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

4.104.114.84.95
Last change on this file since af10d3ef was af10d3ef, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 2, 1999 at 3:57:43 PM

Corrected spacing.

  • Property mode set to 100644
File size: 5.1 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-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
30RTEMS_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 
50RTEMS_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
68RTEMS_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
84RTEMS_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 
100RTEMS_INLINE_ROUTINE boolean _Objects_Is_class_valid(
101  Objects_Classes the_class
102)
103{
104  return the_class && 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
117RTEMS_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
134RTEMS_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
151RTEMS_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_Get_local_object
162 *
163 *  DESCRIPTION:
164 *
165 *  This function returns a pointer to the local_table object
166 *  referenced by the index.
167 */
168
169RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Get_local_object(
170  Objects_Information *information,
171  unsigned32           index
172)
173{
174  if ( index > information->maximum )
175    return NULL;
176  return ( information->local_table[ index ] );
177}
178
179/*PAGE
180 *
181 *  _Objects_Set_local_object
182 *
183 *  DESCRIPTION:
184 *
185 *  This function sets the pointer to the local_table object
186 *  referenced by the index.
187 */
188
189RTEMS_INLINE_ROUTINE void _Objects_Set_local_object(
190  Objects_Information *information,
191  unsigned32           index,
192  Objects_Control     *the_object
193)
194{
195  if ( index <= information->maximum )
196    information->local_table[ index ] = the_object;
197}
198
199
200/*PAGE
201 *
202 *  _Objects_Get_information
203 *
204 *  DESCRIPTION:
205 *
206 *  This function return the information structure given
207 *  an id of an object.
208 */
209 
210RTEMS_INLINE_ROUTINE Objects_Information *_Objects_Get_information(
211  Objects_Id  id
212)
213{
214  Objects_Classes  the_class;
215
216  the_class = _Objects_Get_class( id );
217
218  if ( !_Objects_Is_class_valid( the_class ) )
219    return NULL;
220
221  return _Objects_Information_table[ the_class ];
222}
223
224/*PAGE
225 *
226 *  _Objects_Open
227 *
228 *  DESCRIPTION:
229 *
230 *  This function places the_object control pointer and object name
231 *  in the Local Pointer and Local Name Tables, respectively.
232 */
233
234RTEMS_INLINE_ROUTINE void _Objects_Open(
235  Objects_Information *information,
236  Objects_Control     *the_object,
237  Objects_Name         name
238)
239{
240  unsigned32  index;
241
242  index = _Objects_Get_index( the_object->id );
243  _Objects_Set_local_object( information, index, the_object );
244
245  if ( information->is_string )
246    _Objects_Copy_name_string( name, the_object->name );
247  else
248    _Objects_Copy_name_raw( name, the_object->name, information->name_length );
249}
250
251/*PAGE
252 *
253 *  _Objects_Close
254 *
255 *  DESCRIPTION:
256 *
257 *  This function removes the_object control pointer and object name
258 *  in the Local Pointer and Local Name Tables.
259 */
260
261RTEMS_INLINE_ROUTINE void _Objects_Close(
262  Objects_Information  *information,
263  Objects_Control      *the_object
264)
265{
266  unsigned32 index;
267
268  index = _Objects_Get_index( the_object->id );
269  _Objects_Set_local_object( information, index, NULL );
270  _Objects_Clear_name( the_object->name, information->name_length );
271}
272
273#endif
274/* end of include file */
Note: See TracBrowser for help on using the repository browser.