RTEMS  5.0.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 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
59 typedef union {
61  const char *name_p;
63  uint32_t name_u32;
64 } Objects_Name;
65 
75 typedef uint32_t Objects_Id;
76 
81 typedef uint16_t Objects_Maximum;
82 
87 #define OBJECTS_INDEX_START_BIT 0U
88 
92 #define OBJECTS_NODE_START_BIT 16U
93 
98 #define OBJECTS_API_START_BIT 24U
99 
104 #define OBJECTS_CLASS_START_BIT 27U
105 
109 #define OBJECTS_INDEX_MASK (Objects_Id)0x0000ffffU
110 
114 #define OBJECTS_NODE_MASK (Objects_Id)0x00ff0000U
115 
119 #define OBJECTS_API_MASK (Objects_Id)0x07000000U
120 
124 #define OBJECTS_CLASS_MASK (Objects_Id)0xf8000000U
125 
130 #define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x0000ffffU
131 
136 #define OBJECTS_NODE_VALID_BITS (Objects_Id)0x000000ffU
137 
142 #define OBJECTS_API_VALID_BITS (Objects_Id)0x00000007U
143 
148 #define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x0000001fU
149 
154 #define OBJECTS_UNLIMITED_OBJECTS 0x80000000U
155 
159 #define OBJECTS_ID_INITIAL_INDEX (0)
160 
164 #define OBJECTS_ID_FINAL_INDEX (0xffffU)
165 
169 typedef enum {
170  OBJECTS_NO_API = 0,
171  OBJECTS_INTERNAL_API = 1,
172  OBJECTS_CLASSIC_API = 2,
173  OBJECTS_POSIX_API = 3,
174  OBJECTS_FAKE_OBJECTS_API = 7
175 } Objects_APIs;
176 
178 #define OBJECTS_APIS_LAST OBJECTS_POSIX_API
179 
183 #define OBJECTS_ID_NONE 0
184 
189 #define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
190 
195 #define OBJECTS_SEARCH_ALL_NODES 0
196 
201 #define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
202 
207 #define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF
208 
213 #define OBJECTS_WHO_AM_I 0
214 
219 #define OBJECTS_ID_INITIAL(_api, _class, _node) \
220  _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
221 
225 #define OBJECTS_ID_FINAL ((Objects_Id)~0)
226 
237 #define _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
238  ( (uint32_t)(_C1) << 24 | \
239  (uint32_t)(_C2) << 16 | \
240  (uint32_t)(_C3) << 8 | \
241  (uint32_t)(_C4) )
242 
251  Objects_Id id
252 )
253 {
255 }
256 
263  Objects_Id id
264 )
265 {
266  return (uint32_t)
268 }
269 
278  Objects_Id id
279 )
280 {
282 }
283 
292  Objects_Id id
293 )
294 {
295  return
296  (Objects_Maximum)((id >> OBJECTS_INDEX_START_BIT) &
298 }
299 
312 #define _Objects_Build_id( the_api, the_class, node, index ) \
313  ( (Objects_Id) ( (Objects_Id) the_api << OBJECTS_API_START_BIT ) | \
314  ( (Objects_Id) the_class << OBJECTS_CLASS_START_BIT ) | \
315  ( (Objects_Id) node << OBJECTS_NODE_START_BIT ) | \
316  ( (Objects_Id) index << OBJECTS_INDEX_START_BIT ) )
317 
326 #define _Objects_Is_unlimited( maximum ) \
327  ( ( ( maximum ) & OBJECTS_UNLIMITED_OBJECTS ) != 0 )
328 
329 /*
330  * We cannot use an inline function for this since it may be evaluated at
331  * compile time.
332  */
333 #define _Objects_Maximum_per_allocation( maximum ) \
334  ((Objects_Maximum) ((maximum) & ~OBJECTS_UNLIMITED_OBJECTS))
335 
340 #ifdef __cplusplus
341 }
342 #endif
343 
344 #endif
345 /* end of include file */
uint32_t name_u32
Definition: object.h:63
#define OBJECTS_API_VALID_BITS
Definition: object.h:142
RTEMS_INLINE_ROUTINE Objects_APIs _Objects_Get_API(Objects_Id id)
Definition: object.h:250
RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_index(Objects_Id id)
Definition: object.h:291
#define OBJECTS_INDEX_VALID_BITS
Definition: object.h:130
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:65
#define OBJECTS_CLASS_VALID_BITS
Definition: object.h:148
#define OBJECTS_CLASS_START_BIT
Definition: object.h:104
#define OBJECTS_INDEX_START_BIT
Definition: object.h:87
#define OBJECTS_API_START_BIT
Definition: object.h:98
#define OBJECTS_NODE_VALID_BITS
Definition: object.h:136
const char * name_p
Definition: object.h:61
RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_class(Objects_Id id)
Definition: object.h:262
uint16_t Objects_Maximum
Definition: object.h:81
Basic Definitions.
RTEMS_INLINE_ROUTINE uint32_t _Objects_Get_node(Objects_Id id)
Definition: object.h:277
uint32_t Objects_Id
Definition: object.h:75
Definition: object.h:59
#define OBJECTS_NODE_START_BIT
Definition: object.h:92
Objects_APIs
Definition: object.h:169