RTEMS Logo

RTEMS 4.6.6 On-Line Library


Configuring a System User Extensions Table

PREV UP NEXT Bookshelf RTEMS C User's Guide

22.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 User_extensions_routine           rtems_extension;
typedef User_extensions_thread_create_extension
           rtems_task_create_extension;
typedef User_extensions_thread_delete_extension
           rtems_task_delete_extension;
typedef User_extensions_thread_start_extension
           rtems_task_start_extension;
typedef User_extensions_thread_restart_extension
           rtems_task_restart_extension;
typedef User_extensions_thread_switch_extension
           rtems_task_switch_extension;
typedef User_extensions_thread_begin_extension
           rtems_task_begin_extension;
typedef User_extensions_thread_exitted_extension
           rtems_task_exitted_extension;
typedef User_extensions_fatal_extension   rtems_fatal_extension;

typedef User_extensions_Table             rtems_extensions_table;

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;
} User_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 C User's Guide

Copyright © 1988-2004 OAR Corporation