diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-02-08 14:23:22 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-02-11 14:44:47 +0100 |
commit | 6a22637506aba6b409045172cc7a3d994930a8e1 (patch) | |
tree | 19a1f33d9458d9aa5001cf11a278e6a2afac80af | |
parent | libchip/serial: Make NS16550 handler public (diff) | |
download | rtems-6a22637506aba6b409045172cc7a3d994930a8e1.tar.bz2 |
bsp/lpc24xx: Move UART probes to separate files
-rw-r--r-- | c/src/lib/libbsp/arm/lpc24xx/Makefile.am | 13 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/lpc24xx/console/console-config.c | 48 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-1.c | 38 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-2.c | 38 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-3.c | 38 | ||||
-rw-r--r-- | c/src/lib/libbsp/arm/lpc24xx/include/bsp.h | 8 |
6 files changed, 130 insertions, 53 deletions
diff --git a/c/src/lib/libbsp/arm/lpc24xx/Makefile.am b/c/src/lib/libbsp/arm/lpc24xx/Makefile.am index 275a934a09..63e9d2fad9 100644 --- a/c/src/lib/libbsp/arm/lpc24xx/Makefile.am +++ b/c/src/lib/libbsp/arm/lpc24xx/Makefile.am @@ -119,10 +119,15 @@ libbsp_a_SOURCES += irq/irq.c libbsp_a_SOURCES += irq/irq-dispatch.c # Console -libbsp_a_SOURCES += ../../shared/console.c \ - console/console-config.c ../../shared/console_select.c \ - ../../shared/console_read.c ../../shared/console_write.c \ - ../../shared/console_control.c +libbsp_a_SOURCES += ../../shared/console.c +libbsp_a_SOURCES += ../../shared/console_control.c +libbsp_a_SOURCES += ../../shared/console_read.c +libbsp_a_SOURCES += ../../shared/console_select.c +libbsp_a_SOURCES += ../../shared/console_write.c +libbsp_a_SOURCES += console/console-config.c +libbsp_a_SOURCES += console/uart-probe-1.c +libbsp_a_SOURCES += console/uart-probe-2.c +libbsp_a_SOURCES += console/uart-probe-3.c # Clock libbsp_a_SOURCES += ../../shared/clockdrv_shell.h diff --git a/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c b/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c index d81ad0cb16..a197efe742 100644 --- a/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c +++ b/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c @@ -42,54 +42,6 @@ static void lpc24xx_uart_set_register(uintptr_t addr, uint8_t i, uint8_t val) reg [i] = val; } -#ifdef LPC24XX_CONFIG_UART_1 - static bool lpc24xx_uart_probe_1(int minor) - { - static const lpc24xx_pin_range pins [] = { - LPC24XX_PIN_UART_1_TXD_P0_15, - LPC24XX_PIN_UART_1_RXD_P0_16, - LPC24XX_PIN_TERMINAL - }; - - lpc24xx_module_enable(LPC24XX_MODULE_UART_1, LPC24XX_MODULE_PCLK_DEFAULT); - lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION); - - return true; - } -#endif - -#ifdef LPC24XX_CONFIG_UART_2 - static bool lpc24xx_uart_probe_2(int minor) - { - static const lpc24xx_pin_range pins [] = { - LPC24XX_PIN_UART_2_TXD_P0_10, - LPC24XX_PIN_UART_2_RXD_P0_11, - LPC24XX_PIN_TERMINAL - }; - - lpc24xx_module_enable(LPC24XX_MODULE_UART_2, LPC24XX_MODULE_PCLK_DEFAULT); - lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION); - - return true; - } -#endif - -#ifdef LPC24XX_CONFIG_UART_3 - static bool lpc24xx_uart_probe_3(int minor) - { - static const lpc24xx_pin_range pins [] = { - LPC24XX_PIN_UART_3_TXD_P0_0, - LPC24XX_PIN_UART_3_RXD_P0_1, - LPC24XX_PIN_TERMINAL - }; - - lpc24xx_module_enable(LPC24XX_MODULE_UART_3, LPC24XX_MODULE_PCLK_DEFAULT); - lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION); - - return true; - } -#endif - console_tbl Console_Configuration_Ports [] = { #ifdef LPC24XX_CONFIG_CONSOLE { diff --git a/c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-1.c b/c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-1.c new file mode 100644 index 0000000000..94a5d2e44c --- /dev/null +++ b/c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-1.c @@ -0,0 +1,38 @@ +/** + * @file + * + * @ingroup lpc24xx + * + * @brief UART 1 probe. + */ + +/* + * Copyright (c) 2011-2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <bsp.h> +#include <bsp/io.h> + +bool lpc24xx_uart_probe_1(int minor) +{ + static const lpc24xx_pin_range pins [] = { + LPC24XX_PIN_UART_1_TXD_P0_15, + LPC24XX_PIN_UART_1_RXD_P0_16, + LPC24XX_PIN_TERMINAL + }; + + lpc24xx_module_enable(LPC24XX_MODULE_UART_1, LPC24XX_MODULE_PCLK_DEFAULT); + lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION); + + return true; +} diff --git a/c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-2.c b/c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-2.c new file mode 100644 index 0000000000..0e755ad990 --- /dev/null +++ b/c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-2.c @@ -0,0 +1,38 @@ +/** + * @file + * + * @ingroup lpc24xx + * + * @brief UART 2 probe. + */ + +/* + * Copyright (c) 2011-2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <bsp.h> +#include <bsp/io.h> + +bool lpc24xx_uart_probe_2(int minor) +{ + static const lpc24xx_pin_range pins [] = { + LPC24XX_PIN_UART_2_TXD_P0_10, + LPC24XX_PIN_UART_2_RXD_P0_11, + LPC24XX_PIN_TERMINAL + }; + + lpc24xx_module_enable(LPC24XX_MODULE_UART_2, LPC24XX_MODULE_PCLK_DEFAULT); + lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION); + + return true; +} diff --git a/c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-3.c b/c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-3.c new file mode 100644 index 0000000000..240f6d1f79 --- /dev/null +++ b/c/src/lib/libbsp/arm/lpc24xx/console/uart-probe-3.c @@ -0,0 +1,38 @@ +/** + * @file + * + * @ingroup lpc24xx + * + * @brief UART 3 probe. + */ + +/* + * Copyright (c) 2011-2013 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <bsp.h> +#include <bsp/io.h> + +bool lpc24xx_uart_probe_3(int minor) +{ + static const lpc24xx_pin_range pins [] = { + LPC24XX_PIN_UART_3_TXD_P0_0, + LPC24XX_PIN_UART_3_RXD_P0_1, + LPC24XX_PIN_TERMINAL + }; + + lpc24xx_module_enable(LPC24XX_MODULE_UART_3, LPC24XX_MODULE_PCLK_DEFAULT); + lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION); + + return true; +} diff --git a/c/src/lib/libbsp/arm/lpc24xx/include/bsp.h b/c/src/lib/libbsp/arm/lpc24xx/include/bsp.h index 210f2ab862..a0726a735d 100644 --- a/c/src/lib/libbsp/arm/lpc24xx/include/bsp.h +++ b/c/src/lib/libbsp/arm/lpc24xx/include/bsp.h @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. + * Copyright (c) 2008-2013 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -111,6 +111,12 @@ void *bsp_idle_thread(uintptr_t ignored); void bsp_restart(void *addr); +bool lpc24xx_uart_probe_1(int minor); + +bool lpc24xx_uart_probe_2(int minor); + +bool lpc24xx_uart_probe_3(int minor); + /** @} */ #ifdef __cplusplus |