1 | /*===============================================================*\ |
---|
2 | | Project: RTEMS Haleakala BSP | |
---|
3 | | * by Michael Hamel ADInstruments Ltd 2008 | |
---|
4 | +-----------------------------------------------------------------+ |
---|
5 | | The license and distribution terms for this file may be | |
---|
6 | | found in the file LICENSE in this distribution or at | |
---|
7 | | | |
---|
8 | | http://www.rtems.org/license/LICENSE. | |
---|
9 | | | |
---|
10 | +-----------------------------------------------------------------+ |
---|
11 | | this file contains the irq controller handler | |
---|
12 | \*===============================================================*/ |
---|
13 | #include <libcpu/spr.h> |
---|
14 | #include <bsp/irq.h> |
---|
15 | #include <bsp.h> |
---|
16 | #include <bsp/vectors.h> |
---|
17 | #include <rtems/bspIo.h> |
---|
18 | #include <rtems/powerpc/powerpc.h> |
---|
19 | |
---|
20 | |
---|
21 | /* |
---|
22 | * default on/off function |
---|
23 | */ |
---|
24 | static void nop_func(void) |
---|
25 | { |
---|
26 | } |
---|
27 | |
---|
28 | /* |
---|
29 | * default isOn function |
---|
30 | */ |
---|
31 | static int not_connected(void) |
---|
32 | { |
---|
33 | return 0; |
---|
34 | } |
---|
35 | |
---|
36 | static rtems_irq_connect_data rtemsIrq[BSP_IRQ_NUMBER]; |
---|
37 | static rtems_irq_global_settings initial_config; |
---|
38 | static rtems_irq_connect_data defaultIrq = { |
---|
39 | .name = 0, |
---|
40 | .hdl = NULL, |
---|
41 | .handle = NULL, |
---|
42 | .on = (rtems_irq_enable) nop_func, |
---|
43 | .off = (rtems_irq_disable) nop_func, |
---|
44 | .isOn = (rtems_irq_is_enabled) not_connected, |
---|
45 | #ifdef BSP_SHARED_HANDLER_SUPPORT |
---|
46 | .next_handler = NULL |
---|
47 | #endif |
---|
48 | }; |
---|
49 | |
---|
50 | static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={ |
---|
51 | /* |
---|
52 | * Processor exceptions handled as interrupts |
---|
53 | */ |
---|
54 | 0 |
---|
55 | }; |
---|
56 | |
---|
57 | /* |
---|
58 | * This code assumes the exceptions management setup has already |
---|
59 | * been done. We just need to replace the exceptions that will |
---|
60 | * be handled like interrupt. On mcp750/mpc750 and many PPC processors |
---|
61 | * this means the decrementer exception and the external exception. |
---|
62 | */ |
---|
63 | |
---|
64 | void BSP_rtems_irq_mng_init(unsigned cpuId) |
---|
65 | { |
---|
66 | int i; |
---|
67 | |
---|
68 | /* |
---|
69 | * re-init the rtemsIrq table |
---|
70 | */ |
---|
71 | for (i = 0; i < BSP_IRQ_NUMBER; i++) { |
---|
72 | rtemsIrq[i] = defaultIrq; |
---|
73 | rtemsIrq[i].name = i; |
---|
74 | } |
---|
75 | /* |
---|
76 | * Init initial Interrupt management config |
---|
77 | */ |
---|
78 | initial_config.irqNb = BSP_IRQ_NUMBER; |
---|
79 | initial_config.defaultEntry = defaultIrq; |
---|
80 | initial_config.irqHdlTbl = rtemsIrq; |
---|
81 | initial_config.irqBase = BSP_LOWEST_OFFSET; |
---|
82 | initial_config.irqPrioTbl = irqPrioTable; |
---|
83 | |
---|
84 | if (!BSP_rtems_irq_mngt_set(&initial_config)) { |
---|
85 | /* |
---|
86 | * put something here that will show the failure... |
---|
87 | */ |
---|
88 | rtems_panic( |
---|
89 | "Unable to initialize RTEMS interrupt management!!! System locked\n" |
---|
90 | ); |
---|
91 | } |
---|
92 | |
---|
93 | #ifdef TRACE_IRQ_INIT |
---|
94 | printk("RTEMS IRQ management is now operational\n"); |
---|
95 | #endif |
---|
96 | } |
---|