source: rtems/c/src/exec/score/inline/rtems/score/object.inl @ 1d9403a

4.104.114.84.95
Last change on this file since 1d9403a was 1d9403a, checked in by Joel Sherrill <joel.sherrill@…>, on 07/06/00 at 19:13:31

Removed unnecessary parentheses.

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