source: rtems/cpukit/score/inline/rtems/score/object.inl @ 95fbca1

4.104.114.84.95
Last change on this file since 95fbca1 was 95fbca1, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 18, 1995 at 9:41:27 PM

+ Added object type field to object id.

+ Added name pointer to Object_Control.

+ Modified Object Open and Close to address name field.

+ Removed name as separate element from Thread and Proxy Control.

  • Property mode set to 100644
File size: 3.5 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, 1990, 1991, 1992, 1993, 1994.
7 *  On-Line Applications Research Corporation (OAR).
8 *  All rights assigned to U.S. Government, 1994.
9 *
10 *  This material may be reproduced by or for the U.S. Government pursuant
11 *  to the copyright license under the clause at DFARS 252.227-7013.  This
12 *  notice must appear in all copies of this file and its derivatives.
13 *
14 *  $Id$
15 */
16
17#ifndef __OBJECTS_inl
18#define __OBJECTS_inl
19
20/*PAGE
21 *
22 *  _Objects_Is_name_valid
23 *
24 */
25
26STATIC INLINE boolean _Objects_Is_name_valid (
27  Objects_Name name
28)
29{
30  return ( name != 0 );
31}
32
33/*PAGE
34 *
35 *  rtems_name_to_characters
36 *
37 */
38
39STATIC INLINE void rtems_name_to_characters(
40  Objects_Name  name,
41  char         *c1,
42  char         *c2,
43  char         *c3,
44  char         *c4
45)
46{
47  *c1 = (name >> 24) & 0xff;
48  *c2 = (name >> 16) & 0xff;
49  *c3 = (name >> 8) & 0xff;
50  *c4 =  name & 0xff;
51}
52
53/*PAGE
54 *
55 *  _Objects_Build_id
56 *
57 */
58
59STATIC INLINE Objects_Id _Objects_Build_id(
60  Objects_Classes  the_class,
61  unsigned32       node,
62  unsigned32       index
63)
64{
65  return ( (the_class << OBJECTS_CLASS_START_BIT) |
66           (node << OBJECTS_NODE_START_BIT)       |
67           (index << OBJECTS_INDEX_START_BIT) );
68}
69
70/*PAGE
71 *
72 *  rtems_get_class
73 */
74 
75STATIC INLINE Objects_Classes rtems_get_class(
76  Objects_Id id
77)
78{
79  return (Objects_Classes)
80    ((id >> OBJECTS_CLASS_START_BIT) & OBJECTS_CLASS_VALID_BITS);
81}
82 
83
84/*PAGE
85 *
86 *  rtems_get_node
87 *
88 */
89
90STATIC INLINE unsigned32 rtems_get_node(
91  Objects_Id id
92)
93{
94  return (id >> OBJECTS_NODE_START_BIT) & OBJECTS_NODE_VALID_BITS;
95}
96
97/*PAGE
98 *
99 *  rtems_get_index
100 *
101 */
102
103STATIC INLINE unsigned32 rtems_get_index(
104  Objects_Id id
105)
106{
107  return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
108}
109
110/*PAGE
111 *
112 *  _Objects_Is_local_node
113 *
114 */
115
116STATIC INLINE boolean _Objects_Is_local_node(
117  unsigned32 node
118)
119{
120  return ( node == _Objects_Local_node );
121}
122
123/*PAGE
124 *
125 *  _Objects_Is_local_id
126 *
127 */
128
129STATIC INLINE boolean _Objects_Is_local_id(
130  Objects_Id id
131)
132{
133  return _Objects_Is_local_node( rtems_get_node(id) );
134}
135
136/*PAGE
137 *
138 *  _Objects_Are_ids_equal
139 *
140 */
141
142STATIC INLINE boolean _Objects_Are_ids_equal(
143  Objects_Id left,
144  Objects_Id right
145)
146{
147  return ( left == right );
148}
149
150/*PAGE
151 *
152 *  _Objects_Allocate
153 *
154 */
155
156STATIC INLINE Objects_Control *_Objects_Allocate(
157  Objects_Information *information
158)
159{
160  return (Objects_Control *) _Chain_Get( &information->Inactive );
161}
162
163/*PAGE
164 *
165 *  _Objects_Free
166 *
167 */
168
169STATIC INLINE void _Objects_Free(
170  Objects_Information *information,
171  Objects_Control     *the_object
172)
173{
174  _Chain_Append( &information->Inactive, &the_object->Node );
175}
176
177/*PAGE
178 *
179 *  _Objects_Open
180 *
181 */
182
183STATIC INLINE void _Objects_Open(
184  Objects_Information *information,
185  Objects_Control     *the_object,
186  Objects_Name         name
187)
188{
189  unsigned32 index;
190
191  index = rtems_get_index( the_object->id );
192  information->local_table[ index ] = the_object;
193  information->name_table[ index ]  = name;
194  the_object->name = &information->name_table[ index ];
195}
196
197/*PAGE
198 *
199 *  _Objects_Close
200 *
201 */
202
203STATIC INLINE void _Objects_Close(
204  Objects_Information  *information,
205  Objects_Control      *the_object
206)
207{
208  unsigned32 index;
209
210  index = rtems_get_index( the_object->id );
211  information->local_table[ index ] = NULL;
212  information->name_table[ index ]  = 0;
213  the_object->name = 0;
214}
215
216#endif
217/* end of include file */
Note: See TracBrowser for help on using the repository browser.