[rtems commit] bsp/lpc24xx: Move UART probes to separate files

Sebastian Huber sebh at rtems.org
Mon Feb 11 13:40:32 UTC 2013


Module:    rtems
Branch:    master
Commit:    6a22637506aba6b409045172cc7a3d994930a8e1
Changeset: http://git.rtems.org/rtems/commit/?id=6a22637506aba6b409045172cc7a3d994930a8e1

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Feb  8 14:23:22 2013 +0100

bsp/lpc24xx: Move UART probes to separate files

---

 c/src/lib/libbsp/arm/lpc24xx/Makefile.am           |   13 ++++--
 .../libbsp/arm/lpc24xx/console/console-config.c    |   48 --------------------
 .../lib/libbsp/arm/lpc24xx/console/uart-probe-1.c  |   38 +++++++++++++++
 .../lib/libbsp/arm/lpc24xx/console/uart-probe-2.c  |   38 +++++++++++++++
 .../lib/libbsp/arm/lpc24xx/console/uart-probe-3.c  |   38 +++++++++++++++
 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 275a934..63e9d2f 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 d81ad0c..a197efe 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 0000000..94a5d2e
--- /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 at 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 0000000..0e755ad
--- /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 at 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 0000000..240f6d1
--- /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 at 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 210f2ab..a0726a7 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




More information about the vc mailing list