diff options
Diffstat (limited to 'cpukit/sapi/include/rtems')
-rw-r--r-- | cpukit/sapi/include/rtems/README | 135 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/config.h | 103 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/extension.h | 136 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/fatal.h | 49 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/init.h | 110 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/io.h | 244 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/mptables.h | 29 |
7 files changed, 806 insertions, 0 deletions
diff --git a/cpukit/sapi/include/rtems/README b/cpukit/sapi/include/rtems/README new file mode 100644 index 0000000000..5fcc0d14c7 --- /dev/null +++ b/cpukit/sapi/include/rtems/README @@ -0,0 +1,135 @@ +# +# $Id$ +# + +Configuring a System Using the Template in confdefs.h +===================================================== + +The file confdefs.h is a Configuration Template file which can be +used to greatly simplify the creation and maintenance of RTEMS +Configuration Tables. The basic concepts are: + + + confdefs.h provides defaults for all configuration parameters + + + applications specify only those values they wish to override + + + confdefs.h can be the only file which knows the precise layout + of the RTEMS Configuration Tables. + +The Configuration Template setup is used by all RTEMS tests to +simplify the maintenance of the tests. + +Here is the section from the system.h file from test tm21 from +the Timing Test Suite: + + /* configuration information */ + + #define CONFIGURE_TMTEST + + #define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER + #define CONFIGURE_TEST_NEEDS_TIMER_DRIVER + + #define CONFIGURE_MAXIMUM_TASKS 102 + #define CONFIGURE_MAXIMUM_TIMERS 100 + #define CONFIGURE_MAXIMUM_SEMAPHORES 100 + #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 100 + #define CONFIGURE_MAXIMUM_PARTITIONS 100 + #define CONFIGURE_MAXIMUM_REGIONS 100 + #define CONFIGURE_MAXIMUM_PORTS 100 + #define CONFIGURE_MAXIMUM_PERIODS 100 + + #define CONFIGURE_TICKS_PER_TIMESLICE 0 + + #include <confdefs.h> + + +The above example overrides a number of the configuration parameters. +It informs the template that it is a member of the Timing Suite, +requires a console and timer driver, and that it needs 102 tasks, +100 timers, 100 semaphores, 100 message queues, 100 partitions, +100 regions, 100 ports, and 100 periods. By default, the test +would have gotten no drivers, 10 tasks, and no other RTEMS objects. + +The following shows the configuration tables generated by the +template by default. + + +#include <bsp.h> + +#define NULL_DRIVER_TABLE_ENTRY \ + { NULL, NULL, NULL, NULL, NULL, NULL } + +rtems_driver_address_table Device_drivers[] = { +#ifdef CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER + CONSOLE_DRIVER_TABLE_ENTRY, +#endif +#ifdef CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + CLOCK_DRIVER_TABLE_ENTRY, +#endif +#ifdef CONFIGURE_TEST_NEEDS_STUB_DRIVER + STUB_DRIVER_TABLE_ENTRY, +#endif + NULL_DRIVER_TABLE_ENTRY, +}; + +rtems_initialization_tasks_table Initialization_tasks[] = { + { rtems_build_name( 'U', 'I', '1', ' ' ), /* init task name */ + RTEMS_MINIMUM_STACK_SIZE, /* init task stack size */ + 1, /* init task priority */ + RTEMS_DEFAULT_ATTRIBUTES, /* init task attributes */ + Init, /* init task entry point */ + RTEMS_NO_PREEMPT, /* init task initial mode */ + 0 /* init task argument list */ + } +}; + +#ifdef CONFIGURE_MPTEST +/* + * NODE_NUMBER is assumed to be set on the compile line. + */ + +rtems_multiprocessing_table Multiprocessing_configuration = { + NODE_NUMBER, /* local node number */ + 2, /* maximum # nodes in system */ + 32, /* maximum # global objects */ + 32, /* maximum # proxies */ + &MPCI_table /* pointer to MPCI config table */ +}; +#endif + +/* + * CONFIGURE_EXECUTIVE_RAM_SIZE is a rough guess based on the number of + * tasks in the system plus enough extra to get a whole 64K extra. + * + * The NULL address for the workspace area is assumed to be assigned + * at startup time by the BSP. + */ + +rtems_configuration_table Configuration = { + NULL, /* executive RAM work area */ + CONFIGURE_EXECUTIVE_RAM_SIZE, /* executive RAM size */ + 10, /* maximum # tasks */ + 0, /* maximum # timers */ + 0, /* maximum # semaphores */ + 0, /* maximum # message queues */ + 0, /* maximum # messages */ + 0, /* maximum # partitions */ + 0, /* maximum # regions */ + 0, /* maximum # dp memory areas */ + 0, /* maximum # periods */ + 0, /* maximum # user extensions */ + RTEMS_MILLISECONDS_TO_MICROSECONDS(10), /* # us in a tick */ + 50, /* # ticks in a timeslice */ + sizeof (Initialization_tasks) / sizeof(rtems_initialization_tasks_table), + /* number of init tasks */ + Initialization_tasks, /* init task(s) table */ + sizeof (Device_drivers) / sizeof(rtems_driver_address_table), + /* number of device drivers */ + Device_drivers, /* pointer to driver address table */ + NULL, /* pointer to initial extensions */ +#ifdef CONFIGURE_MPTEST + &Multiprocessing_configuration +#else + NULL /* ptr to MP config table */ +#endif +}; diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h new file mode 100644 index 0000000000..dd297e9d83 --- /dev/null +++ b/cpukit/sapi/include/rtems/config.h @@ -0,0 +1,103 @@ +/* config.h + * + * This include file contains the table of user defined configuration + * parameters. + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_CONFIGURATION_h +#define __RTEMS_CONFIGURATION_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * This is kind of kludgy but it allows targets to totally ignore the + * POSIX API safely. + */ + +#ifdef RTEMS_POSIX_API +#include <rtems/posix/config.h> +#else + +typedef void *posix_api_configuration_table; +#endif + +#include <rtems/rtems/config.h> + +/* XXX <rtems/rtems/config.h> should cover these +#include <rtems/rtems/status.h> +#include <rtems/rtems/types.h> +#include <rtems/rtems/tasks.h> +*/ + +#include <rtems/extension.h> +#include <rtems/io.h> +#include <rtems/score/mpci.h> + +/* + * The following records define the Multiprocessor Configuration + * Table. This table defines the multiprocessor system + * characteristics which must be known by RTEMS in a multiprocessor + * system. + */ + +typedef struct { + unsigned32 node; /* local node number */ + unsigned32 maximum_nodes; /* maximum # nodes in system */ + unsigned32 maximum_global_objects; /* maximum # global objects */ + unsigned32 maximum_proxies; /* maximum # proxies */ + MPCI_Control *User_mpci_table; /* pointer to MPCI table */ +} rtems_multiprocessing_table; + +/* + * The following records define the Configuration Table. The + * information contained in this table is required in all + * RTEMS systems, whether single or multiprocessor. This + * table primarily defines the following: + * + * + location and size of the RTEMS Workspace + * + microseconds per clock tick + * + clock ticks per task timeslice + * + required number of each object type for each API configured + */ + +typedef struct { + void *work_space_start; + unsigned32 work_space_size; + unsigned32 maximum_extensions; + unsigned32 microseconds_per_tick; + unsigned32 ticks_per_timeslice; + unsigned32 maximum_devices; + unsigned32 number_of_device_drivers; + rtems_driver_address_table *Device_driver_table; + rtems_extensions_table *User_extension_table; + rtems_multiprocessing_table *User_multiprocessing_table; + rtems_api_configuration_table *RTEMS_api_configuration; + posix_api_configuration_table *POSIX_api_configuration; +} rtems_configuration_table; + +/* + * The following are provided strictly for the convenience of + * the user. They are not used in RTEMS itself. + */ + +SAPI_EXTERN rtems_configuration_table *_Configuration_Table; +SAPI_EXTERN rtems_multiprocessing_table *_Configuration_MP_table; + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/cpukit/sapi/include/rtems/extension.h b/cpukit/sapi/include/rtems/extension.h new file mode 100644 index 0000000000..c9559855ef --- /dev/null +++ b/cpukit/sapi/include/rtems/extension.h @@ -0,0 +1,136 @@ +/* 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-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_EXTENSION_MANAGER_h +#define __RTEMS_EXTENSION_MANAGER_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rtems/score/object.h> +#include <rtems/score/userext.h> +#include <rtems/rtems/status.h> /* XXX */ +#include <rtems/rtems/types.h> /* XXX */ + +/* + * Extension related types + */ + +typedef User_extensions_routine rtems_extension; +typedef User_extensions_thread_create_extension rtems_task_create_extension; +typedef User_extensions_thread_delete_extension rtems_task_delete_extension; +typedef User_extensions_thread_start_extension rtems_task_start_extension; +typedef User_extensions_thread_restart_extension rtems_task_restart_extension; +typedef User_extensions_thread_switch_extension rtems_task_switch_extension; +typedef User_extensions_thread_begin_extension rtems_task_begin_extension; +typedef User_extensions_thread_exitted_extension rtems_task_exitted_extension; +typedef User_extensions_fatal_extension rtems_fatal_extension; + +typedef User_extensions_Table rtems_extensions_table; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +SAPI_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( + rtems_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( + rtems_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 +); + +#ifndef __RTEMS_APPLICATION__ +#include <rtems/extension.inl> +#endif + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/cpukit/sapi/include/rtems/fatal.h b/cpukit/sapi/include/rtems/fatal.h new file mode 100644 index 0000000000..5cb9a6460a --- /dev/null +++ b/cpukit/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-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $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/cpukit/sapi/include/rtems/init.h b/cpukit/sapi/include/rtems/init.h new file mode 100644 index 0000000000..1a92f53e46 --- /dev/null +++ b/cpukit/sapi/include/rtems/init.h @@ -0,0 +1,110 @@ +/* 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-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_INIT_h +#define __RTEMS_INIT_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rtems/rtems/types.h> +#include <rtems/config.h> +#include <rtems/rtems/intr.h> + +/* + * The following defines the default Multiprocessing Configuration + * Table. This table is used in a single processor system. + */ + +extern const rtems_multiprocessing_table + _Initialization_Default_multiprocessing_table; + +/* + * rtems_initialize_executive + * + * 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/cpukit/sapi/include/rtems/io.h b/cpukit/sapi/include/rtems/io.h new file mode 100644 index 0000000000..a1eddcf637 --- /dev/null +++ b/cpukit/sapi/include/rtems/io.h @@ -0,0 +1,244 @@ +/* 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-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_IO_h +#define __RTEMS_IO_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rtems/rtems/status.h> + +/* + * + * The following defines the types for: + * + * + major and minor numbers + * + the return type of a device driver entry + * + a pointer to a device driver entry + * + an entry in the the Device Driver Address Table. Each entry in this + * table corresponds to an application provided device driver and + * defines the entry points for that device driver. + */ + +typedef unsigned32 rtems_device_major_number; +typedef unsigned32 rtems_device_minor_number; + +typedef rtems_status_code rtems_device_driver; + +typedef rtems_device_driver ( *rtems_device_driver_entry )( + rtems_device_major_number, + rtems_device_minor_number, + void * + ); + +typedef struct { + rtems_device_driver_entry initialization; /* initialization procedure */ + rtems_device_driver_entry open; /* open request procedure */ + rtems_device_driver_entry close; /* close request procedure */ + rtems_device_driver_entry read; /* read request procedure */ + rtems_device_driver_entry write; /* write request procedure */ + rtems_device_driver_entry control; /* special functions procedure */ +} rtems_driver_address_table; + +/* + * Table for the io device names + */ + +typedef struct { + char *device_name; + unsigned32 device_name_length; + rtems_device_major_number major; + rtems_device_minor_number minor; +} rtems_driver_name_t; + +/* + * This is the table of device names. + */ + +/* + * The following declare the data required to manage the Driver + * Address Table and Device Name Table. + */ + +SAPI_EXTERN unsigned32 _IO_Number_of_drivers; +SAPI_EXTERN rtems_driver_address_table *_IO_Driver_address_table; +SAPI_EXTERN unsigned32 _IO_Number_of_devices; +SAPI_EXTERN rtems_driver_name_t *_IO_Driver_name_table; + +/* + * _IO_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _IO_Manager_initialization( + rtems_driver_address_table *driver_table, + unsigned32 number_of_drivers, + unsigned32 number_of_devices +); + +/* + * rtems_io_register_name + * + * DESCRIPTION: + * + * Associate a name with a driver. + * + */ + +rtems_status_code rtems_io_register_name( + char *device_name, + rtems_device_major_number major, + rtems_device_minor_number minor +); + + +/* + * rtems_io_lookup_name + * + * DESCRIPTION: + * + * Find what driver "owns" this name + */ + +rtems_status_code rtems_io_lookup_name( + const char *name, + rtems_driver_name_t **device_info +); + + +/* + * 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 +); + +/* + * 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 +); + +/* + * 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 +); + +/* + * 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 +); + +/* + * 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 +); + +/* + * 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 +); + +/* + * _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 ); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/cpukit/sapi/include/rtems/mptables.h b/cpukit/sapi/include/rtems/mptables.h new file mode 100644 index 0000000000..7a00554c23 --- /dev/null +++ b/cpukit/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-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_MPTABLES_h +#define __RTEMS_MPTABLES_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ |