RTEMS Logo

RTEMS 4.9.2 On-Line Library


Configuring a System User Extensions Table

PREV UP NEXT Bookshelf RTEMS Ada User's Guide

23.9: User Extensions Table

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:

typedef void           rtems_extension;
typedef rtems_extension (*rtems_task_create_extension)(
   Thread_Control * /* executing */,
   Thread_Control * /* created */
);
typedef rtems_extension (*rtems_task_delete_extension)(
   Thread_Control * /* executing */,
   Thread_Control * /* deleted */
);
typedef rtems_extension (*rtems_task_start_extension)(
   Thread_Control * /* executing */,
   Thread_Control * /* started */
);
typedef rtems_extension (*rtems_task_restart_extension)(
   Thread_Control * /* executing */,
   Thread_Control * /* restarted */
);
typedef rtems_extension (*rtems_task_switch_extension)(
   Thread_Control * /* executing */,
   Thread_Control * /* heir */
);
typedef rtems_extension (*rtems_task_begin_extension)(
   Thread_Control * /* beginning */
);
typedef rtems_extension (*rtems_task_exitted_extension)(
   Thread_Control * /* exiting */
);
typedef rtems_extension (*rtems_fatal_extension)(
   Internal_errors_Source /* the_source */,
   bool                   /* is_internal */,
   uint32_t               /* the_error */
);

typedef struct {
  rtems_task_create_extension      thread_create;
  rtems_task_start_extension       thread_start;
  rtems_task_restart_extension     thread_restart;
  rtems_task_delete_extension      thread_delete;
  rtems_task_switch_extension      thread_switch;
  rtems_task_begin_extension       thread_begin;
  rtems_task_exitted_extension     thread_exitted;
  rtems_fatal_extension            fatal;
} rtems_extensions_table;
thread_create
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:

rtems_extensions_table User_extensions = {
   task_create_extension,
   NULL,
   NULL,
   task_delete_extension,
   task_switch_extension,
   NULL,
   NULL,
   fatal_extension
};

More information regarding the user extensions is provided in the User Extensions chapter.


PREV UP NEXT Bookshelf RTEMS Ada User's Guide

Copyright © 1988-2008 OAR Corporation