diff options
Diffstat (limited to 'nuttx/arch/arm/src')
-rw-r--r-- | nuttx/arch/arm/src/imx/Kconfig | 19 | ||||
-rw-r--r-- | nuttx/arch/arm/src/imx/imx_serial.c | 66 | ||||
-rw-r--r-- | nuttx/arch/arm/src/lm3s/lm3s_lowputc.c | 16 | ||||
-rw-r--r-- | nuttx/arch/arm/src/lm3s/lm3s_serial.c | 62 |
4 files changed, 88 insertions, 75 deletions
diff --git a/nuttx/arch/arm/src/imx/Kconfig b/nuttx/arch/arm/src/imx/Kconfig index 879f50ef7..e1081aefe 100644 --- a/nuttx/arch/arm/src/imx/Kconfig +++ b/nuttx/arch/arm/src/imx/Kconfig @@ -3,4 +3,21 @@ # see misc/tools/kconfig-language.txt. # -comment "i.MX Configuration Options" +if ARCH_CHIP_IMX + +config IMX_UART0 + bool "UART0" + select ARCH_HAVE_UART0 + default n + +config IMX_UART1 + bool "UART1" + select ARCH_HAVE_UART1 + default n + +config IMX_UART2 + bool "UART2" + select ARCH_HAVE_UART2 + default n + +endif diff --git a/nuttx/arch/arm/src/imx/imx_serial.c b/nuttx/arch/arm/src/imx/imx_serial.c index 26e6592be..07c9312f4 100644 --- a/nuttx/arch/arm/src/imx/imx_serial.c +++ b/nuttx/arch/arm/src/imx/imx_serial.c @@ -71,8 +71,8 @@ /* The i.MXL chip has only two UARTs */ -#if defined(CONFIG_ARCH_CHIP_IMXL) && !defined(CONFIG_UART3_DISABLE) -# define CONFIG_UART3_DISABLE 1 +#if defined(CONFIG_ARCH_CHIP_IMXL) && defined(CONFIG_IMX_UART3) +# undef CONFIG_IMX_UART3 #endif /**************************************************************************** @@ -144,24 +144,24 @@ struct uart_ops_s g_uart_ops = /* I/O buffers */ -#ifndef CONFIG_UART1_DISABLE +#ifdef CONFIG_IMX_UART1 static char g_uart1rxbuffer[CONFIG_UART1_RXBUFSIZE]; static char g_uart1txbuffer[CONFIG_UART1_TXBUFSIZE]; #endif -#ifndef CONFIG_UART2_DISABLE +#ifdef CONFIG_IMX_UART2 static char g_uart2rxbuffer[CONFIG_UART2_RXBUFSIZE]; static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE]; #endif -#ifndef CONFIG_UART3_DISABLE +#ifdef CONFIG_IMX_UART3 static char g_uart3rxbuffer[CONFIG_UART2_RXBUFSIZE]; static char g_uart3txbuffer[CONFIG_UART2_TXBUFSIZE]; #endif /* This describes the state of the IMX uart1 port. */ -#ifndef CONFIG_UART1_DISABLE +#ifdef CONFIG_IMX_UART1 static struct up_dev_s g_uart1priv = { .uartbase = IMX_UART1_VBASE, @@ -196,7 +196,7 @@ static uart_dev_t g_uart1port = /* This describes the state of the IMX uart2 port. */ -#ifndef CONFIG_UART2_DISABLE +#ifdef CONFIG_IMX_UART2 static struct up_dev_s g_uart2priv = { .uartbase = IMX_UART2_VBASE, @@ -229,7 +229,7 @@ static uart_dev_t g_uart2port = }; #endif -#ifndef CONFIG_UART3_DISABLE +#ifdef CONFIG_IMX_UART3 static struct up_dev_s g_uart3priv = { .uartbase = IMX_UART3_REGISTER_BASE, @@ -264,19 +264,19 @@ static uart_dev_t g_uart3port = /* Now, which one with be tty0/console and which tty1 and tty2? */ -#if defined(CONFIG_UART1_SERIAL_CONSOLE) && !defined(CONFIG_UART1_DISABLE) +#if defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_IMX_UART1) # define CONSOLE_DEV g_uart1port /* UART1 is /dev/console */ # undef CONFIG_UART2_SERIAL_CONSOLE # undef CONFIG_UART3_SERIAL_CONSOLE # define TTYS0_DEV g_uart1port /* UART1 is /dev/ttyS0 */ -# if !defined(CONFIG_UART2_DISABLE) +# if defined(CONFIG_IMX_UART2) # define TTYS1_DEV g_uart2port /* UART2 is /dev/ttyS1 */ -# if !defined(CONFIG_UART3_DISABLE) +# if defined(CONFIG_IMX_UART3) # define TTYS2_DEV g_uart3port /* UART3 is /dev/ttyS2 */ # else # undef TTYS2_DEV /* No /dev/ttyS2 */ # endif -# elif !defined(CONFIG_UART3_DISABLE) +# elif defined(CONFIG_IMX_UART3) # define TTYS1_DEV g_uart3port /* UART3 is /dev/ttyS1 */ # undef TTYS2_DEV /* No /dev/ttyS2 */ # else @@ -284,38 +284,38 @@ static uart_dev_t g_uart3port = # undef TTYS2_DEV /* No /dev/ttyS2 */ # endif -#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && !defined(CONFIG_UART2_DISABLE) +#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_IMX_UART2) # define CONSOLE_DEV g_uart2port /* UART2 is /dev/console */ # undef CONFIG_UART1_SERIAL_CONSOLE # undef CONFIG_UART3_SERIAL_CONSOLE # define TTYS0_DEV g_uart2port /* UART2 is /dev/ttyS0 */ -# if !defined(CONFIG_UART1_DISABLE) +# if defined(CONFIG_IMX_UART1) # define TTYS1_DEV g_uart1port /* UART1 is /dev/ttyS1 */ -# if !defined(CONFIG_UART3_DISABLE) +# if defined(CONFIG_IMX_UART3) # define TTYS2_DEV g_uart3port /* UART3 is /dev/ttyS2 */ # else # undef TTYS2_DEV /* No /dev/ttyS2 */ # endif -# elif !defined(CONFIG_UART3_DISABLE) +# elif defined(CONFIG_IMX_UART3) # define TTYS1_DEV g_uart3port /* UART3 is /dev/ttyS1 */ # else # undef TTYS1_DEV /* No /dev/ttyS1 */ # undef TTYS2_DEV /* No /dev/ttyS2 */ # endif -#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && !defined(CONFIG_UART3_DISABLE) +#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_IMX_UART3) # define CONSOLE_DEV g_uart3port /* UART3 is /dev/console */ # undef CONFIG_UART1_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE # define TTYS0_DEV g_uart3port /* UART3 is /dev/ttyS0 */ -# if !defined(CONFIG_UART1_DISABLE) +# if defined(CONFIG_IMX_UART1) # define TTYS1_DEV g_uart1port /* UART1 is /dev/ttyS1 */ -# if !defined(CONFIG_UART2_DISABLE) +# if defined(CONFIG_IMX_UART2) # define TTYS2_DEV g_uart2port /* UART2 is /dev/ttyS2 */ # else # undef TTYS2_DEV /* No /dev/ttyS2 */ # endif -# elif !defined(CONFIG_UART2_DISABLE) +# elif defined(CONFIG_IMX_UART2) # define TTYS1_DEV g_uart2port /* UART2 is /dev/ttyS1 */ # undef TTYS2_DEV /* No /dev/ttyS2 */ # else @@ -329,16 +329,16 @@ static uart_dev_t g_uart3port = # undef CONFIG_UART2_SERIAL_CONSOLE # undef CONFIG_UART3_SERIAL_CONSOLE -# if !defined(CONFIG_UART1_DISABLE) +# if defined(CONFIG_IMX_UART1) # define TTYS0_DEV g_uart1port /* UART1 is /dev/ttyS0 */ -# if !defined(CONFIG_UART2_DISABLE) +# if defined(CONFIG_IMX_UART2) # define TTYS1_DEV g_uart2port /* UART2 is /dev/ttyS1 */ -# if !defined(CONFIG_UART3_DISABLE) +# if defined(CONFIG_IMX_UART3) # define TTYS2_DEV g_uart3port /* UART3 is /dev/ttyS2 */ # else # undef TTYS2_DEV /* No /dev/ttyS2 */ # endif -# elif !defined(CONFIG_UART3_DISABLE) +# elif defined(CONFIG_IMX_UART3) # define TTYS1_DEV g_uart3port /* UART3 is /dev/ttyS1 */ # undef TTYS2_DEV /* No /dev/ttyS2 */ # else @@ -346,16 +346,16 @@ static uart_dev_t g_uart3port = # undef TTYS2_DEV /* No /dev/ttyS2 */ # endif -# elif !defined(CONFIG_UART2_DISABLE) +# elif defined(CONFIG_IMX_UART2) # define TTYS0_DEV g_uart2port /* UART2 is /dev/ttyS0 */ # undef TTYS2_DEV /* No /dev/ttyS2 */ -# if !defined(CONFIG_UART3_DISABLE) +# if defined(CONFIG_IMX_UART3) # define TTYS1_DEV g_uart2port /* UART2 is /dev/ttyS1 */ # else # undef TTYS1_DEV /* No /dev/ttyS1 */ # endif -# elif !defined(CONFIG_UART3_DISABLE) +# elif defined(CONFIG_IMX_UART3) # define TTYS0_DEV g_uart3port /* UART3 is /dev/ttyS0 */ # undef TTYS1_DEV /* No /dev/ttyS1 */ # undef TTYS2_DEV /* No /dev/ttyS2 */ @@ -765,7 +765,7 @@ static inline struct uart_dev_s *up_mapirq(int irq) switch (irq) { -#ifndef CONFIG_UART1_DISABLE +#ifdef CONFIG_IMX_UART1 #if defined(CONFIG_ARCH_CHIP_IMX1) || defined(CONFIG_ARCH_CHIP_IMXL) case IMX_IRQ_UART1RX: case IMX_IRQ_UART1TX: @@ -776,7 +776,7 @@ static inline struct uart_dev_s *up_mapirq(int irq) break; #endif -#ifndef CONFIG_UART2_DISABLE +#ifdef CONFIG_IMX_UART2 #if defined(CONFIG_ARCH_CHIP_IMX1) || defined(CONFIG_ARCH_CHIP_IMXL) case IMX_IRQ_UART2RX: case IMX_IRQ_UART2TX: @@ -787,7 +787,7 @@ static inline struct uart_dev_s *up_mapirq(int irq) break; #endif -#ifndef CONFIG_UART3_DISABLE +#ifdef CONFIG_IMX_UART3 #if defined(CONFIG_ARCH_CHIP_IMX1) || defined(CONFIG_ARCH_CHIP_IMXL) case IMX_IRQ_UART3RX: case IMX_IRQ_UART3TX: @@ -1068,7 +1068,7 @@ void up_earlyserialinit(void) { /* Configure and disable the UART1 */ -#ifndef CONFIG_UART1_DISABLE +#ifdef CONFIG_IMX_UART1 up_serialout(&g_uart1priv, UART_UCR1, 0); up_serialout(&g_uart1priv, UART_UCR2, 0); @@ -1082,7 +1082,7 @@ void up_earlyserialinit(void) /* Configure and disable the UART2 */ -#ifndef CONFIG_UART2_DISABLE +#ifdef CONFIG_IMX_UART2 up_serialout(&g_uart2priv, UART_UCR1, 0); up_serialout(&g_uart2priv, UART_UCR2, 0); @@ -1098,7 +1098,7 @@ void up_earlyserialinit(void) /* Configure and disable the UART3 */ -#ifndef CONFIG_UART3_DISABLE +#ifdef CONFIG_IMX_UART3 up_serialout(&g_uart3priv, UART_UCR1, 0); up_serialout(&g_uart3priv, UART_UCR2, 0); diff --git a/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c b/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c index 69ac56a9d..b1cb21b2c 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c @@ -55,28 +55,26 @@ /* Configuration **********************************************************/ #if LM3S_NUARTS < 2 -# undef CONFIG_UART1_DISABLE +# undef CONFIG_LM3S_UART1 # undef CONFIG_UART1_SERIAL_CONSOLE -# define CONFIG_UART1_DISABLE 1 #endif #if LM3S_NUARTS < 3 -# undef CONFIG_UART2_DISABLE +# undef CONFIG_LM3S_UART2 # undef CONFIG_UART2_SERIAL_CONSOLE -# define CONFIG_UART2_DISABLE 1 #endif /* Is there a serial console? */ -#if defined(CONFIG_UART0_SERIAL_CONSOLE) && !defined(CONFIG_UART0_DISABLE) +#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART0) # undef CONFIG_UART1_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE # define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && !defined(CONFIG_UART1_DISABLE) +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART1) # undef CONFIG_UART0_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE # define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && !defined(CONFIG_UART2_DISABLE) +#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART2) # undef CONFIG_UART0_SERIAL_CONSOLE # undef CONFIG_UART1_SERIAL_CONSOLE # define HAVE_CONSOLE 1 @@ -258,7 +256,7 @@ void up_lowsetup(void) * this pin configuration -- whether or not a serial console is selected. */ -#ifndef CONFIG_UART0_DISABLE +#ifdef CONFIG_LM3S_UART0 regval = getreg32(LM3S_SYSCON_RCGC1); regval |= SYSCON_RCGC1_UART0; putreg32(regval, LM3S_SYSCON_RCGC1); @@ -267,7 +265,7 @@ void up_lowsetup(void) lm3s_configgpio(GPIO_UART0_TX); #endif -#ifndef CONFIG_UART1_DISABLE +#ifdef CONFIG_LM3S_UART1 regval = getreg32(LM3S_SYSCON_RCGC1); regval |= SYSCON_RCGC1_UART1; putreg32(regval, LM3S_SYSCON_RCGC1); diff --git a/nuttx/arch/arm/src/lm3s/lm3s_serial.c b/nuttx/arch/arm/src/lm3s/lm3s_serial.c index 51f9ce955..7ed9b6fa8 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_serial.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_serial.c @@ -67,34 +67,32 @@ /* Some sanity checks *******************************************************/ #if LM3S_NUARTS < 2 -# undef CONFIG_UART1_DISABLE +# undef CONFIG_LM3S_UART1 # undef CONFIG_UART1_SERIAL_CONSOLE -# define CONFIG_UART1_DISABLE 1 #endif #if LM3S_NUARTS < 3 -# undef CONFIG_UART2_DISABLE +# undef CONFIG_LM3S_UART2 # undef CONFIG_UART2_SERIAL_CONSOLE -# define CONFIG_UART2_DISABLE 1 #endif /* Is there a UART enabled? */ -#if defined(CONFIG_UART0_DISABLE) && defined(CONFIG_UART1_DISABLE) +#if !defined(CONFIG_LM3S_UART0) && !defined(CONFIG_LM3S_UART1) && !defined(CONFIG_LM3S_UART2) # error "No UARTs enabled" #endif /* Is there a serial console? */ -#if defined(CONFIG_UART0_SERIAL_CONSOLE) && !defined(CONFIG_UART0_DISABLE) +#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART0) # undef CONFIG_UART1_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE # define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && !defined(CONFIG_UART1_DISABLE) +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART1) # undef CONFIG_UART0_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE # define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && !defined(CONFIG_UART2_DISABLE) +#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART2) # undef CONFIG_UART0_SERIAL_CONSOLE # undef CONFIG_UART1_SERIAL_CONSOLE # define HAVE_CONSOLE 1 @@ -117,16 +115,16 @@ #if defined(CONFIG_UART0_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart0port /* UART0 is console */ # define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */ -# ifndef CONFIG_UART1_DISABLE +# ifdef CONFIG_LM3S_UART1 # define TTYS1_DEV g_uart1port /* UART1 is ttyS1 */ -# ifndef CONFIG_UART2_DISABLE +# ifdef CONFIG_LM3S_UART2 # define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # else # undef TTYS2_DEV /* No ttyS2 */ # endif # else # undef TTYS2_DEV /* No ttyS2 */ -# ifndef CONFIG_UART2_DISABLE +# ifdef CONFIG_LM3S_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ @@ -135,16 +133,16 @@ #elif defined(CONFIG_UART1_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart1port /* UART1 is console */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ -# ifndef CONFIG_UART0_DISABLE +# ifdef CONFIG_LM3S_UART0 # define TTYS1_DEV g_uart0port /* UART0 is ttyS1 */ -# ifndef CONFIG_UART2_DISABLE +# ifdef CONFIG_LM3S_UART2 # define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # else # undef TTYS2_DEV /* No ttyS2 */ # endif # else # undef TTYS2_DEV /* No ttyS2 */ -# ifndef CONFIG_UART2_DISABLE +# ifdef CONFIG_LM3S_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ @@ -153,49 +151,49 @@ #elif defined(CONFIG_UART2_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart2port /* UART2 is console */ # define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ -# ifndef CONFIG_UART0_DISABLE +# ifdef CONFIG_LM3S_UART0 # define TTYS1_DEV g_uart0port /* UART0 is ttyS1 */ -# ifndef CONFIG_UART2_DISABLE +# ifdef CONFIG_LM3S_UART2 # define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # else # undef TTYS2_DEV /* No ttyS2 */ # endif # else # undef TTYS2_DEV /* No ttyS2 */ -# ifndef CONFIG_UART2_DISABLE +# ifdef CONFIG_LM3S_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ # endif # endif -#elif !defined(CONFIG_UART0_DISABLE) +#elifdefined(CONFIG_LM3S_UART0) # undef CONSOLE_DEV /* No console device */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ -# ifndef CONFIG_UART1_DISABLE +# ifdef CONFIG_LM3S_UART1 # define TTYS1_DEV g_uart1port /* UART1 is ttyS1 */ -# ifndef CONFIG_UART2_DISABLE +# ifdef CONFIG_LM3S_UART2 # define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # else # undef TTYS2_DEV /* No ttyS2 */ # endif # else # undef TTYS2_DEV /* No ttyS2 */ -# ifndef CONFIG_UART2_DISABLE +# ifdef CONFIG_LM3S_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ # endif # endif -#elif !defined(CONFIG_UART1_DISABLE) +#elifdefined(CONFIG_LM3S_UART1) # undef CONSOLE_DEV /* No console device */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ # undef TTYS2_DEV /* No ttyS2 */ -# ifndef CONFIG_UART2_DISABLE +# ifdef CONFIG_LM3S_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ # endif -#elif !defined(CONFIG_UART2_DISABLE) +#elifdefined(CONFIG_LM3S_UART2) # undef CONSOLE_DEV /* No console device */ # define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ # undef TTYS1_DEV /* No ttyS1 */ @@ -263,22 +261,22 @@ struct uart_ops_s g_uart_ops = /* I/O buffers */ -#ifndef CONFIG_UART0_DISABLE +#ifdef CONFIG_LM3S_UART0 static char g_uart0rxbuffer[CONFIG_UART0_RXBUFSIZE]; static char g_uart0txbuffer[CONFIG_UART0_TXBUFSIZE]; #endif -#ifndef CONFIG_UART1_DISABLE +#ifdef CONFIG_LM3S_UART1 static char g_uart1rxbuffer[CONFIG_UART1_RXBUFSIZE]; static char g_uart1txbuffer[CONFIG_UART1_TXBUFSIZE]; #endif -#ifndef CONFIG_UART2_DISABLE +#ifdef CONFIG_LM3S_UART2 static char g_uart2rxbuffer[CONFIG_UART2_RXBUFSIZE]; static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE]; #endif /* This describes the state of the LM3S uart0 port. */ -#ifndef CONFIG_UART0_DISABLE +#ifdef CONFIG_LM3S_UART0 static struct up_dev_s g_uart0priv = { .uartbase = LM3S_UART0_BASE, @@ -308,7 +306,7 @@ static uart_dev_t g_uart0port = /* This describes the state of the LM3S uart1 port. */ -#ifndef CONFIG_UART1_DISABLE +#ifdef CONFIG_LM3S_UART1 static struct up_dev_s g_uart1priv = { .uartbase = LM3S_UART1_BASE, @@ -338,7 +336,7 @@ static uart_dev_t g_uart1port = /* This describes the state of the LM3S uart1 port. */ -#ifndef CONFIG_UART2_DISABLE +#ifdef CONFIG_LM3S_UART2 static struct up_dev_s g_uart2priv = { .uartbase = LM3S_UART2_BASE, @@ -688,14 +686,14 @@ static int up_interrupt(int irq, void *context) int passes; bool handled; -#ifndef CONFIG_UART0_DISABLE +#ifdef CONFIG_LM3S_UART0 if (g_uart0priv.irq == irq) { dev = &g_uart0port; } else #endif -#ifndef CONFIG_UART1_DISABLE +#ifdef CONFIG_LM3S_UART1 if (g_uart1priv.irq == irq) { dev = &g_uart1port; |