RTEMS CPU Kit with SuperCore  4.11.99.0
object.h
Go to the documentation of this file.
1 
11 /*
12  * COPYRIGHT (c) 1989-2011.
13  * On-Line Applications Research Corporation (OAR).
14  *
15  * The license and distribution terms for this file may be
16  * found in the file LICENSE in this distribution or at
17  * http://www.rtems.org/license/LICENSE.
18  */
19 
20 #ifndef _RTEMS_SCORE_OBJECT_H
21 #define _RTEMS_SCORE_OBJECT_H
22 
23 #include <rtems/score/basedefs.h>
24 #include <rtems/score/cpu.h>
25 #include <rtems/score/chain.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
38 #if defined(RTEMS_POSIX_API)
39 
45  #define RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES
46 #endif
47 
68 typedef union {
69  #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
70 
71  const char *name_p;
72  #endif
73 
74  uint32_t name_u32;
75 } Objects_Name;
76 
77 #if defined(RTEMS_USE_16_BIT_OBJECT)
78 
86 typedef uint16_t Objects_Id;
87 
92 typedef uint8_t Objects_Maximum;
93 
94 #define OBJECTS_INDEX_START_BIT 0U
95 #define OBJECTS_API_START_BIT 8U
96 #define OBJECTS_CLASS_START_BIT 11U
97 
98 #define OBJECTS_INDEX_MASK (Objects_Id)0x00ffU
99 #define OBJECTS_API_MASK (Objects_Id)0x0700U
100 #define OBJECTS_CLASS_MASK (Objects_Id)0xF800U
101 
102 #define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x00ffU
103 #define OBJECTS_API_VALID_BITS (Objects_Id)0x0007U
104 /* OBJECTS_NODE_VALID_BITS should not be used with 16 bit Ids */
105 #define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x001fU
106 
107 #define OBJECTS_UNLIMITED_OBJECTS 0x8000U
108 
109 #define OBJECTS_ID_INITIAL_INDEX (0)
110 #define OBJECTS_ID_FINAL_INDEX (0xff)
111 
112 #else
113 
122 typedef uint32_t Objects_Id;
123 
128 typedef uint16_t Objects_Maximum;
129 
134 #define OBJECTS_INDEX_START_BIT 0U
135 
139 #define OBJECTS_NODE_START_BIT 16U
140 
145 #define OBJECTS_API_START_BIT 24U
146 
151 #define OBJECTS_CLASS_START_BIT 27U
152 
156 #define OBJECTS_INDEX_MASK (Objects_Id)0x0000ffffU
157 
161 #define OBJECTS_NODE_MASK (Objects_Id)0x00ff0000U
162 
166 #define OBJECTS_API_MASK (Objects_Id)0x07000000U
167 
171 #define OBJECTS_CLASS_MASK (Objects_Id)0xf8000000U
172 
177 #define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x0000ffffU
178 
183 #define OBJECTS_NODE_VALID_BITS (Objects_Id)0x000000ffU
184 
189 #define OBJECTS_API_VALID_BITS (Objects_Id)0x00000007U
190 
195 #define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x0000001fU
196 
201 #define OBJECTS_UNLIMITED_OBJECTS 0x80000000U
202 
206 #define OBJECTS_ID_INITIAL_INDEX (0)
207 
211 #define OBJECTS_ID_FINAL_INDEX (0xffffU)
212 #endif
213 
217 typedef enum {
218  OBJECTS_NO_API = 0,
219  OBJECTS_INTERNAL_API = 1,
220  OBJECTS_CLASSIC_API = 2,
221  OBJECTS_POSIX_API = 3,
222  OBJECTS_FAKE_OBJECTS_API = 7
223 } Objects_APIs;
224 
226 #define OBJECTS_APIS_LAST OBJECTS_POSIX_API
227 
232 typedef struct {
236  Objects_Id id;
240 
241 #if defined( RTEMS_MULTIPROCESSING )
242 
246 typedef struct {
248  Objects_Control Object;
253  uint32_t name;
254 } Objects_MP_Control;
255 #endif
256 
260 #define OBJECTS_ID_NONE 0
261 
266 #define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
267 
272 #define OBJECTS_SEARCH_ALL_NODES 0
273 
278 #define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
279 
284 #define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF
285 
290 #define OBJECTS_WHO_AM_I 0
291 
296 #define OBJECTS_ID_INITIAL(_api, _class, _node) \
297  _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
298 
302 #define OBJECTS_ID_FINAL ((Objects_Id)~0)
303 
314 #define _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
315  ( (uint32_t)(_C1) << 24 | \
316  (uint32_t)(_C2) << 16 | \
317  (uint32_t)(_C3) << 8 | \
318  (uint32_t)(_C4) )
319 
328  Objects_Id id
329 )
330 {
332 }
333 
340  Objects_Id id
341 )
342 {
343  return (uint32_t)
345 }
346 
355  Objects_Id id
356 )
357 {
358  /*
359  * If using 16-bit Ids, then there is no node field and it MUST
360  * be a single processor system.
361  */
362  #if defined(RTEMS_USE_16_BIT_OBJECT)
363  return 1;
364  #else
366  #endif
367 }
368 
377  Objects_Id id
378 )
379 {
380  return
381  (Objects_Maximum)((id >> OBJECTS_INDEX_START_BIT) &
383 }
384 
398  Objects_APIs the_api,
399  uint16_t the_class,
400  uint8_t node,
401  uint16_t index
402 )
403 {
404  return (( (Objects_Id) the_api ) << OBJECTS_API_START_BIT) |
405  (( (Objects_Id) the_class ) << OBJECTS_CLASS_START_BIT) |
406  #if !defined(RTEMS_USE_16_BIT_OBJECT)
407  (( (Objects_Id) node ) << OBJECTS_NODE_START_BIT) |
408  #endif
409  (( (Objects_Id) index ) << OBJECTS_INDEX_START_BIT);
410 }
411 
421 {
422  return (maximum & OBJECTS_UNLIMITED_OBJECTS) != 0;
423 }
424 
425 /*
426  * We cannot use an inline function for this since it may be evaluated at
427  * compile time.
428  */
429 #define _Objects_Maximum_per_allocation( maximum ) \
430  ((Objects_Maximum) ((maximum) & ~OBJECTS_UNLIMITED_OBJECTS))
431 
436 #ifdef __cplusplus
437 }
438 #endif
439 
440 #endif
441 /* end of include file */
uint32_t name_u32
This is the actual 32-bit "raw" integer name.
Definition: object.h:74
This is used to manage each element (node) which is placed on a chain.
Definition: chain.h:65
#define OBJECTS_API_VALID_BITS
This mask represents the bits that is used to ensure no extra bits are set after shifting to extract ...
Definition: object.h:189
RTEMS_INLINE_ROUTINE Objects_APIs _Objects_Get_API(Objects_Id id)
This function returns the API portion of the ID.
Definition: object.h:327
The following defines the Object Control Block used to manage each object local to this node...
Definition: object.h:232
RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_index(Objects_Id id)
This function returns the index portion of the ID.
Definition: object.h:376
#define OBJECTS_INDEX_VALID_BITS
This mask represents the bits that is used to ensure no extra bits are set after shifting to extract ...
Definition: object.h:177
#define RTEMS_INLINE_ROUTINE
The following (in conjunction with compiler arguments) are used to choose between the use of static i...
Definition: basedefs.h:135
#define OBJECTS_CLASS_VALID_BITS
This mask represents the bits that is used to ensure no extra bits are set after shifting to extract ...
Definition: object.h:195
#define OBJECTS_CLASS_START_BIT
This is the bit position of the starting bit of the class portion of the object Id.
Definition: object.h:151
RTEMS_INLINE_ROUTINE Objects_Id _Objects_Build_id(Objects_APIs the_api, uint16_t the_class, uint8_t node, uint16_t index)
This function builds an object's id from the processor node and index values specified.
Definition: object.h:397
#define OBJECTS_UNLIMITED_OBJECTS
Mask to enable unlimited objects.
Definition: object.h:201
#define OBJECTS_INDEX_START_BIT
This is the bit position of the starting bit of the index portion of the object Id.
Definition: object.h:134
#define OBJECTS_API_START_BIT
This is the bit position of the starting bit of the API portion of the object Id. ...
Definition: object.h:145
Chain_Node Node
This is the chain node portion of an object.
Definition: object.h:234
SPARC CPU Department Source.
#define OBJECTS_NODE_VALID_BITS
This mask represents the bits that is used to ensure no extra bits are set after shifting to extract ...
Definition: object.h:183
RTEMS_INLINE_ROUTINE bool _Objects_Is_unlimited(uint32_t maximum)
Returns if the object maximum specifies unlimited objects.
Definition: object.h:420
RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_class(Objects_Id id)
This function returns the class portion of the ID.
Definition: object.h:339
uint16_t Objects_Maximum
This type is used to store the maximum number of allowed objects of each type.
Definition: object.h:128
Chain Handler API.
Basic Definitions.
RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_node(Objects_Id id)
This function returns the node portion of the ID.
Definition: object.h:354
Objects_Name name
This is the object's name.
Definition: object.h:238
uint32_t Objects_Id
The following type defines the control block used to manage object IDs.
Definition: object.h:122
The following type defines the control block used to manage object names.
Definition: object.h:68
#define OBJECTS_NODE_START_BIT
This is the bit position of the starting bit of the node portion of the object Id.
Definition: object.h:139
Objects_APIs
This enumerated type is used in the class field of the object ID.
Definition: object.h:217
Objects_Id id
This is the object's ID.
Definition: object.h:236