1 | /* userext.h |
---|
2 | * |
---|
3 | * This include file contains all information about user extensions. This |
---|
4 | * Handler provides mechanisms which can be used to initialize and manipulate |
---|
5 | * all user extensions. |
---|
6 | * |
---|
7 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * All rights assigned to U.S. Government, 1994. |
---|
10 | * |
---|
11 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
12 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
13 | * notice must appear in all copies of this file and its derivatives. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef __USER_EXTENSIONS_h |
---|
19 | #define __USER_EXTENSIONS_h |
---|
20 | |
---|
21 | #ifdef __cplusplus |
---|
22 | extern "C" { |
---|
23 | #endif |
---|
24 | |
---|
25 | #include <rtems/score/interr.h> |
---|
26 | #include <rtems/score/chain.h> |
---|
27 | #include <rtems/score/thread.h> |
---|
28 | |
---|
29 | /* |
---|
30 | * The following records defines the User Extension Table. |
---|
31 | * This table defines the application dependent routines which |
---|
32 | * are invoked at critical points in the life of each thread and |
---|
33 | * the system as a whole. |
---|
34 | */ |
---|
35 | |
---|
36 | typedef void User_extensions_routine; |
---|
37 | |
---|
38 | typedef boolean ( *User_extensions_thread_create_extension )( |
---|
39 | Thread_Control *, |
---|
40 | Thread_Control * |
---|
41 | ); |
---|
42 | |
---|
43 | typedef User_extensions_routine ( *User_extensions_thread_delete_extension )( |
---|
44 | Thread_Control *, |
---|
45 | Thread_Control * |
---|
46 | ); |
---|
47 | |
---|
48 | typedef User_extensions_routine ( *User_extensions_thread_start_extension )( |
---|
49 | Thread_Control *, |
---|
50 | Thread_Control * |
---|
51 | ); |
---|
52 | |
---|
53 | typedef User_extensions_routine ( *User_extensions_thread_restart_extension )( |
---|
54 | Thread_Control *, |
---|
55 | Thread_Control * |
---|
56 | ); |
---|
57 | |
---|
58 | typedef User_extensions_routine ( *User_extensions_thread_switch_extension )( |
---|
59 | Thread_Control *, |
---|
60 | Thread_Control * |
---|
61 | ); |
---|
62 | |
---|
63 | typedef User_extensions_routine (*User_extensions_thread_post_switch_extension)( |
---|
64 | Thread_Control * |
---|
65 | ); |
---|
66 | |
---|
67 | typedef User_extensions_routine ( *User_extensions_thread_begin_extension )( |
---|
68 | Thread_Control * |
---|
69 | ); |
---|
70 | |
---|
71 | typedef User_extensions_routine ( *User_extensions_thread_exitted_extension )( |
---|
72 | Thread_Control * |
---|
73 | ); |
---|
74 | |
---|
75 | typedef User_extensions_routine ( *User_extensions_fatal_extension )( |
---|
76 | Internal_errors_Source /* the_source */, |
---|
77 | boolean /* is_internal */, |
---|
78 | unsigned32 /* the_error */ |
---|
79 | ); |
---|
80 | |
---|
81 | |
---|
82 | typedef struct { |
---|
83 | User_extensions_thread_create_extension thread_create; |
---|
84 | User_extensions_thread_start_extension thread_start; |
---|
85 | User_extensions_thread_restart_extension thread_restart; |
---|
86 | User_extensions_thread_delete_extension thread_delete; |
---|
87 | User_extensions_thread_switch_extension thread_switch; |
---|
88 | User_extensions_thread_post_switch_extension thread_post_switch; |
---|
89 | User_extensions_thread_begin_extension thread_begin; |
---|
90 | User_extensions_thread_exitted_extension thread_exitted; |
---|
91 | User_extensions_fatal_extension fatal; |
---|
92 | } User_extensions_Table; |
---|
93 | |
---|
94 | /* |
---|
95 | * The following is used to manage each user extension set. |
---|
96 | */ |
---|
97 | |
---|
98 | typedef struct { |
---|
99 | Chain_Node Node; |
---|
100 | User_extensions_Table Callouts; |
---|
101 | } User_extensions_Control; |
---|
102 | |
---|
103 | /* |
---|
104 | * The following contains the static extension set which may be |
---|
105 | * configured by the application. |
---|
106 | */ |
---|
107 | |
---|
108 | EXTERN User_extensions_Control _User_extensions_Initial; |
---|
109 | |
---|
110 | /* |
---|
111 | * The following is used to manage the list of active extensions. |
---|
112 | */ |
---|
113 | |
---|
114 | EXTERN Chain_Control _User_extensions_List; |
---|
115 | |
---|
116 | |
---|
117 | /* |
---|
118 | * _User_extensions_Handler_initialization |
---|
119 | * |
---|
120 | * DESCRIPTION: |
---|
121 | * |
---|
122 | * This routine performs the initialization necessary for this handler. |
---|
123 | */ |
---|
124 | |
---|
125 | STATIC INLINE void _User_extensions_Handler_initialization ( |
---|
126 | User_extensions_Table *initial_extensions |
---|
127 | ); |
---|
128 | |
---|
129 | /* |
---|
130 | * _User_extensions_Add_set |
---|
131 | * |
---|
132 | * DESCRIPTION: |
---|
133 | * |
---|
134 | * This routine is used to add a user extension set to the active list. |
---|
135 | */ |
---|
136 | |
---|
137 | STATIC INLINE void _User_extensions_Add_set ( |
---|
138 | User_extensions_Control *the_extension, |
---|
139 | User_extensions_Table *extension_table |
---|
140 | ); |
---|
141 | |
---|
142 | /* |
---|
143 | * _User_extensions_Add_API_set |
---|
144 | * |
---|
145 | * DESCRIPTION: |
---|
146 | * |
---|
147 | * This routine is used to add an API extension set to the active list. |
---|
148 | */ |
---|
149 | |
---|
150 | STATIC INLINE void _User_extensions_Add_API_set ( |
---|
151 | User_extensions_Control *the_extension |
---|
152 | ); |
---|
153 | |
---|
154 | /* |
---|
155 | * _User_extensions_Remove_set |
---|
156 | * |
---|
157 | * DESCRIPTION: |
---|
158 | * |
---|
159 | * This routine is used to remove a user extension set from the active list. |
---|
160 | */ |
---|
161 | |
---|
162 | STATIC INLINE void _User_extensions_Remove_set ( |
---|
163 | User_extensions_Control *the_extension |
---|
164 | ); |
---|
165 | |
---|
166 | /* |
---|
167 | * _User_extensions_Thread_create |
---|
168 | * |
---|
169 | * DESCRIPTION: |
---|
170 | * |
---|
171 | * This routine is used to invoke the user extension for |
---|
172 | * the thread creation operate. |
---|
173 | */ |
---|
174 | |
---|
175 | boolean _User_extensions_Thread_create ( |
---|
176 | Thread_Control *the_thread |
---|
177 | ); |
---|
178 | |
---|
179 | /* |
---|
180 | * _User_extensions_Thread_delete |
---|
181 | * |
---|
182 | * DESCRIPTION: |
---|
183 | * |
---|
184 | * This routine is used to invoke the user extension for |
---|
185 | * the thread deletion operation. |
---|
186 | */ |
---|
187 | |
---|
188 | void _User_extensions_Thread_delete ( |
---|
189 | Thread_Control *the_thread |
---|
190 | ); |
---|
191 | |
---|
192 | /* |
---|
193 | * _User_extensions_Thread_start |
---|
194 | * |
---|
195 | * DESCRIPTION: |
---|
196 | * |
---|
197 | * This routine is used to invoke the user extension for |
---|
198 | * the thread start operation. |
---|
199 | */ |
---|
200 | |
---|
201 | void _User_extensions_Thread_start ( |
---|
202 | Thread_Control *the_thread |
---|
203 | ); |
---|
204 | |
---|
205 | /* |
---|
206 | * _User_extensions_Thread_restart |
---|
207 | * |
---|
208 | * DESCRIPTION: |
---|
209 | * |
---|
210 | * This routine is used to invoke the user extension for |
---|
211 | * the thread restart operation. |
---|
212 | */ |
---|
213 | |
---|
214 | void _User_extensions_Thread_restart ( |
---|
215 | Thread_Control *the_thread |
---|
216 | ); |
---|
217 | |
---|
218 | /* |
---|
219 | * _User_extensions_Thread_switch |
---|
220 | * |
---|
221 | * DESCRIPTION: |
---|
222 | * |
---|
223 | * This routine is used to invoke the user extension which |
---|
224 | * is invoked when a context switch occurs. |
---|
225 | */ |
---|
226 | |
---|
227 | STATIC INLINE void _User_extensions_Thread_switch ( |
---|
228 | Thread_Control *executing, |
---|
229 | Thread_Control *heir |
---|
230 | ); |
---|
231 | |
---|
232 | /* |
---|
233 | * _User_extensions_Thread_post_switch |
---|
234 | * |
---|
235 | * DESCRIPTION: |
---|
236 | * |
---|
237 | * This routine is used to invoke the user extension which is invoked |
---|
238 | * after a context switch occurs (i.e. we are running in the context |
---|
239 | * of the new thread). |
---|
240 | */ |
---|
241 | |
---|
242 | STATIC INLINE void _User_extensions_Thread_post_switch ( |
---|
243 | Thread_Control *executing |
---|
244 | ); |
---|
245 | |
---|
246 | |
---|
247 | /* |
---|
248 | * _User_extensions_Thread_begin |
---|
249 | * |
---|
250 | * DESCRIPTION: |
---|
251 | * |
---|
252 | * This routine is used to invoke the user extension which |
---|
253 | * is invoked when a thread begins. |
---|
254 | */ |
---|
255 | |
---|
256 | void _User_extensions_Thread_begin ( |
---|
257 | Thread_Control *executing |
---|
258 | ); |
---|
259 | |
---|
260 | /* |
---|
261 | * _User_extensions_Thread_exitted |
---|
262 | * |
---|
263 | * DESCRIPTION: |
---|
264 | * |
---|
265 | * This routine is used to invoke the user extension which |
---|
266 | * is invoked when a thread exits. |
---|
267 | */ |
---|
268 | |
---|
269 | void _User_extensions_Thread_exitted ( |
---|
270 | Thread_Control *executing |
---|
271 | ); |
---|
272 | |
---|
273 | /* |
---|
274 | * _User_extensions_Fatal |
---|
275 | * |
---|
276 | * DESCRIPTION: |
---|
277 | * |
---|
278 | * This routine is used to invoke the user extension invoked |
---|
279 | * when a fatal error occurs. |
---|
280 | */ |
---|
281 | |
---|
282 | void _User_extensions_Fatal ( |
---|
283 | Internal_errors_Source the_source, |
---|
284 | boolean is_internal, |
---|
285 | unsigned32 the_error |
---|
286 | ); |
---|
287 | |
---|
288 | #include <rtems/score/userext.inl> |
---|
289 | |
---|
290 | #ifdef __cplusplus |
---|
291 | } |
---|
292 | #endif |
---|
293 | |
---|
294 | #endif |
---|
295 | /* end of include file */ |
---|