summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi/include/rtems
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/sapi/include/rtems')
-rw-r--r--cpukit/sapi/include/rtems/README133
-rw-r--r--cpukit/sapi/include/rtems/chain.h140
-rw-r--r--cpukit/sapi/include/rtems/config.h273
-rw-r--r--cpukit/sapi/include/rtems/extension.h259
-rw-r--r--cpukit/sapi/include/rtems/fatal.h53
-rw-r--r--cpukit/sapi/include/rtems/init.h100
-rw-r--r--cpukit/sapi/include/rtems/io.h204
-rw-r--r--cpukit/sapi/include/rtems/mptables.h28
-rw-r--r--cpukit/sapi/include/rtems/sptables.h75
9 files changed, 1265 insertions, 0 deletions
diff --git a/cpukit/sapi/include/rtems/README b/cpukit/sapi/include/rtems/README
new file mode 100644
index 0000000000..f29bdb45b7
--- /dev/null
+++ b/cpukit/sapi/include/rtems/README
@@ -0,0 +1,133 @@
+#
+# $Id$
+#
+
+Configuring a System Using the Template in confdefs.h
+=====================================================
+
+The file confdefs.h is a Configuration Template file which can be
+used to greatly simplify the creation and maintenance of RTEMS
+Configuration Tables. The basic concepts are:
+
+ + confdefs.h provides defaults for all configuration parameters
+
+ + applications specify only those values they wish to override
+
+ + confdefs.h can be the only file which knows the precise layout
+ of the RTEMS Configuration Tables.
+
+The Configuration Template setup is used by all RTEMS tests to
+simplify the maintenance of the tests.
+
+Here is the section from the system.h file from test tm21 from
+the Timing Test Suite:
+
+ /* configuration information */
+
+ #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+ #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
+
+ #define CONFIGURE_MAXIMUM_TASKS 102
+ #define CONFIGURE_MAXIMUM_TIMERS 100
+ #define CONFIGURE_MAXIMUM_SEMAPHORES 100
+ #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 100
+ #define CONFIGURE_MAXIMUM_PARTITIONS 100
+ #define CONFIGURE_MAXIMUM_REGIONS 100
+ #define CONFIGURE_MAXIMUM_PORTS 100
+ #define CONFIGURE_MAXIMUM_PERIODS 100
+
+ #define CONFIGURE_TICKS_PER_TIMESLICE 0
+
+ #include <confdefs.h>
+
+
+The above example overrides a number of the configuration parameters.
+It informs the template that it is a member of the Timing Suite,
+requires a console and timer driver, and that it needs 102 tasks,
+100 timers, 100 semaphores, 100 message queues, 100 partitions,
+100 regions, 100 ports, and 100 periods. By default, the test
+would have gotten no drivers, 10 tasks, and no other RTEMS objects.
+
+The following shows the configuration tables generated by the
+template by default.
+
+
+#include <bsp.h>
+
+#define NULL_DRIVER_TABLE_ENTRY \
+ { NULL, NULL, NULL, NULL, NULL, NULL }
+
+rtems_driver_address_table Device_drivers[] = {
+#ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+ CONSOLE_DRIVER_TABLE_ENTRY,
+#endif
+#ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+ CLOCK_DRIVER_TABLE_ENTRY,
+#endif
+#ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
+ STUB_DRIVER_TABLE_ENTRY,
+#endif
+ NULL_DRIVER_TABLE_ENTRY,
+};
+
+rtems_initialization_tasks_table Initialization_tasks[] = {
+ { rtems_build_name( 'U', 'I', '1', ' ' ), /* init task name */
+ RTEMS_MINIMUM_STACK_SIZE, /* init task stack size */
+ 1, /* init task priority */
+ RTEMS_DEFAULT_ATTRIBUTES, /* init task attributes */
+ Init, /* init task entry point */
+ RTEMS_NO_PREEMPT, /* init task initial mode */
+ 0 /* init task argument list */
+ }
+};
+
+#ifdef CONFIGURE_MP_APPLICATION
+/*
+ * NODE_NUMBER is assumed to be set on the compile line.
+ */
+
+rtems_multiprocessing_table Multiprocessing_configuration = {
+ NODE_NUMBER, /* local node number */
+ 2, /* maximum # nodes in system */
+ 32, /* maximum # global objects */
+ 32, /* maximum # proxies */
+ &MPCI_table /* pointer to MPCI config table */
+};
+#endif
+
+/*
+ * CONFIGURE_EXECUTIVE_RAM_SIZE is a rough guess based on the number of
+ * tasks in the system plus enough extra to get a whole 64K extra.
+ *
+ * The NULL address for the workspace area is assumed to be assigned
+ * at startup time by the BSP.
+ */
+
+rtems_configuration_table Configuration = {
+ NULL, /* executive RAM work area */
+ CONFIGURE_EXECUTIVE_RAM_SIZE, /* executive RAM size */
+ 10, /* maximum # tasks */
+ 0, /* maximum # timers */
+ 0, /* maximum # semaphores */
+ 0, /* maximum # message queues */
+ 0, /* maximum # messages */
+ 0, /* maximum # partitions */
+ 0, /* maximum # regions */
+ 0, /* maximum # dp memory areas */
+ 0, /* maximum # periods */
+ 0, /* maximum # user extensions */
+ RTEMS_MILLISECONDS_TO_MICROSECONDS(10), /* # us in a tick */
+ 50, /* # ticks in a timeslice */
+ sizeof (Initialization_tasks) / sizeof(rtems_initialization_tasks_table),
+ /* number of init tasks */
+ Initialization_tasks, /* init task(s) table */
+ sizeof (Device_drivers) / sizeof(rtems_driver_address_table),
+ /* number of device drivers */
+ Device_drivers, /* pointer to driver address table */
+ NULL, /* pointer to initial extensions */
+#ifdef CONFIGURE_MP_APPLICATION
+ &Multiprocessing_configuration
+#else
+ NULL /* ptr to MP config table */
+#endif
+};
diff --git a/cpukit/sapi/include/rtems/chain.h b/cpukit/sapi/include/rtems/chain.h
new file mode 100644
index 0000000000..a80bb9c1e2
--- /dev/null
+++ b/cpukit/sapi/include/rtems/chain.h
@@ -0,0 +1,140 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicChains
+ *
+ * @brief Chain API.
+ */
+
+/*
+ * Copyright (c) 2010 embedded brains GmbH.
+ *
+ * COPYRIGHT (c) 1989-2008.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_CHAIN_H
+#define _RTEMS_CHAIN_H
+
+#include <rtems/system.h>
+#include <rtems/score/chain.h>
+#include <rtems/rtems/event.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup ClassicChains Chains
+ *
+ * @ingroup ClassicRTEMS
+ *
+ * @brief Chain API.
+ *
+ * @{
+ */
+
+typedef Chain_Node rtems_chain_node;
+
+typedef Chain_Control rtems_chain_control;
+
+/**
+ * @brief Chain initializer for an empty chain with designator @a name.
+ */
+#define RTEMS_CHAIN_INITIALIZER_EMPTY(name) \
+ CHAIN_INITIALIZER_EMPTY(name)
+
+/**
+ * @brief Chain definition for an empty chain with designator @a name.
+ */
+#define RTEMS_CHAIN_DEFINE_EMPTY(name) \
+ CHAIN_DEFINE_EMPTY(name)
+
+/** @} */
+
+#include <rtems/chain.inl>
+
+/**
+ * @addtogroup ClassicChains
+ *
+ * @{
+ */
+
+/**
+ * @brief Appends the @a node to the @a chain and sends the @a events to the
+ * @a task if the @a chain was empty before the append.
+ *
+ * @see rtems_chain_append_with_empty_check() and rtems_event_send().
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation.
+ * @retval RTEMS_INVALID_ID No such task.
+ */
+rtems_status_code rtems_chain_append_with_notification(
+ rtems_chain_control *chain,
+ rtems_chain_node *node,
+ rtems_id task,
+ rtems_event_set events
+);
+
+/**
+ * @brief Prepends the @a node to the @a chain and sends the @a events to the
+ * @a task if the @a chain was empty before the prepend.
+ *
+ * @see rtems_chain_prepend_with_empty_check() and rtems_event_send().
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation.
+ * @retval RTEMS_INVALID_ID No such task.
+ */
+rtems_status_code rtems_chain_prepend_with_notification(
+ rtems_chain_control *chain,
+ rtems_chain_node *node,
+ rtems_id task,
+ rtems_event_set events
+);
+
+/**
+ * @brief Gets the first @a node of the @a chain and sends the @a events to the
+ * @a task if the @a chain is empty after the get.
+ *
+ * @see rtems_chain_get_with_empty_check() and rtems_event_send().
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation.
+ * @retval RTEMS_INVALID_ID No such task.
+ */
+rtems_status_code rtems_chain_get_with_notification(
+ rtems_chain_control *chain,
+ rtems_id task,
+ rtems_event_set events,
+ rtems_chain_node **node
+);
+
+/**
+ * @brief Gets the first @a node of the @a chain and sends the @a events to the
+ * @a task if the @a chain is empty afterwards.
+ *
+ * @see rtems_chain_get() and rtems_event_receive().
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation.
+ * @retval RTEMS_TIMEOUT Timeout.
+ */
+rtems_status_code rtems_chain_get_with_wait(
+ rtems_chain_control *chain,
+ rtems_event_set events,
+ rtems_interval timeout,
+ rtems_chain_node **node
+);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h
new file mode 100644
index 0000000000..cdf33874d7
--- /dev/null
+++ b/cpukit/sapi/include/rtems/config.h
@@ -0,0 +1,273 @@
+/**
+ * @file rtems/config.h
+ */
+
+/*
+ * This include file contains the table of user defined configuration
+ * parameters.
+ *
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_CONFIG_H
+#define _RTEMS_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Unlimited object support. Changes the configuration table entry for POSIX
+ * or RTEMS APIs to bounded only by the memory of the work-space.
+ *
+ * Use the macro to define the resource unlimited before placing in
+ * the configuration table.
+ */
+
+#include <rtems/score/object.h>
+#define RTEMS_UNLIMITED_OBJECTS OBJECTS_UNLIMITED_OBJECTS
+
+#define rtems_resource_unlimited(resource) \
+ ( resource | RTEMS_UNLIMITED_OBJECTS )
+
+/*
+ * This is kind of kludgy but it allows targets to totally ignore the
+ * optional APIs like POSIX safely.
+ */
+
+#ifdef RTEMS_POSIX_API
+#include <rtems/posix/config.h>
+#else
+typedef void *posix_api_configuration_table;
+#endif
+
+#include <rtems/rtems/config.h>
+
+#include <rtems/extension.h>
+#include <rtems/io.h>
+#if defined(RTEMS_MULTIPROCESSING)
+#include <rtems/score/mpci.h>
+#endif
+
+#if defined(RTEMS_MULTIPROCESSING)
+/*
+ * The following records define the Multiprocessor Configuration
+ * Table. This table defines the multiprocessor system
+ * characteristics which must be known by RTEMS in a multiprocessor
+ * system.
+ */
+typedef struct {
+ /** This is the local node number. */
+ uint32_t node;
+ /** This is the maximum number of nodes in system. */
+ uint32_t maximum_nodes;
+ /** This is the maximum number of global objects. */
+ uint32_t maximum_global_objects;
+ /** This is the maximum number of proxies. */
+ uint32_t maximum_proxies;
+
+ /** The MPCI Receive server is assumed to have a stack of at least
+ * minimum stack size. This field specifies the amount of extra
+ * stack this task will be given in bytes.
+ */
+ uint32_t extra_mpci_receive_server_stack;
+
+ /** This is a pointer to User/BSP provided MPCI Table. */
+ rtems_mpci_table *User_mpci_table;
+} rtems_multiprocessing_table;
+#endif
+
+/*
+ * The following records define the Configuration Table. The
+ * information contained in this table is required in all
+ * RTEMS systems, whether single or multiprocessor. This
+ * table primarily defines the following:
+ *
+ * + location and size of the RTEMS Workspace
+ * + microseconds per clock tick
+ * + clock ticks per task timeslice
+ * + required number of each object type for each API configured
+ */
+typedef struct {
+ /** This field specifies the base address of the RTEMS Workspace.
+ */
+ void *work_space_start;
+
+ /** This field specifies the size in bytes of the RTEMS Workspace.
+ */
+ uintptr_t work_space_size;
+
+ /** This field specifies the maximum number of dynamically installed
+ * used extensions.
+ */
+ uint32_t maximum_extensions;
+
+ /** This field specifies the number of microseconds which elapse
+ * between clock ticks. This is the basis for RTEMS timing.
+ */
+ uint32_t microseconds_per_tick;
+
+ /** This field specifies the number of ticks in each task's timeslice.
+ */
+ uint32_t ticks_per_timeslice;
+
+ /** This element points to the BSP's optional idle task which may override
+ * the default one provided with RTEMS.
+ */
+ Thread (*idle_task)( uintptr_t );
+
+ /** This field specifies the size of the IDLE task's stack. If less than or
+ * equal to the minimum stack size, then the IDLE task will have the minimum
+ * stack size.
+ */
+ uint32_t idle_task_stack_size;
+
+ /** This field specifies the size of the interrupt stack. If less than or
+ * equal to the minimum stack size, then the interrupt stack will be of
+ * minimum stack size.
+ */
+ uint32_t interrupt_stack_size;
+
+ /** The BSP may want to provide it's own stack allocation routines.
+ * In this case, the BSP will provide this stack allocation hook.
+ */
+ void * (*stack_allocate_hook)( size_t );
+
+ /** The BSP may want to provide it's own stack free routines.
+ * In this case, the BSP will provide this stack free hook.
+ */
+ void (*stack_free_hook)( void *);
+
+ /** If this element is TRUE, then RTEMS will zero the Executive Workspace.
+ * When this element is FALSE, it is assumed that the BSP or invoking
+ * environment has ensured that memory was cleared before RTEMS was
+ * invoked.
+ */
+ bool do_zero_of_workspace;
+
+ uint32_t maximum_drivers;
+ uint32_t number_of_device_drivers;
+ rtems_driver_address_table *Device_driver_table;
+ uint32_t number_of_initial_extensions;
+ rtems_extensions_table *User_extension_table;
+ #if defined(RTEMS_MULTIPROCESSING)
+ rtems_multiprocessing_table *User_multiprocessing_table;
+ #endif
+} rtems_configuration_table;
+
+/**
+ * This is the configuration table generated by confdefs.h.
+ */
+extern rtems_configuration_table Configuration;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ /**
+ * This points to the multiprocessing configuration table.
+ */
+ SAPI_EXTERN rtems_multiprocessing_table *_Configuration_MP_table;
+#endif
+
+#if defined(RTEMS_MULTIPROCESSING)
+ /**
+ * @brief RTEMS Multiprocessing Configuration Table
+ *
+ * This is the RTEMS Multiprocessing Configuration Table expected to
+ * be generated by confdefs.h.
+ */
+ extern rtems_multiprocessing_table Multiprocessing_configuration;
+#endif
+
+
+/*
+ * Some handy macros to avoid dependencies on either the BSP
+ * or the exact format of the configuration table.
+ */
+
+#define rtems_configuration_get_table() \
+ (&Configuration)
+
+#define rtems_configuration_get_work_space_start() \
+ (Configuration.work_space_start)
+
+#define rtems_configuration_get_work_space_size() \
+ (Configuration.work_space_size)
+
+#define rtems_configuration_get_maximum_extensions() \
+ (Configuration.maximum_extensions)
+
+#define rtems_configuration_get_microseconds_per_tick() \
+ (Configuration.microseconds_per_tick)
+#define rtems_configuration_get_milliseconds_per_tick() \
+ (Configuration.microseconds_per_tick / 1000)
+#define rtems_configuration_get_nanoseconds_per_tick() \
+ (Configuration.microseconds_per_tick * 1000)
+
+#define rtems_configuration_get_ticks_per_timeslice() \
+ (Configuration.ticks_per_timeslice)
+
+#define rtems_configuration_get_idle_task() \
+ (Configuration.idle_task)
+
+#define rtems_configuration_get_idle_task_stack_size() \
+ (Configuration.idle_task_stack_size)
+
+/* XXX We need to get this from the generated table
+ * since BSPs need it before the pointer is set.
+ * Eventually all should be done this way.
+ */
+extern rtems_configuration_table Configuration;
+
+#define rtems_configuration_get_interrupt_stack_size() \
+ (Configuration.interrupt_stack_size)
+
+#define rtems_configuration_get_stack_allocate_hook() \
+ (Configuration.stack_allocate_hook)
+
+#define rtems_configuration_get_stack_free_hook() \
+ (Configuration.stack_free_hook)
+
+/**
+ * This macro assists in accessing the field which indicates whether
+ * RTEMS is responsible for zeroing the Executive Workspace.
+ */
+#define rtems_configuration_get_do_zero_of_workspace() \
+ (Configuration.do_zero_of_workspace)
+
+#define rtems_configuration_get_number_of_device_drivers() \
+ (Configuration.number_of_device_drivers)
+
+#define rtems_configuration_get_device_driver_table() \
+ (Configuration.Device_driver_table)
+
+#define rtems_configuration_get_number_of_initial_extensions() \
+ (Configuration.number_of_initial_extensions)
+
+#define rtems_configuration_get_user_extension_table() \
+ (Configuration.User_extension_table)
+
+#if defined(RTEMS_MULTIPROCESSING)
+ #define rtems_configuration_get_user_multiprocessing_table() \
+ (Configuration.User_multiprocessing_table)
+#else
+ #define rtems_configuration_get_user_multiprocessing_table() NULL
+#endif
+
+#define rtems_configuration_get_rtems_api_configuration() \
+ (&Configuration_RTEMS_API)
+
+#define rtems_configuration_get_posix_api_configuration() \
+ (&Configuration_POSIX_API)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/extension.h b/cpukit/sapi/include/rtems/extension.h
new file mode 100644
index 0000000000..4a7e258818
--- /dev/null
+++ b/cpukit/sapi/include/rtems/extension.h
@@ -0,0 +1,259 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicUserExtensions
+ *
+ * @brief User Extensions API.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_EXTENSION_H
+#define _RTEMS_EXTENSION_H
+
+#ifndef SAPI_EXT_EXTERN
+#define SAPI_EXT_EXTERN extern
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/score/object.h>
+#include <rtems/score/userext.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+
+SAPI_EXT_EXTERN Objects_Information _Extension_Information;
+
+typedef struct {
+ Objects_Control Object;
+ User_extensions_Control Extension;
+} Extension_Control;
+
+void _Extension_Manager_initialization(void);
+
+typedef User_extensions_routine
+ rtems_extension RTEMS_COMPILER_DEPRECATED_ATTRIBUTE;
+
+/**
+ * @defgroup ClassicUserExtensions User Extensions
+ *
+ * @ingroup ClassicRTEMS
+ *
+ * @brief The User Extensions Manager allows the application developer to
+ * augment the executive by allowing them to supply extension routines which
+ * are invoked at critical system events.
+ *
+ * @section ClassicUserExtensionsSets Extension Sets
+ *
+ * An @ref User_extensions_Table "extension set" is defined as a set of
+ * routines which are invoked at each of the critical system events at which
+ * user extension routines are invoked. Together a set of these routines
+ * typically perform a specific functionality such as performance monitoring or
+ * debugger support.
+ *
+ * RTEMS allows the user to have multiple extension sets active at the same
+ * time. First, a single static extension set may be defined as the
+ * application's User Extension Table which is included as part of the
+ * Configuration Table. This extension set is active for the entire life of the
+ * system and may not be deleted. This extension set is especially important
+ * because it is the only way the application can provided a fatal error
+ * extension which is invoked if RTEMS fails during the
+ * rtems_initialize_data_structures() directive. The static extension set is
+ * optional and may be configured as @c NULL if no static extension set is
+ * required.
+ *
+ * Second, the user can install dynamic extensions using the
+ * rtems_extension_create() directive. These extensions are RTEMS objects in
+ * that they have a name, an ID, and can be dynamically created and deleted. In
+ * contrast to the static extension set, these extensions can only be created
+ * and installed after the rtems_initialize_data_structures() directive
+ * successfully completes execution. Dynamic extensions are useful for
+ * encapsulating the functionality of an extension set. For example, the
+ * application could use extensions to manage a special coprocessor, do
+ * performance monitoring, and to do stack bounds checking. Each of these
+ * extension sets could be written and installed independently of the others.
+ *
+ * All user extensions are optional and RTEMS places no naming restrictions on
+ * the user. The user extension entry points are copied into an internal RTEMS
+ * structure. This means the user does not need to keep the table after
+ * creating it, and changing the handler entry points dynamically in a table
+ * once created has no effect. Creating a table local to a function can save
+ * space in space limited applications.
+ *
+ * Extension switches do not effect the context switch overhead if no switch
+ * handler is installed.
+ *
+ * @section ClassicUserExtensionsTCB Task Control Block Area
+ *
+ * RTEMS provides for a pointer to a user-defined data area for each extension
+ * set to be linked to each task's control block (TCB). This area is only
+ * available for the dynamic extensions. This set of pointers is an extension
+ * of the TCB and can be used to store additional data required by the user's
+ * extension functions. It is also possible for a user extension to utilize the
+ * notepad locations associated with each task although this may conflict with
+ * application usage of those particular notepads.
+ *
+ * The TCB extension is an array of pointers in the TCB. The index into the
+ * table can be obtained from the extension identifier returned when the
+ * extension is created:
+ *
+ * @code
+ * rtems_tcb *task = some_task;
+ * size_t index = rtems_object_id_get_index(extension_id);
+ * void *extension_data = task->extensions [index];
+ * @endcode
+ *
+ * The number of pointers in the area is the same as the number of user
+ * extension sets configured. This allows an application to augment the TCB
+ * with user-defined information. For example, an application could implement
+ * task profiling by storing timing statistics in the TCB's extended memory
+ * area. When a task context switch is being executed, the task switch
+ * extension could read a real-time clock to calculate how long the task being
+ * swapped out has run as well as timestamp the starting time for the task
+ * being swapped in.
+ *
+ * If used, the extended memory area for the TCB should be allocated and the
+ * TCB extension pointer should be set at the time the task is created or
+ * started by either the task create or task start extension. The application
+ * is responsible for managing this extended memory area for the TCBs. The
+ * memory may be reinitialized by the task restart extension and should be
+ * deallocated by the task delete extension when the task is deleted. Since the
+ * TCB extension buffers would most likely be of a fixed size, the RTEMS
+ * partition manager could be used to manage the application's extended memory
+ * area. The application could create a partition of fixed size TCB extension
+ * buffers and use the partition manager's allocation and deallocation
+ * directives to obtain and release the extension buffers.
+ *
+ * @section ClassicUserExtensionsOrder Order of Invokation
+ *
+ * When one of the critical system events occur, the user extensions are
+ * invoked in either @a forward or @a reverse order. Forward order indicates
+ * that the static extension set is invoked followed by the dynamic extension
+ * sets in the order in which they were created. Reverse order means that the
+ * dynamic extension sets are invoked in the opposite of the order in which
+ * they were created followed by the static extension set. By invoking the
+ * extension sets in this order, extensions can be built upon one another. At
+ * the following system events, the extensions are invoked in forward order:
+ *
+ * - Task creation
+ * - Task start
+ * - Task restart
+ * - Task context switch
+ * - Post task context switch
+ * - Task begins to execute
+ *
+ * At the following system events, the extensions are invoked in reverse order:
+ *
+ * - Task exit
+ * - Task deletion
+ * - Fatal error detection
+ *
+ * At these system events, the extensions are invoked in reverse order to
+ * insure that if an extension set is built upon another, the more complicated
+ * extension is invoked before the extension set it is built upon. For example,
+ * by invoking the static extension set last it is known that the "system"
+ * fatal error extension will be the last fatal error extension executed.
+ * Another example is use of the task delete extension by the Standard C
+ * Library. Extension sets which are installed after the Standard C Library
+ * will operate correctly even if they utilize the C Library because the C
+ * Library's task delete extension is invoked after that of the other
+ * extensions.
+ *
+ * @{
+ */
+
+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;
+
+/**
+ * @brief Creates an extension set object.
+ *
+ * This directive creates a extension set object from the extension table
+ * @a extension_table. The assigned extension set identifier is returned in
+ * @a id. The identifier is used to access this extension set in other
+ * extension set related directives. The name @a name will be assigned to the
+ * extension set object.
+ *
+ * Newly created extension sets are immediately installed and are invoked upon
+ * the next system event supporting an extension.
+ *
+ * This directive will not cause the calling task to be preempted.
+ *
+ * @retval RTEMS_SUCCESSFUL Extension set created successfully.
+ * @retval RTEMS_INVALID_ADDRESS Identifier pointer is @c NULL.
+ * @retval RTEMS_INVALID_NAME Invalid extension set name.
+ * @retval RTEMS_TOO_MANY Too many extension sets created.
+ */
+rtems_status_code rtems_extension_create(
+ rtems_name name,
+ const rtems_extensions_table *extension_table,
+ rtems_id *id
+);
+
+/**
+ * @brief Identifies an extension set object by a name.
+ *
+ * This directive obtains an extension set identifier in @a id associated with
+ * the extension set name @a name. If the extension set name is not unique,
+ * then the extension set identifier will match one of the extension sets with
+ * that name. However, this extension set identifier is not guaranteed to
+ * correspond to the desired extension set. The extension set identifier is
+ * used to access this extension set in other extension set related directives.
+ *
+ * This directive will not cause the calling task to be preempted.
+ *
+ * @retval RTEMS_SUCCESSFUL Extension set identified successfully.
+ * @retval RTEMS_INVALID_ADDRESS Identifier pointer is @c NULL.
+ * @retval RTEMS_INVALID_NAME Extension set name not found or invalid name.
+ */
+rtems_status_code rtems_extension_ident(
+ rtems_name name,
+ rtems_id *id
+);
+
+/**
+ * @brief Deletes an extension set object specified by the identifier @a id.
+ *
+ * Any subsequent references to the extension's name and identifier are
+ * invalid.
+ *
+ * This directive will not cause the calling task to be preempted.
+ *
+ * @retval RTEMS_SUCCESSFUL Extension set deleted successfully.
+ * @retval RTEMS_INVALID_ID Invalid extension set identifier.
+ */
+rtems_status_code rtems_extension_delete(
+ rtems_id id
+);
+
+/** @} */
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/extension.inl>
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/fatal.h b/cpukit/sapi/include/rtems/fatal.h
new file mode 100644
index 0000000000..63942aad97
--- /dev/null
+++ b/cpukit/sapi/include/rtems/fatal.h
@@ -0,0 +1,53 @@
+/**
+ * @file rtems/fatal.h
+ */
+
+/*
+ * This include file contains constants and prototypes related
+ * to the Fatal Error Manager. This manager processes all fatal or
+ * irrecoverable errors.
+ *
+ * This manager provides directives to:
+ *
+ * + announce a fatal error has occurred
+ *
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_FATAL_H
+#define _RTEMS_FATAL_H
+
+#include <rtems/score/basedefs.h> /* RTEMS_COMPILER_NO_RETURN_ATTRIBUTE */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * rtems_fatal_error_occurred
+ *
+ * DESCRIPTION:
+ *
+ * This is the routine which implements the rtems_fatal_error_occurred
+ * directive. It is invoked when the application or RTEMS
+ * determines that a fatal error has occurred.
+ */
+
+void rtems_fatal_error_occurred(
+ uint32_t the_error
+) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/init.h b/cpukit/sapi/include/rtems/init.h
new file mode 100644
index 0000000000..8cc7aa5c31
--- /dev/null
+++ b/cpukit/sapi/include/rtems/init.h
@@ -0,0 +1,100 @@
+/**
+ * @file rtems/init.h
+ *
+ *
+ * This include file contains all the constants and structures associated
+ * with the Initialization Manager. This manager is responsible for
+ * initializing RTEMS, creating and starting all configured initialization
+ * tasks, invoking the initialization routine for each user-supplied device
+ * driver, and initializing the optional multiprocessor layer.
+ *
+ * This manager provides directives to:
+ *
+ * + initialize the RTEMS executive
+ * + shutdown the RTEMS executive
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_INIT_H
+#define _RTEMS_INIT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/rtems/types.h>
+#include <rtems/config.h>
+#include <rtems/rtems/intr.h>
+
+#if defined(RTEMS_MULTIPROCESSING)
+/**
+ * The following defines the default Multiprocessing Configuration
+ * Table. This table is used in a single processor system.
+ */
+extern const rtems_multiprocessing_table
+ _Initialization_Default_multiprocessing_table;
+#endif
+
+/**
+ * @brief rtems_initialize_data_structures
+ *
+ * This routine implements the portion of the RTEMS initializatin process
+ * that involves initializing data structures to a state that scheduling
+ * can occur in a consistent manner.
+ */
+void rtems_initialize_data_structures(void);
+
+/**
+ * @brief rtems_initialize_before_drivers
+ *
+ * This routine implements the portion of RTEMS initialization that
+ * is done immediately before device drivers are initialized.
+ */
+void rtems_initialize_before_drivers(void);
+
+/**
+ * @brief rtems_initialize_device_drivers
+ *
+ * This routine implements the portion of RTEMS initialization that
+ * initializes all device drivers.
+ */
+void rtems_initialize_device_drivers(void);
+
+/**
+ * @brief rtems_initialize_start_multitasking
+ *
+ * This routine implements the early portion of rtems_initialize_executive
+ * directive up to the pretasking hook. This directive is invoked at system
+ * startup to initialize the RTEMS multitasking environment.
+ */
+void rtems_initialize_start_multitasking(void);
+
+/**
+ * @brief rtems_shutdown_executive
+ *
+ * This routine implements the rtems_shutdown_executive directive. The
+ * invocation of this directive results in the RTEMS environment being
+ * shutdown and multitasking halted. From the application's perspective,
+ * invocation of this directive results in the rtems_initialize_executive
+ * directive exitting to the startup code which invoked it.
+ */
+void rtems_shutdown_executive(
+ uint32_t result
+) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/io.h b/cpukit/sapi/include/rtems/io.h
new file mode 100644
index 0000000000..e47d66556d
--- /dev/null
+++ b/cpukit/sapi/include/rtems/io.h
@@ -0,0 +1,204 @@
+/**
+ * @file
+ *
+ * @ingroup ClassicIO
+ *
+ * @brief Classic Input/Output Manager API.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_IO_H
+#define _RTEMS_IO_H
+
+#ifndef SAPI_IO_EXTERN
+#define SAPI_IO_EXTERN extern
+#endif
+
+#include <rtems/rtems/status.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup ClassicIO Input/Output
+ *
+ * @ingroup ClassicRTEMS
+ *
+ * @{
+ */
+
+typedef uint32_t rtems_device_major_number;
+
+typedef uint32_t rtems_device_minor_number;
+
+typedef rtems_status_code rtems_device_driver;
+
+typedef rtems_device_driver (*rtems_device_driver_entry)(
+ rtems_device_major_number,
+ rtems_device_minor_number,
+ void *
+);
+
+typedef struct {
+ rtems_device_driver_entry initialization_entry;
+ rtems_device_driver_entry open_entry;
+ rtems_device_driver_entry close_entry;
+ rtems_device_driver_entry read_entry;
+ rtems_device_driver_entry write_entry;
+ rtems_device_driver_entry control_entry;
+} rtems_driver_address_table;
+
+/**
+ * @name Device Driver Maintainance
+ *
+ * @{
+ */
+
+/**
+ * @brief Returns @c RTEMS_IO_ERROR.
+ *
+ * @retval RTEMS_IO_ERROR Only this one.
+ */
+rtems_status_code rtems_io_driver_io_error(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *arg
+);
+
+/**
+ * @brief Registers and initializes the device with the device driver table
+ * @a driver_table and major number @a major.
+ *
+ * If the major number equals zero a major number will be obtained. The major
+ * number of the registered driver will be returned in @a registered_major.
+ *
+ * After a successful registration rtems_io_initialize() will be called to
+ * initialize the device.
+ *
+ * @retval RTEMS_SUCCESSFUL Device successfully registered and initialized.
+ * @retval RTEMS_INVALID_ADDRESS Pointer to driver table or to registered
+ * major number are invalid. Device driver table is empty.
+ * @retval RTEMS_INVALID_NUMBER Invalid major number.
+ * @retval RTEMS_TOO_MANY No major number available.
+ * @retval RTEMS_RESOURCE_IN_USE Major number in use.
+ * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context.
+ * @retval * Status code depends on rtems_io_initialize().
+ */
+rtems_status_code rtems_io_register_driver(
+ rtems_device_major_number major,
+ const rtems_driver_address_table *driver_table,
+ rtems_device_major_number *registered_major
+);
+
+/**
+ * @brief Unregisters the device driver with number @a major.
+ *
+ * @retval RTEMS_SUCCESSFUL Device driver successfully unregistered.
+ * @retval RTEMS_UNSATISFIED Invalid major number.
+ * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context.
+ */
+rtems_status_code rtems_io_unregister_driver(
+ rtems_device_major_number major
+);
+
+/**
+ * @brief Registers the name @a device_name in the file system for the device
+ * with number tuple @a major and @a minor.
+ *
+ * @retval RTEMS_SUCCESSFUL Name successfully registered.
+ * @retval RTEMS_TOO_MANY Name already in use or other errors.
+ */
+rtems_status_code rtems_io_register_name(
+ const char *device_name,
+ rtems_device_major_number major,
+ rtems_device_minor_number minor
+);
+
+/** @} */
+
+/**
+ * @name Device Driver Invocation
+ *
+ * @{
+ */
+
+rtems_status_code rtems_io_initialize(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+rtems_status_code rtems_io_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+rtems_status_code rtems_io_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+rtems_status_code rtems_io_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+rtems_status_code rtems_io_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+rtems_status_code rtems_io_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void *argument
+);
+
+/** @} */
+
+/** @} */
+
+typedef struct {
+ char *device_name;
+ size_t device_name_length;
+ rtems_device_major_number major;
+ rtems_device_minor_number minor;
+} rtems_driver_name_t;
+
+/**
+ * @deprecated Use stat() instead.
+ */
+rtems_status_code rtems_io_lookup_name(
+ const char *name,
+ rtems_driver_name_t *device_info
+) RTEMS_COMPILER_DEPRECATED_ATTRIBUTE;
+
+SAPI_IO_EXTERN uint32_t _IO_Number_of_drivers;
+
+SAPI_IO_EXTERN rtems_driver_address_table *_IO_Driver_address_table;
+
+void _IO_Manager_initialization( void );
+
+void _IO_Initialize_all_drivers( void );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/mptables.h b/cpukit/sapi/include/rtems/mptables.h
new file mode 100644
index 0000000000..bcb51c5e96
--- /dev/null
+++ b/cpukit/sapi/include/rtems/mptables.h
@@ -0,0 +1,28 @@
+/* mptables.h
+ *
+ * This include file contains the executive's pre-initialized tables
+ * used in a multiprocessor configuration.
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_MPTABLES_H
+#define _RTEMS_MPTABLES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
diff --git a/cpukit/sapi/include/rtems/sptables.h b/cpukit/sapi/include/rtems/sptables.h
new file mode 100644
index 0000000000..e4fbd226bf
--- /dev/null
+++ b/cpukit/sapi/include/rtems/sptables.h
@@ -0,0 +1,75 @@
+/**
+ * @file rtems/sptables.h
+ *
+ * This include file contains the executive's pre-initialized tables
+ * used when in a single processor configuration.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-1999.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_SPTABLES_H
+#define _RTEMS_SPTABLES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rtems/config.h>
+
+#include <rtems/debug.h>
+#include <rtems/fatal.h>
+#include <rtems/init.h>
+#include <rtems/io.h>
+#include <rtems/score/sysstate.h>
+
+#include <rtems/rtems/intr.h>
+#include <rtems/rtems/clock.h>
+#include <rtems/rtems/tasks.h>
+#include <rtems/rtems/dpmem.h>
+#include <rtems/rtems/event.h>
+#include <rtems/rtems/message.h>
+#if defined(RTEMS_MULTIPROCESSING)
+#include <rtems/rtems/mp.h>
+#endif
+#include <rtems/rtems/part.h>
+#include <rtems/rtems/ratemon.h>
+#include <rtems/rtems/region.h>
+#include <rtems/rtems/sem.h>
+#include <rtems/rtems/signal.h>
+#include <rtems/rtems/timer.h>
+
+#if defined(RTEMS_MULTIPROCESSING)
+/*
+ * This is the default Multiprocessing Configuration Table.
+ * It is used in single processor configurations.
+ */
+ #if defined(SAPI_INIT)
+ const rtems_multiprocessing_table
+ _Initialization_Default_multiprocessing_table = {
+ 1, /* local node number */
+ 1, /* maximum number nodes in system */
+ 0, /* maximum number global objects */
+ 0, /* maximum number proxies */
+ STACK_MINIMUM_SIZE, /* MPCI receive server stack size */
+ NULL, /* pointer to MPCI address table */
+ };
+ #else
+ extern const rtems_multiprocessing_table
+ _Initialization_Default_multiprocessing_table;
+ #endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif