From 85b7605b323427c734af15a7f36e5839bb865385 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 1 Nov 2004 13:15:40 +0000 Subject: 2004-11-01 Joel Sherrill * score/include/rtems/score/object.h, score/inline/rtems/score/object.inl, score/macros/rtems/score/object.inl: Add first cut of optional 16 bit object Id as space reduction for small systems (TinyRTEMS). --- cpukit/ChangeLog | 7 ++++ cpukit/score/include/rtems/score/object.h | 59 ++++++++++++++++++++++-------- cpukit/score/inline/rtems/score/object.inl | 10 +++-- cpukit/score/macros/rtems/score/object.inl | 4 ++ 4 files changed, 61 insertions(+), 19 deletions(-) (limited to 'cpukit') diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index acf86f108e..076bd123df 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,10 @@ +2004-11-01 Joel Sherrill + + * score/include/rtems/score/object.h, + score/inline/rtems/score/object.inl, + score/macros/rtems/score/object.inl: Add first cut of optional + 16 bit object Id as space reduction for small systems (TinyRTEMS). + 2004-11-01 Ralf Corsepius * monitor/monitor.h: Let rtems_monitor_config_dump return int. diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h index 71c9e190db..8fedfae0e3 100644 --- a/cpukit/score/include/rtems/score/object.h +++ b/cpukit/score/include/rtems/score/object.h @@ -5,7 +5,7 @@ * can be used to initialize and manipulate all objects which have * ids. * - * COPYRIGHT (c) 1989-2002. + * COPYRIGHT (c) 1989-2004. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -57,6 +57,28 @@ typedef boolean (*Objects_Name_comparators)( uint32_t /* length */ ); +#if defined(RTEMS_USE_16_BIT_OBJECT) +/* + * The following type defines the control block used to manage + * object IDs. The format is as follows (0=LSB): + * + * Bits 0 .. 7 = index (up to 254 objects of a type) + * Bits 8 .. 10 = API (up to 7 API classes) + * Bits 11 .. 15 = class (up to 31 object types per API) + */ + +typedef uint16_t Objects_Id; +typedef uint8_t Objects_Maximum; + +#define OBJECTS_INDEX_START_BIT 0 +#define OBJECTS_API_START_BIT 8 +#define OBJECTS_CLASS_START_BIT 11 + +#define OBJECTS_INDEX_MASK (Objects_Id)0x000000ff +#define OBJECTS_API_MASK (Objects_Id)0x00000700 +#define OBJECTS_CLASS_MASK (Objects_Id)0x0000F800 + +#else /* * The following type defines the control block used to manage * object IDs. The format is as follows (0=LSB): @@ -68,6 +90,7 @@ typedef boolean (*Objects_Name_comparators)( */ typedef uint32_t Objects_Id; +typedef uint16_t Objects_Maximum; #define OBJECTS_INDEX_START_BIT 0 #define OBJECTS_NODE_START_BIT 16 @@ -83,6 +106,7 @@ typedef uint32_t Objects_Id; #define OBJECTS_NODE_VALID_BITS (Objects_Id)0x000000ff #define OBJECTS_API_VALID_BITS (Objects_Id)0x00000007 #define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x0000001f +#endif /* * This enumerated type is used in the class field of the object ID. @@ -161,7 +185,7 @@ typedef enum { OBJECTS_LOCAL = 0, /* object is local */ OBJECTS_REMOTE = 1, /* object is remote */ OBJECTS_ERROR = 2 /* id was invalid */ -} Objects_Locations; +} Objects_Locations; /* * The following type defines the callout used when a local task @@ -171,7 +195,6 @@ typedef enum { typedef void ( *Objects_Thread_queue_Extract_callout )( void * ); - /* * The following defines the Object Control Block used to manage * each object local to this node. @@ -181,7 +204,7 @@ typedef struct { Chain_Node Node; Objects_Id id; Objects_Name name; -} Objects_Control; +} Objects_Control; /* * The following defines the structure for the information used to @@ -190,21 +213,21 @@ typedef struct { typedef struct { Objects_APIs the_api; /* API of this object */ - uint32_t the_class; /* class of this object */ + uint16_t 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 */ - uint32_t maximum; /* maximum number of objects */ + Objects_Maximum maximum; /* maximum number of objects */ boolean auto_extend; /* TRUE if unlimited objects */ uint32_t allocation_size; /* number of objects in a block */ uint32_t size; /* size of the objects */ Objects_Control **local_table; Objects_Name *name_table; Chain_Control Inactive; /* chain of inactive ctl blocks */ - uint32_t inactive; /* number of objects on the InActive list */ + Objects_Maximum inactive; /* number of objects on the InActive list */ uint32_t *inactive_per_block; /* used to release a block */ void **object_blocks; /* the object memory to remove */ boolean is_string; /* TRUE if names are strings */ - uint32_t name_length; /* maximum length of names */ + uint16_t name_length; /* maximum length of names */ Objects_Thread_queue_Extract_callout *extract; #if defined(RTEMS_MULTIPROCESSING) Chain_Control *global_table; /* pointer to global table */ @@ -216,8 +239,13 @@ typedef struct { * node number of the local node. */ +#if defined(RTEMS_MULTIPROCESSING) SCORE_EXTERN uint32_t _Objects_Local_node; SCORE_EXTERN uint32_t _Objects_Maximum_nodes; +#else +#define _Objects_Local_node 1 +#define _Objects_Maximum_nodes 1 +#endif /* * The following is the list of information blocks per API for each object @@ -254,7 +282,6 @@ SCORE_EXTERN Objects_Information #define OBJECTS_ID_INITIAL(_api, _class, _node) \ _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX ) - #define OBJECTS_ID_FINAL ((Objects_Id)~0) /* @@ -314,8 +341,8 @@ void _Objects_Initialize_information ( Objects_Information *information, Objects_APIs the_api, uint32_t the_class, - uint32_t maximum, - uint32_t size, + Objects_Maximum maximum, + uint16_t size, boolean is_string, uint32_t maximum_name_length #if defined(RTEMS_MULTIPROCESSING) @@ -351,8 +378,8 @@ Objects_Control *_Objects_Allocate( Objects_Control *_Objects_Allocate_by_index( Objects_Information *information, - uint32_t index, - uint32_t sizeof_control + uint16_t index, + uint16_t sizeof_control ); /*PAGE @@ -407,7 +434,7 @@ void _Objects_Copy_name_string( void _Objects_Copy_name_raw( void *source, void *destination, - uint32_t length + uint16_t length ); /* @@ -421,7 +448,7 @@ void _Objects_Copy_name_raw( boolean _Objects_Compare_name_string( void *name_1, void *name_2, - uint32_t length + uint16_t length ); /* @@ -435,7 +462,7 @@ boolean _Objects_Compare_name_string( boolean _Objects_Compare_name_raw( void *name_1, void *name_2, - uint32_t length + uint16_t length ); /* diff --git a/cpukit/score/inline/rtems/score/object.inl b/cpukit/score/inline/rtems/score/object.inl index fa2c0478e5..647b7f9a66 100644 --- a/cpukit/score/inline/rtems/score/object.inl +++ b/cpukit/score/inline/rtems/score/object.inl @@ -131,12 +131,14 @@ RTEMS_INLINE_ROUTINE boolean _Objects_Is_class_valid( * FALSE otherwise. */ +#if defined(RTEMS_MULTIPROCESSING) RTEMS_INLINE_ROUTINE boolean _Objects_Is_local_node( uint32_t node ) { return ( node == _Objects_Local_node ); } +#endif /*PAGE * @@ -148,12 +150,14 @@ RTEMS_INLINE_ROUTINE boolean _Objects_Is_local_node( * FALSE otherwise. */ +#if defined(RTEMS_MULTIPROCESSING) RTEMS_INLINE_ROUTINE boolean _Objects_Is_local_id( Objects_Id id ) { return _Objects_Is_local_node( _Objects_Get_node(id) ); } +#endif /*PAGE * @@ -185,7 +189,7 @@ RTEMS_INLINE_ROUTINE boolean _Objects_Are_ids_equal( RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Get_local_object( Objects_Information *information, - uint32_t index + uint16_t index ) { if ( index > information->maximum ) @@ -205,7 +209,7 @@ RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Get_local_object( RTEMS_INLINE_ROUTINE void _Objects_Set_local_object( Objects_Information *information, - uint32_t index, + uint16_t index, Objects_Control *the_object ) { @@ -229,7 +233,7 @@ RTEMS_INLINE_ROUTINE Objects_Information *_Objects_Get_information( ) { Objects_APIs the_api; - uint32_t the_class; + uint16_t the_class; the_class = _Objects_Get_class( id ); diff --git a/cpukit/score/macros/rtems/score/object.inl b/cpukit/score/macros/rtems/score/object.inl index 79702927f9..3bddc856ac 100644 --- a/cpukit/score/macros/rtems/score/object.inl +++ b/cpukit/score/macros/rtems/score/object.inl @@ -79,8 +79,10 @@ * */ +#if defined(RTEMS_MULTIPROCESSING) #define _Objects_Is_local_node( _node ) \ ( (_node) == _Objects_Local_node ) +#endif /*PAGE * @@ -88,8 +90,10 @@ * */ +#if defined(RTEMS_MULTIPROCESSING) #define _Objects_Is_local_id( _id ) \ _Objects_Is_local_node( _Objects_Get_node(_id) ) +#endif /*PAGE * -- cgit v1.2.3