1 | /** |
---|
2 | * @file |
---|
3 | * @ingroup sparc_leon2 |
---|
4 | * @brief Installs BSP pre-driver hook |
---|
5 | */ |
---|
6 | |
---|
7 | /* Installs the BSP pre-driver hook |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 2011 |
---|
10 | * Aeroflex Gaisler |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #include <bsp.h> |
---|
18 | #include <bsp/bootcard.h> |
---|
19 | |
---|
20 | /* If RTEMS_DRVMGR_STARTUP is defined extra code is added that |
---|
21 | * registers the LEON2 AMBA bus driver as root driver into the |
---|
22 | * driver manager. |
---|
23 | * |
---|
24 | * The structues here are declared weak so that the user can override |
---|
25 | * the configuration and add custom cores in the RTEMS project. |
---|
26 | */ |
---|
27 | #ifdef RTEMS_DRVMGR_STARTUP |
---|
28 | #include <drvmgr/leon2_amba_bus.h> |
---|
29 | |
---|
30 | /* All drivers included by BSP, this is overridden by the user by including |
---|
31 | * the devmgr_confdefs.h. No specifc drivers needed by BSP since IRQ/TIMER/UART |
---|
32 | * is not drvmgr drivers. |
---|
33 | */ |
---|
34 | drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) = |
---|
35 | { |
---|
36 | NULL /* End array with NULL */ |
---|
37 | }; |
---|
38 | |
---|
39 | /* Defines what cores are avilable on the bus in addition to the standard |
---|
40 | * LEON2 peripherals. |
---|
41 | */ |
---|
42 | struct leon2_core leon2_amba_custom_cores[] __attribute__((weak)) = |
---|
43 | { |
---|
44 | EMPTY_LEON2_CORE |
---|
45 | }; |
---|
46 | |
---|
47 | /* Configure LEON2 Root bus driver */ |
---|
48 | struct leon2_bus leon2_bus_config __attribute__((weak)) = |
---|
49 | { |
---|
50 | &leon2_std_cores[0], /* The standard cores, defined by driver */ |
---|
51 | &leon2_amba_custom_cores[0], /* custom cores, defined by us */ |
---|
52 | DRVMGR_TRANSLATE_ONE2ONE, |
---|
53 | DRVMGR_TRANSLATE_ONE2ONE, |
---|
54 | }; |
---|
55 | |
---|
56 | /* Driver resources on LEON2 AMBA bus. Used to set options for particular |
---|
57 | * LEON2 cores, it is up to the driver to look at the configuration paramters |
---|
58 | * once started. |
---|
59 | */ |
---|
60 | struct drvmgr_bus_res leon2_amba_res __attribute__((weak)) = |
---|
61 | { |
---|
62 | .next = NULL, |
---|
63 | .resource = { |
---|
64 | DRVMGR_RES_EMPTY |
---|
65 | }, |
---|
66 | }; |
---|
67 | |
---|
68 | /* |
---|
69 | * bsp_driver_level_hook |
---|
70 | * |
---|
71 | * BSP driver level hook. Called just after drivers have reached initialization |
---|
72 | * level 'level' (1,2,3,4). See exinit.c for meaning of the every level. |
---|
73 | */ |
---|
74 | void bsp_driver_level_hook( int level ) |
---|
75 | { |
---|
76 | } |
---|
77 | |
---|
78 | #endif |
---|
79 | |
---|
80 | /* |
---|
81 | * bsp_predriver_hook |
---|
82 | * |
---|
83 | * BSP predriver hook. Called just before drivers are initialized. |
---|
84 | * Is used to initialize shared interrupt handling. |
---|
85 | */ |
---|
86 | void bsp_predriver_hook( void ) |
---|
87 | { |
---|
88 | bsp_spurious_initialize(); |
---|
89 | |
---|
90 | /* Initialize shared interrupt handling, must be done after IRQ |
---|
91 | * controller has been found and initialized. |
---|
92 | */ |
---|
93 | BSP_shared_interrupt_init(); |
---|
94 | |
---|
95 | #ifdef RTEMS_DRVMGR_STARTUP |
---|
96 | leon2_root_register(&leon2_bus_config, &leon2_amba_res); |
---|
97 | #endif |
---|
98 | } |
---|