From ac7d5ef06a6d6e8d84abbd1f0b82162725f98326 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 11 May 1995 17:39:37 +0000 Subject: Initial revision --- c/src/exec/sapi/headers/config.h | 321 +++++++++++++++++++++++++++++ c/src/exec/sapi/headers/directives.h | 108 ++++++++++ c/src/exec/sapi/headers/extension.h | 169 +++++++++++++++ c/src/exec/sapi/headers/fatal.h | 49 +++++ c/src/exec/sapi/headers/init.h | 101 +++++++++ c/src/exec/sapi/headers/io.h | 204 ++++++++++++++++++ c/src/exec/sapi/headers/mptables.h | 29 +++ c/src/exec/sapi/headers/sptables.h | 140 +++++++++++++ c/src/exec/sapi/include/rtems/config.h | 321 +++++++++++++++++++++++++++++ c/src/exec/sapi/include/rtems/directives.h | 108 ++++++++++ c/src/exec/sapi/include/rtems/extension.h | 169 +++++++++++++++ c/src/exec/sapi/include/rtems/fatal.h | 49 +++++ c/src/exec/sapi/include/rtems/init.h | 101 +++++++++ c/src/exec/sapi/include/rtems/io.h | 204 ++++++++++++++++++ c/src/exec/sapi/include/rtems/mptables.h | 29 +++ c/src/exec/sapi/include/rtems/sptables.h | 140 +++++++++++++ c/src/exec/sapi/inline/extension.inl | 73 +++++++ c/src/exec/sapi/inline/rtems/extension.inl | 73 +++++++ c/src/exec/sapi/macros/extension.inl | 58 ++++++ c/src/exec/sapi/macros/rtems/extension.inl | 58 ++++++ c/src/exec/sapi/optman/no-ext.c | 49 +++++ c/src/exec/sapi/optman/no-io.c | 95 +++++++++ c/src/exec/sapi/src/debug.c | 62 ++++++ c/src/exec/sapi/src/exinit.c | 245 ++++++++++++++++++++++ c/src/exec/sapi/src/extension.c | 156 ++++++++++++++ c/src/exec/sapi/src/fatal.c | 54 +++++ c/src/exec/sapi/src/io.c | 316 ++++++++++++++++++++++++++++ 27 files changed, 3481 insertions(+) create mode 100644 c/src/exec/sapi/headers/config.h create mode 100644 c/src/exec/sapi/headers/directives.h create mode 100644 c/src/exec/sapi/headers/extension.h create mode 100644 c/src/exec/sapi/headers/fatal.h create mode 100644 c/src/exec/sapi/headers/init.h create mode 100644 c/src/exec/sapi/headers/io.h create mode 100644 c/src/exec/sapi/headers/mptables.h create mode 100644 c/src/exec/sapi/headers/sptables.h create mode 100644 c/src/exec/sapi/include/rtems/config.h create mode 100644 c/src/exec/sapi/include/rtems/directives.h create mode 100644 c/src/exec/sapi/include/rtems/extension.h create mode 100644 c/src/exec/sapi/include/rtems/fatal.h create mode 100644 c/src/exec/sapi/include/rtems/init.h create mode 100644 c/src/exec/sapi/include/rtems/io.h create mode 100644 c/src/exec/sapi/include/rtems/mptables.h create mode 100644 c/src/exec/sapi/include/rtems/sptables.h create mode 100644 c/src/exec/sapi/inline/extension.inl create mode 100644 c/src/exec/sapi/inline/rtems/extension.inl create mode 100644 c/src/exec/sapi/macros/extension.inl create mode 100644 c/src/exec/sapi/macros/rtems/extension.inl create mode 100644 c/src/exec/sapi/optman/no-ext.c create mode 100644 c/src/exec/sapi/optman/no-io.c create mode 100644 c/src/exec/sapi/src/debug.c create mode 100644 c/src/exec/sapi/src/exinit.c create mode 100644 c/src/exec/sapi/src/extension.c create mode 100644 c/src/exec/sapi/src/fatal.c create mode 100644 c/src/exec/sapi/src/io.c (limited to 'c/src/exec/sapi') diff --git a/c/src/exec/sapi/headers/config.h b/c/src/exec/sapi/headers/config.h new file mode 100644 index 0000000000..b5080b6133 --- /dev/null +++ b/c/src/exec/sapi/headers/config.h @@ -0,0 +1,321 @@ +/* config.h + * + * This include file contains the table of user defined configuration + * parameters. + * + * 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$ + */ + +#ifndef __RTEMS_CONFIGURATION_h +#define __RTEMS_CONFIGURATION_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * 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 { + Objects_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 void rtems_device_driver; + +typedef rtems_device_driver ( *rtems_device_driver_entry )( + rtems_device_major_number, + rtems_device_minor_number, + void *, + Objects_Id, + unsigned32 * + ); + +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 */ + 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; + +/* + * 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. + */ + +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 */ +}; + +/* + * 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 + * + required number of each object type + * + microseconds per clock tick + * + clock ticks per task timeslice + */ + +struct Configuration_Table { + void *work_space_start; + unsigned32 work_space_size; + unsigned32 maximum_tasks; + unsigned32 maximum_timers; + unsigned32 maximum_semaphores; + unsigned32 maximum_message_queues; + unsigned32 maximum_messages; + unsigned32 maximum_partitions; + unsigned32 maximum_regions; + unsigned32 maximum_ports; + unsigned32 maximum_periods; + unsigned32 maximum_extensions; + unsigned32 microseconds_per_tick; + unsigned32 ticks_per_timeslice; + unsigned32 number_of_initialization_tasks; + rtems_initialization_tasks_table *User_initialization_tasks_table; + unsigned32 number_of_device_drivers; + 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 +); + +/* + * _Configuration_Is_null_initialization_tasks_table_pointer + * + * DESCRIPTION: + * + * This function returns TRUE if the_table is NULL and FALSE otherwise. + */ + +STATIC INLINE boolean + _Configuration_Is_null_initialization_tasks_table_pointer( + rtems_initialization_tasks_table *the_table +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/headers/directives.h b/c/src/exec/sapi/headers/directives.h new file mode 100644 index 0000000000..263811cdca --- /dev/null +++ b/c/src/exec/sapi/headers/directives.h @@ -0,0 +1,108 @@ +/* directives.h + * + * The following definitions are the directive numbers used + * in the assembly interface. + * + * COPYRIGHT (c) 19891990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government1994. + * + * 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. + */ + +#ifndef __RTEMS_DIRECTIVES_h +#define RTEMS___DIRECTIVES_h + +#ifdef __cplusplus +extern "C" { +#endif + +#define RTEMS_INITIALIZE_EXECUTIVE 0 +#define RTEMS_INITIALIZE_EXECUTIVE_EARLY 1 +#define RTEMS_INITIALIZE_EXECUTIVE_LATE 2 +#define RTEMS_SHUTDOWN_EXECUTIVE 3 +#define RTEMS_TASKS_CREATE 4 +#define RTEMS_TASKS_NAME_TO_ID 5 +#define RTEMS_TASKS_START 6 +#define RTEMS_TASKS_RESTART 7 +#define RTEMS_TASKS_DELETE 8 +#define RTEMS_TASKS_SUSPEND 9 +#define RTEMS_TASKS_RESUME 10 +#define RTEMS_TASKS_SET_PRIORITY 11 +#define RTEMS_TASKS_MODE 12 +#define RTEMS_TASKS_GET_NOTE 13 +#define RTEMS_TASKS_SET_NOTE 14 +#define RTEMS_TASKS_WAKE_AFTER 15 +#define RTEMS_TASKS_WAKE_WHEN 16 +#define RTEMS_INTERRUPT_CATCH 17 +#define RTEMS_CLOCK_SET 18 +#define RTEMS_CLOCK_GET 19 +#define RTEMS_CLOCK_TICK 20 +#define RTEMS_EXTENSION_CREATE 21 +#define RTEMS_EXTENSION_NAME_TO_ID 22 +#define RTEMS_EXTENSION_DELETE 23 +#define RTEMS_TIMER_CREATE 24 +#define RTEMS_TIMER_NAME_TO_ID 25 +#define RTEMS_TIMER_CANCEL 26 +#define RTEMS_TIMER_DELETE 27 +#define RTEMS_TIMER_FIRE_AFTER 28 +#define RTEMS_TIMER_FIRE_WHEN 29 +#define RTEMS_TIMER_RESET 30 +#define RTEMS_SEMAPHORE_CREATE 31 +#define RTEMS_SEMAPHORE_NAME_TO_ID 32 +#define RTEMS_SEMAPHORE_DELETE 33 +#define RTEMS_SEMAPHORE_OBTAIN 34 +#define RTEMS_SEMAPHORE_RELEASE 35 +#define RTEMS_MESSAGE_QUEUE_CREATE 36 +#define RTEMS_MESSAGE_QUEUE_NAME_TO_ID 37 +#define RTEMS_MESSAGE_QUEUE_DELETE 38 +#define RTEMS_MESSAGE_QUEUE_SEND 39 +#define RTEMS_MESSAGE_QUEUE_URGENT 40 +#define RTEMS_MESSAGE_QUEUE_BROADCAst 41 +#define RTEMS_MESSAGE_QUEUE_RECEIVE 42 +#define RTEMS_MESSAGE_QUEUE_FLUSH 43 +#define RTEMS_EVENT_SEND 44 +#define RTEMS_EVENT_RECEIVE 45 +#define RTEMS_SIGNAL_CATCH 46 +#define RTEMS_SIGNAL_SEND 47 +#define RTEMS_PARTITION_CREATE 48 +#define RTEMS_PARTITION_NAME_TO_ID 49 +#define RTEMS_PARTITION_DELETE 50 +#define RTEMS_PARTITION_GET_BUFFER 51 +#define RTEMS_PARTITION_RETURN_BUFFER 52 +#define RTEMS_REGION_CREATE 53 +#define RTEMS_REGION_EXTEND 54 +#define RTEMS_REGION_NAME_TO_ID 55 +#define RTEMS_REGION_DELETE 56 +#define RTEMS_REGION_GET_SEGMENT_SIZE 57 +#define RTEMS_REGION_GET_SEGMENT 58 +#define RTEMS_REGION_RETURN_SEGMENT 59 +#define RTEMS_DUAL_PORTED_MEMORY_CREATE 60 +#define RTEMS_DUAL_PORTED_MEMORY_NAME_TO_ID 61 +#define RTEMS_DUAL_PORTED_MEMORY_DELETE 62 +#define RTEMS_DUAL_PORTED_MEMORY_EXTERNAL_TO_INTERNAL 63 +#define RTEMS_DUAL_PORTED_MEMORY_INTERNAL_TO_EXTERNAL 64 +#define RTEMS_IO_INITIALIZE 65 +#define RTEMS_IO_OPEN 66 +#define RTEMS_IO_CLOSE 67 +#define RTEMS_IO_READ 68 +#define RTEMS_IO_WRITE 69 +#define RTEMS_IO_CONTROL 70 +#define RTEMS_FATAL_ERROR_OCCURRED 71 +#define RTEMS_RATE_MONOTONIC_CREATE 72 +#define RTEMS_RATE_MONOTONIC_NAME_TO_ID 73 +#define RTEMS_RATE_MONOTONIC_DELETE 74 +#define RTEMS_RATE_MONOTONIC_CANCEL 75 +#define RTEMS_RATE_MONOTONIC_PERIOD 76 +#define RTEMS_MULTIPROCESSING_ANNOUNCE 77 +#define RTEMS_DEBUG_ENABLE 78 +#define RTEMS_DEBUG_DISABLE 79 + +#ifdef __cplusplus +} +#endif + +#endif +/* end of directives.h */ diff --git a/c/src/exec/sapi/headers/extension.h b/c/src/exec/sapi/headers/extension.h new file mode 100644 index 0000000000..1e20fe6470 --- /dev/null +++ b/c/src/exec/sapi/headers/extension.h @@ -0,0 +1,169 @@ +/* extension.h + * + * This include file contains all the constants, structures, and + * prototypes associated with the User Extension Manager. This manager + * provides a mechanism for manipulating sets of user-defined extensions. + * + * Directives provided are: + * + * + create user extension set + * + get ID of user extension set + * + delete user extension set + * + * 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$ + */ + +#ifndef __RTEMS_EXTENSION_MANAGER_h +#define __RTEMS_EXTENSION_MANAGER_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +EXTERN Objects_Information _Extension_Information; + +/* + * The following records define the control block used to manage + * each extension. + */ + +typedef struct { + Objects_Control Object; + User_extensions_Control Extension; +} Extension_Control; + +/* + * _Extension_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _Extension_Manager_initialization( + unsigned32 maximum_extensions +); + +/* + * rtems_extension_create + * + * DESCRIPTION: + * + * This routine implements the rtems_extension_create directive. The + * extension will have the name name. The entry points of the + * routines which constitute this extension set are in EXTENSION_TABLE. + * It returns the id of the created extension in ID. + */ + +rtems_status_code rtems_extension_create( + Objects_Name name, + rtems_extensions_table *extension_table, + Objects_Id *id +); + +/* + * rtems_extension_ident + * + * DESCRIPTION: + * + * This routine implements the rtems_extension_ident directive. + * This directive returns the extension ID associated with name. + * If more than one extension is named name, then the extension + * to which the ID belongs is arbitrary. + */ + +rtems_status_code rtems_extension_ident( + Objects_Name name, + Objects_Id *id +); + +/* + * rtems_extension_delete + * + * DESCRIPTION: + * + * This routine implements the rtems_extension_delete directive. The + * extension indicated by ID is deleted. + */ + +rtems_status_code rtems_extension_delete( + Objects_Id id +); + +/* + * _Extension_Allocate + * + * DESCRIPTION: + * + * This function allocates a extension control block from + * the inactive chain of free extension control blocks. + */ + +STATIC INLINE Extension_Control *_Extension_Allocate( void ); + +/* + * _Extension_Free + * + * DESCRIPTION: + * + * This routine frees a extension control block to the + * inactive chain of free extension control blocks. + */ + +STATIC INLINE void _Extension_Free ( + Extension_Control *the_extension +); + +/* + * _Extension_Get + * + * DESCRIPTION: + * + * This function maps extension IDs to extension control blocks. + * If ID corresponds to a local extension, then it returns + * the extension control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. Otherwise, location is set + * to OBJECTS_ERROR and the returned value is undefined. + */ + +STATIC INLINE Extension_Control *_Extension_Get ( + Objects_Id id, + Objects_Locations *location +); + +/* + * _Extension_Is_null + * + * DESCRIPTION: + * + * This function returns TRUE if the_extension is NULL and FALSE otherwise. + */ + +STATIC INLINE boolean _Extension_Is_null( + Extension_Control *the_extension +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/headers/fatal.h b/c/src/exec/sapi/headers/fatal.h new file mode 100644 index 0000000000..f61b4183f3 --- /dev/null +++ b/c/src/exec/sapi/headers/fatal.h @@ -0,0 +1,49 @@ +/* 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, 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$ + */ + +#ifndef __RTEMS_FATAL_h +#define __RTEMS_FATAL_h + +#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 volatile rtems_fatal_error_occurred( + unsigned32 the_error +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/headers/init.h b/c/src/exec/sapi/headers/init.h new file mode 100644 index 0000000000..a5ed1688b7 --- /dev/null +++ b/c/src/exec/sapi/headers/init.h @@ -0,0 +1,101 @@ +/* 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, 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$ + */ + +#ifndef __RTEMS_INIT_h +#define __RTEMS_INIT_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * rtems_initialize_executive + * + * DESCRIPTION: + * + * This routine implements the rtems_initialize_executive directive. This + * directive is invoked at system startup to initialize the RTEMS + * multitasking environment. + */ + +void rtems_initialize_executive( + rtems_configuration_table *configuration_table, + rtems_cpu_table *cpu_table +); + +/* + * rtems_initialize_executive_early + * + * DESCRIPTION: + * + * 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. + */ + +rtems_interrupt_level rtems_initialize_executive_early( + rtems_configuration_table *configuration_table, + rtems_cpu_table *cpu_table +); + +/* + * rtems_initialize_executive_late + * + * DESCRIPTION: + * + * 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_executive_late( + rtems_interrupt_level bsp_level +); + +/* + * rtems_shutdown_executive + * + * DESCRIPTION: + * + * 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( + unsigned32 result +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/headers/io.h b/c/src/exec/sapi/headers/io.h new file mode 100644 index 0000000000..6824377170 --- /dev/null +++ b/c/src/exec/sapi/headers/io.h @@ -0,0 +1,204 @@ +/* io.h + * + * This include file contains all the constants and structures associated + * with the Input/Output Manager. This manager provides a well defined + * mechanism for accessing device drivers and a structured methodology for + * organizing device drivers. + * + * Directives provided are: + * + * + initialize a device driver + * + open a device driver + * + close a device driver + * + read from a device driver + * + write to a device driver + * + special device services + * + * 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$ + */ + +#ifndef __RTEMS_IO_h +#define __RTEMS_IO_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following type defines the set of IO operations which are + * recognized by _IO_Handler and can be supported by a RTEMS + * device driver. + */ + +typedef enum { + IO_INITIALIZE_OPERATION = 0, + IO_OPEN_OPERATION = 1, + IO_CLOSE_OPERATION = 2, + IO_READ_OPERATION = 3, + IO_WRITE_OPERATION = 4, + IO_CONTROL_OPERATION = 5 +} IO_operations; + +/* + * The following declare the data required to manage the Device Driver + * Address Table. + */ + +EXTERN unsigned32 _IO_Number_of_drivers; +EXTERN rtems_driver_address_table *_IO_Driver_address_table; + +/* + * _IO_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +STATIC INLINE void _IO_Manager_initialization( + rtems_driver_address_table *driver_table, + unsigned32 number_of_drivers +); + +/* + * rtems_io_initialize + * + * DESCRIPTION: + * + * This routine implements the rtems_io_initialize directive. It is invoked + * to initialize a device driver or an individual device. + */ + +rtems_status_code rtems_io_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_open + * + * DESCRIPTION: + * + * This routine implements the rtems_io_open directive. It is invoked + * to open a device. + */ + +rtems_status_code rtems_io_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_close + * + * DESCRIPTION: + * + * This routine implements the rtems_io_close directive. It is invoked + * to close a device. + */ + +rtems_status_code rtems_io_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_read + * + * DESCRIPTION: + * + * This routine implements the rtems_io_read directive. It is invoked + * to read from a device. + */ + +rtems_status_code rtems_io_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_write + * + * DESCRIPTION: + * + * This routine implements the rtems_io_write directive. It is invoked + * to write to a device. + */ + +rtems_status_code rtems_io_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_control + * + * DESCRIPTION: + * + * This routine implements the rtems_io_control directive. It is invoked + * to perform a device specific operation on a device. + */ + +rtems_status_code rtems_io_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * _IO_Initialize_all_drivers + * + * DESCRIPTION: + * + * This routine initializes all of the device drivers configured + * in the Device Driver Address Table. + */ + +void _IO_Initialize_all_drivers( void ); + +/* + * _IO_Handler_routine + * + * DESCRIPTION: + * + * This routine provides the common foundation for all of the IO + * Manager's directives. + */ + +rtems_status_code _IO_Handler_routine( + IO_operations operation, + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/headers/mptables.h b/c/src/exec/sapi/headers/mptables.h new file mode 100644 index 0000000000..b8e4c6de43 --- /dev/null +++ b/c/src/exec/sapi/headers/mptables.h @@ -0,0 +1,29 @@ +/* mptables.h + * + * This include file contains the executive's pre-initialized tables + * used in a multiprocessor configuration. + * + * 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$ + */ + +#ifndef __RTEMS_MPTABLES_h +#define __RTEMS_MPTABLES_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/headers/sptables.h b/c/src/exec/sapi/headers/sptables.h new file mode 100644 index 0000000000..53dc50df5f --- /dev/null +++ b/c/src/exec/sapi/headers/sptables.h @@ -0,0 +1,140 @@ +/* sptables.h + * + * This include file contains the executive's pre-initialized tables + * used when in a single processor configuration. + * + * 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$ + */ + +#ifndef __RTEMS_SPTABLES_h +#define __RTEMS_SPTABLES_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * This is the default Multiprocessing Configuration Table. + * It is used in single processor configurations. + */ + +const rtems_multiprocessing_table + _Configuration_Default_multiprocessing_table = { + 1, /* local node number */ + 1, /* maximum number nodes in system */ + 0, /* maximum number global objects */ + 0, /* maximum number proxies */ + NULL, /* pointer to MPCI address table */ +}; + +/* + * This is the version string. + */ + +const char _RTEMS_version[] = + "RTEMS RELEASE V3.1.15 (" CPU_NAME "/" RTEMS_MODEL_NAME ")"; + + +/* + * This table is used by the single entry point code. + */ + +const void * _Entry_points[ NUMBER_OF_ENTRY_POINTS + 1 ] = { + (void *) rtems_initialize_executive, /* 0 */ + (void *) rtems_initialize_executive_early, /* 1 */ + (void *) rtems_initialize_executive_late, /* 2 */ + (void *) rtems_shutdown_executive, /* 3 */ + (void *) rtems_task_create, /* 4 */ + (void *) rtems_task_ident, /* 5 */ + (void *) rtems_task_start, /* 6 */ + (void *) rtems_task_restart, /* 7 */ + (void *) rtems_task_delete, /* 8 */ + (void *) rtems_task_suspend, /* 9 */ + (void *) rtems_task_resume, /* 10 */ + (void *) rtems_task_set_priority, /* 11 */ + (void *) rtems_task_mode, /* 12 */ + (void *) rtems_task_get_note, /* 13 */ + (void *) rtems_task_set_note, /* 14 */ + (void *) rtems_task_wake_after, /* 15 */ + (void *) rtems_task_wake_when, /* 16 */ + (void *) rtems_interrupt_catch, /* 17 */ + (void *) rtems_clock_set, /* 18 */ + (void *) rtems_clock_get, /* 19 */ + (void *) rtems_clock_tick, /* 20 */ + (void *) rtems_extension_create, /* 21 */ + (void *) rtems_extension_ident, /* 22 */ + (void *) rtems_extension_delete, /* 23 */ + (void *) rtems_timer_create, /* 24 */ + (void *) rtems_timer_ident, /* 25 */ + (void *) rtems_timer_cancel, /* 26 */ + (void *) rtems_timer_delete, /* 27 */ + (void *) rtems_timer_fire_after, /* 28 */ + (void *) rtems_timer_fire_when, /* 29 */ + (void *) rtems_timer_reset, /* 30 */ + (void *) rtems_semaphore_create, /* 31 */ + (void *) rtems_semaphore_ident, /* 32 */ + (void *) rtems_semaphore_delete, /* 33 */ + (void *) rtems_semaphore_obtain, /* 34 */ + (void *) rtems_semaphore_release, /* 35 */ + (void *) rtems_message_queue_create, /* 36 */ + (void *) rtems_message_queue_ident, /* 37 */ + (void *) rtems_message_queue_delete, /* 38 */ + (void *) rtems_message_queue_send, /* 39 */ + (void *) rtems_message_queue_urgent, /* 40 */ + (void *) rtems_message_queue_broadcast, /* 41 */ + (void *) rtems_message_queue_receive, /* 42 */ + (void *) rtems_message_queue_flush, /* 43 */ + (void *) rtems_event_send, /* 44 */ + (void *) rtems_event_receive, /* 45 */ + (void *) rtems_signal_catch, /* 46 */ + (void *) rtems_signal_send, /* 47 */ + (void *) rtems_partition_create, /* 48 */ + (void *) rtems_partition_ident, /* 49 */ + (void *) rtems_partition_delete, /* 50 */ + (void *) rtems_partition_get_buffer, /* 51 */ + (void *) rtems_partition_return_buffer, /* 52 */ + (void *) rtems_region_create, /* 53 */ + (void *) rtems_region_extend, /* 54 */ + (void *) rtems_region_ident, /* 55 */ + (void *) rtems_region_delete, /* 56 */ + (void *) rtems_region_get_segment, /* 57 */ + (void *) rtems_region_get_segment_size, /* 58 */ + (void *) rtems_region_return_segment, /* 59 */ + (void *) rtems_port_create, /* 60 */ + (void *) rtems_port_ident, /* 61 */ + (void *) rtems_port_delete, /* 62 */ + (void *) rtems_port_external_to_internal, /* 63 */ + (void *) rtems_port_internal_to_external, /* 64 */ + (void *) rtems_io_initialize, /* 65 */ + (void *) rtems_io_open, /* 66 */ + (void *) rtems_io_close, /* 67 */ + (void *) rtems_io_read, /* 68 */ + (void *) rtems_io_write, /* 69 */ + (void *) rtems_io_control, /* 70 */ + (void *) rtems_fatal_error_occurred, /* 71 */ + (void *) rtems_rate_monotonic_create, /* 72 */ + (void *) rtems_rate_monotonic_ident, /* 73 */ + (void *) rtems_rate_monotonic_delete, /* 74 */ + (void *) rtems_rate_monotonic_cancel, /* 75 */ + (void *) rtems_rate_monotonic_period, /* 76 */ + (void *) rtems_multiprocessing_announce, /* 77 */ + (void *) rtems_debug_enable, /* 78 */ + (void *) rtems_debug_disable /* 79 */ +}; + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/include/rtems/config.h b/c/src/exec/sapi/include/rtems/config.h new file mode 100644 index 0000000000..b5080b6133 --- /dev/null +++ b/c/src/exec/sapi/include/rtems/config.h @@ -0,0 +1,321 @@ +/* config.h + * + * This include file contains the table of user defined configuration + * parameters. + * + * 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$ + */ + +#ifndef __RTEMS_CONFIGURATION_h +#define __RTEMS_CONFIGURATION_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * 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 { + Objects_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 void rtems_device_driver; + +typedef rtems_device_driver ( *rtems_device_driver_entry )( + rtems_device_major_number, + rtems_device_minor_number, + void *, + Objects_Id, + unsigned32 * + ); + +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 */ + 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; + +/* + * 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. + */ + +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 */ +}; + +/* + * 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 + * + required number of each object type + * + microseconds per clock tick + * + clock ticks per task timeslice + */ + +struct Configuration_Table { + void *work_space_start; + unsigned32 work_space_size; + unsigned32 maximum_tasks; + unsigned32 maximum_timers; + unsigned32 maximum_semaphores; + unsigned32 maximum_message_queues; + unsigned32 maximum_messages; + unsigned32 maximum_partitions; + unsigned32 maximum_regions; + unsigned32 maximum_ports; + unsigned32 maximum_periods; + unsigned32 maximum_extensions; + unsigned32 microseconds_per_tick; + unsigned32 ticks_per_timeslice; + unsigned32 number_of_initialization_tasks; + rtems_initialization_tasks_table *User_initialization_tasks_table; + unsigned32 number_of_device_drivers; + 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 +); + +/* + * _Configuration_Is_null_initialization_tasks_table_pointer + * + * DESCRIPTION: + * + * This function returns TRUE if the_table is NULL and FALSE otherwise. + */ + +STATIC INLINE boolean + _Configuration_Is_null_initialization_tasks_table_pointer( + rtems_initialization_tasks_table *the_table +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/include/rtems/directives.h b/c/src/exec/sapi/include/rtems/directives.h new file mode 100644 index 0000000000..263811cdca --- /dev/null +++ b/c/src/exec/sapi/include/rtems/directives.h @@ -0,0 +1,108 @@ +/* directives.h + * + * The following definitions are the directive numbers used + * in the assembly interface. + * + * COPYRIGHT (c) 19891990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government1994. + * + * 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. + */ + +#ifndef __RTEMS_DIRECTIVES_h +#define RTEMS___DIRECTIVES_h + +#ifdef __cplusplus +extern "C" { +#endif + +#define RTEMS_INITIALIZE_EXECUTIVE 0 +#define RTEMS_INITIALIZE_EXECUTIVE_EARLY 1 +#define RTEMS_INITIALIZE_EXECUTIVE_LATE 2 +#define RTEMS_SHUTDOWN_EXECUTIVE 3 +#define RTEMS_TASKS_CREATE 4 +#define RTEMS_TASKS_NAME_TO_ID 5 +#define RTEMS_TASKS_START 6 +#define RTEMS_TASKS_RESTART 7 +#define RTEMS_TASKS_DELETE 8 +#define RTEMS_TASKS_SUSPEND 9 +#define RTEMS_TASKS_RESUME 10 +#define RTEMS_TASKS_SET_PRIORITY 11 +#define RTEMS_TASKS_MODE 12 +#define RTEMS_TASKS_GET_NOTE 13 +#define RTEMS_TASKS_SET_NOTE 14 +#define RTEMS_TASKS_WAKE_AFTER 15 +#define RTEMS_TASKS_WAKE_WHEN 16 +#define RTEMS_INTERRUPT_CATCH 17 +#define RTEMS_CLOCK_SET 18 +#define RTEMS_CLOCK_GET 19 +#define RTEMS_CLOCK_TICK 20 +#define RTEMS_EXTENSION_CREATE 21 +#define RTEMS_EXTENSION_NAME_TO_ID 22 +#define RTEMS_EXTENSION_DELETE 23 +#define RTEMS_TIMER_CREATE 24 +#define RTEMS_TIMER_NAME_TO_ID 25 +#define RTEMS_TIMER_CANCEL 26 +#define RTEMS_TIMER_DELETE 27 +#define RTEMS_TIMER_FIRE_AFTER 28 +#define RTEMS_TIMER_FIRE_WHEN 29 +#define RTEMS_TIMER_RESET 30 +#define RTEMS_SEMAPHORE_CREATE 31 +#define RTEMS_SEMAPHORE_NAME_TO_ID 32 +#define RTEMS_SEMAPHORE_DELETE 33 +#define RTEMS_SEMAPHORE_OBTAIN 34 +#define RTEMS_SEMAPHORE_RELEASE 35 +#define RTEMS_MESSAGE_QUEUE_CREATE 36 +#define RTEMS_MESSAGE_QUEUE_NAME_TO_ID 37 +#define RTEMS_MESSAGE_QUEUE_DELETE 38 +#define RTEMS_MESSAGE_QUEUE_SEND 39 +#define RTEMS_MESSAGE_QUEUE_URGENT 40 +#define RTEMS_MESSAGE_QUEUE_BROADCAst 41 +#define RTEMS_MESSAGE_QUEUE_RECEIVE 42 +#define RTEMS_MESSAGE_QUEUE_FLUSH 43 +#define RTEMS_EVENT_SEND 44 +#define RTEMS_EVENT_RECEIVE 45 +#define RTEMS_SIGNAL_CATCH 46 +#define RTEMS_SIGNAL_SEND 47 +#define RTEMS_PARTITION_CREATE 48 +#define RTEMS_PARTITION_NAME_TO_ID 49 +#define RTEMS_PARTITION_DELETE 50 +#define RTEMS_PARTITION_GET_BUFFER 51 +#define RTEMS_PARTITION_RETURN_BUFFER 52 +#define RTEMS_REGION_CREATE 53 +#define RTEMS_REGION_EXTEND 54 +#define RTEMS_REGION_NAME_TO_ID 55 +#define RTEMS_REGION_DELETE 56 +#define RTEMS_REGION_GET_SEGMENT_SIZE 57 +#define RTEMS_REGION_GET_SEGMENT 58 +#define RTEMS_REGION_RETURN_SEGMENT 59 +#define RTEMS_DUAL_PORTED_MEMORY_CREATE 60 +#define RTEMS_DUAL_PORTED_MEMORY_NAME_TO_ID 61 +#define RTEMS_DUAL_PORTED_MEMORY_DELETE 62 +#define RTEMS_DUAL_PORTED_MEMORY_EXTERNAL_TO_INTERNAL 63 +#define RTEMS_DUAL_PORTED_MEMORY_INTERNAL_TO_EXTERNAL 64 +#define RTEMS_IO_INITIALIZE 65 +#define RTEMS_IO_OPEN 66 +#define RTEMS_IO_CLOSE 67 +#define RTEMS_IO_READ 68 +#define RTEMS_IO_WRITE 69 +#define RTEMS_IO_CONTROL 70 +#define RTEMS_FATAL_ERROR_OCCURRED 71 +#define RTEMS_RATE_MONOTONIC_CREATE 72 +#define RTEMS_RATE_MONOTONIC_NAME_TO_ID 73 +#define RTEMS_RATE_MONOTONIC_DELETE 74 +#define RTEMS_RATE_MONOTONIC_CANCEL 75 +#define RTEMS_RATE_MONOTONIC_PERIOD 76 +#define RTEMS_MULTIPROCESSING_ANNOUNCE 77 +#define RTEMS_DEBUG_ENABLE 78 +#define RTEMS_DEBUG_DISABLE 79 + +#ifdef __cplusplus +} +#endif + +#endif +/* end of directives.h */ diff --git a/c/src/exec/sapi/include/rtems/extension.h b/c/src/exec/sapi/include/rtems/extension.h new file mode 100644 index 0000000000..1e20fe6470 --- /dev/null +++ b/c/src/exec/sapi/include/rtems/extension.h @@ -0,0 +1,169 @@ +/* extension.h + * + * This include file contains all the constants, structures, and + * prototypes associated with the User Extension Manager. This manager + * provides a mechanism for manipulating sets of user-defined extensions. + * + * Directives provided are: + * + * + create user extension set + * + get ID of user extension set + * + delete user extension set + * + * 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$ + */ + +#ifndef __RTEMS_EXTENSION_MANAGER_h +#define __RTEMS_EXTENSION_MANAGER_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +EXTERN Objects_Information _Extension_Information; + +/* + * The following records define the control block used to manage + * each extension. + */ + +typedef struct { + Objects_Control Object; + User_extensions_Control Extension; +} Extension_Control; + +/* + * _Extension_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _Extension_Manager_initialization( + unsigned32 maximum_extensions +); + +/* + * rtems_extension_create + * + * DESCRIPTION: + * + * This routine implements the rtems_extension_create directive. The + * extension will have the name name. The entry points of the + * routines which constitute this extension set are in EXTENSION_TABLE. + * It returns the id of the created extension in ID. + */ + +rtems_status_code rtems_extension_create( + Objects_Name name, + rtems_extensions_table *extension_table, + Objects_Id *id +); + +/* + * rtems_extension_ident + * + * DESCRIPTION: + * + * This routine implements the rtems_extension_ident directive. + * This directive returns the extension ID associated with name. + * If more than one extension is named name, then the extension + * to which the ID belongs is arbitrary. + */ + +rtems_status_code rtems_extension_ident( + Objects_Name name, + Objects_Id *id +); + +/* + * rtems_extension_delete + * + * DESCRIPTION: + * + * This routine implements the rtems_extension_delete directive. The + * extension indicated by ID is deleted. + */ + +rtems_status_code rtems_extension_delete( + Objects_Id id +); + +/* + * _Extension_Allocate + * + * DESCRIPTION: + * + * This function allocates a extension control block from + * the inactive chain of free extension control blocks. + */ + +STATIC INLINE Extension_Control *_Extension_Allocate( void ); + +/* + * _Extension_Free + * + * DESCRIPTION: + * + * This routine frees a extension control block to the + * inactive chain of free extension control blocks. + */ + +STATIC INLINE void _Extension_Free ( + Extension_Control *the_extension +); + +/* + * _Extension_Get + * + * DESCRIPTION: + * + * This function maps extension IDs to extension control blocks. + * If ID corresponds to a local extension, then it returns + * the extension control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. Otherwise, location is set + * to OBJECTS_ERROR and the returned value is undefined. + */ + +STATIC INLINE Extension_Control *_Extension_Get ( + Objects_Id id, + Objects_Locations *location +); + +/* + * _Extension_Is_null + * + * DESCRIPTION: + * + * This function returns TRUE if the_extension is NULL and FALSE otherwise. + */ + +STATIC INLINE boolean _Extension_Is_null( + Extension_Control *the_extension +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/include/rtems/fatal.h b/c/src/exec/sapi/include/rtems/fatal.h new file mode 100644 index 0000000000..f61b4183f3 --- /dev/null +++ b/c/src/exec/sapi/include/rtems/fatal.h @@ -0,0 +1,49 @@ +/* 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, 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$ + */ + +#ifndef __RTEMS_FATAL_h +#define __RTEMS_FATAL_h + +#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 volatile rtems_fatal_error_occurred( + unsigned32 the_error +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/include/rtems/init.h b/c/src/exec/sapi/include/rtems/init.h new file mode 100644 index 0000000000..a5ed1688b7 --- /dev/null +++ b/c/src/exec/sapi/include/rtems/init.h @@ -0,0 +1,101 @@ +/* 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, 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$ + */ + +#ifndef __RTEMS_INIT_h +#define __RTEMS_INIT_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * rtems_initialize_executive + * + * DESCRIPTION: + * + * This routine implements the rtems_initialize_executive directive. This + * directive is invoked at system startup to initialize the RTEMS + * multitasking environment. + */ + +void rtems_initialize_executive( + rtems_configuration_table *configuration_table, + rtems_cpu_table *cpu_table +); + +/* + * rtems_initialize_executive_early + * + * DESCRIPTION: + * + * 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. + */ + +rtems_interrupt_level rtems_initialize_executive_early( + rtems_configuration_table *configuration_table, + rtems_cpu_table *cpu_table +); + +/* + * rtems_initialize_executive_late + * + * DESCRIPTION: + * + * 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_executive_late( + rtems_interrupt_level bsp_level +); + +/* + * rtems_shutdown_executive + * + * DESCRIPTION: + * + * 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( + unsigned32 result +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/include/rtems/io.h b/c/src/exec/sapi/include/rtems/io.h new file mode 100644 index 0000000000..6824377170 --- /dev/null +++ b/c/src/exec/sapi/include/rtems/io.h @@ -0,0 +1,204 @@ +/* io.h + * + * This include file contains all the constants and structures associated + * with the Input/Output Manager. This manager provides a well defined + * mechanism for accessing device drivers and a structured methodology for + * organizing device drivers. + * + * Directives provided are: + * + * + initialize a device driver + * + open a device driver + * + close a device driver + * + read from a device driver + * + write to a device driver + * + special device services + * + * 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$ + */ + +#ifndef __RTEMS_IO_h +#define __RTEMS_IO_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following type defines the set of IO operations which are + * recognized by _IO_Handler and can be supported by a RTEMS + * device driver. + */ + +typedef enum { + IO_INITIALIZE_OPERATION = 0, + IO_OPEN_OPERATION = 1, + IO_CLOSE_OPERATION = 2, + IO_READ_OPERATION = 3, + IO_WRITE_OPERATION = 4, + IO_CONTROL_OPERATION = 5 +} IO_operations; + +/* + * The following declare the data required to manage the Device Driver + * Address Table. + */ + +EXTERN unsigned32 _IO_Number_of_drivers; +EXTERN rtems_driver_address_table *_IO_Driver_address_table; + +/* + * _IO_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +STATIC INLINE void _IO_Manager_initialization( + rtems_driver_address_table *driver_table, + unsigned32 number_of_drivers +); + +/* + * rtems_io_initialize + * + * DESCRIPTION: + * + * This routine implements the rtems_io_initialize directive. It is invoked + * to initialize a device driver or an individual device. + */ + +rtems_status_code rtems_io_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_open + * + * DESCRIPTION: + * + * This routine implements the rtems_io_open directive. It is invoked + * to open a device. + */ + +rtems_status_code rtems_io_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_close + * + * DESCRIPTION: + * + * This routine implements the rtems_io_close directive. It is invoked + * to close a device. + */ + +rtems_status_code rtems_io_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_read + * + * DESCRIPTION: + * + * This routine implements the rtems_io_read directive. It is invoked + * to read from a device. + */ + +rtems_status_code rtems_io_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_write + * + * DESCRIPTION: + * + * This routine implements the rtems_io_write directive. It is invoked + * to write to a device. + */ + +rtems_status_code rtems_io_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * rtems_io_control + * + * DESCRIPTION: + * + * This routine implements the rtems_io_control directive. It is invoked + * to perform a device specific operation on a device. + */ + +rtems_status_code rtems_io_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +/* + * _IO_Initialize_all_drivers + * + * DESCRIPTION: + * + * This routine initializes all of the device drivers configured + * in the Device Driver Address Table. + */ + +void _IO_Initialize_all_drivers( void ); + +/* + * _IO_Handler_routine + * + * DESCRIPTION: + * + * This routine provides the common foundation for all of the IO + * Manager's directives. + */ + +rtems_status_code _IO_Handler_routine( + IO_operations operation, + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/include/rtems/mptables.h b/c/src/exec/sapi/include/rtems/mptables.h new file mode 100644 index 0000000000..b8e4c6de43 --- /dev/null +++ b/c/src/exec/sapi/include/rtems/mptables.h @@ -0,0 +1,29 @@ +/* mptables.h + * + * This include file contains the executive's pre-initialized tables + * used in a multiprocessor configuration. + * + * 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$ + */ + +#ifndef __RTEMS_MPTABLES_h +#define __RTEMS_MPTABLES_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/include/rtems/sptables.h b/c/src/exec/sapi/include/rtems/sptables.h new file mode 100644 index 0000000000..53dc50df5f --- /dev/null +++ b/c/src/exec/sapi/include/rtems/sptables.h @@ -0,0 +1,140 @@ +/* sptables.h + * + * This include file contains the executive's pre-initialized tables + * used when in a single processor configuration. + * + * 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$ + */ + +#ifndef __RTEMS_SPTABLES_h +#define __RTEMS_SPTABLES_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * This is the default Multiprocessing Configuration Table. + * It is used in single processor configurations. + */ + +const rtems_multiprocessing_table + _Configuration_Default_multiprocessing_table = { + 1, /* local node number */ + 1, /* maximum number nodes in system */ + 0, /* maximum number global objects */ + 0, /* maximum number proxies */ + NULL, /* pointer to MPCI address table */ +}; + +/* + * This is the version string. + */ + +const char _RTEMS_version[] = + "RTEMS RELEASE V3.1.15 (" CPU_NAME "/" RTEMS_MODEL_NAME ")"; + + +/* + * This table is used by the single entry point code. + */ + +const void * _Entry_points[ NUMBER_OF_ENTRY_POINTS + 1 ] = { + (void *) rtems_initialize_executive, /* 0 */ + (void *) rtems_initialize_executive_early, /* 1 */ + (void *) rtems_initialize_executive_late, /* 2 */ + (void *) rtems_shutdown_executive, /* 3 */ + (void *) rtems_task_create, /* 4 */ + (void *) rtems_task_ident, /* 5 */ + (void *) rtems_task_start, /* 6 */ + (void *) rtems_task_restart, /* 7 */ + (void *) rtems_task_delete, /* 8 */ + (void *) rtems_task_suspend, /* 9 */ + (void *) rtems_task_resume, /* 10 */ + (void *) rtems_task_set_priority, /* 11 */ + (void *) rtems_task_mode, /* 12 */ + (void *) rtems_task_get_note, /* 13 */ + (void *) rtems_task_set_note, /* 14 */ + (void *) rtems_task_wake_after, /* 15 */ + (void *) rtems_task_wake_when, /* 16 */ + (void *) rtems_interrupt_catch, /* 17 */ + (void *) rtems_clock_set, /* 18 */ + (void *) rtems_clock_get, /* 19 */ + (void *) rtems_clock_tick, /* 20 */ + (void *) rtems_extension_create, /* 21 */ + (void *) rtems_extension_ident, /* 22 */ + (void *) rtems_extension_delete, /* 23 */ + (void *) rtems_timer_create, /* 24 */ + (void *) rtems_timer_ident, /* 25 */ + (void *) rtems_timer_cancel, /* 26 */ + (void *) rtems_timer_delete, /* 27 */ + (void *) rtems_timer_fire_after, /* 28 */ + (void *) rtems_timer_fire_when, /* 29 */ + (void *) rtems_timer_reset, /* 30 */ + (void *) rtems_semaphore_create, /* 31 */ + (void *) rtems_semaphore_ident, /* 32 */ + (void *) rtems_semaphore_delete, /* 33 */ + (void *) rtems_semaphore_obtain, /* 34 */ + (void *) rtems_semaphore_release, /* 35 */ + (void *) rtems_message_queue_create, /* 36 */ + (void *) rtems_message_queue_ident, /* 37 */ + (void *) rtems_message_queue_delete, /* 38 */ + (void *) rtems_message_queue_send, /* 39 */ + (void *) rtems_message_queue_urgent, /* 40 */ + (void *) rtems_message_queue_broadcast, /* 41 */ + (void *) rtems_message_queue_receive, /* 42 */ + (void *) rtems_message_queue_flush, /* 43 */ + (void *) rtems_event_send, /* 44 */ + (void *) rtems_event_receive, /* 45 */ + (void *) rtems_signal_catch, /* 46 */ + (void *) rtems_signal_send, /* 47 */ + (void *) rtems_partition_create, /* 48 */ + (void *) rtems_partition_ident, /* 49 */ + (void *) rtems_partition_delete, /* 50 */ + (void *) rtems_partition_get_buffer, /* 51 */ + (void *) rtems_partition_return_buffer, /* 52 */ + (void *) rtems_region_create, /* 53 */ + (void *) rtems_region_extend, /* 54 */ + (void *) rtems_region_ident, /* 55 */ + (void *) rtems_region_delete, /* 56 */ + (void *) rtems_region_get_segment, /* 57 */ + (void *) rtems_region_get_segment_size, /* 58 */ + (void *) rtems_region_return_segment, /* 59 */ + (void *) rtems_port_create, /* 60 */ + (void *) rtems_port_ident, /* 61 */ + (void *) rtems_port_delete, /* 62 */ + (void *) rtems_port_external_to_internal, /* 63 */ + (void *) rtems_port_internal_to_external, /* 64 */ + (void *) rtems_io_initialize, /* 65 */ + (void *) rtems_io_open, /* 66 */ + (void *) rtems_io_close, /* 67 */ + (void *) rtems_io_read, /* 68 */ + (void *) rtems_io_write, /* 69 */ + (void *) rtems_io_control, /* 70 */ + (void *) rtems_fatal_error_occurred, /* 71 */ + (void *) rtems_rate_monotonic_create, /* 72 */ + (void *) rtems_rate_monotonic_ident, /* 73 */ + (void *) rtems_rate_monotonic_delete, /* 74 */ + (void *) rtems_rate_monotonic_cancel, /* 75 */ + (void *) rtems_rate_monotonic_period, /* 76 */ + (void *) rtems_multiprocessing_announce, /* 77 */ + (void *) rtems_debug_enable, /* 78 */ + (void *) rtems_debug_disable /* 79 */ +}; + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/inline/extension.inl b/c/src/exec/sapi/inline/extension.inl new file mode 100644 index 0000000000..27941923b0 --- /dev/null +++ b/c/src/exec/sapi/inline/extension.inl @@ -0,0 +1,73 @@ +/* extension.inl + * + * This file contains the static inline implementation of the inlined routines + * from the Extension Manager. + * + * 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$ + */ + +#ifndef __EXTENSION_MANAGER_inl +#define __EXTENSION_MANAGER_inl + +/*PAGE + * + * _Extension_Allocate + * + */ + +STATIC INLINE Extension_Control *_Extension_Allocate( void ) +{ + return (Extension_Control *) _Objects_Allocate( &_Extension_Information ); +} + +/*PAGE + * + * _Extension_Free + * + */ + +STATIC INLINE void _Extension_Free ( + Extension_Control *the_extension +) +{ + _Objects_Free( &_Extension_Information, &the_extension->Object ); +} + +/*PAGE + * + * _Extension_Get + * + */ + +STATIC INLINE Extension_Control *_Extension_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Extension_Control *) + _Objects_Get( &_Extension_Information, id, location ); +} + +/*PAGE + * + * _Extension_Is_null + * + */ + +STATIC INLINE boolean _Extension_Is_null ( + Extension_Control *the_extension +) +{ + return ( the_extension == NULL ); +} + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/inline/rtems/extension.inl b/c/src/exec/sapi/inline/rtems/extension.inl new file mode 100644 index 0000000000..27941923b0 --- /dev/null +++ b/c/src/exec/sapi/inline/rtems/extension.inl @@ -0,0 +1,73 @@ +/* extension.inl + * + * This file contains the static inline implementation of the inlined routines + * from the Extension Manager. + * + * 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$ + */ + +#ifndef __EXTENSION_MANAGER_inl +#define __EXTENSION_MANAGER_inl + +/*PAGE + * + * _Extension_Allocate + * + */ + +STATIC INLINE Extension_Control *_Extension_Allocate( void ) +{ + return (Extension_Control *) _Objects_Allocate( &_Extension_Information ); +} + +/*PAGE + * + * _Extension_Free + * + */ + +STATIC INLINE void _Extension_Free ( + Extension_Control *the_extension +) +{ + _Objects_Free( &_Extension_Information, &the_extension->Object ); +} + +/*PAGE + * + * _Extension_Get + * + */ + +STATIC INLINE Extension_Control *_Extension_Get ( + Objects_Id id, + Objects_Locations *location +) +{ + return (Extension_Control *) + _Objects_Get( &_Extension_Information, id, location ); +} + +/*PAGE + * + * _Extension_Is_null + * + */ + +STATIC INLINE boolean _Extension_Is_null ( + Extension_Control *the_extension +) +{ + return ( the_extension == NULL ); +} + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/macros/extension.inl b/c/src/exec/sapi/macros/extension.inl new file mode 100644 index 0000000000..96fb9d1b3e --- /dev/null +++ b/c/src/exec/sapi/macros/extension.inl @@ -0,0 +1,58 @@ +/* extension.inl + * + * This file contains the macro implementation of the inlined routines + * from the Extension Manager. + * + * 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$ + */ + +#ifndef __EXTENSION_inl +#define __EXTENSION_inl + +/*PAGE + * + * _Extension_Allocate + * + */ + +#define _Extension_Allocate() \ + (Extension_Control *) _Objects_Allocate( &_Extension_Information ) + +/*PAGE + * + * _Extension_Free + * + */ + +#define _Extension_Free( _the_extension ) \ + _Objects_Free( &_Extension_Information, &(_the_extension)->Object ) + +/*PAGE + * + * _Extension_Get + * + */ + +#define _Extension_Get( _id, _location ) \ + (Extension_Control *) \ + _Objects_Get( &_Extension_Information, (_id), (_location) ) + +/*PAGE + * + * _Extension_Is_null + * + */ + +#define _Extension_Is_null( _the_extension ) \ + ( (_the_extension) == NULL ) + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/macros/rtems/extension.inl b/c/src/exec/sapi/macros/rtems/extension.inl new file mode 100644 index 0000000000..96fb9d1b3e --- /dev/null +++ b/c/src/exec/sapi/macros/rtems/extension.inl @@ -0,0 +1,58 @@ +/* extension.inl + * + * This file contains the macro implementation of the inlined routines + * from the Extension Manager. + * + * 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$ + */ + +#ifndef __EXTENSION_inl +#define __EXTENSION_inl + +/*PAGE + * + * _Extension_Allocate + * + */ + +#define _Extension_Allocate() \ + (Extension_Control *) _Objects_Allocate( &_Extension_Information ) + +/*PAGE + * + * _Extension_Free + * + */ + +#define _Extension_Free( _the_extension ) \ + _Objects_Free( &_Extension_Information, &(_the_extension)->Object ) + +/*PAGE + * + * _Extension_Get + * + */ + +#define _Extension_Get( _id, _location ) \ + (Extension_Control *) \ + _Objects_Get( &_Extension_Information, (_id), (_location) ) + +/*PAGE + * + * _Extension_Is_null + * + */ + +#define _Extension_Is_null( _the_extension ) \ + ( (_the_extension) == NULL ) + +#endif +/* end of include file */ diff --git a/c/src/exec/sapi/optman/no-ext.c b/c/src/exec/sapi/optman/no-ext.c new file mode 100644 index 0000000000..4d707c3a49 --- /dev/null +++ b/c/src/exec/sapi/optman/no-ext.c @@ -0,0 +1,49 @@ +/* + * Extension Manager + * + * + * 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 +#include +#include +#include + +void _Extension_Manager_initialization( + unsigned32 maximum_extensions +) +{ +} + +rtems_status_code rtems_extension_create( + Objects_Name name, + rtems_extensions_table *extension_table, + Objects_Id *id +) +{ + return( RTEMS_NOT_CONFIGURED ); +} + +rtems_status_code rtems_extension_ident( + Objects_Name name, + Objects_Id *id +) +{ + return( RTEMS_NOT_CONFIGURED ); +} + +rtems_status_code rtems_extension_delete( + Objects_Id id +) +{ + return( RTEMS_NOT_CONFIGURED ); +} diff --git a/c/src/exec/sapi/optman/no-io.c b/c/src/exec/sapi/optman/no-io.c new file mode 100644 index 0000000000..177ec4b091 --- /dev/null +++ b/c/src/exec/sapi/optman/no-io.c @@ -0,0 +1,95 @@ +/* + * Input/Output Manager + * + * + * 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 +#include +#include +#include +#include + +void _IO_Initialize_all_drivers( void ) +{ +} + +rtems_status_code rtems_io_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return( RTEMS_NOT_CONFIGURED ); +} + +rtems_status_code rtems_io_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return( RTEMS_NOT_CONFIGURED ); +} + +rtems_status_code rtems_io_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return( RTEMS_NOT_CONFIGURED ); +} + +rtems_status_code rtems_io_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return( RTEMS_NOT_CONFIGURED ); +} + +rtems_status_code rtems_io_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return( RTEMS_NOT_CONFIGURED ); +} + +rtems_status_code rtems_io_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return( RTEMS_NOT_CONFIGURED ); +} + +rtems_status_code _IO_Handler_routine( + IO_operations operation, + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return( RTEMS_NOT_CONFIGURED ); +} diff --git a/c/src/exec/sapi/src/debug.c b/c/src/exec/sapi/src/debug.c new file mode 100644 index 0000000000..5c42fa92f6 --- /dev/null +++ b/c/src/exec/sapi/src/debug.c @@ -0,0 +1,62 @@ +/* + * Debug Manager + * + * 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 +#include + +/*PAGE + * + * _Debug_Manager_initialization + */ + +void _Debug_Manager_initialization( void ) +{ + rtems_debug_disable( RTEMS_DEBUG_ALL_MASK ); +} + +/*PAGE + * + * rtems_debug_enable + */ + +void rtems_debug_enable ( + rtems_debug_control to_be_enabled +) +{ + _Debug_Level |= to_be_enabled; +} + +/*PAGE + * + * rtems_debug_disable + */ + +void rtems_debug_disable ( + rtems_debug_control to_be_disabled +) +{ + _Debug_Level &= ~to_be_disabled; +} + +/*PAGE + * + * _Debug_Is_enabled + */ + +boolean _Debug_Is_enabled( + rtems_debug_control level +) +{ + return (_Debug_Level & level); +} diff --git a/c/src/exec/sapi/src/exinit.c b/c/src/exec/sapi/src/exinit.c new file mode 100644 index 0000000000..cc45a11c94 --- /dev/null +++ b/c/src/exec/sapi/src/exinit.c @@ -0,0 +1,245 @@ +/* + * Initialization Manager + * + * 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$ + */ + +/* + * INIT is defined so all of the data will be included in this + * file. + */ + +#define INIT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/*PAGE + * + * rtems_initialize_executive + * + * This directive initializes all the kernels data structures + * to the states necessary for the kernel to begin execution. All + * include files that contain global variable definitions should be + * included in this file. The system threads and initialization threads + * are created and started by this routine. This routine then + * initiates multithreading. + * + * Input parameters: + * configuration_table - pointer to the user's configuration table + * cpu_table - pointer to the user's CPU configuration table + * + * Output parameters: NONE + */ + +struct months { + unsigned32 months[2][13]; +}; + +void rtems_initialize_executive( + rtems_configuration_table *configuration_table, + rtems_cpu_table *cpu_table +) +{ + rtems_interrupt_level bsp_level; + + bsp_level = rtems_initialize_executive_early(configuration_table, cpu_table); + rtems_initialize_executive_late( bsp_level ); +} + +rtems_interrupt_level rtems_initialize_executive_early( + rtems_configuration_table *configuration_table, + rtems_cpu_table *cpu_table +) +{ + rtems_interrupt_level bsp_level; + rtems_multiprocessing_table *multiprocessing_table; + + /* + * Dispatching and interrupts are disabled until the end of the + * initialization sequence. This prevents an inadvertent context + * switch before the executive is initialized. + */ + + _ISR_Disable( bsp_level ); + + _System_state_Set( SYSTEM_STATE_BEFORE_INITIALIZATION ); + + _CPU_Initialize( cpu_table, _Thread_Dispatch ); + + multiprocessing_table = configuration_table->User_multiprocessing_table; + if ( multiprocessing_table == NULL ) + multiprocessing_table = + (void *) &_Configuration_Default_multiprocessing_table; + + _Configuration_Handler_initialization( + configuration_table, + multiprocessing_table, + multiprocessing_table->User_mpci_table + ); + + _Attributes_Handler_initialization(); + + _Thread_Dispatch_initialization(); + + _User_extensions_Handler_initialization( + configuration_table->User_extension_table + ); + + _Workspace_Handler_initialization( + (void *)configuration_table->work_space_start, + configuration_table->work_space_size + ); + + _ISR_Handler_initialization(); + + _Objects_Handler_initialization( + multiprocessing_table->node, + multiprocessing_table->maximum_global_objects + ); + + _Priority_Handler_initialization(); + + _Watchdog_Handler_initialization(); + + _TOD_Handler_initialization( configuration_table->microseconds_per_tick ); + + _Thread_Handler_initialization( + configuration_table->maximum_tasks, + configuration_table->ticks_per_timeslice, + multiprocessing_table->maximum_proxies + ); + + _MPCI_Handler_initialization(); + +/* MANAGERS */ + + _Interrupt_Manager_initialization(); + + _Multiprocessing_Manager_initialization(); + + _Timer_Manager_initialization( configuration_table->maximum_timers ); + + _Extension_Manager_initialization( configuration_table->maximum_extensions ); + + _IO_Manager_initialization( + configuration_table->Device_driver_table, + configuration_table->number_of_device_drivers + ); + + _Event_Manager_initialization(); + + _Message_queue_Manager_initialization( + configuration_table->maximum_message_queues, + configuration_table->maximum_messages + ); + + _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(); + + if ( cpu_table->pretasking_hook ) + (*cpu_table->pretasking_hook)(); + + _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING ); + + return bsp_level; +} + +void rtems_initialize_executive_late( + rtems_interrupt_level bsp_level +) +{ + + _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING ); + + _Thread_Start_multitasking( + _Internal_threads_System_initialization_thread, + _Internal_threads_Idle_thread + ); + + /* + * Restore the interrupt level to what the BSP had. Technically, + * this is unnecessary since the BSP should have all interrupts + * disabled when rtems_initialize_executive is invoked. But this keeps + * the ISR Disable/Enable calls paired. + */ + + _ISR_Enable( bsp_level ); +} + +/*PAGE + * + * rtems_shutdown_executive + * + * This kernel routine shutdowns the executive. It halts multitasking + * and returns control to the application execution "thread" which + * initialially invoked the rtems_initialize_executive directive. + * + * Input parameters: NONE + * + * Output parameters: NONE + */ + +void rtems_shutdown_executive( + unsigned32 result +) +{ + _Thread_Stop_multitasking(); +} diff --git a/c/src/exec/sapi/src/extension.c b/c/src/exec/sapi/src/extension.c new file mode 100644 index 0000000000..10c974ef8e --- /dev/null +++ b/c/src/exec/sapi/src/extension.c @@ -0,0 +1,156 @@ +/* + * Extension Manager + * + * + * 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 +#include +#include +#include + +/*PAGE + * + * _Extension_Manager_initialization + * + * This routine initializes all extension manager related data structures. + * + * Input parameters: + * maximum_extensions - number of extensions to initialize + * + * Output parameters: NONE + */ + +void _Extension_Manager_initialization( + unsigned32 maximum_extensions +) +{ + _Objects_Initialize_information( + &_Extension_Information, + FALSE, + maximum_extensions, + sizeof( Extension_Control ) + ); +} + +/*PAGE + * + * rtems_extension_create + * + * This directive creates a extension and performs some initialization. + * + * Input parameters: + * name - extension name + * extension_table - pointer to extension set information + * id - pointer to extension id + * + * Output parameters: + * id - extension id + * RTEMS_SUCCESSFUL - if successful + * error code - if unsuccessful + */ + +rtems_status_code rtems_extension_create( + Objects_Name name, + rtems_extensions_table *extension_table, + Objects_Id *id +) +{ + Extension_Control *the_extension; + + if ( !_Objects_Is_name_valid( name ) ) + return ( RTEMS_INVALID_NAME ); + + _Thread_Disable_dispatch(); /* to prevent deletion */ + + the_extension = _Extension_Allocate(); + + if ( !the_extension ) { + _Thread_Enable_dispatch(); + return( RTEMS_TOO_MANY ); + } + + _User_extensions_Add_set( &the_extension->Extension, extension_table ); + + _Objects_Open( &_Extension_Information, &the_extension->Object, name ); + + *id = the_extension->Object.id; + _Thread_Enable_dispatch(); + return( RTEMS_SUCCESSFUL ); +} + +/*PAGE + * + * rtems_extension_ident + * + * This directive returns the system ID associated with + * the extension name. + * + * Input parameters: + * name - user defined message queue name + * id - pointer to extension id + * + * Output parameters: + * *id - message queue id + * RTEMS_SUCCESSFUL - if successful + * error code - if unsuccessful + */ + +rtems_status_code rtems_extension_ident( + Objects_Name name, + Objects_Id *id +) +{ + return _Objects_Name_to_id( + &_Extension_Information, + name, + RTEMS_SEARCH_LOCAL_NODE, + id + ); +} + +/*PAGE + * + * rtems_extension_delete + * + * This directive allows a thread to delete a extension. + * + * Input parameters: + * id - extension id + * + * Output parameters: + * RTEMS_SUCCESSFUL - if successful + * error code - if unsuccessful + */ + +rtems_status_code rtems_extension_delete( + Objects_Id id +) +{ + Extension_Control *the_extension; + Objects_Locations location; + + the_extension = _Extension_Get( id, &location ); + switch ( location ) { + case OBJECTS_ERROR: + case OBJECTS_REMOTE: /* should never return this */ + 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_INTERNAL_ERROR ); /* unreached - only to remove warnings */ +} diff --git a/c/src/exec/sapi/src/fatal.c b/c/src/exec/sapi/src/fatal.c new file mode 100644 index 0000000000..2ecc73ff3f --- /dev/null +++ b/c/src/exec/sapi/src/fatal.c @@ -0,0 +1,54 @@ +/* + * Fatal Error Manager + * + * 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 +#include +#include +#include +#include + +/*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. + * + * 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. + */ + +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 ); + +/* will not return from this routine */ +} diff --git a/c/src/exec/sapi/src/io.c b/c/src/exec/sapi/src/io.c new file mode 100644 index 0000000000..cf78bb9f71 --- /dev/null +++ b/c/src/exec/sapi/src/io.c @@ -0,0 +1,316 @@ +/* + * Input/Output Manager + * + * + * 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 +#include +#include +#include +#include + +/*PAGE + * + * _IO_Initialize_all_drivers + * + * This routine initializes all device drivers + * + * Input Paramters: NONE + * + * Output Parameters: NONE + */ + +void _IO_Initialize_all_drivers( void ) +{ + rtems_device_major_number major; + unsigned32 ignored; + + for ( major=0 ; major < _IO_Number_of_drivers ; major ++ ) + (void) rtems_io_initialize( major, 0, _Configuration_Table, &ignored ); +} + +/*PAGE + * + * rtems_io_initialize + * + * This routine is the initialization directive of the IO manager. + * + * Input Paramters: + * major - device driver number + * minor - device number + * argument - pointer to argument(s) + * return_value - pointer to driver's return value + * + * Output Parameters: + * returns - return code + * *return_value - driver's return code + */ + +rtems_status_code rtems_io_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return _IO_Handler_routine( + IO_INITIALIZE_OPERATION, + major, + minor, + argument, + return_value + ); +} + +/*PAGE + * + * rtems_io_open + * + * This routine is the open directive of the IO manager. + * + * Input Paramters: + * major - device driver number + * minor - device number + * argument - pointer to argument(s) + * return_value - pointer to driver's return value + * + * Output Parameters: + * returns - return code + * *return_value - driver's return code + */ + +rtems_status_code rtems_io_open( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return _IO_Handler_routine( + IO_OPEN_OPERATION, + major, + minor, + argument, + return_value + ); +} + +/*PAGE + * + * rtems_io_close + * + * This routine is the close directive of the IO manager. + * + * Input Paramters: + * major - device driver number + * minor - device number + * argument - pointer to argument(s) + * return_value - pointer to driver's return value + * + * Output Parameters: + * returns - return code + * *return_value - driver's return code + */ + +rtems_status_code rtems_io_close( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return _IO_Handler_routine( + IO_CLOSE_OPERATION, + major, + minor, + argument, + return_value + ); +} + +/*PAGE + * + * rtems_io_read + * + * This routine is the read directive of the IO manager. + * + * Input Paramters: + * major - device driver number + * minor - device number + * argument - pointer to argument(s) + * return_value - pointer to driver's return value + * + * Output Parameters: + * returns - return code + * *return_value - driver's return code + */ + +rtems_status_code rtems_io_read( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return _IO_Handler_routine( + IO_READ_OPERATION, + major, + minor, + argument, + return_value + ); +} + +/*PAGE + * + * rtems_io_write + * + * This routine is the write directive of the IO manager. + * + * Input Paramters: + * major - device driver number + * minor - device number + * argument - pointer to argument(s) + * return_value - pointer to driver's return value + * + * Output Parameters: + * returns - return code + * *return_value - driver's return code + */ + +rtems_status_code rtems_io_write( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return _IO_Handler_routine( + IO_WRITE_OPERATION, + major, + minor, + argument, + return_value + ); +} + +/*PAGE + * + * rtems_io_control + * + * This routine is the control directive of the IO manager. + * + * Input Paramters: + * major - device driver number + * minor - device number + * argument - pointer to argument(s) + * return_value - pointer to driver's return value + * + * Output Parameters: + * returns - return code + * *return_value - driver's return code + */ + +rtems_status_code rtems_io_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + return _IO_Handler_routine( + IO_CONTROL_OPERATION, + major, + minor, + argument, + return_value + ); +} + +/*PAGE + * + * _IO_Handler_routine + * + * This routine implements all IO manager directives. + * + * Input Paramters: + * operation - I/O operation to be performed + * major - device driver number + * minor - device number + * argument - pointer to argument(s) + * return_value - pointer to driver's return value + * + * Output Parameters: + * returns - return code + * *return_value - driver's return code + */ + +rtems_status_code _IO_Handler_routine( + IO_operations operation, + rtems_device_major_number major, + rtems_device_minor_number minor, + void *argument, + unsigned32 *return_value +) +{ + rtems_device_driver_entry io_callout; + + /* + * NOTE: There is no range checking as in Ada because: + * + arrays in Ada are not always zero based. + * + with zero based arrays, a comparison of an unsigned + * number being less than zero would be necessary to + * check it as a range. This would cause a warning for + * checking an unsigned number for being negative. + */ + + if ( major >= _IO_Number_of_drivers ) + return ( RTEMS_INVALID_NUMBER ); + + switch ( operation ) { + case IO_INITIALIZE_OPERATION: + io_callout = _IO_Driver_address_table[ major ].initialization; + break; + case IO_OPEN_OPERATION: + io_callout = _IO_Driver_address_table[ major ].open; + break; + case IO_CLOSE_OPERATION: + io_callout = _IO_Driver_address_table[ major ].close; + break; + case IO_READ_OPERATION: + io_callout = _IO_Driver_address_table[ major ].read; + break; + case IO_WRITE_OPERATION: + io_callout = _IO_Driver_address_table[ major ].write; + break; + case IO_CONTROL_OPERATION: + io_callout = _IO_Driver_address_table[ major ].control; + break; + default: /* unreached -- only to remove warnings */ + io_callout = NULL; + break; + } + + if ( io_callout != NULL ) + (*io_callout)( + major, + minor, + argument, + _Thread_Executing->Object.id, + return_value + ); + else + *return_value = 0; + + return( RTEMS_SUCCESSFUL ); +} -- cgit v1.2.3