source: rtems/cpukit/score/include/rtems/score/object.h @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on May 11, 1995 at 5:39:37 PM

Initial revision

  • Property mode set to 100644
File size: 8.1 KB
Line 
1/*  object.h
2 *
3 *  This include file contains all the constants and structures associated
4 *  with the RTEMS Object Handler.  This Handler provides mechanisms which
5 *  can be used to initialize and manipulate all RTEMS objects.
6 *
7 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
8 *  On-Line Applications Research Corporation (OAR).
9 *  All rights assigned to U.S. Government, 1994.
10 *
11 *  This material may be reproduced by or for the U.S. Government pursuant
12 *  to the copyright license under the clause at DFARS 252.227-7013.  This
13 *  notice must appear in all copies of this file and its derivatives.
14 *
15 *  $Id$
16 */
17
18#ifndef __RTEMS_OBJECTS_h
19#define __RTEMS_OBJECTS_h
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include <rtems/chain.h>
26
27/*
28 *  The following type defines the control block used to manage
29 *  object names.
30 */
31
32typedef unsigned32 Objects_Name;
33
34/*
35 *  The following type defines the control block used to manage
36 *  object IDs.
37 */
38
39typedef unsigned32 Objects_Id;
40
41/*
42 *  This enumerated type lists the locations which may be returned
43 *  by _Objects_Get.  These codes indicate the success of locating
44 *  an object with the specified ID.
45 */
46
47typedef enum {
48  OBJECTS_LOCAL  = 0,         /* object is local */
49  OBJECTS_REMOTE = 1,         /* object is remote */
50  OBJECTS_ERROR  = 2          /* id was invalid */
51}  Objects_Locations;
52
53/*
54 *  The following defines the Object Control Block used to manage
55 *  each object local to this node.
56 */
57
58typedef struct {
59  Chain_Node Node;
60  Objects_Id id;
61}   Objects_Control;
62
63/*
64 *  The following defines the structure for the information used to
65 *  manage each class of objects.
66 */
67
68typedef struct {
69  Objects_Id        minimum_id;      /* minimum valid id of this type */
70  Objects_Id        maximum_id;      /* maximum valid id of this type */
71  unsigned32        maximum;         /* maximum number of objects */
72  Objects_Control **local_table;     /* table of local object pointers */
73  Objects_Name     *name_table;      /* table of local object names */
74  Chain_Control    *global_table;    /* pointer to global table */
75  Chain_Control     Inactive;        /* chain of inactive ctl blocks */
76}   Objects_Information;
77
78/*
79 *  The following defines the data storage which contains the
80 *  node number of the local node.
81 */
82
83EXTERN unsigned32  _Objects_Local_node;
84
85/*
86 *  The following defines the constant which may be used
87 *  with _Objects_Get to manipulate the calling task.
88 *
89 */
90
91#define OBJECTS_ID_OF_SELF 0
92
93/*
94 *  The following define the constants which may be used in name searches.
95 */
96
97#define RTEMS_SEARCH_ALL_NODES   0
98#define RTEMS_SEARCH_OTHER_NODES 0x7FFFFFFE
99#define RTEMS_SEARCH_LOCAL_NODE  0x7FFFFFFF
100#define RTEMS_WHO_AM_I           0
101
102/*
103 *  _Objects_Handler_initialization
104 *
105 *  DESCRIPTION:
106 *
107 *  This function performs the initialization necessary for this handler.
108 *
109 */
110
111void _Objects_Handler_initialization(
112  unsigned32 node,
113  unsigned32 maximum_global_objects
114);
115
116/*
117 *  _Objects_Initialize_information
118 *
119 *  DESCRIPTION:
120 *
121 *  This function initializes an object class information record.
122 *  SUPPORTS_GLOBAL is TRUE if the object class supports global
123 *  objects, and FALSE otherwise.  Maximum indicates the number
124 *  of objects required in this class and size indicates the size
125 *  in bytes of each control block for this object class.
126 *
127 */
128
129void _Objects_Initialize_information (
130  Objects_Information *information,
131  boolean              supports_global,
132  unsigned32           maximum,
133  unsigned32           size
134);
135
136/*
137 *  _Objects_Name_to_id
138 *
139 *  DESCRIPTION:
140 *
141 *  This function implements the common portion of the object
142 *  identification directives.  This directive returns the object
143 *  id associated with name.  If more than one object of this class
144 *  is named name, then the object to which the id belongs is
145 *  arbitrary.  Node indicates the extent of the search for the
146 *  id of the object named name.  If the object class supports global
147 *  objects, then the search can be limited to a particular node
148 *  or allowed to encompass all nodes.
149 *
150 */
151
152rtems_status_code _Objects_Name_to_id(
153  Objects_Information *information,
154  Objects_Name         name,
155  unsigned32           node,
156  Objects_Id          *id
157);
158
159/*
160 *  _Objects_Get
161 *
162 *  DESCRIPTION:
163 *
164 *  This function maps object ids to object control blocks.
165 *  If id corresponds to a local object, then it returns
166 *  the_object control pointer which maps to id and location
167 *  is set to OBJECTS_LOCAL.  If the object class supports global
168 *  objects and the object id is global and resides on a remote
169 *  node, then location is set to OBJECTS_REMOTE, and the_object
170 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
171 *  and the_object is undefined.
172 *
173 */
174
175Objects_Control *_Objects_Get (
176  Objects_Information *information,
177  Objects_Id           id,
178  Objects_Locations   *location
179);
180
181/*
182 *  _Objects_Is_name_valid
183 *
184 *  DESCRIPTION:
185 *
186 *  This function returns TRUE if the name is valid, and FALSE otherwise.
187 */
188
189STATIC INLINE boolean _Objects_Is_name_valid (
190  Objects_Name name
191);
192
193/*
194 *  rtems_build_name
195 *
196 *  DESCRIPTION:
197 *
198 *  This function returns an object name composed of the four characters
199 *  C1, C2, C3, and C4.
200 *
201 *  NOTE:
202 *
203 *  This must be implemented as a macro for use in Configuration Tables.
204 *
205 */
206
207#define rtems_build_name( _C1, _C2, _C3, _C4 ) \
208  ( (_C1) << 24 | (_C2) << 16 | (_C3) << 8 | (_C4) )
209
210/*
211 *  rtems_name_to_characters
212 *
213 *  DESCRIPTION:
214 *
215 *  This function breaks the object name into the four component
216 *  characters C1, C2, C3, and C4.
217 *
218 */
219
220STATIC INLINE void rtems_name_to_characters(
221  Objects_Name  name,
222  char         *c1,
223  char         *c2,
224  char         *c3,
225  char         *c4
226);
227
228/*
229 *  _Objects_Build_id
230 *
231 *  DESCRIPTION:
232 *
233 *  This function builds an object's id from the processor node and index
234 *  values specified.
235 *
236 */
237
238STATIC INLINE Objects_Id _Objects_Build_id(
239  unsigned32 node,
240  unsigned32 index
241);
242
243/*
244 *  rtems_get_node
245 *
246 *  DESCRIPTION:
247 *
248 *  This function returns the node portion of the ID.
249 *
250 */
251
252STATIC INLINE unsigned32 rtems_get_node(
253  Objects_Id id
254);
255
256/*
257 *  rtems_get_index
258 *
259 *  DESCRIPTION:
260 *
261 *  This function returns the index portion of the ID.
262 *
263 */
264
265STATIC INLINE unsigned32 rtems_get_index(
266  Objects_Id id
267);
268
269/*
270 *  _Objects_Is_local_node
271 *
272 *  DESCRIPTION:
273 *
274 *  This function returns TRUE if the node is of the local object, and
275 *  FALSE otherwise.
276 *
277 */
278
279STATIC INLINE boolean _Objects_Is_local_node(
280  unsigned32 node
281);
282
283/*
284 *  _Objects_Is_local_id
285 *
286 *  DESCRIPTION:
287 *
288 *  This function returns TRUE if the id is of a local object, and
289 *  FALSE otherwise.
290 *
291 */
292
293STATIC INLINE boolean _Objects_Is_local_id(
294  Objects_Id id
295);
296
297/*
298 *  _Objects_Are_ids_equal
299 *
300 *  DESCRIPTION:
301 *
302 *  This function returns TRUE if left and right are equal,
303 *  and FALSE otherwise.
304 *
305 */
306
307STATIC INLINE boolean _Objects_Are_ids_equal(
308  Objects_Id left,
309  Objects_Id right
310);
311
312/*
313 *  _Objects_Allocate
314 *
315 *  DESCRIPTION:
316 *
317 *  This function allocates a object control block from
318 *  the inactive chain of free object control blocks.
319 *
320 */
321
322STATIC INLINE Objects_Control *_Objects_Allocate(
323  Objects_Information *information
324);
325
326/*
327 *  _Objects_Free
328 *
329 *  DESCRIPTION:
330 *
331 *  This function frees a object control block to the
332 *  inactive chain of free object control blocks.
333 *
334 */
335
336STATIC INLINE void _Objects_Free(
337  Objects_Information *information,
338  Objects_Control     *the_object
339);
340
341/*
342 *  _Objects_Open
343 *
344 *  DESCRIPTION:
345 *
346 *  This function places the_object control pointer and object name
347 *  in the Local Pointer and Local Name Tables, respectively.
348 *
349 */
350
351STATIC INLINE void _Objects_Open(
352  Objects_Information *information,
353  Objects_Control     *the_object,
354  Objects_Name         name
355);
356
357/*
358 *  _Objects_Close
359 *
360 *  DESCRIPTION:
361 *
362 *  This function removes the_object control pointer and object name
363 *  in the Local Pointer and Local Name Tables.
364 *
365 */
366
367STATIC INLINE void _Objects_Close(
368  Objects_Information *information,
369  Objects_Control     *the_object
370);
371
372#include <rtems/object.inl>
373#include <rtems/objectmp.h>
374
375#ifdef __cplusplus
376}
377#endif
378
379#endif
380/* end of include file */
Note: See TracBrowser for help on using the repository browser.