1 | /** |
---|
2 | * @file rtems/score/object.inl |
---|
3 | */ |
---|
4 | |
---|
5 | /* |
---|
6 | * This include file contains the macro implementation of all |
---|
7 | * of the inlined routines in the Object Handler. |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef __OBJECTS_inl |
---|
20 | #define __OBJECTS_inl |
---|
21 | |
---|
22 | /*PAGE |
---|
23 | * |
---|
24 | * _Objects_Build_id |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | #define _Objects_Build_id( _the_api, _the_class, _node, _index ) \ |
---|
29 | ( (( (Objects_Id) _the_api ) << OBJECTS_API_START_BIT) | \ |
---|
30 | (( (Objects_Id) _the_class ) << OBJECTS_CLASS_START_BIT) | \ |
---|
31 | (( (Objects_Id) _node ) << OBJECTS_NODE_START_BIT) | \ |
---|
32 | (( (Objects_Id) _index ) << OBJECTS_INDEX_START_BIT) ) |
---|
33 | |
---|
34 | /*PAGE |
---|
35 | * |
---|
36 | * _Objects_Get_API |
---|
37 | */ |
---|
38 | |
---|
39 | #define _Objects_Get_API( _id ) \ |
---|
40 | (Objects_APIs) \ |
---|
41 | (((_id) >> OBJECTS_API_START_BIT) & OBJECTS_API_VALID_BITS) |
---|
42 | |
---|
43 | /*PAGE |
---|
44 | * |
---|
45 | * _Objects_Get_class |
---|
46 | */ |
---|
47 | |
---|
48 | #define _Objects_Get_class( _id ) \ |
---|
49 | (uint32_t ) \ |
---|
50 | (((_id) >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS) |
---|
51 | |
---|
52 | /*PAGE |
---|
53 | * |
---|
54 | * _Objects_Get_node |
---|
55 | * |
---|
56 | */ |
---|
57 | |
---|
58 | #define _Objects_Get_node( _id ) \ |
---|
59 | (((_id) >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS) |
---|
60 | |
---|
61 | /*PAGE |
---|
62 | * |
---|
63 | * _Objects_Get_index |
---|
64 | * |
---|
65 | */ |
---|
66 | |
---|
67 | #define _Objects_Get_index( _id ) \ |
---|
68 | (((_id) >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS) |
---|
69 | |
---|
70 | /*PAGE |
---|
71 | * |
---|
72 | * _Objects_Is_class_valid |
---|
73 | * |
---|
74 | */ |
---|
75 | |
---|
76 | #define _Objects_Is_class_valid( _the_class ) \ |
---|
77 | ( (_the_class) /* XXX && (_the_class) <= OBJECTS_CLASSES_LAST */ ) |
---|
78 | |
---|
79 | /*PAGE |
---|
80 | * |
---|
81 | * _Objects_Is_local_node |
---|
82 | * |
---|
83 | */ |
---|
84 | |
---|
85 | #if defined(RTEMS_MULTIPROCESSING) |
---|
86 | #define _Objects_Is_local_node( _node ) \ |
---|
87 | ( (_node) == _Objects_Local_node ) |
---|
88 | #endif |
---|
89 | |
---|
90 | /*PAGE |
---|
91 | * |
---|
92 | * _Objects_Is_local_id |
---|
93 | * |
---|
94 | */ |
---|
95 | |
---|
96 | #if defined(RTEMS_MULTIPROCESSING) |
---|
97 | #define _Objects_Is_local_id( _id ) \ |
---|
98 | _Objects_Is_local_node( _Objects_Get_node(_id) ) |
---|
99 | #else |
---|
100 | #define _Objects_Is_local_id( _id ) \ |
---|
101 | TRUE |
---|
102 | #endif |
---|
103 | |
---|
104 | /*PAGE |
---|
105 | * |
---|
106 | * _Objects_Are_ids_equal |
---|
107 | * |
---|
108 | */ |
---|
109 | |
---|
110 | #define _Objects_Are_ids_equal( _left, _right ) \ |
---|
111 | ( (_left) == (_right) ) |
---|
112 | |
---|
113 | /*PAGE |
---|
114 | * |
---|
115 | * _Objects_Get_local_object |
---|
116 | * |
---|
117 | */ |
---|
118 | |
---|
119 | #define _Objects_Get_local_object( _information, _index ) \ |
---|
120 | ( ( (_index) > (_information)->maximum) ? NULL : \ |
---|
121 | (_information)->local_table[ (_index) ] ) |
---|
122 | |
---|
123 | /*PAGE |
---|
124 | * |
---|
125 | * _Objects_Set_local_object |
---|
126 | * |
---|
127 | */ |
---|
128 | |
---|
129 | #define _Objects_Set_local_object( information, index, the_object ) \ |
---|
130 | { \ |
---|
131 | if ( index <= information->maximum) \ |
---|
132 | information->local_table[ index ] = the_object; \ |
---|
133 | } |
---|
134 | |
---|
135 | |
---|
136 | /*PAGE |
---|
137 | * |
---|
138 | * _Objects_Get_information |
---|
139 | * |
---|
140 | */ |
---|
141 | |
---|
142 | #define _Objects_Get_information( id ) \ |
---|
143 | ( \ |
---|
144 | ( !_Objects_Is_class_valid( _Objects_Get_class( id ) ) ) ? \ |
---|
145 | NULL : \ |
---|
146 | _Objects_Information_table[ _Objects_Get_API( id ) ] \ |
---|
147 | [ _Objects_Get_class( id ) ] \ |
---|
148 | ) |
---|
149 | |
---|
150 | /*PAGE |
---|
151 | * |
---|
152 | * _Objects_Open |
---|
153 | * |
---|
154 | */ |
---|
155 | |
---|
156 | #define _Objects_Open( _information, _the_object, _name ) \ |
---|
157 | do { \ |
---|
158 | uint32_t _index; \ |
---|
159 | \ |
---|
160 | _index = _Objects_Get_index( (_the_object)->id ); \ |
---|
161 | (_information)->local_table[ _index ] = (_the_object); \ |
---|
162 | \ |
---|
163 | if ( (_information)->is_string ) \ |
---|
164 | /* _Objects_Copy_name_string( (_name), (_the_object)->name ); */\ |
---|
165 | (_the_object)->name = (_name); \ |
---|
166 | else \ |
---|
167 | /* _Objects_Copy_name_raw( \ |
---|
168 | (_name), (_the_object)->name, (_information)->name_length ); */ \ |
---|
169 | (_the_object)->name = (_name); \ |
---|
170 | } while (0) |
---|
171 | |
---|
172 | /*PAGE |
---|
173 | * |
---|
174 | * _Objects_Close |
---|
175 | * |
---|
176 | */ |
---|
177 | |
---|
178 | #define _Objects_Close( _information, _the_object ) \ |
---|
179 | do { \ |
---|
180 | uint32_t _index; \ |
---|
181 | \ |
---|
182 | _index = _Objects_Get_index( (_the_object)->id ); \ |
---|
183 | (_information)->local_table[ _index ] = (Objects_Control *) NULL; \ |
---|
184 | /* _Objects_Clear_name( (_the_object)->name, (_information)->name_length ); */ \ |
---|
185 | (_the_object)->name = 0; \ |
---|
186 | } while (0) |
---|
187 | |
---|
188 | /*PAGE |
---|
189 | * |
---|
190 | * _Objects_Namespace_remove |
---|
191 | */ |
---|
192 | |
---|
193 | #define _Objects_Namespace_remove( _information, _the_object ) \ |
---|
194 | (_the_object)->name = 0; \ |
---|
195 | /* _Objects_Clear_name( (_the_object)->name, (_information)->name_length ) */ |
---|
196 | |
---|
197 | #endif |
---|
198 | /* end of include file */ |
---|