source: rtems/c/src/lib/libbsp/powerpc/mpc8260ads/irq/irq.h @ 1628414

4.104.114.84.95
Last change on this file since 1628414 was 5edbffe, checked in by Joel Sherrill <joel.sherrill@…>, on 10/22/01 at 14:46:02

01-10-22 Andy Dachs <a.dachs@…>

  • mpc8260ads added as new BSP. tm27 reported not to run at this time.
  • ChangeLog?, Makefile.am, README, aclocal.m4, bsp_specs, clock/.cvsignore, clock/Makefile.am, clock/p_clock.c, configure.in, console/Makefile.am, console/console.c, include/Makefile.am, include/bsp.h, include/coverhd.h, irq/.cvsignore, irq/Makefile.am, irq/irq.c, irq/irq.h, irq/irq_asm.S, irq/irq_init.c, network/Makefile.am, network/README, network/if_hdlcsubr.c, network/if_hdlcsubr.h, network/network.c, start/Makefile.am, start/start.S, startup/Makefile.am, startup/bspstart.c, startup/cpuinit.c, startup/linkcmds, startup/setvec.c, times, vectors/.cvsignore, vectors/Makefile.am, vectors/vectors.S, vectors/vectors.h, vectors/vectors_init.c, wrapup/Makefile.am: New files.
  • Property mode set to 100644
File size: 12.2 KB
Line 
1/* irq.h
2 *
3 *  This include file describe the data structure and the functions implemented
4 *  by rtems to write interrupt handlers.
5 *
6 *  CopyRight (C) 1999 valette@crf.canon.fr
7 *
8 *  This code is heavilly inspired by the public specification of STREAM V2
9 *  that can be found at :
10 *
11 *      <http://www.chorus.com/Documentation/index.html> by following
12 *  the STREAM API Specification Document link.
13 *
14 *  Modified for mpc8260 by Andy Dachs <a.dachs@sstl.co.uk>
15 *  Surrey Satellite Technology Limited
16 *    The interrupt handling on the mpc8260 seems quite different from
17 *    the 860 (I don't know the 860 well).  Although some interrupts
18 *    are routed via the CPM irq and some are direct to the SIU they all
19 *    appear logically the same.  Therefore I removed the distinction
20 *    between SIU and CPM interrupts.
21 *
22 *  The license and distribution terms for this file may be
23 *  found in found in the file LICENSE in this distribution or at
24 *  http://www.OARcorp.com/rtems/license.html.
25 *
26 *  $Id$
27 */
28
29#ifndef LIBBSP_POWERPC_MBX8XX_IRQ_IRQ_H
30#define LIBBSP_POWERPC_MBX8XX_IRQ_IRQ_H
31
32
33#define BSP_ASM_IRQ_VECTOR_BASE 0x0
34
35#ifndef ASM
36
37/*
38extern volatile unsigned int ppc_cached_irq_mask;
39*/
40
41/*
42 * Symblolic IRQ names and related definitions.
43 */
44
45typedef enum {
46  /* Base vector for our SIU IRQ handlers. */
47  BSP_SIU_VECTOR_BASE   =       BSP_ASM_IRQ_VECTOR_BASE,
48
49  /*
50   * CPM IRQ handlers related definitions
51   * CAUTION : BSP_CPM_IRQ_LOWEST_OFFSET should be equal to OPENPIC_VEC_SOURCE
52   */
53  BSP_CPM_IRQ_NUMBER            =       64,
54  BSP_CPM_IRQ_LOWEST_OFFSET     =       BSP_SIU_VECTOR_BASE,
55  BSP_CPM_IRQ_MAX_OFFSET        =       BSP_CPM_IRQ_LOWEST_OFFSET + BSP_CPM_IRQ_NUMBER - 1,
56  /*
57   * PowerPc exceptions handled as interrupt where a rtems managed interrupt
58   * handler might be connected
59   */
60  BSP_PROCESSOR_IRQ_NUMBER      =       1,
61  BSP_PROCESSOR_IRQ_LOWEST_OFFSET =     BSP_CPM_IRQ_MAX_OFFSET + 1,
62  BSP_PROCESSOR_IRQ_MAX_OFFSET  =       BSP_PROCESSOR_IRQ_LOWEST_OFFSET + BSP_PROCESSOR_IRQ_NUMBER - 1,
63  /*
64   * Summary
65   */
66  BSP_IRQ_NUMBER                =       BSP_PROCESSOR_IRQ_MAX_OFFSET + 1,
67  BSP_LOWEST_OFFSET             =       BSP_CPM_IRQ_LOWEST_OFFSET,
68  BSP_MAX_OFFSET                =       BSP_PROCESSOR_IRQ_MAX_OFFSET,
69
70  /*
71   * Some SIU IRQ symbolic name definition. Please note that
72   * INT IRQ are defined but a single one will be used to
73   * redirect all CPM interrupt.
74   *
75   * On the mpc8260 all this seems to be transparent.  Although the
76   * CPM, PIT and TMCNT interrupt may well be the only interrupts routed
77   * to the SIU at the hardware level all of them appear as CPM interupts
78   * to software apart from the registers for setting priority.
79   *
80   * The MPC8260 User Manual seems shot through with inconsistencies
81   * about this whole area.
82   */   
83
84  /*
85   * Some CPM IRQ symbolic name definition
86   */
87  BSP_CPM_IRQ_ERROR             =       BSP_CPM_IRQ_LOWEST_OFFSET,
88  BSP_CPM_IRQ_I2C               =       BSP_CPM_IRQ_LOWEST_OFFSET + 1,
89  BSP_CPM_IRQ_SPI               =       BSP_CPM_IRQ_LOWEST_OFFSET + 2,
90  BSP_CPM_IRQ_RISC_TIMERS       =       BSP_CPM_IRQ_LOWEST_OFFSET + 3,
91  BSP_CPM_IRQ_SMC1              =       BSP_CPM_IRQ_LOWEST_OFFSET + 4,
92  BSP_CPM_IRQ_SMC2              =       BSP_CPM_IRQ_LOWEST_OFFSET + 5,
93  BSP_CPM_IRQ_IDMA1             =       BSP_CPM_IRQ_LOWEST_OFFSET + 6,
94  BSP_CPM_IRQ_IDMA2             =       BSP_CPM_IRQ_LOWEST_OFFSET + 7,
95  BSP_CPM_IRQ_IDMA3             =       BSP_CPM_IRQ_LOWEST_OFFSET + 8,
96  BSP_CPM_IRQ_IDMA4             =       BSP_CPM_IRQ_LOWEST_OFFSET + 9,
97  BSP_CPM_IRQ_SDMA              =       BSP_CPM_IRQ_LOWEST_OFFSET + 10,
98
99  BSP_CPM_IRQ_TIMER_1           =       BSP_CPM_IRQ_LOWEST_OFFSET + 12,
100  BSP_CPM_IRQ_TIMER_2           =       BSP_CPM_IRQ_LOWEST_OFFSET + 13,
101  BSP_CPM_IRQ_TIMER_3           =       BSP_CPM_IRQ_LOWEST_OFFSET + 14,
102  BSP_CPM_IRQ_TIMER_4           =       BSP_CPM_IRQ_LOWEST_OFFSET + 15,
103  BSP_CPM_IRQ_TMCNT             =       BSP_CPM_IRQ_LOWEST_OFFSET + 16,
104  BSP_CPM_IRQ_PIT               =       BSP_CPM_IRQ_LOWEST_OFFSET + 17,
105
106  BSP_CPM_IRQ_IRQ1              =       BSP_CPM_IRQ_LOWEST_OFFSET + 19,
107  BSP_CPM_IRQ_IRQ2              =       BSP_CPM_IRQ_LOWEST_OFFSET + 20,
108  BSP_CPM_IRQ_IRQ3              =       BSP_CPM_IRQ_LOWEST_OFFSET + 21,
109  BSP_CPM_IRQ_IRQ4              =       BSP_CPM_IRQ_LOWEST_OFFSET + 22,
110  BSP_CPM_IRQ_IRQ5              =       BSP_CPM_IRQ_LOWEST_OFFSET + 23,
111  BSP_CPM_IRQ_IRQ6              =       BSP_CPM_IRQ_LOWEST_OFFSET + 24,
112  BSP_CPM_IRQ_IRQ7              =       BSP_CPM_IRQ_LOWEST_OFFSET + 25,
113
114  BSP_CPM_IRQ_FCC1              =       BSP_CPM_IRQ_LOWEST_OFFSET + 32,
115  BSP_CPM_IRQ_FCC2              =       BSP_CPM_IRQ_LOWEST_OFFSET + 33,
116  BSP_CPM_IRQ_FCC3              =       BSP_CPM_IRQ_LOWEST_OFFSET + 34,
117
118  BSP_CPM_IRQ_MCC1              =       BSP_CPM_IRQ_LOWEST_OFFSET + 36,
119  BSP_CPM_IRQ_MCC2              =       BSP_CPM_IRQ_LOWEST_OFFSET + 37,
120
121  BSP_CPM_IRQ_SCC1              =       BSP_CPM_IRQ_LOWEST_OFFSET + 40,
122  BSP_CPM_IRQ_SCC2              =       BSP_CPM_IRQ_LOWEST_OFFSET + 41,
123  BSP_CPM_IRQ_SCC3              =       BSP_CPM_IRQ_LOWEST_OFFSET + 42,
124  BSP_CPM_IRQ_SCC4              =       BSP_CPM_IRQ_LOWEST_OFFSET + 43,
125
126  BSP_CPM_IRQ_PC15              =       BSP_CPM_IRQ_LOWEST_OFFSET + 48,
127  BSP_CPM_IRQ_PC14              =       BSP_CPM_IRQ_LOWEST_OFFSET + 49,
128  BSP_CPM_IRQ_PC13              =       BSP_CPM_IRQ_LOWEST_OFFSET + 50,
129  BSP_CPM_IRQ_PC12              =       BSP_CPM_IRQ_LOWEST_OFFSET + 51,
130  BSP_CPM_IRQ_PC11              =       BSP_CPM_IRQ_LOWEST_OFFSET + 52,
131  BSP_CPM_IRQ_PC10              =       BSP_CPM_IRQ_LOWEST_OFFSET + 53,
132  BSP_CPM_IRQ_PC9               =       BSP_CPM_IRQ_LOWEST_OFFSET + 54,
133  BSP_CPM_IRQ_PC8               =       BSP_CPM_IRQ_LOWEST_OFFSET + 55,
134  BSP_CPM_IRQ_PC7               =       BSP_CPM_IRQ_LOWEST_OFFSET + 56,
135  BSP_CPM_IRQ_PC6               =       BSP_CPM_IRQ_LOWEST_OFFSET + 57,
136  BSP_CPM_IRQ_PC5               =       BSP_CPM_IRQ_LOWEST_OFFSET + 58,
137  BSP_CPM_IRQ_PC4               =       BSP_CPM_IRQ_LOWEST_OFFSET + 59,
138  BSP_CPM_IRQ_PC3               =       BSP_CPM_IRQ_LOWEST_OFFSET + 60,
139  BSP_CPM_IRQ_PC2               =       BSP_CPM_IRQ_LOWEST_OFFSET + 61,
140  BSP_CPM_IRQ_PC1               =       BSP_CPM_IRQ_LOWEST_OFFSET + 62,
141  BSP_CPM_IRQ_PC0               =       BSP_CPM_IRQ_LOWEST_OFFSET + 63,
142
143
144    /*
145     * Some Processor exception handled as rtems IRQ symbolic name definition
146     */
147  BSP_DECREMENTER               =       BSP_PROCESSOR_IRQ_LOWEST_OFFSET,
148  BSP_PERIODIC_TIMER            =       BSP_DECREMENTER
149
150}rtems_irq_symbolic_name;
151
152#define CPM_INTERRUPT               
153
154
155/*
156 * Type definition for RTEMS managed interrupts
157 */
158typedef unsigned char  rtems_irq_prio;
159struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
160
161typedef void (*rtems_irq_hdl)           (void);
162typedef void (*rtems_irq_enable)        (const struct __rtems_irq_connect_data__*);
163typedef void (*rtems_irq_disable)       (const struct __rtems_irq_connect_data__*);
164typedef int  (*rtems_irq_is_enabled)    (const struct __rtems_irq_connect_data__*);
165
166typedef struct __rtems_irq_connect_data__ {
167  /*
168   * IRQ line
169   */
170  rtems_irq_symbolic_name       name;
171  /*
172   * handler. See comment on handler properties below in function prototype.
173   */
174  rtems_irq_hdl                 hdl;
175  /*
176   * function for enabling interrupts at device level (ONLY!).
177   * The BSP code will automatically enable it at SIU level and CPM level.
178   * RATIONALE : anyway such code has to exist in current driver code.
179   * It is usually called immediately AFTER connecting the interrupt handler.
180   * RTEMS may well need such a function when restoring normal interrupt
181   * processing after a debug session.
182   *
183   */
184    rtems_irq_enable            on;     
185  /*
186   * function for disabling interrupts at device level (ONLY!).
187   * The code will disable it at SIU and CPM level. RATIONALE : anyway
188   * such code has to exist for clean shutdown. It is usually called
189   * BEFORE disconnecting the interrupt. RTEMS may well need such
190   * a function when disabling normal interrupt processing for
191   * a debug session. May well be a NOP function.
192   */
193  rtems_irq_disable             off;
194  /*
195   * function enabling to know what interrupt may currently occur
196   * if someone manipulates the i8259s interrupt mask without care...
197   */
198    rtems_irq_is_enabled        isOn;
199} rtems_irq_connect_data;
200
201typedef struct {
202  /*
203   * size of all the table fields (*Tbl) described below.
204   */
205  unsigned int                  irqNb;
206  /*
207   * Default handler used when disconnecting interrupts.
208   */
209  rtems_irq_connect_data        defaultEntry;
210  /*
211   * Table containing initials/current value.
212   */
213  rtems_irq_connect_data*       irqHdlTbl;
214  /*
215   * actual value of BSP_SIU_IRQ_VECTOR_BASE...
216   */
217  rtems_irq_symbolic_name       irqBase;
218  /*
219   * software priorities associated with interrupts.
220   * if irqPrio  [i]  >  intrPrio  [j]  it  means  that 
221   * interrupt handler hdl connected for interrupt name i
222   * will  not be interrupted by the handler connected for interrupt j
223   * The interrupt source  will be physically masked at i8259 level.
224   */
225    rtems_irq_prio*             irqPrioTbl;
226}rtems_irq_global_settings;
227
228
229
230
231/*-------------------------------------------------------------------------+
232| Function Prototypes.
233+--------------------------------------------------------------------------*/
234/*
235 * ------------------------ PPC CPM Mngt Routines -------
236 */
237
238/*
239 * function to disable a particular irq. After calling
240 * this function, even if the device asserts the interrupt line it will
241 * not be propagated further to the processor
242 */
243int BSP_irq_disable_at_cpm        (const rtems_irq_symbolic_name irqLine);
244/*
245 * function to enable a particular irq. After calling
246 * this function, if the device asserts the interrupt line it will
247 * be propagated further to the processor
248 */
249int BSP_irq_enable_at_cpm               (const rtems_irq_symbolic_name irqLine);
250/*
251 * function to acknoledge a particular irq. After calling
252 * this function, if a device asserts an enabled interrupt line it will
253 * be propagated further to the processor. Mainly usefull for people
254 * writting raw handlers as this is automagically done for rtems managed
255 * handlers.
256 */
257int BSP_irq_ack_at_cpm                  (const rtems_irq_symbolic_name irqLine);
258/*
259 * function to check if a particular irq is enabled. After calling
260 */
261int BSP_irq_enabled_at_cpm      (const rtems_irq_symbolic_name irqLine);
262
263
264
265/*
266 * ------------------------ RTEMS Single Irq Handler Mngt Routines ----------------
267 */
268/*
269 * function to connect a particular irq handler. This hanlder will NOT be called
270 * directly as the result of the corresponding interrupt. Instead, a RTEMS
271 * irq prologue will be called that will :
272 *
273 *      1) save the C scratch registers,
274 *      2) switch to a interrupt stack if the interrupt is not nested,
275 *      4) modify them to disable the current interrupt at  SIU level (and may
276 *      be others depending on software priorities)
277 *      5) aknowledge the SIU',
278 *      6) demask the processor,
279 *      7) call the application handler
280 *
281 * As a result the hdl function provided
282 *
283 *      a) can perfectly be written is C,
284 *      b) may also well directly call the part of the RTEMS API that can be used
285 *      from interrupt level,
286 *      c) It only responsible for handling the jobs that need to be done at
287 *      the device level including (aknowledging/re-enabling the interrupt at device,
288 *      level, getting the data,...)
289 *
290 *      When returning from the function, the following will be performed by
291 *      the RTEMS irq epilogue :
292 *
293 *      1) masks the interrupts again,
294 *      2) restore the original SIU interrupt masks
295 *      3) switch back on the orinal stack if needed,
296 *      4) perform rescheduling when necessary,
297 *      5) restore the C scratch registers...
298 *      6) restore initial execution flow
299 *
300 */
301int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
302/*
303 * function to get the current RTEMS irq handler for ptr->name. It enables to
304 * define hanlder chain...
305 */
306int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
307/*
308 * function to get disconnect the RTEMS irq handler for ptr->name.
309 * This function checks that the value given is the current one for safety reason.
310 * The user can use the previous function to get it.
311 */
312int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
313
314
315/*
316 * ------------------------ RTEMS Global Irq Handler Mngt Routines ----------------
317 */
318/*
319 * (Re) Initialize the RTEMS interrupt management.
320 *
321 * The result of calling this function will be the same as if each individual
322 * handler (config->irqHdlTbl[i].hdl)  different from "config->defaultEntry.hdl"
323 * has been individualy connected via
324 *      BSP_install_rtems_irq_handler(&config->irqHdlTbl[i])
325 * And each handler currently equal to config->defaultEntry.hdl
326 * has been previously disconnected via
327 *       BSP_remove_rtems_irq_handler (&config->irqHdlTbl[i])
328 *
329 * This is to say that all information given will be used and not just
330 * only the space.
331 *
332 * CAUTION : the various table address contained in config will be used
333 *           directly by the interrupt mangement code in order to save
334 *           data size so they must stay valid after the call => they should
335 *           not be modified or declared on a stack.
336 */
337
338int BSP_rtems_irq_mngt_set(rtems_irq_global_settings* config);
339/*
340 * (Re) get info on current RTEMS interrupt management.
341 */
342int BSP_rtems_irq_mngt_get(rtems_irq_global_settings**);
343 
344extern void BSP_rtems_irq_mng_init(unsigned cpuId);
345#endif
346
347#endif
Note: See TracBrowser for help on using the repository browser.