summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon2
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-17 06:57:46 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-20 09:49:36 +0200
commitc4ccf26cb7808786e15312b41c3055b2da75203b (patch)
treef25c7d75c2543e447847e84d978db3d23a433418 /c/src/lib/libbsp/sparc/leon2
parentbsp/motorola_powerpc: Move bspstart.c to bsps (diff)
downloadrtems-c4ccf26cb7808786e15312b41c3055b2da75203b.tar.bz2
bsps: Convert all bsp_predriver_hook()
Use RTEMS_SYSINIT_ITEM() instead. Update #2408.
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon2')
-rw-r--r--c/src/lib/libbsp/sparc/leon2/Makefile.am1
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c88
-rw-r--r--c/src/lib/libbsp/sparc/leon2/startup/bspstart.c77
3 files changed, 77 insertions, 89 deletions
diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am
index a6d5d48564..edbe4ce025 100644
--- a/c/src/lib/libbsp/sparc/leon2/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am
@@ -23,7 +23,6 @@ librtemsbsp_a_SOURCES =
# startup
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c
-librtemsbsp_a_SOURCES += startup/bsppredriver.c
librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspreset-empty.c
librtemsbsp_a_SOURCES += startup/bspstart.c
librtemsbsp_a_SOURCES += ../shared/startup/bspgetworkarea.c
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c b/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c
deleted file mode 100644
index b11ad4cb59..0000000000
--- a/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file
- * @ingroup sparc_leon2
- * @brief Installs BSP pre-driver hook
- */
-
-/* Installs the BSP pre-driver hook
- *
- * COPYRIGHT (c) 2011
- * Aeroflex Gaisler
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#include <bsp.h>
-#include <bsp/bootcard.h>
-
-/* If RTEMS_DRVMGR_STARTUP is defined extra code is added that
- * registers the LEON2 AMBA bus driver as root driver into the
- * driver manager.
- *
- * The structues here are declared weak so that the user can override
- * the configuration and add custom cores in the RTEMS project.
- */
-#ifdef RTEMS_DRVMGR_STARTUP
-#include <drvmgr/drvmgr.h>
-#include <drvmgr/leon2_amba_bus.h>
-
-/* All drivers included by BSP, this is overridden by the user by including
- * the devmgr_confdefs.h. No specifc drivers needed by BSP since IRQ/TIMER/UART
- * is not drvmgr drivers.
- */
-drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) =
-{
- NULL /* End array with NULL */
-};
-
-/* Defines what cores are avilable on the bus in addition to the standard
- * LEON2 peripherals.
- */
-struct leon2_core leon2_amba_custom_cores[] __attribute__((weak)) =
-{
- EMPTY_LEON2_CORE
-};
-
-/* Configure LEON2 Root bus driver */
-struct leon2_bus leon2_bus_config __attribute__((weak)) =
-{
- &leon2_std_cores[0], /* The standard cores, defined by driver */
- &leon2_amba_custom_cores[0], /* custom cores, defined by us */
- DRVMGR_TRANSLATE_ONE2ONE,
- DRVMGR_TRANSLATE_ONE2ONE,
-};
-
-/* Driver resources on LEON2 AMBA bus. Used to set options for particular
- * LEON2 cores, it is up to the driver to look at the configuration paramters
- * once started.
- */
-struct drvmgr_bus_res leon2_amba_res __attribute__((weak)) =
-{
- .next = NULL,
- .resource = {
- DRVMGR_RES_EMPTY
- },
-};
-#endif /* RTEMS_DRVMGR_STARTUP */
-
-/*
- * bsp_predriver_hook
- *
- * BSP predriver hook. Called just before drivers are initialized.
- * Is used to initialize shared interrupt handling.
- */
-void bsp_predriver_hook( void )
-{
- bsp_spurious_initialize();
-
- /* Initialize shared interrupt handling, must be done after IRQ
- * controller has been found and initialized.
- */
- BSP_shared_interrupt_init();
-
-#ifdef RTEMS_DRVMGR_STARTUP
- leon2_root_register(&leon2_bus_config, &leon2_amba_res);
-#endif
-}
diff --git a/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c
index b3da955410..f2ed8ae16c 100644
--- a/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c
+++ b/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c
@@ -7,6 +7,8 @@
/*
* LEON2 Cache Snooping Support
*
+ * COPYRIGHT (c) 2011
+ * Aeroflex Gaisler
*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
@@ -25,6 +27,7 @@
#include <bsp.h>
#include <bsp/bootcard.h>
+#include <rtems/sysinit.h>
/*
* Tells us if data cache snooping is available
@@ -48,3 +51,77 @@ void bsp_start( void )
{
CPU_SPARC_HAS_SNOOPING = set_snooping();
}
+
+/* If RTEMS_DRVMGR_STARTUP is defined extra code is added that
+ * registers the LEON2 AMBA bus driver as root driver into the
+ * driver manager.
+ *
+ * The structues here are declared weak so that the user can override
+ * the configuration and add custom cores in the RTEMS project.
+ */
+#ifdef RTEMS_DRVMGR_STARTUP
+#include <drvmgr/drvmgr.h>
+#include <drvmgr/leon2_amba_bus.h>
+
+/* All drivers included by BSP, this is overridden by the user by including
+ * the devmgr_confdefs.h. No specifc drivers needed by BSP since IRQ/TIMER/UART
+ * is not drvmgr drivers.
+ */
+drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) =
+{
+ NULL /* End array with NULL */
+};
+
+/* Defines what cores are avilable on the bus in addition to the standard
+ * LEON2 peripherals.
+ */
+struct leon2_core leon2_amba_custom_cores[] __attribute__((weak)) =
+{
+ EMPTY_LEON2_CORE
+};
+
+/* Configure LEON2 Root bus driver */
+struct leon2_bus leon2_bus_config __attribute__((weak)) =
+{
+ &leon2_std_cores[0], /* The standard cores, defined by driver */
+ &leon2_amba_custom_cores[0], /* custom cores, defined by us */
+ DRVMGR_TRANSLATE_ONE2ONE,
+ DRVMGR_TRANSLATE_ONE2ONE,
+};
+
+/* Driver resources on LEON2 AMBA bus. Used to set options for particular
+ * LEON2 cores, it is up to the driver to look at the configuration paramters
+ * once started.
+ */
+struct drvmgr_bus_res leon2_amba_res __attribute__((weak)) =
+{
+ .next = NULL,
+ .resource = {
+ DRVMGR_RES_EMPTY
+ },
+};
+#endif /* RTEMS_DRVMGR_STARTUP */
+
+/*
+ * Called just before drivers are initialized. Is used to initialize shared
+ * interrupt handling.
+ */
+static void leon2_pre_driver_hook( void )
+{
+ bsp_spurious_initialize();
+
+ /* Initialize shared interrupt handling, must be done after IRQ
+ * controller has been found and initialized.
+ */
+ BSP_shared_interrupt_init();
+
+#ifdef RTEMS_DRVMGR_STARTUP
+ leon2_root_register(&leon2_bus_config, &leon2_amba_res);
+#endif
+}
+
+RTEMS_SYSINIT_ITEM(
+ leon2_pre_driver_hook,
+ RTEMS_SYSINIT_BSP_PRE_DRIVERS,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);