1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup rtems_interrupt_extension |
---|
5 | * |
---|
6 | * @brief Header file for the Interrupt Manager Extension. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Based on concepts of Pavel Pisa, Till Straumann and Eric Valette. |
---|
11 | * |
---|
12 | * Copyright (c) 2008, 2017 embedded brains GmbH. |
---|
13 | * |
---|
14 | * embedded brains GmbH |
---|
15 | * Dornierstr. 4 |
---|
16 | * 82178 Puchheim |
---|
17 | * Germany |
---|
18 | * <rtems@embedded-brains.de> |
---|
19 | * |
---|
20 | * The license and distribution terms for this file may be |
---|
21 | * found in the file LICENSE in this distribution or at |
---|
22 | * http://www.rtems.org/license/LICENSE. |
---|
23 | */ |
---|
24 | |
---|
25 | #ifndef RTEMS_IRQ_EXTENSION_H |
---|
26 | #define RTEMS_IRQ_EXTENSION_H |
---|
27 | |
---|
28 | #include <rtems.h> |
---|
29 | #include <rtems/chain.h> |
---|
30 | |
---|
31 | #ifdef __cplusplus |
---|
32 | extern "C" { |
---|
33 | #endif /* __cplusplus */ |
---|
34 | |
---|
35 | /** |
---|
36 | * @defgroup rtems_interrupt_extension Interrupt Manager Extension |
---|
37 | * |
---|
38 | * @ingroup ClassicINTR |
---|
39 | * |
---|
40 | * In addition to the Classic API interrupt handler with a handle are |
---|
41 | * supported. You can also install multiple shared handler for one interrupt |
---|
42 | * vector. |
---|
43 | */ |
---|
44 | /**@{**/ |
---|
45 | |
---|
46 | /** |
---|
47 | * @brief Makes the interrupt handler unique. Prevents other handler from |
---|
48 | * using the same interrupt vector. |
---|
49 | */ |
---|
50 | #define RTEMS_INTERRUPT_UNIQUE ((rtems_option) 0x00000001) |
---|
51 | |
---|
52 | /** |
---|
53 | * @brief Allows that this interrupt handler may share a common interrupt |
---|
54 | * vector with other handler. |
---|
55 | */ |
---|
56 | #define RTEMS_INTERRUPT_SHARED ((rtems_option) 0x00000000) |
---|
57 | |
---|
58 | /** |
---|
59 | * @brief Forces that this interrupt handler replaces the first handler with |
---|
60 | * the same argument. |
---|
61 | */ |
---|
62 | #define RTEMS_INTERRUPT_REPLACE ((rtems_option) 0x00000002) |
---|
63 | |
---|
64 | /** |
---|
65 | * @brief Returns true if the interrupt handler unique option is set. |
---|
66 | */ |
---|
67 | #define RTEMS_INTERRUPT_IS_UNIQUE( options) \ |
---|
68 | ((options) & RTEMS_INTERRUPT_UNIQUE) |
---|
69 | |
---|
70 | /** |
---|
71 | * @brief Returns true if the interrupt handler shared option is set. |
---|
72 | */ |
---|
73 | #define RTEMS_INTERRUPT_IS_SHARED( options) \ |
---|
74 | (!RTEMS_INTERRUPT_IS_UNIQUE( options)) |
---|
75 | |
---|
76 | /** |
---|
77 | * @brief Returns true if the interrupt handler replace option is set. |
---|
78 | */ |
---|
79 | #define RTEMS_INTERRUPT_IS_REPLACE( options) \ |
---|
80 | ((options) & RTEMS_INTERRUPT_REPLACE) |
---|
81 | |
---|
82 | /** |
---|
83 | * @brief Interrupt handler routine type. |
---|
84 | */ |
---|
85 | typedef void (*rtems_interrupt_handler)(void *); |
---|
86 | |
---|
87 | /** |
---|
88 | * @brief Installs the interrupt handler routine @a handler for the interrupt |
---|
89 | * vector with number @a vector. |
---|
90 | * |
---|
91 | * You can set one of the mutually exclusive options |
---|
92 | * |
---|
93 | * - @ref RTEMS_INTERRUPT_UNIQUE |
---|
94 | * - @ref RTEMS_INTERRUPT_SHARED |
---|
95 | * - @ref RTEMS_INTERRUPT_REPLACE |
---|
96 | * |
---|
97 | * with the @a options parameter for the interrupt handler. |
---|
98 | * |
---|
99 | * The handler routine shall be called with argument @a arg when dispatched. |
---|
100 | * The order in which the shared interrupt handlers are dispatched for one |
---|
101 | * vector is BSP dependent. |
---|
102 | * |
---|
103 | * If the option @ref RTEMS_INTERRUPT_UNIQUE is set then it shall be ensured |
---|
104 | * that this handler will be the only one for this vector. |
---|
105 | * |
---|
106 | * If the option @ref RTEMS_INTERRUPT_REPLACE is set then it shall be ensured |
---|
107 | * that this handler will replace the first handler with the same argument for |
---|
108 | * this vector if it exists, otherwise an error status shall be returned. A |
---|
109 | * second handler with the same argument for this vector shall remain |
---|
110 | * unchanged. The new handler will inherit the unique or shared option from |
---|
111 | * the replaced handler. |
---|
112 | * |
---|
113 | * You can provide an informative description @a info. This may be used for |
---|
114 | * system debugging and status tools. The string has to be persistent during |
---|
115 | * the handler life time. |
---|
116 | * |
---|
117 | * This function may block. |
---|
118 | * |
---|
119 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
120 | * @retval RTEMS_CALLED_FROM_ISR If this function is called from interrupt |
---|
121 | * context this shall be returned. |
---|
122 | * @retval RTEMS_INVALID_ADDRESS If the handler address is NULL this shall be |
---|
123 | * returned. |
---|
124 | * @retval RTEMS_INVALID_ID If the vector number is out of range this shall be |
---|
125 | * returned. |
---|
126 | * @retval RTEMS_INVALID_NUMBER If an option is not applicable this shall be |
---|
127 | * returned. |
---|
128 | * @retval RTEMS_RESOURCE_IN_USE If the vector is already occupied with a |
---|
129 | * unique handler this shall be returned. If a unique handler should be |
---|
130 | * installed and there is already a handler installed this shall be returned. |
---|
131 | * @retval RTEMS_TOO_MANY If a handler with this argument is already installed |
---|
132 | * for the vector this shall be returned. |
---|
133 | * @retval RTEMS_UNSATISFIED If no handler exists to replace with the specified |
---|
134 | * argument and vector this shall be returned. |
---|
135 | * @retval RTEMS_IO_ERROR Reserved for board support package specific error |
---|
136 | * conditions. |
---|
137 | */ |
---|
138 | rtems_status_code rtems_interrupt_handler_install( |
---|
139 | rtems_vector_number vector, |
---|
140 | const char *info, |
---|
141 | rtems_option options, |
---|
142 | rtems_interrupt_handler handler, |
---|
143 | void *arg |
---|
144 | ); |
---|
145 | |
---|
146 | /** |
---|
147 | * @brief Removes the interrupt handler routine @a handler with argument @a arg |
---|
148 | * for the interrupt vector with number @a vector. |
---|
149 | * |
---|
150 | * This function may block. |
---|
151 | * |
---|
152 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
153 | * @retval RTEMS_CALLED_FROM_ISR If this function is called from interrupt |
---|
154 | * context this shall be returned. |
---|
155 | * @retval RTEMS_INVALID_ADDRESS If the handler address is NULL this shall be |
---|
156 | * returned. |
---|
157 | * @retval RTEMS_INVALID_ID If the vector number is out of range this shall be |
---|
158 | * returned. |
---|
159 | * @retval RTEMS_UNSATISFIED If the handler with its argument is not installed |
---|
160 | * for the vector this shall be returned. |
---|
161 | * @retval RTEMS_IO_ERROR Reserved for board support package specific error |
---|
162 | * conditions. |
---|
163 | */ |
---|
164 | rtems_status_code rtems_interrupt_handler_remove( |
---|
165 | rtems_vector_number vector, |
---|
166 | rtems_interrupt_handler handler, |
---|
167 | void *arg |
---|
168 | ); |
---|
169 | |
---|
170 | /** |
---|
171 | * @brief Interrupt handler iteration routine type. |
---|
172 | * |
---|
173 | * @see rtems_interrupt_handler_iterate() |
---|
174 | */ |
---|
175 | typedef void (*rtems_interrupt_per_handler_routine)( |
---|
176 | void *, const char *, rtems_option, rtems_interrupt_handler, void * |
---|
177 | ); |
---|
178 | |
---|
179 | /** |
---|
180 | * @brief Iterates over all installed interrupt handler of the interrupt vector |
---|
181 | * with number @a vector. |
---|
182 | * |
---|
183 | * For each installed handler of the vector the function @a routine will be |
---|
184 | * called with the supplied argument @a arg and the handler information, |
---|
185 | * options, routine and argument. |
---|
186 | * |
---|
187 | * This function is intended for system information and diagnostics. |
---|
188 | * |
---|
189 | * This function may block. Never install or remove an interrupt handler |
---|
190 | * within the iteration routine. This may result in a deadlock. |
---|
191 | * |
---|
192 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
193 | * @retval RTEMS_CALLED_FROM_ISR If this function is called from interrupt |
---|
194 | * context this shall be returned. |
---|
195 | * @retval RTEMS_INVALID_ID If the vector number is out of range this shall be |
---|
196 | * returned. |
---|
197 | * @retval RTEMS_IO_ERROR Reserved for board support package specific error |
---|
198 | * conditions. |
---|
199 | */ |
---|
200 | rtems_status_code rtems_interrupt_handler_iterate( |
---|
201 | rtems_vector_number vector, |
---|
202 | rtems_interrupt_per_handler_routine routine, |
---|
203 | void *arg |
---|
204 | ); |
---|
205 | |
---|
206 | /** |
---|
207 | * @brief Sets the processor affinity set of an interrupt vector. |
---|
208 | * |
---|
209 | * @param[in] vector The interrupt vector number. |
---|
210 | * @param[in] affinity_size The storage size of the affinity set. |
---|
211 | * @param[in] affinity_set The new processor affinity set for the interrupt |
---|
212 | * vector. This pointer must not be @c NULL. |
---|
213 | * |
---|
214 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
215 | * @retval RTEMS_INVALID_ID The vector number is invalid. |
---|
216 | * @retval RTEMS_INVALID_SIZE Invalid affinity set size. |
---|
217 | * @retval RTEMS_INVALID_NUMBER Invalid processor affinity set. |
---|
218 | */ |
---|
219 | rtems_status_code rtems_interrupt_set_affinity( |
---|
220 | rtems_vector_number vector, |
---|
221 | size_t affinity_size, |
---|
222 | const cpu_set_t *affinity |
---|
223 | ); |
---|
224 | |
---|
225 | /** |
---|
226 | * @brief Gets the processor affinity set of an interrupt vector. |
---|
227 | * |
---|
228 | * @param[in] vector The interrupt vector number. |
---|
229 | * @param[in] affinity_size The storage size of the affinity set. |
---|
230 | * @param[out] affinity_set The current processor affinity set for the |
---|
231 | * interrupt vector. This pointer must not be @c NULL. |
---|
232 | * |
---|
233 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
234 | * @retval RTEMS_INVALID_ID The vector number is invalid. |
---|
235 | * @retval RTEMS_INVALID_SIZE Invalid affinity set size. |
---|
236 | */ |
---|
237 | rtems_status_code rtems_interrupt_get_affinity( |
---|
238 | rtems_vector_number vector, |
---|
239 | size_t affinity_size, |
---|
240 | cpu_set_t *affinity |
---|
241 | ); |
---|
242 | |
---|
243 | /** |
---|
244 | * @brief An interrupt server action. |
---|
245 | * |
---|
246 | * This structure must be treated as an opaque data type. Members must not be |
---|
247 | * accessed directly. |
---|
248 | * |
---|
249 | * @see rtems_interrupt_server_action_prepend(). |
---|
250 | */ |
---|
251 | typedef struct rtems_interrupt_server_action { |
---|
252 | struct rtems_interrupt_server_action *next; |
---|
253 | rtems_interrupt_handler handler; |
---|
254 | void *arg; |
---|
255 | } rtems_interrupt_server_action; |
---|
256 | |
---|
257 | /** |
---|
258 | * @brief The interrupt server index of the default interrupt server. |
---|
259 | */ |
---|
260 | #define RTEMS_INTERRUPT_SERVER_DEFAULT 0 |
---|
261 | |
---|
262 | /** |
---|
263 | * @brief An interrupt server entry. |
---|
264 | * |
---|
265 | * This structure must be treated as an opaque data type. Members must not be |
---|
266 | * accessed directly. |
---|
267 | * |
---|
268 | * @see rtems_interrupt_server_entry_initialize(), |
---|
269 | * rtems_interrupt_server_action_prepend(), |
---|
270 | * rtems_interrupt_server_entry_submit(), and |
---|
271 | * rtems_interrupt_server_entry_destroy(). |
---|
272 | */ |
---|
273 | typedef struct { |
---|
274 | rtems_chain_node node; |
---|
275 | void *server; |
---|
276 | rtems_vector_number vector; |
---|
277 | rtems_interrupt_server_action *actions; |
---|
278 | } rtems_interrupt_server_entry; |
---|
279 | |
---|
280 | /** |
---|
281 | * @brief An interrupt server request. |
---|
282 | * |
---|
283 | * This structure must be treated as an opaque data type. Members must not be |
---|
284 | * accessed directly. |
---|
285 | * |
---|
286 | * @see rtems_interrupt_server_request_initialize(), |
---|
287 | * rtems_interrupt_server_request_submit(), and |
---|
288 | * rtems_interrupt_server_request_destroy(). |
---|
289 | */ |
---|
290 | typedef struct { |
---|
291 | rtems_interrupt_server_entry entry; |
---|
292 | rtems_interrupt_server_action action; |
---|
293 | } rtems_interrupt_server_request; |
---|
294 | |
---|
295 | /** |
---|
296 | * @brief Initializes the interrupt server tasks. |
---|
297 | * |
---|
298 | * This function tries to create an interrupt server task for each processor in |
---|
299 | * the system. The tasks will have the priority @a priority, the stack size @a |
---|
300 | * stack_size, the modes @a modes and the attributes @a attributes. The count |
---|
301 | * of server tasks will be returned in @a server_count. Interrupt handlers can |
---|
302 | * be installed on an interrupt server with |
---|
303 | * rtems_interrupt_server_handler_install() and removed with |
---|
304 | * rtems_interrupt_server_handler_remove() using a server index. In case of an |
---|
305 | * interrupt, the request will be forwarded to the interrupt server. The |
---|
306 | * handlers are executed within the interrupt server context. If one handler |
---|
307 | * blocks on something this may delay the processing of other handlers. |
---|
308 | * |
---|
309 | * The server count pointer @a server_count may be @a NULL. |
---|
310 | * |
---|
311 | * This function may block. |
---|
312 | * |
---|
313 | * @see rtems_task_create(). |
---|
314 | * |
---|
315 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
316 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
317 | * @retval RTEMS_NO_MEMORY Not enough memory. |
---|
318 | * @retval RTEMS_TOO_MANY No free task available to create at least one server task. |
---|
319 | * @retval RTEMS_UNSATISFIED Task stack size too large. |
---|
320 | * @retval RTEMS_INVALID_PRIORITY Invalid task priority. |
---|
321 | */ |
---|
322 | rtems_status_code rtems_interrupt_server_initialize( |
---|
323 | rtems_task_priority priority, |
---|
324 | size_t stack_size, |
---|
325 | rtems_mode modes, |
---|
326 | rtems_attribute attributes, |
---|
327 | uint32_t *server_count |
---|
328 | ); |
---|
329 | |
---|
330 | /** |
---|
331 | * @brief Installs the interrupt handler routine @a handler for the interrupt |
---|
332 | * vector with number @a vector on the server @a server. |
---|
333 | * |
---|
334 | * The handler routine will be executed on the corresponding interrupt server |
---|
335 | * task. A server index @a server_index of @c RTEMS_INTERRUPT_SERVER_DEFAULT |
---|
336 | * may be used to install the handler on the default server. |
---|
337 | * |
---|
338 | * This function may block. |
---|
339 | * |
---|
340 | * @see rtems_interrupt_handler_install(). |
---|
341 | * |
---|
342 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
343 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
344 | * @retval RTEMS_INVALID_ID If the interrupt server index is invalid. |
---|
345 | * @retval * For other errors see rtems_interrupt_handler_install(). |
---|
346 | */ |
---|
347 | rtems_status_code rtems_interrupt_server_handler_install( |
---|
348 | uint32_t server_index, |
---|
349 | rtems_vector_number vector, |
---|
350 | const char *info, |
---|
351 | rtems_option options, |
---|
352 | rtems_interrupt_handler handler, |
---|
353 | void *arg |
---|
354 | ); |
---|
355 | |
---|
356 | /** |
---|
357 | * @brief Removes the interrupt handler routine @a handler with argument @a arg |
---|
358 | * for the interrupt vector with number @a vector from the server @a server. |
---|
359 | * |
---|
360 | * A server index @a server_index of @c RTEMS_INTERRUPT_SERVER_DEFAULT may be |
---|
361 | * used to remove the handler from the default server. |
---|
362 | * |
---|
363 | * This function may block. |
---|
364 | * |
---|
365 | * @see rtems_interrupt_handler_remove(). |
---|
366 | * |
---|
367 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
368 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
369 | * @retval RTEMS_INVALID_ID If the interrupt server index is invalid. |
---|
370 | * @retval * For other errors see rtems_interrupt_handler_remove(). |
---|
371 | */ |
---|
372 | rtems_status_code rtems_interrupt_server_handler_remove( |
---|
373 | uint32_t server_index, |
---|
374 | rtems_vector_number vector, |
---|
375 | rtems_interrupt_handler handler, |
---|
376 | void *arg |
---|
377 | ); |
---|
378 | |
---|
379 | /** |
---|
380 | * @brief Iterates over all interrupt handler of the interrupt vector with |
---|
381 | * number @a vector which are installed on the interrupt server specified by |
---|
382 | * @a server. |
---|
383 | * |
---|
384 | * A server index @a server_index of @c RTEMS_INTERRUPT_SERVER_DEFAULT may be |
---|
385 | * used to specify the default server. |
---|
386 | * |
---|
387 | * @see rtems_interrupt_handler_iterate() |
---|
388 | * |
---|
389 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
390 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
391 | * @retval RTEMS_INVALID_ID If the interrupt server index is invalid. |
---|
392 | * @retval * For other errors see rtems_interrupt_handler_iterate(). |
---|
393 | */ |
---|
394 | rtems_status_code rtems_interrupt_server_handler_iterate( |
---|
395 | uint32_t server_index, |
---|
396 | rtems_vector_number vector, |
---|
397 | rtems_interrupt_per_handler_routine routine, |
---|
398 | void *arg |
---|
399 | ); |
---|
400 | |
---|
401 | /** |
---|
402 | * @brief Moves the interrupt handlers installed on the specified source |
---|
403 | * interrupt server to the destination interrupt server. |
---|
404 | * |
---|
405 | * This function must be called from thread context. It may block. Calling |
---|
406 | * this function within the context of an interrupt server is undefined |
---|
407 | * behaviour. |
---|
408 | * |
---|
409 | * @param[in] source_server_index The source interrupt server index. Use |
---|
410 | * @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server. |
---|
411 | * @param[in] vector The interrupt vector number. |
---|
412 | * @param[in] destination_server_index The destination interrupt server index. |
---|
413 | * Use @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server. |
---|
414 | * |
---|
415 | * @retval RTEMS_SUCCESSFUL Successful operation |
---|
416 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
417 | * @retval RTEMS_INVALID_ID The destination interrupt server index is invalid. |
---|
418 | * @retval RTEMS_INVALID_ID The vector number is invalid. |
---|
419 | * @retval RTEMS_INVALID_ID The destination interrupt server index is invalid. |
---|
420 | */ |
---|
421 | rtems_status_code rtems_interrupt_server_move( |
---|
422 | uint32_t source_server_index, |
---|
423 | rtems_vector_number vector, |
---|
424 | uint32_t destination_server_index |
---|
425 | ); |
---|
426 | |
---|
427 | /** |
---|
428 | * @brief Suspends the specified interrupt server. |
---|
429 | * |
---|
430 | * A suspend request is sent to the specified interrupt server. This function |
---|
431 | * waits for an acknowledgment from the specified interrupt server. |
---|
432 | * |
---|
433 | * This function must be called from thread context. It may block. Calling |
---|
434 | * this function within the context of an interrupt server is undefined |
---|
435 | * behaviour. |
---|
436 | * |
---|
437 | * @param[in] server_index The interrupt server index. Use |
---|
438 | * @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server. |
---|
439 | * |
---|
440 | * @see rtems_interrupt_server_resume(). |
---|
441 | * |
---|
442 | * @retval RTEMS_SUCCESSFUL Successful operation |
---|
443 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
444 | * @retval RTEMS_INVALID_ID If the interrupt server index is invalid. |
---|
445 | */ |
---|
446 | rtems_status_code rtems_interrupt_server_suspend( uint32_t server_index ); |
---|
447 | |
---|
448 | /** |
---|
449 | * @brief Resumes the specified interrupt server. |
---|
450 | * |
---|
451 | * This function must be called from thread context. It may block. Calling |
---|
452 | * this function within the context of an interrupt server is undefined |
---|
453 | * behaviour. |
---|
454 | * |
---|
455 | * @param[in] server_index The interrupt server index. Use |
---|
456 | * @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server. |
---|
457 | * |
---|
458 | * @see rtems_interrupt_server_suspend(). |
---|
459 | * |
---|
460 | * @retval RTEMS_SUCCESSFUL Successful operation |
---|
461 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
462 | * @retval RTEMS_INVALID_ID If the interrupt server index is invalid. |
---|
463 | */ |
---|
464 | rtems_status_code rtems_interrupt_server_resume( uint32_t server_index ); |
---|
465 | |
---|
466 | /** |
---|
467 | * @brief Sets the processor affinity of the specified interrupt server. |
---|
468 | * |
---|
469 | * The scheduler is set determined by the highest numbered processor in the |
---|
470 | * specified affinity set. |
---|
471 | * |
---|
472 | * This operation is only reliable in case the specified interrupt was |
---|
473 | * suspended via rtems_interrupt_server_suspend(). |
---|
474 | * |
---|
475 | * @param[in] server_index The interrupt server index. Use |
---|
476 | * @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server. |
---|
477 | * @param[in] affinity_size The storage size of the affinity set. |
---|
478 | * @param[in] affinity The desired processor affinity set for the specified |
---|
479 | * interrupt server. |
---|
480 | * @param[in] priority The task priority with respect to the corresponding |
---|
481 | * scheduler instance. |
---|
482 | * |
---|
483 | * @retval RTEMS_SUCCESSFUL Successful operation |
---|
484 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
485 | * @retval RTEMS_INVALID_ID If the interrupt server index is invalid. |
---|
486 | * @retval RTEMS_INVALID_SIZE Invalid affinity set size. |
---|
487 | * @retval RTEMS_INVALID_NAME The affinity set contains no online processor. |
---|
488 | * @retval RTEMS_INCORRECT_STATE The highest numbered online processor in the |
---|
489 | * specified affinity set is not owned by a scheduler. |
---|
490 | * @retval RTEMS_INVALID_PRIORITY Invalid priority. |
---|
491 | * @retval RTEMS_RESOURCE_IN_USE The interrupt server owns resources which deny |
---|
492 | * a scheduler change. |
---|
493 | * @retval RTEMS_INVALID_NUMBER Invalid processor affinity set. |
---|
494 | */ |
---|
495 | rtems_status_code rtems_interrupt_server_set_affinity( |
---|
496 | uint32_t server_index, |
---|
497 | size_t affinity_size, |
---|
498 | const cpu_set_t *affinity, |
---|
499 | rtems_task_priority priority |
---|
500 | ); |
---|
501 | |
---|
502 | /** |
---|
503 | * @brief Initializes the specified interrupt server entry. |
---|
504 | * |
---|
505 | * @param[in] server_index The interrupt server index. Use |
---|
506 | * @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server. |
---|
507 | * @param[in] entry The interrupt server entry to initialize. |
---|
508 | * |
---|
509 | * @see rtems_interrupt_server_action_prepend(). |
---|
510 | * |
---|
511 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
512 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
513 | * @retval RTEMS_INVALID_ID If the interrupt server index is invalid. |
---|
514 | */ |
---|
515 | rtems_status_code rtems_interrupt_server_entry_initialize( |
---|
516 | uint32_t server_index, |
---|
517 | rtems_interrupt_server_entry *entry |
---|
518 | ); |
---|
519 | |
---|
520 | /** |
---|
521 | * @brief Prepends the specified interrupt server action to the list of actions |
---|
522 | * of the specified interrupt server entry. |
---|
523 | * |
---|
524 | * No error checking is performed. |
---|
525 | * |
---|
526 | * @param[in] entry The interrupt server entry to prepend the interrupt server |
---|
527 | * action. It must have been initialized via |
---|
528 | * rtems_interrupt_server_entry_initialize(). |
---|
529 | * @param[in] action The interrupt server action to prepend the list of actions |
---|
530 | * of the entry. |
---|
531 | * @param[in] handler The interrupt handler for the action. |
---|
532 | * @param[in] arg The interrupt handler argument for the action. |
---|
533 | */ |
---|
534 | void rtems_interrupt_server_action_prepend( |
---|
535 | rtems_interrupt_server_entry *entry, |
---|
536 | rtems_interrupt_server_action *action, |
---|
537 | rtems_interrupt_handler handler, |
---|
538 | void *arg |
---|
539 | ); |
---|
540 | |
---|
541 | /** |
---|
542 | * @brief Submits the specified interrupt server entry so that its interrupt |
---|
543 | * server actions can be invoked by the specified interrupt server. |
---|
544 | * |
---|
545 | * This function may be used to do a two-step interrupt processing. The first |
---|
546 | * step is done in interrupt context which calls this function. The second |
---|
547 | * step is then done in the context of the interrupt server. |
---|
548 | * |
---|
549 | * This function may be called from thread or interrupt context. It does not |
---|
550 | * block. No error checking is performed. |
---|
551 | * |
---|
552 | * @param[in] entry The interrupt server entry must be initialized before the |
---|
553 | * first call to this function via rtems_interrupt_server_entry_initialize() |
---|
554 | * and rtems_interrupt_server_action_prepend(). The entry and its actions |
---|
555 | * must not be modified between calls to this function. Use |
---|
556 | * rtems_interrupt_server_entry_destroy() to destroy an entry in use. |
---|
557 | */ |
---|
558 | void rtems_interrupt_server_entry_submit( |
---|
559 | rtems_interrupt_server_entry *entry |
---|
560 | ); |
---|
561 | |
---|
562 | /** |
---|
563 | * @brief Destroys the specified interrupt server entry. |
---|
564 | * |
---|
565 | * This function must be called from thread context. It may block. Calling |
---|
566 | * this function within the context of an interrupt server is undefined |
---|
567 | * behaviour. No error checking is performed. |
---|
568 | * |
---|
569 | * @param[in] server_index The interrupt server index. Use |
---|
570 | * @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server. |
---|
571 | * @param[in] entry The interrupt server entry to destroy. It must have been |
---|
572 | * initialized via rtems_interrupt_server_entry_initialize(). |
---|
573 | */ |
---|
574 | void rtems_interrupt_server_entry_destroy( |
---|
575 | rtems_interrupt_server_entry *entry |
---|
576 | ); |
---|
577 | |
---|
578 | /** |
---|
579 | * @brief Initializes the specified interrupt server request. |
---|
580 | * |
---|
581 | * @param[in] server_index The interrupt server index. Use |
---|
582 | * @c RTEMS_INTERRUPT_SERVER_DEFAULT to specify the default server. |
---|
583 | * @param[in] request The interrupt server request to initialize. |
---|
584 | * @param[in] handler The interrupt handler for the request action. |
---|
585 | * @param[in] arg The interrupt handler argument for the request action. |
---|
586 | * |
---|
587 | * @retval RTEMS_SUCCESSFUL Successful operation. |
---|
588 | * @retval RTEMS_INCORRECT_STATE The interrupt servers are not initialized. |
---|
589 | * @retval RTEMS_INVALID_ID If the interrupt server index is invalid. |
---|
590 | */ |
---|
591 | rtems_status_code rtems_interrupt_server_request_initialize( |
---|
592 | uint32_t server_index, |
---|
593 | rtems_interrupt_server_request *request, |
---|
594 | rtems_interrupt_handler handler, |
---|
595 | void *arg |
---|
596 | ); |
---|
597 | |
---|
598 | /** |
---|
599 | * @brief Submits the specified interrupt server request so that its interrupt |
---|
600 | * server action can be invoked by the specified interrupt server. |
---|
601 | * |
---|
602 | * This function may be used to do a two-step interrupt processing. The first |
---|
603 | * step is done in interrupt context which calls this function. The second |
---|
604 | * step is then done in the context of the interrupt server. |
---|
605 | * |
---|
606 | * This function may be called from thread or interrupt context. It does not |
---|
607 | * block. No error checking is performed. |
---|
608 | * |
---|
609 | * @param[in] request The interrupt server request must be initialized before the |
---|
610 | * first call to this function via |
---|
611 | * rtems_interrupt_server_request_initialize(). The request must not be |
---|
612 | * modified between calls to this function. Use |
---|
613 | * rtems_interrupt_server_request_destroy() to destroy a request in use. |
---|
614 | */ |
---|
615 | RTEMS_INLINE_ROUTINE void rtems_interrupt_server_request_submit( |
---|
616 | rtems_interrupt_server_request *request |
---|
617 | ) |
---|
618 | { |
---|
619 | rtems_interrupt_server_entry_submit( &request->entry ); |
---|
620 | } |
---|
621 | |
---|
622 | /** |
---|
623 | * @brief Destroys the specified interrupt server request. |
---|
624 | * |
---|
625 | * This function must be called from thread context. It may block. Calling |
---|
626 | * this function within the context of an interrupt server is undefined |
---|
627 | * behaviour. No error checking is performed. |
---|
628 | * |
---|
629 | * @param[in] request The interrupt server request to destroy. It must have |
---|
630 | * been initialized via rtems_interrupt_server_request_initialize(). |
---|
631 | */ |
---|
632 | RTEMS_INLINE_ROUTINE void rtems_interrupt_server_request_destroy( |
---|
633 | rtems_interrupt_server_request *request |
---|
634 | ) |
---|
635 | { |
---|
636 | rtems_interrupt_server_entry_destroy( &request->entry ); |
---|
637 | } |
---|
638 | |
---|
639 | /** @} */ |
---|
640 | |
---|
641 | #ifdef __cplusplus |
---|
642 | } |
---|
643 | #endif /* __cplusplus */ |
---|
644 | |
---|
645 | #endif /* RTEMS_IRQ_EXTENSION_H */ |
---|