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

4.104.114.95
Last change on this file since ce19f1fa was ce19f1fa, checked in by Joel Sherrill <joel.sherrill@…>, on 01/23/08 at 22:57:43

2008-01-23 Joel Sherrill <joel.sherrill@…>

  • itron/include/rtems/itron/object.h, itron/src/cre_tsk.c, libblock/src/show_bdbuf.c, libmisc/capture/capture-cli.c, libmisc/capture/capture.c, libmisc/monitor/mon-manager.c, libmisc/stackchk/check.c, posix/src/condinit.c, posix/src/keycreate.c, posix/src/mqueuecreatesupp.c, posix/src/mqueuedeletesupp.c, posix/src/mqueuenametoid.c, posix/src/mqueueopen.c, posix/src/mqueueunlink.c, posix/src/mutexinit.c, posix/src/pbarrierinit.c, posix/src/prwlockinit.c, posix/src/pspininit.c, posix/src/pthreadcreate.c, posix/src/pthreadexit.c, posix/src/semaphorecreatesupp.c, posix/src/semaphorenametoid.c, posix/src/timercreate.c, rtems/src/barrierident.c, rtems/src/dpmemident.c, rtems/src/msgqident.c, rtems/src/partident.c, rtems/src/ratemonident.c, rtems/src/regionident.c, rtems/src/semident.c, rtems/src/taskident.c, rtems/src/timerident.c, sapi/src/extensionident.c, score/Makefile.am, score/include/rtems/score/object.h, score/inline/rtems/score/object.inl, score/src/apimutexallocate.c, score/src/objectextendinformation.c, score/src/objectgetnameasstring.c, score/src/objectmp.c, score/src/objectnametoid.c: Convert the Objects_Name type from a simple type to a union of an unsigned 32 bit integer and a pointer. This should help eliminate weird casts between u32 and pointers in various places. The APIs now have to explicitly call _u32 or _string versions of helper routines. This should also simplify things and eliminate the need for ugly casts in some cases.
  • score/src/objectclearname.c, score/src/objectcomparenameraw.c, score/src/objectcomparenamestring.c, score/src/objectcopynameraw.c, score/src/objectcopynamestring.c: Removed.
  • Property mode set to 100644
File size: 26.0 KB
Line 
1/**
2 * @file  rtems/score/object.h
3 *
4 *
5 *  This include file contains all the constants and structures associated
6 *  with the Object Handler.  This Handler provides mechanisms which
7 *  can be used to initialize and manipulate all objects which have
8 *  ids.
9 */
10
11/*
12 *  COPYRIGHT (c) 1989-2007.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.com/license/LICENSE.
18 *
19 *  $Id$
20 */
21
22#ifndef _RTEMS_SCORE_OBJECT_H
23#define _RTEMS_SCORE_OBJECT_H
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#include <rtems/score/chain.h>
30#include <rtems/score/isr.h>
31
32/**
33 *  The following type defines the control block used to manage
34 *  object names.
35 */
36typedef union {
37  /** This is a pointer to a string name. */
38  const char *name_p;
39  /** This is the actual 32-bit "raw" integer name. */
40  uint32_t    name_u32;
41} Objects_Name;
42
43/**
44 *  Space for object names is allocated in multiples of this.
45 *
46 *  NOTE:  Must be a power of 2.  Matches the name manipulation routines.
47 */
48#define OBJECTS_NAME_ALIGNMENT     sizeof( uint32_t )
49
50/**
51 *  Functions which compare names are prototyped like this.
52 */
53typedef boolean (*Objects_Name_comparators)(
54  void       * /* name_1 */,
55  void       * /* name_2 */,
56  uint16_t     /* length */
57);
58
59#if defined(RTEMS_USE_16_BIT_OBJECT)
60/**
61 *  The following type defines the control block used to manage
62 *  object IDs.  The format is as follows (0=LSB):
63 *
64 *     Bits  0 ..  7    = index  (up to 254 objects of a type)
65 *     Bits  8 .. 10    = API    (up to 7 API classes)
66 *     Bits 11 .. 15    = class  (up to 31 object types per API)
67 */
68typedef uint16_t   Objects_Id;
69
70/**
71 * This type is used to store the maximum number of allowed objects
72 * of each type.
73 */
74typedef uint8_t    Objects_Maximum;
75
76#define OBJECTS_INDEX_START_BIT  0
77#define OBJECTS_API_START_BIT    8
78#define OBJECTS_CLASS_START_BIT 11
79
80#define OBJECTS_INDEX_MASK      (Objects_Id)0x00ff
81#define OBJECTS_API_MASK        (Objects_Id)0x0700
82#define OBJECTS_CLASS_MASK      (Objects_Id)0xF800
83
84#define OBJECTS_INDEX_VALID_BITS  (Objects_Id)0x00ff
85#define OBJECTS_API_VALID_BITS    (Objects_Id)0x0007
86/* OBJECTS_NODE_VALID_BITS should not be used with 16 bit Ids */
87#define OBJECTS_CLASS_VALID_BITS  (Objects_Id)0x001f
88
89#define OBJECTS_UNLIMITED_OBJECTS 0x8000
90
91#define OBJECTS_ID_INITIAL_INDEX  (0)
92#define OBJECTS_ID_FINAL_INDEX    (0xff)
93
94#else
95/**
96 *  The following type defines the control block used to manage
97 *  object IDs.  The format is as follows (0=LSB):
98 *
99 *     Bits  0 .. 15    = index  (up to 65535 objects of a type)
100 *     Bits 16 .. 23    = node   (up to 255 nodes)
101 *     Bits 24 .. 26    = API    (up to 7 API classes)
102 *     Bits 27 .. 31    = class  (up to 31 object types per API)
103 */
104typedef uint32_t   Objects_Id;
105
106/**
107 * This type is used to store the maximum number of allowed objects
108 * of each type.
109 */
110typedef uint16_t   Objects_Maximum;
111
112/**
113 *  This is the bit position of the starting bit of the index portion of
114 *  the object Id.
115 */
116#define OBJECTS_INDEX_START_BIT  0
117
118
119/**
120 *  This is the bit position of the starting bit of the node portion of
121 *  the object Id.
122 */
123#define OBJECTS_NODE_START_BIT  16
124
125/**
126 *  This is the bit position of the starting bit of the API portion of
127 *  the object Id.
128 */
129#define OBJECTS_API_START_BIT   24
130
131/**
132 *  This is the bit position of the starting bit of the class portion of
133 *  the object Id.
134 */
135#define OBJECTS_CLASS_START_BIT 27
136
137/**
138 *  This mask is used to extract the index portion of an object Id.
139 */
140#define OBJECTS_INDEX_MASK      (Objects_Id)0x0000ffff
141
142/**
143 *  This mask is used to extract the node portion of an object Id.
144 */
145#define OBJECTS_NODE_MASK       (Objects_Id)0x00ff0000
146
147/**
148 *  This mask is used to extract the API portion of an object Id.
149 */
150#define OBJECTS_API_MASK        (Objects_Id)0x07000000
151
152/**
153 *  This mask is used to extract the class portion of an object Id.
154 */
155#define OBJECTS_CLASS_MASK      (Objects_Id)0xf8000000
156
157/**
158 *  This mask represents the bits that is used to ensure no extra bits
159 *  are set after shifting to extract the index portion of an object Id.
160 */
161#define OBJECTS_INDEX_VALID_BITS  (Objects_Id)0x0000ffff
162
163/**
164 *  This mask represents the bits that is used to ensure no extra bits
165 *  are set after shifting to extract the node portion of an object Id.
166 */
167#define OBJECTS_NODE_VALID_BITS   (Objects_Id)0x000000ff
168
169/**
170 *  This mask represents the bits that is used to ensure no extra bits
171 *  are set after shifting to extract the API portion of an object Id.
172 */
173#define OBJECTS_API_VALID_BITS    (Objects_Id)0x00000007
174
175/**
176 *  This mask represents the bits that is used to ensure no extra bits
177 *  are set after shifting to extract the class portion of an object Id.
178 */
179#define OBJECTS_CLASS_VALID_BITS  (Objects_Id)0x0000001f
180
181/**
182 *  Mask to enable unlimited objects.  This is used in the configuration
183 *  table when specifying the number of configured objects.
184 */
185#define OBJECTS_UNLIMITED_OBJECTS 0x80000000
186
187/**
188 *  This is the lowest value for the index portion of an object Id.
189 */
190#define OBJECTS_ID_INITIAL_INDEX  (0)
191
192/**
193 *  This is the highest value for the index portion of an object Id.
194 */
195#define OBJECTS_ID_FINAL_INDEX    (0xff)
196#endif
197
198/**
199 *  This enumerated type is used in the class field of the object ID.
200 */
201typedef enum {
202  OBJECTS_NO_API       = 0,
203  OBJECTS_INTERNAL_API = 1,
204  OBJECTS_CLASSIC_API  = 2,
205  OBJECTS_POSIX_API    = 3,
206  OBJECTS_ITRON_API    = 4
207} Objects_APIs;
208
209/** This macro is used to generically specify the last API index. */
210#define OBJECTS_APIS_LAST OBJECTS_ITRON_API
211
212/**
213 *  This enumerated type is used in the class field of the object ID
214 *  for RTEMS internal object classes.
215 */
216typedef enum {
217  OBJECTS_INTERNAL_NO_CLASS =  0,
218  OBJECTS_INTERNAL_THREADS  =  1,
219  OBJECTS_INTERNAL_MUTEXES  =  2
220} Objects_Internal_API;
221
222/** This macro is used to generically specify the last API index. */
223#define OBJECTS_INTERNAL_CLASSES_LAST OBJECTS_INTERNAL_MUTEXES
224
225/**
226 *  This enumerated type is used in the class field of the object ID
227 *  for the RTEMS Classic API.
228 */
229typedef enum {
230  OBJECTS_CLASSIC_NO_CLASS     = 0,
231  OBJECTS_RTEMS_TASKS          = 1,
232  OBJECTS_RTEMS_TIMERS         = 2,
233  OBJECTS_RTEMS_SEMAPHORES     = 3,
234  OBJECTS_RTEMS_MESSAGE_QUEUES = 4,
235  OBJECTS_RTEMS_PARTITIONS     = 5,
236  OBJECTS_RTEMS_REGIONS        = 6,
237  OBJECTS_RTEMS_PORTS          = 7,
238  OBJECTS_RTEMS_PERIODS        = 8,
239  OBJECTS_RTEMS_EXTENSIONS     = 9,
240  OBJECTS_RTEMS_BARRIERS       = 10
241} Objects_Classic_API;
242
243/** This macro is used to generically specify the last API index. */
244#define OBJECTS_RTEMS_CLASSES_LAST OBJECTS_RTEMS_BARRIERS
245
246/**
247 *  This enumerated type is used in the class field of the object ID
248 *  for the POSIX API.
249 */
250typedef enum {
251  OBJECTS_POSIX_NO_CLASS            = 0,
252  OBJECTS_POSIX_THREADS             = 1,
253  OBJECTS_POSIX_KEYS                = 2,
254  OBJECTS_POSIX_INTERRUPTS          = 3,
255  OBJECTS_POSIX_MESSAGE_QUEUE_FDS   = 4,
256  OBJECTS_POSIX_MESSAGE_QUEUES      = 5,
257  OBJECTS_POSIX_MUTEXES             = 6,
258  OBJECTS_POSIX_SEMAPHORES          = 7,
259  OBJECTS_POSIX_CONDITION_VARIABLES = 8,
260  OBJECTS_POSIX_TIMERS              = 9,
261  OBJECTS_POSIX_BARRIERS            = 10,
262  OBJECTS_POSIX_SPINLOCKS           = 11,
263  OBJECTS_POSIX_RWLOCKS             = 12
264} Objects_POSIX_API;
265
266/** This macro is used to generically specify the last API index. */
267#define OBJECTS_POSIX_CLASSES_LAST OBJECTS_POSIX_RWLOCKS
268
269/**
270 *  This enumerated type is used in the class field of the object ID
271 *  for the ITRON API.
272 */
273typedef enum {
274  OBJECTS_ITRON_NO_CLASS              = 0,
275  OBJECTS_ITRON_TASKS                 = 1,
276  OBJECTS_ITRON_EVENTFLAGS            = 2,
277  OBJECTS_ITRON_MAILBOXES             = 3,
278  OBJECTS_ITRON_MESSAGE_BUFFERS       = 4,
279  OBJECTS_ITRON_PORTS                 = 5,
280  OBJECTS_ITRON_SEMAPHORES            = 6,
281  OBJECTS_ITRON_VARIABLE_MEMORY_POOLS = 7,
282  OBJECTS_ITRON_FIXED_MEMORY_POOLS    = 8
283} Objects_ITRON_API;
284
285/** This macro is used to generically specify the last API index. */
286#define OBJECTS_ITRON_CLASSES_LAST OBJECTS_ITRON_FIXED_MEMORY_POOLS
287
288/**
289 *  This enumerated type lists the locations which may be returned
290 *  by _Objects_Get.  These codes indicate the success of locating
291 *  an object with the specified ID.
292 */
293typedef enum {
294  OBJECTS_LOCAL  = 0,         /* object is local */
295  OBJECTS_ERROR  = 1,         /* id was invalid */
296#if defined(RTEMS_MULTIPROCESSING)
297  OBJECTS_REMOTE = 2,         /* object is remote */
298#endif
299} Objects_Locations;
300
301/**
302 *  The following type defines the callout used when a local task
303 *  is extracted from a remote thread queue (i.e. it's proxy must
304 *  extracted from the remote queue).
305 */
306typedef void ( *Objects_Thread_queue_Extract_callout )( void * );
307
308/**
309 *  The following defines the Object Control Block used to manage
310 *  each object local to this node.
311 */
312typedef struct {
313  /** This is the chain node portion of an object. */
314  Chain_Node     Node;
315  /** This is the object's ID. */
316  Objects_Id     id;
317  /** This is the object's name. */
318  Objects_Name   name;
319} Objects_Control;
320
321/**
322 *  The following defines the structure for the information used to
323 *  manage each class of objects.
324 */
325typedef struct {
326  /** This field indicates the API of this object class. */
327  Objects_APIs      the_api;
328  /** This is the class of this object set. */
329  uint16_t          the_class;
330  /** This is the minimum valid id of this object class. */
331  Objects_Id        minimum_id;
332  /** This is the maximum valid id of this object class. */
333  Objects_Id        maximum_id;
334  /** This is the maximum number of objects in this class. */
335  Objects_Maximum   maximum;
336  /** This is the TRUE if unlimited objects in this class. */
337  boolean           auto_extend;
338  /** This is the number of objects in a block. */
339  uint32_t          allocation_size;
340  /** This is the size in bytes of each object instance. */
341  size_t            size;
342  /** This points to the table of local objects. */
343  Objects_Control **local_table;
344  /** This points to the table of local object names. */
345  /* XXX should be safe to remove this field */
346  uint32_t        **name_table;
347  /** This is the chain of inactive control blocks. */
348  Chain_Control     Inactive;
349  /** This is the number of objects on the Inactive list. */
350  Objects_Maximum   inactive;
351  /** This is the number of inactive objects per block. */
352  uint32_t         *inactive_per_block;
353  /** This is a table to the chain of inactive object memory blocks. */
354  void            **object_blocks;
355  /** This is the TRUE if names are strings. */
356  boolean           is_string;
357  /** This is the maximum length of names. */
358  uint16_t          name_length;
359  /** This is this object class' method called when extracting a thread. */
360  Objects_Thread_queue_Extract_callout extract;
361#if defined(RTEMS_MULTIPROCESSING)
362  /** This is this object class' pointer to the global name table */
363  Chain_Control    *global_table;
364#endif
365}   Objects_Information;
366
367/**
368 *  The following is referenced to the node number of the local node.
369 */
370#if defined(RTEMS_MULTIPROCESSING)
371SCORE_EXTERN uint16_t       _Objects_Local_node;
372#else
373#define _Objects_Local_node ((uint16_t)1)
374#endif
375
376/**
377 *  The following is referenced to the number of nodes in the system.
378 */
379#if defined(RTEMS_MULTIPROCESSING)
380SCORE_EXTERN uint16_t    _Objects_Maximum_nodes;
381#else
382#define _Objects_Maximum_nodes 1
383#endif
384
385/**
386 *  The following is the list of information blocks per API for each object
387 *  class.  From the ID, we can go to one of these information blocks,
388 *  and obtain a pointer to the appropriate object control block.
389 */
390SCORE_EXTERN Objects_Information
391    **_Objects_Information_table[OBJECTS_APIS_LAST + 1];
392
393/**
394 *  The following defines the constant which may be used
395 *  with _Objects_Get to manipulate the calling task.
396 */
397#define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
398
399/**
400 *  The following constant is used to specify that a name to ID search
401 *  should search through all nodes.
402 */
403#define OBJECTS_SEARCH_ALL_NODES   0
404
405/**
406 *  The following constant is used to specify that a name to ID search
407 *  should search through all nodes except the current node.
408 */
409#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
410
411/**
412 *  The following constant is used to specify that a name to ID search
413 *  should search only on this node.
414 */
415#define OBJECTS_SEARCH_LOCAL_NODE  0x7FFFFFFF
416
417/**
418 *  The following constant is used to specify that a name to ID search
419 *  is being asked for the ID of the currently executing task.
420 */
421#define OBJECTS_WHO_AM_I           0
422
423/**
424 *  This macros calculates the lowest ID for the specified api, class,
425 *  and node.
426 */
427#define OBJECTS_ID_INITIAL(_api, _class, _node) \
428  _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
429
430/**
431 *  This macro specifies the highest object ID value
432 */
433#define OBJECTS_ID_FINAL           ((Objects_Id)~0)
434
435/**
436 *  This function performs the initialization necessary for this handler.
437 *
438 *  @param[in] node indicates the identifying number of this node.
439 *  @param[in] maximum_nodes is the maximum number of nodes in this system.
440 *  @param[in] maximum_global_objects is maximum number of global objects
441 *             concurrently offered in the system.
442 */
443void _Objects_Handler_initialization(
444#if defined(RTEMS_MULTIPROCESSING)
445  uint32_t   node,
446  uint32_t   maximum_nodes,
447  uint32_t   maximum_global_objects
448#endif
449);
450
451/**
452 *  This function extends an object class information record.
453 *
454 *  @param[in] information points to an object class information block.
455 */
456void _Objects_Extend_information(
457  Objects_Information *information
458);
459
460/**
461 *  This function shrink an object class information record.
462 *
463 *  @param[in] information points to an object class information block.
464 */
465void _Objects_Shrink_information(
466  Objects_Information *information
467);
468
469/**
470 *  This function initializes an object class information record.
471 *  SUPPORTS_GLOBAL is TRUE if the object class supports global
472 *  objects, and FALSE otherwise.  Maximum indicates the number
473 *  of objects required in this class and size indicates the size
474 *  in bytes of each control block for this object class.  The
475 *  name length and string designator are also set.  In addition,
476 *  the class may be a task, therefore this information is also included.
477 *
478 *  @param[in] information points to an object class information block.
479 *  @param[in] the_api indicates the API associated with this information block.
480 *  @param[in] the_class indicates the class of object being managed
481 *             by this information block.  It is specific to @a the_api.
482 *  @param[in] maximum is the maximum number of instances of this object
483 *             class which may be concurrently active.
484 *  @param[in] size is the size of the data structure for this class.
485 *  @param[in] is_string is TRUE if this object uses string style names.
486 *  @param[in] maximum_name_length is the maximum length of object names.
487 */
488void _Objects_Initialize_information (
489  Objects_Information *information,
490  Objects_APIs         the_api,
491  uint32_t             the_class,
492  uint32_t             maximum,
493  uint16_t             size,
494  boolean              is_string,
495  uint32_t             maximum_name_length
496#if defined(RTEMS_MULTIPROCESSING)
497  ,
498  boolean              supports_global,
499  Objects_Thread_queue_Extract_callout extract
500#endif
501);
502
503/**
504 *  This function allocates a object control block from
505 *  the inactive chain of free object control blocks.
506 *
507 *  @param[in] information points to an object class information block.
508 */
509Objects_Control *_Objects_Allocate(
510  Objects_Information *information
511);
512
513/**
514 *  This function allocates the object control block
515 *  specified by the index from the inactive chain of
516 *  free object control blocks.
517 *
518 *  @param[in] information points to an object class information block.
519 *  @param[in] index is the index of the object to allocate.
520 *  @param[in] sizeof_control is the size of the object control block.
521 */
522Objects_Control *_Objects_Allocate_by_index(
523  Objects_Information *information,
524  uint16_t             index,
525  uint16_t             sizeof_control
526);
527
528/**
529 *
530 *  This function frees a object control block to the
531 *  inactive chain of free object control blocks.
532 *
533 *  @param[in] information points to an object class information block.
534 *  @param[in] the_object points to the object to deallocate.
535 */
536void _Objects_Free(
537  Objects_Information *information,
538  Objects_Control     *the_object
539);
540
541/**
542 *  This function implements the common portion of the object
543 *  identification directives.  This directive returns the object
544 *  id associated with name.  If more than one object of this class
545 *  is named name, then the object to which the id belongs is
546 *  arbitrary.  Node indicates the extent of the search for the
547 *  id of the object named name.  If the object class supports global
548 *  objects, then the search can be limited to a particular node
549 *  or allowed to encompass all nodes.
550 */
551typedef enum {
552  OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL,
553  OBJECTS_INVALID_NAME,
554  OBJECTS_INVALID_ADDRESS,
555  OBJECTS_INVALID_ID,
556  OBJECTS_INVALID_NODE
557} Objects_Name_or_id_lookup_errors;
558
559/** This macro defines the first entry in the
560 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
561 */
562#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL
563
564/** This macro defines the last entry in the
565 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
566 */
567#define OBJECTS_NAME_ERRORS_LAST  OBJECTS_INVALID_NODE
568
569/**
570 *  This method converts an object name to an Id.  It performs a look up
571 *  using the object information block for this object class.
572 *
573 *  @param[in] information points to an object class information block.
574 *  @param[in] name is the name of the object to find.
575 *  @param[in] node is the set of nodes to search.
576 *  @param[in] id will contain the Id if the search is successful.
577 *
578 *  @return This method returns one of the values from the
579 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
580 *          successful or failure.  On success @a id will contain the Id of
581 *          the requested object.
582 */
583Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
584  Objects_Information *information,
585  uint32_t             name,
586  uint32_t             node,
587  Objects_Id          *id
588);
589
590/**
591 *  This method converts an object name to an Id.  It performs a look up
592 *  using the object information block for this object class.
593 *
594 *  @param[in] information points to an object class information block.
595 *  @param[in] name is the name of the object to find.
596 *  @param[in] node is the set of nodes to search.
597 *  @param[in] id will contain the Id if the search is successful.
598 *
599 *  @return This method returns one of the values from the
600 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
601 *          successful or failure.  On success @a id will contain the Id of
602 *          the requested object.
603 */
604Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string(
605  Objects_Information *information,
606  const char          *name,
607  uint32_t             node,
608  Objects_Id          *id
609);
610
611/**
612 *  This function implements the common portion of the object Id
613 *  to name directives.  This function returns the name
614 *  associated with object id.
615 *
616 *  @param[in] id is the Id of the object whose name we are locating.
617 *  @param[in] name will contain the name of the object, if found.
618 *
619 *  @return This method returns one of the values from the
620 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
621 *          successful or failure.  On success @a name will contain the name of
622 *          the requested object.
623 *
624 *  @note This function currently does not support string names.
625 */
626Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
627  Objects_Id      id,
628  Objects_Name   *name
629);
630
631/**
632 *  This function maps object ids to object control blocks.
633 *  If id corresponds to a local object, then it returns
634 *  the_object control pointer which maps to id and location
635 *  is set to OBJECTS_LOCAL.  If the object class supports global
636 *  objects and the object id is global and resides on a remote
637 *  node, then location is set to OBJECTS_REMOTE, and the_object
638 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
639 *  and the_object is undefined.
640 *
641 *  @param[in] information points to an object class information block.
642 *  @param[in] id is the Id of the object whose name we are locating.
643 *  @param[in] location will contain an indication of success or failure.
644 *
645 *  @return This method returns one of the values from the
646 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
647 *          successful or failure.  On success @a id will contain the Id of
648 *          the requested object.
649 *
650 *  @note _Objects_Get returns with dispatching disabled for
651 *  local and remote objects.  _Objects_Get_isr_disable returns with
652 *  dispatching disabled for remote objects and interrupts for local
653 *  objects.
654 */
655Objects_Control *_Objects_Get (
656  Objects_Information *information,
657  Objects_Id           id,
658  Objects_Locations   *location
659);
660
661/**
662 *  This function maps object ids to object control blocks.
663 *  If id corresponds to a local object, then it returns
664 *  the_object control pointer which maps to id and location
665 *  is set to OBJECTS_LOCAL.  If the object class supports global
666 *  objects and the object id is global and resides on a remote
667 *  node, then location is set to OBJECTS_REMOTE, and the_object
668 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
669 *  and the_object is undefined.
670 *
671 *  @param[in] information points to an object class information block.
672 *  @param[in] id is the Id of the object whose name we are locating.
673 *  @param[in] location will contain an indication of success or failure.
674 *  @param[in] level is the interrupt level being turned.
675 *
676 *  @return This method returns one of the values from the
677 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
678 *          successful or failure.  On success @a name will contain the name of
679 *          the requested object.
680 *
681 *  @note _Objects_Get returns with dispatching disabled for
682 *  local and remote objects.  _Objects_Get_isr_disable returns with
683 *  dispatching disabled for remote objects and interrupts for local
684 *  objects.
685 */
686Objects_Control *_Objects_Get_isr_disable(
687  Objects_Information *information,
688  Objects_Id           id,
689  Objects_Locations   *location,
690  ISR_Level           *level
691);
692
693/**
694 *  This function maps object index to object control blocks which must.
695 *  be local.  The parameter the_object control pointer which maps to id
696 *  and location is set to OBJECTS_LOCAL.  Otherwise, location is set to
697    OBJECTS_ERROR and the_object is undefined.
698 *
699 *  @param[in] information points to an object class information block.
700 *  @param[in] id is the Id of the object whose name we are locating.
701 *  @param[in] location will contain an indication of success or failure.
702 *
703 *  @return This method returns a pointer to the object associated with ID.
704 *
705 *  @return This method returns one of the values from the
706 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
707 *          successful or failure.  On success @a id will contain the id of
708 *          the requested object.
709 *
710 *  @note _Objects_Get returns with dispatching disabled for
711 *  local and remote objects.  _Objects_Get_isr_disable returns with
712 *  dispatching disabled for remote objects and interrupts for local
713 *  objects.
714 */
715Objects_Control *_Objects_Get_by_index (
716  Objects_Information *information,
717  Objects_Id           id,
718  Objects_Locations   *location
719);
720
721/**
722 *  This function maps object ids to object control blocks.
723 *  If id corresponds to a local object, then it returns
724 *  the_object control pointer which maps to id and location
725 *  is set to OBJECTS_LOCAL.  If the object class supports global
726 *  objects and the object id is global and resides on a remote
727 *  node, then location is set to OBJECTS_REMOTE, and the_object
728 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
729 *  and the_object is undefined.
730 *
731 *  @param[in] information points to an object class information block.
732 *  @param[in] id is the Id of the object whose name we are locating.
733 *  @param[in] location will contain an indication of success or failure.
734 *
735 *  @return This method returns one of the values from the
736 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
737 *          successful or failure.  On success @a id will contain the Id of
738 *          the requested object.
739 *
740 *  @note _Objects_Get returns with dispatching disabled for
741 *  local and remote objects.  _Objects_Get_isr_disable returns with
742 *  dispatching disabled for remote objects and interrupts for local
743 *  objects.
744 */
745Objects_Control *_Objects_Get_no_protection(
746  Objects_Information *information,
747  Objects_Id           id,
748  Objects_Locations   *location
749);
750
751/**
752 *  Like @ref _Objects_Get, but is used to find "next" open object.
753 *
754 *  @param[in] information points to an object class information block.
755 *  @param[in] id is the Id of the object whose name we are locating.
756 *  @param[in] location_p will contain an indication of success or failure.
757 *  @param[in] next_id_p is the Id of the next object we will look at.
758 *
759 *  @return This method returns the pointer to the object located or
760 *          NULL on error.
761 */
762Objects_Control *_Objects_Get_next(
763    Objects_Information *information,
764    Objects_Id           id,
765    Objects_Locations   *location_p,
766    Objects_Id          *next_id_p
767);
768
769/**
770 *  This method objects the name of an object and returns its name
771 *  in the form of a C string.  It attempts to be careful about
772 *  overflowing the user's string and about returning unprintable characters.
773 *
774 *  @param[in] id is the object to obtain the name of
775 *  @param[in] length indicates the length of the caller's buffer
776 *  @param[inout] name is a string which will be filled in.
777 *
778 *  @return This method returns @a name or NULL on error.
779 */
780
781char *_Objects_Get_name_as_string(
782  Objects_Id   id,
783  size_t       length,
784  char        *name
785);
786
787/*
788 *  Pieces of object.inl are promoted out to the user
789 */
790
791#include <rtems/score/object.inl>
792#if defined(RTEMS_MULTIPROCESSING)
793#include <rtems/score/objectmp.h>
794#endif
795
796#ifdef __cplusplus
797}
798#endif
799
800#endif
801/* end of include file */
Note: See TracBrowser for help on using the repository browser.