OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [score/] [inline/] [rtems/] [score/] [object.inl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*  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.OARcorp.com/rtems/license.html.
12
 *
13
 *  object.inl,v 1.22 2002/07/01 22:30:12 joel Exp
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
 
29
RTEMS_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
 
51
RTEMS_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
 
67
RTEMS_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
 
84
RTEMS_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
 
100
RTEMS_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
 
116
RTEMS_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
 
134
RTEMS_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
 
151
RTEMS_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
 
168
RTEMS_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
 
186
RTEMS_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
 
206
RTEMS_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
 
227
RTEMS_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
 
254
RTEMS_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
 
283
RTEMS_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
 
305
RTEMS_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 */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.