source: rtems/c/src/exec/score/headers/object.h @ b06e68ef

4.104.114.84.95
Last change on this file since b06e68ef was b06e68ef, checked in by Joel Sherrill <joel.sherrill@…>, on 08/17/95 at 19:51:51

Numerous miscellaneous features incorporated from Tony Bennett
(tbennett@…) including the following major additions:

+ variable length messages
+ named devices
+ debug monitor
+ association tables/variables

  • Property mode set to 100644
File size: 8.8 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 * Parameters and return id's for _Objects_Get_next
104 */
105
106#define RTEMS_OBJECT_ID_INITIAL_INDEX   (0)
107#define RTEMS_OBJECT_ID_FINAL_INDEX     (0xffff)
108
109#define RTEMS_OBJECT_ID_INITIAL(node)   (_Objects_Build_id(      \
110                                            node, \
111                                            RTEMS_OBJECT_ID_INITIAL_INDEX))
112#define RTEMS_OBJECT_ID_FINAL           ((Objects_Id) ~0)
113
114/*
115 *  _Objects_Handler_initialization
116 *
117 *  DESCRIPTION:
118 *
119 *  This function performs the initialization necessary for this handler.
120 *
121 */
122
123void _Objects_Handler_initialization(
124  unsigned32 node,
125  unsigned32 maximum_global_objects
126);
127
128/*
129 *  _Objects_Initialize_information
130 *
131 *  DESCRIPTION:
132 *
133 *  This function initializes an object class information record.
134 *  SUPPORTS_GLOBAL is TRUE if the object class supports global
135 *  objects, and FALSE otherwise.  Maximum indicates the number
136 *  of objects required in this class and size indicates the size
137 *  in bytes of each control block for this object class.
138 *
139 */
140
141void _Objects_Initialize_information (
142  Objects_Information *information,
143  boolean              supports_global,
144  unsigned32           maximum,
145  unsigned32           size
146);
147
148/*
149 *  _Objects_Name_to_id
150 *
151 *  DESCRIPTION:
152 *
153 *  This function implements the common portion of the object
154 *  identification directives.  This directive returns the object
155 *  id associated with name.  If more than one object of this class
156 *  is named name, then the object to which the id belongs is
157 *  arbitrary.  Node indicates the extent of the search for the
158 *  id of the object named name.  If the object class supports global
159 *  objects, then the search can be limited to a particular node
160 *  or allowed to encompass all nodes.
161 *
162 */
163
164rtems_status_code _Objects_Name_to_id(
165  Objects_Information *information,
166  Objects_Name         name,
167  unsigned32           node,
168  Objects_Id          *id
169);
170
171/*
172 *  _Objects_Get
173 *
174 *  DESCRIPTION:
175 *
176 *  This function maps object ids to object control blocks.
177 *  If id corresponds to a local object, then it returns
178 *  the_object control pointer which maps to id and location
179 *  is set to OBJECTS_LOCAL.  If the object class supports global
180 *  objects and the object id is global and resides on a remote
181 *  node, then location is set to OBJECTS_REMOTE, and the_object
182 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
183 *  and the_object is undefined.
184 *
185 */
186
187Objects_Control *_Objects_Get (
188  Objects_Information *information,
189  Objects_Id           id,
190  Objects_Locations   *location
191);
192
193/*
194 *  _Objects_Get_next
195 *
196 *  DESCRIPTION:
197 *
198 *  Like _Objects_Get, but is used to find "next" open object.
199 *
200 */
201
202Objects_Control *_Objects_Get_next(
203    Objects_Information *information,
204    Objects_Id           id,
205    unsigned32          *location_p,
206    Objects_Id          *next_id_p
207);
208
209/*
210 *  _Objects_Is_name_valid
211 *
212 *  DESCRIPTION:
213 *
214 *  This function returns TRUE if the name is valid, and FALSE otherwise.
215 */
216
217STATIC INLINE boolean _Objects_Is_name_valid (
218  Objects_Name name
219);
220
221/*
222 *  rtems_build_name
223 *
224 *  DESCRIPTION:
225 *
226 *  This function returns an object name composed of the four characters
227 *  C1, C2, C3, and C4.
228 *
229 *  NOTE:
230 *
231 *  This must be implemented as a macro for use in Configuration Tables.
232 *
233 */
234
235#define rtems_build_name( _C1, _C2, _C3, _C4 ) \
236  ( (_C1) << 24 | (_C2) << 16 | (_C3) << 8 | (_C4) )
237
238/*
239 *  rtems_name_to_characters
240 *
241 *  DESCRIPTION:
242 *
243 *  This function breaks the object name into the four component
244 *  characters C1, C2, C3, and C4.
245 *
246 */
247
248STATIC INLINE void rtems_name_to_characters(
249  Objects_Name  name,
250  char         *c1,
251  char         *c2,
252  char         *c3,
253  char         *c4
254);
255
256/*
257 *  _Objects_Build_id
258 *
259 *  DESCRIPTION:
260 *
261 *  This function builds an object's id from the processor node and index
262 *  values specified.
263 *
264 */
265
266STATIC INLINE Objects_Id _Objects_Build_id(
267  unsigned32 node,
268  unsigned32 index
269);
270
271/*
272 *  rtems_get_node
273 *
274 *  DESCRIPTION:
275 *
276 *  This function returns the node portion of the ID.
277 *
278 */
279
280STATIC INLINE unsigned32 rtems_get_node(
281  Objects_Id id
282);
283
284/*
285 *  rtems_get_index
286 *
287 *  DESCRIPTION:
288 *
289 *  This function returns the index portion of the ID.
290 *
291 */
292
293STATIC INLINE unsigned32 rtems_get_index(
294  Objects_Id id
295);
296
297/*
298 *  _Objects_Is_local_node
299 *
300 *  DESCRIPTION:
301 *
302 *  This function returns TRUE if the node is of the local object, and
303 *  FALSE otherwise.
304 *
305 */
306
307STATIC INLINE boolean _Objects_Is_local_node(
308  unsigned32 node
309);
310
311/*
312 *  _Objects_Is_local_id
313 *
314 *  DESCRIPTION:
315 *
316 *  This function returns TRUE if the id is of a local object, and
317 *  FALSE otherwise.
318 *
319 */
320
321STATIC INLINE boolean _Objects_Is_local_id(
322  Objects_Id id
323);
324
325/*
326 *  _Objects_Are_ids_equal
327 *
328 *  DESCRIPTION:
329 *
330 *  This function returns TRUE if left and right are equal,
331 *  and FALSE otherwise.
332 *
333 */
334
335STATIC INLINE boolean _Objects_Are_ids_equal(
336  Objects_Id left,
337  Objects_Id right
338);
339
340/*
341 *  _Objects_Allocate
342 *
343 *  DESCRIPTION:
344 *
345 *  This function allocates a object control block from
346 *  the inactive chain of free object control blocks.
347 *
348 */
349
350STATIC INLINE Objects_Control *_Objects_Allocate(
351  Objects_Information *information
352);
353
354/*
355 *  _Objects_Free
356 *
357 *  DESCRIPTION:
358 *
359 *  This function frees a object control block to the
360 *  inactive chain of free object control blocks.
361 *
362 */
363
364STATIC INLINE void _Objects_Free(
365  Objects_Information *information,
366  Objects_Control     *the_object
367);
368
369/*
370 *  _Objects_Open
371 *
372 *  DESCRIPTION:
373 *
374 *  This function places the_object control pointer and object name
375 *  in the Local Pointer and Local Name Tables, respectively.
376 *
377 */
378
379STATIC INLINE void _Objects_Open(
380  Objects_Information *information,
381  Objects_Control     *the_object,
382  Objects_Name         name
383);
384
385/*
386 *  _Objects_Close
387 *
388 *  DESCRIPTION:
389 *
390 *  This function removes the_object control pointer and object name
391 *  in the Local Pointer and Local Name Tables.
392 *
393 */
394
395STATIC INLINE void _Objects_Close(
396  Objects_Information *information,
397  Objects_Control     *the_object
398);
399
400#include <rtems/object.inl>
401#include <rtems/objectmp.h>
402
403#ifdef __cplusplus
404}
405#endif
406
407#endif
408/* end of include file */
Note: See TracBrowser for help on using the repository browser.