summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/sapi')
-rw-r--r--cpukit/sapi/include/rtems/config.h265
-rw-r--r--cpukit/sapi/include/rtems/extension.h29
-rw-r--r--cpukit/sapi/include/rtems/init.h12
-rw-r--r--cpukit/sapi/include/rtems/io.h56
-rw-r--r--cpukit/sapi/src/exinit.c140
-rw-r--r--cpukit/sapi/src/extension.c30
-rw-r--r--cpukit/sapi/src/fatal.c24
-rw-r--r--cpukit/sapi/src/io.c29
-rw-r--r--cpukit/sapi/src/rtemsapi.c89
9 files changed, 292 insertions, 382 deletions
diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h
index 766ea4a4a8..31e8093387 100644
--- a/cpukit/sapi/include/rtems/config.h
+++ b/cpukit/sapi/include/rtems/config.h
@@ -21,164 +21,12 @@
extern "C" {
#endif
-#include <rtems/types.h>
-#include <rtems/object.h>
-#include <rtems/thread.h>
-
-/*
- * The following records define the Initialization Tasks Table.
- * Each entry contains the information required by RTEMS to
- * create and start a user task automatically at executive
- * initialization time.
- */
-
-typedef struct {
- rtems_name name; /* task name */
- unsigned32 stack_size; /* task stack size */
- rtems_task_priority initial_priority; /* task priority */
- rtems_attribute attribute_set; /* task attributes */
- rtems_task_entry entry_point; /* task entry point */
- rtems_mode mode_set; /* task initial mode */
- unsigned32 argument; /* task argument */
-} rtems_initialization_tasks_table;
-
-/*
- *
- * The following defines the types for:
- *
- * + major and minor numbers
- * + the return type of a device driver entry
- * + a pointer to a device driver entry
- * + an entry in the the Device Driver Address Table. Each entry in this
- * table corresponds to an application provided device driver and
- * defines the entry points for that device driver.
- */
-
-typedef unsigned32 rtems_device_major_number;
-typedef unsigned32 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; /* initialization procedure */
- rtems_device_driver_entry open; /* open request procedure */
- rtems_device_driver_entry close; /* close request procedure */
- rtems_device_driver_entry read; /* read request procedure */
- rtems_device_driver_entry write; /* write request procedure */
- rtems_device_driver_entry control; /* special functions procedure */
-} rtems_driver_address_table;
-
-/*
- * The following records defines the User Extension Table.
- * This table defines the application dependent routines which
- * are invoked at critical points in the life of each task and
- * the system as a whole.
- */
-
-typedef void rtems_extension;
-
-typedef rtems_extension ( *rtems_task_create_extension )(
- rtems_tcb *,
- rtems_tcb *
- );
-
-typedef rtems_extension ( *rtems_task_delete_extension )(
- rtems_tcb *,
- rtems_tcb *
- );
-
-typedef rtems_extension ( *rtems_task_start_extension )(
- rtems_tcb *,
- rtems_tcb *
- );
-
-typedef rtems_extension ( *rtems_task_restart_extension )(
- rtems_tcb *,
- rtems_tcb *
- );
-
-typedef rtems_extension ( *rtems_task_switch_extension )(
- rtems_tcb *,
- rtems_tcb *
- );
-
-typedef rtems_extension ( *rtems_task_begin_extension )(
- rtems_tcb *
- );
-
-typedef rtems_extension ( *rtems_task_exitted_extension )(
- rtems_tcb *
- );
-
-typedef rtems_extension ( *rtems_fatal_extension )(
- unsigned32
- );
-
-typedef struct {
- rtems_task_create_extension rtems_task_create;
- rtems_task_start_extension rtems_task_start;
- rtems_task_restart_extension rtems_task_restart;
- rtems_task_delete_extension rtems_task_delete;
- rtems_task_switch_extension task_switch;
- rtems_task_begin_extension task_begin;
- rtems_task_exitted_extension task_exitted;
- rtems_fatal_extension fatal;
-} rtems_extensions_table;
-
-/*
- * The following records define the Multiprocessor Communications
- * Interface (MPCI) Table. This table defines the user-provided
- * MPCI which is a required part of a multiprocessor RTEMS system.
- *
- * For non-blocking local operations that become remote operations,
- * we need a timeout. This is a per-driver timeout: default_timeout
- */
-
-/* XXX FORWARD REFERENCES */
-
-typedef struct Configuration_Table rtems_configuration_table;
-typedef struct Configuration_Table_MP rtems_multiprocessing_table;
-
-typedef void rtems_mpci_entry;
-
-typedef rtems_mpci_entry ( *rtems_mpci_initialization_entry )(
- rtems_configuration_table *,
- rtems_cpu_table *,
- rtems_multiprocessing_table *
- );
-
-typedef rtems_mpci_entry ( *rtems_mpci_get_packet_entry )(
- rtems_packet_prefix **
- );
-
-typedef rtems_mpci_entry ( *rtems_mpci_return_packet_entry )(
- rtems_packet_prefix *
- );
-
-typedef rtems_mpci_entry ( *rtems_mpci_send_entry )(
- unsigned32,
- rtems_packet_prefix *
- );
-
-typedef rtems_mpci_entry ( *rtems_mpci_receive_entry )(
- rtems_packet_prefix **
- );
-
-typedef struct {
- unsigned32 default_timeout; /* in ticks */
- unsigned32 maximum_packet_size;
- rtems_mpci_initialization_entry initialization;
- rtems_mpci_get_packet_entry get_packet;
- rtems_mpci_return_packet_entry return_packet;
- rtems_mpci_send_entry send_packet;
- rtems_mpci_receive_entry receive_packet;
-} rtems_mpci_table;
+#include <rtems/rtems/status.h>
+#include <rtems/extension.h>
+#include <rtems/io.h>
+#include <rtems/core/mpci.h>
+#include <rtems/rtems/types.h>
+#include <rtems/rtems/tasks.h>
/*
* The following records define the Multiprocessor Configuration
@@ -187,13 +35,13 @@ typedef struct {
* system.
*/
-struct Configuration_Table_MP {
- unsigned32 node; /* local node number */
- unsigned32 maximum_nodes; /* maximum # nodes in system */
- unsigned32 maximum_global_objects; /* maximum # global objects */
- unsigned32 maximum_proxies; /* maximum # proxies */
- rtems_mpci_table *User_mpci_table; /* pointer to MPCI table */
-};
+typedef struct {
+ unsigned32 node; /* local node number */
+ unsigned32 maximum_nodes; /* maximum # nodes in system */
+ unsigned32 maximum_global_objects; /* maximum # global objects */
+ unsigned32 maximum_proxies; /* maximum # proxies */
+ MPCI_Control *User_mpci_table; /* pointer to MPCI table */
+} rtems_multiprocessing_table;
/*
* The following records define the Configuration Table. The
@@ -207,7 +55,7 @@ struct Configuration_Table_MP {
* + clock ticks per task timeslice
*/
-struct Configuration_Table {
+typedef struct {
void *work_space_start;
unsigned32 work_space_size;
unsigned32 maximum_tasks;
@@ -224,92 +72,19 @@ struct Configuration_Table {
unsigned32 number_of_initialization_tasks;
rtems_initialization_tasks_table *User_initialization_tasks_table;
unsigned32 number_of_device_drivers;
+ unsigned32 maximum_devices;
rtems_driver_address_table *Device_driver_table;
rtems_extensions_table *User_extension_table;
rtems_multiprocessing_table *User_multiprocessing_table;
-};
-
-/*
- * The following defines the default Multiprocessing Configuration
- * Table. This table is used in a single processor system.
- */
-
-extern const rtems_multiprocessing_table
- _Configuration_Default_multiprocessing_table;
-
-/*
- * The following define the internal pointers to the user's
- * configuration information.
- */
-
-EXTERN rtems_configuration_table *_Configuration_Table;
-EXTERN rtems_multiprocessing_table *_Configuration_MP_table;
-EXTERN rtems_mpci_table *_Configuration_MPCI_table;
-
-/*
- *
- * _Configuration_Handler_initialization
- *
- * DESCRIPTION:
- *
- * This routine performs the initialization necessary for this handler.
- */
-
-STATIC INLINE void _Configuration_Handler_initialization(
- rtems_configuration_table *configuration_table,
- rtems_multiprocessing_table *multiprocessing_table,
- rtems_mpci_table *users_mpci_table
-);
-
-/*
- * _Configuration_Is_multiprocessing
- *
- * DESCRIPTION:
- *
- * This function determines if a multiprocessing application has been
- * configured, if so, TRUE is returned, otherwise FALSE is returned.
- */
-
-STATIC INLINE boolean _Configuration_Is_multiprocessing( void );
-
-/*
- * _Configuration_Is_null_driver_address_table_pointer
- *
- * DESCRIPTION:
- *
- * This function returns TRUE if the_table is NULL and FALSE otherwise.
- */
-
-STATIC INLINE boolean _Configuration_Is_null_driver_address_table_pointer(
- rtems_driver_address_table *the_table
-);
-
-/*
- * _Configuration_Is_null_extension_table_pointer
- *
- * DESCRIPTION:
- *
- * This function returns TRUE if the_table is NULL and FALSE otherwise.
- */
-
-STATIC INLINE boolean _Configuration_Is_null_extension_table_pointer(
- rtems_extensions_table *the_table
-);
+} rtems_configuration_table;
/*
- * _Configuration_Is_null_initialization_tasks_table_pointer
- *
- * DESCRIPTION:
- *
- * This function returns TRUE if the_table is NULL and FALSE otherwise.
+ * The following are provided strictly for the convenience of
+ * the user. They are not used in RTEMS itself.
*/
-STATIC INLINE boolean
- _Configuration_Is_null_initialization_tasks_table_pointer(
- rtems_initialization_tasks_table *the_table
-);
-
-#include <rtems/config.inl>
+EXTERN rtems_configuration_table *_Configuration_Table;
+EXTERN rtems_multiprocessing_table *_Configuration_MP_table;
#ifdef __cplusplus
}
diff --git a/cpukit/sapi/include/rtems/extension.h b/cpukit/sapi/include/rtems/extension.h
index b447cc43fe..57c8a54271 100644
--- a/cpukit/sapi/include/rtems/extension.h
+++ b/cpukit/sapi/include/rtems/extension.h
@@ -28,9 +28,28 @@
extern "C" {
#endif
-#include <rtems.h>
-#include <rtems/object.h>
-#include <rtems/userext.h>
+#include <rtems/core/object.h>
+#include <rtems/core/userext.h>
+#include <rtems/rtems/status.h> /* XXX */
+#include <rtems/rtems/types.h> /* XXX */
+
+/*
+ * Extension related types
+ */
+
+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_post_switch_extension
+ rtems_task_post_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;
/*
* The following defines the information control block used to manage
@@ -73,9 +92,9 @@ void _Extension_Manager_initialization(
*/
rtems_status_code rtems_extension_create(
- rtems_name name,
+ rtems_name name,
rtems_extensions_table *extension_table,
- Objects_Id *id
+ Objects_Id *id
);
/*
diff --git a/cpukit/sapi/include/rtems/init.h b/cpukit/sapi/include/rtems/init.h
index 8c6e34d2c3..e008c45ebc 100644
--- a/cpukit/sapi/include/rtems/init.h
+++ b/cpukit/sapi/include/rtems/init.h
@@ -30,9 +30,17 @@
extern "C" {
#endif
-#include <rtems/types.h>
+#include <rtems/rtems/types.h>
#include <rtems/config.h>
-#include <rtems/intr.h>
+#include <rtems/rtems/intr.h>
+
+/*
+ * 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;
/*
* rtems_initialize_executive
diff --git a/cpukit/sapi/include/rtems/io.h b/cpukit/sapi/include/rtems/io.h
index ef9fc69d03..6f3afba53e 100644
--- a/cpukit/sapi/include/rtems/io.h
+++ b/cpukit/sapi/include/rtems/io.h
@@ -32,16 +32,40 @@
extern "C" {
#endif
-#include <rtems/config.h>
+#include <rtems/rtems/status.h>
/*
- * The following declare the data required to manage the Device Driver
- * Address Table.
+ *
+ * The following defines the types for:
+ *
+ * + major and minor numbers
+ * + the return type of a device driver entry
+ * + a pointer to a device driver entry
+ * + an entry in the the Device Driver Address Table. Each entry in this
+ * table corresponds to an application provided device driver and
+ * defines the entry points for that device driver.
*/
+
+typedef unsigned32 rtems_device_major_number;
+typedef unsigned32 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 *
+ );
-EXTERN unsigned32 _IO_Number_of_drivers;
-EXTERN rtems_driver_address_table *_IO_Driver_address_table;
-
+typedef struct {
+ rtems_device_driver_entry initialization; /* initialization procedure */
+ rtems_device_driver_entry open; /* open request procedure */
+ rtems_device_driver_entry close; /* close request procedure */
+ rtems_device_driver_entry read; /* read request procedure */
+ rtems_device_driver_entry write; /* write request procedure */
+ rtems_device_driver_entry control; /* special functions procedure */
+} rtems_driver_address_table;
+
/*
* Table for the io device names
*/
@@ -53,12 +77,19 @@ typedef struct {
rtems_device_minor_number minor;
} rtems_driver_name_t;
-/*XXX this really should be allocated some better way... */
-/*XXX it should probably be a chain and use a 'maximum' drivers field
- * in config table */
-#define RTEMS_MAX_DRIVER_NAMES 20
-EXTERN rtems_driver_name_t rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES];
+/*
+ * This is the table of device names.
+ */
+
+/*
+ * The following declare the data required to manage the Driver
+ * Address Table and Device Name Table.
+ */
+EXTERN unsigned32 _IO_Number_of_drivers;
+EXTERN rtems_driver_address_table *_IO_Driver_address_table;
+EXTERN unsigned32 _IO_Number_of_devices;
+EXTERN rtems_driver_name_t *_IO_Driver_name_table;
/*
* _IO_Manager_initialization
@@ -70,7 +101,8 @@ EXTERN rtems_driver_name_t rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES];
STATIC INLINE void _IO_Manager_initialization(
rtems_driver_address_table *driver_table,
- unsigned32 number_of_drivers
+ unsigned32 number_of_drivers,
+ unsigned32 number_of_devices
);
/*
diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
index f85504b18d..4c9cb2e785 100644
--- a/cpukit/sapi/src/exinit.c
+++ b/cpukit/sapi/src/exinit.c
@@ -21,39 +21,31 @@
#include <rtems/system.h>
#include <rtems/config.h>
-#include <rtems/copyrt.h>
-#include <rtems/clock.h>
-#include <rtems/tasks.h>
#include <rtems/debug.h>
-#include <rtems/dpmem.h>
-#include <rtems/event.h>
#include <rtems/extension.h>
#include <rtems/fatal.h>
-#include <rtems/heap.h>
#include <rtems/init.h>
-#include <rtems/intthrd.h>
-#include <rtems/isr.h>
-#include <rtems/intr.h>
#include <rtems/io.h>
-#include <rtems/message.h>
-#include <rtems/mp.h>
-#include <rtems/mpci.h>
-#include <rtems/part.h>
-#include <rtems/priority.h>
-#include <rtems/ratemon.h>
-#include <rtems/region.h>
-#include <rtems/sem.h>
-#include <rtems/signal.h>
#include <rtems/sysstate.h>
-#include <rtems/thread.h>
-#include <rtems/timer.h>
-#include <rtems/tod.h>
-#include <rtems/userext.h>
-#include <rtems/watchdog.h>
-#include <rtems/wkspace.h>
+#include <rtems/core/copyrt.h>
+#include <rtems/core/heap.h>
+#include <rtems/core/interr.h>
+#include <rtems/core/intthrd.h>
+#include <rtems/core/isr.h>
+#include <rtems/core/mpci.h>
+#include <rtems/core/priority.h>
+#include <rtems/core/thread.h>
+#include <rtems/core/tod.h>
+#include <rtems/core/userext.h>
+#include <rtems/core/watchdog.h>
+#include <rtems/core/wkspace.h>
+
+#include <rtems/directives.h>
#include <rtems/sptables.h>
+#include <rtems/rtems/rtemsapi.h>
+
/*PAGE
*
* rtems_initialize_executive
@@ -103,29 +95,54 @@ rtems_interrupt_level rtems_initialize_executive_early(
_ISR_Disable( bsp_level );
- _System_state_Set( SYSTEM_STATE_BEFORE_INITIALIZATION );
+ if ( cpu_table == NULL )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_NO_CONFIGURATION_TABLE
+ );
- _CPU_Initialize( cpu_table, _Thread_Dispatch );
+ /*
+ * Initialize the system state based on whether this is an MP system.
+ */
+
+ multiprocessing_table = configuration_table->User_multiprocessing_table;
+
+ _System_state_Handler_initialization(
+ (multiprocessing_table) ? TRUE : FALSE
+ );
/*
- * Do this as early as possible to insure no debugging output
- * is even attempted to be printed.
+ * Provided just for user convenience.
*/
- _Debug_Manager_initialization();
+ _Configuration_Table = configuration_table;
+ _Configuration_MP_table = multiprocessing_table;
+
+ /*
+ * Internally we view single processor systems as a very restricted
+ * multiprocessor system.
+ */
- multiprocessing_table = configuration_table->User_multiprocessing_table;
if ( multiprocessing_table == NULL )
- multiprocessing_table =
- (void *) &_Configuration_Default_multiprocessing_table;
+ multiprocessing_table =
+ (void *)&_Initialization_Default_multiprocessing_table;
- _Configuration_Handler_initialization(
- configuration_table,
- multiprocessing_table,
- multiprocessing_table->User_mpci_table
- );
+ if ( cpu_table == NULL )
+ _Internal_error_Occurred(
+ INTERNAL_ERROR_CORE,
+ TRUE,
+ INTERNAL_ERROR_NO_CPU_TABLE
+ );
+
+ _CPU_Initialize( cpu_table, _Thread_Dispatch );
- _Attributes_Handler_initialization();
+ /*
+ * Do this as early as possible to insure no debugging output
+ * is even attempted to be printed.
+ */
+
+ _Debug_Manager_initialization();
_Thread_Dispatch_initialization();
@@ -142,6 +159,7 @@ rtems_interrupt_level rtems_initialize_executive_early(
_Objects_Handler_initialization(
multiprocessing_table->node,
+ multiprocessing_table->maximum_nodes,
multiprocessing_table->maximum_global_objects
);
@@ -153,57 +171,33 @@ rtems_interrupt_level rtems_initialize_executive_early(
_Thread_Handler_initialization(
configuration_table->ticks_per_timeslice,
+ configuration_table->maximum_extensions,
multiprocessing_table->maximum_proxies
);
- _MPCI_Handler_initialization();
-
-/* MANAGERS */
-
- _Interrupt_Manager_initialization();
-
- _Multiprocessing_Manager_initialization();
+ _MPCI_Handler_initialization(
+ multiprocessing_table->User_mpci_table
+ );
- _RTEMS_tasks_Manager_initialization( configuration_table->maximum_tasks );
+ _Internal_threads_Initialization();
- _Timer_Manager_initialization( configuration_table->maximum_timers );
+/* MANAGERS */
_Extension_Manager_initialization( configuration_table->maximum_extensions );
_IO_Manager_initialization(
configuration_table->Device_driver_table,
- configuration_table->number_of_device_drivers
+ configuration_table->number_of_device_drivers,
+ configuration_table->maximum_devices
);
- _Event_Manager_initialization();
-
- _Message_queue_Manager_initialization(
- configuration_table->maximum_message_queues
- );
-
- _Semaphore_Manager_initialization(
- configuration_table->maximum_semaphores
- );
-
- _Partition_Manager_initialization(
- configuration_table->maximum_partitions
- );
-
- _Region_Manager_initialization( configuration_table->maximum_regions );
-
- _Dual_ported_memory_Manager_initialization(
- configuration_table->maximum_ports
- );
-
- _Rate_monotonic_Manager_initialization(
- configuration_table->maximum_periods
- );
-
- _Internal_threads_Initialization();
+ _RTEMS_API_Initialize( configuration_table );
if ( cpu_table->pretasking_hook )
(*cpu_table->pretasking_hook)();
+ _Internal_threads_Start();
+
_System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
return bsp_level;
diff --git a/cpukit/sapi/src/extension.c b/cpukit/sapi/src/extension.c
index a962ad270e..4c1ac96ebd 100644
--- a/cpukit/sapi/src/extension.c
+++ b/cpukit/sapi/src/extension.c
@@ -14,9 +14,9 @@
*/
#include <rtems/system.h>
-#include <rtems/support.h>
-#include <rtems/object.h>
-#include <rtems/thread.h>
+#include <rtems/rtems/support.h>
+#include <rtems/core/object.h>
+#include <rtems/core/thread.h>
#include <rtems/extension.h>
/*PAGE
@@ -65,15 +65,15 @@ void _Extension_Manager_initialization(
*/
rtems_status_code rtems_extension_create(
- rtems_name name,
+ rtems_name name,
rtems_extensions_table *extension_table,
- Objects_Id *id
+ Objects_Id *id
)
{
Extension_Control *the_extension;
if ( !rtems_is_name_valid( name ) )
- return ( RTEMS_INVALID_NAME );
+ return RTEMS_INVALID_NAME;
_Thread_Disable_dispatch(); /* to prevent deletion */
@@ -81,7 +81,7 @@ rtems_status_code rtems_extension_create(
if ( !the_extension ) {
_Thread_Enable_dispatch();
- return( RTEMS_TOO_MANY );
+ return RTEMS_TOO_MANY;
}
_User_extensions_Add_set( &the_extension->Extension, extension_table );
@@ -90,7 +90,7 @@ rtems_status_code rtems_extension_create(
*id = the_extension->Object.id;
_Thread_Enable_dispatch();
- return( RTEMS_SUCCESSFUL );
+ return RTEMS_SUCCESSFUL;
}
/*PAGE
@@ -115,12 +115,16 @@ rtems_status_code rtems_extension_ident(
Objects_Id *id
)
{
- return _Objects_Name_to_id(
+ Objects_Name_to_id_errors status;
+
+ status = _Objects_Name_to_id(
&_Extension_Information,
&name,
- RTEMS_SEARCH_LOCAL_NODE,
+ OBJECTS_SEARCH_LOCAL_NODE,
id
);
+
+ return _Status_Object_name_errors_to_status[ status ];
}
/*PAGE
@@ -148,14 +152,14 @@ rtems_status_code rtems_extension_delete(
switch ( location ) {
case OBJECTS_ERROR:
case OBJECTS_REMOTE: /* should never return this */
- return( RTEMS_INVALID_ID );
+ return RTEMS_INVALID_ID;
case OBJECTS_LOCAL:
_User_extensions_Remove_set( &the_extension->Extension );
_Objects_Close( &_Extension_Information, &the_extension->Object );
_Extension_Free( the_extension );
_Thread_Enable_dispatch();
- return( RTEMS_SUCCESSFUL );
+ return RTEMS_SUCCESSFUL;
}
- return( RTEMS_INTERNAL_ERROR ); /* unreached - only to remove warnings */
+ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
}
diff --git a/cpukit/sapi/src/fatal.c b/cpukit/sapi/src/fatal.c
index 2ecc73ff3f..321eec1c00 100644
--- a/cpukit/sapi/src/fatal.c
+++ b/cpukit/sapi/src/fatal.c
@@ -13,42 +13,26 @@
*/
#include <rtems/system.h>
-#include <rtems/config.h>
#include <rtems/fatal.h>
-#include <rtems/sysstate.h>
-#include <rtems/userext.h>
+#include <rtems/core/interr.h>
/*PAGE
*
* rtems_fatal_error_occurred
*
- * This directive will invoke the fatal error handler supplied by the user
- * followed by the the default one provided by the executive. The default
- * error handler assumes no hardware is present to help inform the user
- * of the problem. Halt stores the error code in a known register,
- * disables interrupts, and halts the CPU. If the CPU does not have a
- * halt instruction, it will loop to itself.
+ * This directive will invoke the internal fatal error handler.
*
* Input parameters:
* the_error - fatal error status code
*
- * Output parameters:
- * the_error - on stack
- * status register - on stack
- *
- * NOTE: The the_error is not necessarily a directive status code.
+ * Output parameters: NONE
*/
void volatile rtems_fatal_error_occurred(
unsigned32 the_error
)
{
-
- _User_extensions_Fatal( the_error );
-
- _System_state_Set( SYSTEM_STATE_FAILED );
-
- _CPU_Fatal_halt( the_error );
+ _Internal_error_Occurred( INTERNAL_ERROR_RTEMS_API, FALSE, the_error );
/* will not return from this routine */
}
diff --git a/cpukit/sapi/src/io.c b/cpukit/sapi/src/io.c
index 4ab45b33f5..cca390ea71 100644
--- a/cpukit/sapi/src/io.c
+++ b/cpukit/sapi/src/io.c
@@ -14,11 +14,9 @@
*/
#include <rtems/system.h>
-#include <rtems/config.h>
#include <rtems/io.h>
-#include <rtems/isr.h>
-#include <rtems/thread.h>
-#include <rtems/intr.h>
+#include <rtems/core/isr.h>
+#include <rtems/core/thread.h>
#include <string.h>
@@ -38,7 +36,7 @@ void _IO_Initialize_all_drivers( void )
rtems_device_major_number major;
for ( major=0 ; major < _IO_Number_of_drivers ; major ++ )
- (void) rtems_io_initialize( major, 0, _Configuration_Table);
+ (void) rtems_io_initialize( major, 0, NULL);
}
/*PAGE
@@ -60,22 +58,26 @@ rtems_status_code rtems_io_register_name(
{
rtems_driver_name_t *np;
unsigned32 level;
+ unsigned32 index;
/* find an empty slot */
- for (np = rtems_driver_name_table; np < &rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; np++)
+ for( index=0, np = _IO_Driver_name_table ;
+ index < _IO_Number_of_devices ;
+ index++, np++ )
{
- rtems_interrupt_disable(level);
+
+ _ISR_Disable(level);
if (np->device_name == 0)
{
np->device_name = device_name;
np->device_name_length = strlen(device_name);
np->major = major;
np->minor = minor;
- rtems_interrupt_enable(level);
+ _ISR_Enable(level);
return RTEMS_SUCCESSFUL;
}
- rtems_interrupt_enable(level);
+ _ISR_Enable(level);
}
return RTEMS_TOO_MANY;
@@ -93,13 +95,16 @@ rtems_status_code rtems_io_register_name(
*/
rtems_status_code rtems_io_lookup_name(
- const char *pathname,
+ const char *pathname,
rtems_driver_name_t **rnp
- )
+)
{
rtems_driver_name_t *np;
+ unsigned32 index;
- for (np = rtems_driver_name_table; np < &rtems_driver_name_table[RTEMS_MAX_DRIVER_NAMES]; np++)
+ for( index=0, np = _IO_Driver_name_table ;
+ index < _IO_Number_of_devices ;
+ index++, np++ )
if (np->device_name)
if (strncmp(np->device_name, pathname, np->device_name_length) == 0)
{
diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c
new file mode 100644
index 0000000000..b6ecb6c37c
--- /dev/null
+++ b/cpukit/sapi/src/rtemsapi.c
@@ -0,0 +1,89 @@
+/*
+ * RTEMS API Support
+ *
+ * NOTE:
+ *
+ * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
+ * On-Line Applications Research Corporation (OAR).
+ * All rights assigned to U.S. Government, 1994.
+ *
+ * This material may be reproduced by or for the U.S. Government pursuant
+ * to the copyright license under the clause at DFARS 252.227-7013. This
+ * notice must appear in all copies of this file and its derivatives.
+ *
+ * $Id$
+ */
+
+#include <rtems/system.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/rtemsapi.h>
+
+#define INIT
+
+#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>
+#include <rtems/rtems/mp.h>
+#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>
+
+/*PAGE
+ *
+ * _RTEMS_API_Initialize
+ *
+ * XXX
+ */
+
+void _RTEMS_API_Initialize(
+ rtems_configuration_table *configuration_table
+)
+{
+ _Attributes_Handler_initialization();
+
+ _Interrupt_Manager_initialization();
+
+ _Multiprocessing_Manager_initialization();
+
+ _RTEMS_tasks_Manager_initialization(
+ configuration_table->maximum_tasks,
+ configuration_table->number_of_initialization_tasks,
+ configuration_table->User_initialization_tasks_table
+ );
+
+ _Timer_Manager_initialization( configuration_table->maximum_timers );
+
+ _Signal_Manager_initialization();
+
+ _Event_Manager_initialization();
+
+ _Message_queue_Manager_initialization(
+ configuration_table->maximum_message_queues
+ );
+
+ _Semaphore_Manager_initialization(
+ configuration_table->maximum_semaphores
+ );
+
+ _Partition_Manager_initialization(
+ configuration_table->maximum_partitions
+ );
+
+ _Region_Manager_initialization( configuration_table->maximum_regions );
+
+ _Dual_ported_memory_Manager_initialization(
+ configuration_table->maximum_ports
+ );
+
+ _Rate_monotonic_Manager_initialization(
+ configuration_table->maximum_periods
+ );
+}
+
+/* end of file */