RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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>
23#include <rtems/score/rbtree.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
39typedef struct {
47
52typedef enum {
53 OBJECTS_INTERNAL_NO_CLASS = 0,
54
55 /* Must be one, see __Thread_Get_objects_information() */
56 OBJECTS_INTERNAL_THREADS = 1
58
63typedef enum {
64 OBJECTS_CLASSIC_NO_CLASS = 0,
65
66 /* Must be one, see __Thread_Get_objects_information() */
67 OBJECTS_RTEMS_TASKS = 1,
68
69 OBJECTS_RTEMS_TIMERS,
70 OBJECTS_RTEMS_SEMAPHORES,
71 OBJECTS_RTEMS_MESSAGE_QUEUES,
72 OBJECTS_RTEMS_PARTITIONS,
73 OBJECTS_RTEMS_REGIONS,
74 OBJECTS_RTEMS_PORTS,
75 OBJECTS_RTEMS_PERIODS,
76 OBJECTS_RTEMS_EXTENSIONS,
77 OBJECTS_RTEMS_BARRIERS
79
84typedef enum {
85 OBJECTS_POSIX_NO_CLASS = 0,
86
87 /* Must be one, see __Thread_Get_objects_information() */
88 OBJECTS_POSIX_THREADS = 1,
89
90 OBJECTS_POSIX_KEYS,
91 OBJECTS_POSIX_MESSAGE_QUEUES,
92 OBJECTS_POSIX_SEMAPHORES,
93 OBJECTS_POSIX_TIMERS,
94 OBJECTS_POSIX_SHMS
96
101#define OBJECTS_NO_STRING_NAME 0
102
103#if defined( RTEMS_MULTIPROCESSING )
104struct _Thread_Control;
105
110typedef struct {
114 union {
118 Chain_Node Inactive;
119
120 struct {
124 RBTree_Node Id_lookup;
125
129 RBTree_Node Name_lookup;
130 } Active;
131 } Nodes;
132
136 Objects_Id id;
137
144 uint32_t name;
145} Objects_MP_Control;
146
152extern Objects_MP_Control _Objects_MP_Controls[];
153
159typedef void ( *Objects_Thread_queue_Extract_callout )(
160 struct _Thread_Control *,
162);
163#endif
164
166
186
196
204
214
223
232
238 uint16_t object_size;
239
247 uint16_t name_length;
248
257
265
273
283
284#if defined(RTEMS_MULTIPROCESSING)
290 Objects_Thread_queue_Extract_callout extract;
291
298 RBTree_Control Global_by_id;
299
309 RBTree_Control Global_by_name;
310#endif
311};
312
321
331
343
353 Objects_Information *information,
354 Objects_Control *the_object
355);
356
367 Objects_Information *information,
368 Objects_Control *the_object
369);
370
371#if defined(RTEMS_MULTIPROCESSING)
372#define OBJECTS_INFORMATION_MP( name, extract ) \
373 , \
374 extract, \
375 RBTREE_INITIALIZER_EMPTY( name.Global_by_id ), \
376 RBTREE_INITIALIZER_EMPTY( name.Global_by_name )
377#else
378#define OBJECTS_INFORMATION_MP( name, extract )
379#endif
380
392#define OBJECTS_INFORMATION_DEFINE_ZERO( name, api, cls, nl ) \
393Objects_Information name##_Information = { \
394 _Objects_Build_id( api, cls, 1, 0 ), \
395 NULL, \
396 _Objects_Allocate_none, \
397 NULL, \
398 0, \
399 0, \
400 0, \
401 nl, \
402 CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \
403 NULL, \
404 NULL, \
405 NULL \
406 OBJECTS_INFORMATION_MP( name##_Information, NULL ) \
407}
408
427#define OBJECTS_INFORMATION_DEFINE( name, api, cls, type, max, nl, ex ) \
428static Objects_Control * \
429name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
430static type name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
431Objects_Information name##_Information = { \
432 _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
433 name##_Local_table, \
434 _Objects_Is_unlimited( max ) ? \
435 _Objects_Allocate_unlimited : _Objects_Allocate_static, \
436 _Objects_Is_unlimited( max ) ? \
437 _Objects_Free_unlimited : _Objects_Free_static, \
438 0, \
439 _Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \
440 sizeof( type ), \
441 nl, \
442 CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \
443 NULL, \
444 NULL, \
445 &name##_Objects[ 0 ].Object \
446 OBJECTS_INFORMATION_MP( name##_Information, ex ) \
447}
448
451#ifdef __cplusplus
452}
453#endif
454
455#endif
456/* end of include file */
Chain Handler API.
void _Objects_Free_static(Objects_Information *information, Objects_Control *the_object)
Free the object.
Definition: objectfreestatic.c:41
uint32_t Objects_Id
Definition: object.h:80
Objects_Control * _Objects_Allocate_static(Objects_Information *information)
Return an inactive object or NULL.
Definition: objectallocatestatic.c:41
Objects_Control * _Objects_Allocate_unlimited(Objects_Information *information)
Return an inactive object or NULL.
Definition: objectallocateunlimited.c:46
Objects_POSIX_API
Definition: objectdata.h:84
uint16_t Objects_Maximum
Definition: object.h:86
Objects_Internal_API
Definition: objectdata.h:52
void _Objects_Free_unlimited(Objects_Information *information, Objects_Control *the_object)
Free the object.
Definition: objectfree.c:24
Objects_Control * _Objects_Allocate_none(Objects_Information *information)
Always return NULL.
Definition: objectallocatenone.c:40
Objects_Classic_API
Definition: objectdata.h:63
Constants and Structures Associated with the Red-Black Tree Handler.
Constants and Structures Associated with the Object Handler.
Definition: chain.h:68
Definition: objectdata.h:39
Chain_Node Node
Definition: objectdata.h:41
Objects_Id id
Definition: objectdata.h:43
Objects_Name name
Definition: objectdata.h:45
The information structure used to manage each API class of objects.
Definition: objectdata.h:176
uint16_t object_size
This is the size in bytes of each object control block.
Definition: objectdata.h:238
Objects_Control * initial_objects
This points to the object control blocks initially available.
Definition: objectdata.h:282
Objects_Id maximum_id
This is the maximum valid ID of this object API class.
Definition: objectdata.h:185
Objects_Control ** local_table
This points to the table of local object control blocks.
Definition: objectdata.h:195
Chain_Control Inactive
This is the chain of inactive object control blocks.
Definition: objectdata.h:256
Objects_Maximum inactive
This is the number of object control blocks on the inactive chain.
Definition: objectdata.h:222
Objects_Maximum * inactive_per_block
This is the number of inactive object control blocks per allocation block.
Definition: objectdata.h:264
uint16_t name_length
This is the maximum length of names.
Definition: objectdata.h:247
Objects_Control ** object_blocks
This is a table to allocation blocks of object control blocks.
Definition: objectdata.h:272
Objects_Maximum objects_per_block
This is the number of object control blocks in an allocation block.
Definition: objectdata.h:231
void(* deallocate)(Objects_Information *, Objects_Control *)
Free an object.
Definition: objectdata.h:213
Red-black tree node.
Definition: rbtree.h:55
Definition: thread.h:732
Definition: chain.h:86
Definition: object.h:64