1 | /*===============================================================*\ |
---|
2 | | Project: RTEMS TQM8xx BSP | |
---|
3 | +-----------------------------------------------------------------+ |
---|
4 | | This file has been adapted to MPC8xx by | |
---|
5 | | Thomas Doerfler <Thomas.Doerfler@embedded-brains.de> | |
---|
6 | | Copyright (c) 2008 | |
---|
7 | | Embedded Brains GmbH | |
---|
8 | | Obere Lagerstr. 30 | |
---|
9 | | D-82178 Puchheim | |
---|
10 | | Germany | |
---|
11 | | rtems@embedded-brains.de | |
---|
12 | | | |
---|
13 | | See the other copyright notice below for the original parts. | |
---|
14 | +-----------------------------------------------------------------+ |
---|
15 | | The license and distribution terms for this file may be | |
---|
16 | | found in the file LICENSE in this distribution or at | |
---|
17 | | | |
---|
18 | | http://www.rtems.com/license/LICENSE. | |
---|
19 | | | |
---|
20 | +-----------------------------------------------------------------+ |
---|
21 | | this file contains the console driver | |
---|
22 | \*===============================================================*/ |
---|
23 | /* derived from: generic MPC83xx BSP */ |
---|
24 | /* irq.h |
---|
25 | * |
---|
26 | * This include file describe the data structure and the functions implemented |
---|
27 | * by rtems to write interrupt handlers. |
---|
28 | * |
---|
29 | * CopyRight (C) 1999 valette@crf.canon.fr |
---|
30 | * |
---|
31 | * This code is heavilly inspired by the public specification of STREAM V2 |
---|
32 | * that can be found at : |
---|
33 | * |
---|
34 | * <http://www.chorus.com/Documentation/index.html> by following |
---|
35 | * the STREAM API Specification Document link. |
---|
36 | * |
---|
37 | * The license and distribution terms for this file may be |
---|
38 | * found in found in the file LICENSE in this distribution or at |
---|
39 | * http://www.rtems.com/license/LICENSE. |
---|
40 | * |
---|
41 | * $Id$ |
---|
42 | */ |
---|
43 | |
---|
44 | #ifndef LIBBSP_POWERPC_TQM8XX_IRQ_IRQ_H |
---|
45 | #define LIBBSP_POWERPC_TQM8XX_IRQ_IRQ_H |
---|
46 | |
---|
47 | #include <rtems/irq.h> |
---|
48 | |
---|
49 | #ifndef ASM |
---|
50 | |
---|
51 | #ifdef __cplusplus |
---|
52 | extern "C" { |
---|
53 | #endif |
---|
54 | |
---|
55 | extern volatile unsigned int ppc_cached_irq_mask; |
---|
56 | |
---|
57 | /* |
---|
58 | * Symblolic IRQ names and related definitions. |
---|
59 | */ |
---|
60 | |
---|
61 | /* |
---|
62 | * SIU IRQ handler related definitions |
---|
63 | */ |
---|
64 | #define BSP_SIU_IRQ_NUMBER 16 /* 16 reserved but in the future... */ |
---|
65 | #define BSP_SIU_IRQ_LOWEST_OFFSET 0 |
---|
66 | #define BSP_SIU_IRQ_MAX_OFFSET (BSP_SIU_IRQ_LOWEST_OFFSET + BSP_SIU_IRQ_NUMBER - 1) |
---|
67 | /* |
---|
68 | * CPM IRQ handlers related definitions |
---|
69 | * CAUTION : BSP_CPM_IRQ_LOWEST_OFFSET should be equal to OPENPIC_VEC_SOURCE |
---|
70 | */ |
---|
71 | #define BSP_CPM_IRQ_NUMBER 32 |
---|
72 | #define BSP_CPM_IRQ_LOWEST_OFFSET (BSP_SIU_IRQ_NUMBER + BSP_SIU_IRQ_LOWEST_OFFSET) |
---|
73 | #define BSP_CPM_IRQ_MAX_OFFSET (BSP_CPM_IRQ_LOWEST_OFFSET + BSP_CPM_IRQ_NUMBER - 1) |
---|
74 | /* |
---|
75 | * PowerPc exceptions handled as interrupt where a rtems managed interrupt |
---|
76 | * handler might be connected |
---|
77 | */ |
---|
78 | #define BSP_PROCESSOR_IRQ_NUMBER 1 |
---|
79 | #define BSP_PROCESSOR_IRQ_LOWEST_OFFSET (BSP_CPM_IRQ_MAX_OFFSET + 1) |
---|
80 | #define BSP_PROCESSOR_IRQ_MAX_OFFSET (BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1) |
---|
81 | /* |
---|
82 | * Summary |
---|
83 | */ |
---|
84 | #define BSP_IRQ_NUMBER (BSP_PROCESSOR_IRQ_MAX_OFFSET + 1) |
---|
85 | #define BSP_LOWEST_OFFSET (BSP_SIU_IRQ_LOWEST_OFFSET) |
---|
86 | #define BSP_MAX_OFFSET (BSP_PROCESSOR_IRQ_MAX_OFFSET) |
---|
87 | /* |
---|
88 | * Some SIU IRQ symbolic name definition. Please note that |
---|
89 | * INT IRQ are defined but a single one will be used to |
---|
90 | * redirect all CPM interrupt. |
---|
91 | */ |
---|
92 | #define BSP_SIU_EXT_IRQ_0 0 |
---|
93 | #define BSP_SIU_INT_IRQ_0 1 |
---|
94 | |
---|
95 | #define BSP_SIU_EXT_IRQ_1 2 |
---|
96 | #define BSP_SIU_INT_IRQ_1 3 |
---|
97 | |
---|
98 | #define BSP_SIU_EXT_IRQ_2 4 |
---|
99 | #define BSP_SIU_INT_IRQ_2 5 |
---|
100 | |
---|
101 | #define BSP_SIU_EXT_IRQ_3 6 |
---|
102 | #define BSP_SIU_INT_IRQ_3 7 |
---|
103 | |
---|
104 | #define BSP_SIU_EXT_IRQ_4 8 |
---|
105 | #define BSP_SIU_INT_IRQ_4 9 |
---|
106 | |
---|
107 | #define BSP_SIU_EXT_IRQ_5 10 |
---|
108 | #define BSP_SIU_INT_IRQ_5 11 |
---|
109 | |
---|
110 | #define BSP_SIU_EXT_IRQ_6 12 |
---|
111 | #define BSP_SIU_INT_IRQ_6 13 |
---|
112 | |
---|
113 | #define BSP_SIU_EXT_IRQ_7 14 |
---|
114 | #define BSP_SIU_INT_IRQ_7 15 |
---|
115 | /* |
---|
116 | * Symbolic name for CPM interrupt on SIU Internal level 2 |
---|
117 | */ |
---|
118 | #define BSP_CPM_INTERRUPT BSP_SIU_INT_IRQ_2 |
---|
119 | #define BSP_PERIODIC_TIMER BSP_SIU_INT_IRQ_6 |
---|
120 | #define BSP_FAST_ETHERNET_CTRL BSP_SIU_INT_IRQ_3 |
---|
121 | /* |
---|
122 | * Some CPM IRQ symbolic name definition |
---|
123 | */ |
---|
124 | #define BSP_CPM_IRQ_ERROR BSP_CPM_IRQ_LOWEST_OFFSET |
---|
125 | #define BSP_CPM_IRQ_PARALLEL_IO_PC4 (BSP_CPM_IRQ_LOWEST_OFFSET + 1) |
---|
126 | #define BSP_CPM_IRQ_PARALLEL_IO_PC5 (BSP_CPM_IRQ_LOWEST_OFFSET + 2) |
---|
127 | #define BSP_CPM_IRQ_SMC2_OR_PIP (BSP_CPM_IRQ_LOWEST_OFFSET + 3) |
---|
128 | #define BSP_CPM_IRQ_SMC1 (BSP_CPM_IRQ_LOWEST_OFFSET + 4) |
---|
129 | #define BSP_CPM_IRQ_SPI (BSP_CPM_IRQ_LOWEST_OFFSET + 5) |
---|
130 | #define BSP_CPM_IRQ_PARALLEL_IO_PC6 (BSP_CPM_IRQ_LOWEST_OFFSET + 6) |
---|
131 | #define BSP_CPM_IRQ_TIMER_4 (BSP_CPM_IRQ_LOWEST_OFFSET + 7) |
---|
132 | |
---|
133 | #define BSP_CPM_IRQ_PARALLEL_IO_PC7 (BSP_CPM_IRQ_LOWEST_OFFSET + 9) |
---|
134 | #define BSP_CPM_IRQ_PARALLEL_IO_PC8 (BSP_CPM_IRQ_LOWEST_OFFSET + 10) |
---|
135 | #define BSP_CPM_IRQ_PARALLEL_IO_PC9 (BSP_CPM_IRQ_LOWEST_OFFSET + 11) |
---|
136 | #define BSP_CPM_IRQ_TIMER_3 (BSP_CPM_IRQ_LOWEST_OFFSET + 12) |
---|
137 | |
---|
138 | #define BSP_CPM_IRQ_PARALLEL_IO_PC10 (BSP_CPM_IRQ_LOWEST_OFFSET + 14) |
---|
139 | #define BSP_CPM_IRQ_PARALLEL_IO_PC11 (BSP_CPM_IRQ_LOWEST_OFFSET + 15) |
---|
140 | #define BSP_CPM_I2C (BSP_CPM_IRQ_LOWEST_OFFSET + 16) |
---|
141 | #define BSP_CPM_RISC_TIMER_TABLE (BSP_CPM_IRQ_LOWEST_OFFSET + 17) |
---|
142 | #define BSP_CPM_IRQ_TIMER_2 (BSP_CPM_IRQ_LOWEST_OFFSET + 18) |
---|
143 | |
---|
144 | #define BSP_CPM_IDMA2 (BSP_CPM_IRQ_LOWEST_OFFSET + 20) |
---|
145 | #define BSP_CPM_IDMA1 (BSP_CPM_IRQ_LOWEST_OFFSET + 21) |
---|
146 | #define BSP_CPM_SDMA_CHANNEL_BUS_ERR (BSP_CPM_IRQ_LOWEST_OFFSET + 22) |
---|
147 | #define BSP_CPM_IRQ_PARALLEL_IO_PC12 (BSP_CPM_IRQ_LOWEST_OFFSET + 23) |
---|
148 | #define BSP_CPM_IRQ_PARALLEL_IO_PC13 (BSP_CPM_IRQ_LOWEST_OFFSET + 24) |
---|
149 | #define BSP_CPM_IRQ_TIMER_1 (BSP_CPM_IRQ_LOWEST_OFFSET + 25) |
---|
150 | #define BSP_CPM_IRQ_PARALLEL_IO_PC14 (BSP_CPM_IRQ_LOWEST_OFFSET + 26) |
---|
151 | #define BSP_CPM_IRQ_SCC4 (BSP_CPM_IRQ_LOWEST_OFFSET + 27) |
---|
152 | #define BSP_CPM_IRQ_SCC3 (BSP_CPM_IRQ_LOWEST_OFFSET + 28) |
---|
153 | #define BSP_CPM_IRQ_SCC2 (BSP_CPM_IRQ_LOWEST_OFFSET + 29) |
---|
154 | #define BSP_CPM_IRQ_SCC1 (BSP_CPM_IRQ_LOWEST_OFFSET + 30) |
---|
155 | #define BSP_CPM_IRQ_PARALLEL_IO_PC15 (BSP_CPM_IRQ_LOWEST_OFFSET + 31) |
---|
156 | /* |
---|
157 | * Some Processor exception handled as rtems IRQ symbolic name definition |
---|
158 | */ |
---|
159 | #define BSP_DECREMENTER BSP_PROCESSOR_IRQ_LOWEST_OFFSET |
---|
160 | |
---|
161 | |
---|
162 | #define CPM_INTERRUPT |
---|
163 | |
---|
164 | /*-------------------------------------------------------------------------+ |
---|
165 | | Function Prototypes. |
---|
166 | +--------------------------------------------------------------------------*/ |
---|
167 | /* |
---|
168 | * ------------------------ PPC SIU Mngt Routines ------- |
---|
169 | */ |
---|
170 | |
---|
171 | /* |
---|
172 | * function to disable a particular irq at 8259 level. After calling |
---|
173 | * this function, even if the device asserts the interrupt line it will |
---|
174 | * not be propagated further to the processor |
---|
175 | */ |
---|
176 | int BSP_irq_disable_at_siu (const rtems_irq_number irqLine); |
---|
177 | /* |
---|
178 | * function to enable a particular irq at 8259 level. After calling |
---|
179 | * this function, if the device asserts the interrupt line it will |
---|
180 | * be propagated further to the processor |
---|
181 | */ |
---|
182 | int BSP_irq_enable_at_siu (const rtems_irq_number irqLine); |
---|
183 | /* |
---|
184 | * function to acknoledge a particular irq at 8259 level. After calling |
---|
185 | * this function, if a device asserts an enabled interrupt line it will |
---|
186 | * be propagated further to the processor. Mainly usefull for people |
---|
187 | * writting raw handlers as this is automagically done for rtems managed |
---|
188 | * handlers. |
---|
189 | */ |
---|
190 | int BSP_irq_ack_at_siu (const rtems_irq_number irqLine); |
---|
191 | /* |
---|
192 | * function to check if a particular irq is enabled at 8259 level. After calling |
---|
193 | */ |
---|
194 | int BSP_irq_enabled_at_siu (const rtems_irq_number irqLine); |
---|
195 | |
---|
196 | extern void BSP_rtems_irq_mng_init(unsigned cpuId); |
---|
197 | |
---|
198 | #ifdef __cplusplus |
---|
199 | } |
---|
200 | #endif |
---|
201 | |
---|
202 | #endif |
---|
203 | |
---|
204 | #endif |
---|