15 #include <bsp/fatal.h> 18 #include <rtems/sysinit.h> 20 unsigned int leon3_timer_prescaler __attribute__((weak)) = 0;
21 int leon3_timer_core_index __attribute__((weak)) = 0;
33 #ifdef RTEMS_DRVMGR_STARTUP 34 #include <drvmgr/drvmgr.h> 35 #include <grlib/ambapp_bus_grlib.h> 37 extern void gptimer_register_drv (
void);
38 extern void apbuart_cons_register_drv(
void);
42 drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) =
45 apbuart_cons_register_drv,
53 struct drvmgr_bus_res grlib_drv_resources __attribute__((weak)) =
63 struct grlib_config grlib_bus_config =
74 volatile struct irqmp_regs *LEON3_IrqCtrl_Regs;
89 static void amba_initialize(
void)
99 ambapp_scan(&ambapp_plb, LEON3_IO_AREA, NULL, NULL);
102 adev = (
void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
103 VENDOR_GAISLER, GAISLER_IRQMP,
104 ambapp_find_by_idx, NULL);
110 bsp_fatal(LEON3_FATAL_NO_IRQMP_CONTROLLER);
113 LEON3_IrqCtrl_Regs = (
volatile struct irqmp_regs *)DEV_TO_APB(adev)->start;
114 LEON3_IrqCtrl_Adev = adev;
115 if ((LEON3_IrqCtrl_Regs->ampctrl >> 28) > 0) {
121 icsel = LEON3_IrqCtrl_Regs->icsel[LEON3_Cpu_Index/8];
122 icsel = (icsel >> ((7 - (LEON3_Cpu_Index & 0x7)) * 4)) & 0xf;
123 LEON3_IrqCtrl_Regs += icsel;
125 LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] = 0;
126 LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index] = 0;
127 LEON3_IrqCtrl_Regs->iclear = 0xffffffff;
130 leon3_ext_irq_init();
133 adev = (
void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
134 VENDOR_GAISLER, GAISLER_GPTIMER,
135 ambapp_find_by_idx, &leon3_timer_core_index);
137 LEON3_Timer_Regs = (
volatile struct gptimer_regs *)DEV_TO_APB(adev)->start;
138 LEON3_Timer_Adev = adev;
144 (LEON3_Timer_Regs->scaler_reload + 1)
145 * LEON3_GPTIMER_0_FREQUENCY_SET_BY_BOOT_LOADER
152 if (leon3_timer_prescaler)
153 LEON3_Timer_Regs->scaler_reload = leon3_timer_prescaler;
156 #ifdef RTEMS_DRVMGR_STARTUP 158 ambapp_grlib_root_register(&grlib_bus_config);
164 RTEMS_SYSINIT_BSP_START,
165 RTEMS_SYSINIT_ORDER_SECOND
LEON3 BSP data types and macros.
#define RTEMS_INTERRUPT_LOCK_INITIALIZER(_name)
%