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 | * Modified by T. Straumann for the 'beatnik' BSP. |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #include <rtems.h> |
---|
19 | #include <bsp.h> |
---|
20 | #include <bsp/irq.h> |
---|
21 | #include <bsp/vectors.h> |
---|
22 | #include <rtems/bspIo.h> |
---|
23 | |
---|
24 | #if 0 |
---|
25 | #include <libcpu/io.h> |
---|
26 | #include <libcpu/spr.h> |
---|
27 | #include <bsp/pci.h> |
---|
28 | #include <bsp/residual.h> |
---|
29 | #include <bsp/openpic.h> |
---|
30 | #include <bsp/irq.h> |
---|
31 | #include <bsp.h> |
---|
32 | #include <bsp/motorola.h> |
---|
33 | #endif |
---|
34 | |
---|
35 | /* |
---|
36 | #define SHOW_ISA_PCI_BRIDGE_SETTINGS |
---|
37 | */ |
---|
38 | |
---|
39 | extern unsigned int external_exception_vector_prolog_code_size[]; |
---|
40 | extern void external_exception_vector_prolog_code(void); |
---|
41 | extern unsigned int decrementer_exception_vector_prolog_code_size[]; |
---|
42 | extern void decrementer_exception_vector_prolog_code(void); |
---|
43 | |
---|
44 | /* |
---|
45 | * default handler |
---|
46 | */ |
---|
47 | static void nop_func(void *arg){} |
---|
48 | |
---|
49 | static rtems_irq_connect_data rtemsIrq[BSP_IRQ_NUMBER]; |
---|
50 | static rtems_irq_global_settings initial_config; |
---|
51 | static rtems_irq_prio rtemsPrioTbl[BSP_IRQ_NUMBER]; |
---|
52 | static rtems_irq_connect_data defaultIrq = { |
---|
53 | name: 0, |
---|
54 | hdl: nop_func, |
---|
55 | handle: 0, |
---|
56 | on: 0, |
---|
57 | off: 0, |
---|
58 | isOn: 0 |
---|
59 | }; |
---|
60 | |
---|
61 | |
---|
62 | /* |
---|
63 | * This code assumes the exceptions management setup has already |
---|
64 | * been done. We just need to replace the exceptions that will |
---|
65 | * be handled like interrupt. On mcp750/mpc750 and many PPC processors |
---|
66 | * this means the decrementer exception and the external exception. |
---|
67 | */ |
---|
68 | |
---|
69 | void BSP_rtems_irq_mng_init(unsigned cpuId) |
---|
70 | { |
---|
71 | int i; |
---|
72 | |
---|
73 | /* |
---|
74 | * First initialize the Interrupt management hardware |
---|
75 | */ |
---|
76 | |
---|
77 | /* |
---|
78 | * Initialize Rtems management interrupt table |
---|
79 | */ |
---|
80 | |
---|
81 | /* |
---|
82 | * re-init the rtemsIrq table |
---|
83 | */ |
---|
84 | for (i = BSP_LOWEST_OFFSET; i <= BSP_MAX_OFFSET; i++) { |
---|
85 | rtemsIrq[i] = defaultIrq; |
---|
86 | rtemsIrq[i].name = i; |
---|
87 | rtemsPrioTbl[i] = BSP_IRQ_DEFAULT_PRIORITY; |
---|
88 | } |
---|
89 | |
---|
90 | /* |
---|
91 | * Init initial Interrupt management config |
---|
92 | */ |
---|
93 | initial_config.irqNb = BSP_IRQ_NUMBER; |
---|
94 | initial_config.defaultEntry = defaultIrq; |
---|
95 | initial_config.irqHdlTbl = rtemsIrq; |
---|
96 | initial_config.irqBase = BSP_LOWEST_OFFSET; |
---|
97 | initial_config.irqPrioTbl = rtemsPrioTbl; |
---|
98 | |
---|
99 | if (!BSP_rtems_irq_mngt_set(&initial_config)) { |
---|
100 | /* |
---|
101 | * put something here that will show the failure... |
---|
102 | */ |
---|
103 | rtems_panic("Unable to initialize RTEMS interrupt Management!!! System locked\n"); |
---|
104 | } |
---|
105 | |
---|
106 | #ifdef TRACE_IRQ_INIT |
---|
107 | printk("RTEMS IRQ management is now operationnal\n"); |
---|
108 | #endif |
---|
109 | } |
---|
110 | |
---|