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

4.104.114.95
Last change on this file since 9184270 was 9184270, checked in by Joel Sherrill <joel.sherrill@…>, on 02/06/08 at 23:54:55

2008-02-06 Joel Sherrill <joel.sherrill@…>

  • posix/src/mqueueunlink.c, score/Makefile.am, score/include/rtems/score/object.h, score/inline/rtems/score/object.inl: Enhance _Objects_Namespace_remove() to handle freeing object names which are strings. All changed _Objects_Close() to call _Objects_Namespace_remove(). The resulting code was then moved from inline routines to function calls.
  • score/src/objectclose.c, score/src/objectnamespaceremove.c: New files.
  • Property mode set to 100644
File size: 28.9 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-2008.
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 is the chain of inactive control blocks. */
345  Chain_Control     Inactive;
346  /** This is the number of objects on the Inactive list. */
347  Objects_Maximum   inactive;
348  /** This is the number of inactive objects per block. */
349  uint32_t         *inactive_per_block;
350  /** This is a table to the chain of inactive object memory blocks. */
351  void            **object_blocks;
352  /** This is the TRUE if names are strings. */
353  boolean           is_string;
354  /** This is the maximum length of names. */
355  uint16_t          name_length;
356  /** This is this object class' method called when extracting a thread. */
357  Objects_Thread_queue_Extract_callout extract;
358#if defined(RTEMS_MULTIPROCESSING)
359  /** This is this object class' pointer to the global name table */
360  Chain_Control    *global_table;
361#endif
362}   Objects_Information;
363
364/**
365 *  The following is referenced to the node number of the local node.
366 */
367#if defined(RTEMS_MULTIPROCESSING)
368SCORE_EXTERN uint16_t       _Objects_Local_node;
369#else
370#define _Objects_Local_node ((uint16_t)1)
371#endif
372
373/**
374 *  The following is referenced to the number of nodes in the system.
375 */
376#if defined(RTEMS_MULTIPROCESSING)
377SCORE_EXTERN uint16_t    _Objects_Maximum_nodes;
378#else
379#define _Objects_Maximum_nodes 1
380#endif
381
382/**
383 *  The following is the list of information blocks per API for each object
384 *  class.  From the ID, we can go to one of these information blocks,
385 *  and obtain a pointer to the appropriate object control block.
386 */
387SCORE_EXTERN Objects_Information
388    **_Objects_Information_table[OBJECTS_APIS_LAST + 1];
389
390/**
391 *  The following defines the constant which may be used
392 *  with _Objects_Get to manipulate the calling task.
393 */
394#define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
395
396/**
397 *  The following constant is used to specify that a name to ID search
398 *  should search through all nodes.
399 */
400#define OBJECTS_SEARCH_ALL_NODES   0
401
402/**
403 *  The following constant is used to specify that a name to ID search
404 *  should search through all nodes except the current node.
405 */
406#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
407
408/**
409 *  The following constant is used to specify that a name to ID search
410 *  should search only on this node.
411 */
412#define OBJECTS_SEARCH_LOCAL_NODE  0x7FFFFFFF
413
414/**
415 *  The following constant is used to specify that a name to ID search
416 *  is being asked for the ID of the currently executing task.
417 */
418#define OBJECTS_WHO_AM_I           0
419
420/**
421 *  This macros calculates the lowest ID for the specified api, class,
422 *  and node.
423 */
424#define OBJECTS_ID_INITIAL(_api, _class, _node) \
425  _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
426
427/**
428 *  This macro specifies the highest object ID value
429 */
430#define OBJECTS_ID_FINAL           ((Objects_Id)~0)
431
432#if defined(RTEMS_MULTIPROCESSING)
433/**
434 *  This function performs the initialization necessary for this handler.
435 *
436 *  @param[in] node indicates the identifying number of this node.
437 *  @param[in] maximum_nodes is the maximum number of nodes in this system.
438 *  @param[in] maximum_global_objects is maximum number of global objects
439 *             concurrently offered in the system.
440 */
441void _Objects_Handler_initialization(
442  uint32_t   node,
443  uint32_t   maximum_nodes,
444  uint32_t   maximum_global_objects
445);
446#else
447/**
448 *  This function performs the initialization necessary for this handler.
449 */
450void _Objects_Handler_initialization(void);
451#endif
452
453/**
454 *  This function extends an object class information record.
455 *
456 *  @param[in] information points to an object class information block.
457 */
458void _Objects_Extend_information(
459  Objects_Information *information
460);
461
462/**
463 *  This function shrink an object class information record.
464 *
465 *  @param[in] information points to an object class information block.
466 */
467void _Objects_Shrink_information(
468  Objects_Information *information
469);
470
471/**
472 *  This function initializes an object class information record.
473 *  SUPPORTS_GLOBAL is TRUE if the object class supports global
474 *  objects, and FALSE otherwise.  Maximum indicates the number
475 *  of objects required in this class and size indicates the size
476 *  in bytes of each control block for this object class.  The
477 *  name length and string designator are also set.  In addition,
478 *  the class may be a task, therefore this information is also included.
479 *
480 *  @param[in] information points to an object class information block.
481 *  @param[in] the_api indicates the API associated with this information block.
482 *  @param[in] the_class indicates the class of object being managed
483 *             by this information block.  It is specific to @a the_api.
484 *  @param[in] maximum is the maximum number of instances of this object
485 *             class which may be concurrently active.
486 *  @param[in] size is the size of the data structure for this class.
487 *  @param[in] is_string is TRUE if this object uses string style names.
488 *  @param[in] maximum_name_length is the maximum length of object names.
489 */
490void _Objects_Initialize_information (
491  Objects_Information *information,
492  Objects_APIs         the_api,
493  uint32_t             the_class,
494  uint32_t             maximum,
495  uint16_t             size,
496  boolean              is_string,
497  uint32_t             maximum_name_length
498#if defined(RTEMS_MULTIPROCESSING)
499  ,
500  boolean              supports_global,
501  Objects_Thread_queue_Extract_callout extract
502#endif
503);
504
505/**
506 *  This function returns the highest numeric value of a valid
507 *  API for the specified @a api.
508 *
509 *  @param[in] api is the API of interest
510 *
511 *  @return A positive integer on success and -1 otherwise.
512 */
513int _Objects_API_maximum_class(
514  uint32_t api
515);
516
517/**
518 *  This function allocates a object control block from
519 *  the inactive chain of free object control blocks.
520 *
521 *  @param[in] information points to an object class information block.
522 */
523Objects_Control *_Objects_Allocate(
524  Objects_Information *information
525);
526
527/**
528 *  This function allocates the object control block
529 *  specified by the index from the inactive chain of
530 *  free object control blocks.
531 *
532 *  @param[in] information points to an object class information block.
533 *  @param[in] index is the index of the object to allocate.
534 *  @param[in] sizeof_control is the size of the object control block.
535 */
536Objects_Control *_Objects_Allocate_by_index(
537  Objects_Information *information,
538  uint16_t             index,
539  uint16_t             sizeof_control
540);
541
542/**
543 *
544 *  This function frees a object control block to the
545 *  inactive chain of free object control blocks.
546 *
547 *  @param[in] information points to an object class information block.
548 *  @param[in] the_object points to the object to deallocate.
549 */
550void _Objects_Free(
551  Objects_Information *information,
552  Objects_Control     *the_object
553);
554
555/**
556 *  This macro is used to build a thirty-two bit style name from
557 *  four characters.  The most significant byte will be the
558 *  character @a _C1.
559 *
560 *  @param[in] _C1 is the first character of the name
561 *  @param[in] _C2 is the second character of the name
562 *  @param[in] _C3 is the third character of the name
563 *  @param[in] _C4 is the fourth character of the name
564 */
565#define  _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
566  ( (uint32_t)(_C1) << 24 | \
567    (uint32_t)(_C2) << 16 | \
568    (uint32_t)(_C3) << 8 | \
569    (uint32_t)(_C4) )
570
571/**
572 *  This function implements the common portion of the object
573 *  identification directives.  This directive returns the object
574 *  id associated with name.  If more than one object of this class
575 *  is named name, then the object to which the id belongs is
576 *  arbitrary.  Node indicates the extent of the search for the
577 *  id of the object named name.  If the object class supports global
578 *  objects, then the search can be limited to a particular node
579 *  or allowed to encompass all nodes.
580 */
581typedef enum {
582  OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL,
583  OBJECTS_INVALID_NAME,
584  OBJECTS_INVALID_ADDRESS,
585  OBJECTS_INVALID_ID,
586  OBJECTS_INVALID_NODE
587} Objects_Name_or_id_lookup_errors;
588
589/**
590 *  This macro defines the first entry in the
591 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
592 */
593#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL
594
595/**
596 *  This macro defines the last entry in the
597 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
598 */
599#define OBJECTS_NAME_ERRORS_LAST  OBJECTS_INVALID_NODE
600
601/**
602 *  This method converts an object name to an Id.  It performs a look up
603 *  using the object information block for this object class.
604 *
605 *  @param[in] information points to an object class information block.
606 *  @param[in] name is the name of the object to find.
607 *  @param[in] node is the set of nodes to search.
608 *  @param[in] id will contain the Id if the search is successful.
609 *
610 *  @return This method returns one of the values from the
611 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
612 *          successful or failure.  On success @a id will contain the Id of
613 *          the requested object.
614 */
615Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
616  Objects_Information *information,
617  uint32_t             name,
618  uint32_t             node,
619  Objects_Id          *id
620);
621
622/**
623 *  This method converts an object name to an Id.  It performs a look up
624 *  using the object information block for this object class.
625 *
626 *  @param[in] information points to an object class information block.
627 *  @param[in] name is the name of the object to find.
628 *  @param[in] id will contain the Id if the search is successful.
629 *
630 *  @return This method returns one of the values from the
631 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
632 *          successful or failure.  On success @a id will contain the Id of
633 *          the requested object.
634 */
635Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string(
636  Objects_Information *information,
637  const char          *name,
638  Objects_Id          *id
639);
640
641/**
642 *  This function implements the common portion of the object Id
643 *  to name directives.  This function returns the name
644 *  associated with object id.
645 *
646 *  @param[in] id is the Id of the object whose name we are locating.
647 *  @param[in] name will contain the name of the object, if found.
648 *
649 *  @return This method returns one of the values from the
650 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
651 *          successful or failure.  On success @a name will contain the name of
652 *          the requested object.
653 *
654 *  @note This function currently does not support string names.
655 */
656Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
657  Objects_Id      id,
658  Objects_Name   *name
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 *
675 *  @return This method returns one of the values from the
676 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
677 *          successful or failure.  On success @a id will contain the Id of
678 *          the requested object.
679 *
680 *  @note _Objects_Get returns with dispatching disabled for
681 *  local and remote objects.  _Objects_Get_isr_disable returns with
682 *  dispatching disabled for remote objects and interrupts for local
683 *  objects.
684 */
685Objects_Control *_Objects_Get (
686  Objects_Information *information,
687  Objects_Id           id,
688  Objects_Locations   *location
689);
690
691/**
692 *  This function maps object ids to object control blocks.
693 *  If id corresponds to a local object, then it returns
694 *  the_object control pointer which maps to id and location
695 *  is set to OBJECTS_LOCAL.  If the object class supports global
696 *  objects and the object id is global and resides on a remote
697 *  node, then location is set to OBJECTS_REMOTE, and the_object
698 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
699 *  and the_object is undefined.
700 *
701 *  @param[in] information points to an object class information block.
702 *  @param[in] id is the Id of the object whose name we are locating.
703 *  @param[in] location will contain an indication of success or failure.
704 *  @param[in] level is the interrupt level being turned.
705 *
706 *  @return This method returns one of the values from the
707 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
708 *          successful or failure.  On success @a name will contain the name of
709 *          the requested object.
710 *
711 *  @note _Objects_Get returns with dispatching disabled for
712 *  local and remote objects.  _Objects_Get_isr_disable returns with
713 *  dispatchng disabled for remote objects and interrupts for local
714 *  objects.
715 */
716Objects_Control *_Objects_Get_isr_disable(
717  Objects_Information *information,
718  Objects_Id           id,
719  Objects_Locations   *location,
720  ISR_Level           *level
721);
722
723/**
724 *  This function maps object index to object control blocks which must.
725 *  be local.  The parameter the_object control pointer which maps to id
726 *  and location is set to OBJECTS_LOCAL.  Otherwise, location is set to
727    OBJECTS_ERROR and the_object is undefined.
728 *
729 *  @param[in] information points to an object class information block.
730 *  @param[in] id is the Id of the object whose name we are locating.
731 *  @param[in] location will contain an indication of success or failure.
732 *
733 *  @return This method returns a pointer to the object associated with ID.
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_by_index (
746  Objects_Information *information,
747  Objects_Id           id,
748  Objects_Locations   *location
749);
750
751/**
752 *  This function maps object ids to object control blocks.
753 *  If id corresponds to a local object, then it returns
754 *  the_object control pointer which maps to id and location
755 *  is set to OBJECTS_LOCAL.  If the object class supports global
756 *  objects and the object id is global and resides on a remote
757 *  node, then location is set to OBJECTS_REMOTE, and the_object
758 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
759 *  and the_object is undefined.
760 *
761 *  @param[in] information points to an object class information block.
762 *  @param[in] id is the Id of the object whose name we are locating.
763 *  @param[in] location will contain an indication of success or failure.
764 *
765 *  @return This method returns one of the values from the
766 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
767 *          successful or failure.  On success @a id will contain the Id of
768 *          the requested object.
769 *
770 *  @note _Objects_Get returns with dispatching disabled for
771 *  local and remote objects.  _Objects_Get_isr_disable returns with
772 *  dispatching disabled for remote objects and interrupts for local
773 *  objects.
774 */
775Objects_Control *_Objects_Get_no_protection(
776  Objects_Information *information,
777  Objects_Id           id,
778  Objects_Locations   *location
779);
780
781/**
782 *  Like @ref _Objects_Get, but is used to find "next" open object.
783 *
784 *  @param[in] information points to an object class information block.
785 *  @param[in] id is the Id of the object whose name we are locating.
786 *  @param[in] location_p will contain an indication of success or failure.
787 *  @param[in] next_id_p is the Id of the next object we will look at.
788 *
789 *  @return This method returns the pointer to the object located or
790 *          NULL on error.
791 */
792Objects_Control *_Objects_Get_next(
793    Objects_Information *information,
794    Objects_Id           id,
795    Objects_Locations   *location_p,
796    Objects_Id          *next_id_p
797);
798
799/**
800 *  This function return the information structure given
801 *  an the API and Class.  This can be done independent of
802 *  the existence of any objects created by the API.
803 *
804 *  @param[in] the_api indicates the API for the information we want
805 *  @param[in] the_class indicates the Class for the information we want
806 *
807 *  @return This method returns a pointer to the Object Information Table
808 *          for the class of objects which corresponds to this object ID.
809 */
810Objects_Information *_Objects_Get_information(
811  Objects_APIs   the_api,
812  uint32_t       the_class
813);
814
815/**
816 *  This function return the information structure given
817 *  an id of an object.
818 *
819 *  @param[in] id is an object ID
820 *
821 *  @return This method returns a pointer to the Object Information Table
822 *          for the class of objects which corresponds to this object ID.
823 */
824Objects_Information *_Objects_Get_information_id(
825  Objects_Id  id
826);
827
828/**
829 *  This method objects the name of an object and returns its name
830 *  in the form of a C string.  It attempts to be careful about
831 *  overflowing the user's string and about returning unprintable characters.
832 *
833 *  @param[in] id is the object to obtain the name of
834 *  @param[in] length indicates the length of the caller's buffer
835 *  @param[in] name points a string which will be filled in.
836 *
837 *  @return This method returns @a name or NULL on error. @a *name will
838 *          contain the name if successful.
839 */
840char *_Objects_Get_name_as_string(
841  Objects_Id   id,
842  size_t       length,
843  char        *name
844);
845
846/**
847 *  This method sets the object name to either a copy of a string
848 *  or up to the first four characters of the string based upon
849 *  whether this object class uses strings for names.
850 *
851 *  @param[in] information points to the object information structure
852 *  @param[in] the_object is the object to operate upon
853 *  @param[in] name is a pointer to the name to use
854 *
855 *  @return If successful, TRUE is returned.  Otherwise FALSE is returned.
856 */
857boolean _Objects_Set_name(
858  Objects_Information *information,
859  Objects_Control     *the_object,
860  const char          *name
861);
862
863/**
864 *  This function removes the_object from the namespace.
865 *
866 *  @param[in] information points to an Object Information Table
867 *  @param[in] the_object is a pointer to an object
868 */
869void _Objects_Namespace_remove(
870  Objects_Information  *information,
871  Objects_Control      *the_object
872);
873
874/**
875 *  This function removes the_object control pointer and object name
876 *  in the Local Pointer and Local Name Tables.
877 *
878 *  @param[in] information points to an Object Information Table
879 *  @param[in] the_object is a pointer to an object
880 */
881void _Objects_Close(
882  Objects_Information  *information,
883  Objects_Control      *the_object
884);
885
886/*
887 *  Pieces of object.inl are promoted out to the user
888 */
889
890#include <rtems/score/object.inl>
891#if defined(RTEMS_MULTIPROCESSING)
892#include <rtems/score/objectmp.h>
893#endif
894
895#ifdef __cplusplus
896}
897#endif
898
899#endif
900/* end of include file */
Note: See TracBrowser for help on using the repository browser.