diff options
Diffstat (limited to 'cpukit/score/include/rtems/score')
-rw-r--r-- | cpukit/score/include/rtems/score/apimutex.h | 153 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/coremsg.h | 4 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/coremutex.h | 4 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/coresem.h | 4 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/object.h | 165 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/threadq.h | 6 |
6 files changed, 269 insertions, 67 deletions
diff --git a/cpukit/score/include/rtems/score/apimutex.h b/cpukit/score/include/rtems/score/apimutex.h new file mode 100644 index 0000000000..1f0c6bb230 --- /dev/null +++ b/cpukit/score/include/rtems/score/apimutex.h @@ -0,0 +1,153 @@ +/* apimutex.h + * + * This include file contains all the constants and structures associated + * with the API Mutex Handler. This handler is used by API level + * routines to manage mutual exclusion. + * + * COPYRIGHT (c) 1989-2002. + * On-Line Applications Research Corporation (OAR). + * + * 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$ + */ + +#ifndef __API_MUTEX_h +#define __API_MUTEX_h + +#ifdef __cplusplus +extern "C" { +#endif + +#include <rtems/score/coremutex.h> +#include <rtems/score/isr.h> +#include <rtems/score/object.h> + +/* + * The following defines the control block used to manage each mutex. + */ + +typedef struct { + Objects_Control Object; + CORE_mutex_Control Mutex; +} API_Mutex_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +SCORE_EXTERN Objects_Information _API_Mutex_Information; + +/* + * _API_Mutex_Initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this handler. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#define _API_Mutex_Initialization( _maximum_mutexes ) \ + _Objects_Initialize_information( \ + &_API_Mutex_Information, \ + OBJECTS_INTERNAL_API, \ + OBJECTS_INTERNAL_MUTEXES, \ + _maximum_mutexes, \ + sizeof( API_Mutex_Control ), \ + FALSE, \ + 0, \ + FALSE, \ + NULL \ + ); +#else +#define _API_Mutex_Initialization( _maximum_mutexes ) \ + _Objects_Initialize_information( \ + &_API_Mutex_Information, \ + OBJECTS_INTERNAL_API, \ + OBJECTS_INTERNAL_MUTEXES, \ + _maximum_mutexes, \ + sizeof( API_Mutex_Control ), \ + FALSE, \ + 0 \ + ); +#endif + +/* + * _API_Mutex_Allocate + * + * DESCRIPTION: + * + * This routine allocates an api mutex from the inactive set. + */ + +#define _API_Mutex_Allocate( _the_mutex ) \ + do { \ + CORE_mutex_Attributes attr = \ + { CORE_MUTEX_NESTING_IS_ERROR, FALSE, \ + CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT, 0 }; \ + (_the_mutex) = (API_Mutex_Control *) \ + _Objects_Allocate( &_API_Mutex_Information ); \ + _CORE_mutex_Initialize( \ + &(_the_mutex)->Mutex, &attr, CORE_MUTEX_UNLOCKED ); \ + } while (0) + +/* + * _API_Mutex_Lock + * + * DESCRIPTION: + * + * This routine acquires the specified api mutex. + */ + +#define _API_Mutex_Lock( _the_mutex ) \ + do { \ + ISR_Level _level; \ + _CORE_mutex_Seize( \ + &(_the_mutex)->Mutex, (_the_mutex)->Object.id, TRUE, 0, (_level) ); \ + } while (0) + +/* + * _API_Mutex_Unlock + * + * DESCRIPTION: + * + * This routine releases the specified api mutex. + */ + +#define _API_Mutex_Unlock( _the_mutex ) \ + do { \ + _Thread_Disable_dispatch(); \ + _CORE_mutex_Surrender( \ + &(_the_mutex)->Mutex, (_the_mutex)->Object.id, NULL ); \ + _Thread_Enable_dispatch(); \ + } while (0); + +/*XXX when the APIs all use this for allocation and deallocation + *XXX protection, then they should be renamed and probably moved + */ + +SCORE_EXTERN API_Mutex_Control *_RTEMS_Allocator_Mutex; + +#define _RTEMS_Lock_allocator() \ + _API_Mutex_Lock( _RTEMS_Allocator_Mutex ) + +#define _RTEMS_Unlock_allocator() \ + _API_Mutex_Unlock( _RTEMS_Allocator_Mutex ) + +/* + * There are no inlines for this handler. + */ + +#ifndef __RTEMS_APPLICATION__ +/* #include <rtems/score/apimutex.inl> */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/cpukit/score/include/rtems/score/coremsg.h b/cpukit/score/include/rtems/score/coremsg.h index c53f29cea1..c90ad2fcf0 100644 --- a/cpukit/score/include/rtems/score/coremsg.h +++ b/cpukit/score/include/rtems/score/coremsg.h @@ -144,11 +144,9 @@ typedef struct { boolean _CORE_message_queue_Initialize( CORE_message_queue_Control *the_message_queue, - Objects_Classes the_class, CORE_message_queue_Attributes *the_message_queue_attributes, unsigned32 maximum_pending_messages, - unsigned32 maximum_message_size, - Thread_queue_Extract_callout proxy_extract_callout + unsigned32 maximum_message_size ); /* diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h index 4f8e81a67c..2eac6d489a 100644 --- a/cpukit/score/include/rtems/score/coremutex.h +++ b/cpukit/score/include/rtems/score/coremutex.h @@ -134,10 +134,8 @@ typedef struct { void _CORE_mutex_Initialize( CORE_mutex_Control *the_mutex, - Objects_Classes the_class, CORE_mutex_Attributes *the_mutex_attributes, - unsigned32 initial_lock, - Thread_queue_Extract_callout proxy_extract_callout + unsigned32 initial_lock ); /* diff --git a/cpukit/score/include/rtems/score/coresem.h b/cpukit/score/include/rtems/score/coresem.h index 324fdcf1aa..9d4c4c4c50 100644 --- a/cpukit/score/include/rtems/score/coresem.h +++ b/cpukit/score/include/rtems/score/coresem.h @@ -89,10 +89,8 @@ typedef struct { void _CORE_semaphore_Initialize( CORE_semaphore_Control *the_semaphore, - Objects_Classes the_class, CORE_semaphore_Attributes *the_semaphore_attributes, - unsigned32 initial_value, - Thread_queue_Extract_callout proxy_extract_callout + unsigned32 initial_value ); /* diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h index 4b9af7f075..af2b6f763b 100644 --- a/cpukit/score/include/rtems/score/object.h +++ b/cpukit/score/include/rtems/score/object.h @@ -26,7 +26,8 @@ extern "C" { #include <rtems/score/isr.h> /* - * Mask to enable unlimited objects + * Mask to enable unlimited objects. This is used in the configuration + * table when specifying the number of configured objects. */ #define OBJECTS_UNLIMITED_OBJECTS 0x80000000 @@ -60,63 +61,95 @@ typedef boolean (*Objects_Name_comparators)( * The following type defines the control block used to manage * object IDs. The format is as follows (0=LSB): * - * Bits 0 .. 15 = index - * Bits 16 .. 25 = node - * Bits 26 .. 31 = class + * Bits 0 .. 15 = index (up to 65535 objects of a type) + * Bits 16 .. 23 = node (up to 255 nodes) + * Bits 24 .. 26 = API (up to 7 API classes) + * Bits 27 .. 31 = class (up to 31 object types per API) */ typedef unsigned32 Objects_Id; #define OBJECTS_INDEX_START_BIT 0 #define OBJECTS_NODE_START_BIT 16 -#define OBJECTS_CLASS_START_BIT 26 +#define OBJECTS_API_START_BIT 24 +#define OBJECTS_CLASS_START_BIT 27 #define OBJECTS_INDEX_MASK 0x0000ffff -#define OBJECTS_NODE_MASK 0x03ff0000 -#define OBJECTS_CLASS_MASK 0xfc000000 +#define OBJECTS_NODE_MASK 0x00ff0000 +#define OBJECTS_API_MASK 0x07000000 +#define OBJECTS_CLASS_MASK 0xf8000000 #define OBJECTS_INDEX_VALID_BITS 0x0000ffff -#define OBJECTS_NODE_VALID_BITS 0x000003ff -#define OBJECTS_CLASS_VALID_BITS 0x000000cf +#define OBJECTS_NODE_VALID_BITS 0x000000ff +#define OBJECTS_API_VALID_BITS 0x00000007 +#define OBJECTS_CLASS_VALID_BITS 0x0000001f /* * This enumerated type is used in the class field of the object ID. */ +#define OBJECTS_NO_CLASS 0 + typedef enum { - OBJECTS_NO_CLASS = 0, - OBJECTS_INTERNAL_THREADS = 1, - OBJECTS_RTEMS_TASKS = 2, - OBJECTS_POSIX_THREADS = 3, - OBJECTS_ITRON_TASKS = 4, - OBJECTS_RTEMS_TIMERS = 5, - OBJECTS_RTEMS_SEMAPHORES = 6, - OBJECTS_RTEMS_MESSAGE_QUEUES = 7, - OBJECTS_RTEMS_PARTITIONS = 8, - OBJECTS_RTEMS_REGIONS = 9, - OBJECTS_RTEMS_PORTS = 10, - OBJECTS_RTEMS_PERIODS = 11, - OBJECTS_RTEMS_EXTENSIONS = 12, - OBJECTS_POSIX_KEYS = 13, - OBJECTS_POSIX_INTERRUPTS = 14, - OBJECTS_POSIX_MESSAGE_QUEUE_FDS = 15, - OBJECTS_POSIX_MESSAGE_QUEUES = 16, - OBJECTS_POSIX_MUTEXES = 17, - OBJECTS_POSIX_SEMAPHORES = 18, - OBJECTS_POSIX_CONDITION_VARIABLES = 19, - OBJECTS_ITRON_EVENTFLAGS = 10, - OBJECTS_ITRON_MAILBOXES = 21, - OBJECTS_ITRON_MESSAGE_BUFFERS = 22, - OBJECTS_ITRON_PORTS = 23, - OBJECTS_ITRON_SEMAPHORES = 24, - OBJECTS_ITRON_VARIABLE_MEMORY_POOLS = 25, - OBJECTS_ITRON_FIXED_MEMORY_POOLS = 26 -} Objects_Classes; - -#define OBJECTS_CLASSES_FIRST OBJECTS_NO_CLASS -#define OBJECTS_CLASSES_LAST OBJECTS_ITRON_FIXED_MEMORY_POOLS -#define OBJECTS_CLASSES_FIRST_THREAD_CLASS OBJECTS_INTERNAL_THREADS -#define OBJECTS_CLASSES_LAST_THREAD_CLASS OBJECTS_ITRON_TASKS + OBJECTS_NO_API = 0, + OBJECTS_INTERNAL_API = 1, + OBJECTS_CLASSIC_API = 2, + OBJECTS_POSIX_API = 3, + OBJECTS_ITRON_API = 4 +} Objects_APIs; + +#define OBJECTS_APIS_LAST OBJECTS_ITRON_API + +typedef enum { + OBJECTS_INTERNAL_NO_CLASS = 0, + OBJECTS_INTERNAL_THREADS = 1, + OBJECTS_INTERNAL_MUTEXES = 2 +} Objects_Internal_API; + +#define OBJECTS_INTERNAL_CLASSES_LAST OBJECTS_INTERNAL_MUTEXES + +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_Classic_API; + +#define OBJECTS_RTEMS_CLASSES_LAST OBJECTS_RTEMS_EXTENSIONS + +typedef enum { + OBJECTS_POSIX_NO_CLASS = 0, + OBJECTS_POSIX_THREADS = 1, + OBJECTS_POSIX_KEYS = 2, + OBJECTS_POSIX_INTERRUPTS = 3, + OBJECTS_POSIX_MESSAGE_QUEUE_FDS = 4, + OBJECTS_POSIX_MESSAGE_QUEUES = 5, + OBJECTS_POSIX_MUTEXES = 6, + OBJECTS_POSIX_SEMAPHORES = 7, + OBJECTS_POSIX_CONDITION_VARIABLES = 8 +} Objects_POSIX_API; + +#define OBJECTS_POSIX_CLASSES_LAST OBJECTS_POSIX_CONDITION_VARIABLES + +typedef enum { + OBJECTS_ITRON_NO_CLASS = 0, + OBJECTS_ITRON_TASKS = 1, + OBJECTS_ITRON_EVENTFLAGS = 2, + OBJECTS_ITRON_MAILBOXES = 3, + OBJECTS_ITRON_MESSAGE_BUFFERS = 4, + OBJECTS_ITRON_PORTS = 5, + OBJECTS_ITRON_SEMAPHORES = 6, + OBJECTS_ITRON_VARIABLE_MEMORY_POOLS = 7, + OBJECTS_ITRON_FIXED_MEMORY_POOLS = 8 +} Objects_ITRON_API; + +#define OBJECTS_ITRON_CLASSES_LAST OBJECTS_ITRON_FIXED_MEMORY_POOLS /* * This enumerated type lists the locations which may be returned @@ -131,6 +164,15 @@ typedef enum { } Objects_Locations; /* + * 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 )( void * ); + + +/* * The following defines the Object Control Block used to manage * each object local to this node. */ @@ -147,7 +189,8 @@ typedef struct { */ typedef struct { - Objects_Classes the_class; /* Class of this object */ + Objects_APIs the_api; /* API of this object */ + unsigned32 the_class; /* class of this object */ Objects_Id minimum_id; /* minimum valid id of this type */ Objects_Id maximum_id; /* maximum valid id of this type */ unsigned32 maximum; /* maximum number of objects */ @@ -156,15 +199,16 @@ typedef struct { unsigned32 size; /* size of the objects */ Objects_Control **local_table; Objects_Name *name_table; - Chain_Control *global_table; /* pointer to global table */ Chain_Control Inactive; /* chain of inactive ctl blocks */ unsigned32 inactive; /* number of objects on the InActive list */ unsigned32 *inactive_per_block; /* used to release a block */ void **object_blocks; /* the object memory to remove */ boolean is_string; /* TRUE if names are strings */ unsigned32 name_length; /* maximum length of names */ - boolean is_thread; /* TRUE if these are threads */ - /* irregardless of API */ + Objects_Thread_queue_Extract_callout *extract; +#if defined(RTEMS_MULTIPROCESSING) + Chain_Control *global_table; /* pointer to global table */ +#endif } Objects_Information; /* @@ -176,13 +220,13 @@ SCORE_EXTERN unsigned32 _Objects_Local_node; SCORE_EXTERN unsigned32 _Objects_Maximum_nodes; /* - * The following is the list of information blocks for each object + * The following is the list of information blocks per API for each object * class. From the ID, we can go to one of these information blocks, * and obtain a pointer to the appropriate object control block. */ -SCORE_EXTERN Objects_Information - *_Objects_Information_table[OBJECTS_CLASSES_LAST + 1]; +SCORE_EXTERN Objects_Information + **_Objects_Information_table[OBJECTS_APIS_LAST + 1]; /* * The following defines the constant which may be used @@ -208,8 +252,8 @@ SCORE_EXTERN Objects_Information #define OBJECTS_ID_INITIAL_INDEX (0) #define OBJECTS_ID_FINAL_INDEX (0xffff) -#define OBJECTS_ID_INITIAL(_class, _node) \ - _Objects_Build_id( (_class), (_node), OBJECTS_ID_INITIAL_INDEX ) +#define OBJECTS_ID_INITIAL(_api, _class, _node) \ + _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX ) #define OBJECTS_ID_FINAL ((Objects_Id)~0) @@ -268,13 +312,17 @@ void _Objects_Shrink_information( void _Objects_Initialize_information ( Objects_Information *information, - Objects_Classes the_class, - boolean supports_global, + Objects_APIs the_api, + unsigned32 the_class, unsigned32 maximum, unsigned32 size, boolean is_string, - unsigned32 maximum_name_length, - boolean is_task + unsigned32 maximum_name_length +#if defined(RTEMS_MULTIPROCESSING) + , + boolean supports_global, + Objects_Thread_queue_Extract_callout *extract +#endif ); /*PAGE @@ -460,6 +508,13 @@ Objects_Control *_Objects_Get_by_index ( Objects_Id id, Objects_Locations *location ); + +Objects_Control *_Objects_Get_no_protection( + Objects_Information *information, + Objects_Id id, + Objects_Locations *location +); + /* * _Objects_Get_next * diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h index 1ef6c009cb..db275177c5 100644 --- a/cpukit/score/include/rtems/score/threadq.h +++ b/cpukit/score/include/rtems/score/threadq.h @@ -47,12 +47,14 @@ typedef void ( *Thread_queue_Flush_callout )( * extracted from the remote queue). */ +#if 0 typedef void ( *Thread_queue_Extract_callout )( Thread_Control * ); SCORE_EXTERN Thread_queue_Extract_callout _Thread_queue_Extract_table[ OBJECTS_CLASSES_LAST + 1 ]; +#endif /* * _Thread_queue_Dequeue @@ -103,7 +105,7 @@ void _Thread_queue_Extract( * DESCRIPTION: * * This routine extracts the_thread from the_thread_queue - * and insures that if there is a proxy for this task on + * and ensures that if there is a proxy for this task on * another node, it is also dealt with. */ @@ -152,10 +154,8 @@ void _Thread_queue_Flush( void _Thread_queue_Initialize( Thread_queue_Control *the_thread_queue, - Objects_Classes the_class, Thread_queue_Disciplines the_discipline, States_Control state, - Thread_queue_Extract_callout proxy_extract_callout, unsigned32 timeout_status ); |