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.com/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 <libcpu/raw_exception.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() |
---|
25 | { |
---|
26 | } |
---|
27 | |
---|
28 | /* |
---|
29 | * default isOn function |
---|
30 | */ |
---|
31 | static int not_connected() |
---|
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, hdl , handle , on , off , isOn */ |
---|
40 | 0, nop_func , NULL , nop_func , nop_func , not_connected |
---|
41 | }; |
---|
42 | |
---|
43 | static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={ |
---|
44 | /* |
---|
45 | * Processor exceptions handled as interrupts |
---|
46 | */ |
---|
47 | 0 |
---|
48 | }; |
---|
49 | |
---|
50 | /* |
---|
51 | * This code assumes the exceptions management setup has already |
---|
52 | * been done. We just need to replace the exceptions that will |
---|
53 | * be handled like interrupt. On mcp750/mpc750 and many PPC processors |
---|
54 | * this means the decrementer exception and the external exception. |
---|
55 | */ |
---|
56 | |
---|
57 | void BSP_rtems_irq_mng_init(unsigned cpuId) |
---|
58 | { |
---|
59 | int i; |
---|
60 | |
---|
61 | /* |
---|
62 | * re-init the rtemsIrq table |
---|
63 | */ |
---|
64 | for (i = 0; i < BSP_IRQ_NUMBER; i++) { |
---|
65 | rtemsIrq[i] = defaultIrq; |
---|
66 | rtemsIrq[i].name = i; |
---|
67 | } |
---|
68 | /* |
---|
69 | * Init initial Interrupt management config |
---|
70 | */ |
---|
71 | initial_config.irqNb = BSP_IRQ_NUMBER; |
---|
72 | initial_config.defaultEntry = defaultIrq; |
---|
73 | initial_config.irqHdlTbl = rtemsIrq; |
---|
74 | initial_config.irqBase = BSP_LOWEST_OFFSET; |
---|
75 | initial_config.irqPrioTbl = irqPrioTable; |
---|
76 | |
---|
77 | if (!BSP_rtems_irq_mngt_set(&initial_config)) { |
---|
78 | /* |
---|
79 | * put something here that will show the failure... |
---|
80 | */ |
---|
81 | BSP_panic( |
---|
82 | "Unable to initialize RTEMS interrupt management!!! System locked\n" |
---|
83 | ); |
---|
84 | } |
---|
85 | |
---|
86 | #ifdef TRACE_IRQ_INIT |
---|
87 | printk("RTEMS IRQ management is now operational\n"); |
---|
88 | #endif |
---|
89 | } |
---|