diff options
Diffstat (limited to 'cpukit/sapi/src')
-rw-r--r-- | cpukit/sapi/src/exinit.c | 140 | ||||
-rw-r--r-- | cpukit/sapi/src/extension.c | 30 | ||||
-rw-r--r-- | cpukit/sapi/src/fatal.c | 24 | ||||
-rw-r--r-- | cpukit/sapi/src/io.c | 29 | ||||
-rw-r--r-- | cpukit/sapi/src/rtemsapi.c | 89 |
5 files changed, 194 insertions, 118 deletions
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 */ |