RTEMS
object.h
Go to the documentation of this file.
1 
13 /*
14  * COPYRIGHT (c) 1989-2011.
15  * On-Line Applications Research Corporation (OAR).
16  *
17  * The license and distribution terms for this file may be
18  * found in the file LICENSE in this distribution or at
19  * http://www.rtems.org/license/LICENSE.
20  */
21 
22 #ifndef _RTEMS_SCORE_OBJECT_H
23 #define _RTEMS_SCORE_OBJECT_H
24 
25 #include <rtems/score/basedefs.h>
26 #include <rtems/score/cpu.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
64 typedef union {
66  const char *name_p;
68  uint32_t name_u32;
69 } Objects_Name;
70 
80 typedef uint32_t Objects_Id;
81 
86 typedef uint16_t Objects_Maximum;
87 
92 #define OBJECTS_INDEX_START_BIT 0U
93 
97 #define OBJECTS_NODE_START_BIT 16U
98 
103 #define OBJECTS_API_START_BIT 24U
104 
109 #define OBJECTS_CLASS_START_BIT 27U
110 
114 #define OBJECTS_INDEX_MASK (Objects_Id)0x0000ffffU
115 
119 #define OBJECTS_NODE_MASK (Objects_Id)0x00ff0000U
120 
124 #define OBJECTS_API_MASK (Objects_Id)0x07000000U
125 
129 #define OBJECTS_CLASS_MASK (Objects_Id)0xf8000000U
130 
135 #define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x0000ffffU
136 
141 #define OBJECTS_NODE_VALID_BITS (Objects_Id)0x000000ffU
142 
147 #define OBJECTS_API_VALID_BITS (Objects_Id)0x00000007U
148 
153 #define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x0000001fU
154 
159 #define OBJECTS_UNLIMITED_OBJECTS 0x80000000U
160 
164 #define OBJECTS_ID_INITIAL_INDEX (0)
165 
169 #define OBJECTS_ID_FINAL_INDEX (0xffffU)
170 
174 typedef enum {
175  OBJECTS_NO_API = 0,
176  OBJECTS_INTERNAL_API = 1,
177  OBJECTS_CLASSIC_API = 2,
178  OBJECTS_POSIX_API = 3,
179  OBJECTS_FAKE_OBJECTS_API = 7
180 } Objects_APIs;
181 
183 #define OBJECTS_APIS_LAST OBJECTS_POSIX_API
184 
188 #define OBJECTS_ID_NONE 0
189 
194 #define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
195 
200 #define OBJECTS_SEARCH_ALL_NODES 0
201 
206 #define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
207 
212 #define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF
213 
218 #define OBJECTS_WHO_AM_I 0
219 
224 #define OBJECTS_ID_INITIAL(_api, _class, _node) \
225  _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
226 
230 #define OBJECTS_ID_FINAL ((Objects_Id)~0)
231 
242 #define _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
243  ( (uint32_t)(_C1) << 24 | \
244  (uint32_t)(_C2) << 16 | \
245  (uint32_t)(_C3) << 8 | \
246  (uint32_t)(_C4) )
247 
256  Objects_Id id
257 )
258 {
260 }
261 
270  Objects_Id id
271 )
272 {
273  return (uint32_t)
275 }
276 
285  Objects_Id id
286 )
287 {
289 }
290 
299  Objects_Id id
300 )
301 {
302  return
305 }
306 
317 #define _Objects_Build_id( the_api, the_class, node, index ) \
318  ( (Objects_Id) ( (Objects_Id) the_api << OBJECTS_API_START_BIT ) | \
319  ( (Objects_Id) the_class << OBJECTS_CLASS_START_BIT ) | \
320  ( (Objects_Id) node << OBJECTS_NODE_START_BIT ) | \
321  ( (Objects_Id) index << OBJECTS_INDEX_START_BIT ) )
322 
331 #define _Objects_Is_unlimited( maximum ) \
332  ( ( ( maximum ) & OBJECTS_UNLIMITED_OBJECTS ) != 0 )
333 
334 /*
335  * We cannot use an inline function for this since it may be evaluated at
336  * compile time.
337  */
338 #define _Objects_Maximum_per_allocation( maximum ) \
339  ((Objects_Maximum) ((maximum) & ~OBJECTS_UNLIMITED_OBJECTS))
340 
344 #if defined(RTEMS_MULTIPROCESSING)
345 extern uint16_t _Objects_Local_node;
346 #else
347 #define _Objects_Local_node ((uint16_t) 1)
348 #endif
349 
354 #ifdef __cplusplus
355 }
356 #endif
357 
358 #endif
359 /* end of include file */
uint32_t name_u32
Definition: object.h:68
#define OBJECTS_NODE_VALID_BITS
Definition: object.h:141
#define OBJECTS_INDEX_START_BIT
Definition: object.h:92
#define OBJECTS_NODE_START_BIT
Definition: object.h:97
uint16_t Objects_Maximum
Definition: object.h:86
#define OBJECTS_INDEX_VALID_BITS
Definition: object.h:135
static __inline__ Objects_Maximum _Objects_Get_index(Objects_Id id)
Returns the index portion of the ID.
Definition: object.h:298
#define OBJECTS_API_START_BIT
Definition: object.h:103
static __inline__ uint32_t _Objects_Get_node(Objects_Id id)
Returns the node portion of the ID.
Definition: object.h:284
#define OBJECTS_CLASS_START_BIT
Definition: object.h:109
static __inline__ uint32_t _Objects_Get_class(Objects_Id id)
Returns the class portion of the ID.
Definition: object.h:269
#define OBJECTS_CLASS_VALID_BITS
Definition: object.h:153
SPARC CPU Department Source.
const char * name_p
Definition: object.h:66
#define _Objects_Local_node
The local MPCI node number.
Definition: object.h:347
Objects_APIs
Definition: object.h:174
#define OBJECTS_API_VALID_BITS
Definition: object.h:147
uint32_t Objects_Id
Definition: object.h:80
This header file provides basic definitions used by the API and the implementation.
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
Definition: basedefs.h:683
static __inline__ Objects_APIs _Objects_Get_API(Objects_Id id)
Returns the API portion of the ID.
Definition: object.h:255