RTEMS CPU Kit with SuperCore  4.10.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 #include <rtems/score/isrlock.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
39 #if defined(RTEMS_POSIX_API)
40 
46  #define RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES
47 #endif
48 
69 typedef union {
70  #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
71 
72  const char *name_p;
73  #endif
74 
75  uint32_t name_u32;
76 } Objects_Name;
77 
78 #if defined(RTEMS_USE_16_BIT_OBJECT)
79 
87 typedef uint16_t Objects_Id;
88 
93 typedef uint8_t Objects_Maximum;
94 
95 #define OBJECTS_INDEX_START_BIT 0U
96 #define OBJECTS_API_START_BIT 8U
97 #define OBJECTS_CLASS_START_BIT 11U
98 
99 #define OBJECTS_INDEX_MASK (Objects_Id)0x00ffU
100 #define OBJECTS_API_MASK (Objects_Id)0x0700U
101 #define OBJECTS_CLASS_MASK (Objects_Id)0xF800U
102 
103 #define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x00ffU
104 #define OBJECTS_API_VALID_BITS (Objects_Id)0x0007U
105 /* OBJECTS_NODE_VALID_BITS should not be used with 16 bit Ids */
106 #define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x001fU
107 
108 #define OBJECTS_UNLIMITED_OBJECTS 0x8000U
109 
110 #define OBJECTS_ID_INITIAL_INDEX (0)
111 #define OBJECTS_ID_FINAL_INDEX (0xff)
112 
113 #else
114 
123 typedef uint32_t Objects_Id;
124 
129 typedef uint16_t Objects_Maximum;
130 
135 #define OBJECTS_INDEX_START_BIT 0U
136 
140 #define OBJECTS_NODE_START_BIT 16U
141 
146 #define OBJECTS_API_START_BIT 24U
147 
152 #define OBJECTS_CLASS_START_BIT 27U
153 
157 #define OBJECTS_INDEX_MASK (Objects_Id)0x0000ffffU
158 
162 #define OBJECTS_NODE_MASK (Objects_Id)0x00ff0000U
163 
167 #define OBJECTS_API_MASK (Objects_Id)0x07000000U
168 
172 #define OBJECTS_CLASS_MASK (Objects_Id)0xf8000000U
173 
178 #define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x0000ffffU
179 
184 #define OBJECTS_NODE_VALID_BITS (Objects_Id)0x000000ffU
185 
190 #define OBJECTS_API_VALID_BITS (Objects_Id)0x00000007U
191 
196 #define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x0000001fU
197 
202 #define OBJECTS_UNLIMITED_OBJECTS 0x80000000U
203 
207 #define OBJECTS_ID_INITIAL_INDEX (0)
208 
212 #define OBJECTS_ID_FINAL_INDEX (0xffffU)
213 #endif
214 
218 typedef enum {
219  OBJECTS_NO_API = 0,
220  OBJECTS_INTERNAL_API = 1,
221  OBJECTS_CLASSIC_API = 2,
222  OBJECTS_POSIX_API = 3,
223  OBJECTS_FAKE_OBJECTS_API = 7
224 } Objects_APIs;
225 
227 #define OBJECTS_APIS_LAST OBJECTS_POSIX_API
228 
233 typedef struct {
237  Objects_Id id;
241  ISR_LOCK_MEMBER( Lock )
243 
244 #if defined( RTEMS_MULTIPROCESSING )
245 
249 typedef struct {
251  Objects_Control Object;
256  uint32_t name;
257 } Objects_MP_Control;
258 #endif
259 
263 #define OBJECTS_ID_NONE 0
264 
269 #define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
270 
275 #define OBJECTS_SEARCH_ALL_NODES 0
276 
281 #define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
282 
287 #define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF
288 
293 #define OBJECTS_WHO_AM_I 0
294 
299 #define OBJECTS_ID_INITIAL(_api, _class, _node) \
300  _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
301 
305 #define OBJECTS_ID_FINAL ((Objects_Id)~0)
306 
317 #define _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
318  ( (uint32_t)(_C1) << 24 | \
319  (uint32_t)(_C2) << 16 | \
320  (uint32_t)(_C3) << 8 | \
321  (uint32_t)(_C4) )
322 
331  Objects_Id id
332 )
333 {
335 }
336 
343  Objects_Id id
344 )
345 {
346  return (uint32_t)
348 }
349 
358  Objects_Id id
359 )
360 {
361  /*
362  * If using 16-bit Ids, then there is no node field and it MUST
363  * be a single processor system.
364  */
365  #if defined(RTEMS_USE_16_BIT_OBJECT)
366  return 1;
367  #else
369  #endif
370 }
371 
380  Objects_Id id
381 )
382 {
383  return
384  (Objects_Maximum)((id >> OBJECTS_INDEX_START_BIT) &
386 }
387 
401  Objects_APIs the_api,
402  uint16_t the_class,
403  uint8_t node,
404  uint16_t index
405 )
406 {
407  return (( (Objects_Id) the_api ) << OBJECTS_API_START_BIT) |
408  (( (Objects_Id) the_class ) << OBJECTS_CLASS_START_BIT) |
409  #if !defined(RTEMS_USE_16_BIT_OBJECT)
410  (( (Objects_Id) node ) << OBJECTS_NODE_START_BIT) |
411  #endif
412  (( (Objects_Id) index ) << OBJECTS_INDEX_START_BIT);
413 }
414 
424 {
425  return (maximum & OBJECTS_UNLIMITED_OBJECTS) != 0;
426 }
427 
428 /*
429  * We cannot use an inline function for this since it may be evaluated at
430  * compile time.
431  */
432 #define _Objects_Maximum_per_allocation( maximum ) \
433  ((Objects_Maximum) ((maximum) & ~OBJECTS_UNLIMITED_OBJECTS))
434 
439 #ifdef __cplusplus
440 }
441 #endif
442 
443 #endif
444 /* end of include file */
uint32_t name_u32
This is the actual 32-bit "raw" integer name.
Definition: object.h:75
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:190
RTEMS_INLINE_ROUTINE Objects_APIs _Objects_Get_API(Objects_Id id)
This function returns the API portion of the ID.
Definition: object.h:330
The following defines the Object Control Block used to manage each object local to this node...
Definition: object.h:233
RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_index(Objects_Id id)
This function returns the index portion of the ID.
Definition: object.h:379
#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:178
#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 ISR_LOCK_MEMBER(_designator)
Defines an ISR lock member.
Definition: isrlock.h:83
#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:196
#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:152
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:400
#define OBJECTS_UNLIMITED_OBJECTS
Mask to enable unlimited objects.
Definition: object.h:202
#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:135
#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:146
Chain_Node Node
This is the chain node portion of an object.
Definition: object.h:235
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:184
RTEMS_INLINE_ROUTINE bool _Objects_Is_unlimited(uint32_t maximum)
Returns if the object maximum specifies unlimited objects.
Definition: object.h:423
RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_class(Objects_Id id)
This function returns the class portion of the ID.
Definition: object.h:342
uint16_t Objects_Maximum
This type is used to store the maximum number of allowed objects of each type.
Definition: object.h:129
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:357
Objects_Name name
This is the object's name.
Definition: object.h:239
uint32_t Objects_Id
The following type defines the control block used to manage object IDs.
Definition: object.h:123
The following type defines the control block used to manage object names.
Definition: object.h:69
#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:140
ISR Locks.
Objects_APIs
This enumerated type is used in the class field of the object ID.
Definition: object.h:218
Objects_Id id
This is the object's ID.
Definition: object.h:237