The User Extensions Table is used to inform RTEMS of
the optional user-supplied static extension set. This table
contains one entry for each possible extension. The entries are
called at critical times in the life of the system and
individual tasks. The application may create dynamic extensions
in addition to this single static set. The format of each entry
in the User Extensions Table is defined in the following C structure:
is the address of the
user-supplied subroutine for the TASK_CREATE extension. If this
extension for task creation is defined, it is called from the
task_create directive. A value of NULL indicates that no
extension is provided.
thread_start
is the address of the user-supplied
subroutine for the TASK_START extension. If this extension for
task initiation is defined, it is called from the task_start
directive. A value of NULL indicates that no extension is
provided.
thread_restart
is the address of the user-supplied
subroutine for the TASK_RESTART extension. If this extension
for task re-initiation is defined, it is called from the
task_restart directive. A value of NULL indicates that no
extension is provided.
thread_delete
is the address of the user-supplied
subroutine for the TASK_DELETE extension. If this RTEMS
extension for task deletion is defined, it is called from the
task_delete directive. A value of NULL indicates that no
extension is provided.
thread_switch
is the address of the user-supplied
subroutine for the task context switch extension. This
subroutine is called from RTEMS dispatcher after the current
task has been swapped out but before the new task has been
swapped in. A value of NULL indicates that no extension is
provided. As this routine is invoked after saving the current
task's context and before restoring the heir task's context, it
is not necessary for this routine to save and restore any
registers.
thread_begin
is the address of the user-supplied
subroutine which is invoked immediately before a task begins
execution. It is invoked in the context of the beginning task.
A value of NULL indicates that no extension is provided.
thread_exitted
is the address of the user-supplied
subroutine which is invoked when a task exits. This procedure
is responsible for some action which will allow the system to
continue execution (i.e. delete or restart the task) or to
terminate with a fatal error. If this field is set to NULL, the
default RTEMS TASK_EXITTED handler will be invoked.
fatal
is the address of the user-supplied
subroutine for the FATAL extension. This RTEMS extension of
fatal error handling is called from the
rtems.fatal_error_occurred
directive. If the user's fatal error handler returns or if this
entry is NULL then the default RTEMS fatal error handler will be
executed.
A typical declaration for a User Extension Table
which defines the TASK_CREATE, TASK_DELETE, TASK_SWITCH, and
FATAL extension might appear as follows: