From 3f1ab83853c43c22e035d5d7e2663ddbb1385d9e Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 28 Jul 2013 14:55:25 +0200 Subject: Added option to disable serial port reordering --- nuttx/arch/arm/src/stm32/Kconfig | 14 ++++++++++++++ nuttx/arch/arm/src/stm32/stm32_serial.c | 9 ++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'nuttx/arch/arm/src/stm32') diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig index 7249b382f..abd8f9898 100644 --- a/nuttx/arch/arm/src/stm32/Kconfig +++ b/nuttx/arch/arm/src/stm32/Kconfig @@ -2417,6 +2417,20 @@ config SERIAL_TERMIOS If this is not defined, then the terminal settings (baud, parity, etc). are not configurable at runtime; serial streams cannot be flushed, etc.. +config SERIAL_DISABLE_REORDERING + bool "Disable reordering of ttySx devices." + depends on STM32_USART1 || STM32_USART2 || STM32_USART3 || STM32_UART4 || STM32_UART5 || STM32_USART6 || STM32_USART7 || STM32_USART8 + default n + ---help--- + NuttX per default reorders the serial ports (/dev/ttySx) so that the + console is always on /dev/ttyS0. If more than one UART is in use this + can have however the side-effect that all port mappings + (hardware USART1 -> /dev/ttyS0) change if the console is moved to another + UART. This is in particular relevant if a project uses the USB console + in some configs and a serial console in other configs, but does not + want the side effect of having all serial port names change when just + the console is moved from serial to USB. + endmenu config STM32_USART_SINGLEWIRE diff --git a/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c index 52a77e255..ff4cd7549 100644 --- a/nuttx/arch/arm/src/stm32/stm32_serial.c +++ b/nuttx/arch/arm/src/stm32/stm32_serial.c @@ -2417,6 +2417,10 @@ void up_serialinit(void) #if CONSOLE_UART > 0 (void)uart_register("/dev/console", &uart_devs[CONSOLE_UART - 1]->dev); +#ifndef CONFIG_SERIAL_DISABLE_REORDERING + /* If not disabled, register the console UART to ttyS0 and exclude + * it from initializing it further down + */ (void)uart_register("/dev/ttyS0", &uart_devs[CONSOLE_UART - 1]->dev); minor = 1; @@ -2425,6 +2429,7 @@ void up_serialinit(void) # ifdef SERIAL_HAVE_CONSOLE_DMA up_dma_setup(&uart_devs[CONSOLE_UART - 1]->dev); # endif +#endif /* CONFIG_SERIAL_DISABLE_REORDERING not defined */ #endif /* CONSOLE_UART > 0 */ @@ -2434,12 +2439,14 @@ void up_serialinit(void) for (i = 0; i < STM32_NUSART; i++) { + +#ifndef CONFIG_SERIAL_DISABLE_REORDERING /* Don't create a device for the console - we did that above */ - if ((uart_devs[i] == 0) || (uart_devs[i]->dev.isconsole)) { continue; } +#endif /* Register USARTs as devices in increasing order */ -- cgit v1.2.3