1 | /* object.inl |
---|
2 | * |
---|
3 | * This include file contains the static inline implementation of all |
---|
4 | * of the inlined routines in the Object Handler. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1998. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __OBJECTS_inl |
---|
18 | #define __OBJECTS_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _Objects_Build_id |
---|
23 | * |
---|
24 | * DESCRIPTION: |
---|
25 | * |
---|
26 | * This function builds an object's id from the processor node and index |
---|
27 | * values specified. |
---|
28 | */ |
---|
29 | |
---|
30 | RTEMS_INLINE_ROUTINE Objects_Id _Objects_Build_id( |
---|
31 | Objects_Classes the_class, |
---|
32 | unsigned32 node, |
---|
33 | unsigned32 index |
---|
34 | ) |
---|
35 | { |
---|
36 | return ( (the_class << OBJECTS_CLASS_START_BIT) | |
---|
37 | (node << OBJECTS_NODE_START_BIT) | |
---|
38 | (index << OBJECTS_INDEX_START_BIT) ); |
---|
39 | } |
---|
40 | |
---|
41 | /*PAGE |
---|
42 | * |
---|
43 | * _Objects_Get_class |
---|
44 | * |
---|
45 | * DESCRIPTION: |
---|
46 | * |
---|
47 | * This function returns the class portion of the ID. |
---|
48 | */ |
---|
49 | |
---|
50 | RTEMS_INLINE_ROUTINE Objects_Classes _Objects_Get_class( |
---|
51 | Objects_Id id |
---|
52 | ) |
---|
53 | { |
---|
54 | return (Objects_Classes) |
---|
55 | ((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS); |
---|
56 | } |
---|
57 | |
---|
58 | |
---|
59 | /*PAGE |
---|
60 | * |
---|
61 | * _Objects_Get_node |
---|
62 | * |
---|
63 | * DESCRIPTION: |
---|
64 | * |
---|
65 | * This function returns the node portion of the ID. |
---|
66 | */ |
---|
67 | |
---|
68 | RTEMS_INLINE_ROUTINE unsigned32 _Objects_Get_node( |
---|
69 | Objects_Id id |
---|
70 | ) |
---|
71 | { |
---|
72 | return (id >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS; |
---|
73 | } |
---|
74 | |
---|
75 | /*PAGE |
---|
76 | * |
---|
77 | * _Objects_Get_index |
---|
78 | * |
---|
79 | * DESCRIPTION: |
---|
80 | * |
---|
81 | * This function returns the index portion of the ID. |
---|
82 | */ |
---|
83 | |
---|
84 | RTEMS_INLINE_ROUTINE unsigned32 _Objects_Get_index( |
---|
85 | Objects_Id id |
---|
86 | ) |
---|
87 | { |
---|
88 | return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS; |
---|
89 | } |
---|
90 | |
---|
91 | /*PAGE |
---|
92 | * |
---|
93 | * _Objects_Is_class_valid |
---|
94 | * |
---|
95 | * DESCRIPTION: |
---|
96 | * |
---|
97 | * This function returns TRUE if the class is valid. |
---|
98 | */ |
---|
99 | |
---|
100 | RTEMS_INLINE_ROUTINE boolean _Objects_Is_class_valid( |
---|
101 | Objects_Classes the_class |
---|
102 | ) |
---|
103 | { |
---|
104 | return the_class <= OBJECTS_CLASSES_LAST; |
---|
105 | } |
---|
106 | |
---|
107 | /*PAGE |
---|
108 | * |
---|
109 | * _Objects_Is_local_node |
---|
110 | * |
---|
111 | * DESCRIPTION: |
---|
112 | * |
---|
113 | * This function returns TRUE if the node is of the local object, and |
---|
114 | * FALSE otherwise. |
---|
115 | */ |
---|
116 | |
---|
117 | RTEMS_INLINE_ROUTINE boolean _Objects_Is_local_node( |
---|
118 | unsigned32 node |
---|
119 | ) |
---|
120 | { |
---|
121 | return ( node == _Objects_Local_node ); |
---|
122 | } |
---|
123 | |
---|
124 | /*PAGE |
---|
125 | * |
---|
126 | * _Objects_Is_local_id |
---|
127 | * |
---|
128 | * DESCRIPTION: |
---|
129 | * |
---|
130 | * This function returns TRUE if the id is of a local object, and |
---|
131 | * FALSE otherwise. |
---|
132 | */ |
---|
133 | |
---|
134 | RTEMS_INLINE_ROUTINE boolean _Objects_Is_local_id( |
---|
135 | Objects_Id id |
---|
136 | ) |
---|
137 | { |
---|
138 | return _Objects_Is_local_node( _Objects_Get_node(id) ); |
---|
139 | } |
---|
140 | |
---|
141 | /*PAGE |
---|
142 | * |
---|
143 | * _Objects_Are_ids_equal |
---|
144 | * |
---|
145 | * DESCRIPTION: |
---|
146 | * |
---|
147 | * This function returns TRUE if left and right are equal, |
---|
148 | * and FALSE otherwise. |
---|
149 | */ |
---|
150 | |
---|
151 | RTEMS_INLINE_ROUTINE boolean _Objects_Are_ids_equal( |
---|
152 | Objects_Id left, |
---|
153 | Objects_Id right |
---|
154 | ) |
---|
155 | { |
---|
156 | return ( left == right ); |
---|
157 | } |
---|
158 | |
---|
159 | /*PAGE |
---|
160 | * |
---|
161 | * _Objects_Allocate |
---|
162 | * |
---|
163 | * DESCRIPTION: |
---|
164 | * |
---|
165 | * This function allocates a object control block from |
---|
166 | * the inactive chain of free object control blocks. |
---|
167 | */ |
---|
168 | |
---|
169 | RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Allocate( |
---|
170 | Objects_Information *information |
---|
171 | ) |
---|
172 | { |
---|
173 | return (Objects_Control *) _Chain_Get( &information->Inactive ); |
---|
174 | } |
---|
175 | |
---|
176 | /*PAGE |
---|
177 | * |
---|
178 | * _Objects_Free |
---|
179 | * |
---|
180 | * DESCRIPTION: |
---|
181 | * |
---|
182 | * This function frees a object control block to the |
---|
183 | * inactive chain of free object control blocks. |
---|
184 | */ |
---|
185 | |
---|
186 | RTEMS_INLINE_ROUTINE void _Objects_Free( |
---|
187 | Objects_Information *information, |
---|
188 | Objects_Control *the_object |
---|
189 | ) |
---|
190 | { |
---|
191 | _Chain_Append( &information->Inactive, &the_object->Node ); |
---|
192 | } |
---|
193 | |
---|
194 | /*PAGE |
---|
195 | * |
---|
196 | * _Objects_Open |
---|
197 | * |
---|
198 | * DESCRIPTION: |
---|
199 | * |
---|
200 | * This function places the_object control pointer and object name |
---|
201 | * in the Local Pointer and Local Name Tables, respectively. |
---|
202 | */ |
---|
203 | |
---|
204 | RTEMS_INLINE_ROUTINE void _Objects_Open( |
---|
205 | Objects_Information *information, |
---|
206 | Objects_Control *the_object, |
---|
207 | Objects_Name name |
---|
208 | ) |
---|
209 | { |
---|
210 | unsigned32 index; |
---|
211 | |
---|
212 | index = _Objects_Get_index( the_object->id ); |
---|
213 | information->local_table[ index ] = the_object; |
---|
214 | |
---|
215 | if ( information->is_string ) |
---|
216 | _Objects_Copy_name_string( name, the_object->name ); |
---|
217 | else |
---|
218 | _Objects_Copy_name_raw( name, the_object->name, information->name_length ); |
---|
219 | } |
---|
220 | |
---|
221 | /*PAGE |
---|
222 | * |
---|
223 | * _Objects_Close |
---|
224 | * |
---|
225 | * DESCRIPTION: |
---|
226 | * |
---|
227 | * This function removes the_object control pointer and object name |
---|
228 | * in the Local Pointer and Local Name Tables. |
---|
229 | */ |
---|
230 | |
---|
231 | RTEMS_INLINE_ROUTINE void _Objects_Close( |
---|
232 | Objects_Information *information, |
---|
233 | Objects_Control *the_object |
---|
234 | ) |
---|
235 | { |
---|
236 | unsigned32 index; |
---|
237 | |
---|
238 | index = _Objects_Get_index( the_object->id ); |
---|
239 | information->local_table[ index ] = (Objects_Control *) NULL; |
---|
240 | _Objects_Clear_name( the_object->name, information->name_length ); |
---|
241 | } |
---|
242 | |
---|
243 | #endif |
---|
244 | /* end of include file */ |
---|