1 | /* object.inl |
---|
2 | * |
---|
3 | * This include file contains the macro implementation of all |
---|
4 | * of the inlined routines in the Object Handler. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
11 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
12 | * notice must appear in all copies of this file and its derivatives. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __OBJECTS_inl |
---|
18 | #define __OBJECTS_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Objects_Is_name_valid |
---|
23 | * |
---|
24 | */ |
---|
25 | |
---|
26 | #define _Objects_Is_name_valid( _name ) \ |
---|
27 | ( (_name) != 0 ) |
---|
28 | |
---|
29 | /* |
---|
30 | * rtems_name_to_characters |
---|
31 | * |
---|
32 | */ |
---|
33 | |
---|
34 | #define rtems_name_to_characters( _name, _c1, _c2, _c3, _c4 ) \ |
---|
35 | { \ |
---|
36 | (*(_c1) = ((_name) >> 24) & 0xff; \ |
---|
37 | (*(_c2) = ((_name) >> 16) & 0xff; \ |
---|
38 | (*(_c3) = ((_name) >> 8) & 0xff; \ |
---|
39 | (*(_c4) = ((_name)) & 0xff; \ |
---|
40 | } |
---|
41 | |
---|
42 | /*PAGE |
---|
43 | * |
---|
44 | * _Objects_Build_id |
---|
45 | * |
---|
46 | */ |
---|
47 | |
---|
48 | #define _Objects_Build_id( _the_class, _node, _index ) \ |
---|
49 | ( ((_the_class) << OBJECTS_CLASS_START_BIT) | \ |
---|
50 | ((_node) << OBJECTS_NODE_START_BIT) | \ |
---|
51 | ((_index) << OBJECTS_INDEX_START_BIT) ) |
---|
52 | |
---|
53 | /*PAGE |
---|
54 | * |
---|
55 | * rtems_get_class |
---|
56 | */ |
---|
57 | |
---|
58 | #define rtems_get_class( _id ) \ |
---|
59 | (Objects_Classes) \ |
---|
60 | (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS) |
---|
61 | |
---|
62 | /*PAGE |
---|
63 | * |
---|
64 | * rtems_get_node |
---|
65 | * |
---|
66 | */ |
---|
67 | |
---|
68 | #define rtems_get_node( _id ) \ |
---|
69 | (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS) |
---|
70 | |
---|
71 | /*PAGE |
---|
72 | * |
---|
73 | * rtems_get_index |
---|
74 | * |
---|
75 | */ |
---|
76 | |
---|
77 | #define rtems_get_index( _id ) \ |
---|
78 | (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS) |
---|
79 | |
---|
80 | /*PAGE |
---|
81 | * |
---|
82 | * _Objects_Is_local_node |
---|
83 | * |
---|
84 | */ |
---|
85 | |
---|
86 | #define _Objects_Is_local_node( _node ) \ |
---|
87 | ( (_node) == _Objects_Local_node ) |
---|
88 | |
---|
89 | /*PAGE |
---|
90 | * |
---|
91 | * _Objects_Is_local_id |
---|
92 | * |
---|
93 | */ |
---|
94 | |
---|
95 | #define _Objects_Is_local_id( _id ) \ |
---|
96 | _Objects_Is_local_node( rtems_get_node(_id) ) |
---|
97 | |
---|
98 | /*PAGE |
---|
99 | * |
---|
100 | * _Objects_Are_ids_equal |
---|
101 | * |
---|
102 | */ |
---|
103 | |
---|
104 | #define _Objects_Are_ids_equal( _left, _right ) \ |
---|
105 | ( (_left) == (_right) ) |
---|
106 | |
---|
107 | /*PAGE |
---|
108 | * |
---|
109 | * _Objects_Allocate |
---|
110 | * |
---|
111 | */ |
---|
112 | |
---|
113 | #define _Objects_Allocate( _information ) \ |
---|
114 | (Objects_Control *) _Chain_Get( &(_information)->Inactive ) |
---|
115 | |
---|
116 | /*PAGE |
---|
117 | * |
---|
118 | * _Objects_Free |
---|
119 | * |
---|
120 | */ |
---|
121 | |
---|
122 | #define _Objects_Free( _information, _the_object ) \ |
---|
123 | _Chain_Append( &(_information)->Inactive, &(_the_object)->Node ) |
---|
124 | |
---|
125 | /*PAGE |
---|
126 | * |
---|
127 | * _Objects_Open |
---|
128 | * |
---|
129 | */ |
---|
130 | |
---|
131 | #define _Objects_Open( _information, _the_object, _name ) \ |
---|
132 | { \ |
---|
133 | unsigned32 _index; \ |
---|
134 | \ |
---|
135 | _index = rtems_get_index( (_the_object)->id ); \ |
---|
136 | (_information)->local_table[ _index ] = (_the_object); \ |
---|
137 | (_information)->name_table[ _index ] = (_name); \ |
---|
138 | (_the_object)->name = &(_information)->name_table[ _index ]; \ |
---|
139 | } |
---|
140 | |
---|
141 | /*PAGE |
---|
142 | * |
---|
143 | * _Objects_Close |
---|
144 | * |
---|
145 | */ |
---|
146 | |
---|
147 | #define _Objects_Close( _information, _the_object ) \ |
---|
148 | { \ |
---|
149 | unsigned32 _index; \ |
---|
150 | \ |
---|
151 | _index = rtems_get_index( (_the_object)->id ); \ |
---|
152 | (_information)->local_table[ _index ] = NULL; \ |
---|
153 | (_information)->name_table[ _index ] = 0; \ |
---|
154 | (_the_object)->name = 0; \ |
---|
155 | } |
---|
156 | |
---|
157 | #endif |
---|
158 | /* end of include file */ |
---|