source: rtems/c/src/lib/libbsp/arm/edb7312/irq/irq.h @ e01c480d

4.104.114.84.95
Last change on this file since e01c480d was f05b2ac, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/21/04 at 16:01:48

Remove duplicate white lines.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1/*
2 * Cirrus EP7312 Intererrupt handler
3 *
4 * Copyright (c) 2002 by Jay Monkman <jtm@smoothsmoothie.com>
5 *
6 * Copyright (c) 2002 by Charlie Steader <charlies@poliac.com>
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *
14 *  $Id$
15*/
16
17#ifndef __IRQ_H__
18#define __IRQ_H__
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24  /* define that can be useful (the values are just examples) */
25#define VECTOR_TABLE     0x40
26
27#ifndef __asm__
28
29/*
30 * Include some preprocessor value also used by assember code
31 */
32
33#include <rtems.h>
34
35extern void default_int_handler();
36/*-------------------------------------------------------------------------+
37| Constants
38+--------------------------------------------------------------------------*/
39
40  /* enum of the possible interrupt sources */
41typedef enum {
42  /* int interrupt status/mask register 1 */
43  BSP_EXTFIQ = 0,
44  BSP_BLINT,
45  BSP_WEINT,
46  BSP_MCINT,
47  BSP_CSINT,
48  BSP_EINT1,
49  BSP_EINT2,
50  BSP_EINT3,
51  BSP_TC1OI,
52  BSP_TC2OI,
53  BSP_RTCMI,
54  BSP_TINT,
55  BSP_UTXINT1,
56  BSP_URXINT1,
57  BSP_UMSINT,
58  BSP_SSEOTI,
59  /* int interrupt status/mask register 2 */
60  BSP_KBDINT,
61  BSP_SS2RX,
62  BSP_SS2TX,
63  BSP_UTXINT2,
64  BSP_URXINT2,
65  /* int interrupt status/mask register 3 */
66  BSP_DAIINT,
67  BSP_MAX_INT,
68} rtems_irq_symbolic_name;
69
70/*
71 * Type definition for RTEMS managed interrupts
72 */
73typedef unsigned char  rtems_irq_level;
74typedef unsigned char  rtems_irq_trigger;
75
76struct  __rtems_irq_connect_data__;     /* forward declaratiuon */
77
78typedef void (*rtems_irq_hdl)           (void);
79typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*);
80typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*);
81typedef int  (*rtems_irq_is_enabled)(const struct __rtems_irq_connect_data__*);
82
83typedef struct __rtems_irq_connect_data__ {
84  /*
85   * IRQ line
86   */
87  rtems_irq_symbolic_name       name;
88  /*
89   * handler. See comment on handler properties below in function prototype.
90   */
91  rtems_irq_hdl                 hdl;
92  /*
93   * function for enabling interrupts at device level (ONLY!).
94   * The BSP code will automatically enable it at i8259s level.
95   * RATIONALE : anyway such code has to exist in current driver code.
96   * It is usually called immediately AFTER connecting the interrupt handler.
97   * RTEMS may well need such a function when restoring normal interrupt
98   * processing after a debug session.
99   *
100   */
101    rtems_irq_enable            on;
102  /*
103   * function for disabling interrupts at device level (ONLY!).
104   * The code will disable it at i8259s level. RATIONALE : anyway
105   * such code has to exist for clean shutdown. It is usually called
106   * BEFORE disconnecting the interrupt. RTEMS may well need such
107   * a function when disabling normal interrupt processing for
108   * a debug session. May well be a NOP function.
109   */
110  rtems_irq_disable             off;
111  /*
112   * function enabling to know what interrupt may currently occur
113   * if someone manipulates the i8259s interrupt mask without care...
114   */
115    rtems_irq_is_enabled        isOn;
116  /*
117   * priority level at the vplus level
118   */
119  rtems_irq_level               irqLevel;
120  /*
121   * Trigger way : Rising or falling edge or High or low level
122   */
123  rtems_irq_trigger             irqTrigger;
124} rtems_irq_connect_data;
125
126/*-------------------------------------------------------------------------+
127| Function Prototypes.
128+--------------------------------------------------------------------------*/
129/*
130 * ------------------- RTEMS Single Irq Handler Mngt Routines ----------------
131 */
132
133/*
134 * function to initialize the interrupt for a specific BSP
135 */
136void BSP_rtems_irq_mngt_init();
137
138/*
139 * function to connect a particular irq handler. This hanlder will NOT be called
140 * directly as the result of the corresponding interrupt. Instead, a RTEMS
141 * irq prologue will be called that will :
142 *
143 *      1) save the C scratch registers,
144 *      2) switch to a interrupt stack if the interrupt is not nested,
145 *      3) store the current i8259s' interrupt masks
146 *      4) modify them to disable the current interrupt at 8259 level (and may
147 *      be others depending on software priorities)
148 *      5) aknowledge the i8259s',
149 *      6) demask the processor,
150 *      7) call the application handler
151 *
152 * As a result the hdl function provided
153 *
154 *      a) can perfectly be written is C,
155 *      b) may also well directly call the part of the RTEMS API that can be used
156 *      from interrupt level,
157 *      c) It only responsible for handling the jobs that need to be done at
158 *      the device level including (aknowledging/re-enabling the interrupt at device,
159 *      level, getting the data,...)
160 *
161 *      When returning from the function, the following will be performed by
162 *      the RTEMS irq epilogue :
163 *
164 *      1) masks the interrupts again,
165 *      2) restore the original i8259s' interrupt masks
166 *      3) switch back on the orinal stack if needed,
167 *      4) perform rescheduling when necessary,
168 *      5) restore the C scratch registers...
169 *      6) restore initial execution flow
170 *
171 */
172
173int BSP_install_rtems_irq_handler       (const rtems_irq_connect_data*);
174/*
175 * function to get the current RTEMS irq handler for ptr->name. It enables to
176 * define hanlder chain...
177 */
178int BSP_get_current_rtems_irq_handler   (rtems_irq_connect_data* ptr);
179/*
180 * function to get disconnect the RTEMS irq handler for ptr->name.
181 * This function checks that the value given is the current one for safety reason.
182 * The user can use the previous function to get it.
183 */
184int BSP_remove_rtems_irq_handler        (const rtems_irq_connect_data*);
185
186#endif /* __asm__ */
187
188#ifdef __cplusplus
189}
190#endif
191
192#endif /* __IRQ_H__ */
Note: See TracBrowser for help on using the repository browser.