diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-11-09 22:07:23 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-11-09 22:07:23 +0000 |
commit | 352c9b2035e32e56f10f261d94955d97f4ab0f1c (patch) | |
tree | f433e95ae0ab8d8854ea19b7f4bfab3ffb431726 /c/src/exec/sapi | |
parent | Fixed warning where initialized default POSIX API structure did (diff) | |
download | rtems-352c9b2035e32e56f10f261d94955d97f4ab0f1c.tar.bz2 |
This patch adds the basic framework for the ITRON 3.0 API implementation
for RTEMS.
Diffstat (limited to '')
-rw-r--r-- | c/src/exec/sapi/include/confdefs.h | 210 | ||||
-rw-r--r-- | c/src/exec/sapi/include/rtems/config.h | 18 | ||||
-rw-r--r-- | c/src/exec/sapi/src/Makefile.in | 3 | ||||
-rw-r--r-- | c/src/exec/sapi/src/exinit.c | 8 | ||||
-rw-r--r-- | c/src/exec/sapi/src/itronapi.c | 117 |
5 files changed, 348 insertions, 8 deletions
diff --git a/c/src/exec/sapi/include/confdefs.h b/c/src/exec/sapi/include/confdefs.h index e2a0c84d3d..152ae790df 100644 --- a/c/src/exec/sapi/include/confdefs.h +++ b/c/src/exec/sapi/include/confdefs.h @@ -29,6 +29,9 @@ extern rtems_multiprocessing_table Multiprocessing_configuration; #ifdef RTEMS_POSIX_API extern posix_api_configuration_table Configuration_POSIX_API; #endif +#ifdef RTEMS_ITRON_API +extern itron_api_configuration_table Configuration_ITRON_API; +#endif /* * RTEMS C Library and Newlib support @@ -508,6 +511,184 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = { #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE 0 #endif +/* + * ITRON API Configuration Parameters + */ + +#ifdef RTEMS_ITRON_API + +#include <itron.h> +#include <rtems/itron/config.h> +#include <rtems/itron/eventflags.h> +#include <rtems/itron/fmempool.h> +#include <rtems/itron/mbox.h> +#include <rtems/itron/msgbuffer.h> +#include <rtems/itron/port.h> +#include <rtems/itron/semaphore.h> +#include <rtems/itron/task.h> +#include <rtems/itron/vmempool.h> + +#ifndef CONFIGURE_MAXIMUM_ITRON_TASKS +#define CONFIGURE_MAXIMUM_ITRON_TASKS 10 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_SEMAPHORES +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS +#define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_MAILBOXES +#define CONFIGURE_MAXIMUM_ITRON_MAILBOXES 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS +#define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_PORTS +#define CONFIGURE_MAXIMUM_ITRON_PORTS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS +#define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS +#define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS 0 +#endif + +#ifdef CONFIGURE_ITRON_INIT_TASK_TABLE + +#ifdef CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE + +/* + * The user is defining their own table information and setting the + * appropriate variables. + */ + +#else + +#ifndef CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT +#define CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT ITRON_Init +#endif + +#ifndef CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES +#define CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES TA_HLNG +#endif + +#ifndef CONFIGURE_ITRON_INIT_TASK_PRIORITY +#define CONFIGURE_ITRON_INIT_TASK_PRIORITY 1 +#endif + +#ifndef CONFIGURE_ITRON_INIT_TASK_STACK_SIZE +#define CONFIGURE_ITRON_INIT_TASK_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE +#endif + +#ifdef CONFIGURE_INIT +itron_initialization_tasks_table ITRON_Initialization_tasks[] = { + { 1, /* ID */ + { (VP) 0, /* exinfo */ + CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES, /* task attributes */ + CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT, /* task start address */ + CONFIGURE_ITRON_INIT_TASK_PRIORITY, /* initial task priority */ + CONFIGURE_ITRON_INIT_TASK_STACK_SIZE /* stack size */ + } + } +}; +#endif + +#define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME ITRON_Initialization_tasks + +#define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE \ + sizeof(CONFIGURE_ITRON_INIT_TASK_TABLE_NAME) / \ + sizeof(itron_initialization_tasks_table) + +#endif /* CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE */ + +#else /* CONFIGURE_ITRON_INIT_TASK_TABLE */ + +#define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME NULL +#define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE 0 + +#endif + +#define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API \ + ( \ + sizeof (ITRON_API_Control) \ + ) + +#define CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES(_semaphores) \ + ((_semaphores) * \ + ( sizeof(ITRON_Semaphore_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS(_eventflags) \ + ((_eventflags) * \ + ( sizeof(ITRON_Eventflags_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES(_mailboxes) \ + ((_mailboxes) * \ + ( sizeof(ITRON_Mailbox_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS(_message_buffers) \ + ((_message_buffers) * \ + ( sizeof(ITRON_Message_buffer_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_PORTS(_ports) \ + ((_ports) * \ + ( sizeof(ITRON_Port_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS(_memory_pools) \ + ((_memory_pools) * \ + (sizeof(ITRON_Variable_memory_pool_Control) + CONFIGURE_OBJECT_TABLE_STUFF)) + +#define CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS(_fixed_memory_pools) \ + ((_fixed_memory_pools) * \ + ( sizeof(ITRON_Fixed_memory_pool_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#ifndef CONFIGURE_ITRON_INIT_TASK_STACK_SIZES +#define CONFIGURE_ITRON_INIT_TASK_STACK_SIZES (RTEMS_MINIMUM_STACK_SIZE * 2) +#endif + + +#define CONFIGURE_MEMORY_FOR_ITRON \ + ( \ + CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES( \ + CONFIGURE_MAXIMUM_ITRON_SEMAPHORES ) + \ + CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS( \ + CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES( \ + CONFIGURE_MAXIMUM_ITRON_MAILBOXES ) + \ + CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS( \ + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_PORTS( \ + CONFIGURE_MAXIMUM_ITRON_PORTS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS( \ + CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS( \ + CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS ) + \ + CONFIGURE_ITRON_INIT_TASK_STACK_SIZES \ + ) + + +#else + +#define CONFIGURE_MAXIMUM_ITRON_TASKS 0 +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 0 +#define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS 0 +#define CONFIGURE_MAXIMUM_ITRON_MAILBOXES 0 +#define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS 0 +#define CONFIGURE_MAXIMUM_ITRON_PORTS 0 +#define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS 0 +#define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS 0 +#define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API 0 +#define CONFIGURE_MEMORY_FOR_ITRON 0 + +#endif /* RTEMS_ITRON_API */ + + /* * Calculate the RAM size based on the maximum number of objects configured. * The model is to estimate the memory required for each configured item, @@ -538,6 +719,7 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = { ((sizeof(Thread_Control) + CONTEXT_FP_SIZE + \ STACK_MINIMUM_SIZE + sizeof( RTEMS_API_Control ) + \ CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \ + CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API + \ CONFIGURE_OBJECT_TABLE_STUFF)) \ ) @@ -616,8 +798,10 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = { #define CONFIGURE_EXECUTIVE_RAM_SIZE \ (( CONFIGURE_MEMORY_FOR_POSIX + \ + CONFIGURE_MEMORY_FOR_ITRON + \ CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS + \ - CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS ) + \ + CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS + \ + CONFIGURE_MAXIMUM_ITRON_TASKS ) + \ CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS) + \ CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES + \ CONFIGURE_LIBIO_SEMAPHORES) + \ @@ -697,6 +881,21 @@ posix_api_configuration_table Configuration_POSIX_API = { }; #endif +#ifdef RTEMS_ITRON_API +itron_api_configuration_table Configuration_ITRON_API = { + CONFIGURE_MAXIMUM_ITRON_TASKS, + CONFIGURE_MAXIMUM_ITRON_SEMAPHORES, + CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS, + CONFIGURE_MAXIMUM_ITRON_MAILBOXES, + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS, + CONFIGURE_MAXIMUM_ITRON_PORTS, + CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS, + CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS, + CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE, + CONFIGURE_ITRON_INIT_TASK_TABLE_NAME +}; +#endif + rtems_configuration_table Configuration = { CONFIGURE_EXECUTIVE_RAM_WORK_AREA, CONFIGURE_EXECUTIVE_RAM_SIZE, @@ -713,9 +912,14 @@ rtems_configuration_table Configuration = { CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */ &Configuration_RTEMS_API, /* pointer to RTEMS API config */ #ifdef RTEMS_POSIX_API - &Configuration_POSIX_API /* pointer to POSIX API config */ + &Configuration_POSIX_API, /* pointer to POSIX API config */ +#else + NULL, /* pointer to POSIX API config */ +#endif +#ifdef RTEMS_ITRON_API + &Configuration_ITRON_API /* pointer to ITRON API config */ #else - NULL /* pointer to POSIX API config */ + NULL /* pointer to ITRON API config */ #endif }; #endif diff --git a/c/src/exec/sapi/include/rtems/config.h b/c/src/exec/sapi/include/rtems/config.h index 7439a6e3fe..636813edc5 100644 --- a/c/src/exec/sapi/include/rtems/config.h +++ b/c/src/exec/sapi/include/rtems/config.h @@ -25,8 +25,8 @@ extern "C" { * Unlimited object support. Changes the configuration table entry for POSIX * or RTEMS APIs to bounded only by the memory of the work-space. * - * Use the macro to define the resource unlimited before placing in the configuration - * table. + * Use the macro to define the resource unlimited before placing in + * the configuration table. */ #include <rtems/score/object.h> @@ -37,16 +37,22 @@ extern "C" { /* * This is kind of kludgy but it allows targets to totally ignore the - * POSIX API safely. + * optional APIs like POSIX and ITRON safely. */ #ifdef RTEMS_POSIX_API #include <rtems/posix/config.h> #else - typedef void *posix_api_configuration_table; #endif +#ifdef RTEMS_ITRON_API +#include <itron.h> +#include <rtems/itron/config.h> +#else +typedef void *itron_api_configuration_table; +#endif + #include <rtems/rtems/config.h> /* XXX <rtems/rtems/config.h> should cover these @@ -106,6 +112,7 @@ typedef struct { rtems_multiprocessing_table *User_multiprocessing_table; rtems_api_configuration_table *RTEMS_api_configuration; posix_api_configuration_table *POSIX_api_configuration; + itron_api_configuration_table *ITRON_api_configuration; } rtems_configuration_table; /* @@ -165,6 +172,9 @@ SAPI_EXTERN rtems_multiprocessing_table *_Configuration_MP_table; #define rtems_configuration_get_posix_api_configuration() \ (_Configuration_Table->POSIX_api_configuration) +#define rtems_configuration_get_itron_api_configuration() \ + (_Configuration_Table->ITRON_api_configuration) + #ifdef __cplusplus } #endif diff --git a/c/src/exec/sapi/src/Makefile.in b/c/src/exec/sapi/src/Makefile.in index 4223fa423b..102c7cd24a 100644 --- a/c/src/exec/sapi/src/Makefile.in +++ b/c/src/exec/sapi/src/Makefile.in @@ -13,7 +13,8 @@ PROJECT_ROOT = @PROJECT_ROOT@ VPATH = @srcdir@ -C_PIECES = debug entrytable extension fatal exinit io posixapi rtemsapi +C_PIECES = debug entrytable extension fatal exinit io \ + itronapi posixapi rtemsapi C_FILES = $(C_PIECES:%=%.c) C_O_FILES = $(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/exec/sapi/src/exinit.c b/c/src/exec/sapi/src/exinit.c index 43da0a9363..511a0086f5 100644 --- a/c/src/exec/sapi/src/exinit.c +++ b/c/src/exec/sapi/src/exinit.c @@ -52,6 +52,10 @@ #ifdef RTEMS_POSIX_API #include <rtems/posix/posixapi.h> #endif +#ifdef RTEMS_ITRON_API +#include <rtems/itron/itronapi.h> +#endif + /*PAGE * @@ -211,6 +215,10 @@ rtems_interrupt_level rtems_initialize_executive_early( _POSIX_API_Initialize( configuration_table ); #endif +#ifdef RTEMS_ITRON_API + _ITRON_API_Initialize( configuration_table ); +#endif + _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING ); if ( cpu_table->pretasking_hook ) diff --git a/c/src/exec/sapi/src/itronapi.c b/c/src/exec/sapi/src/itronapi.c new file mode 100644 index 0000000000..0309967ecf --- /dev/null +++ b/c/src/exec/sapi/src/itronapi.c @@ -0,0 +1,117 @@ +/* + * ITRON API Initialization Support + * + * NOTE: + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include <assert.h> + +/* + * ITRON_API_INIT is defined so all of the ITRON API + * data will be included in this object file. + */ + +#define ITRON_API_INIT + +#include <rtems/system.h> /* include this before checking RTEMS_ITRON_API */ +#ifdef RTEMS_ITRON_API + +#include <itron.h> + +#include <sys/types.h> +#include <rtems/config.h> +#include <rtems/score/object.h> + +#include <rtems/itron/eventflags.h> +#include <rtems/itron/fmempool.h> +#include <rtems/itron/mbox.h> +#include <rtems/itron/msgbuffer.h> +#include <rtems/itron/port.h> +#include <rtems/itron/semaphore.h> +#include <rtems/itron/task.h> +#include <rtems/itron/vmempool.h> + +/*PAGE + * + * _ITRON_API_Initialize + * + * XXX + */ + +itron_api_configuration_table _ITRON_Default_configuration = { + 0, /* maximum_tasks */ + 0, /* maximum_semaphores */ + 0, /* maximum_eventflags */ + 0, /* maximum_mailboxes */ + 0, /* maximum_message_buffers */ + 0, /* maximum_ports */ + 0, /* maximum_memory_pools */ + 0, /* maximum_fixed_memory_pools */ + 0, /* number_of_initialization_tasks */ + NULL /* User_initialization_tasks_table */ +}; + + +void _ITRON_API_Initialize( + rtems_configuration_table *configuration_table +) +{ + itron_api_configuration_table *api_configuration; + + /* XXX need to assert here based on size assumptions */ + + assert( sizeof(ID) == sizeof(Objects_Id) ); + + api_configuration = configuration_table->ITRON_api_configuration; + if ( !api_configuration ) + api_configuration = &_ITRON_Default_configuration; + + _ITRON_Task_Manager_initialization( + api_configuration->maximum_tasks, + api_configuration->number_of_initialization_tasks, + api_configuration->User_initialization_tasks_table + ); + + _ITRON_Semaphore_Manager_initialization( + api_configuration->maximum_semaphores + ); + + _ITRON_Eventflags_Manager_initialization( + api_configuration->maximum_eventflags + ); + + _ITRON_Fixed_memory_pool_Manager_initialization( + api_configuration->maximum_fixed_memory_pools + ); + + _ITRON_Mailbox_Manager_initialization( + api_configuration->maximum_mailboxes + ); + + _ITRON_Message_buffer_Manager_initialization( + api_configuration->maximum_message_buffers + ); + + _ITRON_Port_Manager_initialization( + api_configuration->maximum_ports + ); + + _ITRON_Variable_memory_pool_Manager_initialization( + api_configuration->maximum_memory_pools + ); + + +} + +#endif +/* end of file */ |