1 | @c |
---|
2 | @c COPYRIGHT (c) 1996. |
---|
3 | @c On-Line Applications Research Corporation (OAR). |
---|
4 | @c All rights reserved. |
---|
5 | @c |
---|
6 | |
---|
7 | @ifinfo |
---|
8 | @node User Extensions Manager, User Extensions Manager Introduction, Heterogeneous Systems, Top |
---|
9 | @end ifinfo |
---|
10 | @chapter User Extensions Manager |
---|
11 | @ifinfo |
---|
12 | @menu |
---|
13 | * User Extensions Manager Introduction:: |
---|
14 | * User Extensions Manager Background:: |
---|
15 | * User Extensions Manager Operations:: |
---|
16 | * User Extensions Manager Directives:: |
---|
17 | @end menu |
---|
18 | @end ifinfo |
---|
19 | |
---|
20 | @ifinfo |
---|
21 | @node User Extensions Manager Introduction, User Extensions Manager Background, User Extensions Manager, User Extensions Manager |
---|
22 | @end ifinfo |
---|
23 | @section Introduction |
---|
24 | |
---|
25 | The RTEMS User Extensions Manager allows the |
---|
26 | application developer to augment the executive by allowing them |
---|
27 | to supply extension routines which are invoked at critical |
---|
28 | system events. The directives provided by the user extensions |
---|
29 | manager are: |
---|
30 | |
---|
31 | @itemize @bullet |
---|
32 | @item @code{extension_create} - Create an extension set |
---|
33 | @item @code{extension_ident} - Get ID of an extension set |
---|
34 | @item @code{extension_delete} - Delete an extension set |
---|
35 | @end itemize |
---|
36 | |
---|
37 | @ifinfo |
---|
38 | @node User Extensions Manager Background, Extension Sets, User Extensions Manager Introduction, User Extensions Manager |
---|
39 | @end ifinfo |
---|
40 | @section Background |
---|
41 | @ifinfo |
---|
42 | @menu |
---|
43 | * Extension Sets:: |
---|
44 | * TCB Extension Area:: |
---|
45 | * Extensions:: |
---|
46 | * TASK_CREATE Extension:: |
---|
47 | * TASK_START Extension:: |
---|
48 | * TASK_RESTART Extension:: |
---|
49 | * TASK_DELETE Extension:: |
---|
50 | * TASK_SWITCH Extension:: |
---|
51 | * TASK_POST_SWITCH Extension:: |
---|
52 | * TASK_BEGIN Extension:: |
---|
53 | * TASK_EXITTED Extension:: |
---|
54 | * FATAL Error Extension:: |
---|
55 | * Order of Invocation:: |
---|
56 | @end menu |
---|
57 | @end ifinfo |
---|
58 | |
---|
59 | User extension routines are invoked when the |
---|
60 | following system events occur: |
---|
61 | |
---|
62 | @itemize @bullet |
---|
63 | @item Task creation |
---|
64 | @item Task initiation |
---|
65 | @item Task reinitiation |
---|
66 | @item Task deletion |
---|
67 | @item Task context switch |
---|
68 | @item Post task context switch |
---|
69 | @item Task begin |
---|
70 | @item Task exits |
---|
71 | @item Fatal error detection |
---|
72 | @end itemize |
---|
73 | |
---|
74 | These extensions are invoked as a function with |
---|
75 | arguments that are appropriate to the system event. |
---|
76 | |
---|
77 | @ifinfo |
---|
78 | @node Extension Sets, TCB Extension Area, User Extensions Manager Background, User Extensions Manager Background |
---|
79 | @end ifinfo |
---|
80 | @subsection Extension Sets |
---|
81 | |
---|
82 | An extension set is defined as a set of routines |
---|
83 | which are invoked at each of the critical system events at which |
---|
84 | user extension routines are invoked. Together a set of these |
---|
85 | routines typically perform a specific functionality such as |
---|
86 | performance monitoring or debugger support. RTEMS is informed of |
---|
87 | the entry points which constitute an extension set via the |
---|
88 | following structure: |
---|
89 | |
---|
90 | @ifset is-C |
---|
91 | @example |
---|
92 | @group |
---|
93 | typedef struct @{ |
---|
94 | User_extensions_thread_create_extension thread_create; |
---|
95 | User_extensions_thread_start_extension thread_start; |
---|
96 | User_extensions_thread_restart_extension thread_restart; |
---|
97 | User_extensions_thread_delete_extension thread_delete; |
---|
98 | User_extensions_thread_switch_extension thread_switch; |
---|
99 | User_extensions_thread_post_switch_extension thread_post_switch; |
---|
100 | User_extensions_thread_begin_extension thread_begin; |
---|
101 | User_extensions_thread_exitted_extension thread_exitted; |
---|
102 | User_extensions_fatal_error_extension fatal; |
---|
103 | @} User_extensions_Table; |
---|
104 | @end group |
---|
105 | @end example |
---|
106 | @end ifset |
---|
107 | |
---|
108 | @ifset is-Ada |
---|
109 | @example |
---|
110 | type Extensions_Table is |
---|
111 | record |
---|
112 | Task_Create : RTEMS.Task_Create_Extension; |
---|
113 | Task_Start : RTEMS.Task_Start_Extension; |
---|
114 | Task_Restart : RTEMS.Task_Restart_Extension; |
---|
115 | Task_Delete : RTEMS.Task_Delete_Extension; |
---|
116 | Task_Switch : RTEMS.Task_Switch_Extension; |
---|
117 | Task_Post_Switch : RTEMS.Task_Post_Switch_Extension; |
---|
118 | Task_Begin : RTEMS.Task_Begin_Extension; |
---|
119 | Task_Exitted : RTEMS.Task_Exitted_Extension; |
---|
120 | Fatal : RTEMS.Fatal_Error_Extension; |
---|
121 | end record; |
---|
122 | @end example |
---|
123 | @end ifset |
---|
124 | |
---|
125 | |
---|
126 | RTEMS allows the user to have multiple extension sets |
---|
127 | active at the same time. First, a single static extension set |
---|
128 | may be defined as the application's User Extension Table which |
---|
129 | is included as part of the Configuration Table. This extension |
---|
130 | set is active for the entire life of the system and may not be |
---|
131 | deleted. This extension set is especially important because it |
---|
132 | is the only way the application can provided a FATAL error |
---|
133 | extension which is invoked if RTEMS fails during the |
---|
134 | initialize_executive directive. The static extension set is |
---|
135 | optional and may be configured as NULL if no static extension |
---|
136 | set is required. |
---|
137 | |
---|
138 | Second, the user can install dynamic extensions using |
---|
139 | the extension_create directive. These extensions are RTEMS |
---|
140 | objects in that they have a name, an ID, and can be dynamically |
---|
141 | created and deleted. In contrast to the static extension set, |
---|
142 | these extensions can only be created and installed after the |
---|
143 | initialize_executive directive successfully completes execution. |
---|
144 | Dynamic extensions are useful for encapsulating the |
---|
145 | functionality of an extension set. For example, the application |
---|
146 | could use extensions to manage a special coprocessor, do |
---|
147 | performance monitoring, and to do stack bounds checking. Each |
---|
148 | of these extension sets could be written and installed |
---|
149 | independently of the others. |
---|
150 | |
---|
151 | All user extensions are optional and RTEMS places no |
---|
152 | naming restrictions on the user. |
---|
153 | |
---|
154 | @ifinfo |
---|
155 | @node TCB Extension Area, Extensions, Extension Sets, User Extensions Manager Background |
---|
156 | @end ifinfo |
---|
157 | @subsection TCB Extension Area |
---|
158 | |
---|
159 | RTEMS provides for a pointer to a user-defined data |
---|
160 | area for each extension set to be linked to each task's control |
---|
161 | block. This set of pointers is an extension of the TCB and can |
---|
162 | be used to store additional data required by the user's |
---|
163 | extension functions. It is also possible for a user extension |
---|
164 | to utilize the notepad locations associated with each task |
---|
165 | although this may conflict with application usage of those |
---|
166 | particular notepads. |
---|
167 | |
---|
168 | The TCB extension is an array of pointers in the TCB. |
---|
169 | The number of pointers in the area is the same as the number of |
---|
170 | user extension sets configured. This allows an application to |
---|
171 | augment the TCB with user-defined information. For example, an |
---|
172 | application could implement task profiling by storing timing |
---|
173 | statistics in the TCB's extended memory area. When a task |
---|
174 | context switch is being executed, the TASK_SWITCH extension |
---|
175 | could read a real-time clock to calculate how long the task |
---|
176 | being swapped out has run as well as timestamp the starting time |
---|
177 | for the task being swapped in. |
---|
178 | |
---|
179 | If used, the extended memory area for the TCB should |
---|
180 | be allocated and the TCB extension pointer should be set at the |
---|
181 | time the task is created or started by either the TASK_CREATE or |
---|
182 | TASK_START extension. The application is responsible for |
---|
183 | managing this extended memory area for the TCBs. The memory may |
---|
184 | be reinitialized by the TASK_RESTART extension and should be |
---|
185 | deallocated by the TASK_DELETE extension when the task is |
---|
186 | deleted. Since the TCB extension buffers would most likely be |
---|
187 | of a fixed size, the RTEMS partition manager could be used to |
---|
188 | manage the application's extended memory area. The application |
---|
189 | could create a partition of fixed size TCB extension buffers and |
---|
190 | use the partition manager's allocation and deallocation |
---|
191 | directives to obtain and release the extension buffers. |
---|
192 | |
---|
193 | @ifinfo |
---|
194 | @node Extensions, TASK_CREATE Extension, TCB Extension Area, User Extensions Manager Background |
---|
195 | @end ifinfo |
---|
196 | @subsection Extensions |
---|
197 | |
---|
198 | The sections that follow will contain a description |
---|
199 | of each extension. Each section will contain a prototype of a |
---|
200 | function with the appropriate calling sequence for the |
---|
201 | corresponding extension. The names given for the @value{LANGUAGE} |
---|
202 | @value{ROUTINE} and |
---|
203 | its arguments are all defined by the user. The names used in |
---|
204 | the examples were arbitrarily chosen and impose no naming |
---|
205 | conventions on the user. |
---|
206 | |
---|
207 | @ifinfo |
---|
208 | @node TASK_CREATE Extension, TASK_START Extension, Extensions, User Extensions Manager Background |
---|
209 | @end ifinfo |
---|
210 | @subsection TASK_CREATE Extension |
---|
211 | |
---|
212 | The TASK_CREATE extension directly corresponds to the |
---|
213 | task_create directive. If this extension is defined in any |
---|
214 | static or dynamic extension set and a task is being created, |
---|
215 | then the extension routine will automatically be invoked by |
---|
216 | RTEMS. The extension should have a prototype similar to the |
---|
217 | following: |
---|
218 | |
---|
219 | @ifset is-C |
---|
220 | @example |
---|
221 | rtems_extension user_task_create( |
---|
222 | rtems_tcb *current_task, |
---|
223 | rtems_tcb *new_task |
---|
224 | ); |
---|
225 | @end example |
---|
226 | @end ifset |
---|
227 | |
---|
228 | @ifset is-Ada |
---|
229 | @example |
---|
230 | procedure User_Task_Create ( |
---|
231 | Current_Task : in RTEMS.TCB_Pointer; |
---|
232 | New_Task : in RTEMS.TCB_Pointer |
---|
233 | ); |
---|
234 | @end example |
---|
235 | @end ifset |
---|
236 | |
---|
237 | where current_task can be used to access the TCB for |
---|
238 | the currently executing task, and new_task can be used to access |
---|
239 | the TCB for the new task being created. This extension is |
---|
240 | invoked from the task_create directive after new_task has been |
---|
241 | completely initialized, but before it is placed on a ready TCB |
---|
242 | chain. |
---|
243 | |
---|
244 | @ifinfo |
---|
245 | @node TASK_START Extension, TASK_RESTART Extension, TASK_CREATE Extension, User Extensions Manager Background |
---|
246 | @end ifinfo |
---|
247 | @subsection TASK_START Extension |
---|
248 | |
---|
249 | The TASK_START extension directly corresponds to the |
---|
250 | task_start directive. If this extension is defined in any |
---|
251 | static or dynamic extension set and a task is being started, |
---|
252 | then the extension routine will automatically be invoked by |
---|
253 | RTEMS. The extension should have a prototype similar to the |
---|
254 | following: |
---|
255 | |
---|
256 | @ifset is-C |
---|
257 | @example |
---|
258 | rtems_extension user_task_start( |
---|
259 | rtems_tcb *current_task, |
---|
260 | rtems_tcb *started_task |
---|
261 | ); |
---|
262 | @end example |
---|
263 | @end ifset |
---|
264 | |
---|
265 | @ifset is-Ada |
---|
266 | @example |
---|
267 | procedure User_Task_Start ( |
---|
268 | Current_Task : in RTEMS.TCB_Pointer; |
---|
269 | Started_Task : in RTEMS.TCB_Pointer |
---|
270 | ); |
---|
271 | @end example |
---|
272 | @end ifset |
---|
273 | |
---|
274 | where current_task can be used to access the TCB for |
---|
275 | the currently executing task, and started_task can be used to |
---|
276 | access the TCB for the dormant task being started. This |
---|
277 | extension is invoked from the task_start directive after |
---|
278 | started_task has been made ready to start execution, but before |
---|
279 | it is placed on a ready TCB chain. |
---|
280 | |
---|
281 | @ifinfo |
---|
282 | @node TASK_RESTART Extension, TASK_DELETE Extension, TASK_START Extension, User Extensions Manager Background |
---|
283 | @end ifinfo |
---|
284 | @subsection TASK_RESTART Extension |
---|
285 | |
---|
286 | The TASK_RESTART extension directly corresponds to |
---|
287 | the task_restart directive. If this extension is defined in any |
---|
288 | static or dynamic extension set and a task is being restarted, |
---|
289 | then the extension should have a prototype similar to the |
---|
290 | following: |
---|
291 | |
---|
292 | @ifset is-C |
---|
293 | @example |
---|
294 | rtems_extension user_task_restart( |
---|
295 | rtems_tcb *current_task, |
---|
296 | rtems_tcb *restarted_task |
---|
297 | ); |
---|
298 | @end example |
---|
299 | @end ifset |
---|
300 | |
---|
301 | @ifset is-Ada |
---|
302 | @example |
---|
303 | procedure User_Task_Restart ( |
---|
304 | Current_Task : in RTEMS.TCB_Pointer; |
---|
305 | Restarted_Task : in RTEMS.TCB_Pointer |
---|
306 | ); |
---|
307 | @end example |
---|
308 | @end ifset |
---|
309 | |
---|
310 | where current_task can be used to access the TCB for |
---|
311 | the currently executing task, and restarted_task can be used to |
---|
312 | access the TCB for the task being restarted. This extension is |
---|
313 | invoked from the task_restart directive after restarted_task has |
---|
314 | been made ready to start execution, but before it is placed on a |
---|
315 | ready TCB chain. |
---|
316 | |
---|
317 | @ifinfo |
---|
318 | @node TASK_DELETE Extension, TASK_SWITCH Extension, TASK_RESTART Extension, User Extensions Manager Background |
---|
319 | @end ifinfo |
---|
320 | @subsection TASK_DELETE Extension |
---|
321 | |
---|
322 | The TASK_DELETE extension is associated with the |
---|
323 | task_delete directive. If this extension is defined in any |
---|
324 | static or dynamic extension set and a task is being deleted, |
---|
325 | then the extension routine will automatically be invoked by |
---|
326 | RTEMS. The extension should have a prototype similar to the |
---|
327 | following: |
---|
328 | |
---|
329 | @ifset is-C |
---|
330 | @example |
---|
331 | rtems_extension user_task_delete( |
---|
332 | rtems_tcb *current_task, |
---|
333 | rtems_tcb *deleted_task |
---|
334 | ); |
---|
335 | @end example |
---|
336 | @end ifset |
---|
337 | |
---|
338 | @ifset is-Ada |
---|
339 | @example |
---|
340 | procedure User_Task_Delete ( |
---|
341 | Current_Task : in RTEMS.TCB_Pointer; |
---|
342 | Deleted_Task : in RTEMS.TCB_Pointer |
---|
343 | ); |
---|
344 | @end example |
---|
345 | @end ifset |
---|
346 | |
---|
347 | where current_task can be used to access the TCB for |
---|
348 | the currently executing task, and deleted_task can be used to |
---|
349 | access the TCB for the task being deleted. This extension is |
---|
350 | invoked from the task_delete directive after the TCB has been |
---|
351 | removed from a ready TCB chain, but before all its resources |
---|
352 | including the TCB have been returned to their respective free |
---|
353 | pools. This extension should not call any RTEMS directives if a |
---|
354 | task is deleting itself (current_task is equal to deleted_task). |
---|
355 | |
---|
356 | @ifinfo |
---|
357 | @node TASK_SWITCH Extension, TASK_POST_SWITCH Extension, TASK_DELETE Extension, User Extensions Manager Background |
---|
358 | @end ifinfo |
---|
359 | @subsection TASK_SWITCH Extension |
---|
360 | |
---|
361 | The TASK_SWITCH extension corresponds to a task |
---|
362 | context switch. If this extension is defined in any static or |
---|
363 | dynamic extension set and a task context switch is in progress, |
---|
364 | then the extension routine will automatically be invoked by |
---|
365 | RTEMS. The extension should have a prototype similar to the |
---|
366 | following: |
---|
367 | |
---|
368 | @ifset is-C |
---|
369 | @example |
---|
370 | rtems_extension user_task_switch( |
---|
371 | rtems_tcb *current_task, |
---|
372 | rtems_tcb *heir_task |
---|
373 | ); |
---|
374 | @end example |
---|
375 | @end ifset |
---|
376 | |
---|
377 | @ifset is-Ada |
---|
378 | @example |
---|
379 | procedure User_Task_Switch ( |
---|
380 | Current_Task : in RTEMS.TCB_Pointer; |
---|
381 | Heir_Task : in RTEMS.TCB_Pointer |
---|
382 | ); |
---|
383 | @end example |
---|
384 | @end ifset |
---|
385 | |
---|
386 | where current_task can be used to access the TCB for |
---|
387 | the task that is being swapped out, and heir_task can be used to |
---|
388 | access the TCB for the task being swapped in. This extension is |
---|
389 | invoked from RTEMS' dispatcher routine after the current_task |
---|
390 | context has been saved, but before the heir_task context has |
---|
391 | been restored. This extension should not call any RTEMS |
---|
392 | directives. |
---|
393 | |
---|
394 | @ifinfo |
---|
395 | @node TASK_POST_SWITCH Extension, TASK_BEGIN Extension, TASK_SWITCH Extension, User Extensions Manager Background |
---|
396 | @end ifinfo |
---|
397 | @subsection TASK_POST_SWITCH Extension |
---|
398 | |
---|
399 | The TASK_POST_SWITCH extension corresponds to a task |
---|
400 | context switch. If this extension is defined in any static or |
---|
401 | dynamic extension set and a raw task context switch has been |
---|
402 | completed, then the extension routine will automatically be |
---|
403 | invoked by RTEMS. The extension should have a prototype similar |
---|
404 | to the following: |
---|
405 | |
---|
406 | @ifset is-C |
---|
407 | @example |
---|
408 | rtems_extension user_task_post_switch( |
---|
409 | rtems_tcb *current_task |
---|
410 | ); |
---|
411 | @end example |
---|
412 | @end ifset |
---|
413 | |
---|
414 | @ifset is-Ada |
---|
415 | @example |
---|
416 | procedure User_Task_Post_Switch ( |
---|
417 | Current_Task : in RTEMS.TCB_Pointer |
---|
418 | ); |
---|
419 | @end example |
---|
420 | @end ifset |
---|
421 | |
---|
422 | where current_task can be used to access the TCB for |
---|
423 | the task that is being swapped out, and heir_task can be used to |
---|
424 | access the TCB for the task being swapped in. This extension is |
---|
425 | invoked from RTEMS' dispatcher routine after the current_task |
---|
426 | context has been restored and the extension runs in the context |
---|
427 | of the current_task. |
---|
428 | |
---|
429 | @ifinfo |
---|
430 | @node TASK_BEGIN Extension, TASK_EXITTED Extension, TASK_POST_SWITCH Extension, User Extensions Manager Background |
---|
431 | @end ifinfo |
---|
432 | @subsection TASK_BEGIN Extension |
---|
433 | |
---|
434 | The TASK_BEGIN extension is invoked when a task |
---|
435 | begins execution. It is invoked immediately before the body of |
---|
436 | the starting procedure and executes in the context in the task. |
---|
437 | This user extension have a prototype similar to the following: |
---|
438 | |
---|
439 | @ifset is-C |
---|
440 | @example |
---|
441 | rtems_extension user_task_begin( |
---|
442 | rtems_tcb *current_task |
---|
443 | ); |
---|
444 | @end example |
---|
445 | @end ifset |
---|
446 | |
---|
447 | @ifset is-Ada |
---|
448 | @example |
---|
449 | procedure User_Task_Begin ( |
---|
450 | Current_Task : in RTEMS.TCB_Pointer |
---|
451 | ); |
---|
452 | @end example |
---|
453 | @end ifset |
---|
454 | |
---|
455 | where current_task can be used to access the TCB for |
---|
456 | the currently executing task which has begun. The distinction |
---|
457 | between the TASK_BEGIN and TASK_START extension is that the |
---|
458 | TASK_BEGIN extension is executed in the context of the actual |
---|
459 | task while the TASK_START extension is executed in the context |
---|
460 | of the task performing the task_start directive. For most |
---|
461 | extensions, this is not a critical distinction. |
---|
462 | |
---|
463 | @ifinfo |
---|
464 | @node TASK_EXITTED Extension, FATAL Error Extension, TASK_BEGIN Extension, User Extensions Manager Background |
---|
465 | @end ifinfo |
---|
466 | @subsection TASK_EXITTED Extension |
---|
467 | |
---|
468 | The TASK_EXITTED extension is invoked when a task |
---|
469 | exits the body of the starting procedure by either an implicit |
---|
470 | or explicit return statement. This user extension have a |
---|
471 | prototype similar to the following: |
---|
472 | |
---|
473 | @ifset is-C |
---|
474 | @example |
---|
475 | rtems_extension user_task_exitted( |
---|
476 | rtems_tcb *current_task |
---|
477 | ); |
---|
478 | @end example |
---|
479 | @end ifset |
---|
480 | |
---|
481 | @ifset is-Ada |
---|
482 | @example |
---|
483 | procedure User_Task_Exitted ( |
---|
484 | Current_Task : in RTEMS.TCB_Pointer |
---|
485 | ); |
---|
486 | @end example |
---|
487 | @end ifset |
---|
488 | |
---|
489 | where current_task can be used to access the TCB for |
---|
490 | the currently executing task which has just exitted. |
---|
491 | |
---|
492 | Although exiting of task is often considered to be a |
---|
493 | fatal error, this extension allows recovery by either restarting |
---|
494 | or deleting the exiting task. If the user does not wish to |
---|
495 | recover, then a fatal error may be reported. If the user does |
---|
496 | not provide a TASK_EXITTED extension or the provided handler |
---|
497 | returns control to RTEMS, then the RTEMS default handler will be |
---|
498 | used. This default handler invokes the directive |
---|
499 | fatal_error_occurred with the @code{TASK_EXITTED} directive status. |
---|
500 | |
---|
501 | @lowersections |
---|
502 | |
---|
503 | @ifinfo |
---|
504 | @node FATAL Error Extension, Order of Invocation, TASK_EXITTED Extension, User Extensions Manager Background |
---|
505 | @end ifinfo |
---|
506 | @subsection FATAL Error Extension |
---|
507 | |
---|
508 | The FATAL error extension is associated with the |
---|
509 | fatal_error_occurred directive. If this extension is defined in |
---|
510 | any static or dynamic extension set and the fatal_error_occurred |
---|
511 | directive has been invoked, then this extension will be called. |
---|
512 | This extension should have a prototype similar to the following: |
---|
513 | |
---|
514 | @ifset is-C |
---|
515 | @example |
---|
516 | rtems_extension user_fatal_error( |
---|
517 | Internal_errors_Source the_source, |
---|
518 | rtems_boolean is_internal, |
---|
519 | rtems_unsigned32 the_error |
---|
520 | ); |
---|
521 | @end example |
---|
522 | @end ifset |
---|
523 | |
---|
524 | @ifset is-Ada |
---|
525 | @example |
---|
526 | procedure User_Fatal_Error ( |
---|
527 | Error : in RTEMS.Unsigned32 |
---|
528 | ); |
---|
529 | @end example |
---|
530 | @end ifset |
---|
531 | |
---|
532 | where the_error is the error code passed to the |
---|
533 | fatal_error_occurred directive. This extension is invoked from |
---|
534 | the fatal_error_occurred directive. |
---|
535 | |
---|
536 | If defined, the user's FATAL error extension is |
---|
537 | invoked before RTEMS' default fatal error routine is invoked and |
---|
538 | the processor is stopped. For example, this extension could be |
---|
539 | used to pass control to a debugger when a fatal error occurs. |
---|
540 | This extension should not call any RTEMS directives. |
---|
541 | |
---|
542 | @raisesections |
---|
543 | |
---|
544 | @ifinfo |
---|
545 | @node Order of Invocation, User Extensions Manager Operations, FATAL Error Extension, User Extensions Manager Background |
---|
546 | @end ifinfo |
---|
547 | @subsection Order of Invocation |
---|
548 | |
---|
549 | When one of the critical system events occur, the |
---|
550 | user extensions are invoked in either "forward" or "reverse" |
---|
551 | order. Forward order indicates that the static extension set is |
---|
552 | invoked followed by the dynamic extension sets in the order in |
---|
553 | which they were created. Reverse order means that the dynamic |
---|
554 | extension sets are invoked in the opposite of the order in which |
---|
555 | they were created followed by the static extension set. By |
---|
556 | invoking the extension sets in this order, extensions can be |
---|
557 | built upon one another. At the following system events, the |
---|
558 | extensions are invoked in forward order: |
---|
559 | |
---|
560 | @itemize @bullet |
---|
561 | @item Task creation |
---|
562 | @item Task initiation |
---|
563 | @item Task reinitiation |
---|
564 | @item Task deletion |
---|
565 | @item Task context switch |
---|
566 | @item Post task context switch |
---|
567 | @item Task begins to execute |
---|
568 | @end itemize |
---|
569 | |
---|
570 | |
---|
571 | At the following system events, the extensions are |
---|
572 | invoked in reverse order: |
---|
573 | |
---|
574 | @itemize @bullet |
---|
575 | @item Task deletion |
---|
576 | @item Fatal error detection |
---|
577 | @end itemize |
---|
578 | |
---|
579 | At these system events, the extensions are invoked in |
---|
580 | reverse order to insure that if an extension set is built upon |
---|
581 | another, the more complicated extension is invoked before the |
---|
582 | extension set it is built upon. For example, by invoking the |
---|
583 | static extension set last it is known that the "system" fatal |
---|
584 | error extension will be the last fatal error extension executed. |
---|
585 | Another example is use of the task delete extension by the |
---|
586 | Standard C Library. Extension sets which are installed after |
---|
587 | the Standard C Library will operate correctly even if they |
---|
588 | utilize the C Library because the C Library's TASK_DELETE |
---|
589 | extension is invoked after that of the other extensions. |
---|
590 | |
---|
591 | @ifinfo |
---|
592 | @node User Extensions Manager Operations, Creating an Extension Set, Order of Invocation, User Extensions Manager |
---|
593 | @end ifinfo |
---|
594 | @section Operations |
---|
595 | @ifinfo |
---|
596 | @menu |
---|
597 | * Creating an Extension Set:: |
---|
598 | * Obtaining Extension Set IDs:: |
---|
599 | * Deleting an Extension Set:: |
---|
600 | @end menu |
---|
601 | @end ifinfo |
---|
602 | |
---|
603 | @ifinfo |
---|
604 | @node Creating an Extension Set, Obtaining Extension Set IDs, User Extensions Manager Operations, User Extensions Manager Operations |
---|
605 | @end ifinfo |
---|
606 | @subsection Creating an Extension Set |
---|
607 | |
---|
608 | The extension_create directive creates and installs |
---|
609 | an extension set by allocating a Extension Set Control Block |
---|
610 | (ESCB), assigning the extension set a user-specified name, and |
---|
611 | assigning it an extension set ID. Newly created extension sets |
---|
612 | are immediately installed and are invoked upon the next system |
---|
613 | even supporting an extension. |
---|
614 | |
---|
615 | @ifinfo |
---|
616 | @node Obtaining Extension Set IDs, Deleting an Extension Set, Creating an Extension Set, User Extensions Manager Operations |
---|
617 | @end ifinfo |
---|
618 | @subsection Obtaining Extension Set IDs |
---|
619 | |
---|
620 | When an extension set is created, RTEMS generates a |
---|
621 | unique extension set ID and assigns it to the created extension |
---|
622 | set until it is deleted. The extension ID may be obtained by |
---|
623 | either of two methods. First, as the result of an invocation of |
---|
624 | the extension_create directive, the extension set ID is stored |
---|
625 | in a user provided location. Second, the extension set ID may |
---|
626 | be obtained later using the extension_ident directive. The |
---|
627 | extension set ID is used by other directives to manipulate this |
---|
628 | extension set. |
---|
629 | |
---|
630 | @ifinfo |
---|
631 | @node Deleting an Extension Set, User Extensions Manager Directives, Obtaining Extension Set IDs, User Extensions Manager Operations |
---|
632 | @end ifinfo |
---|
633 | @subsection Deleting an Extension Set |
---|
634 | |
---|
635 | The extension_delete directive is used to delete an |
---|
636 | extension set. The extension set's control block is returned to |
---|
637 | the ESCB free list when it is deleted. An extension set can be |
---|
638 | deleted by a task other than the task which created the |
---|
639 | extension set. Any subsequent references to the extension's |
---|
640 | name and ID are invalid. |
---|
641 | |
---|
642 | @ifinfo |
---|
643 | @node User Extensions Manager Directives, EXTENSION_CREATE - Create a extension set, Deleting an Extension Set, User Extensions Manager |
---|
644 | @end ifinfo |
---|
645 | @section Directives |
---|
646 | @ifinfo |
---|
647 | @menu |
---|
648 | * EXTENSION_CREATE - Create a extension set:: |
---|
649 | * EXTENSION_IDENT - Get ID of a extension set:: |
---|
650 | * EXTENSION_DELETE - Delete a extension set:: |
---|
651 | @end menu |
---|
652 | @end ifinfo |
---|
653 | |
---|
654 | This section details the user extension manager's |
---|
655 | directives. A subsection is dedicated to each of this manager's |
---|
656 | directives and describes the calling sequence, related |
---|
657 | constants, usage, and status codes. |
---|
658 | |
---|
659 | @page |
---|
660 | @ifinfo |
---|
661 | @node EXTENSION_CREATE - Create a extension set, EXTENSION_IDENT - Get ID of a extension set, User Extensions Manager Directives, User Extensions Manager Directives |
---|
662 | @end ifinfo |
---|
663 | @subsection EXTENSION_CREATE - Create a extension set |
---|
664 | |
---|
665 | @subheading CALLING SEQUENCE: |
---|
666 | |
---|
667 | @ifset is-C |
---|
668 | @example |
---|
669 | rtems_status_code rtems_extension_create( |
---|
670 | rtems_name name, |
---|
671 | rtems_extensions_table *table, |
---|
672 | rtems_id *id |
---|
673 | ); |
---|
674 | @end example |
---|
675 | @end ifset |
---|
676 | |
---|
677 | @ifset is-Ada |
---|
678 | @example |
---|
679 | procedure Extension_Create ( |
---|
680 | Name : in RTEMS.Name; |
---|
681 | Table : in RTEMS.Extensions_Table_Pointer; |
---|
682 | ID : out RTEMS.ID; |
---|
683 | Result : out RTEMS.Status_Codes |
---|
684 | ); |
---|
685 | @end example |
---|
686 | @end ifset |
---|
687 | |
---|
688 | @subheading DIRECTIVE STATUS CODES: |
---|
689 | @code{SUCCESSFUL} - extension set created successfully@* |
---|
690 | @code{INVALID_NAME} - invalid extension set name@* |
---|
691 | @code{TOO_MANY} - too many extension sets created |
---|
692 | |
---|
693 | @subheading DESCRIPTION: |
---|
694 | |
---|
695 | This directive creates a extension set. The assigned |
---|
696 | extension set id is returned in id. This id is used to access |
---|
697 | the extension set with other user extension manager directives. |
---|
698 | For control and maintenance of the extension set, RTEMS |
---|
699 | allocates an ESCB from the local ESCB free pool and initializes |
---|
700 | it. |
---|
701 | |
---|
702 | @subheading NOTES: |
---|
703 | |
---|
704 | This directive will not cause the calling task to be |
---|
705 | preempted. |
---|
706 | |
---|
707 | @page |
---|
708 | @ifinfo |
---|
709 | @node EXTENSION_IDENT - Get ID of a extension set, EXTENSION_DELETE - Delete a extension set, EXTENSION_CREATE - Create a extension set, User Extensions Manager Directives |
---|
710 | @end ifinfo |
---|
711 | @subsection EXTENSION_IDENT - Get ID of a extension set |
---|
712 | |
---|
713 | @subheading CALLING SEQUENCE: |
---|
714 | |
---|
715 | @ifset is-C |
---|
716 | @example |
---|
717 | rtems_status_code rtems_extension_ident( |
---|
718 | rtems_name name, |
---|
719 | rtems_id *id |
---|
720 | ); |
---|
721 | @end example |
---|
722 | @end ifset |
---|
723 | |
---|
724 | @ifset is-Ada |
---|
725 | @example |
---|
726 | procedure Extension_Ident ( |
---|
727 | Name : in RTEMS.Name; |
---|
728 | ID : out RTEMS.ID; |
---|
729 | Result : out RTEMS.Status_Codes |
---|
730 | ); |
---|
731 | @end example |
---|
732 | @end ifset |
---|
733 | |
---|
734 | @subheading DIRECTIVE STATUS CODES: |
---|
735 | @code{SUCCESSFUL} - extension set identified successfully@* |
---|
736 | @code{INVALID_NAME} - extension set name not found |
---|
737 | |
---|
738 | @subheading DESCRIPTION: |
---|
739 | |
---|
740 | This directive obtains the extension set id |
---|
741 | associated with the extension set name to be acquired. If the |
---|
742 | extension set name is not unique, then the extension set id will |
---|
743 | match one of the extension sets with that name. However, this |
---|
744 | extension set id is not guaranteed to correspond to the desired |
---|
745 | extension set. The extension set id is used to access this |
---|
746 | extension set in other extension set related directives. |
---|
747 | |
---|
748 | @subheading NOTES: |
---|
749 | |
---|
750 | This directive will not cause the running task to be |
---|
751 | preempted. |
---|
752 | |
---|
753 | @page |
---|
754 | @ifinfo |
---|
755 | @node EXTENSION_DELETE - Delete a extension set, Configuring a System, EXTENSION_IDENT - Get ID of a extension set, User Extensions Manager Directives |
---|
756 | @end ifinfo |
---|
757 | @subsection EXTENSION_DELETE - Delete a extension set |
---|
758 | |
---|
759 | @subheading CALLING SEQUENCE: |
---|
760 | |
---|
761 | @ifset is-C |
---|
762 | @example |
---|
763 | rtems_status_code rtems_extension_delete( |
---|
764 | rtems_id id |
---|
765 | ); |
---|
766 | @end example |
---|
767 | @end ifset |
---|
768 | |
---|
769 | @ifset is-Ada |
---|
770 | @example |
---|
771 | procedure Extension_Delete ( |
---|
772 | ID : in RTEMS.ID; |
---|
773 | Result : out RTEMS.Status_Codes |
---|
774 | ); |
---|
775 | @end example |
---|
776 | @end ifset |
---|
777 | |
---|
778 | @subheading DIRECTIVE STATUS CODES: |
---|
779 | @code{SUCCESSFUL} - extension set deleted successfully@* |
---|
780 | @code{INVALID_ID} - invalid extension set id |
---|
781 | |
---|
782 | @subheading DESCRIPTION: |
---|
783 | |
---|
784 | This directive deletes the extension set specified by |
---|
785 | id. If the extension set is running, it is automatically |
---|
786 | canceled. The ESCB for the deleted extension set is reclaimed |
---|
787 | by RTEMS. |
---|
788 | |
---|
789 | @subheading NOTES: |
---|
790 | |
---|
791 | This directive will not cause the running task to be |
---|
792 | preempted. |
---|
793 | |
---|
794 | A extension set can be deleted by a task other than |
---|
795 | the task which created the extension set. |
---|
796 | |
---|
797 | @subheading NOTES: |
---|
798 | |
---|
799 | This directive will not cause the running task to be |
---|
800 | preempted. |
---|