1 | /* irq_init.c |
---|
2 | * |
---|
3 | * This file contains the implementation of rtems initialization |
---|
4 | * related to interrupt handling. |
---|
5 | * |
---|
6 | * CopyRight (C) 1999 valette@crf.canon.fr |
---|
7 | * |
---|
8 | * Enhanced by Jay Kulpinski <jskulpin@eng01.gdds.com> |
---|
9 | * to make it valid for MVME2300 Motorola boards. |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | * |
---|
15 | * irq_init.c,v 1.6.2.5 2003/09/04 18:45:20 joel Exp |
---|
16 | */ |
---|
17 | |
---|
18 | #include <libcpu/io.h> |
---|
19 | #include <libcpu/spr.h> |
---|
20 | #include <bsp/irq.h> |
---|
21 | #include <bsp.h> |
---|
22 | #include <psim.h> |
---|
23 | #include <libcpu/raw_exception.h> |
---|
24 | #include <rtems/bspIo.h> |
---|
25 | #include <bsp/openpic.h> |
---|
26 | |
---|
27 | static rtems_irq_connect_data rtemsIrq[BSP_IRQ_NUMBER]; |
---|
28 | static rtems_irq_global_settings initial_config; |
---|
29 | static rtems_irq_connect_data defaultIrq = { |
---|
30 | /* vectorIdex, hdl , handle , on , off , isOn */ |
---|
31 | 0, NULL, NULL , NULL, NULL, NULL |
---|
32 | }; |
---|
33 | static rtems_irq_prio irqPrioTable[BSP_IRQ_NUMBER]={ |
---|
34 | /* |
---|
35 | * Processor exceptions handled as interrupts |
---|
36 | */ |
---|
37 | 0 |
---|
38 | }; |
---|
39 | |
---|
40 | /* |
---|
41 | * This code assumes the exceptions management setup has already |
---|
42 | * been done. We just need to replace the exceptions that will |
---|
43 | * be handled like interrupt. On mcp750/mpc750 and many PPC processors |
---|
44 | * this means the decrementer exception and the external exception. |
---|
45 | */ |
---|
46 | void BSP_rtems_irq_mng_init(unsigned cpuId) |
---|
47 | { |
---|
48 | int i; |
---|
49 | |
---|
50 | /* |
---|
51 | * First initialize the Interrupt management hardware |
---|
52 | */ |
---|
53 | OpenPIC = (void*)PSIM.OpenPIC; |
---|
54 | openpic_init(1,0,0,16,0,0); |
---|
55 | |
---|
56 | /* |
---|
57 | * Initialize Rtems management interrupt table |
---|
58 | */ |
---|
59 | /* |
---|
60 | * re-init the rtemsIrq table |
---|
61 | */ |
---|
62 | for (i = 0; i < BSP_IRQ_NUMBER; i++) { |
---|
63 | rtemsIrq[i] = defaultIrq; |
---|
64 | rtemsIrq[i].name = i; |
---|
65 | } |
---|
66 | /* |
---|
67 | * Init initial Interrupt management config |
---|
68 | */ |
---|
69 | initial_config.irqNb = BSP_IRQ_NUMBER; |
---|
70 | initial_config.defaultEntry = defaultIrq; |
---|
71 | initial_config.irqHdlTbl = rtemsIrq; |
---|
72 | initial_config.irqBase = BSP_LOWEST_OFFSET; |
---|
73 | initial_config.irqPrioTbl = irqPrioTable; |
---|
74 | |
---|
75 | for (i = BSP_PCI_IRQ_LOWEST_OFFSET; i< BSP_PCI_IRQ_NUMBER; i++ ) { |
---|
76 | irqPrioTable[i] = 8; |
---|
77 | } |
---|
78 | |
---|
79 | if (!BSP_rtems_irq_mngt_set(&initial_config)) { |
---|
80 | /* |
---|
81 | * put something here that will show the failure... |
---|
82 | */ |
---|
83 | BSP_panic( |
---|
84 | "Unable to initialize RTEMS interrupt Management!!! System locked\n" |
---|
85 | ); |
---|
86 | } |
---|
87 | |
---|
88 | #ifdef TRACE_IRQ_INIT |
---|
89 | printk("RTEMS IRQ management is now operationnal\n"); |
---|
90 | #endif |
---|
91 | } |
---|