source: rtems/cpukit/score/inline/rtems/score/object.inl @ 7e4c3d8b

4.104.114.84.95
Last change on this file since 7e4c3d8b was 7e4c3d8b, checked in by Joel Sherrill <joel.sherrill@…>, on 06/18/98 at 18:58:42

Modified _Objects_Is_class_valid() to correctly report that 0 was
not a valid object class. This was discovered while looking for
a bug reported by Jennifer.

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