1
0
Fork 0
forked from nuttx/nuttx-update

drivers/rtt: add rtt syslog channel configuration

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2023-07-10 21:07:15 +08:00 committed by Xiang Xiao
parent 3f9a76e131
commit bc181f3f9c
2 changed files with 12 additions and 4 deletions

View file

@ -122,6 +122,14 @@ config SYSLOG_RTT
---help---
Use Segger J-Link RTT as a SYSLOG output device.
if SYSLOG_RTT
config SYSLOG_RTT_CHANNEL
int "SYSLOG RTT channel"
default 0
---help---
SYSLOG RTT channel number
endif
config SERIAL_RTT
bool
select SEGGER_RTT

View file

@ -32,14 +32,14 @@
int syslog_rtt_putc(FAR struct syslog_channel_s *channel, int ch)
{
SEGGER_RTT_BLOCK_IF_FIFO_FULL(0);
SEGGER_RTT_PutChar(0, ch);
SEGGER_RTT_BLOCK_IF_FIFO_FULL(CONFIG_SYSLOG_RTT_CHANNEL);
SEGGER_RTT_PutChar(CONFIG_SYSLOG_RTT_CHANNEL, ch);
return ch;
}
ssize_t syslog_rtt_write(FAR struct syslog_channel_s *channel,
FAR const char *buffer, size_t buflen)
{
SEGGER_RTT_BLOCK_IF_FIFO_FULL(0);
return SEGGER_RTT_Write(0, buffer, buflen);
SEGGER_RTT_BLOCK_IF_FIFO_FULL(CONFIG_SYSLOG_RTT_CHANNEL);
return SEGGER_RTT_Write(CONFIG_SYSLOG_RTT_CHANNEL, buffer, buflen);
}