From b0f3bed36468768636a78d2493512a510b76dadf Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 24 Mar 2013 20:40:40 +0000 Subject: Fix LM4F120 LaunchPad serial output. Add support for all 7 LM4F120 UARTs git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5782 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/lm/chip/lm4f_pinmap.h | 4 +- nuttx/arch/arm/src/lm/lm_gpio.h | 36 +- nuttx/arch/arm/src/lm/lm_lowputc.c | 125 ++++--- nuttx/arch/arm/src/lm/lm_lowputc.h | 118 +++++++ nuttx/arch/arm/src/lm/lm_serial.c | 547 +++++++++++++++++++++++-------- 5 files changed, 645 insertions(+), 185 deletions(-) (limited to 'nuttx/arch/arm') diff --git a/nuttx/arch/arm/src/lm/chip/lm4f_pinmap.h b/nuttx/arch/arm/src/lm/chip/lm4f_pinmap.h index 771eb9d2c..6f4bc27a6 100644 --- a/nuttx/arch/arm/src/lm/chip/lm4f_pinmap.h +++ b/nuttx/arch/arm/src/lm/chip/lm4f_pinmap.h @@ -167,8 +167,8 @@ # define GPIO_UART1_RX_2 (GPIO_FUNC_PFINPUT | GPIO_ALT_2 | GPIO_PORTC | GPIO_PIN_4) # define GPIO_UART1_TX_1 (GPIO_FUNC_PFOUTPUT | GPIO_ALT_1 | GPIO_PORTB | GPIO_PIN_1) # define GPIO_UART1_TX_2 (GPIO_FUNC_PFOUTPUT | GPIO_ALT_2 | GPIO_PORTC | GPIO_PIN_5) -# define GPIO_UART2_RX_1 (GPIO_FUNC_PFINPUT | GPIO_ALT_1 | GPIO_PORTD | GPIO_PIN_6) -# define GPIO_UART2_TX_2 (GPIO_FUNC_PFOUTPUT | GPIO_ALT_1 | GPIO_PORTD | GPIO_PIN_7) +# define GPIO_UART2_RX (GPIO_FUNC_PFINPUT | GPIO_ALT_1 | GPIO_PORTD | GPIO_PIN_6) +# define GPIO_UART2_TX (GPIO_FUNC_PFOUTPUT | GPIO_ALT_1 | GPIO_PORTD | GPIO_PIN_7) # define GPIO_UART3_RX (GPIO_FUNC_PFINPUT | GPIO_ALT_1 | GPIO_PORTC | GPIO_PIN_6) # define GPIO_UART3_TX (GPIO_FUNC_PFOUTPUT | GPIO_ALT_1 | GPIO_PORTC | GPIO_PIN_7) # define GPIO_UART4_RX (GPIO_FUNC_PFINPUT | GPIO_ALT_1 | GPIO_PORTC | GPIO_PIN_4) diff --git a/nuttx/arch/arm/src/lm/lm_gpio.h b/nuttx/arch/arm/src/lm/lm_gpio.h index 6aa847e07..a8206c109 100644 --- a/nuttx/arch/arm/src/lm/lm_gpio.h +++ b/nuttx/arch/arm/src/lm/lm_gpio.h @@ -123,24 +123,24 @@ #ifdef LM4F # define GPIO_ALT_SHIFT 16 /* Bits 16-19: Alternate function */ -# define GPIO_ALT_MASK (15 << GPIO_INT_SHIFT) -# define GPIO_ALT(n) ((n) << GPIO_INT_SHIFT) -# define GPIO_ALT_NONE (0 << GPIO_INT_SHIFT) -# define GPIO_ALT_1 (1 << GPIO_INT_SHIFT) -# define GPIO_ALT_2 (2 << GPIO_INT_SHIFT) -# define GPIO_ALT_3 (3 << GPIO_INT_SHIFT) -# define GPIO_ALT_4 (4 << GPIO_INT_SHIFT) -# define GPIO_ALT_5 (5 << GPIO_INT_SHIFT) -# define GPIO_ALT_6 (6 << GPIO_INT_SHIFT) -# define GPIO_ALT_7 (7 << GPIO_INT_SHIFT) -# define GPIO_ALT_8 (8 << GPIO_INT_SHIFT) -# define GPIO_ALT_9 (9 << GPIO_INT_SHIFT) -# define GPIO_ALT_10 (10 << GPIO_INT_SHIFT) -# define GPIO_ALT_11 (11 << GPIO_INT_SHIFT) -# define GPIO_ALT_12 (12 << GPIO_INT_SHIFT) -# define GPIO_ALT_13 (13 << GPIO_INT_SHIFT) -# define GPIO_ALT_14 (14 << GPIO_INT_SHIFT) -# define GPIO_ALT_15 (15 << GPIO_INT_SHIFT) +# define GPIO_ALT_MASK (15 << GPIO_ALT_SHIFT) +# define GPIO_ALT(n) ((n) << GPIO_ALT_SHIFT) +# define GPIO_ALT_NONE (0 << GPIO_ALT_SHIFT) +# define GPIO_ALT_1 (1 << GPIO_ALT_SHIFT) +# define GPIO_ALT_2 (2 << GPIO_ALT_SHIFT) +# define GPIO_ALT_3 (3 << GPIO_ALT_SHIFT) +# define GPIO_ALT_4 (4 << GPIO_ALT_SHIFT) +# define GPIO_ALT_5 (5 << GPIO_ALT_SHIFT) +# define GPIO_ALT_6 (6 << GPIO_ALT_SHIFT) +# define GPIO_ALT_7 (7 << GPIO_ALT_SHIFT) +# define GPIO_ALT_8 (8 << GPIO_ALT_SHIFT) +# define GPIO_ALT_9 (9 << GPIO_ALT_SHIFT) +# define GPIO_ALT_10 (10 << GPIO_ALT_SHIFT) +# define GPIO_ALT_11 (11 << GPIO_ALT_SHIFT) +# define GPIO_ALT_12 (12 << GPIO_ALT_SHIFT) +# define GPIO_ALT_13 (13 << GPIO_ALT_SHIFT) +# define GPIO_ALT_14 (14 << GPIO_ALT_SHIFT) +# define GPIO_ALT_15 (15 << GPIO_ALT_SHIFT) #endif /* If the pin is an GPIO digital output, then this identifies the initial output value: diff --git a/nuttx/arch/arm/src/lm/lm_lowputc.c b/nuttx/arch/arm/src/lm/lm_lowputc.c index d461cd52e..ce822538f 100644 --- a/nuttx/arch/arm/src/lm/lm_lowputc.c +++ b/nuttx/arch/arm/src/lm/lm_lowputc.c @@ -54,41 +54,8 @@ /************************************************************************** * Pre-processor Definitions **************************************************************************/ - /* Configuration **********************************************************/ -#if LM_NUARTS < 2 -# undef CONFIG_LM_UART1 -# undef CONFIG_UART1_SERIAL_CONSOLE -#endif - -#if LM_NUARTS < 3 -# undef CONFIG_LM_UART2 -# undef CONFIG_UART2_SERIAL_CONSOLE -#endif - -/* Is there a serial console? */ - -#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LM_UART0) -# undef CONFIG_UART1_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LM_UART1) -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART1_SERIAL_CONSOLE -# define HAVE_CONSOLE 1 -#else -# warning "No valid CONFIG_UARTn_SERIAL_CONSOLE Setting" -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART1_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# undef HAVE_CONSOLE -#endif - /* Select UART parameters for the selected console */ #if defined(CONFIG_UART0_SERIAL_CONSOLE) @@ -109,6 +76,36 @@ # define LM_CONSOLE_BITS CONFIG_UART2_BITS # 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_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_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_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_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_BAUD CONFIG_UART7_BAUD +# define LM_CONSOLE_BITS CONFIG_UART7_BITS +# define LM_CONSOLE_PARITY CONFIG_UART7_PARITY +# define LM_CONSOLE_2STOP CONFIG_UART7_2STOP #else # error "No CONFIG_UARTn_SERIAL_CONSOLE Setting" #endif @@ -226,7 +223,7 @@ void up_lowputc(char ch) { -#ifdef HAVE_CONSOLE +#ifdef HAVE_SERIAL_CONSOLE /* Wait until the TX FIFO is not full */ while ((getreg32(LM_CONSOLE_BASE+LM_UART_FR_OFFSET) & UART_FR_TXFF) != 0); @@ -250,11 +247,11 @@ void up_lowputc(char ch) void up_lowsetup(void) { uint32_t regval; -#if defined(HAVE_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG) +#if defined(HAVE_SERIAL_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG) uint32_t ctl; #endif - /* Enable the selected UARTs and configure GPIO pins to need by the + /* Enable the selected UARTs and configure GPIO pins needed by the * the selected UARTs. NOTE: The serial driver later depends on * this pin configuration -- whether or not a serial console is selected. */ @@ -277,9 +274,63 @@ void up_lowsetup(void) lm_configgpio(GPIO_UART1_TX); #endif +#ifdef CONFIG_LM_UART2 + regval = getreg32(LM_SYSCON_RCGC1); + regval |= SYSCON_RCGC1_UART2; + putreg32(regval, LM_SYSCON_RCGC1); + + lm_configgpio(GPIO_UART2_RX); + lm_configgpio(GPIO_UART2_TX); +#endif + +#ifdef CONFIG_LM_UART3 + regval = getreg32(LM_SYSCON_RCGCUART); + regval |= SYSCON_RCGCUART_R3; + putreg32(regval, LM_SYSCON_RCGCUART); + + lm_configgpio(GPIO_UART3_RX); + lm_configgpio(GPIO_UART3_TX); +#endif + +#ifdef CONFIG_LM_UART4 + regval = getreg32(LM_SYSCON_RCGCUART); + regval |= SYSCON_RCGCUART_R4; + putreg32(regval, LM_SYSCON_RCGCUART); + + lm_configgpio(GPIO_UART4_RX); + lm_configgpio(GPIO_UART4_TX); +#endif + +#ifdef CONFIG_LM_UART5 + regval = getreg32(LM_SYSCON_RCGCUART); + regval |= SYSCON_RCGCUART_R5; + putreg32(regval, LM_SYSCON_RCGCUART); + + lm_configgpio(GPIO_UART5_RX); + lm_configgpio(GPIO_UART5_TX); +#endif + +#ifdef CONFIG_LM_UART6 + regval = getreg32(LM_SYSCON_RCGCUART); + regval |= SYSCON_RCGCUART_R6; + putreg32(regval, LM_SYSCON_RCGCUART); + + lm_configgpio(GPIO_UART6_RX); + lm_configgpio(GPIO_UART6_TX); +#endif + +#ifdef CONFIG_LM_UART7 + regval = getreg32(LM_SYSCON_RCGCUART); + regval |= SYSCON_RCGCUART_R7; + putreg32(regval, LM_SYSCON_RCGCUART); + + lm_configgpio(GPIO_UART7_RX); + lm_configgpio(GPIO_UART7_TX); +#endif + /* Enable the selected console device */ -#if defined(HAVE_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG) +#if defined(HAVE_SERIAL_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG) /* Disable the UART by clearing the UARTEN bit in the UART CTL register */ ctl = getreg32(LM_CONSOLE_BASE+LM_UART_CTL_OFFSET); diff --git a/nuttx/arch/arm/src/lm/lm_lowputc.h b/nuttx/arch/arm/src/lm/lm_lowputc.h index 49d6e2df9..cc9a5d0ca 100644 --- a/nuttx/arch/arm/src/lm/lm_lowputc.h +++ b/nuttx/arch/arm/src/lm/lm_lowputc.h @@ -45,6 +45,124 @@ /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ +/* Configuration *******************************************************************/ + +#if LM_NUARTS < 8 +# undef CONFIG_LM_UART7 +# undef CONFIG_UART7_SERIAL_CONSOLE +# if LM_NUARTS < 7 +# undef CONFIG_LM_UART6 +# undef CONFIG_UART6_SERIAL_CONSOLE +# if LM_NUARTS < 6 +# undef CONFIG_LM_UART5 +# undef CONFIG_UART5_SERIAL_CONSOLE +# if LM_NUARTS < 5 +# undef CONFIG_LM_UART4 +# undef CONFIG_UART4_SERIAL_CONSOLE +# if LM_NUARTS < 4 +# undef CONFIG_LM_UART3 +# undef CONFIG_UART3_SERIAL_CONSOLE +# if LM_NUARTS < 3 +# undef CONFIG_LM_UART2 +# undef CONFIG_UART2_SERIAL_CONSOLE +# if LM_NUARTS < 2 +# undef CONFIG_LM_UART1 +# undef CONFIG_UART1_SERIAL_CONSOLE +# endif +# endif +# endif +# endif +# endif +# endif +#endif + +/* Is there a serial console? */ + +#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LM_UART0) +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef CONFIG_UART4_SERIAL_CONSOLE +# undef CONFIG_UART5_SERIAL_CONSOLE +# undef CONFIG_UART6_SERIAL_CONSOLE +# undef CONFIG_UART7_SERIAL_CONSOLE +# define HAVE_SERIAL_CONSOLE 1 +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LM_UART1) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef CONFIG_UART4_SERIAL_CONSOLE +# undef CONFIG_UART5_SERIAL_CONSOLE +# undef CONFIG_UART6_SERIAL_CONSOLE +# undef CONFIG_UART7_SERIAL_CONSOLE +# define HAVE_SERIAL_CONSOLE 1 +#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef CONFIG_UART4_SERIAL_CONSOLE +# undef CONFIG_UART5_SERIAL_CONSOLE +# undef CONFIG_UART6_SERIAL_CONSOLE +# undef CONFIG_UART7_SERIAL_CONSOLE +# define HAVE_SERIAL_CONSOLE 1 +#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART4_SERIAL_CONSOLE +# undef CONFIG_UART5_SERIAL_CONSOLE +# undef CONFIG_UART6_SERIAL_CONSOLE +# undef CONFIG_UART7_SERIAL_CONSOLE +# define HAVE_SERIAL_CONSOLE 1 +#elif defined(CONFIG_UART4_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef CONFIG_UART5_SERIAL_CONSOLE +# undef CONFIG_UART6_SERIAL_CONSOLE +# undef CONFIG_UART7_SERIAL_CONSOLE +# define HAVE_SERIAL_CONSOLE 1 +#elif defined(CONFIG_UART5_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef CONFIG_UART4_SERIAL_CONSOLE +# undef CONFIG_UART6_SERIAL_CONSOLE +# undef CONFIG_UART7_SERIAL_CONSOLE +# define HAVE_SERIAL_CONSOLE 1 +#elif defined(CONFIG_UART6_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef CONFIG_UART4_SERIAL_CONSOLE +# undef CONFIG_UART5_SERIAL_CONSOLE +# undef CONFIG_UART7_SERIAL_CONSOLE +# define HAVE_SERIAL_CONSOLE 1 +#elif defined(CONFIG_UART7_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef CONFIG_UART4_SERIAL_CONSOLE +# undef CONFIG_UART5_SERIAL_CONSOLE +# undef CONFIG_UART6_SERIAL_CONSOLE +# define HAVE_SERIAL_CONSOLE 1 +#else +# warning "No valid CONFIG_UARTn_SERIAL_CONSOLE Setting" +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef CONFIG_UART4_SERIAL_CONSOLE +# undef CONFIG_UART5_SERIAL_CONSOLE +# undef CONFIG_UART6_SERIAL_CONSOLE +# undef CONFIG_UART7_SERIAL_CONSOLE +# undef HAVE_SERIAL_CONSOLE +#endif + /************************************************************************************ * Public Types diff --git a/nuttx/arch/arm/src/lm/lm_serial.c b/nuttx/arch/arm/src/lm/lm_serial.c index 13f3ca8df..e9b9f72fb 100644 --- a/nuttx/arch/arm/src/lm/lm_serial.c +++ b/nuttx/arch/arm/src/lm/lm_serial.c @@ -60,150 +60,241 @@ #include "up_internal.h" #include "os_internal.h" +#include "lm_lowputc.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /* Some sanity checks *******************************************************/ -#if LM_NUARTS < 2 -# undef CONFIG_LM_UART1 -# undef CONFIG_UART1_SERIAL_CONSOLE -#endif - -#if LM_NUARTS < 3 -# undef CONFIG_LM_UART2 -# undef CONFIG_UART2_SERIAL_CONSOLE -#endif - /* Is there a UART enabled? */ -#if !defined(CONFIG_LM_UART0) && !defined(CONFIG_LM_UART1) && !defined(CONFIG_LM_UART2) +#if !defined(CONFIG_LM_UART0) && !defined(CONFIG_LM_UART1) && !defined(CONFIG_LM_UART2) && \ + !defined(CONFIG_LM_UART3) && !defined(CONFIG_LM_UART4) && !defined(CONFIG_LM_UART5) && \ + !defined(CONFIG_LM_UART6) && !defined(CONFIG_LM_UART7) # error "No UARTs enabled" #endif -/* Is there a serial console? */ - -#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LM_UART0) -# undef CONFIG_UART1_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LM_UART1) -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART1_SERIAL_CONSOLE -# define HAVE_CONSOLE 1 -#else -# warning "No valid CONFIG_UARTn_SERIAL_CONSOLE Setting" -# undef CONFIG_UART0_SERIAL_CONSOLE -# undef CONFIG_UART1_SERIAL_CONSOLE -# undef CONFIG_UART2_SERIAL_CONSOLE -# undef HAVE_CONSOLE -#endif - /* If we are not using the serial driver for the console, then we * still must provide some minimal implementation of up_putc. */ #ifdef USE_SERIALDRIVER -/* Which UART with be tty0/console and which tty1? */ +/* Which UART with be tty0/console and which tty1-7? The console will always + * be ttyS0. If there is no console then will use the lowest numbered UART. + */ + +/* First pick the console and ttys0. This could be any of UART0-5 */ #if defined(CONFIG_UART0_SERIAL_CONSOLE) -# define CONSOLE_DEV g_uart0port /* UART0 is console */ -# define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */ -# ifdef CONFIG_LM_UART1 -# define TTYS1_DEV g_uart1port /* UART1 is ttyS1 */ -# ifdef CONFIG_LM_UART2 -# define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ -# else -# undef TTYS2_DEV /* No ttyS2 */ -# endif -# else -# undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM_UART2 -# define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ -# else -# undef TTYS1_DEV /* No ttyS1 */ -# endif -# endif +# define CONSOLE_DEV g_uart0port /* UART0 is console */ +# define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */ +# define UART0_ASSIGNED 1 #elif defined(CONFIG_UART1_SERIAL_CONSOLE) -# define CONSOLE_DEV g_uart1port /* UART1 is console */ -# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ -# ifdef CONFIG_LM_UART0 -# define TTYS1_DEV g_uart0port /* UART0 is ttyS1 */ -# ifdef CONFIG_LM_UART2 -# define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ -# else -# undef TTYS2_DEV /* No ttyS2 */ -# endif -# else -# undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM_UART2 -# define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ -# else -# undef TTYS1_DEV /* No ttyS1 */ -# endif -# endif +# define CONSOLE_DEV g_uart1port /* UART1 is console */ +# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ +# define UART1_ASSIGNED 1 #elif defined(CONFIG_UART2_SERIAL_CONSOLE) -# define CONSOLE_DEV g_uart2port /* UART2 is console */ -# define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ -# ifdef CONFIG_LM_UART0 -# define TTYS1_DEV g_uart0port /* UART0 is ttyS1 */ -# ifdef CONFIG_LM_UART2 -# define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ -# else -# undef TTYS2_DEV /* No ttyS2 */ -# endif -# else -# undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM_UART2 -# define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ -# else -# undef TTYS1_DEV /* No ttyS1 */ -# endif -# endif -#elifdefined(CONFIG_LM_UART0) -# undef CONSOLE_DEV /* No console device */ -# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ -# ifdef CONFIG_LM_UART1 -# define TTYS1_DEV g_uart1port /* UART1 is ttyS1 */ -# ifdef CONFIG_LM_UART2 -# define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ -# else -# undef TTYS2_DEV /* No ttyS2 */ -# endif -# else -# undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM_UART2 -# define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ -# else -# undef TTYS1_DEV /* No ttyS1 */ -# endif -# endif -#elifdefined(CONFIG_LM_UART1) -# undef CONSOLE_DEV /* No console device */ -# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ -# undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM_UART2 -# define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ -# else -# undef TTYS1_DEV /* No ttyS1 */ -# endif -#elifdefined(CONFIG_LM_UART2) -# undef CONSOLE_DEV /* No console device */ -# define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ -# undef TTYS1_DEV /* No ttyS1 */ -# undef TTYS2_DEV /* No ttyS2 */ +# define CONSOLE_DEV g_uart2port /* UART2 is console */ +# define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ +# define UART2_ASSIGNED 1 +#elif defined(CONFIG_UART3_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart3port /* UART3 is console */ +# define TTYS0_DEV g_uart3port /* UART3 is ttyS0 */ +# define UART3_ASSIGNED 1 +#elif defined(CONFIG_UART4_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart4port /* UART4 is console */ +# define TTYS0_DEV g_uart4port /* UART4 is ttyS0 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_UART5_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart5port /* UART5 is console */ +# define TTYS5_DEV g_uart5port /* UART5 is ttyS0 */ +#elif defined(CONFIG_UART6_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart6port /* UART6 is console */ +# define TTYS5_DEV g_uart6port /* UART6 is ttyS0 */ +#elif defined(CONFIG_UART7_SERIAL_CONSOLE) +# define CONSOLE_DEV g_uart7port /* UART7 is console */ +# define TTYS5_DEV g_uart7port /* UART7 is ttyS0 */ #else -# error "No valid TTY devices" -# undef CONSOLE_DEV /* No console device */ -# undef TTYS0_DEV /* No ttyS0 */ -# undef TTYS1_DEV /* No ttyS1 */ -# undef TTYS2_DEV /* No ttyS2 */ +# undef CONSOLE_DEV /* No console */ +# if defined(CONFIG_KINETIS_UART0) +# define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */ +# define UART0_ASSIGNED 1 +# elif defined(CONFIG_KINETIS_UART1) +# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ +# define UART1_ASSIGNED 1 +# elif defined(CONFIG_KINETIS_UART2) +# define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ +# define UART2_ASSIGNED 1 +# elif defined(CONFIG_KINETIS_UART3) +# define TTYS0_DEV g_uart3port /* UART3 is ttyS0 */ +# define UART3_ASSIGNED 1 +# elif defined(CONFIG_KINETIS_UART4) +# define TTYS0_DEV g_uart4port /* UART4 is ttyS0 */ +# define UART4_ASSIGNED 1 +# elif defined(CONFIG_KINETIS_UART5) +# define TTYS0_DEV g_uart5port /* UART5 is ttyS0 */ +# define UART5_ASSIGNED 1 +# elif defined(CONFIG_KINETIS_UART6) +# define TTYS0_DEV g_uart6port /* UART5 is ttyS0 */ +# define UART6_ASSIGNED 1 +# elif defined(CONFIG_KINETIS_UART7) +# define TTYS0_DEV g_uart7port /* UART5 is ttyS0 */ +# define UART7_ASSIGNED 1 +# endif +#endif + +/* Pick ttys1. This could be any of UART0-7 excluding the console UART. */ + +#if defined(CONFIG_KINETIS_UART0) && !defined(UART0_ASSIGNED) +# define TTYS1_DEV g_uart0port /* UART0 is ttyS1 */ +# define UART0_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART1) && !defined(UART1_ASSIGNED) +# define TTYS1_DEV g_uart1port /* UART1 is ttyS1 */ +# define UART1_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART2) && !defined(UART2_ASSIGNED) +# define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ +# define UART2_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART3) && !defined(UART3_ASSIGNED) +# define TTYS1_DEV g_uart3port /* UART3 is ttyS1 */ +# define UART3_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART4) && !defined(UART4_ASSIGNED) +# define TTYS1_DEV g_uart4port /* UART4 is ttyS1 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART5) && !defined(UART5_ASSIGNED) +# define TTYS1_DEV g_uart5port /* UART5 is ttyS1 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART6) && !defined(UART6_ASSIGNED) +# define TTYS1_DEV g_uart6port /* UART6 is ttyS1 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART7) && !defined(UART7_ASSIGNED) +# define TTYS1_DEV g_uart7port /* UART7 is ttyS1 */ +# define UART7_ASSIGNED 1 +#endif + +/* Pick ttys2. This could be one of UART1-7. It can't be UART0 because that + * was either assigned as ttyS0 or ttys1. One of UART 1-7 could also be the + * console. + */ + +#if defined(CONFIG_KINETIS_UART1) && !defined(UART1_ASSIGNED) +# define TTYS2_DEV g_uart1port /* UART1 is ttyS2 */ +# define UART1_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART2) && !defined(UART2_ASSIGNED) +# define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ +# define UART2_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART3) && !defined(UART3_ASSIGNED) +# define TTYS2_DEV g_uart3port /* UART3 is ttyS2 */ +# define UART3_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART4) && !defined(UART4_ASSIGNED) +# define TTYS2_DEV g_uart4port /* UART4 is ttyS2 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART5) && !defined(UART5_ASSIGNED) +# define TTYS2_DEV g_uart5port /* UART5 is ttyS2 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART6) && !defined(UART6_ASSIGNED) +# define TTYS2_DEV g_uart6port /* UART6 is ttyS2 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART7) && !defined(UART7_ASSIGNED) +# define TTYS2_DEV g_uart7port /* UART7 is ttyS2 */ +# define UART7_ASSIGNED 1 +#endif + +/* Pick ttys3. This could be one of UART2-7. It can't be UART0-1 because + * those have already been assigned to ttsyS0, 1, or 2. One of + * UART 2-7 could also be the console. + */ + +#if defined(CONFIG_KINETIS_UART2) && !defined(UART2_ASSIGNED) +# define TTYS3_DEV g_uart2port /* UART2 is ttyS3 */ +# define UART2_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART3) && !defined(UART3_ASSIGNED) +# define TTYS3_DEV g_uart3port /* UART3 is ttyS3 */ +# define UART3_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART4) && !defined(UART4_ASSIGNED) +# define TTYS3_DEV g_uart4port /* UART4 is ttyS3 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART5) && !defined(UART5_ASSIGNED) +# define TTYS3_DEV g_uart5port /* UART5 is ttyS3 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART6) && !defined(UART6_ASSIGNED) +# define TTYS3_DEV g_uart6port /* UART6 is ttyS3 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART7) && !defined(UART7_ASSIGNED) +# define TTYS3_DEV g_uart7port /* UART7 is ttyS3 */ +# define UART7_ASSIGNED 1 +#endif + +/* Pick ttys4. This could be one of UART3-7. It can't be UART0-2 because + * those have already been assigned to ttsyS0, 1, 2 or 3. One of + * UART 3-7 could also be the console. + */ + +#if defined(CONFIG_KINETIS_UART3) && !defined(UART3_ASSIGNED) +# define TTYS4_DEV g_uart3port /* UART3 is ttyS4 */ +# define UART3_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART4) && !defined(UART4_ASSIGNED) +# define TTYS4_DEV g_uart4port /* UART4 is ttyS4 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART5) && !defined(UART5_ASSIGNED) +# define TTYS4_DEV g_uart5port /* UART5 is ttyS4 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART6) && !defined(UART6_ASSIGNED) +# define TTYS4_DEV g_uart6port /* UART6 is ttyS4 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART7) && !defined(UART7_ASSIGNED) +# define TTYS4_DEV g_uart7port /* UART7 is ttyS4 */ +# define UART7_ASSIGNED 1 +#endif + +/* Pick ttys5. This could be one of UART4-7. It can't be UART0-3 because + * those have already been assigned to ttsyS0, 1, 2, 3 or 4. One of + * UART 4-7 could also be the console. + */ + +#if defined(CONFIG_KINETIS_UART4) && !defined(UART4_ASSIGNED) +# define TTYS5_DEV g_uart4port /* UART4 is ttyS5 */ +# define UART4_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART5) && !defined(UART5_ASSIGNED) +# define TTYS5_DEV g_uart5port /* UART5 is ttyS5 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART6) && !defined(UART6_ASSIGNED) +# define TTYS5_DEV g_uart6port /* UART6 is ttyS5 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART7) && !defined(UART7_ASSIGNED) +# define TTYS5_DEV g_uart7port /* UART7 is ttyS5 */ +# define UART7_ASSIGNED 1 +#endif + +/* Pick ttys6. This could be one of UART5-7. It can't be UART0-4 because + * those have already been assigned to ttsyS0, 1, 2, 3, 4, or 5. One of + * UART 5-7 could also be the console. + */ + +#if defined(CONFIG_KINETIS_UART5) && !defined(UART5_ASSIGNED) +# define TTYS6_DEV g_uart5port /* UART5 is ttyS6 */ +# define UART5_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART6) && !defined(UART6_ASSIGNED) +# define TTYS6_DEV g_uart6port /* UART6 is ttyS6 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART7) && !defined(UART7_ASSIGNED) +# define TTYS6_DEV g_uart7port /* UART7 is ttyS6 */ +# define UART7_ASSIGNED 1 +#endif + +/* Pick ttys7. This could be one of UART6-7. It can't be UART0-5 because + * those have already been assigned to ttsyS0, 1, 2, 3, 4, or 6. One of + * UART 6-7 could also be the console. + */ + +#if defined(CONFIG_KINETIS_UART6) && !defined(UART6_ASSIGNED) +# define TTYS7_DEV g_uart6port /* UART6 is ttyS7 */ +# define UART6_ASSIGNED 1 +#elif defined(CONFIG_KINETIS_UART7) && !defined(UART7_ASSIGNED) +# define TTYS7_DEV g_uart7port /* UART7 is ttyS7 */ +# define UART7_ASSIGNED 1 #endif /**************************************************************************** @@ -273,6 +364,26 @@ static char g_uart1txbuffer[CONFIG_UART1_TXBUFSIZE]; static char g_uart2rxbuffer[CONFIG_UART2_RXBUFSIZE]; static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE]; #endif +#ifdef CONFIG_LM_UART3 +static char g_uart3rxbuffer[CONFIG_UART3_RXBUFSIZE]; +static char g_uart3txbuffer[CONFIG_UART3_TXBUFSIZE]; +#endif +#ifdef CONFIG_LM_UART4 +static char g_uart4rxbuffer[CONFIG_UART4_RXBUFSIZE]; +static char g_uart4txbuffer[CONFIG_UART4_TXBUFSIZE]; +#endif +#ifdef CONFIG_LM_UART5 +static char g_uart5rxbuffer[CONFIG_UART5_RXBUFSIZE]; +static char g_uart5txbuffer[CONFIG_UART5_TXBUFSIZE]; +#endif +#ifdef CONFIG_LM_UART6 +static char g_uart6rxbuffer[CONFIG_UART6_RXBUFSIZE]; +static char g_uart6txbuffer[CONFIG_UART6_TXBUFSIZE]; +#endif +#ifdef CONFIG_LM_UART7 +static char g_uart7rxbuffer[CONFIG_UART7_RXBUFSIZE]; +static char g_uart7txbuffer[CONFIG_UART7_TXBUFSIZE]; +#endif /* This describes the state of the Stellaris uart0 port. */ @@ -334,7 +445,7 @@ static uart_dev_t g_uart1port = }; #endif -/* This describes the state of the Stellaris uart1 port. */ +/* This describes the state of the Stellaris uart2 port. */ #ifdef CONFIG_LM_UART2 static struct up_dev_s g_uart2priv = @@ -364,6 +475,156 @@ static uart_dev_t g_uart2port = }; #endif +/* This describes the state of the Stellaris uart3 port. */ + +#ifdef CONFIG_LM_UART3 +static struct up_dev_s g_uart3priv = +{ + .uartbase = LM_UART3_BASE, + .baud = CONFIG_UART3_BAUD, + .irq = LM_IRQ_UART3, + .parity = CONFIG_UART3_PARITY, + .bits = CONFIG_UART3_BITS, + .stopbits2 = CONFIG_UART3_2STOP, +}; + +static uart_dev_t g_uart3port = +{ + .recv = + { + .size = CONFIG_UART3_RXBUFSIZE, + .buffer = g_uart3rxbuffer, + }, + .xmit = + { + .size = CONFIG_UART3_TXBUFSIZE, + .buffer = g_uart3txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart3priv, +}; +#endif + +/* This describes the state of the Stellaris uart4 port. */ + +#ifdef CONFIG_LM_UART4 +static struct up_dev_s g_uart4priv = +{ + .uartbase = LM_UART4_BASE, + .baud = CONFIG_UART4_BAUD, + .irq = LM_IRQ_UART4, + .parity = CONFIG_UART4_PARITY, + .bits = CONFIG_UART4_BITS, + .stopbits2 = CONFIG_UART4_2STOP, +}; + +static uart_dev_t g_uart4port = +{ + .recv = + { + .size = CONFIG_UART4_RXBUFSIZE, + .buffer = g_uart4rxbuffer, + }, + .xmit = + { + .size = CONFIG_UART4_TXBUFSIZE, + .buffer = g_uart4txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart4priv, +}; +#endif + +/* This describes the state of the Stellaris uart5 port. */ + +#ifdef CONFIG_LM_UART5 +static struct up_dev_s g_uart5priv = +{ + .uartbase = LM_UART5_BASE, + .baud = CONFIG_UART5_BAUD, + .irq = LM_IRQ_UART5, + .parity = CONFIG_UART5_PARITY, + .bits = CONFIG_UART5_BITS, + .stopbits2 = CONFIG_UART5_2STOP, +}; + +static uart_dev_t g_uart5port = +{ + .recv = + { + .size = CONFIG_UART5_RXBUFSIZE, + .buffer = g_uart5rxbuffer, + }, + .xmit = + { + .size = CONFIG_UART5_TXBUFSIZE, + .buffer = g_uart5txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart5priv, +}; +#endif + +/* This describes the state of the Stellaris uart6 port. */ + +#ifdef CONFIG_LM_UART6 +static struct up_dev_s g_uart6priv = +{ + .uartbase = LM_UART6_BASE, + .baud = CONFIG_UART6_BAUD, + .irq = LM_IRQ_UART6, + .parity = CONFIG_UART6_PARITY, + .bits = CONFIG_UART6_BITS, + .stopbits2 = CONFIG_UART6_2STOP, +}; + +static uart_dev_t g_uart6port = +{ + .recv = + { + .size = CONFIG_UART6_RXBUFSIZE, + .buffer = g_uart6rxbuffer, + }, + .xmit = + { + .size = CONFIG_UART6_TXBUFSIZE, + .buffer = g_uart6txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart6priv, +}; +#endif + +/* This describes the state of the Stellaris uart7 port. */ + +#ifdef CONFIG_LM_UART7 +static struct up_dev_s g_uart7priv = +{ + .uartbase = LM_UART7_BASE, + .baud = CONFIG_UART7_BAUD, + .irq = LM_IRQ_UART7, + .parity = CONFIG_UART7_PARITY, + .bits = CONFIG_UART7_BITS, + .stopbits2 = CONFIG_UART7_2STOP, +}; + +static uart_dev_t g_uart7port = +{ + .recv = + { + .size = CONFIG_UART7_RXBUFSIZE, + .buffer = g_uart7rxbuffer, + }, + .xmit = + { + .size = CONFIG_UART7_TXBUFSIZE, + .buffer = g_uart7txbuffer, + }, + .ops = &g_uart_ops, + .priv = &g_uart7priv, +}; +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -419,7 +680,7 @@ static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t im) * Name: up_waittxnotfull ****************************************************************************/ -#ifdef HAVE_CONSOLE +#ifdef HAVE_SERIAL_CONSOLE static inline void up_waittxnotfull(struct up_dev_s *priv) { int tmp; @@ -963,10 +1224,25 @@ void up_earlyserialinit(void) #ifdef TTYS2_DEV up_disableuartint(TTYS2_DEV.priv, NULL); #endif +#ifdef TTYS3_DEV + up_disableuartint(TTYS3_DEV.priv, NULL); +#endif +#ifdef TTYS4_DEV + up_disableuartint(TTYS4_DEV.priv, NULL); +#endif +#ifdef TTYS5_DEV + up_disableuartint(TTYS5_DEV.priv, NULL); +#endif +#ifdef TTYS6_DEV + up_disableuartint(TTYS6_DEV.priv, NULL); +#endif +#ifdef TTYS7_DEV + up_disableuartint(TTYS7_DEV.priv, NULL); +#endif /* Configuration whichever one is the console */ -#ifdef HAVE_CONSOLE +#ifdef HAVE_SERIAL_CONSOLE CONSOLE_DEV.isconsole = true; up_setup(&CONSOLE_DEV); #endif @@ -985,7 +1261,7 @@ void up_serialinit(void) { /* Register the console */ -#ifdef HAVE_CONSOLE +#ifdef HAVE_SERIAL_CONSOLE (void)uart_register("/dev/console", &CONSOLE_DEV); #endif @@ -998,6 +1274,21 @@ void up_serialinit(void) #ifdef TTYS2_DEV (void)uart_register("/dev/ttyS2", &TTYS2_DEV); #endif +#ifdef TTYS3_DEV + (void)uart_register("/dev/ttyS3", &TTYS3_DEV); +#endif +#ifdef TTYS4_DEV + (void)uart_register("/dev/ttyS4", &TTYS4_DEV); +#endif +#ifdef TTYS5_DEV + (void)uart_register("/dev/ttyS5", &TTYS5_DEV); +#endif +#ifdef TTYS6_DEV + (void)uart_register("/dev/ttyS6", &TTYS6_DEV); +#endif +#ifdef TTYS7_DEV + (void)uart_register("/dev/ttyS7", &TTYS7_DEV); +#endif } /**************************************************************************** @@ -1010,7 +1301,7 @@ void up_serialinit(void) int up_putc(int ch) { -#ifdef HAVE_CONSOLE +#ifdef HAVE_SERIAL_CONSOLE struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv; uint32_t im; @@ -1046,7 +1337,7 @@ int up_putc(int ch) int up_putc(int ch) { -#ifdef HAVE_CONSOLE +#ifdef HAVE_SERIAL_CONSOLE /* Check for LF */ if (ch == '\n') -- cgit v1.2.3