[rtems commit] bsp/leon3: Use sysinit for bsp_debug_uart_init()

Sebastian Huber sebh at rtems.org
Mon Jun 20 06:21:10 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jun 20 08:16:54 2016 +0200

bsp/leon3: Use sysinit for bsp_debug_uart_init()

---

 c/src/lib/libbsp/sparc/leon3/console/printk_support.c | 9 ++++++++-
 c/src/lib/libbsp/sparc/leon3/include/leon.h           | 2 --
 c/src/lib/libbsp/sparc/leon3/startup/bspstart.c       | 4 ----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/leon3/console/printk_support.c b/c/src/lib/libbsp/sparc/leon3/console/printk_support.c
index 7b8d343..1af0efd 100644
--- a/c/src/lib/libbsp/sparc/leon3/console/printk_support.c
+++ b/c/src/lib/libbsp/sparc/leon3/console/printk_support.c
@@ -18,6 +18,7 @@
 #include <bsp.h>
 #include <leon.h>
 #include <rtems/libio.h>
+#include <rtems/sysinit.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <stdio.h>
@@ -38,7 +39,7 @@ static int pre_printk_pos = 0;
 /* Initialize the BSP system debug console layer. It will scan AMBA Plu&Play
  * for a debug APBUART and enable RX/TX for that UART.
  */
-void bsp_debug_uart_init(void)
+static void bsp_debug_uart_init(void)
 {
   int i;
   struct ambapp_dev *adev;
@@ -76,6 +77,12 @@ void bsp_debug_uart_init(void)
   }
 }
 
+RTEMS_SYSINIT_ITEM(
+  bsp_debug_uart_init,
+  RTEMS_SYSINIT_BSP_START,
+  RTEMS_SYSINIT_ORDER_THIRD
+);
+
 /* putchar/getchar for printk */
 static void bsp_out_char(char c)
 {
diff --git a/c/src/lib/libbsp/sparc/leon3/include/leon.h b/c/src/lib/libbsp/sparc/leon3/include/leon.h
index bbf94d9..ba0673f 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/leon.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/leon.h
@@ -392,8 +392,6 @@ void leon3_cpu_counter_initialize(void);
 /* GRLIB extended IRQ controller register */
 void leon3_ext_irq_init(void);
 
-void bsp_debug_uart_init(void);
-
 void leon3_power_down_loop(void) RTEMS_NO_RETURN;
 
 static inline uint32_t leon3_get_cpu_count(
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
index a49afd2..ec041f1 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c
@@ -18,7 +18,6 @@
 
 #include <bsp.h>
 #include <leon.h>
-#include <rtems/bspIo.h>
 #include <bsp/bootcard.h>
 
 #if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING)
@@ -67,7 +66,4 @@ void bsp_start( void )
   LEON3_Cpu_Index = _LEON3_Get_current_processor();
 
   leon3_cpu_counter_initialize();
-
-  /* find debug UART for printk() */
-  bsp_debug_uart_init();
 }



More information about the vc mailing list