source: rtems/cpukit/score/inline/rtems/score/object.inl @ d8dbdc0

4.104.114.84.95
Last change on this file since d8dbdc0 was d6154c7, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/29/04 at 16:41:13

2004-03-29 Ralf Corsepius <ralf_corsepius@…>

  • score/include/rtems/debug.h, score/include/rtems/score/bitfield.h, score/include/rtems/score/chain.h, score/include/rtems/score/coremsg.h, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h, score/include/rtems/score/heap.h, score/include/rtems/score/interr.h, score/include/rtems/score/isr.h, score/include/rtems/score/mpci.h, score/include/rtems/score/mppkt.h, score/include/rtems/score/object.h, score/include/rtems/score/objectmp.h, score/include/rtems/score/priority.h, score/include/rtems/score/stack.h, score/include/rtems/score/states.h, score/include/rtems/score/thread.h, score/include/rtems/score/threadmp.h, score/include/rtems/score/threadq.h, score/include/rtems/score/tod.h, score/include/rtems/score/tqdata.h, score/include/rtems/score/userext.h, score/include/rtems/score/watchdog.h, score/include/rtems/score/wkspace.h, score/inline/rtems/score/address.inl, score/inline/rtems/score/coremsg.inl, score/inline/rtems/score/coresem.inl, score/inline/rtems/score/heap.inl, score/inline/rtems/score/isr.inl, score/inline/rtems/score/object.inl, score/inline/rtems/score/priority.inl, score/inline/rtems/score/stack.inl, score/inline/rtems/score/thread.inl, score/inline/rtems/score/tqdata.inl, score/inline/rtems/score/userext.inl, score/inline/rtems/score/wkspace.inl, score/macros/rtems/score/address.inl, score/macros/rtems/score/heap.inl, score/macros/rtems/score/object.inl, score/macros/rtems/score/priority.inl, score/macros/rtems/score/userext.inl: Convert to using c99 fixed size types.
  • Property mode set to 100644
File size: 6.0 KB
Line 
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-2002.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#ifndef __OBJECTS_inl
17#define __OBJECTS_inl
18
19/*PAGE
20 *
21 *  _Objects_Build_id
22 *
23 *  DESCRIPTION:
24 *
25 *  This function builds an object's id from the processor node and index
26 *  values specified.
27 */
28
29RTEMS_INLINE_ROUTINE Objects_Id _Objects_Build_id(
30  Objects_APIs     the_api,
31  uint32_t         the_class,
32  uint32_t         node,
33  uint32_t         index
34)
35{
36  return (( (Objects_Id) the_api )   << OBJECTS_API_START_BIT)   |
37         (( (Objects_Id) the_class ) << OBJECTS_CLASS_START_BIT) |
38         (( (Objects_Id) node )      << OBJECTS_NODE_START_BIT)  |
39         (( (Objects_Id) index )     << OBJECTS_INDEX_START_BIT);
40}
41
42/*PAGE
43 *
44 *  _Objects_Get_API
45 *
46 *  DESCRIPTION:
47 *
48 *  This function returns the API portion of the ID.
49 */
50
51RTEMS_INLINE_ROUTINE Objects_APIs _Objects_Get_API(
52  Objects_Id id
53)
54{
55  return (Objects_APIs) ((id >> OBJECTS_API_START_BIT) & OBJECTS_API_VALID_BITS);
56}
57
58/*PAGE
59 *
60 *  _Objects_Get_class
61 *
62 *  DESCRIPTION:
63 *
64 *  This function returns the class portion of the ID.
65 */
66 
67RTEMS_INLINE_ROUTINE uint32_t   _Objects_Get_class(
68  Objects_Id id
69)
70{
71  return (uint32_t  )
72    ((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS);
73}
74 
75/*PAGE
76 *
77 *  _Objects_Get_node
78 *
79 *  DESCRIPTION:
80 *
81 *  This function returns the node portion of the ID.
82 */
83
84RTEMS_INLINE_ROUTINE uint32_t   _Objects_Get_node(
85  Objects_Id id
86)
87{
88  return (id >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS;
89}
90
91/*PAGE
92 *
93 *  _Objects_Get_index
94 *
95 *  DESCRIPTION:
96 *
97 *  This function returns the index portion of the ID.
98 */
99
100RTEMS_INLINE_ROUTINE uint32_t   _Objects_Get_index(
101  Objects_Id id
102)
103{
104  return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
105}
106
107/*PAGE
108 *
109 *  _Objects_Is_class_valid
110 *
111 *  DESCRIPTION:
112 *
113 *  This function returns TRUE if the class is valid.
114 */
115 
116RTEMS_INLINE_ROUTINE boolean _Objects_Is_class_valid(
117  uint32_t   the_class
118)
119{
120  /* XXX how do we determine this now? */
121  return TRUE; /* the_class && the_class <= OBJECTS_CLASSES_LAST; */
122}
123
124/*PAGE
125 *
126 *  _Objects_Is_local_node
127 *
128 *  DESCRIPTION:
129 *
130 *  This function returns TRUE if the node is of the local object, and
131 *  FALSE otherwise.
132 */
133
134RTEMS_INLINE_ROUTINE boolean _Objects_Is_local_node(
135  uint32_t   node
136)
137{
138  return ( node == _Objects_Local_node );
139}
140
141/*PAGE
142 *
143 *  _Objects_Is_local_id
144 *
145 *  DESCRIPTION:
146 *
147 *  This function returns TRUE if the id is of a local object, and
148 *  FALSE otherwise.
149 */
150
151RTEMS_INLINE_ROUTINE boolean _Objects_Is_local_id(
152  Objects_Id id
153)
154{
155  return _Objects_Is_local_node( _Objects_Get_node(id) );
156}
157
158/*PAGE
159 *
160 *  _Objects_Are_ids_equal
161 *
162 *  DESCRIPTION:
163 *
164 *  This function returns TRUE if left and right are equal,
165 *  and FALSE otherwise.
166 */
167
168RTEMS_INLINE_ROUTINE boolean _Objects_Are_ids_equal(
169  Objects_Id left,
170  Objects_Id right
171)
172{
173  return ( left == right );
174}
175
176/*PAGE
177 *
178 *  _Objects_Get_local_object
179 *
180 *  DESCRIPTION:
181 *
182 *  This function returns a pointer to the local_table object
183 *  referenced by the index.
184 */
185
186RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Get_local_object(
187  Objects_Information *information,
188  uint32_t             index
189)
190{
191  if ( index > information->maximum )
192    return NULL;
193  return information->local_table[ index ];
194}
195
196/*PAGE
197 *
198 *  _Objects_Set_local_object
199 *
200 *  DESCRIPTION:
201 *
202 *  This function sets the pointer to the local_table object
203 *  referenced by the index.
204 */
205
206RTEMS_INLINE_ROUTINE void _Objects_Set_local_object(
207  Objects_Information *information,
208  uint32_t             index,
209  Objects_Control     *the_object
210)
211{
212  if ( index <= information->maximum )
213    information->local_table[ index ] = the_object;
214}
215
216
217/*PAGE
218 *
219 *  _Objects_Get_information
220 *
221 *  DESCRIPTION:
222 *
223 *  This function return the information structure given
224 *  an id of an object.
225 */
226 
227RTEMS_INLINE_ROUTINE Objects_Information *_Objects_Get_information(
228  Objects_Id  id
229)
230{
231  Objects_APIs  the_api;
232  uint32_t      the_class;
233
234
235  the_class = _Objects_Get_class( id );
236
237  if ( !_Objects_Is_class_valid( the_class ) )
238    return NULL;
239
240  the_api = _Objects_Get_API( id );
241  return _Objects_Information_table[ the_api ][ the_class ];
242}
243
244/*PAGE
245 *
246 *  _Objects_Open
247 *
248 *  DESCRIPTION:
249 *
250 *  This function places the_object control pointer and object name
251 *  in the Local Pointer and Local Name Tables, respectively.
252 */
253
254RTEMS_INLINE_ROUTINE void _Objects_Open(
255  Objects_Information *information,
256  Objects_Control     *the_object,
257  Objects_Name         name
258)
259{
260  uint32_t    index;
261
262  index = _Objects_Get_index( the_object->id );
263  _Objects_Set_local_object( information, index, the_object );
264
265  if ( information->is_string )
266    /* _Objects_Copy_name_string( name, the_object->name ); */
267    the_object->name = name;
268  else
269    /* _Objects_Copy_name_raw( name, the_object->name, information->name_length ); */
270    the_object->name = name;
271}
272
273/*PAGE
274 *
275 *  _Objects_Close
276 *
277 *  DESCRIPTION:
278 *
279 *  This function removes the_object control pointer and object name
280 *  in the Local Pointer and Local Name Tables.
281 */
282
283RTEMS_INLINE_ROUTINE void _Objects_Close(
284  Objects_Information  *information,
285  Objects_Control      *the_object
286)
287{
288  uint32_t   index;
289
290  index = _Objects_Get_index( the_object->id );
291  _Objects_Set_local_object( information, index, NULL );
292  /* _Objects_Clear_name( the_object->name, information->name_length ); */
293  the_object->name = 0;
294}
295
296/*PAGE
297 *
298 *  _Objects_Namespace_remove
299 *
300 *  DESCRIPTION:
301 *
302 *  This function removes the_object from the namespace.
303 */
304
305RTEMS_INLINE_ROUTINE void _Objects_Namespace_remove(
306  Objects_Information  *information,
307  Objects_Control      *the_object
308)
309{
310  /* _Objects_Clear_name( the_object->name, information->name_length ); */
311  the_object->name = 0;
312}
313
314#endif
315/* end of include file */
Note: See TracBrowser for help on using the repository browser.