diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-05 17:20:19 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-05 17:20:19 +0000 |
commit | 291dd23da13557097ec86d3899a16c8548d2ebd2 (patch) | |
tree | d66089490b6d6a874d87f9a401e857f4872be187 /nuttx/drivers/serial | |
parent | 58b3f22d812ecc73e8658679638b4ef772dd9210 (diff) | |
download | px4-nuttx-291dd23da13557097ec86d3899a16c8548d2ebd2.tar.gz px4-nuttx-291dd23da13557097ec86d3899a16c8548d2ebd2.tar.bz2 px4-nuttx-291dd23da13557097ec86d3899a16c8548d2ebd2.zip |
Add Kconfig settings for the LPC17xx
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5094 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers/serial')
-rw-r--r-- | nuttx/drivers/serial/Kconfig | 460 | ||||
-rw-r--r-- | nuttx/drivers/serial/uart_16550.c | 74 |
2 files changed, 472 insertions, 62 deletions
diff --git a/nuttx/drivers/serial/Kconfig b/nuttx/drivers/serial/Kconfig index df80a1ded..0448f1268 100644 --- a/nuttx/drivers/serial/Kconfig +++ b/nuttx/drivers/serial/Kconfig @@ -215,25 +215,25 @@ endif choice prompt "16550 Serial Console" - default NO_SERIAL_CONSOLE + default 16550_NO_SERIAL_CONSOLE -config UART0_SERIAL_CONSOLE +config 16550_UART0_SERIAL_CONSOLE bool "16550 UART0 serial console" depends on 16550_UART0 -config UART1_SERIAL_CONSOLE +config 16550_UART1_SERIAL_CONSOLE bool "16550 UART1 serial console" depends on 16550_UART1 -config UART2_SERIAL_CONSOLE +config 16550_UART2_SERIAL_CONSOLE bool "16550 UART2 serial console" depends on 16550_UART2 -config UART3_SERIAL_CONSOLE +config 16550_UART3_SERIAL_CONSOLE bool "16550 UART3 serial console" depends on 16550_UART3 -config NO_SERIAL_CONSOLE +config 16550_NO_SERIAL_CONSOLE bool "No 16550 serial console" endchoice @@ -267,25 +267,27 @@ config 16550_ADDRWIDTH endif -config STANDARD_SERIAL - bool "Standard serial" - default y if !LOWLEVEL_CONSOLE && !16550_UART - -if STANDARD_SERIAL -config CONFIG_SERIAL_NPOLLWAITERS - int "Number of poll threads" - default 2 - depends on !DISABLE_POLL - ---help--- - Maximum number of threads than can be waiting for POLL events. - Default: 2 - -endif - # -# USARTn_XYZ settings +# MCU serial peripheral driver? # +config ARCH_HAS_UART + bool +config ARCH_HAS_UART0 + bool +config ARCH_HAS_UART1 + bool +config ARCH_HAS_UART2 + bool +config ARCH_HAS_UART3 + bool +config ARCH_HAS_UART4 + bool +config ARCH_HAS_UART5 + bool +config ARCH_HAS_UART6 + bool + config ARCH_HAS_USART0 bool config ARCH_HAS_USART1 @@ -301,42 +303,192 @@ config ARCH_HAS_USART5 config ARCH_HAS_USART6 bool +config MCU_SERIAL + bool + default y if ARCH_HAS_UART || ARCH_HAS_UART0 || ARCH_HAS_USART0 || ARCH_HAS_UART1 || ARCH_HAS_USART1 || \ + ARCH_HAS_UART2 || ARCH_HAS_USART2 || ARCH_HAS_UART3 || ARCH_HAS_USART3 || \ + ARCH_HAS_UART4 || ARCH_HAS_USART4 || ARCH_HAS_UART5 || ARCH_HAS_USART5 || ARCH_HAS_UART6 || ARCH_HAS_USART6 + +# +# Standard serial driver configuration +# + +config STANDARD_SERIAL + bool "Enable standard \"upper-half\" serial driver" + default y if MCU_SERIAL + default n if !MCU_SERIAL + depends on !LOWLEVEL_CONSOLE + ---help--- + Enable the standard, upper-half serial driver used by most MCU serial peripherals. + +config CONFIG_SERIAL_NPOLLWAITERS + int "Number of poll threads" + default 2 + depends on !DISABLE_POLL && STANDARD_SERIAL + ---help--- + Maximum number of threads than can be waiting for POLL events. + Default: 2 + +# +# U[S]ARTn_XYZ settings for MCU serial drivers +# + choice prompt "Serial console" - depends on ARCH_HAS_USART0 || \ - ARCH_HAS_USART1 || ARCH_HAS_USART2 || ARCH_HAS_USART3 || \ - ARCH_HAS_USART4 || ARCH_HAS_USART5 || ARCH_HAS_USART6 + depends on MCU_SERIAL + default NO_SERIAL_CONSOLE + +config UART_SERIAL_CONSOLE + bool "UART" + depends on ARCH_HAS_UART + +config UART0_SERIAL_CONSOLE + bool "UART0" + depends on ARCH_HAS_UART0 config USART0_SERIAL_CONSOLE bool "USART0" depends on ARCH_HAS_USART0 +config UART1_SERIAL_CONSOLE + bool "UART1" + depends on ARCH_HAS_UART1 + config USART1_SERIAL_CONSOLE bool "USART1" depends on ARCH_HAS_USART1 +config UART2_SERIAL_CONSOLE + bool "UART2" + depends on ARCH_HAS_UART2 + config USART2_SERIAL_CONSOLE bool "USART2" depends on ARCH_HAS_USART2 +config UART3_SERIAL_CONSOLE + bool "UART3" + depends on ARCH_HAS_UART3 + config USART3_SERIAL_CONSOLE bool "USART3" depends on ARCH_HAS_USART3 +config UART4_SERIAL_CONSOLE + bool "UART4" + depends on ARCH_HAS_UART4 + config USART4_SERIAL_CONSOLE bool "USART4" depends on ARCH_HAS_USART4 +config UART5_SERIAL_CONSOLE + bool "UART5" + depends on ARCH_HAS_UART5 + config USART5_SERIAL_CONSOLE bool "USART5" depends on ARCH_HAS_USART5 +config UART6_SERIAL_CONSOLE + bool "UART6" + depends on ARCH_HAS_UART6 + config USART6_SERIAL_CONSOLE bool "USART6" depends on ARCH_HAS_USART6 +config NO_SERIAL_CONSOLE + bool "No serial console" + endchoice +menu "UART Configuration" + depends on ARCH_HAS_UART + +config UART_RXBUFSIZE + int "receive buffer size" + default 256 + help + Characters are buffered as they are received. This specifies + the size of the receive buffer. + +config UART_TXBUFSIZE + int "transmit buffer size" + default 256 + help + Characters are buffered before being sent. This specifies + the size of the transmit buffer. + +config UART_BAUD + int "baud rate" + default 11520 + help + The configured BAUD of the UART. + +config UART_BITS + int "character size" + default 8 + help + The number of bits. Must be either 7 or 8. + +config UART_PARITY + int "parity setting" + default 0 + help + 0=no parity, 1=odd parity, 2=even parity + +config UART_2STOP + int "use 2 stop bits" + default 0 + help + 1=Two stop bits + +endmenu + +menu "UART0 Configuration" + depends on ARCH_HAS_UART0 + +config UART0_RXBUFSIZE + int "receive buffer size" + default 256 + help + Characters are buffered as they are received. This specifies + the size of the receive buffer. + +config UART0_TXBUFSIZE + int "transmit buffer size" + default 256 + help + Characters are buffered before being sent. This specifies + the size of the transmit buffer. + +config UART0_BAUD + int "baud rate" + default 11520 + help + The configured BAUD of the UART. + +config UART0_BITS + int "character size" + default 8 + help + The number of bits. Must be either 7 or 8. + +config UART0_PARITY + int "parity setting" + default 0 + help + 0=no parity, 1=odd parity, 2=even parity + +config UART0_2STOP + int "use 2 stop bits" + default 0 + help + 1=Two stop bits + +endmenu + menu "USART0 Configuration" depends on ARCH_HAS_USART0 @@ -380,6 +532,49 @@ config USART0_2STOP endmenu +menu "UART1 Configuration" + depends on ARCH_HAS_UART1 + +config UART1_RXBUFSIZE + int "receive buffer size" + default 256 + help + Characters are buffered as they are received. This specifies + the size of the receive buffer. + +config UART1_TXBUFSIZE + int "transmit buffer size" + default 256 + help + Characters are buffered before being sent. This specifies + the size of the transmit buffer. + +config UART1_BAUD + int "baud rate" + default 11520 + help + The configured BAUD of the UART. + +config UART1_BITS + int "character size" + default 8 + help + The number of bits. Must be either 7 or 8. + +config UART1_PARITY + int "parity setting" + default 0 + help + 0=no parity, 1=odd parity, 2=even parity + +config UART1_2STOP + int "uses 2 stop bits" + default 0 + help + 1=Two stop bits + +endmenu + menu "USART1 Configuration" depends on ARCH_HAS_USART1 @@ -423,6 +618,49 @@ config USART1_2STOP endmenu +menu "UART2 Configuration" + depends on ARCH_HAS_UART2 + +config UART2_RXBUFSIZE + int "receive buffer size" + default 256 + help + Characters are buffered as they are received. This specifies + the size of the receive buffer. + +config UART2_TXBUFSIZE + int "transmit buffer size" + default 256 + help + Characters are buffered before being sent. This specifies + the size of the transmit buffer. + +config UART2_BAUD + int "baud rate" + default 11520 + help + The configured BAUD of the UART. + +config UART2_BITS + int "character size" + default 8 + help + The number of bits. Must be either 7 or 8. + +config UART2_PARITY + int "parity setting" + default 0 + help + 0=no parity, 1=odd parity, 2=even parity + +config UART2_2STOP + int "uses 2 stop bits" + default 0 + help + 1=Two stop bits + +endmenu + menu "USART2 Configuration" depends on ARCH_HAS_USART2 @@ -466,6 +704,49 @@ config USART2_2STOP endmenu +menu "UART3 Configuration" + depends on ARCH_HAS_UART3 + +config UART3_RXBUFSIZE + int "receive buffer size" + default 256 + help + Characters are buffered as they are received. This specifies + the size of the receive buffer. + +config UART3_TXBUFSIZE + int "transmit buffer size" + default 256 + help + Characters are buffered before being sent. This specifies + the size of the transmit buffer. + +config UART3_BAUD + int "baud rate" + default 11520 + help + The configured BAUD of the UART. + +config UART3_BITS + int "character size" + default 8 + help + The number of bits. Must be either 7 or 8. + +config UART3_PARITY + int "parity setting" + default 0 + help + 0=no parity, 1=odd parity, 2=even parity + +config UART3_2STOP + int "uses 2 stop bits" + default 0 + help + 1=Two stop bits + +endmenu + menu "USART3 Configuration" depends on ARCH_HAS_USART3 @@ -509,6 +790,49 @@ config USART3_2STOP endmenu +menu "UART4 Configuration" + depends on ARCH_HAS_UART4 + +config UART4_RXBUFSIZE + int "receive buffer size" + default 256 + help + Characters are buffered as they are received. This specifies + the size of the receive buffer. + +config UART4_TXBUFSIZE + int "transmit buffer size" + default 256 + help + Characters are buffered before being sent. This specifies + the size of the transmit buffer. + +config UART4_BAUD + int "baud rate" + default 11520 + help + The configured BAUD of the UART. + +config UART4_BITS + int "character size" + default 8 + help + The number of bits. Must be either 7 or 8. + +config UART4_PARITY + int "parity setting" + default 0 + help + 0=no parity, 1=odd parity, 2=even parity + +config UART4_2STOP + int "uses 2 stop bits" + default 0 + help + 1=Two stop bits + +endmenu + menu "USART4 Configuration" depends on ARCH_HAS_USART4 @@ -552,6 +876,49 @@ config USART4_2STOP endmenu +menu "UART5 Configuration" + depends on ARCH_HAS_UART5 + +config UART5_RXBUFSIZE + int "receive buffer size" + default 256 + help + Characters are buffered as they are received. This specifies + the size of the receive buffer. + +config UART5_TXBUFSIZE + int "transmit buffer size" + default 256 + help + Characters are buffered before being sent. This specifies + the size of the transmit buffer. + +config UART5_BAUD + int "baud rate" + default 11520 + help + The configured BAUD of the UART. + +config UART5_BITS + int "character size" + default 8 + help + The number of bits. Must be either 7 or 8. + +config UART5_PARITY + int "parity setting" + default 0 + help + 0=no parity, 1=odd parity, 2=even parity + +config UART5_2STOP + int "uses 2 stop bits" + default 0 + help + 1=Two stop bits + +endmenu + menu "USART5 Configuration" depends on ARCH_HAS_USART5 @@ -637,3 +1004,46 @@ config USART6_2STOP 1=Two stop bits endmenu + +menu "UART6 Configuration" + depends on ARCH_HAS_UART6 + +config UART6_RXBUFSIZE + int "receive buffer size" + default 256 + help + Characters are buffered as they are received. This specifies + the size of the receive buffer. + +config UART6_TXBUFSIZE + int "transmit buffer size" + default 256 + help + Characters are buffered before being sent. This specifies + the size of the transmit buffer. + +config UART6_BAUD + int "baud rate" + default 11520 + help + The configured BAUD of the UART. + +config UART6_BITS + int "character size" + default 8 + help + The number of bits. Must be either 7 or 8. + +config UART6_PARITY + int "parity setting" + default 0 + help + 0=no parity, 1=odd parity, 2=even parity + +config UART6_2STOP + int "uses 2 stop bits" + default 0 + help + 1=Two stop bits + +endmenu diff --git a/nuttx/drivers/serial/uart_16550.c b/nuttx/drivers/serial/uart_16550.c index ea7d944f3..8fb71bfd2 100644 --- a/nuttx/drivers/serial/uart_16550.c +++ b/nuttx/drivers/serial/uart_16550.c @@ -128,20 +128,20 @@ struct uart_ops_s g_uart_ops = /* I/O buffers */ #ifdef CONFIG_16550_UART0 -static char g_uart0rxbuffer[CONFIG_UART0_RXBUFSIZE]; -static char g_uart0txbuffer[CONFIG_UART0_TXBUFSIZE]; +static char g_uart0rxbuffer[CONFIG_16550_UART0_RXBUFSIZE]; +static char g_uart0txbuffer[CONFIG_16550_UART0_TXBUFSIZE]; #endif #ifdef CONFIG_16550_UART1 -static char g_uart1rxbuffer[CONFIG_UART1_RXBUFSIZE]; -static char g_uart1txbuffer[CONFIG_UART1_TXBUFSIZE]; +static char g_uart1rxbuffer[CONFIG_16550_UART1_RXBUFSIZE]; +static char g_uart1txbuffer[CONFIG_16550_UART1_TXBUFSIZE]; #endif #ifdef CONFIG_16550_UART2 -static char g_uart2rxbuffer[CONFIG_UART1_RXBUFSIZE]; -static char g_uart2txbuffer[CONFIG_UART1_TXBUFSIZE]; +static char g_uart2rxbuffer[CONFIG_16550_UART2_RXBUFSIZE]; +static char g_uart2txbuffer[CONFIG_16550_UART2_TXBUFSIZE]; #endif #ifdef CONFIG_16550_UART3 -static char g_uart3rxbuffer[CONFIG_UART1_RXBUFSIZE]; -static char g_uart3txbuffer[CONFIG_UART1_TXBUFSIZE]; +static char g_uart3rxbuffer[CONFIG_16550_UART3_RXBUFSIZE]; +static char g_uart3txbuffer[CONFIG_16550_UART3_TXBUFSIZE]; #endif /* This describes the state of the LPC17xx uart0 port. */ @@ -151,16 +151,16 @@ static struct u16550_s g_uart0priv = { .uartbase = CONFIG_16550_UART0_BASE, #ifndef CONFIG_16550_SUPRESS_CONFIG - .baud = CONFIG_UART0_BAUD, + .baud = CONFIG_16550_UART0_BAUD, .uartclk = CONFIG_16550_UART0_CLOCK, #endif #ifndef CONFIG_SUPPRESS_SERIAL_INTS .irq = CONFIG_16550_UART0_IRQ, #endif #ifndef CONFIG_16550_SUPRESS_CONFIG - .parity = CONFIG_UART0_PARITY, - .bits = CONFIG_UART0_BITS, - .stopbits2 = CONFIG_UART0_2STOP, + .parity = CONFIG_16550_UART0_PARITY, + .bits = CONFIG_16550_UART0_BITS, + .stopbits2 = CONFIG_16550_UART0_2STOP, #endif }; @@ -168,12 +168,12 @@ static uart_dev_t g_uart0port = { .recv = { - .size = CONFIG_UART0_RXBUFSIZE, + .size = CONFIG_16550_UART0_RXBUFSIZE, .buffer = g_uart0rxbuffer, }, .xmit = { - .size = CONFIG_UART0_TXBUFSIZE, + .size = CONFIG_16550_UART0_TXBUFSIZE, .buffer = g_uart0txbuffer, }, .ops = &g_uart_ops, @@ -188,16 +188,16 @@ static struct u16550_s g_uart1priv = { .uartbase = CONFIG_16550_UART1_BASE, #ifndef CONFIG_16550_SUPRESS_CONFIG - .baud = CONFIG_UART1_BAUD, + .baud = CONFIG_16550_UART1_BAUD, .uartclk = CONFIG_16550_UART1_CLOCK, #endif #ifndef CONFIG_SUPPRESS_SERIAL_INTS .irq = CONFIG_16550_UART1_IRQ, #endif #ifndef CONFIG_16550_SUPRESS_CONFIG - .parity = CONFIG_UART1_PARITY, - .bits = CONFIG_UART1_BITS, - .stopbits2 = CONFIG_UART1_2STOP, + .parity = CONFIG_16550_UART1_PARITY, + .bits = CONFIG_16550_UART1_BITS, + .stopbits2 = CONFIG_16550_UART1_2STOP, #endif }; @@ -205,12 +205,12 @@ static uart_dev_t g_uart1port = { .recv = { - .size = CONFIG_UART1_RXBUFSIZE, + .size = CONFIG_16550_UART1_RXBUFSIZE, .buffer = g_uart1rxbuffer, }, .xmit = { - .size = CONFIG_UART1_TXBUFSIZE, + .size = CONFIG_16550_UART1_TXBUFSIZE, .buffer = g_uart1txbuffer, }, .ops = &g_uart_ops, @@ -225,16 +225,16 @@ static struct u16550_s g_uart2priv = { .uartbase = CONFIG_16550_UART2_BASE, #ifndef CONFIG_16550_SUPRESS_CONFIG - .baud = CONFIG_UART2_BAUD, + .baud = CONFIG_16550_UART2_BAUD, .uartclk = CONFIG_16550_UART2_CLOCK, #endif #ifndef CONFIG_SUPPRESS_SERIAL_INTS .irq = CONFIG_16550_UART2_IRQ, #endif #ifndef CONFIG_16550_SUPRESS_CONFIG - .parity = CONFIG_UART2_PARITY, - .bits = CONFIG_UART2_BITS, - .stopbits2 = CONFIG_UART2_2STOP, + .parity = CONFIG_16550_UART2_PARITY, + .bits = CONFIG_16550_UART2_BITS, + .stopbits2 = CONFIG_16550_UART2_2STOP, #endif }; @@ -242,12 +242,12 @@ static uart_dev_t g_uart2port = { .recv = { - .size = CONFIG_UART2_RXBUFSIZE, + .size = CONFIG_16550_UART2_RXBUFSIZE, .buffer = g_uart2rxbuffer, }, .xmit = { - .size = CONFIG_UART2_TXBUFSIZE, + .size = CONFIG_16550_UART2_TXBUFSIZE, .buffer = g_uart2txbuffer, }, .ops = &g_uart_ops, @@ -262,16 +262,16 @@ static struct u16550_s g_uart3priv = { .uartbase = CONFIG_16550_UART3_BASE, #ifndef CONFIG_16550_SUPRESS_CONFIG - .baud = CONFIG_UART3_BAUD, + .baud = CONFIG_16550_UART3_BAUD, .uartclk = CONFIG_16550_UART3_CLOCK, #endif #ifndef CONFIG_SUPPRESS_SERIAL_INTS .irq = CONFIG_16550_UART3_IRQ, #endif #ifndef CONFIG_16550_SUPRESS_CONFIG - .parity = CONFIG_UART3_PARITY, - .bits = CONFIG_UART3_BITS, - .stopbits2 = CONFIG_UART3_2STOP, + .parity = CONFIG_16550_UART3_PARITY, + .bits = CONFIG_16550_UART3_BITS, + .stopbits2 = CONFIG_16550_UART3_2STOP, #endif }; @@ -279,12 +279,12 @@ static uart_dev_t g_uart3port = { .recv = { - .size = CONFIG_UART3_RXBUFSIZE, + .size = CONFIG_16550_UART3_RXBUFSIZE, .buffer = g_uart3rxbuffer, }, .xmit = { - .size = CONFIG_UART3_TXBUFSIZE, + .size = CONFIG_16550_UART3_TXBUFSIZE, .buffer = g_uart3txbuffer, }, .ops = &g_uart_ops, @@ -294,7 +294,7 @@ static uart_dev_t g_uart3port = /* Which UART with be tty0/console and which tty1? tty2? tty3? */ -#if defined(CONFIG_UART0_SERIAL_CONSOLE) +#if defined(CONFIG_16550_UART0_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart0port /* UART0=console */ # define TTYS0_DEV g_uart0port /* UART0=ttyS0 */ # ifdef CONFIG_16550_UART1 @@ -333,7 +333,7 @@ static uart_dev_t g_uart3port = # undef TTYS3_DEV /* No ttyS3 */ # endif # endif -#elif defined(CONFIG_UART1_SERIAL_CONSOLE) +#elif defined(CONFIG_16550_UART1_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart1port /* UART1=console */ # define TTYS0_DEV g_uart1port /* UART1=ttyS0 */ # ifdef CONFIG_16550_UART @@ -372,7 +372,7 @@ static uart_dev_t g_uart3port = # undef TTYS3_DEV /* No ttyS3 */ # endif # endif -#elif defined(CONFIG_UART2_SERIAL_CONSOLE) +#elif defined(CONFIG_16550_UART2_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart2port /* UART2=console */ # define TTYS0_DEV g_uart2port /* UART2=ttyS0 */ # ifdef CONFIG_16550_UART @@ -411,7 +411,7 @@ static uart_dev_t g_uart3port = # undef TTYS3_DEV /* No ttyS3 */ # endif # endif -#elif defined(CONFIG_UART3_SERIAL_CONSOLE) +#elif defined(CONFIG_16550_UART3_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart3port /* UART3=console */ # define TTYS0_DEV g_uart3port /* UART3=ttyS0 */ # ifdef CONFIG_16550_UART @@ -1161,4 +1161,4 @@ int up_putc(int ch) } #endif -#endif /* CONFIG_UART_16550 */ +#endif /* CONFIG_16550_UART */ |