arch/arm/src/amebad: Minor Updates
#if defined(CONFIG_UART0_SERIAL_CONSOLE)
#define CONSOLE_DEV g_uart0port /* UART0 is console */
#define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */
+#define CONSOLE UART0_DEV
#define UART0_ASSIGNED 1
#define HAVE_SERIAL_CONSOLE
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
#define CONSOLE_DEV g_uart1port /* UART1 is console */
#define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */
+#define CONSOLE UART1_DEV
#define UART1_ASSIGNED 1
#define HAVE_SERIAL_CONSOLE
#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
#define CONSOLE_DEV g_uart2port /* UART2 is console */
#define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */
+#define CONSOLE UART2_DEV
#define UART2_ASSIGNED 1
#define HAVE_SERIAL_CONSOLE
#else
#define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */
#define UART2_ASSIGNED 1
#endif
+#define CHAR_TIMEOUT 6540
/****************************************************************************
* Private Types
@@ -376,7 +380,7 @@ static u32 uart_index_get(PinName tx)
static void LOGUART_PutChar_RAM(u8 c)
{
- UART_TypeDef* LOGUART = UART2_DEV;
+ UART_TypeDef* LOGUART = CONSOLE;
u32 CounterIndex = 0;
if (ConfigDebugClose == 1)
@@ -384,7 +388,7 @@ static void LOGUART_PutChar_RAM(u8 c)
while(1) {
CounterIndex++;
- if (CounterIndex >=6540)
+ if (CounterIndex >= CHAR_TIMEOUT)
break;
if (LOGUART->LSR & RUART_LINE_STATUS_REG_THRE)
@@ -708,11 +712,14 @@ void up_serialinit(void)
UART_DeInit(UART2_DEV);
UART_ClearRxFifo(UART2_DEV);
UART_ClearTxFifo(UART2_DEV);
+
+#ifdef CONSOLE_DEV
CONSOLE_DEV.isconsole = true;
rtl8721d_up_setup(&CONSOLE_DEV);
/* Register the console */
uart_register("/dev/console", &CONSOLE_DEV);
+#endif
/* Register all UARTs */
#ifdef TTYS0_DEV
