RTEMS 6.1-rc6
Loading...
Searching...
No Matches
objectdata.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
14/*
15 * COPYRIGHT (c) 1989-2011.
16 * On-Line Applications Research Corporation (OAR).
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 * 1. Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 * 2. Redistributions in binary form must reproduce the above copyright
24 * notice, this list of conditions and the following disclaimer in the
25 * documentation and/or other materials provided with the distribution.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef _RTEMS_SCORE_OBJECTDATA_H
41#define _RTEMS_SCORE_OBJECTDATA_H
42
43#include <rtems/score/object.h>
45#include <rtems/score/rbtree.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
61typedef struct {
69
74typedef enum {
75 OBJECTS_INTERNAL_NO_CLASS = 0,
76
77 /* Must be one, see _Thread_Get_objects_information_by_id() */
78 OBJECTS_INTERNAL_THREADS = 1
80
85typedef enum {
86 OBJECTS_CLASSIC_NO_CLASS = 0,
87
88 /* Must be one, see _Thread_Get_objects_information_by_id() */
89 OBJECTS_RTEMS_TASKS = 1,
90
91 OBJECTS_RTEMS_TIMERS,
92 OBJECTS_RTEMS_SEMAPHORES,
93 OBJECTS_RTEMS_MESSAGE_QUEUES,
94 OBJECTS_RTEMS_PARTITIONS,
95 OBJECTS_RTEMS_REGIONS,
96 OBJECTS_RTEMS_PORTS,
97 OBJECTS_RTEMS_PERIODS,
98 OBJECTS_RTEMS_EXTENSIONS,
99 OBJECTS_RTEMS_BARRIERS
101
106typedef enum {
107 OBJECTS_POSIX_NO_CLASS = 0,
108
109 /* Must be one, see _Thread_Get_objects_information_by_id() */
110 OBJECTS_POSIX_THREADS = 1,
111
112 OBJECTS_POSIX_KEYS,
113 OBJECTS_POSIX_MESSAGE_QUEUES,
114 OBJECTS_POSIX_SEMAPHORES,
115 OBJECTS_POSIX_TIMERS,
116 OBJECTS_POSIX_SHMS
118
123#define OBJECTS_NO_STRING_NAME 0
124
125#if defined( RTEMS_MULTIPROCESSING )
126struct _Thread_Control;
127
132typedef struct {
136 union {
140 Chain_Node Inactive;
141
142 struct {
146 RBTree_Node Id_lookup;
147
151 RBTree_Node Name_lookup;
152 } Active;
153 } Nodes;
154
158 Objects_Id id;
159
166 uint32_t name;
167} Objects_MP_Control;
168
174extern Objects_MP_Control _Objects_MP_Controls[];
175
181typedef void ( *Objects_Thread_queue_Extract_callout )(
182 struct _Thread_Control *,
184);
185#endif
186
188
208
218
226
236
245
254
260 uint16_t object_size;
261
269 uint16_t name_length;
270
279
287
295
305
306#if defined(RTEMS_MULTIPROCESSING)
312 Objects_Thread_queue_Extract_callout extract;
313
320 RBTree_Control Global_by_id;
321
331 RBTree_Control Global_by_name;
332#endif
333};
334
343
353
365
375 Objects_Information *information,
376 Objects_Control *the_object
377);
378
389 Objects_Information *information,
390 Objects_Control *the_object
391);
392
393#if defined(RTEMS_MULTIPROCESSING)
394#define OBJECTS_INFORMATION_MP( name, extract ) \
395 , \
396 extract, \
397 RBTREE_INITIALIZER_EMPTY( name.Global_by_id ), \
398 RBTREE_INITIALIZER_EMPTY( name.Global_by_name )
399#else
400#define OBJECTS_INFORMATION_MP( name, extract )
401#endif
402
414#define OBJECTS_INFORMATION_DEFINE_ZERO( name, api, cls, nl ) \
415Objects_Information name##_Information = { \
416 _Objects_Build_id( api, cls, 1, 0 ), \
417 NULL, \
418 _Objects_Allocate_none, \
419 NULL, \
420 0, \
421 0, \
422 0, \
423 nl, \
424 CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \
425 NULL, \
426 NULL, \
427 NULL \
428 OBJECTS_INFORMATION_MP( name##_Information, NULL ) \
429}
430
449#define OBJECTS_INFORMATION_DEFINE( name, api, cls, type, max, nl, ex ) \
450static Objects_Control * \
451name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
452static RTEMS_SECTION( ".noinit.rtems.content.objects." #name ) \
453type \
454name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
455Objects_Information name##_Information = { \
456 _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
457 name##_Local_table, \
458 _Objects_Is_unlimited( max ) ? \
459 _Objects_Allocate_unlimited : _Objects_Allocate_static, \
460 _Objects_Is_unlimited( max ) ? \
461 _Objects_Free_unlimited : _Objects_Free_static, \
462 0, \
463 _Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \
464 sizeof( type ), \
465 nl, \
466 CHAIN_INITIALIZER_EMPTY( name##_Information.Inactive ), \
467 NULL, \
468 NULL, \
469 &name##_Objects[ 0 ].Object \
470 OBJECTS_INFORMATION_MP( name##_Information, ex ) \
471}
472
475#ifdef __cplusplus
476}
477#endif
478
479#endif
480/* end of include file */
This header file provides interfaces of the Chain Handler which are only used by the implementation.
void _Objects_Free_static(Objects_Information *information, Objects_Control *the_object)
Free the object.
Definition: objectfreestatic.c:44
uint32_t Objects_Id
Definition: object.h:101
Objects_Control * _Objects_Allocate_static(Objects_Information *information)
Return an inactive object or NULL.
Definition: objectallocatestatic.c:44
Objects_Control * _Objects_Allocate_unlimited(Objects_Information *information)
Return an inactive object or NULL.
Definition: objectallocateunlimited.c:49
Objects_POSIX_API
Definition: objectdata.h:106
uint16_t Objects_Maximum
Definition: object.h:107
Objects_Internal_API
Definition: objectdata.h:74
void _Objects_Free_unlimited(Objects_Information *information, Objects_Control *the_object)
Free the object.
Definition: objectfree.c:45
Objects_Control * _Objects_Allocate_none(Objects_Information *information)
Always return NULL.
Definition: objectallocatenone.c:43
Objects_Classic_API
Definition: objectdata.h:85
This header file provides interfaces of the Red-Black Tree Handler which are used by the implementati...
This header file provides interfaces of the Object Handler which are used by the implementation and t...
This structure represents a chain node.
Definition: chain.h:78
Definition: objectdata.h:61
Chain_Node Node
Definition: objectdata.h:63
Objects_Id id
Definition: objectdata.h:65
Objects_Name name
Definition: objectdata.h:67
The information structure used to manage each API class of objects.
Definition: objectdata.h:198
uint16_t object_size
This is the size in bytes of each object control block.
Definition: objectdata.h:260
Objects_Control * initial_objects
This points to the object control blocks initially available.
Definition: objectdata.h:304
Objects_Id maximum_id
This is the maximum valid ID of this object API class.
Definition: objectdata.h:207
Objects_Control ** local_table
This points to the table of local object control blocks.
Definition: objectdata.h:217
Chain_Control Inactive
This is the chain of inactive object control blocks.
Definition: objectdata.h:278
Objects_Maximum inactive
This is the number of object control blocks on the inactive chain.
Definition: objectdata.h:244
Objects_Maximum * inactive_per_block
This is the number of inactive object control blocks per allocation block.
Definition: objectdata.h:286
uint16_t name_length
This is the maximum length of names.
Definition: objectdata.h:269
Objects_Control ** object_blocks
This is a table to allocation blocks of object control blocks.
Definition: objectdata.h:294
Objects_Maximum objects_per_block
This is the number of object control blocks in an allocation block.
Definition: objectdata.h:253
void(* deallocate)(Objects_Information *, Objects_Control *)
Free an object.
Definition: objectdata.h:235
Red-black tree node.
Definition: rbtree.h:73
Definition: thread.h:837
This union represents a chain control block.
Definition: chain.h:96
Definition: object.h:85