RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
irq.h
Go to the documentation of this file.
1
8/*
9 * CopyRight (C) 1998 valette@crf.canon.fr
10 *
11 * This code is heavilly inspired by the public specification of STREAM V2
12 * that can be found at :
13 *
14 * <http://www.chorus.com/Documentation/index.html> by following
15 * the STREAM API Specification Document link.
16 *
17 * The license and distribution terms for this file may be
18 * found in the file LICENSE in this distribution or at
19 * http://www.rtems.org/license/LICENSE.
20 */
21
22#ifndef _RTEMS_IRQ_H
23#define _RTEMS_IRQ_H
24
25#ifndef ASM
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31
32/*
33 * Type definition for RTEMS managed interrupts
34 */
35typedef unsigned char rtems_irq_prio;
36struct __rtems_irq_connect_data__; /* forward declaratiuon */
37
38typedef unsigned int rtems_irq_number;
39typedef void *rtems_irq_hdl_param;
40typedef void (*rtems_irq_hdl) (rtems_irq_hdl_param);
41typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*);
42typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*);
43typedef int (*rtems_irq_is_enabled) (const struct __rtems_irq_connect_data__*);
44
46 /*
47 * IRQ line
48 */
49 rtems_irq_number name;
50 /*
51 * handler. See comment on handler properties below in function prototype.
52 */
53 rtems_irq_hdl hdl;
54 /*
55 * Handler handle to store private data
56 */
57 rtems_irq_hdl_param handle;
58 /*
59 * function for enabling interrupts at device level (ONLY!).
60 * The BSP code will automatically enable it at i8259s level.
61 * RATIONALE : anyway such code has to exist in current driver code.
62 * It is usually called immediately AFTER connecting the interrupt handler.
63 * RTEMS may well need such a function when restoring normal interrupt
64 * processing after a debug session.
65 *
66 */
67 rtems_irq_enable on;
68 /*
69 * function for disabling interrupts at device level (ONLY!).
70 * The code will disable it at i8259s level. RATIONALE : anyway
71 * such code has to exist for clean shutdown. It is usually called
72 * BEFORE disconnecting the interrupt. RTEMS may well need such
73 * a function when disabling normal interrupt processing for
74 * a debug session. May well be a NOP function.
75 */
76 rtems_irq_disable off;
77 /*
78 * function enabling to know what interrupt may currently occur
79 * if someone manipulates the i8259s interrupt mask without care...
80 */
81 rtems_irq_is_enabled isOn;
82
83#ifdef BSP_SHARED_HANDLER_SUPPORT
84 /*
85 * Set to -1 for vectors forced to have only 1 handler
86 */
87 void *next_handler;
88#endif
89
91
92typedef struct {
93 /*
94 * size of all the table fields (*Tbl) described below.
95 */
96 unsigned int irqNb;
97 /*
98 * Default handler used when disconnecting interrupts.
99 */
100 rtems_irq_connect_data defaultEntry;
101 /*
102 * Table containing initials/current value.
103 */
104 rtems_irq_connect_data* irqHdlTbl;
105 /*
106 * actual value of BSP_ISA_IRQ_VECTOR_BASE...
107 */
108 rtems_irq_number irqBase;
109 /*
110 * software priorities associated with interrupts.
111 * if (*irqPrio [i] > intrPrio [j] it means that
112 * interrupt handler hdl connected for interrupt name i
113 * will not be interrupted by the handler connected for interrupt j
114 * The interrupt source will be physically masked at i8259 level.
115 */
116 rtems_irq_prio* irqPrioTbl;
118
119/*-------------------------------------------------------------------------+
120| Function Prototypes.
121+--------------------------------------------------------------------------*/
122/*
123 * -------------------- RTEMS Single Irq Handler Mngt Routines ----------------
124 */
125/*
126 * function to connect a particular irq handler. This hanlder will NOT be called
127 * directly as the result of the corresponding interrupt. Instead, a RTEMS
128 * irq prologue will be called that will :
129 *
130 * 1) save the C scratch registers,
131 * 2) switch to a interrupt stack if the interrupt is not nested,
132 * 3) store the current i8259s' interrupt masks
133 * 4) modify them to disable the current interrupt at 8259 level (and may
134 * be others depending on software priorities)
135 * 5) aknowledge the i8259s',
136 * 6) demask the processor,
137 * 7) call the application handler
138 *
139 * As a result the hdl function provided
140 *
141 * a) can perfectly be written is C,
142 * b) may also well directly call the part of the RTEMS API that can be
143 * used from interrupt level,
144 * c) It only responsible for handling the jobs that need to be done at
145 * the device level including (aknowledging/re-enabling the interrupt at
146 * device level, getting the data,...)
147 *
148 * When returning from the function, the following will be performed by
149 * the RTEMS irq epilogue :
150 *
151 * 1) masks the interrupts again,
152 * 2) restore the original i8259s' interrupt masks
153 * 3) switch back on the orinal stack if needed,
154 * 4) perform rescheduling when necessary,
155 * 5) restore the C scratch registers...
156 * 6) restore initial execution flow
157 *
158 */
160/*
161 * function to get the current RTEMS irq handler for ptr->name. It enables to
162 * define hanlder chain...
163 */
165/*
166 * function to get disconnect the RTEMS irq handler for ptr->name.
167 * This function checks that the value given is the current one for safety reason.
168 * The user can use the previous function to get it.
169 */
171
172
173/*
174 * ----------------- RTEMS Shared Irq Handler Mngt Routines ----------------
175 */
176#ifdef BSP_SHARED_HANDLER_SUPPORT
178#endif
179
180/*
181 * Less cumbersome, alternate entry points;
182 * RETURNS: more traditional, 0 on success, nonzero on error
183 *
184 * The BSP_rtems_int_connect() and BSP_rtems_int_disconnect() functions are
185 * only present on some PowerPC BSPs. Do not use them. Use
186 * rtems_interrupt_handler_install() instead.
187 */
188
189int BSP_rtems_int_connect(
190 rtems_irq_number n,
191 rtems_irq_hdl hdl,
192 rtems_irq_hdl_param p
193);
194
195int BSP_rtems_int_disconnect(
196 rtems_irq_number n,
197 rtems_irq_hdl hdl,
198 rtems_irq_hdl_param p
199);
200
201/*
202 * ----------------- RTEMS Global Irq Handler Mngt Routines ----------------
203 */
204/*
205 * (Re) Initialize the RTEMS interrupt management.
206 *
207 * The result of calling this function will be the same as if each individual
208 * handler (config->irqHdlTbl[i].hdl) different from "config->defaultEntry.hdl"
209 * has been individualy connected via
210 * BSP_install_rtems_irq_handler(&config->irqHdlTbl[i])
211 * And each handler currently equal to config->defaultEntry.hdl
212 * has been previously disconnected via
213 * BSP_remove_rtems_irq_handler (&config->irqHdlTbl[i])
214 *
215 * This is to say that all information given will be used and not just
216 * only the space.
217 *
218 * CAUTION : the various table address contained in config will be used
219 * directly by the interrupt mangement code in order to save
220 * data size so they must stay valid after the call => they should
221 * not be modified or declared on a stack.
222 */
223
225
226/*
227 * (Re) get info on current RTEMS interrupt management.
228 */
230
231#ifdef __cplusplus
232}
233#endif
234
235#endif /* ASM */
236#endif /* _RTEMS_IRQ_H */
int BSP_remove_rtems_irq_handler(const rtems_irq_connect_data *)
Definition: ppc-irq-legacy.c:192
int BSP_rtems_irq_mngt_set(rtems_irq_global_settings *config)
Definition: ppc-irq-legacy.c:326
int BSP_get_current_rtems_irq_handler(rtems_irq_connect_data *ptr)
Definition: ppc-irq-legacy.c:179
int BSP_install_rtems_irq_handler(const rtems_irq_connect_data *)
Definition: ppc-irq-legacy.c:133
int BSP_rtems_irq_mngt_get(rtems_irq_global_settings **)
Definition: ppc-irq-legacy.c:389
int BSP_install_rtems_shared_irq_handler(const rtems_irq_connect_data *cd)
Definition: irq-legacy.c:84
Definition: irq.h:45
Definition: deflate.c:115
Definition: irq.h:92
unsigned p
Definition: tte.h:17