[8d830fae] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * @ingroup sparc_leon2 |
---|
| 4 | * @brief Installs BSP pre-driver hook |
---|
| 5 | */ |
---|
| 6 | |
---|
[95518e59] | 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 |
---|
[c499856] | 14 | * http://www.rtems.org/license/LICENSE. |
---|
[95518e59] | 15 | */ |
---|
| 16 | |
---|
| 17 | #include <bsp.h> |
---|
[12579b2d] | 18 | #include <bsp/bootcard.h> |
---|
[95518e59] | 19 | |
---|
[3db9e5b0] | 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 |
---|
[47190194] | 28 | #include <drvmgr/drvmgr.h> |
---|
[3db9e5b0] | 29 | #include <drvmgr/leon2_amba_bus.h> |
---|
| 30 | |
---|
| 31 | /* All drivers included by BSP, this is overridden by the user by including |
---|
| 32 | * the devmgr_confdefs.h. No specifc drivers needed by BSP since IRQ/TIMER/UART |
---|
| 33 | * is not drvmgr drivers. |
---|
| 34 | */ |
---|
[291c5391] | 35 | drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) = |
---|
[3db9e5b0] | 36 | { |
---|
[291c5391] | 37 | NULL /* End array with NULL */ |
---|
[3db9e5b0] | 38 | }; |
---|
| 39 | |
---|
| 40 | /* Defines what cores are avilable on the bus in addition to the standard |
---|
| 41 | * LEON2 peripherals. |
---|
| 42 | */ |
---|
| 43 | struct leon2_core leon2_amba_custom_cores[] __attribute__((weak)) = |
---|
| 44 | { |
---|
| 45 | EMPTY_LEON2_CORE |
---|
| 46 | }; |
---|
| 47 | |
---|
| 48 | /* Configure LEON2 Root bus driver */ |
---|
| 49 | struct leon2_bus leon2_bus_config __attribute__((weak)) = |
---|
| 50 | { |
---|
| 51 | &leon2_std_cores[0], /* The standard cores, defined by driver */ |
---|
| 52 | &leon2_amba_custom_cores[0], /* custom cores, defined by us */ |
---|
| 53 | DRVMGR_TRANSLATE_ONE2ONE, |
---|
| 54 | DRVMGR_TRANSLATE_ONE2ONE, |
---|
| 55 | }; |
---|
| 56 | |
---|
| 57 | /* Driver resources on LEON2 AMBA bus. Used to set options for particular |
---|
| 58 | * LEON2 cores, it is up to the driver to look at the configuration paramters |
---|
| 59 | * once started. |
---|
| 60 | */ |
---|
| 61 | struct drvmgr_bus_res leon2_amba_res __attribute__((weak)) = |
---|
| 62 | { |
---|
| 63 | .next = NULL, |
---|
| 64 | .resource = { |
---|
[bef5e23e] | 65 | DRVMGR_RES_EMPTY |
---|
[3db9e5b0] | 66 | }, |
---|
| 67 | }; |
---|
[6d21a3f2] | 68 | #endif /* RTEMS_DRVMGR_STARTUP */ |
---|
[3db9e5b0] | 69 | |
---|
| 70 | /* |
---|
| 71 | * bsp_predriver_hook |
---|
| 72 | * |
---|
| 73 | * BSP predriver hook. Called just before drivers are initialized. |
---|
| 74 | * Is used to initialize shared interrupt handling. |
---|
| 75 | */ |
---|
[95518e59] | 76 | void bsp_predriver_hook( void ) |
---|
| 77 | { |
---|
[938ef78c] | 78 | bsp_spurious_initialize(); |
---|
| 79 | |
---|
[95518e59] | 80 | /* Initialize shared interrupt handling, must be done after IRQ |
---|
| 81 | * controller has been found and initialized. |
---|
| 82 | */ |
---|
| 83 | BSP_shared_interrupt_init(); |
---|
[3db9e5b0] | 84 | |
---|
| 85 | #ifdef RTEMS_DRVMGR_STARTUP |
---|
| 86 | leon2_root_register(&leon2_bus_config, &leon2_amba_res); |
---|
| 87 | #endif |
---|
[95518e59] | 88 | } |
---|