Added option to disable STM32 serial port re-ordering

This commit is contained in:
Gregory Nutt 2013-08-10 19:29:44 -06:00
parent 3c38992727
commit 217ed87aad
2 changed files with 24 additions and 1 deletions

View File

@ -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

View File

@ -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 */