summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/object.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-01 22:30:12 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-07-01 22:30:12 +0000
commitef9505a92f6c9c962dc2649f49002311466e009e (patch)
tree5a869b6101918ff8b37f19ca2b36f0b835d69d58 /cpukit/score/include/rtems/score/object.h
parent2002-07-01 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-ef9505a92f6c9c962dc2649f49002311466e009e.tar.bz2
2002-07-01 Joel Sherrill <joel@OARcorp.com>
* Mega patch merge to change the format of the object IDs to loosen the dependency between the SCORE and the various APIs. There was considerable work to simplify the object name management and it appears that the name_table field is no longer needed. This patch also includes the addition of the internal mutex which is currently only used to protect some types of allocation and deallocation. This significantly can reduce context switch latency under certain circumstances. In particular, some heap/region operations were O(n) and had dispatching disabled. This should help enormously. With this merge, the patch is not as clean as it should be. In particular, the documentation has not been modified to reflect the new object ID layout, the IDs in the test screens are not updated, and _Objects_Get_information needs to be a real routine not inlined. As part of this patch a lot of MP code for thread/proxy blocking was made conditional and cleaned up. * include/Makefile.am, include/rtems/score/coremsg.h, include/rtems/score/coremutex.h, include/rtems/score/coresem.h, include/rtems/score/object.h, include/rtems/score/threadq.h, inline/rtems/score/object.inl, inline/rtems/score/thread.inl, macros/rtems/score/object.inl, src/Makefile.am, src/coremsg.c, src/coremutex.c, src/coresem.c, src/mpci.c, src/objectcomparenameraw.c, src/objectextendinformation.c, src/objectinitializeinformation.c, src/objectnametoid.c, src/thread.c, src/threadclose.c, src/threadget.c, src/threadq.c, src/threadqextractwithproxy.c: Modified as part of above. * include/rtems/score/apimutex.h, src/objectgetnoprotection.c: New files.
Diffstat (limited to 'cpukit/score/include/rtems/score/object.h')
-rw-r--r--cpukit/score/include/rtems/score/object.h165
1 files changed, 110 insertions, 55 deletions
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
*