summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1995-08-18 21:41:27 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1995-08-18 21:41:27 +0000
commit95fbca1940805db2eca55e4ea605a5a552a36bc0 (patch)
tree8f4df72be3791d002048cff1ce082ab74cd435f6 /cpukit
parentb06e68ef1f6df69cc86d72356c3a002054a35fad (diff)
downloadrtems-95fbca1940805db2eca55e4ea605a5a552a36bc0.tar.bz2
+ Added object type field to object id.
+ Added name pointer to Object_Control. + Modified Object Open and Close to address name field. + Removed name as separate element from Thread and Proxy Control.
Diffstat (limited to '')
-rw-r--r--cpukit/score/include/rtems/score/object.h65
-rw-r--r--cpukit/score/include/rtems/score/thread.h8
-rw-r--r--cpukit/score/inline/rtems/score/object.inl29
-rw-r--r--cpukit/score/macros/rtems/score/object.inl21
4 files changed, 102 insertions, 21 deletions
diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h
index 0553fe901d..7f4c01c53d 100644
--- a/cpukit/score/include/rtems/score/object.h
+++ b/cpukit/score/include/rtems/score/object.h
@@ -33,11 +33,44 @@ typedef unsigned32 Objects_Name;
/*
* The following type defines the control block used to manage
- * object IDs.
+ * object IDs. The format is as follows (0=LSB):
+ *
+ * Bits 0 .. 15 = index
+ * Bits 16 .. 25 = node
+ * Bits 26 .. 31 = class
*/
typedef unsigned32 Objects_Id;
+#define OBJECTS_INDEX_START_BIT 0
+#define OBJECTS_NODE_START_BIT 16
+#define OBJECTS_CLASS_START_BIT 26
+
+#define OBJECTS_INDEX_MASK 0x0000ffff
+#define OBJECTS_NODE_MASK 0x03ff0000
+#define OBJECTS_CLASS_MASK 0xfc000000
+
+#define OBJECTS_INDEX_VALID_BITS 0x0000ffff
+#define OBJECTS_NODE_VALID_BITS 0x000003ff
+#define OBJECTS_CLASS_VALID_BITS 0x000000cf
+
+/*
+ * This enumerated type is used in the class field of the object ID.
+ */
+
+typedef enum {
+ OBJECTS_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_Classes;
+
/*
* This enumerated type lists the locations which may be returned
* by _Objects_Get. These codes indicate the success of locating
@@ -56,8 +89,9 @@ typedef enum {
*/
typedef struct {
- Chain_Node Node;
- Objects_Id id;
+ Chain_Node Node;
+ Objects_Id id;
+ Objects_Name *name;
} Objects_Control;
/*
@@ -66,6 +100,7 @@ typedef struct {
*/
typedef struct {
+ Objects_Classes 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 */
@@ -88,7 +123,7 @@ EXTERN unsigned32 _Objects_Local_node;
*
*/
-#define OBJECTS_ID_OF_SELF 0
+#define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
/*
* The following define the constants which may be used in name searches.
@@ -107,9 +142,10 @@ EXTERN unsigned32 _Objects_Local_node;
#define RTEMS_OBJECT_ID_FINAL_INDEX (0xffff)
#define RTEMS_OBJECT_ID_INITIAL(node) (_Objects_Build_id( \
+ OBJECTS_NO_CLASS, \
node, \
RTEMS_OBJECT_ID_INITIAL_INDEX))
-#define RTEMS_OBJECT_ID_FINAL ((Objects_Id) ~0)
+#define RTEMS_OBJECT_ID_FINAL ((Objects_Id)~0)
/*
* _Objects_Handler_initialization
@@ -140,6 +176,7 @@ void _Objects_Handler_initialization(
void _Objects_Initialize_information (
Objects_Information *information,
+ Objects_Classes the_class,
boolean supports_global,
unsigned32 maximum,
unsigned32 size
@@ -264,8 +301,22 @@ STATIC INLINE void rtems_name_to_characters(
*/
STATIC INLINE Objects_Id _Objects_Build_id(
- unsigned32 node,
- unsigned32 index
+ Objects_Classes the_class,
+ unsigned32 node,
+ unsigned32 index
+);
+
+/*
+ * rtems_get_class
+ *
+ * DESCRIPTION:
+ *
+ * This function returns the class portion of the ID.
+ *
+ */
+
+STATIC INLINE Objects_Classes rtems_get_class(
+ Objects_Id id
);
/*
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 953e19ba95..ddae52a363 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -133,14 +133,13 @@ typedef struct {
typedef struct {
Objects_Control Object;
- Objects_Name name;
States_Control current_state;
- rtems_task_priority current_priority;
- rtems_task_priority real_priority;
+ rtems_task_priority current_priority;
+ rtems_task_priority real_priority;
unsigned32 resource_count;
Thread_Wait_information Wait;
Watchdog_Control Timer;
- rtems_packet_prefix *receive_packet;
+ rtems_packet_prefix *receive_packet;
/****************** end of common block ********************/
Chain_Node Active;
} Thread_Proxy_control;
@@ -156,7 +155,6 @@ typedef struct {
typedef struct {
Objects_Control Object;
- Objects_Name name;
States_Control current_state;
rtems_task_priority current_priority;
rtems_task_priority real_priority;
diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl
index 9c2110077c..da65807aa1 100644
--- a/cpukit/score/inline/rtems/score/object.inl
+++ b/cpukit/score/inline/rtems/score/object.inl
@@ -57,15 +57,32 @@ STATIC INLINE void rtems_name_to_characters(
*/
STATIC INLINE Objects_Id _Objects_Build_id(
- unsigned32 node,
- unsigned32 index
+ Objects_Classes the_class,
+ unsigned32 node,
+ unsigned32 index
)
{
- return ( (node << 16) | index );
+ return ( (the_class << OBJECTS_CLASS_START_BIT) |
+ (node << OBJECTS_NODE_START_BIT) |
+ (index << OBJECTS_INDEX_START_BIT) );
}
/*PAGE
*
+ * rtems_get_class
+ */
+
+STATIC INLINE Objects_Classes rtems_get_class(
+ Objects_Id id
+)
+{
+ return (Objects_Classes)
+ ((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS);
+}
+
+
+/*PAGE
+ *
* rtems_get_node
*
*/
@@ -74,7 +91,7 @@ STATIC INLINE unsigned32 rtems_get_node(
Objects_Id id
)
{
- return (id >> 16);
+ return (id >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS;
}
/*PAGE
@@ -87,7 +104,7 @@ STATIC INLINE unsigned32 rtems_get_index(
Objects_Id id
)
{
- return (id &0xFFFF);
+ return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
}
/*PAGE
@@ -174,6 +191,7 @@ STATIC INLINE void _Objects_Open(
index = rtems_get_index( the_object->id );
information->local_table[ index ] = the_object;
information->name_table[ index ] = name;
+ the_object->name = &information->name_table[ index ];
}
/*PAGE
@@ -192,6 +210,7 @@ STATIC INLINE void _Objects_Close(
index = rtems_get_index( the_object->id );
information->local_table[ index ] = NULL;
information->name_table[ index ] = 0;
+ the_object->name = 0;
}
#endif
diff --git a/cpukit/score/macros/rtems/score/object.inl b/cpukit/score/macros/rtems/score/object.inl
index ddd311689b..b95b5d678b 100644
--- a/cpukit/score/macros/rtems/score/object.inl
+++ b/cpukit/score/macros/rtems/score/object.inl
@@ -45,8 +45,19 @@
*
*/
-#define _Objects_Build_id( _node, _index ) \
- ( ((_node) << 16) | (_index) )
+#define _Objects_Build_id( _the_class, _node, _index ) \
+ ( ((_the_class) << OBJECTS_CLASS_START_BIT) | \
+ ((_node) << OBJECTS_NODE_START_BIT) | \
+ ((_index) << OBJECTS_INDEX_START_BIT) )
+
+/*PAGE
+ *
+ * rtems_get_class
+ */
+
+#define rtems_get_class( _id ) \
+ (Objects_Classes) \
+ (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS)
/*PAGE
*
@@ -55,7 +66,7 @@
*/
#define rtems_get_node( _id ) \
- ((_id) >> 16)
+ (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS)
/*PAGE
*
@@ -64,7 +75,7 @@
*/
#define rtems_get_index( _id ) \
- ((_id) & 0xFFFF)
+ (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS)
/*PAGE
*
@@ -124,6 +135,7 @@
_index = rtems_get_index( (_the_object)->id ); \
(_information)->local_table[ _index ] = (_the_object); \
(_information)->name_table[ _index ] = (_name); \
+ (_the_object)->name = &(_information)->name_table[ _index ]; \
}
/*PAGE
@@ -139,6 +151,7 @@
_index = rtems_get_index( (_the_object)->id ); \
(_information)->local_table[ _index ] = NULL; \
(_information)->name_table[ _index ] = 0; \
+ (_the_object)->name = 0; \
}
#endif