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, 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 | STATIC INLINE boolean _Objects_Is_name_valid ( |
---|
27 | Objects_Name name |
---|
28 | ) |
---|
29 | { |
---|
30 | return ( name != 0 ); |
---|
31 | } |
---|
32 | |
---|
33 | /*PAGE |
---|
34 | * |
---|
35 | * rtems_name_to_characters |
---|
36 | * |
---|
37 | */ |
---|
38 | |
---|
39 | STATIC INLINE void rtems_name_to_characters( |
---|
40 | Objects_Name name, |
---|
41 | char *c1, |
---|
42 | char *c2, |
---|
43 | char *c3, |
---|
44 | char *c4 |
---|
45 | ) |
---|
46 | { |
---|
47 | *c1 = (name >> 24) & 0xff; |
---|
48 | *c2 = (name >> 16) & 0xff; |
---|
49 | *c3 = (name >> 8) & 0xff; |
---|
50 | *c4 = name & 0xff; |
---|
51 | } |
---|
52 | |
---|
53 | /*PAGE |
---|
54 | * |
---|
55 | * _Objects_Build_id |
---|
56 | * |
---|
57 | */ |
---|
58 | |
---|
59 | STATIC INLINE Objects_Id _Objects_Build_id( |
---|
60 | unsigned32 node, |
---|
61 | unsigned32 index |
---|
62 | ) |
---|
63 | { |
---|
64 | return ( (node << 16) | index ); |
---|
65 | } |
---|
66 | |
---|
67 | /*PAGE |
---|
68 | * |
---|
69 | * rtems_get_node |
---|
70 | * |
---|
71 | */ |
---|
72 | |
---|
73 | STATIC INLINE unsigned32 rtems_get_node( |
---|
74 | Objects_Id id |
---|
75 | ) |
---|
76 | { |
---|
77 | return (id >> 16); |
---|
78 | } |
---|
79 | |
---|
80 | /*PAGE |
---|
81 | * |
---|
82 | * rtems_get_index |
---|
83 | * |
---|
84 | */ |
---|
85 | |
---|
86 | STATIC INLINE unsigned32 rtems_get_index( |
---|
87 | Objects_Id id |
---|
88 | ) |
---|
89 | { |
---|
90 | return (id &0xFFFF); |
---|
91 | } |
---|
92 | |
---|
93 | /*PAGE |
---|
94 | * |
---|
95 | * _Objects_Is_local_node |
---|
96 | * |
---|
97 | */ |
---|
98 | |
---|
99 | STATIC INLINE boolean _Objects_Is_local_node( |
---|
100 | unsigned32 node |
---|
101 | ) |
---|
102 | { |
---|
103 | return ( node == _Objects_Local_node ); |
---|
104 | } |
---|
105 | |
---|
106 | /*PAGE |
---|
107 | * |
---|
108 | * _Objects_Is_local_id |
---|
109 | * |
---|
110 | */ |
---|
111 | |
---|
112 | STATIC INLINE boolean _Objects_Is_local_id( |
---|
113 | Objects_Id id |
---|
114 | ) |
---|
115 | { |
---|
116 | return _Objects_Is_local_node( rtems_get_node(id) ); |
---|
117 | } |
---|
118 | |
---|
119 | /*PAGE |
---|
120 | * |
---|
121 | * _Objects_Are_ids_equal |
---|
122 | * |
---|
123 | */ |
---|
124 | |
---|
125 | STATIC INLINE boolean _Objects_Are_ids_equal( |
---|
126 | Objects_Id left, |
---|
127 | Objects_Id right |
---|
128 | ) |
---|
129 | { |
---|
130 | return ( left == right ); |
---|
131 | } |
---|
132 | |
---|
133 | /*PAGE |
---|
134 | * |
---|
135 | * _Objects_Allocate |
---|
136 | * |
---|
137 | */ |
---|
138 | |
---|
139 | STATIC INLINE Objects_Control *_Objects_Allocate( |
---|
140 | Objects_Information *information |
---|
141 | ) |
---|
142 | { |
---|
143 | return (Objects_Control *) _Chain_Get( &information->Inactive ); |
---|
144 | } |
---|
145 | |
---|
146 | /*PAGE |
---|
147 | * |
---|
148 | * _Objects_Free |
---|
149 | * |
---|
150 | */ |
---|
151 | |
---|
152 | STATIC INLINE void _Objects_Free( |
---|
153 | Objects_Information *information, |
---|
154 | Objects_Control *the_object |
---|
155 | ) |
---|
156 | { |
---|
157 | _Chain_Append( &information->Inactive, &the_object->Node ); |
---|
158 | } |
---|
159 | |
---|
160 | /*PAGE |
---|
161 | * |
---|
162 | * _Objects_Open |
---|
163 | * |
---|
164 | */ |
---|
165 | |
---|
166 | STATIC INLINE void _Objects_Open( |
---|
167 | Objects_Information *information, |
---|
168 | Objects_Control *the_object, |
---|
169 | Objects_Name name |
---|
170 | ) |
---|
171 | { |
---|
172 | unsigned32 index; |
---|
173 | |
---|
174 | index = rtems_get_index( the_object->id ); |
---|
175 | information->local_table[ index ] = the_object; |
---|
176 | information->name_table[ index ] = name; |
---|
177 | } |
---|
178 | |
---|
179 | /*PAGE |
---|
180 | * |
---|
181 | * _Objects_Close |
---|
182 | * |
---|
183 | */ |
---|
184 | |
---|
185 | STATIC INLINE void _Objects_Close( |
---|
186 | Objects_Information *information, |
---|
187 | Objects_Control *the_object |
---|
188 | ) |
---|
189 | { |
---|
190 | unsigned32 index; |
---|
191 | |
---|
192 | index = rtems_get_index( the_object->id ); |
---|
193 | information->local_table[ index ] = NULL; |
---|
194 | information->name_table[ index ] = 0; |
---|
195 | } |
---|
196 | |
---|
197 | #endif |
---|
198 | /* end of include file */ |
---|