diff options
-rw-r--r-- | nuttx/ChangeLog | 2 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/Kconfig | 14 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_serial.c | 11 |
3 files changed, 26 insertions, 1 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index b6c9bcb89..ad37d615b 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -5350,3 +5350,5 @@ * drivers/usbdev/cdcacm.c: Added FIONREAD and FIONWRITE to CDC/ACM driver based on serial.c implementation. From Lorenz Meier (2013-8-10). + * arch/arm/src/stm32/Kconfig and stm32_serial.c: Added option to + disable serial port reordering. From Lorenz Meier (2013-8-10). diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig index 74b7acde3..fc16be6c3 100644 --- a/nuttx/arch/arm/src/stm32/Kconfig +++ b/nuttx/arch/arm/src/stm32/Kconfig @@ -2473,6 +2473,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, however, have 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..037ad07db 100644 --- a/nuttx/arch/arm/src/stm32/stm32_serial.c +++ b/nuttx/arch/arm/src/stm32/stm32_serial.c @@ -2417,7 +2417,13 @@ void up_serialinit(void) #if CONSOLE_UART > 0 (void)uart_register("/dev/console", &uart_devs[CONSOLE_UART - 1]->dev); - (void)uart_register("/dev/ttyS0", &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; /* If we need to re-initialise the console to enable DMA do that here. */ @@ -2425,6 +2431,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 +2441,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 */ |