RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
cpukit
include
rtems
irq.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
9
10
/*
11
* CopyRight (C) 1998 valette@crf.canon.fr
12
*
13
* This code is heavilly inspired by the public specification of STREAM V2
14
* that can be found at :
15
*
16
* <http://www.chorus.com/Documentation/index.html> by following
17
* the STREAM API Specification Document link.
18
*
19
* Redistribution and use in source and binary forms, with or without
20
* modification, are permitted provided that the following conditions
21
* are met:
22
* 1. Redistributions of source code must retain the above copyright
23
* notice, this list of conditions and the following disclaimer.
24
* 2. Redistributions in binary form must reproduce the above copyright
25
* notice, this list of conditions and the following disclaimer in the
26
* documentation and/or other materials provided with the distribution.
27
*
28
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
32
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38
* POSSIBILITY OF SUCH DAMAGE.
39
*/
40
41
#ifndef _RTEMS_IRQ_H
42
#define _RTEMS_IRQ_H
43
44
#ifndef ASM
45
46
#ifdef __cplusplus
47
extern
"C"
{
48
#endif
49
50
51
/*
52
* Type definition for RTEMS managed interrupts
53
*/
54
typedef
unsigned
char
rtems_irq_prio;
55
struct
__rtems_irq_connect_data__
;
/* forward declaratiuon */
56
57
typedef
unsigned
int
rtems_irq_number;
58
typedef
void
*rtems_irq_hdl_param;
59
typedef
void (*rtems_irq_hdl) (rtems_irq_hdl_param);
60
typedef
void (*rtems_irq_enable) (
const
struct
__rtems_irq_connect_data__
*);
61
typedef
void (*rtems_irq_disable) (
const
struct
__rtems_irq_connect_data__
*);
62
typedef
int (*rtems_irq_is_enabled) (
const
struct
__rtems_irq_connect_data__
*);
63
64
typedef
struct
__rtems_irq_connect_data__
{
65
/*
66
* IRQ line
67
*/
68
rtems_irq_number name;
69
/*
70
* handler. See comment on handler properties below in function prototype.
71
*/
72
rtems_irq_hdl hdl;
73
/*
74
* Handler handle to store private data
75
*/
76
rtems_irq_hdl_param handle;
77
/*
78
* function for enabling interrupts at device level (ONLY!).
79
* The BSP code will automatically enable it at i8259s level.
80
* RATIONALE : anyway such code has to exist in current driver code.
81
* It is usually called immediately AFTER connecting the interrupt handler.
82
* RTEMS may well need such a function when restoring normal interrupt
83
* processing after a debug session.
84
*
85
*/
86
rtems_irq_enable on;
87
/*
88
* function for disabling interrupts at device level (ONLY!).
89
* The code will disable it at i8259s level. RATIONALE : anyway
90
* such code has to exist for clean shutdown. It is usually called
91
* BEFORE disconnecting the interrupt. RTEMS may well need such
92
* a function when disabling normal interrupt processing for
93
* a debug session. May well be a NOP function.
94
*/
95
rtems_irq_disable off;
96
/*
97
* function enabling to know what interrupt may currently occur
98
* if someone manipulates the i8259s interrupt mask without care...
99
*/
100
rtems_irq_is_enabled isOn;
101
102
#ifdef BSP_SHARED_HANDLER_SUPPORT
103
/*
104
* Set to -1 for vectors forced to have only 1 handler
105
*/
106
void
*next_handler;
107
#endif
108
109
} rtems_irq_connect_data;
110
111
typedef
struct
{
112
/*
113
* size of all the table fields (*Tbl) described below.
114
*/
115
unsigned
int
irqNb;
116
/*
117
* Default handler used when disconnecting interrupts.
118
*/
119
rtems_irq_connect_data defaultEntry;
120
/*
121
* Table containing initials/current value.
122
*/
123
rtems_irq_connect_data* irqHdlTbl;
124
/*
125
* actual value of BSP_ISA_IRQ_VECTOR_BASE...
126
*/
127
rtems_irq_number irqBase;
128
/*
129
* software priorities associated with interrupts.
130
* if (*irqPrio [i] > intrPrio [j] it means that
131
* interrupt handler hdl connected for interrupt name i
132
* will not be interrupted by the handler connected for interrupt j
133
* The interrupt source will be physically masked at i8259 level.
134
*/
135
rtems_irq_prio* irqPrioTbl;
136
}
rtems_irq_global_settings
;
137
138
/*-------------------------------------------------------------------------+
139
| Function Prototypes.
140
+--------------------------------------------------------------------------*/
141
/*
142
* -------------------- RTEMS Single Irq Handler Mngt Routines ----------------
143
*/
144
/*
145
* function to connect a particular irq handler. This hanlder will NOT be called
146
* directly as the result of the corresponding interrupt. Instead, a RTEMS
147
* irq prologue will be called that will :
148
*
149
* 1) save the C scratch registers,
150
* 2) switch to a interrupt stack if the interrupt is not nested,
151
* 3) store the current i8259s' interrupt masks
152
* 4) modify them to disable the current interrupt at 8259 level (and may
153
* be others depending on software priorities)
154
* 5) aknowledge the i8259s',
155
* 6) demask the processor,
156
* 7) call the application handler
157
*
158
* As a result the hdl function provided
159
*
160
* a) can perfectly be written is C,
161
* b) may also well directly call the part of the RTEMS API that can be
162
* used from interrupt level,
163
* c) It only responsible for handling the jobs that need to be done at
164
* the device level including (aknowledging/re-enabling the interrupt at
165
* device level, getting the data,...)
166
*
167
* When returning from the function, the following will be performed by
168
* the RTEMS irq epilogue :
169
*
170
* 1) masks the interrupts again,
171
* 2) restore the original i8259s' interrupt masks
172
* 3) switch back on the orinal stack if needed,
173
* 4) perform rescheduling when necessary,
174
* 5) restore the C scratch registers...
175
* 6) restore initial execution flow
176
*
177
*/
178
int
BSP_install_rtems_irq_handler (
const
rtems_irq_connect_data*);
179
/*
180
* function to get the current RTEMS irq handler for ptr->name. It enables to
181
* define hanlder chain...
182
*/
183
int
BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr);
184
/*
185
* function to get disconnect the RTEMS irq handler for ptr->name.
186
* This function checks that the value given is the current one for safety reason.
187
* The user can use the previous function to get it.
188
*/
189
int
BSP_remove_rtems_irq_handler (
const
rtems_irq_connect_data*);
190
191
192
/*
193
* ----------------- RTEMS Shared Irq Handler Mngt Routines ----------------
194
*/
195
#ifdef BSP_SHARED_HANDLER_SUPPORT
196
int
BSP_install_rtems_shared_irq_handler (
const
rtems_irq_connect_data*);
197
#endif
198
199
/*
200
* Less cumbersome, alternate entry points;
201
* RETURNS: more traditional, 0 on success, nonzero on error
202
*
203
* The BSP_rtems_int_connect() and BSP_rtems_int_disconnect() functions are
204
* only present on some PowerPC BSPs. Do not use them. Use
205
* rtems_interrupt_handler_install() instead.
206
*/
207
208
int
BSP_rtems_int_connect(
209
rtems_irq_number n,
210
rtems_irq_hdl hdl,
211
rtems_irq_hdl_param
p
212
);
213
214
int
BSP_rtems_int_disconnect(
215
rtems_irq_number n,
216
rtems_irq_hdl hdl,
217
rtems_irq_hdl_param
p
218
);
219
220
/*
221
* ----------------- RTEMS Global Irq Handler Mngt Routines ----------------
222
*/
223
/*
224
* (Re) Initialize the RTEMS interrupt management.
225
*
226
* The result of calling this function will be the same as if each individual
227
* handler (config->irqHdlTbl[i].hdl) different from "config->defaultEntry.hdl"
228
* has been individualy connected via
229
* BSP_install_rtems_irq_handler(&config->irqHdlTbl[i])
230
* And each handler currently equal to config->defaultEntry.hdl
231
* has been previously disconnected via
232
* BSP_remove_rtems_irq_handler (&config->irqHdlTbl[i])
233
*
234
* This is to say that all information given will be used and not just
235
* only the space.
236
*
237
* CAUTION : the various table address contained in config will be used
238
* directly by the interrupt mangement code in order to save
239
* data size so they must stay valid after the call => they should
240
* not be modified or declared on a stack.
241
*/
242
243
int
BSP_rtems_irq_mngt_set(
rtems_irq_global_settings
* config);
244
245
/*
246
* (Re) get info on current RTEMS interrupt management.
247
*/
248
int
BSP_rtems_irq_mngt_get(
rtems_irq_global_settings
**);
249
250
#ifdef __cplusplus
251
}
252
#endif
253
254
#endif
/* ASM */
255
#endif
/* _RTEMS_IRQ_H */
__rtems_irq_connect_data__
Definition
irq.h:64
rtems_irq_global_settings
Definition
irq.h:111
p
unsigned p
Definition
tte.h:17
Generated by
1.18.0