diff options
Diffstat (limited to '')
47 files changed, 900 insertions, 750 deletions
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h index d66e23e0ab..f147d67dae 100644 --- a/cpukit/include/rtems/confdefs.h +++ b/cpukit/include/rtems/confdefs.h @@ -44,9 +44,11 @@ #include <rtems/rtems/timerdata.h> #include <rtems/posix/key.h> #include <rtems/posix/mqueue.h> +#include <rtems/posix/psignal.h> #include <rtems/posix/pthread.h> #include <rtems/posix/semaphore.h> #include <rtems/posix/shm.h> +#include <rtems/posix/timer.h> #include <limits.h> @@ -1354,24 +1356,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; */ #define _Configure_Max_Objects(_max) \ (_Configure_Zero_or_One(_max) * rtems_resource_maximum_per_allocation(_max)) - -/** - * This macro accounts for how memory for a set of configured objects is - * allocated from the Executive Workspace. - * - * NOTE: It does NOT attempt to address the more complex case of unlimited - * objects. - */ -#define _Configure_Object_RAM(_number, _size) ( \ - _Configure_From_workspace(_Configure_Max_Objects(_number) * (_size)) + \ - _Configure_From_workspace( \ - _Configure_Zero_or_One(_number) * ( \ - (_Configure_Max_Objects(_number) + 1) * sizeof(Objects_Control *) + \ - _Configure_Align_up(sizeof(void *), CPU_ALIGNMENT) + \ - _Configure_Align_up(sizeof(uint32_t), CPU_ALIGNMENT) \ - ) \ - ) \ - ) /**@}*/ /** @@ -1853,7 +1837,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #define _CONFIGURE_MEMORY_FOR_PROXIES(_proxies) \ _Configure_From_workspace((_proxies) \ * (sizeof(Thread_Proxy_control) \ - + THREAD_QUEUE_HEADS_SIZE(_CONFIGURE_SCHEDULER_COUNT))) + + sizeof(Thread_queue_Configured_heads))) #ifndef CONFIGURE_MP_MPCI_TABLE_POINTER #include <mpci.h> @@ -1971,12 +1955,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #define CONFIGURE_MAXIMUM_POSIX_TIMERS \ rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) #endif -/* - #if !defined(CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) - #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS \ - rtems_resource_unlimited(CONFIGURE_UNLIMITED_ALLOCATION_SIZE) - #endif -*/ #endif /* RTEMS_POSIX_API */ #endif /* CONFIGURE_UNLIMITED_OBJECTS */ @@ -2006,16 +1984,11 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; #ifndef CONFIGURE_MAXIMUM_TIMERS /** This specifies the maximum number of Classic API timers. */ #define CONFIGURE_MAXIMUM_TIMERS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API timers. - */ - #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) 0 -#else - #define _CONFIGURE_MEMORY_FOR_TIMERS(_timers) \ - _Configure_Object_RAM(_timers, sizeof(Timer_Control) ) #endif +#define _CONFIGURE_TIMERS \ + (CONFIGURE_MAXIMUM_TIMERS + _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER) + #ifndef CONFIGURE_MAXIMUM_SEMAPHORES /** This specifies the maximum number of Classic API semaphores. */ #define CONFIGURE_MAXIMUM_SEMAPHORES 0 @@ -2037,35 +2010,12 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; ) #endif -/* - * This macro is calculated to specify the memory required for - * Classic API Semaphores. - * - * If there are no user or support semaphores defined, then we can assume - * that no memory need be allocated at all for semaphores. - */ -#if CONFIGURE_MAXIMUM_SEMAPHORES == 0 - #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) 0 -#else - #define _CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \ - _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) ) + \ - _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES -#endif - #ifndef CONFIGURE_MAXIMUM_MESSAGE_QUEUES /** * This configuration parameter specifies the maximum number of * Classic API Message Queues. */ #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 0 - /* - * This macro is calculated to specify the RTEMS Workspace required for - * the Classic API Message Queues. - */ - #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) 0 -#else - #define _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \ - _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) ) #endif #ifndef CONFIGURE_MAXIMUM_PARTITIONS @@ -2074,14 +2024,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; * Classic API Partitions. */ #define CONFIGURE_MAXIMUM_PARTITIONS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API - */ - #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) 0 -#else - #define _CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \ - _Configure_Object_RAM(_partitions, sizeof(Partition_Control) ) #endif #ifndef CONFIGURE_MAXIMUM_REGIONS @@ -2090,14 +2032,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; * Classic API Regions. */ #define CONFIGURE_MAXIMUM_REGIONS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API Regions. - */ - #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) 0 -#else - #define _CONFIGURE_MEMORY_FOR_REGIONS(_regions) \ - _Configure_Object_RAM(_regions, sizeof(Region_Control) ) #endif #ifndef CONFIGURE_MAXIMUM_PORTS @@ -2106,14 +2040,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; * Classic API Dual-Ported Memory Ports. */ #define CONFIGURE_MAXIMUM_PORTS 0 - /** - * This macro is calculated to specify the memory required for - * Classic API Dual-Ported Memory Ports. - */ - #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) 0 -#else - #define _CONFIGURE_MEMORY_FOR_PORTS(_ports) \ - _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) ) #endif #ifndef CONFIGURE_MAXIMUM_PERIODS @@ -2122,14 +2048,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; * Classic API Rate Monotonic Periods. */ #define CONFIGURE_MAXIMUM_PERIODS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API Rate Monotonic Periods. - */ - #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) 0 -#else - #define _CONFIGURE_MEMORY_FOR_PERIODS(_periods) \ - _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) ) #endif /** @@ -2145,18 +2063,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; * Barriers required by the application and configured capabilities. */ #define _CONFIGURE_BARRIERS \ - (CONFIGURE_MAXIMUM_BARRIERS + _CONFIGURE_BARRIERS_FOR_FIFOS) - -/* - * This macro is calculated to specify the memory required for - * Classic API Barriers. - */ -#if _CONFIGURE_BARRIERS == 0 - #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) 0 -#else - #define _CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \ - _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) ) -#endif + (CONFIGURE_MAXIMUM_BARRIERS + _CONFIGURE_BARRIERS_FOR_FIFOS) #ifndef CONFIGURE_MAXIMUM_USER_EXTENSIONS /** @@ -2164,14 +2071,6 @@ extern rtems_initialization_tasks_table Initialization_tasks[]; * Classic API User Extensions. */ #define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0 - /* - * This macro is calculated to specify the memory required for - * Classic API User Extensions. - */ - #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) 0 -#else - #define _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \ - _Configure_Object_RAM(_extensions, sizeof(Extension_Control) ) #endif /**@}*/ /* end of Classic API Configuration */ @@ -2297,16 +2196,6 @@ struct _reent *__getreent(void) #define _CONFIGURE_POSIX_KEYS \ (CONFIGURE_MAXIMUM_POSIX_KEYS + _CONFIGURE_LIBIO_POSIX_KEYS) -/* - * This macro is calculated to specify the memory required for - * POSIX API keys. - */ -#define _CONFIGURE_MEMORY_FOR_POSIX_KEYS(_keys, _key_value_pairs) \ - (_Configure_Object_RAM(_keys, sizeof(POSIX_Keys_Control) ) \ - + _Configure_From_workspace( \ - _Configure_Max_Objects(_key_value_pairs) \ - * sizeof(POSIX_Keys_Key_value_pair))) - /** * This configuration parameter specifies the maximum number of * POSIX API threads. @@ -2320,9 +2209,8 @@ struct _reent *__getreent(void) * of the object to be duplicated. */ #define _Configure_POSIX_Named_Object_RAM(_number, _size) \ - (_Configure_Object_RAM(_number, _size) \ - + _Configure_Max_Objects(_number) \ - * _Configure_From_workspace(_POSIX_PATH_MAX + 1)) + (_Configure_Max_Objects(_number) \ + * _Configure_From_workspace(_POSIX_PATH_MAX + 1)) /** * This configuration parameter specifies the maximum number of @@ -2370,48 +2258,37 @@ struct _reent *__getreent(void) #define _CONFIGURE_MEMORY_FOR_POSIX_SHMS(_shms) \ _Configure_POSIX_Named_Object_RAM(_shms, sizeof(POSIX_Shm_Control) ) -/* - * The rest of the POSIX threads API features are only available when - * POSIX is enabled. +/** + * This configuration parameter specifies the maximum number of + * POSIX API timers. */ -#ifdef RTEMS_POSIX_API - #include <sys/types.h> - #include <signal.h> - #include <rtems/posix/psignal.h> - #include <rtems/posix/threadsup.h> - #include <rtems/posix/timer.h> +#ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS + #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0 +#endif - /** - * This configuration parameter specifies the maximum number of - * POSIX API timers. - */ - #ifndef CONFIGURE_MAXIMUM_POSIX_TIMERS - #define CONFIGURE_MAXIMUM_POSIX_TIMERS 0 - #endif +#if !defined(RTEMS_POSIX_API) && CONFIGURE_MAXIMUM_POSIX_TIMERS != 0 + #error "CONFIGURE_MAXIMUM_POSIX_TIMERS must be zero if POSIX API is disabled" +#endif - /* - * This macro is calculated to specify the memory required for - * POSIX API timers. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(_timers) \ - _Configure_Object_RAM(_timers, sizeof(POSIX_Timer_Control) ) +/** + * This configuration parameter specifies the maximum number of + * POSIX API queued signals. + */ +#ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS + #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0 +#endif - /** - * This configuration parameter specifies the maximum number of - * POSIX API queued signals. - */ - #ifndef CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS - #define CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS 0 - #endif +#if !defined(RTEMS_POSIX_API) && CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0 + #error "CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS must be zero if POSIX API is disabled" +#endif - /* - * This macro is calculated to specify the memory required for - * POSIX API queued signals. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS(_queued_signals) \ - _Configure_From_workspace( \ - (_queued_signals) * (sizeof(POSIX_signals_Siginfo_node)) ) -#endif /* RTEMS_POSIX_API */ +#if CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS > 0 + #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS \ + _Configure_From_workspace( (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) * \ + sizeof( POSIX_signals_Siginfo_node ) ) +#else + #define _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS 0 +#endif #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE #ifndef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE @@ -2536,23 +2413,6 @@ struct _reent *__getreent(void) CONFIGURE_MAXIMUM_ADA_TASKS + \ CONFIGURE_MAXIMUM_GOROUTINES) -#ifdef RTEMS_POSIX_API - /* - * This macro is calculated to specify the memory required for - * the POSIX API in its entirety. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX \ - (_CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( \ - CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS) + \ - _CONFIGURE_MEMORY_FOR_POSIX_TIMERS(CONFIGURE_MAXIMUM_POSIX_TIMERS)) -#else - /* - * This macro is calculated to specify the memory required for - * the POSIX API in its entirety. - */ - #define _CONFIGURE_MEMORY_FOR_POSIX 0 -#endif - /* * We must be able to split the free block used for the second last allocation * into two parts so that we have a free block for the last allocation. See @@ -2561,6 +2421,12 @@ struct _reent *__getreent(void) #define _CONFIGURE_HEAP_HANDLER_OVERHEAD \ _Configure_Align_up( HEAP_BLOCK_HEADER_SIZE, CPU_HEAP_ALIGNMENT ) +/** + * This calculates the amount of memory reserved for the IDLE tasks. + * In an SMP system, each CPU core has its own idle task. + */ +#define _CONFIGURE_IDLE_TASKS_COUNT _CONFIGURE_MAXIMUM_PROCESSORS + /* * Calculate the RAM size based on the maximum number of objects configured. */ @@ -2573,13 +2439,8 @@ struct _reent *__getreent(void) * entry in the local pointer table. */ #define _CONFIGURE_MEMORY_FOR_TASKS(_tasks, _number_FP_tasks) \ - ( \ - _Configure_Object_RAM(_tasks, sizeof(Configuration_Thread_control)) \ - + _Configure_From_workspace(_Configure_Max_Objects(_tasks) \ - * THREAD_QUEUE_HEADS_SIZE(_CONFIGURE_SCHEDULER_COUNT)) \ - + _Configure_Max_Objects(_number_FP_tasks) \ - * _Configure_From_workspace(CONTEXT_FP_SIZE) \ - ) + (_Configure_Max_Objects(_number_FP_tasks) \ + * _Configure_From_workspace(CONTEXT_FP_SIZE)) /* * This defines the amount of memory configured for the multiprocessing @@ -2629,12 +2490,6 @@ struct _reent *__getreent(void) #endif /** - * This calculates the amount of memory reserved for the IDLE tasks. - * In an SMP system, each CPU core has its own idle task. - */ -#define _CONFIGURE_IDLE_TASKS_COUNT _CONFIGURE_MAXIMUM_PROCESSORS - -/** * This defines the formula used to compute the amount of memory * reserved for internal task control structures. */ @@ -2670,23 +2525,6 @@ struct _reent *__getreent(void) )) /** - * This macro provides a summation of the memory required by the - * Classic API as configured. - */ -#define _CONFIGURE_MEMORY_FOR_CLASSIC \ - (_CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS + \ - _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER ) + \ - _CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES) + \ - _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES) + \ - _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS) + \ - _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ) + \ - _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS) + \ - _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS) + \ - _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS) + \ - _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \ - ) - -/** * This calculates the memory required for the executive workspace. * * This is an internal parameter. @@ -2698,17 +2536,14 @@ struct _reent *__getreent(void) _CONFIGURE_TASKS, _CONFIGURE_TASKS) + \ _CONFIGURE_MEMORY_FOR_TASKS( \ _CONFIGURE_POSIX_THREADS, _CONFIGURE_POSIX_THREADS) + \ - _CONFIGURE_MEMORY_FOR_CLASSIC + \ - _CONFIGURE_MEMORY_FOR_POSIX_KEYS( \ - _CONFIGURE_POSIX_KEYS, \ - CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ) + \ + _CONFIGURE_MEMORY_FOR_MRSP_SEMAPHORES + \ _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( \ CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES) + \ _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( \ CONFIGURE_MAXIMUM_POSIX_SEMAPHORES) + \ _CONFIGURE_MEMORY_FOR_POSIX_SHMS( \ CONFIGURE_MAXIMUM_POSIX_SHMS) + \ - _CONFIGURE_MEMORY_FOR_POSIX + \ + _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS + \ _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \ _CONFIGURE_MEMORY_FOR_MP + \ CONFIGURE_MESSAGE_BUFFER_MEMORY + \ @@ -2882,7 +2717,7 @@ struct _reent *__getreent(void) const size_t _Thread_Maximum_name_size = CONFIGURE_MAXIMUM_THREAD_NAME_SIZE; - typedef struct { + struct Thread_Configured_control { Thread_Control Control; #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0 void *extensions[ CONFIGURE_MAXIMUM_USER_EXTENSIONS + 1 ]; @@ -2902,43 +2737,41 @@ struct _reent *__getreent(void) #else struct { /* Empty */ } Newlib; #endif - } Configuration_Thread_control; - - const size_t _Thread_Control_size = sizeof( Configuration_Thread_control ); + }; const Thread_Control_add_on _Thread_Control_add_ons[] = { { - offsetof( Configuration_Thread_control, Control.Scheduler.nodes ), - offsetof( Configuration_Thread_control, Scheduler_nodes ) + offsetof( Thread_Configured_control, Control.Scheduler.nodes ), + offsetof( Thread_Configured_control, Scheduler_nodes ) }, { offsetof( - Configuration_Thread_control, + Thread_Configured_control, Control.API_Extensions[ THREAD_API_RTEMS ] ), - offsetof( Configuration_Thread_control, API_RTEMS ) + offsetof( Thread_Configured_control, API_RTEMS ) }, { offsetof( - Configuration_Thread_control, + Thread_Configured_control, Control.libc_reent ), - offsetof( Configuration_Thread_control, Newlib ) + offsetof( Thread_Configured_control, Newlib ) } #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1 , { offsetof( - Configuration_Thread_control, + Thread_Configured_control, Control.Join_queue.Queue.name ), - offsetof( Configuration_Thread_control, name ) + offsetof( Thread_Configured_control, name ) } #endif #ifdef RTEMS_POSIX_API , { offsetof( - Configuration_Thread_control, + Thread_Configured_control, Control.API_Extensions[ THREAD_API_POSIX ] ), - offsetof( Configuration_Thread_control, API_POSIX ) + offsetof( Thread_Configured_control, API_POSIX ) } #endif }; @@ -2946,46 +2779,122 @@ struct _reent *__getreent(void) const size_t _Thread_Control_add_on_count = RTEMS_ARRAY_SIZE( _Thread_Control_add_ons ); + #if defined(RTEMS_SMP) + struct Thread_queue_Configured_heads { + Thread_queue_Heads Heads; + Thread_queue_Priority_queue Priority[ _CONFIGURE_SCHEDULER_COUNT ]; + }; + + const size_t _Thread_queue_Heads_size = + sizeof( Thread_queue_Configured_heads ); + #endif + const uint32_t _Watchdog_Nanoseconds_per_tick = - 1000 * CONFIGURE_MICROSECONDS_PER_TICK; + (uint32_t) 1000 * CONFIGURE_MICROSECONDS_PER_TICK; const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND; + const size_t _Thread_Initial_thread_count = _CONFIGURE_IDLE_TASKS_COUNT + + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT + + rtems_resource_maximum_per_allocation( _CONFIGURE_TASKS ) + + rtems_resource_maximum_per_allocation( _CONFIGURE_POSIX_THREADS ); + + THREAD_INFORMATION_DEFINE( + _Thread, + OBJECTS_INTERNAL_API, + OBJECTS_INTERNAL_THREADS, + _CONFIGURE_IDLE_TASKS_COUNT + _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT + ); + + #if _CONFIGURE_BARRIERS > 0 + BARRIER_INFORMATION_DEFINE( _CONFIGURE_BARRIERS ); + #endif + + #if CONFIGURE_MAXIMUM_MESSAGE_QUEUES > 0 + MESSAGE_QUEUE_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_MESSAGE_QUEUES ); + #endif + + #if CONFIGURE_MAXIMUM_PARTITIONS > 0 + PARTITION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_PARTITIONS ); + #endif + + #if CONFIGURE_MAXIMUM_PERIODS > 0 + RATE_MONOTONIC_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_PERIODS ); + #endif + + #if CONFIGURE_MAXIMUM_PORTS > 0 + DUAL_PORTED_MEMORY_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_PORTS ); + #endif + + #if CONFIGURE_MAXIMUM_REGIONS > 0 + REGION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_REGIONS ); + #endif + + #if CONFIGURE_MAXIMUM_SEMAPHORES > 0 + SEMAPHORE_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_SEMAPHORES ); + #endif + + #if _CONFIGURE_TIMERS > 0 + TIMER_INFORMATION_DEFINE( _CONFIGURE_TIMERS ); + #endif + + #if _CONFIGURE_TASKS > 0 + THREAD_INFORMATION_DEFINE( + _RTEMS_tasks, + OBJECTS_CLASSIC_API, + OBJECTS_RTEMS_TASKS, + _CONFIGURE_TASKS + ); + #endif + + #if CONFIGURE_MAXIMUM_USER_EXTENSIONS > 0 + EXTENSION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_USER_EXTENSIONS ); + #endif + /** * This is the Classic API Configuration Table. */ rtems_api_configuration_table Configuration_RTEMS_API = { - _CONFIGURE_TASKS, - CONFIGURE_MAXIMUM_TIMERS + _CONFIGURE_TIMER_FOR_SHARED_MEMORY_DRIVER, - CONFIGURE_MAXIMUM_SEMAPHORES, - CONFIGURE_MAXIMUM_MESSAGE_QUEUES, - CONFIGURE_MAXIMUM_PARTITIONS, - CONFIGURE_MAXIMUM_REGIONS, - CONFIGURE_MAXIMUM_PORTS, - CONFIGURE_MAXIMUM_PERIODS, - _CONFIGURE_BARRIERS, CONFIGURE_INIT_TASK_TABLE_SIZE, CONFIGURE_INIT_TASK_TABLE }; + #if CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS > 0 + POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[ + rtems_resource_maximum_per_allocation( + CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS + ) + ]; + + const uint32_t _POSIX_Keys_Key_value_pair_maximum = + CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS; + #endif + + #if _CONFIGURE_POSIX_KEYS > 0 + POSIX_KEYS_INFORMATION_DEFINE( _CONFIGURE_POSIX_KEYS ); + #endif + #if CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES > 0 - const uint32_t _Configuration_POSIX_Maximum_message_queues = - CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES; + POSIX_MESSAGE_QUEUE_INFORMATION_DEFINE( + CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES + ); #endif #if CONFIGURE_MAXIMUM_POSIX_SEMAPHORES > 0 - const uint32_t _Configuration_POSIX_Maximum_named_semaphores = - CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; + POSIX_SEMAPHORE_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ); #endif #if CONFIGURE_MAXIMUM_POSIX_SHMS > 0 - const uint32_t _Configuration_POSIX_Maximum_shms = - CONFIGURE_MAXIMUM_POSIX_SHMS; + POSIX_SHM_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_SHMS ); #endif #if _CONFIGURE_POSIX_THREADS > 0 - const uint32_t _Configuration_POSIX_Maximum_threads = - _CONFIGURE_POSIX_THREADS; + THREAD_INFORMATION_DEFINE( + _POSIX_Threads, + OBJECTS_POSIX_API, + OBJECTS_POSIX_THREADS, + CONFIGURE_MAXIMUM_POSIX_THREADS + ); #endif #ifdef RTEMS_POSIX_API @@ -2995,8 +2904,7 @@ struct _reent *__getreent(void) #endif #if CONFIGURE_MAXIMUM_POSIX_TIMERS > 0 - const uint32_t _Configuration_POSIX_Maximum_timers = - CONFIGURE_MAXIMUM_POSIX_TIMERS; + POSIX_TIMER_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_TIMERS ); #endif #endif @@ -3021,8 +2929,6 @@ struct _reent *__getreent(void) CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */ _CONFIGURE_STACK_SPACE_SIZE, /* required stack space */ CONFIGURE_MAXIMUM_USER_EXTENSIONS, /* maximum dynamic extensions */ - _CONFIGURE_POSIX_KEYS, /* POSIX keys are always */ - CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS, /* enabled */ CONFIGURE_MICROSECONDS_PER_TICK, /* microseconds per clock tick */ CONFIGURE_TICKS_PER_TIMESLICE, /* ticks per timeslice quantum */ CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */ @@ -3182,35 +3088,12 @@ struct _reent *__getreent(void) uint32_t PER_INTEGER_TASK; uint32_t FP_OVERHEAD; - uint32_t CLASSIC; - uint32_t POSIX; /* System overhead pieces */ uint32_t MEMORY_FOR_IDLE_TASK; - /* Classic API Pieces */ - uint32_t CLASSIC_TASKS; - uint32_t TIMERS; - uint32_t SEMAPHORES; - uint32_t MESSAGE_QUEUES; - uint32_t PARTITIONS; - uint32_t REGIONS; - uint32_t PORTS; - uint32_t PERIODS; - uint32_t BARRIERS; - uint32_t USER_EXTENSIONS; - - /* POSIX API managers that are always enabled */ - uint32_t POSIX_KEYS; - /* POSIX API Pieces */ -#ifdef RTEMS_POSIX_API - uint32_t POSIX_TIMERS; uint32_t POSIX_QUEUED_SIGNALS; -#endif - uint32_t POSIX_MESSAGE_QUEUES; - uint32_t POSIX_SEMAPHORES; - uint32_t POSIX_SHMS; /* Stack space sizes */ uint32_t IDLE_TASKS_STACK; @@ -3230,36 +3113,12 @@ struct _reent *__getreent(void) _CONFIGURE_INITIALIZATION_THREADS_EXTRA_STACKS, _CONFIGURE_MEMORY_FOR_TASKS(1, 0), _CONFIGURE_MEMORY_FOR_TASKS(0, 1), - _CONFIGURE_MEMORY_FOR_CLASSIC, - _CONFIGURE_MEMORY_FOR_POSIX, /* System overhead pieces */ _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS, - /* Classic API Pieces */ - _CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS, 0), - _CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS), - _CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES), - _CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(CONFIGURE_MAXIMUM_MESSAGE_QUEUES), - _CONFIGURE_MEMORY_FOR_PARTITIONS(CONFIGURE_MAXIMUM_PARTITIONS), - _CONFIGURE_MEMORY_FOR_REGIONS( CONFIGURE_MAXIMUM_REGIONS ), - _CONFIGURE_MEMORY_FOR_PORTS(CONFIGURE_MAXIMUM_PORTS), - _CONFIGURE_MEMORY_FOR_PERIODS(CONFIGURE_MAXIMUM_PERIODS), - _CONFIGURE_MEMORY_FOR_BARRIERS(_CONFIGURE_BARRIERS), - _CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS), - _CONFIGURE_MEMORY_FOR_POSIX_KEYS( _CONFIGURE_POSIX_KEYS, \ - CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS ), - /* POSIX API Pieces */ -#ifdef RTEMS_POSIX_API - _CONFIGURE_MEMORY_FOR_POSIX_TIMERS( CONFIGURE_MAXIMUM_POSIX_TIMERS ), - _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS( - CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS ), -#endif - _CONFIGURE_MEMORY_FOR_POSIX_MESSAGE_QUEUES( - CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES ), - _CONFIGURE_MEMORY_FOR_POSIX_SEMAPHORES( CONFIGURE_MAXIMUM_POSIX_SEMAPHORES ), - _CONFIGURE_MEMORY_FOR_POSIX_SHMS( CONFIGURE_MAXIMUM_POSIX_SHMS ), + _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS, /* Stack space sizes */ _CONFIGURE_IDLE_TASKS_STACK, @@ -3311,21 +3170,6 @@ struct _reent *__getreent(void) #error "CONFIGURATION ERROR: RTEMS not configured for multiprocessing!!" #endif -/* - * If an attempt was made to configure POSIX objects and - * the POSIX API was not configured into RTEMS, error out. - * - * @note POSIX Keys are always available so the parameters - * CONFIGURE_MAXIMUM_POSIX_KEYS and - * CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS are not in this list. - */ -#if !defined(RTEMS_POSIX_API) - #if ((CONFIGURE_MAXIMUM_POSIX_TIMERS != 0) || \ - (CONFIGURE_MAXIMUM_POSIX_QUEUED_SIGNALS != 0)) - #error "CONFIGURATION ERROR: POSIX API support not configured!!" - #endif -#endif - #if !defined(RTEMS_SCHEDSIM) #if !defined(CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE) /* diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h index 36b20dba09..ae11fd9df8 100644 --- a/cpukit/include/rtems/config.h +++ b/cpukit/include/rtems/config.h @@ -127,18 +127,6 @@ typedef struct { */ uintptr_t stack_space_size; - /** - * This field specifies the maximum number of dynamically installed - * used extensions. - */ - uint32_t maximum_extensions; - - /** - * This field contains the maximum number of POSIX API - * keys which are configured for this application. - */ - uint32_t maximum_keys; - /** * This field contains the maximum number of POSIX API * key value pairs which are configured for this application. diff --git a/cpukit/include/rtems/extensiondata.h b/cpukit/include/rtems/extensiondata.h index e665fda04f..61319d5668 100644 --- a/cpukit/include/rtems/extensiondata.h +++ b/cpukit/include/rtems/extensiondata.h @@ -37,6 +37,31 @@ typedef struct { User_extensions_Control Extension; } Extension_Control; +/** + * @brief The Classic Extensions objects information. + */ +extern Objects_Information _Extension_Information; + +/** + * @brief Macro to define the objects information for the Classic Extensions + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define EXTENSION_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _Extension, \ + OBJECTS_CLASSIC_API, \ + OBJECTS_RTEMS_EXTENSIONS, \ + Extension_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/extensionimpl.h b/cpukit/include/rtems/extensionimpl.h index fd71d530ae..6ad4956b3a 100644 --- a/cpukit/include/rtems/extensionimpl.h +++ b/cpukit/include/rtems/extensionimpl.h @@ -33,8 +33,6 @@ extern "C" { * @{ */ -extern Objects_Information _Extension_Information; - RTEMS_INLINE_ROUTINE Extension_Control *_Extension_Allocate( void ) { return (Extension_Control *) _Objects_Allocate( &_Extension_Information ); diff --git a/cpukit/include/rtems/posix/key.h b/cpukit/include/rtems/posix/key.h index 1f09916f06..a710855b93 100644 --- a/cpukit/include/rtems/posix/key.h +++ b/cpukit/include/rtems/posix/key.h @@ -71,6 +71,24 @@ typedef struct { } POSIX_Keys_Key_value_pair; /** + * @brief The initial set of POSIX key and value pairs. + * + * This array is provided via <rtems/confdefs.h> in case POSIX key and value + * pairs are configured. The POSIX key and value pair count in this array must + * be equal to + * _Objects_Maximum_per_allocation( _POSIX_Keys_Key_value_pair_maximum ). + */ +extern POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[]; + +/** + * @brief The POSIX key and value pairs maximum. + * + * This value is provided via <rtems/confdefs.h> in case POSIX key and value + * pairs are configured. The OBJECTS_UNLIMITED_OBJECTS flag may be set. + */ +extern const uint32_t _POSIX_Keys_Key_value_pair_maximum; + +/** * @brief The data structure used to manage a POSIX key. */ typedef struct { @@ -85,6 +103,30 @@ typedef struct { Chain_Control Key_value_pairs; } POSIX_Keys_Control; +/** + * @brief The POSIX Key objects information. + */ +extern Objects_Information _POSIX_Keys_Information; + +/** + * @brief Macro to define the objects information for the POSIX Key objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define POSIX_KEYS_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Keys, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_KEYS, \ + POSIX_Keys_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/posix/keyimpl.h b/cpukit/include/rtems/posix/keyimpl.h index 1148123638..d27244fe81 100644 --- a/cpukit/include/rtems/posix/keyimpl.h +++ b/cpukit/include/rtems/posix/keyimpl.h @@ -37,11 +37,6 @@ extern "C" { */ /** - * @brief The information control block used to manage this class of objects. - */ -extern Objects_Information _POSIX_Keys_Information; - -/** * @brief This freechain is used as a memory pool for POSIX_Keys_Key_value_pair. */ extern Freechain_Control _POSIX_Keys_Keypool; diff --git a/cpukit/include/rtems/posix/mqueue.h b/cpukit/include/rtems/posix/mqueue.h index bec82ee3d9..84010e7d4f 100644 --- a/cpukit/include/rtems/posix/mqueue.h +++ b/cpukit/include/rtems/posix/mqueue.h @@ -31,11 +31,13 @@ #ifndef _RTEMS_POSIX_MQUEUE_H #define _RTEMS_POSIX_MQUEUE_H -#include <signal.h> -#include <mqueue.h> /* struct mq_attr */ #include <rtems/score/coremsg.h> #include <rtems/score/objectdata.h> +#include <limits.h> +#include <mqueue.h> +#include <signal.h> + #ifdef __cplusplus extern "C" { #endif @@ -61,7 +63,30 @@ typedef struct { int oflag; } POSIX_Message_queue_Control; -extern const uint32_t _Configuration_POSIX_Maximum_message_queues; +/** + * @brief The POSIX Message Queue objects information. + */ +extern Objects_Information _POSIX_Message_queue_Information; + +/** + * @brief Macro to define the objects information for the POSIX Message Queue + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define POSIX_MESSAGE_QUEUE_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Message_queue, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_MESSAGE_QUEUES, \ + POSIX_Message_queue_Control, \ + max, \ + _POSIX_PATH_MAX, \ + NULL \ + ) /** @} */ diff --git a/cpukit/include/rtems/posix/mqueueimpl.h b/cpukit/include/rtems/posix/mqueueimpl.h index 28381ad54b..14573287ad 100644 --- a/cpukit/include/rtems/posix/mqueueimpl.h +++ b/cpukit/include/rtems/posix/mqueueimpl.h @@ -31,12 +31,6 @@ extern "C" { #endif /** - * This defines the information control block used to manage - * this class of objects. - */ -extern Objects_Information _POSIX_Message_queue_Information; - -/** * @brief Delete a POSIX Message Queue * * This routine supports the mq_unlink and mq_close routines by diff --git a/cpukit/include/rtems/posix/pthread.h b/cpukit/include/rtems/posix/pthread.h index 25bf40ef27..9b59fd922d 100644 --- a/cpukit/include/rtems/posix/pthread.h +++ b/cpukit/include/rtems/posix/pthread.h @@ -38,8 +38,6 @@ extern "C" { extern const size_t _Configuration_POSIX_Minimum_stack_size; -extern const uint32_t _Configuration_POSIX_Maximum_threads; - /** * @brief POSIX threads initialize user threads body. * @@ -48,6 +46,12 @@ extern const uint32_t _Configuration_POSIX_Maximum_threads; */ extern void _POSIX_Threads_Initialize_user_threads_body(void); +/** + * The following defines the information control block used to manage + * this class of objects. + */ +extern Thread_Information _POSIX_Threads_Information; + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/posix/pthreadimpl.h b/cpukit/include/rtems/posix/pthreadimpl.h index be44716983..abb4d0f942 100644 --- a/cpukit/include/rtems/posix/pthreadimpl.h +++ b/cpukit/include/rtems/posix/pthreadimpl.h @@ -42,12 +42,6 @@ extern "C" { */ #define PTHREAD_MINIMUM_STACK_SIZE _Configuration_POSIX_Minimum_stack_size -/** - * The following defines the information control block used to manage - * this class of objects. - */ -extern Thread_Information _POSIX_Threads_Information; - #if defined(RTEMS_POSIX_API) RTEMS_INLINE_ROUTINE void _POSIX_Threads_Sporadic_timer_insert( Thread_Control *the_thread, diff --git a/cpukit/include/rtems/posix/semaphore.h b/cpukit/include/rtems/posix/semaphore.h index 16b6d711cc..db36b39c9d 100644 --- a/cpukit/include/rtems/posix/semaphore.h +++ b/cpukit/include/rtems/posix/semaphore.h @@ -19,9 +19,11 @@ #ifndef _RTEMS_POSIX_SEMAPHORE_H #define _RTEMS_POSIX_SEMAPHORE_H -#include <semaphore.h> #include <rtems/score/objectdata.h> +#include <limits.h> +#include <semaphore.h> + #ifdef __cplusplus extern "C" { #endif @@ -46,7 +48,30 @@ typedef struct { uint32_t open_count; } POSIX_Semaphore_Control; -extern const uint32_t _Configuration_POSIX_Maximum_named_semaphores; +/** + * @brief The POSIX Semaphore objects information. + */ +extern Objects_Information _POSIX_Semaphore_Information; + +/** + * @brief Macro to define the objects information for the POSIX Semaphore + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define POSIX_SEMAPHORE_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Semaphore, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_SEMAPHORES, \ + POSIX_Semaphore_Control, \ + max, \ + _POSIX_PATH_MAX, \ + NULL \ + ) /** @} */ diff --git a/cpukit/include/rtems/posix/semaphoreimpl.h b/cpukit/include/rtems/posix/semaphoreimpl.h index 5ae6a300fa..b662d001cb 100644 --- a/cpukit/include/rtems/posix/semaphoreimpl.h +++ b/cpukit/include/rtems/posix/semaphoreimpl.h @@ -34,12 +34,6 @@ extern "C" { */ #define POSIX_SEMAPHORE_MAGIC 0x5d367fe7UL -/** - * This defines the information control block used to manage - * this class of objects. - */ -extern Objects_Information _POSIX_Semaphore_Information; - RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control * _POSIX_Semaphore_Allocate_unprotected( void ) { diff --git a/cpukit/include/rtems/posix/shm.h b/cpukit/include/rtems/posix/shm.h index ae0416e1fe..3d10e65fea 100644 --- a/cpukit/include/rtems/posix/shm.h +++ b/cpukit/include/rtems/posix/shm.h @@ -126,7 +126,30 @@ typedef struct { time_t ctime; } POSIX_Shm_Control; -extern const uint32_t _Configuration_POSIX_Maximum_shms; +/** + * @brief The POSIX Shared Memory objects information. + */ +extern Objects_Information _POSIX_Shm_Information; + +/** + * @brief Macro to define the objects information for the POSIX Shared Memory + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define POSIX_SHM_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Shm, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_SHMS, \ + POSIX_Shm_Control, \ + max, \ + _POSIX_PATH_MAX, \ + NULL \ + ) /** * @brief object_create operation for shm objects stored in RTEMS Workspace. diff --git a/cpukit/include/rtems/posix/shmimpl.h b/cpukit/include/rtems/posix/shmimpl.h index f16af8123d..6882119a83 100644 --- a/cpukit/include/rtems/posix/shmimpl.h +++ b/cpukit/include/rtems/posix/shmimpl.h @@ -31,8 +31,6 @@ extern "C" { * @{ */ -extern Objects_Information _POSIX_Shm_Information; - RTEMS_INLINE_ROUTINE POSIX_Shm_Control *_POSIX_Shm_Allocate_unprotected( void ) { return (POSIX_Shm_Control *) diff --git a/cpukit/include/rtems/posix/sigset.h b/cpukit/include/rtems/posix/sigset.h index 96bcc086ba..6f46f61104 100644 --- a/cpukit/include/rtems/posix/sigset.h +++ b/cpukit/include/rtems/posix/sigset.h @@ -19,7 +19,8 @@ #ifndef _RTEMS_POSIX_SIGSET_H #define _RTEMS_POSIX_SIGSET_H -#include <signal.h> // sigset_t +#include <stdbool.h> +#include <signal.h> /* * Currently 32 signals numbered 1-32 are defined diff --git a/cpukit/include/rtems/posix/timer.h b/cpukit/include/rtems/posix/timer.h index 2cbc56e873..0b7a91e256 100644 --- a/cpukit/include/rtems/posix/timer.h +++ b/cpukit/include/rtems/posix/timer.h @@ -50,7 +50,29 @@ typedef struct { struct timespec time; /* Time at which the timer was started */ } POSIX_Timer_Control; -extern const uint32_t _Configuration_POSIX_Maximum_timers; +/** + * @brief The POSIX Timer objects information. + */ +extern Objects_Information _POSIX_Timer_Information; + +/** + * @brief Macro to define the objects information for the POSIX Timer objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define POSIX_TIMER_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _POSIX_Timer, \ + OBJECTS_POSIX_API, \ + OBJECTS_POSIX_TIMERS, \ + POSIX_Timer_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ + ) /** @} */ diff --git a/cpukit/include/rtems/posix/timerimpl.h b/cpukit/include/rtems/posix/timerimpl.h index 42a814c992..2b4eec1e24 100644 --- a/cpukit/include/rtems/posix/timerimpl.h +++ b/cpukit/include/rtems/posix/timerimpl.h @@ -52,12 +52,6 @@ extern "C" { #endif /** - * The following defines the information control block used to manage - * this class of objects. - */ -extern Objects_Information _POSIX_Timer_Information; - -/** * @brief POSIX Timer Allocate * * This function allocates a timer control block from diff --git a/cpukit/include/rtems/rtems/barrierdata.h b/cpukit/include/rtems/rtems/barrierdata.h index 12b2eab2d8..1598bbf6db 100644 --- a/cpukit/include/rtems/rtems/barrierdata.h +++ b/cpukit/include/rtems/rtems/barrierdata.h @@ -44,6 +44,31 @@ typedef struct { rtems_attribute attribute_set; } Barrier_Control; +/** + * @brief The Classic Barrier objects information. + */ +extern Objects_Information _Barrier_Information; + +/** + * @brief Macro to define the objects information for the Classic Barrier + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define BARRIER_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _Barrier, \ + OBJECTS_CLASSIC_API, \ + OBJECTS_RTEMS_BARRIERS, \ + Barrier_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/barrierimpl.h b/cpukit/include/rtems/rtems/barrierimpl.h index 0acef05af3..5494191610 100644 --- a/cpukit/include/rtems/rtems/barrierimpl.h +++ b/cpukit/include/rtems/rtems/barrierimpl.h @@ -35,12 +35,6 @@ extern "C" { */ /** - * The following defines the information control block used to manage - * this class of objects. - */ -extern Objects_Information _Barrier_Information; - -/** * @brief _Barrier_Allocate * * This function allocates a barrier control block from diff --git a/cpukit/include/rtems/rtems/config.h b/cpukit/include/rtems/rtems/config.h index 51b3dbe30f..a3e3988cd6 100644 --- a/cpukit/include/rtems/rtems/config.h +++ b/cpukit/include/rtems/rtems/config.h @@ -47,61 +47,6 @@ extern "C" { * + required number of each object type */ typedef struct { - /** - * This field contains the maximum number of Classic API - * Tasks which are configured for this application. - */ - uint32_t maximum_tasks; - - /** - * This field contains the maximum number of Classic API - * Timers which are configured for this application. - */ - uint32_t maximum_timers; - - /** - * This field contains the maximum number of Classic API - * Semaphores which are configured for this application. - */ - uint32_t maximum_semaphores; - - /** - * This field contains the maximum number of Classic API - * Message Queues which are configured for this application. - */ - uint32_t maximum_message_queues; - - /** - * This field contains the maximum number of Classic API - * Partitions which are configured for this application. - */ - uint32_t maximum_partitions; - - /** - * This field contains the maximum number of Classic API - * Regions which are configured for this application. - */ - uint32_t maximum_regions; - - /** - * This field contains the maximum number of Classic API - * Dual Ported Memory Areas which are configured for this - * application. - */ - uint32_t maximum_ports; - - /** - * This field contains the maximum number of Classic API - * Rate Monotonic Periods which are configured for this - * application. - */ - uint32_t maximum_periods; - - /** - * This field contains the maximum number of Classic API - * Barriers which are configured for this application. - */ - uint32_t maximum_barriers; /** * This field contains the number of Classic API Initialization diff --git a/cpukit/include/rtems/rtems/dpmemdata.h b/cpukit/include/rtems/rtems/dpmemdata.h index 86302f9089..3727297482 100644 --- a/cpukit/include/rtems/rtems/dpmemdata.h +++ b/cpukit/include/rtems/rtems/dpmemdata.h @@ -46,6 +46,31 @@ typedef struct { uint32_t length; } Dual_ported_memory_Control; +/** + * @brief The Classic Dual Ported Memory objects information. + */ +extern Objects_Information _Dual_ported_memory_Information; + +/** + * @brief Macro to define the objects information for the Classic Dual Ported + * Memory objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define DUAL_PORTED_MEMORY_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _Dual_ported_memory, \ + OBJECTS_CLASSIC_API, \ + OBJECTS_RTEMS_PORTS, \ + Dual_ported_memory_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/dpmemimpl.h b/cpukit/include/rtems/rtems/dpmemimpl.h index 2b3fefd199..3da0d5237b 100644 --- a/cpukit/include/rtems/rtems/dpmemimpl.h +++ b/cpukit/include/rtems/rtems/dpmemimpl.h @@ -33,12 +33,6 @@ extern "C" { */ /** - * @brief Define the internal Dual Ported Memory information - * The following define the internal Dual Ported Memory information. - */ -extern Objects_Information _Dual_ported_memory_Information; - -/** * @brief Allocates a port control block from the inactive chain * of free port control blocks. * diff --git a/cpukit/include/rtems/rtems/messagedata.h b/cpukit/include/rtems/rtems/messagedata.h index b035dff97b..fa1f681473 100644 --- a/cpukit/include/rtems/rtems/messagedata.h +++ b/cpukit/include/rtems/rtems/messagedata.h @@ -44,6 +44,45 @@ typedef struct { rtems_attribute attribute_set; } Message_queue_Control; +/** + * @brief The Classic Message Queue objects information. + */ +extern Objects_Information _Message_queue_Information; + +#if defined(RTEMS_MULTIPROCESSING) +/** + * @brief _Message_queue_MP_Send_extract_proxy + * + * This routine is invoked when a task is deleted and it + * has a proxy which must be removed from a thread queue and + * the remote node must be informed of this. + */ +void _Message_queue_MP_Send_extract_proxy ( + Thread_Control *the_thread, + Objects_Id id +); +#endif + +/** + * @brief Macro to define the objects information for the Classic Message Queue + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define MESSAGE_QUEUE_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _Message_queue, \ + OBJECTS_CLASSIC_API, \ + OBJECTS_RTEMS_MESSAGE_QUEUES, \ + Message_queue_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + _Message_queue_MP_Send_extract_proxy \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/messageimpl.h b/cpukit/include/rtems/rtems/messageimpl.h index 098e310804..5872b67e04 100644 --- a/cpukit/include/rtems/rtems/messageimpl.h +++ b/cpukit/include/rtems/rtems/messageimpl.h @@ -52,12 +52,6 @@ typedef enum { } Message_queue_Submit_types; /** - * The following defines the information control block used to - * manage this class of objects. - */ -extern Objects_Information _Message_queue_Information; - -/** * @brief Message_queue_Submit * * This routine implements the directives rtems_message_queue_send diff --git a/cpukit/include/rtems/rtems/msgmp.h b/cpukit/include/rtems/rtems/msgmp.h index 3dabd8d46b..1c5818b44e 100644 --- a/cpukit/include/rtems/rtems/msgmp.h +++ b/cpukit/include/rtems/rtems/msgmp.h @@ -189,18 +189,6 @@ void _Message_queue_MP_Send_object_was_deleted ( Objects_Id mp_id ); -/** - * @brief _Message_queue_MP_Send_extract_proxy - * - * This routine is invoked when a task is deleted and it - * has a proxy which must be removed from a thread queue and - * the remote node must be informed of this. - */ -void _Message_queue_MP_Send_extract_proxy ( - Thread_Control *the_thread, - Objects_Id id -); - /**@}*/ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/partdata.h b/cpukit/include/rtems/rtems/partdata.h index 3b030c8f34..3be94b6cd1 100644 --- a/cpukit/include/rtems/rtems/partdata.h +++ b/cpukit/include/rtems/rtems/partdata.h @@ -53,6 +53,45 @@ typedef struct { Chain_Control Memory; } Partition_Control; +/** + * @brief The Classic Partition objects information. + */ +extern Objects_Information _Partition_Information; + +#if defined(RTEMS_MULTIPROCESSING) +/** + * @brief Partition_MP_Send_extract_proxy + * + * This routine is invoked when a task is deleted and it + * has a proxy which must be removed from a thread queue and + * the remote node must be informed of this. + */ +void _Partition_MP_Send_extract_proxy ( + Thread_Control *the_thread, + Objects_Id id +); +#endif + +/** + * @brief Macro to define the objects information for the Classic Partition + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define PARTITION_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _Partition, \ + OBJECTS_CLASSIC_API, \ + OBJECTS_RTEMS_PARTITIONS, \ + Partition_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + _Partition_MP_Send_extract_proxy \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/partimpl.h b/cpukit/include/rtems/rtems/partimpl.h index d795748723..0160d4add6 100644 --- a/cpukit/include/rtems/rtems/partimpl.h +++ b/cpukit/include/rtems/rtems/partimpl.h @@ -34,12 +34,6 @@ extern "C" { */ /** - * The following defines the information control block used to - * manage this class of objects. - */ -extern Objects_Information _Partition_Information; - -/** * @brief Allocate a buffer from the_partition. * * This function attempts to allocate a buffer from the_partition. diff --git a/cpukit/include/rtems/rtems/partmp.h b/cpukit/include/rtems/rtems/partmp.h index b9eaa08b8c..5fffd68480 100644 --- a/cpukit/include/rtems/rtems/partmp.h +++ b/cpukit/include/rtems/rtems/partmp.h @@ -122,18 +122,6 @@ void _Partition_MP_Process_packet ( * cannot be deleted when buffers are in use. */ -/** - * @brief Partition_MP_Send_extract_proxy - * - * This routine is invoked when a task is deleted and it - * has a proxy which must be removed from a thread queue and - * the remote node must be informed of this. - */ -void _Partition_MP_Send_extract_proxy ( - Thread_Control *the_thread, - Objects_Id id -); - #ifdef __cplusplus } #endif diff --git a/cpukit/include/rtems/rtems/ratemondata.h b/cpukit/include/rtems/rtems/ratemondata.h index 898fc653c1..0e4415237b 100644 --- a/cpukit/include/rtems/rtems/ratemondata.h +++ b/cpukit/include/rtems/rtems/ratemondata.h @@ -130,6 +130,31 @@ typedef struct { uint64_t latest_deadline; } Rate_monotonic_Control; +/** + * @brief The Classic Rate Monotonic objects information. + */ +extern Objects_Information _Rate_monotonic_Information; + +/** + * @brief Macro to define the objects information for the Classic Rate + * Monotonic objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define RATE_MONOTONIC_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _Rate_monotonic, \ + OBJECTS_CLASSIC_API, \ + OBJECTS_RTEMS_PERIODS, \ + Rate_monotonic_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/ratemonimpl.h b/cpukit/include/rtems/rtems/ratemonimpl.h index 2a417f66c6..eb359b17c8 100644 --- a/cpukit/include/rtems/rtems/ratemonimpl.h +++ b/cpukit/include/rtems/rtems/ratemonimpl.h @@ -49,14 +49,6 @@ extern "C" { ( THREAD_WAIT_CLASS_PERIOD | THREAD_WAIT_STATE_READY_AGAIN ) /** - * @brief Rate Monotonic Period Class Management Structure - * - * This instance of Objects_Information is used to manage the - * set of rate monotonic period instances. - */ -extern Objects_Information _Rate_monotonic_Information; - -/** * @brief Allocates a period control block from * the inactive chain of free period control blocks. * diff --git a/cpukit/include/rtems/rtems/regiondata.h b/cpukit/include/rtems/rtems/regiondata.h index cfbc07f713..c64f623c1d 100644 --- a/cpukit/include/rtems/rtems/regiondata.h +++ b/cpukit/include/rtems/rtems/regiondata.h @@ -46,6 +46,31 @@ typedef struct { Heap_Control Memory; } Region_Control; +/** + * @brief The Classic Region objects information. + */ +extern Objects_Information _Region_Information; + +/** + * @brief Macro to define the objects information for the Classic Region + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define REGION_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _Region, \ + OBJECTS_CLASSIC_API, \ + OBJECTS_RTEMS_REGIONS, \ + Region_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/regionimpl.h b/cpukit/include/rtems/rtems/regionimpl.h index 8a7ee258cc..35775671e6 100644 --- a/cpukit/include/rtems/rtems/regionimpl.h +++ b/cpukit/include/rtems/rtems/regionimpl.h @@ -39,12 +39,6 @@ extern "C" { RTEMS_CONTAINER_OF( queue, Region_Control, Wait_queue.Queue ) /** - * The following defines the information control block used to - * manage this class of objects. - */ -extern Objects_Information _Region_Information; - -/** * @brief Region_Allocate * * This function allocates a region control block from diff --git a/cpukit/include/rtems/rtems/semdata.h b/cpukit/include/rtems/rtems/semdata.h index 04db07d6a0..d2275e5dfe 100644 --- a/cpukit/include/rtems/rtems/semdata.h +++ b/cpukit/include/rtems/rtems/semdata.h @@ -92,6 +92,45 @@ typedef struct { #endif } Semaphore_Control; +/** + * @brief The Classic Semaphore objects information. + */ +extern Objects_Information _Semaphore_Information; + +#if defined(RTEMS_MULTIPROCESSING) +/** + * @brief Semaphore MP Send Extract Proxy + * + * This routine is invoked when a task is deleted and it + * has a proxy which must be removed from a thread queue and + * the remote node must be informed of this. + */ +void _Semaphore_MP_Send_extract_proxy ( + Thread_Control *the_thread, + Objects_Id id +); +#endif + +/** + * @brief Macro to define the objects information for the Classic Semaphore + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define SEMAPHORE_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _Semaphore, \ + OBJECTS_CLASSIC_API, \ + OBJECTS_RTEMS_SEMAPHORES, \ + Semaphore_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + _Semaphore_MP_Send_extract_proxy \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/semimpl.h b/cpukit/include/rtems/rtems/semimpl.h index 1028879f39..743a4a9c6b 100644 --- a/cpukit/include/rtems/rtems/semimpl.h +++ b/cpukit/include/rtems/rtems/semimpl.h @@ -56,12 +56,6 @@ typedef enum { SEMAPHORE_DISCIPLINE_FIFO } Semaphore_Discipline; -/** - * The following defines the information control block used to manage - * this class of objects. - */ -extern Objects_Information _Semaphore_Information; - RTEMS_INLINE_ROUTINE const Thread_queue_Operations *_Semaphore_Get_operations( const Semaphore_Control *the_semaphore ) diff --git a/cpukit/include/rtems/rtems/semmp.h b/cpukit/include/rtems/rtems/semmp.h index 9d7669f43e..31774c39ba 100644 --- a/cpukit/include/rtems/rtems/semmp.h +++ b/cpukit/include/rtems/rtems/semmp.h @@ -120,18 +120,6 @@ void _Semaphore_MP_Send_object_was_deleted ( ); /** - * @brief Semaphore MP Send Extract Proxy - * - * This routine is invoked when a task is deleted and it - * has a proxy which must be removed from a thread queue and - * the remote node must be informed of this. - */ -void _Semaphore_MP_Send_extract_proxy ( - Thread_Control *the_thread, - Objects_Id id -); - -/** * @brief Semaphore Core Mutex MP Support * * This function processes the global actions necessary for remote diff --git a/cpukit/include/rtems/rtems/tasksdata.h b/cpukit/include/rtems/rtems/tasksdata.h index 18562bf067..19e6a8a618 100644 --- a/cpukit/include/rtems/rtems/tasksdata.h +++ b/cpukit/include/rtems/rtems/tasksdata.h @@ -67,6 +67,12 @@ typedef struct { extern void _RTEMS_tasks_Initialize_user_tasks_body( void ); +/** + * The following instantiates the information control block used to + * manage this class of objects. + */ +extern Thread_Information _RTEMS_tasks_Information; + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/tasksimpl.h b/cpukit/include/rtems/rtems/tasksimpl.h index b6694cc416..c98f1a3ab0 100644 --- a/cpukit/include/rtems/rtems/tasksimpl.h +++ b/cpukit/include/rtems/rtems/tasksimpl.h @@ -35,12 +35,6 @@ extern "C" { */ /** - * The following instantiates the information control block used to - * manage this class of objects. - */ -extern Thread_Information _RTEMS_tasks_Information; - -/** * @brief RTEMS User Task Initialization * * This routine creates and starts all configured user diff --git a/cpukit/include/rtems/rtems/timerdata.h b/cpukit/include/rtems/rtems/timerdata.h index db32739488..ed00671b10 100644 --- a/cpukit/include/rtems/rtems/timerdata.h +++ b/cpukit/include/rtems/rtems/timerdata.h @@ -57,6 +57,31 @@ typedef struct { Watchdog_Interval stop_time; } Timer_Control; +/** + * @brief The Classic Timer objects information. + */ +extern Objects_Information _Timer_Information; + +/** + * @brief Macro to define the objects information for the Classic Timer + * objects. + * + * This macro should only be used by <rtems/confdefs.h>. + * + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + */ +#define TIMER_INFORMATION_DEFINE( max ) \ + OBJECTS_INFORMATION_DEFINE( \ + _Timer, \ + OBJECTS_CLASSIC_API, \ + OBJECTS_RTEMS_TIMERS, \ + Timer_Control, \ + max, \ + OBJECTS_NO_STRING_NAME, \ + NULL \ + ) + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/rtems/timerimpl.h b/cpukit/include/rtems/rtems/timerimpl.h index d62db3b34a..59b2b9f816 100644 --- a/cpukit/include/rtems/rtems/timerimpl.h +++ b/cpukit/include/rtems/rtems/timerimpl.h @@ -53,12 +53,6 @@ typedef struct Timer_server_Control { extern Timer_server_Control *volatile _Timer_server; /** - * The following defines the information control block used to manage - * this class of objects. - */ -extern Objects_Information _Timer_Information; - -/** * @brief Timer_Allocate * * This function allocates a timer control block from diff --git a/cpukit/include/rtems/score/freechain.h b/cpukit/include/rtems/score/freechain.h index 1540c0e2a1..6282178347 100644 --- a/cpukit/include/rtems/score/freechain.h +++ b/cpukit/include/rtems/score/freechain.h @@ -17,7 +17,7 @@ #define _RTEMS_SCORE_FREECHAIN_H #include <rtems/score/basedefs.h> -#include <rtems/score/chain.h> +#include <rtems/score/chainimpl.h> #ifdef __cplusplus extern "C" { @@ -58,16 +58,24 @@ typedef struct { * get more nodes. * * @param[in] freechain The freechain control to initialize. - * @param[in] allocator The allocator function. + * @param[in] initial_nodes Array with the initial nodes. * @param[in] number_nodes The initial number of nodes. * @param[in] node_size The node size. */ -void _Freechain_Initialize( +RTEMS_INLINE_ROUTINE void _Freechain_Initialize( Freechain_Control *freechain, - Freechain_Allocator allocator, + void *initial_nodes, size_t number_nodes, size_t node_size -); +) +{ + _Chain_Initialize( + &freechain->Free, + initial_nodes, + number_nodes, + node_size + ); +} /** * @brief Gets a node from the freechain. diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h index 0c734e855f..df1a1298d9 100644 --- a/cpukit/include/rtems/score/interr.h +++ b/cpukit/include/rtems/score/interr.h @@ -173,7 +173,7 @@ typedef enum { /* INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = 16, */ /* INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = 17, */ /* INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_FROM_BAD_STATE = 18, */ - INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 = 19, + /* INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 = 19, */ /* INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP = 20, */ INTERNAL_ERROR_GXX_KEY_ADD_FAILED = 21, INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED = 22, diff --git a/cpukit/include/rtems/score/object.h b/cpukit/include/rtems/score/object.h index e7861ecab1..f75d1de2ab 100644 --- a/cpukit/include/rtems/score/object.h +++ b/cpukit/include/rtems/score/object.h @@ -307,18 +307,11 @@ RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_index( * * @return This method returns an object Id constructed from the arguments. */ -RTEMS_INLINE_ROUTINE Objects_Id _Objects_Build_id( - Objects_APIs the_api, - uint16_t the_class, - uint8_t node, - uint16_t index -) -{ - return (( (Objects_Id) the_api ) << OBJECTS_API_START_BIT) | - (( (Objects_Id) the_class ) << OBJECTS_CLASS_START_BIT) | - (( (Objects_Id) node ) << OBJECTS_NODE_START_BIT) | - (( (Objects_Id) index ) << OBJECTS_INDEX_START_BIT); -} +#define _Objects_Build_id( the_api, the_class, node, index ) \ + ( (Objects_Id) ( (Objects_Id) the_api << OBJECTS_API_START_BIT ) | \ + ( (Objects_Id) the_class << OBJECTS_CLASS_START_BIT ) | \ + ( (Objects_Id) node << OBJECTS_NODE_START_BIT ) | \ + ( (Objects_Id) index << OBJECTS_INDEX_START_BIT ) ) /** * Returns if the object maximum specifies unlimited objects. @@ -328,10 +321,8 @@ RTEMS_INLINE_ROUTINE Objects_Id _Objects_Build_id( * @retval true Unlimited objects are available. * @retval false The object count is fixed. */ -RTEMS_INLINE_ROUTINE bool _Objects_Is_unlimited( uint32_t maximum ) -{ - return (maximum & OBJECTS_UNLIMITED_OBJECTS) != 0; -} +#define _Objects_Is_unlimited( maximum ) \ + ( ( ( maximum ) & OBJECTS_UNLIMITED_OBJECTS ) != 0 ) /* * We cannot use an inline function for this since it may be evaluated at diff --git a/cpukit/include/rtems/score/objectdata.h b/cpukit/include/rtems/score/objectdata.h index 51258fa4a4..6139bfc1ec 100644 --- a/cpukit/include/rtems/score/objectdata.h +++ b/cpukit/include/rtems/score/objectdata.h @@ -19,7 +19,7 @@ #define _RTEMS_SCORE_OBJECTDATA_H #include <rtems/score/object.h> -#include <rtems/score/chain.h> +#include <rtems/score/chainimpl.h> #include <rtems/score/rbtree.h> #ifdef __cplusplus @@ -45,7 +45,57 @@ typedef struct { Objects_Name name; } Objects_Control; +/** + * This enumerated type is used in the class field of the object ID + * for RTEMS internal object classes. + */ +typedef enum { + OBJECTS_INTERNAL_NO_CLASS = 0, + OBJECTS_INTERNAL_THREADS = 1 +} Objects_Internal_API; + +/** + * This enumerated type is used in the class field of the object ID + * for the RTEMS Classic API. + */ +typedef enum { + OBJECTS_CLASSIC_NO_CLASS = 0, + OBJECTS_RTEMS_TASKS = 1, + OBJECTS_RTEMS_TIMERS = 2, + OBJECTS_RTEMS_SEMAPHORES = 3, + OBJECTS_RTEMS_MESSAGE_QUEUES = 4, + OBJECTS_RTEMS_PARTITIONS = 5, + OBJECTS_RTEMS_REGIONS = 6, + OBJECTS_RTEMS_PORTS = 7, + OBJECTS_RTEMS_PERIODS = 8, + OBJECTS_RTEMS_EXTENSIONS = 9, + OBJECTS_RTEMS_BARRIERS = 10 +} Objects_Classic_API; + +/** + * This enumerated type is used in the class field of the object ID + * for the POSIX API. + */ +typedef enum { + OBJECTS_POSIX_NO_CLASS = 0, + OBJECTS_POSIX_THREADS = 1, + OBJECTS_POSIX_KEYS = 2, + OBJECTS_POSIX_INTERRUPTS = 3, + OBJECTS_POSIX_MESSAGE_QUEUES = 5, + OBJECTS_POSIX_SEMAPHORES = 7, + OBJECTS_POSIX_TIMERS = 9, + OBJECTS_POSIX_SHMS = 12 +} Objects_POSIX_API; + +/** + * @brief Constant for the object information string name length to indicate + * that this object class has no string names. + */ +#define OBJECTS_NO_STRING_NAME 0 + #if defined( RTEMS_MULTIPROCESSING ) +struct _Thread_Control; + /** * @brief This defines the Global Object Control Block used to manage objects * resident on other nodes. @@ -86,8 +136,139 @@ typedef struct { */ uint32_t name; } Objects_MP_Control; + +/** + * The following type defines the callout used when a local task + * is extracted from a remote thread queue (i.e. it's proxy must + * extracted from the remote queue). + */ +typedef void ( *Objects_Thread_queue_Extract_callout )( + struct _Thread_Control *, + Objects_Id +); #endif +/** + * The following defines the structure for the information used to + * manage each class of objects. + */ +typedef struct { + /** This is the maximum valid id of this object class. */ + Objects_Id maximum_id; + /** This points to the table of local objects. */ + Objects_Control **local_table; + /** This is the number of objects on the Inactive list. */ + Objects_Maximum inactive; + /** This is the number of objects in a block. */ + Objects_Maximum objects_per_block; + /** This is the size in bytes of each object instance. */ + uint16_t object_size; + /** + * @brief This is the maximum length of names. + * + * A length of zero indicates that this object has a no string name + * (OBJECTS_NO_STRING_NAME). + */ + uint16_t name_length; + /** This is the chain of inactive control blocks. */ + Chain_Control Inactive; + /** This is the number of inactive objects per block. */ + Objects_Maximum *inactive_per_block; + /** This is a table to the chain of inactive object memory blocks. */ + Objects_Control **object_blocks; + Objects_Control *initial_objects; + #if defined(RTEMS_MULTIPROCESSING) + /** This is this object class' method called when extracting a thread. */ + Objects_Thread_queue_Extract_callout extract; + + /** + * @brief The global objects of this object information sorted by object + * identifier. + */ + RBTree_Control Global_by_id; + + /** + * @brief The global objects of this object information sorted by object + * name. + * + * Objects with the same name are sorted according to their identifier. + */ + RBTree_Control Global_by_name; + #endif +} Objects_Information; + +#if defined(RTEMS_MULTIPROCESSING) +#define OBJECTS_INFORMATION_MP( name, extract ) \ + , \ + extract, \ + RBTREE_INITIALIZER_EMPTY( name.Global_by_id ), \ + RBTREE_INITIALIZER_EMPTY( name.Global_by_name ) +#else +#define OBJECTS_INFORMATION_MP( name, extract ) +#endif + +/** + * @brief Statically initializes an objects information. + * + * The initialized objects information contains no objects. + * + * @param name The object class C designator namespace prefix, e.g. _Semaphore. + * @param api The object API number, e.g. OBJECTS_CLASSIC_API. + * @param cls The object class number, e.g. OBJECTS_RTEMS_SEMAPHORES. + * @param nl The object name string length, use OBJECTS_NO_STRING_NAME for + * objects without a string name. + */ +#define OBJECTS_INFORMATION_DEFINE_ZERO( name, api, cls, nl ) \ +Objects_Information name##_Information = { \ + _Objects_Build_id( api, cls, 1, 0 ), \ + NULL, \ + 0, \ + 0, \ + 0, \ + nl, \ + CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \ + NULL, \ + NULL, \ + NULL \ + OBJECTS_INFORMATION_MP( name##_Information, NULL ) \ +} + +/** + * @brief Statically initializes an objects information. + * + * The initialized objects information references a table with statically + * allocated objects as specified by the object maximum parameter. These + * objects must be registered via a call to _Objects_Information(). + * + * @param name The object class C designator namespace prefix, e.g. _Semaphore. + * @param api The object API number, e.g. OBJECTS_CLASSIC_API. + * @param cls The object class number, e.g. OBJECTS_RTEMS_SEMAPHORES. + * @param type The object class type. + * @param max The configured object maximum (the OBJECTS_UNLIMITED_OBJECTS flag + * may be set). + * @param nl The object name string length, use OBJECTS_NO_STRING_NAME for + * objects without a string name. + * @param ex The optional object extraction method. Used only if + * multiprocessing (RTEMS_MULTIPROCESSING) is enabled. + */ +#define OBJECTS_INFORMATION_DEFINE( name, api, cls, type, max, nl, ex ) \ +static Objects_Control * \ +name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \ +static type name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \ +Objects_Information name##_Information = { \ + _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \ + name##_Local_table, \ + 0, \ + _Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \ + sizeof( type ), \ + nl, \ + CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \ + NULL, \ + NULL, \ + &name##_Objects[ 0 ].Object \ + OBJECTS_INFORMATION_MP( name##_Information, ex ) \ +} + /** @} */ #ifdef __cplusplus diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h index bbf32fcd80..c5a315e57f 100644 --- a/cpukit/include/rtems/score/objectimpl.h +++ b/cpukit/include/rtems/score/objectimpl.h @@ -43,54 +43,12 @@ typedef bool (*Objects_Name_comparators)( uint16_t /* length */ ); -/** - * This enumerated type is used in the class field of the object ID - * for RTEMS internal object classes. - */ -typedef enum { - OBJECTS_INTERNAL_NO_CLASS = 0, - OBJECTS_INTERNAL_THREADS = 1 -} Objects_Internal_API; - /** This macro is used to generically specify the last API index. */ #define OBJECTS_INTERNAL_CLASSES_LAST OBJECTS_INTERNAL_THREADS -/** - * This enumerated type is used in the class field of the object ID - * for the RTEMS Classic API. - */ -typedef enum { - OBJECTS_CLASSIC_NO_CLASS = 0, - OBJECTS_RTEMS_TASKS = 1, - OBJECTS_RTEMS_TIMERS = 2, - OBJECTS_RTEMS_SEMAPHORES = 3, - OBJECTS_RTEMS_MESSAGE_QUEUES = 4, - OBJECTS_RTEMS_PARTITIONS = 5, - OBJECTS_RTEMS_REGIONS = 6, - OBJECTS_RTEMS_PORTS = 7, - OBJECTS_RTEMS_PERIODS = 8, - OBJECTS_RTEMS_EXTENSIONS = 9, - OBJECTS_RTEMS_BARRIERS = 10 -} Objects_Classic_API; - /** This macro is used to generically specify the last API index. */ #define OBJECTS_RTEMS_CLASSES_LAST OBJECTS_RTEMS_BARRIERS -/** - * This enumerated type is used in the class field of the object ID - * for the POSIX API. - */ -typedef enum { - OBJECTS_POSIX_NO_CLASS = 0, - OBJECTS_POSIX_THREADS = 1, - OBJECTS_POSIX_KEYS = 2, - OBJECTS_POSIX_INTERRUPTS = 3, - OBJECTS_POSIX_MESSAGE_QUEUES = 5, - OBJECTS_POSIX_SEMAPHORES = 7, - OBJECTS_POSIX_TIMERS = 9, - OBJECTS_POSIX_SHMS = 12 -} Objects_POSIX_API; - /** This macro is used to generically specify the last API index. */ #define OBJECTS_POSIX_CLASSES_LAST OBJECTS_POSIX_SHMS @@ -103,71 +61,6 @@ typedef enum { OBJECTS_FAKE_OBJECTS_SCHEDULERS = 1 } Objects_Fake_objects_API; -#if defined(RTEMS_MULTIPROCESSING) -/** - * The following type defines the callout used when a local task - * is extracted from a remote thread queue (i.e. it's proxy must - * extracted from the remote queue). - */ -typedef void ( *Objects_Thread_queue_Extract_callout )( - Thread_Control *, - Objects_Id -); -#endif - -/** - * The following defines the structure for the information used to - * manage each class of objects. - */ -typedef struct { - /** This is the maximum valid id of this object class. */ - Objects_Id maximum_id; - /** This points to the table of local objects. */ - Objects_Control **local_table; - /** This is the number of objects on the Inactive list. */ - Objects_Maximum inactive; - /** - * @brief This is the number of objects in a block if the automatic extension - * is enabled. - * - * This member is zero if the automatic extension is disabled. - */ - Objects_Maximum objects_per_block; - /** This is the size in bytes of each object instance. */ - uint16_t object_size; - /** - * @brief This is the maximum length of names. - * - * A length of zero indicates that this object has a no string name - * (OBJECTS_NO_STRING_NAME). - */ - uint16_t name_length; - /** This is the chain of inactive control blocks. */ - Chain_Control Inactive; - /** This is the number of inactive objects per block. */ - Objects_Maximum *inactive_per_block; - /** This is a table to the chain of inactive object memory blocks. */ - Objects_Control **object_blocks; - #if defined(RTEMS_MULTIPROCESSING) - /** This is this object class' method called when extracting a thread. */ - Objects_Thread_queue_Extract_callout extract; - - /** - * @brief The global objects of this object information sorted by object - * identifier. - */ - RBTree_Control Global_by_id; - - /** - * @brief The global objects of this object information sorted by object - * name. - * - * Objects with the same name are sorted according to their identifier. - */ - RBTree_Control Global_by_name; - #endif -} Objects_Information; - /** * The following is referenced to the node number of the local node. */ @@ -222,84 +115,13 @@ void _Objects_Shrink_information( Objects_Information *information ); -void _Objects_Do_initialize_information( - Objects_Information *information, - Objects_APIs the_api, - uint16_t the_class, - uint32_t maximum, - uint16_t object_size, - uint16_t maximum_name_length -#if defined(RTEMS_MULTIPROCESSING) - , - Objects_Thread_queue_Extract_callout extract -#endif -); - /** - * @brief Constant for the object information string name length to indicate - * that this object class has no string names. - */ -#define OBJECTS_NO_STRING_NAME 0 - -/** - * @brief Initialize object Information - * - * This function initializes an object class information record. - * SUPPORTS_GLOBAL is true if the object class supports global - * objects, and false otherwise. Maximum indicates the number - * of objects required in this class and size indicates the size - * in bytes of each control block for this object class. The - * name length and string designator are also set. In addition, - * the class may be a task, therefore this information is also included. + * @brief Initializes the specified objects information. * - * @param[in] information points to an object class information block. - * @param[in] the_api indicates the API associated with this information block. - * @param[in] the_class indicates the class of object being managed - * by this information block. It is specific to @a the_api. - * @param[in] maximum is the maximum number of instances of this object - * class which may be concurrently active. - * @param[in] object_size is the size of the data structure for this class. - * @param[in] is_string is true if this object uses string style names. - * @param[in] maximum_name_length is the maximum length of object names. + * The objects information must be statically pre-initialized with the + * OBJECTS_INFORMATION_DEFINE() macro before this function is called. */ -#if defined(RTEMS_MULTIPROCESSING) - #define _Objects_Initialize_information( \ - information, \ - the_api, \ - the_class, \ - maximum, \ - object_size, \ - maximum_name_length, \ - extract \ - ) \ - _Objects_Do_initialize_information( \ - information, \ - the_api, \ - the_class, \ - maximum, \ - object_size, \ - maximum_name_length, \ - extract \ - ) -#else - #define _Objects_Initialize_information( \ - information, \ - the_api, \ - the_class, \ - maximum, \ - object_size, \ - maximum_name_length, \ - extract \ - ) \ - _Objects_Do_initialize_information( \ - information, \ - the_api, \ - the_class, \ - maximum, \ - object_size, \ - maximum_name_length \ - ) -#endif +void _Objects_Initialize_information( Objects_Information *information ); /** * @brief Object API Maximum Class diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h index 7e24af43c9..9bf920d5fb 100644 --- a/cpukit/include/rtems/score/thread.h +++ b/cpukit/include/rtems/score/thread.h @@ -26,6 +26,7 @@ #if defined(RTEMS_MULTIPROCESSING) #include <rtems/score/mppkt.h> #endif +#include <rtems/score/freechain.h> #include <rtems/score/isrlock.h> #include <rtems/score/objectdata.h> #include <rtems/score/priority.h> @@ -909,7 +910,7 @@ typedef struct { * * This array is provided via <rtems/confdefs.h>. * - * @see _Thread_Control_add_on_count and _Thread_Control_size. + * @see _Thread_Control_add_on_count. */ extern const Thread_Control_add_on _Thread_Control_add_ons[]; @@ -923,13 +924,11 @@ extern const Thread_Control_add_on _Thread_Control_add_ons[]; extern const size_t _Thread_Control_add_on_count; /** - * @brief Size of the thread control block of a particular application. + * @brief Count of configured threads. * * This value is provided via <rtems/confdefs.h>. - * - * @see _Thread_Control_add_ons. */ -extern const size_t _Thread_Control_size; +extern const size_t _Thread_Initial_thread_count; /** * @brief Maximum size of a thread name in characters (including the @@ -939,6 +938,115 @@ extern const size_t _Thread_Control_size; */ extern const size_t _Thread_Maximum_name_size; +/** + * @brief The configured thread control block. + * + * This type is defined in <rtems/confdefs.h> and depends on the application + * configuration. + */ +typedef struct Thread_Configured_control Thread_Configured_control; + +/** + * @brief The configured thread queue heads. + * + * In SMP configurations, this type is defined in <rtems/confdefs.h> and depends + * on the application configuration. + */ +#if defined(RTEMS_SMP) +typedef struct Thread_queue_Configured_heads Thread_queue_Configured_heads; +#else +typedef Thread_queue_Heads Thread_queue_Configured_heads; +#endif + +/** + * @brief Size of the thread queue heads of a particular application. + * + * In SMP configurations, this value is provided via <rtems/confdefs.h>. + */ +#if defined(RTEMS_SMP) +extern const size_t _Thread_queue_Heads_size; +#else +#define _Thread_queue_Heads_size sizeof(Thread_queue_Heads) +#endif + +/** + * @brief The thread object information. + */ +typedef struct { + /** + * @brief The object information. + */ + Objects_Information Objects; + + /** + * @brief Thread queue heads maintenance. + */ + union { + /** + * @brief Contains the initial set of thread queue heads. + * + * This is set by <rtems/confdefs.h> via THREAD_INFORMATION_DEFINE(). + */ + Thread_queue_Configured_heads *initial; + + /** + * @brief The free thread queue heads. + * + * This member is initialized by _Thread_Initialize_information(). + */ + Freechain_Control Free; + } Thread_queue_heads; +} Thread_Information; + +/** + * @brief The internal thread objects information. + */ +extern Thread_Information _Thread_Information; + +#define THREAD_INFORMATION_DEFINE_ZERO( name, api, cls ) \ +Thread_Information name##_Information = { \ + { \ + _Objects_Build_id( api, cls, 1, 0 ), \ + NULL, \ + 0, \ + 0, \ + 0, \ + 0, \ + CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \ + NULL, \ + NULL, \ + NULL \ + OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ), \ + }, { \ + NULL \ + } \ +} + +#define THREAD_INFORMATION_DEFINE( name, api, cls, max ) \ +static Objects_Control * \ +name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \ +static Thread_Configured_control \ +name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \ +static Thread_queue_Configured_heads \ +name##_Heads[ _Objects_Maximum_per_allocation( max ) ]; \ +Thread_Information name##_Information = { \ + { \ + _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \ + name##_Local_table, \ + 0, \ + _Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \ + sizeof( Thread_Configured_control ), \ + OBJECTS_NO_STRING_NAME, \ + CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \ + NULL, \ + NULL, \ + &name##_Objects[ 0 ].Control.Object \ + OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ) \ + }, { \ + &name##_Heads[ 0 ] \ + } \ +} + /**@}*/ #ifdef __cplusplus diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h index 0e93cb501d..d3e69ed91c 100644 --- a/cpukit/include/rtems/score/threadimpl.h +++ b/cpukit/include/rtems/score/threadimpl.h @@ -34,7 +34,6 @@ #include <rtems/score/timestampimpl.h> #include <rtems/score/threadqimpl.h> #include <rtems/score/todimpl.h> -#include <rtems/score/freechain.h> #include <rtems/score/watchdogimpl.h> #include <rtems/config.h> @@ -58,18 +57,6 @@ extern "C" { */ extern void *rtems_ada_self; -typedef struct { - Objects_Information Objects; - - Freechain_Control Free_thread_queue_heads; -} Thread_Information; - -/** - * The following defines the information control block used to - * manage this class of objects. - */ -extern Thread_Information _Thread_Internal_information; - /** * @brief Object identifier of the global constructor thread. * @@ -100,12 +87,7 @@ void _Thread_Iterate( void *arg ); -void _Thread_Initialize_information( - Thread_Information *information, - Objects_APIs the_api, - uint16_t the_class, - uint32_t maximum -); +void _Thread_Initialize_information( Thread_Information *information ); /** * @brief Initialize thread handler. @@ -828,7 +810,7 @@ RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_maximum_internal_threads(void) RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Internal_allocate( void ) { return (Thread_Control *) - _Objects_Allocate_unprotected( &_Thread_Internal_information.Objects ); + _Objects_Allocate_unprotected( &_Thread_Information.Objects ); } /** diff --git a/cpukit/include/rtems/score/threadq.h b/cpukit/include/rtems/score/threadq.h index 5ddc2a10bb..c0a11770fb 100644 --- a/cpukit/include/rtems/score/threadq.h +++ b/cpukit/include/rtems/score/threadq.h @@ -394,15 +394,6 @@ typedef struct _Thread_queue_Heads { #endif } Thread_queue_Heads; -#if defined(RTEMS_SMP) - #define THREAD_QUEUE_HEADS_SIZE( scheduler_count ) \ - ( sizeof( Thread_queue_Heads ) \ - + ( scheduler_count ) * sizeof( Thread_queue_Priority_queue ) ) -#else - #define THREAD_QUEUE_HEADS_SIZE( scheduler_count ) \ - sizeof( Thread_queue_Heads ) -#endif - struct Thread_queue_Queue { /** * @brief Lock to protect this thread queue. |