diff options
author | Martin Galvan <martin.galvan@tallertechnologies.com> | 2015-03-11 16:57:23 -0300 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-03-20 09:16:07 +0100 |
commit | 7b35a36fb16491dbdb98106ab39d35b8d19598e5 (patch) | |
tree | a5c23a33c3316623fa5fa5129f6669147f249bb0 /c/src/lib/libbsp/arm/lpc176x/console/console-config.c | |
parent | score: Fix _Thread_Change_priority() (diff) | |
download | rtems-7b35a36fb16491dbdb98106ab39d35b8d19598e5.tar.bz2 |
Add CAN, PWM, ADC and UART1/2/3 support to the LPC176x BSP.
This patch adds support for the following devices to the LPC176x BSP:
* CAN
* PWM
* ADC
It also adds the probe routines for UART1/2/3 to the console_device_table in console-config.c, and enables UART1 in configure.ac.
Diffstat (limited to 'c/src/lib/libbsp/arm/lpc176x/console/console-config.c')
-rw-r--r-- | c/src/lib/libbsp/arm/lpc176x/console/console-config.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/c/src/lib/libbsp/arm/lpc176x/console/console-config.c b/c/src/lib/libbsp/arm/lpc176x/console/console-config.c index 3b56a2ca56..6e1ebc29ab 100644 --- a/c/src/lib/libbsp/arm/lpc176x/console/console-config.c +++ b/c/src/lib/libbsp/arm/lpc176x/console/console-config.c @@ -62,6 +62,42 @@ static inline void lpc176x_uart_set_register( reg[ i ] = val; } +static bool lpc176x_uart1_probe(rtems_termios_device_context *ctx) +{ + (void)ctx; + + lpc176x_module_enable( LPC176X_MODULE_UART_1, LPC176X_MODULE_PCLK_DEFAULT ); + + lpc176x_pin_select( LPC176X_PIN_UART_1_TXD, LPC176X_PIN_FUNCTION_01 ); + lpc176x_pin_select( LPC176X_PIN_UART_1_RXD, LPC176X_PIN_FUNCTION_01 ); + + return true; +} + +static bool lpc176x_uart2_probe(rtems_termios_device_context *ctx) +{ + (void)ctx; + + lpc176x_module_enable( LPC176X_MODULE_UART_2, LPC176X_MODULE_PCLK_DEFAULT ); + + lpc176x_pin_select( LPC176X_PIN_UART_2_TXD, LPC176X_PIN_FUNCTION_01 ); + lpc176x_pin_select( LPC176X_PIN_UART_2_RXD, LPC176X_PIN_FUNCTION_01 ); + + return true; +} + +static bool lpc176x_uart3_probe(rtems_termios_device_context *ctx) +{ + (void)ctx; + + lpc176x_module_enable( LPC176X_MODULE_UART_3, LPC176X_MODULE_PCLK_DEFAULT ); + + lpc176x_pin_select( LPC176X_PIN_UART_3_TXD, LPC176X_PIN_FUNCTION_10 ); + lpc176x_pin_select( LPC176X_PIN_UART_3_RXD, LPC176X_PIN_FUNCTION_10 ); + + return true; +} + #ifdef LPC176X_CONFIG_CONSOLE static ns16550_context lpc176x_uart_context_0 = { .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("UART 0"), @@ -126,7 +162,7 @@ const console_device console_device_table[] = { #ifdef LPC176X_CONFIG_UART_1 { .device_file = "/dev/ttyS1", - .probe = ns16550_probe, + .probe = lpc176x_uart1_probe, .handler = &ns16550_handler_interrupt, .context = &lpc176x_uart_context_1.base }, @@ -134,7 +170,7 @@ const console_device console_device_table[] = { #ifdef LPC176X_CONFIG_UART_2 { .device_file = "/dev/ttyS2", - .probe = ns16550_probe, + .probe = lpc176x_uart2_probe, .handler = &ns16550_handler_interrupt, .context = &lpc176x_uart_context_2.base }, @@ -142,7 +178,7 @@ const console_device console_device_table[] = { #ifdef LPC176X_CONFIG_UART_3 { .device_file = "/dev/ttyS3", - .probe = ns16550_probe, + .probe = lpc176x_uart3_probe, .handler = &ns16550_handler_interrupt, .context = &lpc176x_uart_context_3.base }, |