mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 09:49:21 +08:00
drivers/rtt: make RTT console optional
This commit is contained in:
parent
024bdcbca0
commit
4db39d7afd
2 changed files with 19 additions and 4 deletions
|
@ -173,8 +173,15 @@ config SERIAL_RTT2
|
|||
This option is used to enable the serial driver of channel 2
|
||||
|
||||
config SERIAL_RTT_CONSOLE
|
||||
int "Segger RTT console channel"
|
||||
bool "Segger RTT console support"
|
||||
depends on SERIAL_RTT
|
||||
default y
|
||||
---help---
|
||||
If this opsion is selected, then RTT channel can be used as console
|
||||
|
||||
config SERIAL_RTT_CONSOLE_CHANNEL
|
||||
int "Segger RTT console channel"
|
||||
depends on SERIAL_RTT && SERIAL_RTT_CONSOLE
|
||||
default 0 if SERIAL_RTT0
|
||||
default 1 if SERIAL_RTT1
|
||||
default 2 if SERIAL_RTT2
|
||||
|
|
|
@ -116,7 +116,9 @@ static struct serial_rtt_s g_serial_rtt0 =
|
|||
{
|
||||
.uart =
|
||||
{
|
||||
.isconsole = CONFIG_SERIAL_RTT_CONSOLE == 0,
|
||||
#ifdef CONFIG_SERIAL_RTT_CONSOLE
|
||||
.isconsole = CONFIG_SERIAL_RTT_CONSOLE_CHANNEL == 0,
|
||||
#endif
|
||||
.recv =
|
||||
{
|
||||
.buffer = g_rtt0_recv_buffer,
|
||||
|
@ -149,7 +151,9 @@ static struct serial_rtt_s g_serial_rtt1 =
|
|||
{
|
||||
.uart =
|
||||
{
|
||||
.isconsole = CONFIG_SERIAL_RTT_CONSOLE == 1,
|
||||
#ifdef CONFIG_SERIAL_RTT_CONSOLE
|
||||
.isconsole = CONFIG_SERIAL_RTT_CONSOLE_CHANNEL == 1,
|
||||
#endif
|
||||
.recv =
|
||||
{
|
||||
.buffer = g_rtt1_recv_buffer,
|
||||
|
@ -182,7 +186,9 @@ static struct serial_rtt_s g_serial_rtt2 =
|
|||
{
|
||||
.uart =
|
||||
{
|
||||
.isconsole = CONFIG_SERIAL_RTT_CONSOLE == 2,
|
||||
#ifdef CONFIG_SERIAL_RTT_CONSOLE
|
||||
.isconsole = CONFIG_SERIAL_RTT_CONSOLE_CHANNEL == 2,
|
||||
#endif
|
||||
.recv =
|
||||
{
|
||||
.buffer = g_rtt2_recv_buffer,
|
||||
|
@ -427,10 +433,12 @@ static void serial_rtt_register(FAR const char *name,
|
|||
rtt->uart.recv.size,
|
||||
SEGGER_RTT_MODE_NO_BLOCK_TRIM);
|
||||
|
||||
#ifdef CONFIG_SERIAL_RTT_CONSOLE
|
||||
if (rtt->uart.isconsole)
|
||||
{
|
||||
uart_register("/dev/console", &rtt->uart);
|
||||
}
|
||||
#endif
|
||||
|
||||
uart_register(name, &rtt->uart);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue