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