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
This commit is contained in:
patacongo 2013-03-24 20:40:40 +00:00
parent fde971ed5d
commit c568203ddc
8 changed files with 703 additions and 186 deletions

View File

@ -4443,4 +4443,9 @@
* arch/arm/src/lm, kinetis, lpc32, and nuc1xx: Add kernel build * arch/arm/src/lm, kinetis, lpc32, and nuc1xx: Add kernel build
support to all ARMv7-M and ARMv6-M chips. There are no support to all ARMv7-M and ARMv6-M chips. There are no
configurations in place to to verify these additions! configurations in place to to verify these additions!
(2013-03-24).
* arch/arm/src/lm/lm_gpio.h: Correct typos in alternate function
definitions (2013-03-23).
* arch/arm/src/lm/lm_lowputc.c and lm_serial.c: Add support for
the 7 UARTs on the LM4F120 (2013-03-23).

View File

@ -167,8 +167,8 @@
# define GPIO_UART1_RX_2 (GPIO_FUNC_PFINPUT | GPIO_ALT_2 | GPIO_PORTC | GPIO_PIN_4) # 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_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_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_RX (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_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_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_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) # define GPIO_UART4_RX (GPIO_FUNC_PFINPUT | GPIO_ALT_1 | GPIO_PORTC | GPIO_PIN_4)

View File

@ -123,24 +123,24 @@
#ifdef LM4F #ifdef LM4F
# define GPIO_ALT_SHIFT 16 /* Bits 16-19: Alternate function */ # define GPIO_ALT_SHIFT 16 /* Bits 16-19: Alternate function */
# define GPIO_ALT_MASK (15 << GPIO_INT_SHIFT) # define GPIO_ALT_MASK (15 << GPIO_ALT_SHIFT)
# define GPIO_ALT(n) ((n) << GPIO_INT_SHIFT) # define GPIO_ALT(n) ((n) << GPIO_ALT_SHIFT)
# define GPIO_ALT_NONE (0 << GPIO_INT_SHIFT) # define GPIO_ALT_NONE (0 << GPIO_ALT_SHIFT)
# define GPIO_ALT_1 (1 << GPIO_INT_SHIFT) # define GPIO_ALT_1 (1 << GPIO_ALT_SHIFT)
# define GPIO_ALT_2 (2 << GPIO_INT_SHIFT) # define GPIO_ALT_2 (2 << GPIO_ALT_SHIFT)
# define GPIO_ALT_3 (3 << GPIO_INT_SHIFT) # define GPIO_ALT_3 (3 << GPIO_ALT_SHIFT)
# define GPIO_ALT_4 (4 << GPIO_INT_SHIFT) # define GPIO_ALT_4 (4 << GPIO_ALT_SHIFT)
# define GPIO_ALT_5 (5 << GPIO_INT_SHIFT) # define GPIO_ALT_5 (5 << GPIO_ALT_SHIFT)
# define GPIO_ALT_6 (6 << GPIO_INT_SHIFT) # define GPIO_ALT_6 (6 << GPIO_ALT_SHIFT)
# define GPIO_ALT_7 (7 << GPIO_INT_SHIFT) # define GPIO_ALT_7 (7 << GPIO_ALT_SHIFT)
# define GPIO_ALT_8 (8 << GPIO_INT_SHIFT) # define GPIO_ALT_8 (8 << GPIO_ALT_SHIFT)
# define GPIO_ALT_9 (9 << GPIO_INT_SHIFT) # define GPIO_ALT_9 (9 << GPIO_ALT_SHIFT)
# define GPIO_ALT_10 (10 << GPIO_INT_SHIFT) # define GPIO_ALT_10 (10 << GPIO_ALT_SHIFT)
# define GPIO_ALT_11 (11 << GPIO_INT_SHIFT) # define GPIO_ALT_11 (11 << GPIO_ALT_SHIFT)
# define GPIO_ALT_12 (12 << GPIO_INT_SHIFT) # define GPIO_ALT_12 (12 << GPIO_ALT_SHIFT)
# define GPIO_ALT_13 (13 << GPIO_INT_SHIFT) # define GPIO_ALT_13 (13 << GPIO_ALT_SHIFT)
# define GPIO_ALT_14 (14 << GPIO_INT_SHIFT) # define GPIO_ALT_14 (14 << GPIO_ALT_SHIFT)
# define GPIO_ALT_15 (15 << GPIO_INT_SHIFT) # define GPIO_ALT_15 (15 << GPIO_ALT_SHIFT)
#endif #endif
/* If the pin is an GPIO digital output, then this identifies the initial output value: /* If the pin is an GPIO digital output, then this identifies the initial output value:

View File

@ -54,41 +54,8 @@
/************************************************************************** /**************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
**************************************************************************/ **************************************************************************/
/* Configuration **********************************************************/ /* 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 */ /* Select UART parameters for the selected console */
#if defined(CONFIG_UART0_SERIAL_CONSOLE) #if defined(CONFIG_UART0_SERIAL_CONSOLE)
@ -109,6 +76,36 @@
# define LM_CONSOLE_BITS CONFIG_UART2_BITS # define LM_CONSOLE_BITS CONFIG_UART2_BITS
# define LM_CONSOLE_PARITY CONFIG_UART2_PARITY # define LM_CONSOLE_PARITY CONFIG_UART2_PARITY
# define LM_CONSOLE_2STOP CONFIG_UART2_2STOP # 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 #else
# error "No CONFIG_UARTn_SERIAL_CONSOLE Setting" # error "No CONFIG_UARTn_SERIAL_CONSOLE Setting"
#endif #endif
@ -226,7 +223,7 @@
void up_lowputc(char ch) void up_lowputc(char ch)
{ {
#ifdef HAVE_CONSOLE #ifdef HAVE_SERIAL_CONSOLE
/* Wait until the TX FIFO is not full */ /* Wait until the TX FIFO is not full */
while ((getreg32(LM_CONSOLE_BASE+LM_UART_FR_OFFSET) & UART_FR_TXFF) != 0); 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) void up_lowsetup(void)
{ {
uint32_t regval; 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; uint32_t ctl;
#endif #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 * the selected UARTs. NOTE: The serial driver later depends on
* this pin configuration -- whether or not a serial console is selected. * this pin configuration -- whether or not a serial console is selected.
*/ */
@ -277,9 +274,63 @@ void up_lowsetup(void)
lm_configgpio(GPIO_UART1_TX); lm_configgpio(GPIO_UART1_TX);
#endif #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 */ /* 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 */ /* Disable the UART by clearing the UARTEN bit in the UART CTL register */
ctl = getreg32(LM_CONSOLE_BASE+LM_UART_CTL_OFFSET); ctl = getreg32(LM_CONSOLE_BASE+LM_UART_CTL_OFFSET);

View File

@ -45,6 +45,124 @@
/************************************************************************************ /************************************************************************************
* Pre-processor Definitions * 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 * Public Types

View File

@ -60,150 +60,241 @@
#include "up_internal.h" #include "up_internal.h"
#include "os_internal.h" #include "os_internal.h"
#include "lm_lowputc.h"
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Some sanity checks *******************************************************/ /* 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? */ /* 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" # error "No UARTs enabled"
#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
# 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 /* If we are not using the serial driver for the console, then we
* still must provide some minimal implementation of up_putc. * still must provide some minimal implementation of up_putc.
*/ */
#ifdef USE_SERIALDRIVER #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) #if defined(CONFIG_UART0_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart0port /* UART0 is console */ # define CONSOLE_DEV g_uart0port /* UART0 is console */
# define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */ # define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */
# ifdef CONFIG_LM_UART1 # define UART0_ASSIGNED 1
# 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
#elif defined(CONFIG_UART1_SERIAL_CONSOLE) #elif defined(CONFIG_UART1_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart1port /* UART1 is console */ # define CONSOLE_DEV g_uart1port /* UART1 is console */
# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */
# ifdef CONFIG_LM_UART0 # define UART1_ASSIGNED 1
# 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
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) #elif defined(CONFIG_UART2_SERIAL_CONSOLE)
# define CONSOLE_DEV g_uart2port /* UART2 is console */ # define CONSOLE_DEV g_uart2port /* UART2 is console */
# define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ # define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */
# ifdef CONFIG_LM_UART0 # define UART2_ASSIGNED 1
# define TTYS1_DEV g_uart0port /* UART0 is ttyS1 */ #elif defined(CONFIG_UART3_SERIAL_CONSOLE)
# ifdef CONFIG_LM_UART2 # define CONSOLE_DEV g_uart3port /* UART3 is console */
# define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # define TTYS0_DEV g_uart3port /* UART3 is ttyS0 */
# else # define UART3_ASSIGNED 1
# undef TTYS2_DEV /* No ttyS2 */ #elif defined(CONFIG_UART4_SERIAL_CONSOLE)
# endif # define CONSOLE_DEV g_uart4port /* UART4 is console */
# else # define TTYS0_DEV g_uart4port /* UART4 is ttyS0 */
# undef TTYS2_DEV /* No ttyS2 */ # define UART4_ASSIGNED 1
# ifdef CONFIG_LM_UART2 #elif defined(CONFIG_UART5_SERIAL_CONSOLE)
# define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # define CONSOLE_DEV g_uart5port /* UART5 is console */
# else # define TTYS5_DEV g_uart5port /* UART5 is ttyS0 */
# undef TTYS1_DEV /* No ttyS1 */ #elif defined(CONFIG_UART6_SERIAL_CONSOLE)
# endif # define CONSOLE_DEV g_uart6port /* UART6 is console */
# endif # define TTYS5_DEV g_uart6port /* UART6 is ttyS0 */
#elifdefined(CONFIG_LM_UART0) #elif defined(CONFIG_UART7_SERIAL_CONSOLE)
# undef CONSOLE_DEV /* No console device */ # define CONSOLE_DEV g_uart7port /* UART7 is console */
# define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ # define TTYS5_DEV g_uart7port /* UART7 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 */
#else #else
# error "No valid TTY devices" # undef CONSOLE_DEV /* No console */
# undef CONSOLE_DEV /* No console device */ # if defined(CONFIG_KINETIS_UART0)
# undef TTYS0_DEV /* No ttyS0 */ # define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */
# undef TTYS1_DEV /* No ttyS1 */ # define UART0_ASSIGNED 1
# undef TTYS2_DEV /* No ttyS2 */ # 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 #endif
/**************************************************************************** /****************************************************************************
@ -273,6 +364,26 @@ static char g_uart1txbuffer[CONFIG_UART1_TXBUFSIZE];
static char g_uart2rxbuffer[CONFIG_UART2_RXBUFSIZE]; static char g_uart2rxbuffer[CONFIG_UART2_RXBUFSIZE];
static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE]; static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE];
#endif #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. */ /* This describes the state of the Stellaris uart0 port. */
@ -334,7 +445,7 @@ static uart_dev_t g_uart1port =
}; };
#endif #endif
/* This describes the state of the Stellaris uart1 port. */ /* This describes the state of the Stellaris uart2 port. */
#ifdef CONFIG_LM_UART2 #ifdef CONFIG_LM_UART2
static struct up_dev_s g_uart2priv = static struct up_dev_s g_uart2priv =
@ -364,6 +475,156 @@ static uart_dev_t g_uart2port =
}; };
#endif #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 * Private Functions
****************************************************************************/ ****************************************************************************/
@ -419,7 +680,7 @@ static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t im)
* Name: up_waittxnotfull * Name: up_waittxnotfull
****************************************************************************/ ****************************************************************************/
#ifdef HAVE_CONSOLE #ifdef HAVE_SERIAL_CONSOLE
static inline void up_waittxnotfull(struct up_dev_s *priv) static inline void up_waittxnotfull(struct up_dev_s *priv)
{ {
int tmp; int tmp;
@ -963,10 +1224,25 @@ void up_earlyserialinit(void)
#ifdef TTYS2_DEV #ifdef TTYS2_DEV
up_disableuartint(TTYS2_DEV.priv, NULL); up_disableuartint(TTYS2_DEV.priv, NULL);
#endif #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 */ /* Configuration whichever one is the console */
#ifdef HAVE_CONSOLE #ifdef HAVE_SERIAL_CONSOLE
CONSOLE_DEV.isconsole = true; CONSOLE_DEV.isconsole = true;
up_setup(&CONSOLE_DEV); up_setup(&CONSOLE_DEV);
#endif #endif
@ -985,7 +1261,7 @@ void up_serialinit(void)
{ {
/* Register the console */ /* Register the console */
#ifdef HAVE_CONSOLE #ifdef HAVE_SERIAL_CONSOLE
(void)uart_register("/dev/console", &CONSOLE_DEV); (void)uart_register("/dev/console", &CONSOLE_DEV);
#endif #endif
@ -998,6 +1274,21 @@ void up_serialinit(void)
#ifdef TTYS2_DEV #ifdef TTYS2_DEV
(void)uart_register("/dev/ttyS2", &TTYS2_DEV); (void)uart_register("/dev/ttyS2", &TTYS2_DEV);
#endif #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) int up_putc(int ch)
{ {
#ifdef HAVE_CONSOLE #ifdef HAVE_SERIAL_CONSOLE
struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv; struct up_dev_s *priv = (struct up_dev_s*)CONSOLE_DEV.priv;
uint32_t im; uint32_t im;
@ -1046,7 +1337,7 @@ int up_putc(int ch)
int up_putc(int ch) int up_putc(int ch)
{ {
#ifdef HAVE_CONSOLE #ifdef HAVE_SERIAL_CONSOLE
/* Check for LF */ /* Check for LF */
if (ch == '\n') if (ch == '\n')

View File

@ -15,6 +15,7 @@ Contents
NuttX OABI "buildroot" Toolchain NuttX OABI "buildroot" Toolchain
NXFLAT Toolchain NXFLAT Toolchain
LEDs LEDs
Serial Console
USB Device Controller Functions USB Device Controller Functions
Using OpenOCD and GDB with an FT2232 JTAG emulator Using OpenOCD and GDB with an FT2232 JTAG emulator
LM4F120 LaunchPad Configuration Options LM4F120 LaunchPad Configuration Options
@ -466,6 +467,50 @@ LEDs
- In the event of a fatal crash, the BLUE and GREEN components will be - In the event of a fatal crash, the BLUE and GREEN components will be
extinguished and the RED component will FLASH at a 2Hz rate. extinguished and the RED component will FLASH at a 2Hz rate.
Serial Console
^^^^^^^^^^^^^^
By default, all configurations use UART0 which connects to the USB VCOM
on the DEBUG port on the LM4F120 LaunchPad:
UART0 RX - PA.0
UART0 TX - PA.1
However, if you use an external RS232 driver, then other options are
available. UART1 has option pin settings and flow control capabilities
that are not available with the other UARTS::
UART1 RX - PB.0 or PC.4 (Need disambiguation in board.h)
UART1 TX - PB.1 or PC.5 (" " " " "" " ")
UART1_RTS - PF.0 or PC.4
UART1_CTS - PF.1 or PC.5
NOTE: board.h currently selects PB.0, PB.1, PF.0 and PF.1 for UART1, but
that can be changed by editting board.h
UART2-5, 7 are also available, UART2 is not recommended because it shares
some pin usage with USB device mode. UART6 is not available because its
only RX/TX pin options are dedicated to USB support.
UART2 RX - PD.6
UART2 TX - PD.7 (Also used for USB VBUS detection)
UART3 RX - PC.6
UART3 TX - PC.7
UART4 RX - PC.4
UART4 TX - PC.5
UART5 RX - PE.4
UART5 TX - PE.5
UART6 RX - PD.4, Not available. Dedicated for USB_DM
UART6 TX - PD.5, Not available. Dedicated for USB_DP
UART7 RX - PE.0
UART7 TX - PE.1
USB Device Controller Functions USB Device Controller Functions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -158,6 +158,13 @@
#define BUTTON_SW1_BIT (1 << BUTTON_SW1) #define BUTTON_SW1_BIT (1 << BUTTON_SW1)
#define BUTTON_SW2_BIT (1 << BUTTON_SW2) #define BUTTON_SW2_BIT (1 << BUTTON_SW2)
/* Pin Multiplexing Disambiguation **************************************************/
#define GPIO_UART1_CTS GPIO_UART1_CTS_1
#define GPIO_UART1_RTS GPIO_UART1_RTS_1
#define GPIO_UART1_RX GPIO_UART1_RX_1
#define GPIO_UART1_TX GPIO_UART1_TX_1
/************************************************************************************ /************************************************************************************
* Public Function Prototypes * Public Function Prototypes
************************************************************************************/ ************************************************************************************/