RTEMS: cpukit/include/rtems/score/objectdata.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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
26extern "C" {
27#endif
28
39 typedef struct {
41 Chain_Node Node;
43 Objects_Id id;
45 Objects_Name name;
46} Objects_Control;
47
52 typedef enum {
53 OBJECTS_INTERNAL_NO_CLASS = 0,
54
55 /* Must be one, see __Thread_Get_objects_information() */
56 OBJECTS_INTERNAL_THREADS = 1
57} Objects_Internal_API;
58
63 typedef 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
78} Objects_Classic_API;
79
84 typedef 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
95} Objects_POSIX_API;
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 *,
161 Objects_Id
162);
163#endif
164
165typedef struct Objects_Information Objects_Information;
166
176 struct Objects_Information {
185 Objects_Id maximum_id;
186
195 Objects_Control **local_table;
196
203 Objects_Control *( *allocate )( Objects_Information * );
204
213 void ( *deallocate )( Objects_Information *, Objects_Control * );
214
222 Objects_Maximum inactive;
223
231 Objects_Maximum objects_per_block;
232
238 uint16_t object_size;
239
247 uint16_t name_length;
248
256 Chain_Control Inactive;
257
264 Objects_Maximum *inactive_per_block;
265
272 Objects_Control **object_blocks;
273
282 Objects_Control *initial_objects;
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
320 Objects_Control *_Objects_Allocate_none( Objects_Information *information );
321
330 Objects_Control *_Objects_Allocate_static( Objects_Information *information );
331
342 Objects_Control *_Objects_Allocate_unlimited( Objects_Information *information );
343
352void _Objects_Free_static(
353 Objects_Information *information,
354 Objects_Control *the_object
355);
356
366void _Objects_Free_unlimited(
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 */
chainimpl.h
Chain Handler API.
_Objects_Free_static
void _Objects_Free_static(Objects_Information *information, Objects_Control *the_object)
Free the object.
Definition: objectfreestatic.c:41
Objects_Id
uint32_t Objects_Id
Definition: object.h:80
_Objects_Allocate_static
Objects_Control * _Objects_Allocate_static(Objects_Information *information)
Return an inactive object or NULL.
Definition: objectallocatestatic.c:41
_Objects_Allocate_unlimited
Objects_Control * _Objects_Allocate_unlimited(Objects_Information *information)
Return an inactive object or NULL.
Definition: objectallocateunlimited.c:46
Objects_POSIX_API
Objects_POSIX_API
Definition: objectdata.h:84
Objects_Maximum
uint16_t Objects_Maximum
Definition: object.h:86
Objects_Internal_API
Objects_Internal_API
Definition: objectdata.h:52
_Objects_Free_unlimited
void _Objects_Free_unlimited(Objects_Information *information, Objects_Control *the_object)
Free the object.
Definition: objectfree.c:24
_Objects_Allocate_none
Objects_Control * _Objects_Allocate_none(Objects_Information *information)
Always return NULL.
Definition: objectallocatenone.c:40
Objects_Classic_API
Objects_Classic_API
Definition: objectdata.h:63
rbtree.h
Constants and Structures Associated with the Red-Black Tree Handler.
object.h
Constants and Structures Associated with the Object Handler.
Chain_Node_struct
Definition: chain.h:68
Objects_Control
Definition: objectdata.h:39
Objects_Control::Node
Chain_Node Node
Definition: objectdata.h:41
Objects_Control::id
Objects_Id id
Definition: objectdata.h:43
Objects_Control::name
Objects_Name name
Definition: objectdata.h:45
Objects_Information
The information structure used to manage each API class of objects.
Definition: objectdata.h:176
Objects_Information::object_size
uint16_t object_size
This is the size in bytes of each object control block.
Definition: objectdata.h:238
Objects_Information::initial_objects
Objects_Control * initial_objects
This points to the object control blocks initially available.
Definition: objectdata.h:282
Objects_Information::maximum_id
Objects_Id maximum_id
This is the maximum valid ID of this object API class.
Definition: objectdata.h:185
Objects_Information::local_table
Objects_Control ** local_table
This points to the table of local object control blocks.
Definition: objectdata.h:195
Objects_Information::Inactive
Chain_Control Inactive
This is the chain of inactive object control blocks.
Definition: objectdata.h:256
Objects_Information::inactive
Objects_Maximum inactive
This is the number of object control blocks on the inactive chain.
Definition: objectdata.h:222
Objects_Information::inactive_per_block
Objects_Maximum * inactive_per_block
This is the number of inactive object control blocks per allocation block.
Definition: objectdata.h:264
Objects_Information::name_length
uint16_t name_length
This is the maximum length of names.
Definition: objectdata.h:247
Objects_Information::object_blocks
Objects_Control ** object_blocks
This is a table to allocation blocks of object control blocks.
Definition: objectdata.h:272
Objects_Information::objects_per_block
Objects_Maximum objects_per_block
This is the number of object control blocks in an allocation block.
Definition: objectdata.h:231
Objects_Information::deallocate
void(* deallocate)(Objects_Information *, Objects_Control *)
Free an object.
Definition: objectdata.h:213
RBTree_Node
Red-black tree node.
Definition: rbtree.h:55
_Thread_Control
Definition: thread.h:732
Chain_Control
Definition: chain.h:86
Objects_Name
Definition: object.h:64