mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 23:40:19 +08:00
drivers/rtt: make RTT console optional
This commit is contained in:
@@ -173,8 +173,15 @@ config SERIAL_RTT2
|
|||||||
This option is used to enable the serial driver of channel 2
|
This option is used to enable the serial driver of channel 2
|
||||||
|
|
||||||
config SERIAL_RTT_CONSOLE
|
config SERIAL_RTT_CONSOLE
|
||||||
int "Segger RTT console channel"
|
bool "Segger RTT console support"
|
||||||
depends on SERIAL_RTT
|
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 0 if SERIAL_RTT0
|
||||||
default 1 if SERIAL_RTT1
|
default 1 if SERIAL_RTT1
|
||||||
default 2 if SERIAL_RTT2
|
default 2 if SERIAL_RTT2
|
||||||
|
|||||||
@@ -116,7 +116,9 @@ static struct serial_rtt_s g_serial_rtt0 =
|
|||||||
{
|
{
|
||||||
.uart =
|
.uart =
|
||||||
{
|
{
|
||||||
.isconsole = CONFIG_SERIAL_RTT_CONSOLE == 0,
|
#ifdef CONFIG_SERIAL_RTT_CONSOLE
|
||||||
|
.isconsole = CONFIG_SERIAL_RTT_CONSOLE_CHANNEL == 0,
|
||||||
|
#endif
|
||||||
.recv =
|
.recv =
|
||||||
{
|
{
|
||||||
.buffer = g_rtt0_recv_buffer,
|
.buffer = g_rtt0_recv_buffer,
|
||||||
@@ -149,7 +151,9 @@ static struct serial_rtt_s g_serial_rtt1 =
|
|||||||
{
|
{
|
||||||
.uart =
|
.uart =
|
||||||
{
|
{
|
||||||
.isconsole = CONFIG_SERIAL_RTT_CONSOLE == 1,
|
#ifdef CONFIG_SERIAL_RTT_CONSOLE
|
||||||
|
.isconsole = CONFIG_SERIAL_RTT_CONSOLE_CHANNEL == 1,
|
||||||
|
#endif
|
||||||
.recv =
|
.recv =
|
||||||
{
|
{
|
||||||
.buffer = g_rtt1_recv_buffer,
|
.buffer = g_rtt1_recv_buffer,
|
||||||
@@ -182,7 +186,9 @@ static struct serial_rtt_s g_serial_rtt2 =
|
|||||||
{
|
{
|
||||||
.uart =
|
.uart =
|
||||||
{
|
{
|
||||||
.isconsole = CONFIG_SERIAL_RTT_CONSOLE == 2,
|
#ifdef CONFIG_SERIAL_RTT_CONSOLE
|
||||||
|
.isconsole = CONFIG_SERIAL_RTT_CONSOLE_CHANNEL == 2,
|
||||||
|
#endif
|
||||||
.recv =
|
.recv =
|
||||||
{
|
{
|
||||||
.buffer = g_rtt2_recv_buffer,
|
.buffer = g_rtt2_recv_buffer,
|
||||||
@@ -427,10 +433,12 @@ static void serial_rtt_register(FAR const char *name,
|
|||||||
rtt->uart.recv.size,
|
rtt->uart.recv.size,
|
||||||
SEGGER_RTT_MODE_NO_BLOCK_TRIM);
|
SEGGER_RTT_MODE_NO_BLOCK_TRIM);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SERIAL_RTT_CONSOLE
|
||||||
if (rtt->uart.isconsole)
|
if (rtt->uart.isconsole)
|
||||||
{
|
{
|
||||||
uart_register("/dev/console", &rtt->uart);
|
uart_register("/dev/console", &rtt->uart);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uart_register(name, &rtt->uart);
|
uart_register(name, &rtt->uart);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user