RTEMS  5.0.0
objectdata.h
Go to the documentation of this file.
1 
9 /*
10  * COPYRIGHT (c) 1989-2011.
11  * On-Line Applications Research Corporation (OAR).
12  *
13  * The license and distribution terms for this file may be
14  * found in the file LICENSE in this distribution or at
15  * http://www.rtems.org/license/LICENSE.
16  */
17 
18 #ifndef _RTEMS_SCORE_OBJECTDATA_H
19 #define _RTEMS_SCORE_OBJECTDATA_H
20 
21 #include <rtems/score/object.h>
22 #include <rtems/score/chainimpl.h>
23 #include <rtems/score/rbtree.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
39 typedef struct {
47 
52 typedef enum {
53  OBJECTS_INTERNAL_NO_CLASS = 0,
54  OBJECTS_INTERNAL_THREADS = 1
56 
61 typedef enum {
62  OBJECTS_CLASSIC_NO_CLASS = 0,
63  OBJECTS_RTEMS_TASKS = 1,
64  OBJECTS_RTEMS_TIMERS = 2,
65  OBJECTS_RTEMS_SEMAPHORES = 3,
66  OBJECTS_RTEMS_MESSAGE_QUEUES = 4,
67  OBJECTS_RTEMS_PARTITIONS = 5,
68  OBJECTS_RTEMS_REGIONS = 6,
69  OBJECTS_RTEMS_PORTS = 7,
70  OBJECTS_RTEMS_PERIODS = 8,
71  OBJECTS_RTEMS_EXTENSIONS = 9,
72  OBJECTS_RTEMS_BARRIERS = 10
74 
79 typedef enum {
80  OBJECTS_POSIX_NO_CLASS = 0,
81  OBJECTS_POSIX_THREADS = 1,
82  OBJECTS_POSIX_KEYS = 2,
83  OBJECTS_POSIX_INTERRUPTS = 3,
84  OBJECTS_POSIX_MESSAGE_QUEUES = 5,
85  OBJECTS_POSIX_SEMAPHORES = 7,
86  OBJECTS_POSIX_TIMERS = 9,
87  OBJECTS_POSIX_SHMS = 12
89 
94 #define OBJECTS_NO_STRING_NAME 0
95 
96 #if defined( RTEMS_MULTIPROCESSING )
97 struct _Thread_Control;
98 
103 typedef struct {
107  union {
111  Chain_Node Inactive;
112 
113  struct {
117  RBTree_Node Id_lookup;
118 
122  RBTree_Node Name_lookup;
123  } Active;
124  } Nodes;
125 
129  Objects_Id id;
130 
137  uint32_t name;
138 } Objects_MP_Control;
139 
145 typedef void ( *Objects_Thread_queue_Extract_callout )(
146  struct _Thread_Control *,
147  Objects_Id
148 );
149 #endif
150 
160 typedef struct {
170 
180 
189 
198 
204  uint16_t object_size;
205 
213  uint16_t name_length;
214 
223 
231 
239 
249 
250 #if defined(RTEMS_MULTIPROCESSING)
251 
256  Objects_Thread_queue_Extract_callout extract;
257 
264  RBTree_Control Global_by_id;
265 
275  RBTree_Control Global_by_name;
276 #endif
278 
279 #if defined(RTEMS_MULTIPROCESSING)
280 #define OBJECTS_INFORMATION_MP( name, extract ) \
281  , \
282  extract, \
283  RBTREE_INITIALIZER_EMPTY( name.Global_by_id ), \
284  RBTREE_INITIALIZER_EMPTY( name.Global_by_name )
285 #else
286 #define OBJECTS_INFORMATION_MP( name, extract )
287 #endif
288 
300 #define OBJECTS_INFORMATION_DEFINE_ZERO( name, api, cls, nl ) \
301 Objects_Information name##_Information = { \
302  _Objects_Build_id( api, cls, 1, 0 ), \
303  NULL, \
304  0, \
305  0, \
306  0, \
307  nl, \
308  CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \
309  NULL, \
310  NULL, \
311  NULL \
312  OBJECTS_INFORMATION_MP( name##_Information, NULL ) \
313 }
314 
333 #define OBJECTS_INFORMATION_DEFINE( name, api, cls, type, max, nl, ex ) \
334 static Objects_Control * \
335 name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
336 static type name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
337 Objects_Information name##_Information = { \
338  _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
339  name##_Local_table, \
340  0, \
341  _Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \
342  sizeof( type ), \
343  nl, \
344  CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \
345  NULL, \
346  NULL, \
347  &name##_Objects[ 0 ].Object \
348  OBJECTS_INFORMATION_MP( name##_Information, ex ) \
349 }
350 
353 #ifdef __cplusplus
354 }
355 #endif
356 
357 #endif
358 /* end of include file */
Definition: chain.h:65
Definition: objectdata.h:39
Chain_Control Inactive
This is the chain of inactive object control blocks.
Definition: objectdata.h:222
Constants and Structures Associated with the Object Handler.
Objects_Maximum * inactive_per_block
This is the number of inactive object control blocks per allocation block.
Definition: objectdata.h:230
Definition: chain.h:83
Objects_Maximum inactive
This is the number of object control blocks on the inactive chain.
Definition: objectdata.h:188
Red-black tree node.
Definition: rbtree.h:50
Objects_Control * initial_objects
This points to the object control blocks initially available.
Definition: objectdata.h:248
Objects_Id maximum_id
This is the maximum valid ID of this object API class.
Definition: objectdata.h:169
Objects_Control ** local_table
This points to the table of local object control blocks.
Definition: objectdata.h:179
Definition: thread.h:728
Chain_Node Node
Definition: objectdata.h:41
Constants and Structures Associated with the Red-Black Tree Handler.
The information structure used to manage each API class of objects.
Definition: objectdata.h:160
Chain Handler API.
Objects_Internal_API
Definition: objectdata.h:52
uint16_t name_length
This is the maximum length of names.
Definition: objectdata.h:213
uint16_t Objects_Maximum
Definition: object.h:81
Objects_POSIX_API
Definition: objectdata.h:79
Objects_Classic_API
Definition: objectdata.h:61
Objects_Name name
Definition: objectdata.h:45
Objects_Maximum objects_per_block
This is the number of object control blocks in an allocation block.
Definition: objectdata.h:197
uint32_t Objects_Id
Definition: object.h:75
Definition: object.h:59
Objects_Control ** object_blocks
This is a table to allocation blocks of object control blocks.
Definition: objectdata.h:238
uint16_t object_size
This is the size in bytes of each object control block.
Definition: objectdata.h:204
Objects_Id id
Definition: objectdata.h:43