RTEMS 6.1-rc7
Loading...
Searching...
No Matches
object.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
13/*
14 * COPYRIGHT (c) 1989-2011.
15 * On-Line Applications Research Corporation (OAR).
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#ifndef _RTEMS_SCORE_OBJECT_H
40#define _RTEMS_SCORE_OBJECT_H
41
43#include <rtems/score/cpu.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
85typedef union {
87 const char *name_p;
89 uint32_t name_u32;
91
101typedef uint32_t Objects_Id;
102
107typedef uint16_t Objects_Maximum;
108
113#define OBJECTS_INDEX_START_BIT 0U
118#define OBJECTS_NODE_START_BIT 16U
119
124#define OBJECTS_API_START_BIT 24U
125
130#define OBJECTS_CLASS_START_BIT 27U
131
135#define OBJECTS_INDEX_MASK (Objects_Id)0x0000ffffU
136
140#define OBJECTS_NODE_MASK (Objects_Id)0x00ff0000U
141
145#define OBJECTS_API_MASK (Objects_Id)0x07000000U
146
150#define OBJECTS_CLASS_MASK (Objects_Id)0xf8000000U
151
156#define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x0000ffffU
157
162#define OBJECTS_NODE_VALID_BITS (Objects_Id)0x000000ffU
163
168#define OBJECTS_API_VALID_BITS (Objects_Id)0x00000007U
169
174#define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x0000001fU
175
180#define OBJECTS_UNLIMITED_OBJECTS 0x80000000U
181
185#define OBJECTS_ID_INITIAL_INDEX (0)
186
190#define OBJECTS_ID_FINAL_INDEX (0xffffU)
191
195typedef enum {
196 OBJECTS_NO_API = 0,
197 OBJECTS_INTERNAL_API = 1,
198 OBJECTS_CLASSIC_API = 2,
199 OBJECTS_POSIX_API = 3,
200 OBJECTS_FAKE_OBJECTS_API = 7
202
204#define OBJECTS_APIS_LAST OBJECTS_POSIX_API
205
209#define OBJECTS_ID_NONE 0
210
215#define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
216
221#define OBJECTS_SEARCH_ALL_NODES 0
222
227#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
228
233#define OBJECTS_SEARCH_LOCAL_NODE 0x7FFFFFFF
234
239#define OBJECTS_WHO_AM_I 0
240
245#define OBJECTS_ID_INITIAL(_api, _class, _node) \
246 _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
247
251#define OBJECTS_ID_FINAL ((Objects_Id)~0)
252
263#define _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
264 ( (uint32_t) (uint8_t) (_C1) << 24 | \
265 (uint32_t) (uint8_t) (_C2) << 16 | \
266 (uint32_t) (uint8_t) (_C3) << 8 | \
267 (uint8_t) (_C4) )
268
276static inline Objects_APIs _Objects_Get_API(
277 Objects_Id id
278)
279{
281}
282
290static inline uint32_t _Objects_Get_class(
291 Objects_Id id
292)
293{
294 return (uint32_t)
296}
297
305static inline uint32_t _Objects_Get_node(
306 Objects_Id id
307)
308{
310}
311
319static inline Objects_Maximum _Objects_Get_index(
320 Objects_Id id
321)
322{
323 return
326}
327
338#define _Objects_Build_id( the_api, the_class, node, index ) \
339 ( (Objects_Id) ( (Objects_Id) the_api << OBJECTS_API_START_BIT ) | \
340 ( (Objects_Id) the_class << OBJECTS_CLASS_START_BIT ) | \
341 ( (Objects_Id) node << OBJECTS_NODE_START_BIT ) | \
342 ( (Objects_Id) index << OBJECTS_INDEX_START_BIT ) )
343
352#define _Objects_Is_unlimited( maximum ) \
353 ( ( ( maximum ) & OBJECTS_UNLIMITED_OBJECTS ) != 0 )
354
355/*
356 * We cannot use an inline function for this since it may be evaluated at
357 * compile time.
358 */
359#define _Objects_Maximum_per_allocation( maximum ) \
360 ((Objects_Maximum) ((maximum) & ~OBJECTS_UNLIMITED_OBJECTS))
361
365#if defined(RTEMS_MULTIPROCESSING)
366extern uint16_t _Objects_Local_node;
367#else
368#define _Objects_Local_node ((uint16_t) 1)
369#endif
370
373#ifdef __cplusplus
374}
375#endif
376
377#endif
378/* end of include file */
This header file provides basic definitions used by the API and the implementation.
Objects_APIs
Definition: object.h:195
#define OBJECTS_NODE_START_BIT
Definition: object.h:118
uint32_t Objects_Id
Definition: object.h:101
#define OBJECTS_API_VALID_BITS
Definition: object.h:168
#define OBJECTS_CLASS_VALID_BITS
Definition: object.h:174
#define OBJECTS_INDEX_START_BIT
Definition: object.h:113
#define OBJECTS_API_START_BIT
Definition: object.h:124
#define OBJECTS_INDEX_VALID_BITS
Definition: object.h:156
uint16_t Objects_Maximum
Definition: object.h:107
#define OBJECTS_CLASS_START_BIT
Definition: object.h:130
#define OBJECTS_NODE_VALID_BITS
Definition: object.h:162
#define _Objects_Local_node
The local MPCI node number.
Definition: object.h:368
Definition: object.h:85
const char * name_p
Definition: object.h:87
uint32_t name_u32
Definition: object.h:89