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

4.104.114.84.95
Last change on this file since dd687d9 was dd687d9, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 6:56:05 PM

2003-09-04 Joel Sherrill <joel@…>

  • include/rtems/debug.h, include/rtems/seterr.h, include/rtems/system.h, include/rtems/score/address.h, include/rtems/score/apiext.h, include/rtems/score/apimutex.h, include/rtems/score/bitfield.h, include/rtems/score/chain.h, include/rtems/score/context.h, include/rtems/score/copyrt.h, include/rtems/score/coremsg.h, include/rtems/score/coremutex.h, include/rtems/score/coresem.h, include/rtems/score/heap.h, include/rtems/score/interr.h, include/rtems/score/isr.h, include/rtems/score/mpci.h, include/rtems/score/mppkt.h, include/rtems/score/object.h, include/rtems/score/objectmp.h, include/rtems/score/priority.h, include/rtems/score/stack.h, include/rtems/score/states.h, include/rtems/score/sysstate.h, include/rtems/score/thread.h, include/rtems/score/threadmp.h, include/rtems/score/threadq.h, include/rtems/score/tod.h, include/rtems/score/tqdata.h, include/rtems/score/userext.h, include/rtems/score/watchdog.h, include/rtems/score/wkspace.h, inline/rtems/score/address.inl, inline/rtems/score/chain.inl, inline/rtems/score/coremsg.inl, inline/rtems/score/coremutex.inl, inline/rtems/score/coresem.inl, inline/rtems/score/heap.inl, inline/rtems/score/isr.inl, inline/rtems/score/mppkt.inl, inline/rtems/score/object.inl, inline/rtems/score/objectmp.inl, inline/rtems/score/priority.inl, inline/rtems/score/stack.inl, inline/rtems/score/states.inl, inline/rtems/score/sysstate.inl, inline/rtems/score/thread.inl, inline/rtems/score/threadmp.inl, inline/rtems/score/tod.inl, inline/rtems/score/tqdata.inl, inline/rtems/score/userext.inl, inline/rtems/score/watchdog.inl, inline/rtems/score/wkspace.inl, macros/rtems/score/address.inl, macros/rtems/score/chain.inl, macros/rtems/score/coremsg.inl, macros/rtems/score/coremutex.inl, macros/rtems/score/coresem.inl, macros/rtems/score/heap.inl, macros/rtems/score/isr.inl, macros/rtems/score/mppkt.inl, macros/rtems/score/object.inl, macros/rtems/score/objectmp.inl, macros/rtems/score/priority.inl, macros/rtems/score/stack.inl, macros/rtems/score/states.inl, macros/rtems/score/sysstate.inl, macros/rtems/score/thread.inl, macros/rtems/score/threadmp.inl, macros/rtems/score/tod.inl, macros/rtems/score/tqdata.inl, macros/rtems/score/userext.inl, macros/rtems/score/watchdog.inl, macros/rtems/score/wkspace.inl, src/apiext.c, src/chain.c, src/coremsg.c, src/coremsgbroadcast.c, src/coremsgclose.c, src/coremsgflush.c, src/coremsgflushsupp.c, src/coremsgflushwait.c, src/coremsginsert.c, src/coremsgseize.c, src/coremsgsubmit.c, src/coremutex.c, src/coremutexflush.c, src/coremutexseize.c, src/coremutexsurrender.c, src/coresem.c, src/coresemflush.c, src/coresemseize.c, src/coresemsurrender.c, src/coretod.c, src/coretodset.c, src/coretodtickle.c, src/coretodtoseconds.c, src/coretodvalidate.c, src/heap.c, src/heapallocate.c, src/heapextend.c, src/heapfree.c, src/heapgetinfo.c, src/heapsizeofuserarea.c, src/heapwalk.c, src/interr.c, src/isr.c, src/iterateoverthreads.c, src/mpci.c, src/object.c, src/objectallocate.c, src/objectallocatebyindex.c, src/objectclearname.c, src/objectcomparenameraw.c, src/objectcomparenamestring.c, src/objectcopynameraw.c, src/objectcopynamestring.c, src/objectextendinformation.c, src/objectfree.c, src/objectget.c, src/objectgetbyindex.c, src/objectgetisr.c, src/objectgetnext.c, src/objectgetnoprotection.c, src/objectidtoname.c, src/objectinitializeinformation.c, src/objectmp.c, src/objectnametoid.c, src/objectshrinkinformation.c, src/thread.c, src/threadchangepriority.c, src/threadclearstate.c, src/threadclose.c, src/threadcreateidle.c, src/threaddelayended.c, src/threaddispatch.c, src/threadevaluatemode.c, src/threadget.c, src/threadhandler.c, src/threadidlebody.c, src/threadinitialize.c, src/threadloadenv.c, src/threadmp.c, src/threadq.c, src/threadqdequeue.c, src/threadqdequeuefifo.c, src/threadqdequeuepriority.c, src/threadqenqueue.c, src/threadqenqueuefifo.c, src/threadqenqueuepriority.c, src/threadqextract.c, src/threadqextractfifo.c, src/threadqextractpriority.c, src/threadqextractwithproxy.c, src/threadqfirst.c, src/threadqfirstfifo.c, src/threadqfirstpriority.c, src/threadqflush.c, src/threadqtimeout.c, src/threadready.c, src/threadreset.c, src/threadresettimeslice.c, src/threadrestart.c, src/threadresume.c, src/threadrotatequeue.c, src/threadsetpriority.c, src/threadsetstate.c, src/threadsettransient.c, src/threadstackallocate.c, src/threadstackfree.c, src/threadstart.c, src/threadstartmultitasking.c, src/threadsuspend.c, src/threadtickletimeslice.c, src/threadyieldprocessor.c, src/userext.c, src/watchdog.c, src/watchdogadjust.c, src/watchdoginsert.c, src/watchdogremove.c, src/watchdogtickle.c, src/wkspace.c: URL for license changed.
  • 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  unsigned32       the_class,
32  unsigned32       node,
33  unsigned32       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 unsigned32 _Objects_Get_class(
68  Objects_Id id
69)
70{
71  return (unsigned32)
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 unsigned32 _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 unsigned32 _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  unsigned32 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  unsigned32 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  unsigned32           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  unsigned32           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  unsigned32    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  unsigned32  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  unsigned32 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.