From 951f4ff4a32ab643c64aaf46fa5457f7dcc4c624 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 19 Feb 2014 17:02:30 -0600 Subject: [PATCH] LM3/4: Several errors were unmasked with UARTs > UART2 were enabled. Fromo Gosha --- ChangeLog | 2 ++ arch/arm/src/lm/lm_lowputc.c | 13 +++++------ arch/arm/src/lm/lm_serial.c | 43 ++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 33f004ba5c..3e62365887 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6624,4 +6624,6 @@ * arch/arm/src/samd/sam_spi.c: Add framework for a SAMD SPI driver. The initial check-in is a crude port of the SAMA5 SPI driver with a lot of missing logic (2014-2-19). + * arch/arm/src/lm/lm_lowputc.c and lm_serial.c: Several errors + are unmasked with UARTs > UART2 are enabled. From gosha (2014-2-19). diff --git a/arch/arm/src/lm/lm_lowputc.c b/arch/arm/src/lm/lm_lowputc.c index ce822538ff..6bb8033145 100644 --- a/arch/arm/src/lm/lm_lowputc.c +++ b/arch/arm/src/lm/lm_lowputc.c @@ -77,31 +77,31 @@ # define LM_CONSOLE_PARITY CONFIG_UART2_PARITY # define LM_CONSOLE_2STOP CONFIG_UART2_2STOP #elif defined(CONFIG_UART3_SERIAL_CONSOLE) -# define LM_CONSOLE_BASE LM_UART2_BASE +# define LM_CONSOLE_BASE LM_UART3_BASE # define LM_CONSOLE_BAUD CONFIG_UART3_BAUD # define LM_CONSOLE_BITS CONFIG_UART3_BITS # define LM_CONSOLE_PARITY CONFIG_UART3_PARITY # define LM_CONSOLE_2STOP CONFIG_UART3_2STOP #elif defined(CONFIG_UART4_SERIAL_CONSOLE) -# define LM_CONSOLE_BASE LM_UART2_BASE +# define LM_CONSOLE_BASE LM_UART4_BASE # define LM_CONSOLE_BAUD CONFIG_UART4_BAUD # define LM_CONSOLE_BITS CONFIG_UART4_BITS # define LM_CONSOLE_PARITY CONFIG_UART4_PARITY # define LM_CONSOLE_2STOP CONFIG_UART4_2STOP #elif defined(CONFIG_UART5_SERIAL_CONSOLE) -# define LM_CONSOLE_BASE LM_UART2_BASE +# define LM_CONSOLE_BASE LM_UART5_BASE # define LM_CONSOLE_BAUD CONFIG_UART5_BAUD # define LM_CONSOLE_BITS CONFIG_UART5_BITS # define LM_CONSOLE_PARITY CONFIG_UART5_PARITY # define LM_CONSOLE_2STOP CONFIG_UART5_2STOP #elif defined(CONFIG_UART6_SERIAL_CONSOLE) -# define LM_CONSOLE_BASE LM_UART2_BASE +# define LM_CONSOLE_BASE LM_UART6_BASE # define LM_CONSOLE_BAUD CONFIG_UART6_BAUD # define LM_CONSOLE_BITS CONFIG_UART6_BITS # define LM_CONSOLE_PARITY CONFIG_UART6_PARITY # define LM_CONSOLE_2STOP CONFIG_UART6_2STOP #elif defined(CONFIG_UART7_SERIAL_CONSOLE) -# define LM_CONSOLE_BASE LM_UART2_BASE +# define LM_CONSOLE_BASE LM_UART7_BASE # define LM_CONSOLE_BAUD CONFIG_UART7_BAUD # define LM_CONSOLE_BITS CONFIG_UART7_BITS # define LM_CONSOLE_PARITY CONFIG_UART7_PARITY @@ -354,7 +354,4 @@ void up_lowsetup(void) ctl |= (UART_CTL_UARTEN|UART_CTL_TXE|UART_CTL_RXE); putreg32(ctl, LM_CONSOLE_BASE+LM_UART_CTL_OFFSET); #endif - } - - diff --git a/arch/arm/src/lm/lm_serial.c b/arch/arm/src/lm/lm_serial.c index 52773608e1..61999d45aa 100644 --- a/arch/arm/src/lm/lm_serial.c +++ b/arch/arm/src/lm/lm_serial.c @@ -960,10 +960,53 @@ static int up_interrupt(int irq, void *context) dev = &g_uart1port; } else +#endif +#ifdef CONFIG_LM_UART2 + if (g_uart2priv.irq == irq) + { + dev = &g_uart2port; + } + else +#endif +#ifdef CONFIG_LM_UART3 + if (g_uart3priv.irq == irq) + { + dev = &g_uart3port; + } + else +#endif +#ifdef CONFIG_LM_UART4 + if (g_uart4priv.irq == irq) + { + dev = &g_uart4port; + } + else +#endif +#ifdef CONFIG_LM_UART5 + if (g_uart5priv.irq == irq) + { + dev = &g_uart5port; + } + else +#endif +#ifdef CONFIG_LM_UART6 + if (g_uart6priv.irq == irq) + { + dev = &g_uart6port; + } + else +#endif +#ifdef CONFIG_LM_UART7 + if (g_uart7priv.irq == irq) + { + dev = &g_uart7port; + } + else #endif { PANIC(); } + priv = (struct up_dev_s*)dev->priv; /* Loop until there are no characters to be transferred or,