source: rtems/cpukit/score/include/rtems/score/object.h @ 97e2729d

4.104.114.84.95
Last change on this file since 97e2729d was 97e2729d, checked in by Joel Sherrill <joel.sherrill@…>, on 11/23/98 at 17:38:09

Added --disable-multiprocessing flag and modified a lot of files to make
it work.

  • Property mode set to 100644
File size: 9.8 KB
RevLine 
[ac7d5ef0]1/*  object.h
2 *
3 *  This include file contains all the constants and structures associated
[3a4ae6c]4 *  with the Object Handler.  This Handler provides mechanisms which
5 *  can be used to initialize and manipulate all objects which have
6 *  ids.
[ac7d5ef0]7 *
[60b791ad]8 *  COPYRIGHT (c) 1989-1998.
[ac7d5ef0]9 *  On-Line Applications Research Corporation (OAR).
[03f2154e]10 *  Copyright assigned to U.S. Government, 1994.
[ac7d5ef0]11 *
[98e4ebf5]12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
[03f2154e]14 *  http://www.OARcorp.com/rtems/license.html.
[ac7d5ef0]15 *
16 *  $Id$
17 */
18
[3a4ae6c]19#ifndef __OBJECTS_h
20#define __OBJECTS_h
[ac7d5ef0]21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
[5e9b32b]26#include <rtems/score/chain.h>
[ac7d5ef0]27
28/*
29 *  The following type defines the control block used to manage
30 *  object names.
31 */
32
[3235ad9]33typedef void * Objects_Name;
34
35/*
36 *  Space for object names is allocated in multiples of this.
37 *
38 *  NOTE:  Must be a power of 2.  Matches the name manipulation routines.
39 */
40
[4944b5bf]41#define OBJECTS_NAME_ALIGNMENT     sizeof( unsigned32 )
[3235ad9]42
43/*
44 *  Functions which compare names are prototyped like this.
45 */
46
47typedef boolean (*Objects_Name_comparators)(
48  void       * /* name_1 */,
49  void       * /* name_2 */,
50  unsigned32   /* length */
51);
[ac7d5ef0]52
53/*
54 *  The following type defines the control block used to manage
[95fbca1]55 *  object IDs.  The format is as follows (0=LSB):
56 *
57 *     Bits  0 .. 15    = index
58 *     Bits 16 .. 25    = node
59 *     Bits 26 .. 31    = class
[ac7d5ef0]60 */
61
62typedef unsigned32 Objects_Id;
63
[95fbca1]64#define OBJECTS_INDEX_START_BIT  0
65#define OBJECTS_NODE_START_BIT  16
66#define OBJECTS_CLASS_START_BIT 26
67
68#define OBJECTS_INDEX_MASK      0x0000ffff
69#define OBJECTS_NODE_MASK       0x03ff0000
70#define OBJECTS_CLASS_MASK      0xfc000000
71
72#define OBJECTS_INDEX_VALID_BITS  0x0000ffff
73#define OBJECTS_NODE_VALID_BITS   0x000003ff
74#define OBJECTS_CLASS_VALID_BITS  0x000000cf
75
76/*
77 *  This enumerated type is used in the class field of the object ID.
78 */
79
80typedef enum {
[5e9b32b]81  OBJECTS_NO_CLASS                  =  0,
82  OBJECTS_INTERNAL_THREADS          =  1,
83  OBJECTS_RTEMS_TASKS               =  2,
84  OBJECTS_POSIX_THREADS             =  3,
85  OBJECTS_RTEMS_TIMERS              =  4,
86  OBJECTS_RTEMS_SEMAPHORES          =  5,
87  OBJECTS_RTEMS_MESSAGE_QUEUES      =  6,
88  OBJECTS_RTEMS_PARTITIONS          =  7,
89  OBJECTS_RTEMS_REGIONS             =  8,
90  OBJECTS_RTEMS_PORTS               =  9,
91  OBJECTS_RTEMS_PERIODS             = 10,
92  OBJECTS_RTEMS_EXTENSIONS          = 11,
93  OBJECTS_POSIX_KEYS                = 12,
94  OBJECTS_POSIX_INTERRUPTS          = 13,
95  OBJECTS_POSIX_MESSAGE_QUEUES      = 14,
96  OBJECTS_POSIX_MUTEXES             = 15,
97  OBJECTS_POSIX_SEMAPHORES          = 16,
98  OBJECTS_POSIX_CONDITION_VARIABLES = 17
[95fbca1]99} Objects_Classes;
[5e9b32b]100 
101#define OBJECTS_CLASSES_FIRST               OBJECTS_NO_CLASS
102#define OBJECTS_CLASSES_LAST                OBJECTS_POSIX_CONDITION_VARIABLES
[ef006c1]103#define OBJECTS_CLASSES_FIRST_THREAD_CLASS  OBJECTS_INTERNAL_THREADS
[5e9b32b]104#define OBJECTS_CLASSES_LAST_THREAD_CLASS   OBJECTS_POSIX_THREADS
[5250ff39]105
[ac7d5ef0]106/*
107 *  This enumerated type lists the locations which may be returned
108 *  by _Objects_Get.  These codes indicate the success of locating
109 *  an object with the specified ID.
110 */
111
112typedef enum {
113  OBJECTS_LOCAL  = 0,         /* object is local */
114  OBJECTS_REMOTE = 1,         /* object is remote */
115  OBJECTS_ERROR  = 2          /* id was invalid */
116}  Objects_Locations;
117
118/*
119 *  The following defines the Object Control Block used to manage
120 *  each object local to this node.
121 */
122
123typedef struct {
[95fbca1]124  Chain_Node    Node;
125  Objects_Id    id;
[3235ad9]126  Objects_Name  name;
[ac7d5ef0]127}   Objects_Control;
128
129/*
130 *  The following defines the structure for the information used to
131 *  manage each class of objects.
132 */
133
134typedef struct {
[95fbca1]135  Objects_Classes   the_class;       /* Class of this object */
[ac7d5ef0]136  Objects_Id        minimum_id;      /* minimum valid id of this type */
137  Objects_Id        maximum_id;      /* maximum valid id of this type */
138  unsigned32        maximum;         /* maximum number of objects */
139  Objects_Control **local_table;     /* table of local object pointers */
140  Objects_Name     *name_table;      /* table of local object names */
141  Chain_Control    *global_table;    /* pointer to global table */
142  Chain_Control     Inactive;        /* chain of inactive ctl blocks */
[3235ad9]143  boolean           is_string;       /* TRUE if names are strings */
144  unsigned32        name_length;     /* maximum length of names */
[5250ff39]145  boolean           is_thread;       /* TRUE if these are threads */
146                                     /*   irregardless of API */
[ac7d5ef0]147}   Objects_Information;
148
149/*
150 *  The following defines the data storage which contains the
151 *  node number of the local node.
152 */
153
[c627b2a3]154SCORE_EXTERN unsigned32  _Objects_Local_node;
155SCORE_EXTERN unsigned32  _Objects_Maximum_nodes;
[ac7d5ef0]156
[5250ff39]157/*
158 *  The following is the list of information blocks for each object
159 *  class.  From the ID, we can go to one of these information blocks,
160 *  and obtain a pointer to the appropriate object control block.
161 */
162
[c627b2a3]163SCORE_EXTERN Objects_Information
[5250ff39]164    *_Objects_Information_table[OBJECTS_CLASSES_LAST + 1];
165
[ac7d5ef0]166/*
167 *  The following defines the constant which may be used
168 *  with _Objects_Get to manipulate the calling task.
169 *
170 */
171
[95fbca1]172#define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
[ac7d5ef0]173
174/*
175 *  The following define the constants which may be used in name searches.
176 */
177
[3a4ae6c]178#define OBJECTS_SEARCH_ALL_NODES   0
179#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
180#define OBJECTS_SEARCH_LOCAL_NODE  0x7FFFFFFF
181#define OBJECTS_WHO_AM_I           0
[ac7d5ef0]182
[b06e68ef]183/*
184 * Parameters and return id's for _Objects_Get_next
185 */
186
[3a4ae6c]187#define OBJECTS_ID_INITIAL_INDEX   (0)
188#define OBJECTS_ID_FINAL_INDEX     (0xffff)
[b06e68ef]189
[5d3e539]190#define OBJECTS_ID_INITIAL(_class, _node) \
191  _Objects_Build_id( (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
192
[3a4ae6c]193#define OBJECTS_ID_FINAL           ((Objects_Id)~0)
[b06e68ef]194
[ac7d5ef0]195/*
196 *  _Objects_Handler_initialization
197 *
198 *  DESCRIPTION:
199 *
200 *  This function performs the initialization necessary for this handler.
201 *
202 */
203
204void _Objects_Handler_initialization(
205  unsigned32 node,
[3a4ae6c]206  unsigned32 maximum_nodes,
[ac7d5ef0]207  unsigned32 maximum_global_objects
208);
209
210/*
211 *  _Objects_Initialize_information
212 *
213 *  DESCRIPTION:
214 *
215 *  This function initializes an object class information record.
216 *  SUPPORTS_GLOBAL is TRUE if the object class supports global
217 *  objects, and FALSE otherwise.  Maximum indicates the number
218 *  of objects required in this class and size indicates the size
[5e9b32b]219 *  in bytes of each control block for this object class.  The
220 *  name length and string designator are also set.  In addition,
221 *  the class may be a task, therefore this information is also included.
[ac7d5ef0]222 */
223
224void _Objects_Initialize_information (
225  Objects_Information *information,
[95fbca1]226  Objects_Classes      the_class,
[ac7d5ef0]227  boolean              supports_global,
228  unsigned32           maximum,
[3235ad9]229  unsigned32           size,
230  boolean              is_string,
[5250ff39]231  unsigned32           maximum_name_length,
232  boolean              is_task
[3235ad9]233);
234
235/*
236 *  _Objects_Clear_name
237 *
238 *  DESCRIPTION:
239 *
240 *  XXX
241 */
242 
243void _Objects_Clear_name(
244  void       *name,
245  unsigned32  length
246);
247
248/*
249 *  _Objects_Copy_name_string
250 *
251 *  DESCRIPTION:
252 *
253 *  XXX
254 */
255
256void _Objects_Copy_name_string(
257  void       *source,
258  void       *destination
259);
260
261/*
262 *  _Objects_Copy_name_raw
263 *
264 *  DESCRIPTION:
265 *
266 *  XXX
267 */
268
269void _Objects_Copy_name_raw(
270  void       *source,
271  void       *destination,
272  unsigned32  length
273);
274
275/*
276 *  _Objects_Compare_name_string
277 *
278 *  DESCRIPTION:
279 *
280 *  XXX
281 */
282
283boolean _Objects_Compare_name_string(
284  void       *name_1,
285  void       *name_2,
286  unsigned32  length
[ac7d5ef0]287);
288
[3235ad9]289/*
290 *  _Objects_Compare_name_raw
291 *
292 *  DESCRIPTION:
293 *
294 *  XXX
295 */
296
297boolean _Objects_Compare_name_raw(
298  void       *name_1,
299  void       *name_2,
300  unsigned32  length
301);
[ac7d5ef0]302/*
303 *  _Objects_Name_to_id
304 *
305 *  DESCRIPTION:
306 *
307 *  This function implements the common portion of the object
308 *  identification directives.  This directive returns the object
309 *  id associated with name.  If more than one object of this class
310 *  is named name, then the object to which the id belongs is
311 *  arbitrary.  Node indicates the extent of the search for the
312 *  id of the object named name.  If the object class supports global
313 *  objects, then the search can be limited to a particular node
314 *  or allowed to encompass all nodes.
315 *
316 */
317
[3a4ae6c]318typedef enum {
319  OBJECTS_SUCCESSFUL,
320  OBJECTS_INVALID_NAME,
321  OBJECTS_INVALID_NODE
322} Objects_Name_to_id_errors;
323
324#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_SUCCESSFUL
325#define OBJECTS_NAME_ERRORS_LAST  OBJECTS_INVALID_NODE
326
327Objects_Name_to_id_errors _Objects_Name_to_id(
[ac7d5ef0]328  Objects_Information *information,
329  Objects_Name         name,
330  unsigned32           node,
331  Objects_Id          *id
332);
333
334/*
335 *  _Objects_Get
336 *
337 *  DESCRIPTION:
338 *
339 *  This function maps object ids to object control blocks.
340 *  If id corresponds to a local object, then it returns
341 *  the_object control pointer which maps to id and location
342 *  is set to OBJECTS_LOCAL.  If the object class supports global
343 *  objects and the object id is global and resides on a remote
344 *  node, then location is set to OBJECTS_REMOTE, and the_object
345 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
346 *  and the_object is undefined.
347 *
348 */
349
350Objects_Control *_Objects_Get (
351  Objects_Information *information,
352  Objects_Id           id,
353  Objects_Locations   *location
354);
355
[b06e68ef]356/*
357 *  _Objects_Get_next
358 *
359 *  DESCRIPTION:
360 *
361 *  Like _Objects_Get, but is used to find "next" open object.
362 *
363 */
364
365Objects_Control *_Objects_Get_next(
366    Objects_Information *information,
367    Objects_Id           id,
[4944b5bf]368    Objects_Locations   *location_p,
[b06e68ef]369    Objects_Id          *next_id_p
370);
371
[7f6a24ab]372/*
373 *  _Objects_Get_information
374 *
375 *  DESCRIPTION:
376 *
377 *  Returns the information control block for the class of objects
378 *  corresponding to this id.
379 */
380
381Objects_Information *_Objects_Get_information(
382  Objects_Id  id
383);
384 
[ac7d5ef0]385/*
[1a8fde6c]386 *  Pieces of object.inl are promoted out to the user
[ac7d5ef0]387 */
388
[5e9b32b]389#include <rtems/score/object.inl>
[97e2729d]390#if defined(RTEMS_MULTIPROCESSING)
[5e9b32b]391#include <rtems/score/objectmp.h>
[97e2729d]392#endif
[ac7d5ef0]393
394#ifdef __cplusplus
395}
396#endif
397
398#endif
399/* end of include file */
Note: See TracBrowser for help on using the repository browser.