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

4.115
Last change on this file since c51318a was c51318a, checked in by Ralf Corsepius <ralf.corsepius@…>, on 06/18/10 at 03:58:21

2010-06-18 Ralf Corsépius <ralf.corsepius@…>

  • core/include/rtems/score/object.h: Remove Objects_ITRON_API.
  • Property mode set to 100644
File size: 26.5 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#include <rtems/score/chain.h>
26#include <rtems/score/isr.h>
27
28#if defined(RTEMS_POSIX_API)
29  #define RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES
30#endif
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/**
37 * @defgroup Score SuperCore
38 *
39 * @brief Provides services for all APIs.
40 */
41
42/**
43 * @defgroup ScoreCPU CPU Architecture Support
44 *
45 * @ingroup Score
46 *
47 * @brief Provides CPU architecture dependent services.
48 */
49
50/**
51 *  The following type defines the control block used to manage
52 *  object names.
53 */
54typedef union {
55  #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
56    /** This is a pointer to a string name. */
57    const char *name_p;
58  #endif
59  /** This is the actual 32-bit "raw" integer name. */
60  uint32_t    name_u32;
61} Objects_Name;
62
63/**
64 *  Space for object names is allocated in multiples of this.
65 *
66 *  NOTE:  Must be a power of 2.  Matches the name manipulation routines.
67 */
68#define OBJECTS_NAME_ALIGNMENT     sizeof( uint32_t )
69
70/**
71 *  Functions which compare names are prototyped like this.
72 */
73typedef bool    (*Objects_Name_comparators)(
74  void       * /* name_1 */,
75  void       * /* name_2 */,
76  uint16_t     /* length */
77);
78
79#if defined(RTEMS_USE_16_BIT_OBJECT)
80/**
81 *  The following type defines the control block used to manage
82 *  object IDs.  The format is as follows (0=LSB):
83 *
84 *     Bits  0 ..  7    = index  (up to 254 objects of a type)
85 *     Bits  8 .. 10    = API    (up to 7 API classes)
86 *     Bits 11 .. 15    = class  (up to 31 object types per API)
87 */
88typedef uint16_t   Objects_Id;
89
90/**
91 * This type is used to store the maximum number of allowed objects
92 * of each type.
93 */
94typedef uint8_t    Objects_Maximum;
95
96#define OBJECTS_INDEX_START_BIT  0U
97#define OBJECTS_API_START_BIT    8U
98#define OBJECTS_CLASS_START_BIT 11U
99
100#define OBJECTS_INDEX_MASK      (Objects_Id)0x00ffU
101#define OBJECTS_API_MASK        (Objects_Id)0x0700U
102#define OBJECTS_CLASS_MASK      (Objects_Id)0xF800U
103
104#define OBJECTS_INDEX_VALID_BITS  (Objects_Id)0x00ffU
105#define OBJECTS_API_VALID_BITS    (Objects_Id)0x0007U
106/* OBJECTS_NODE_VALID_BITS should not be used with 16 bit Ids */
107#define OBJECTS_CLASS_VALID_BITS  (Objects_Id)0x001fU
108
109#define OBJECTS_UNLIMITED_OBJECTS 0x8000U
110
111#define OBJECTS_ID_INITIAL_INDEX  (0)
112#define OBJECTS_ID_FINAL_INDEX    (0xff)
113
114#else
115/**
116 *  The following type defines the control block used to manage
117 *  object IDs.  The format is as follows (0=LSB):
118 *
119 *     Bits  0 .. 15    = index  (up to 65535 objects of a type)
120 *     Bits 16 .. 23    = node   (up to 255 nodes)
121 *     Bits 24 .. 26    = API    (up to 7 API classes)
122 *     Bits 27 .. 31    = class  (up to 31 object types per API)
123 */
124typedef uint32_t   Objects_Id;
125
126/**
127 * This type is used to store the maximum number of allowed objects
128 * of each type.
129 */
130typedef uint16_t   Objects_Maximum;
131
132/**
133 *  This is the bit position of the starting bit of the index portion of
134 *  the object Id.
135 */
136#define OBJECTS_INDEX_START_BIT  0U
137
138
139/**
140 *  This is the bit position of the starting bit of the node portion of
141 *  the object Id.
142 */
143#define OBJECTS_NODE_START_BIT  16U
144
145/**
146 *  This is the bit position of the starting bit of the API portion of
147 *  the object Id.
148 */
149#define OBJECTS_API_START_BIT   24U
150
151/**
152 *  This is the bit position of the starting bit of the class portion of
153 *  the object Id.
154 */
155#define OBJECTS_CLASS_START_BIT 27U
156
157/**
158 *  This mask is used to extract the index portion of an object Id.
159 */
160#define OBJECTS_INDEX_MASK      (Objects_Id)0x0000ffffU
161
162/**
163 *  This mask is used to extract the node portion of an object Id.
164 */
165#define OBJECTS_NODE_MASK       (Objects_Id)0x00ff0000U
166
167/**
168 *  This mask is used to extract the API portion of an object Id.
169 */
170#define OBJECTS_API_MASK        (Objects_Id)0x07000000U
171
172/**
173 *  This mask is used to extract the class portion of an object Id.
174 */
175#define OBJECTS_CLASS_MASK      (Objects_Id)0xf8000000U
176
177/**
178 *  This mask represents the bits that is used to ensure no extra bits
179 *  are set after shifting to extract the index portion of an object Id.
180 */
181#define OBJECTS_INDEX_VALID_BITS  (Objects_Id)0x0000ffffU
182
183/**
184 *  This mask represents the bits that is used to ensure no extra bits
185 *  are set after shifting to extract the node portion of an object Id.
186 */
187#define OBJECTS_NODE_VALID_BITS   (Objects_Id)0x000000ffU
188
189/**
190 *  This mask represents the bits that is used to ensure no extra bits
191 *  are set after shifting to extract the API portion of an object Id.
192 */
193#define OBJECTS_API_VALID_BITS    (Objects_Id)0x00000007U
194
195/**
196 *  This mask represents the bits that is used to ensure no extra bits
197 *  are set after shifting to extract the class portion of an object Id.
198 */
199#define OBJECTS_CLASS_VALID_BITS  (Objects_Id)0x0000001fU
200
201/**
202 *  Mask to enable unlimited objects.  This is used in the configuration
203 *  table when specifying the number of configured objects.
204 */
205#define OBJECTS_UNLIMITED_OBJECTS 0x80000000U
206
207/**
208 *  This is the lowest value for the index portion of an object Id.
209 */
210#define OBJECTS_ID_INITIAL_INDEX  (0)
211
212/**
213 *  This is the highest value for the index portion of an object Id.
214 */
215#define OBJECTS_ID_FINAL_INDEX    (0xffffU)
216#endif
217
218/**
219 *  This enumerated type is used in the class field of the object ID.
220 */
221typedef enum {
222  OBJECTS_NO_API       = 0,
223  OBJECTS_INTERNAL_API = 1,
224  OBJECTS_CLASSIC_API  = 2,
225  OBJECTS_POSIX_API    = 3,
226  OBJECTS_ITRON_API    = 4
227} Objects_APIs;
228
229/** This macro is used to generically specify the last API index. */
230#define OBJECTS_APIS_LAST OBJECTS_ITRON_API
231
232/**
233 *  This enumerated type is used in the class field of the object ID
234 *  for RTEMS internal object classes.
235 */
236typedef enum {
237  OBJECTS_INTERNAL_NO_CLASS =  0,
238  OBJECTS_INTERNAL_THREADS  =  1,
239  OBJECTS_INTERNAL_MUTEXES  =  2
240} Objects_Internal_API;
241
242/** This macro is used to generically specify the last API index. */
243#define OBJECTS_INTERNAL_CLASSES_LAST OBJECTS_INTERNAL_MUTEXES
244
245/**
246 *  This enumerated type is used in the class field of the object ID
247 *  for the RTEMS Classic API.
248 */
249typedef enum {
250  OBJECTS_CLASSIC_NO_CLASS     = 0,
251  OBJECTS_RTEMS_TASKS          = 1,
252  OBJECTS_RTEMS_TIMERS         = 2,
253  OBJECTS_RTEMS_SEMAPHORES     = 3,
254  OBJECTS_RTEMS_MESSAGE_QUEUES = 4,
255  OBJECTS_RTEMS_PARTITIONS     = 5,
256  OBJECTS_RTEMS_REGIONS        = 6,
257  OBJECTS_RTEMS_PORTS          = 7,
258  OBJECTS_RTEMS_PERIODS        = 8,
259  OBJECTS_RTEMS_EXTENSIONS     = 9,
260  OBJECTS_RTEMS_BARRIERS       = 10
261} Objects_Classic_API;
262
263/** This macro is used to generically specify the last API index. */
264#define OBJECTS_RTEMS_CLASSES_LAST OBJECTS_RTEMS_BARRIERS
265
266/**
267 *  This enumerated type is used in the class field of the object ID
268 *  for the POSIX API.
269 */
270typedef enum {
271  OBJECTS_POSIX_NO_CLASS            = 0,
272  OBJECTS_POSIX_THREADS             = 1,
273  OBJECTS_POSIX_KEYS                = 2,
274  OBJECTS_POSIX_INTERRUPTS          = 3,
275  OBJECTS_POSIX_MESSAGE_QUEUE_FDS   = 4,
276  OBJECTS_POSIX_MESSAGE_QUEUES      = 5,
277  OBJECTS_POSIX_MUTEXES             = 6,
278  OBJECTS_POSIX_SEMAPHORES          = 7,
279  OBJECTS_POSIX_CONDITION_VARIABLES = 8,
280  OBJECTS_POSIX_TIMERS              = 9,
281  OBJECTS_POSIX_BARRIERS            = 10,
282  OBJECTS_POSIX_SPINLOCKS           = 11,
283  OBJECTS_POSIX_RWLOCKS             = 12
284} Objects_POSIX_API;
285
286/** This macro is used to generically specify the last API index. */
287#define OBJECTS_POSIX_CLASSES_LAST OBJECTS_POSIX_RWLOCKS
288
289/**
290 *  This enumerated type lists the locations which may be returned
291 *  by _Objects_Get.  These codes indicate the success of locating
292 *  an object with the specified ID.
293 */
294typedef enum {
295#if defined(RTEMS_MULTIPROCESSING)
296  OBJECTS_REMOTE = 2,         /* object is remote */
297#endif
298  OBJECTS_LOCAL  = 0,         /* object is local */
299  OBJECTS_ERROR  = 1          /* id was invalid */
300} Objects_Locations;
301
302/**
303 *  The following type defines the callout used when a local task
304 *  is extracted from a remote thread queue (i.e. it's proxy must
305 *  extracted from the remote queue).
306 */
307typedef void ( *Objects_Thread_queue_Extract_callout )( void * );
308
309/**
310 *  The following defines the Object Control Block used to manage
311 *  each object local to this node.
312 */
313typedef struct {
314  /** This is the chain node portion of an object. */
315  Chain_Node     Node;
316  /** This is the object's ID. */
317  Objects_Id     id;
318  /** This is the object's name. */
319  Objects_Name   name;
320} Objects_Control;
321
322/**
323 *  The following defines the structure for the information used to
324 *  manage each class of objects.
325 */
326typedef struct {
327  /** This field indicates the API of this object class. */
328  Objects_APIs      the_api;
329  /** This is the class of this object set. */
330  uint16_t          the_class;
331  /** This is the minimum valid id of this object class. */
332  Objects_Id        minimum_id;
333  /** This is the maximum valid id of this object class. */
334  Objects_Id        maximum_id;
335  /** This is the maximum number of objects in this class. */
336  Objects_Maximum   maximum;
337  /** This is the true if unlimited objects in this class. */
338  bool              auto_extend;
339  /** This is the number of objects in a block. */
340  Objects_Maximum   allocation_size;
341  /** This is the size in bytes of each object instance. */
342  size_t            size;
343  /** This points to the table of local objects. */
344  Objects_Control **local_table;
345  /** This is the chain of inactive control blocks. */
346  Chain_Control     Inactive;
347  /** This is the number of objects on the Inactive list. */
348  Objects_Maximum   inactive;
349  /** This is the number of inactive objects per block. */
350  uint32_t         *inactive_per_block;
351  /** This is a table to the chain of inactive object memory blocks. */
352  void            **object_blocks;
353  #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
354    /** This is true if names are strings. */
355    bool              is_string;
356  #endif
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 *  No object can have this ID.
395 */
396#define OBJECTS_ID_NONE 0
397
398/**
399 *  The following defines the constant which may be used
400 *  with _Objects_Get to manipulate the calling task.
401 */
402#define OBJECTS_ID_OF_SELF ((Objects_Id) 0)
403
404/**
405 *  The following constant is used to specify that a name to ID search
406 *  should search through all nodes.
407 */
408#define OBJECTS_SEARCH_ALL_NODES   0
409
410/**
411 *  The following constant is used to specify that a name to ID search
412 *  should search through all nodes except the current node.
413 */
414#define OBJECTS_SEARCH_OTHER_NODES 0x7FFFFFFE
415
416/**
417 *  The following constant is used to specify that a name to ID search
418 *  should search only on this node.
419 */
420#define OBJECTS_SEARCH_LOCAL_NODE  0x7FFFFFFF
421
422/**
423 *  The following constant is used to specify that a name to ID search
424 *  is being asked for the ID of the currently executing task.
425 */
426#define OBJECTS_WHO_AM_I           0
427
428/**
429 *  This macros calculates the lowest ID for the specified api, class,
430 *  and node.
431 */
432#define OBJECTS_ID_INITIAL(_api, _class, _node) \
433  _Objects_Build_id( (_api), (_class), (_node), OBJECTS_ID_INITIAL_INDEX )
434
435/**
436 *  This macro specifies the highest object ID value
437 */
438#define OBJECTS_ID_FINAL           ((Objects_Id)~0)
439
440/**
441 *  This function extends an object class information record.
442 *
443 *  @param[in] information points to an object class information block.
444 */
445void _Objects_Extend_information(
446  Objects_Information *information
447);
448
449/**
450 *  This function shrink an object class information record.
451 *
452 *  @param[in] information points to an object class information block.
453 */
454void _Objects_Shrink_information(
455  Objects_Information *information
456);
457
458/**
459 *  This function initializes an object class information record.
460 *  SUPPORTS_GLOBAL is true if the object class supports global
461 *  objects, and false otherwise.  Maximum indicates the number
462 *  of objects required in this class and size indicates the size
463 *  in bytes of each control block for this object class.  The
464 *  name length and string designator are also set.  In addition,
465 *  the class may be a task, therefore this information is also included.
466 *
467 *  @param[in] information points to an object class information block.
468 *  @param[in] the_api indicates the API associated with this information block.
469 *  @param[in] the_class indicates the class of object being managed
470 *             by this information block.  It is specific to @a the_api.
471 *  @param[in] maximum is the maximum number of instances of this object
472 *             class which may be concurrently active.
473 *  @param[in] size is the size of the data structure for this class.
474 *  @param[in] is_string is true if this object uses string style names.
475 *  @param[in] maximum_name_length is the maximum length of object names.
476 */
477void _Objects_Initialize_information (
478  Objects_Information *information,
479  Objects_APIs         the_api,
480  uint32_t             the_class,
481  uint32_t             maximum,
482  uint16_t             size,
483  bool                 is_string,
484  uint32_t             maximum_name_length
485#if defined(RTEMS_MULTIPROCESSING)
486  ,
487  bool                 supports_global,
488  Objects_Thread_queue_Extract_callout extract
489#endif
490);
491
492/**
493 *  This function returns the highest numeric value of a valid
494 *  API for the specified @a api.
495 *
496 *  @param[in] api is the API of interest
497 *
498 *  @return A positive integer on success and 0 otherwise.
499 */
500unsigned int _Objects_API_maximum_class(
501  uint32_t api
502);
503
504/**
505 *  This function allocates a object control block from
506 *  the inactive chain of free object control blocks.
507 *
508 *  @param[in] information points to an object class information block.
509 */
510Objects_Control *_Objects_Allocate(
511  Objects_Information *information
512);
513
514/**
515 *
516 *  This function frees a object control block to the
517 *  inactive chain of free object control blocks.
518 *
519 *  @param[in] information points to an object class information block.
520 *  @param[in] the_object points to the object to deallocate.
521 */
522void _Objects_Free(
523  Objects_Information *information,
524  Objects_Control     *the_object
525);
526
527/**
528 *  This macro is used to build a thirty-two bit style name from
529 *  four characters.  The most significant byte will be the
530 *  character @a _C1.
531 *
532 *  @param[in] _C1 is the first character of the name
533 *  @param[in] _C2 is the second character of the name
534 *  @param[in] _C3 is the third character of the name
535 *  @param[in] _C4 is the fourth character of the name
536 */
537#define  _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
538  ( (uint32_t)(_C1) << 24 | \
539    (uint32_t)(_C2) << 16 | \
540    (uint32_t)(_C3) << 8 | \
541    (uint32_t)(_C4) )
542
543/**
544 *  This function implements the common portion of the object
545 *  identification directives.  This directive returns the object
546 *  id associated with name.  If more than one object of this class
547 *  is named name, then the object to which the id belongs is
548 *  arbitrary.  Node indicates the extent of the search for the
549 *  id of the object named name.  If the object class supports global
550 *  objects, then the search can be limited to a particular node
551 *  or allowed to encompass all nodes.
552 */
553typedef enum {
554  OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL,
555  OBJECTS_INVALID_NAME,
556  OBJECTS_INVALID_ADDRESS,
557  OBJECTS_INVALID_ID,
558  OBJECTS_INVALID_NODE
559} Objects_Name_or_id_lookup_errors;
560
561/**
562 *  This macro defines the first entry in the
563 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
564 */
565#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL
566
567/**
568 *  This macro defines the last entry in the
569 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
570 */
571#define OBJECTS_NAME_ERRORS_LAST  OBJECTS_INVALID_NODE
572
573/**
574 *  This method converts an object name to an Id.  It performs a look up
575 *  using the object information block for this object class.
576 *
577 *  @param[in] information points to an object class information block.
578 *  @param[in] name is the name of the object to find.
579 *  @param[in] node is the set of nodes to search.
580 *  @param[in] id will contain the Id if the search is successful.
581 *
582 *  @return This method returns one of the values from the
583 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
584 *          successful or failure.  On success @a id will contain the Id of
585 *          the requested object.
586 */
587Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
588  Objects_Information *information,
589  uint32_t             name,
590  uint32_t             node,
591  Objects_Id          *id
592);
593
594#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
595/**
596 *  This method converts an object name to an Id.  It performs a look up
597 *  using the object information block for this object class.
598 *
599 *  @param[in] information points to an object class information block.
600 *  @param[in] name is the name of the object to find.
601 *  @param[in] id will contain the Id if the search is successful.
602 *
603 *  @return This method returns one of the values from the
604 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
605 *          successful or failure.  On success @a id will contain the Id of
606 *          the requested object.
607 */
608Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string(
609  Objects_Information *information,
610  const char          *name,
611  Objects_Id          *id
612);
613#endif
614
615/**
616 *  This function implements the common portion of the object Id
617 *  to name directives.  This function returns the name
618 *  associated with object id.
619 *
620 *  @param[in] id is the Id of the object whose name we are locating.
621 *  @param[in] name will contain the name of the object, if found.
622 *
623 *  @return This method returns one of the values from the
624 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
625 *          successful or failure.  On success @a name will contain the name of
626 *          the requested object.
627 *
628 *  @note This function currently does not support string names.
629 */
630Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
631  Objects_Id      id,
632  Objects_Name   *name
633);
634
635/**
636 *  This function maps object ids to object control blocks.
637 *  If id corresponds to a local object, then it returns
638 *  the_object control pointer which maps to id and location
639 *  is set to OBJECTS_LOCAL.  If the object class supports global
640 *  objects and the object id is global and resides on a remote
641 *  node, then location is set to OBJECTS_REMOTE, and the_object
642 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
643 *  and the_object is undefined.
644 *
645 *  @param[in] information points to an object class information block.
646 *  @param[in] id is the Id of the object whose name we are locating.
647 *  @param[in] location will contain an indication of success or failure.
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 id will contain the Id of
652 *          the requested object.
653 *
654 *  @note _Objects_Get returns with dispatching disabled for
655 *  local and remote objects.  _Objects_Get_isr_disable returns with
656 *  dispatching disabled for remote objects and interrupts for local
657 *  objects.
658 */
659Objects_Control *_Objects_Get (
660  Objects_Information *information,
661  Objects_Id           id,
662  Objects_Locations   *location
663);
664
665/**
666 *  This function maps object ids to object control blocks.
667 *  If id corresponds to a local object, then it returns
668 *  the_object control pointer which maps to id and location
669 *  is set to OBJECTS_LOCAL.  If the object class supports global
670 *  objects and the object id is global and resides on a remote
671 *  node, then location is set to OBJECTS_REMOTE, and the_object
672 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
673 *  and the_object is undefined.
674 *
675 *  @param[in] information points to an object class information block.
676 *  @param[in] id is the Id of the object whose name we are locating.
677 *  @param[in] location will contain an indication of success or failure.
678 *  @param[in] level is the interrupt level being turned.
679 *
680 *  @return This method returns one of the values from the
681 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
682 *          successful or failure.  On success @a name will contain the name of
683 *          the requested object.
684 *
685 *  @note _Objects_Get returns with dispatching disabled for
686 *  local and remote objects.  _Objects_Get_isr_disable returns with
687 *  dispatchng disabled for remote objects and interrupts for local
688 *  objects.
689 */
690Objects_Control *_Objects_Get_isr_disable(
691  Objects_Information *information,
692  Objects_Id           id,
693  Objects_Locations   *location,
694  ISR_Level           *level
695);
696
697/**
698 *  This function maps object ids to object control blocks.
699 *  If id corresponds to a local object, then it returns
700 *  the_object control pointer which maps to id and location
701 *  is set to OBJECTS_LOCAL.  If the object class supports global
702 *  objects and the object id is global and resides on a remote
703 *  node, then location is set to OBJECTS_REMOTE, and the_object
704 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
705 *  and the_object is undefined.
706 *
707 *  @param[in] information points to an object class information block.
708 *  @param[in] id is the Id of the object whose name we are locating.
709 *  @param[in] location will contain an indication of success or failure.
710 *
711 *  @return This method returns one of the values from the
712 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
713 *          successful or failure.  On success @a id will contain the Id of
714 *          the requested object.
715 *
716 *  @note _Objects_Get returns with dispatching disabled for
717 *  local and remote objects.  _Objects_Get_isr_disable returns with
718 *  dispatching disabled for remote objects and interrupts for local
719 *  objects.
720 */
721Objects_Control *_Objects_Get_no_protection(
722  Objects_Information *information,
723  Objects_Id           id,
724  Objects_Locations   *location
725);
726
727/**
728 *  Like @ref _Objects_Get, but is used to find "next" open object.
729 *
730 *  @param[in] information points to an object class information block.
731 *  @param[in] id is the Id of the object whose name we are locating.
732 *  @param[in] location_p will contain an indication of success or failure.
733 *  @param[in] next_id_p is the Id of the next object we will look at.
734 *
735 *  @return This method returns the pointer to the object located or
736 *          NULL on error.
737 */
738Objects_Control *_Objects_Get_next(
739    Objects_Information *information,
740    Objects_Id           id,
741    Objects_Locations   *location_p,
742    Objects_Id          *next_id_p
743);
744
745/**
746 *  This function return the information structure given
747 *  an the API and Class.  This can be done independent of
748 *  the existence of any objects created by the API.
749 *
750 *  @param[in] the_api indicates the API for the information we want
751 *  @param[in] the_class indicates the Class for the information we want
752 *
753 *  @return This method returns a pointer to the Object Information Table
754 *          for the class of objects which corresponds to this object ID.
755 */
756Objects_Information *_Objects_Get_information(
757  Objects_APIs   the_api,
758  uint32_t       the_class
759);
760
761/**
762 *  This function return the information structure given
763 *  an id of an object.
764 *
765 *  @param[in] id is an object ID
766 *
767 *  @return This method returns a pointer to the Object Information Table
768 *          for the class of objects which corresponds to this object ID.
769 */
770Objects_Information *_Objects_Get_information_id(
771  Objects_Id  id
772);
773
774/**
775 *  This method objects the name of an object and returns its name
776 *  in the form of a C string.  It attempts to be careful about
777 *  overflowing the user's string and about returning unprintable characters.
778 *
779 *  @param[in] id is the object to obtain the name of
780 *  @param[in] length indicates the length of the caller's buffer
781 *  @param[in] name points a string which will be filled in.
782 *
783 *  @return This method returns @a name or NULL on error. @a *name will
784 *          contain the name if successful.
785 */
786char *_Objects_Get_name_as_string(
787  Objects_Id   id,
788  size_t       length,
789  char        *name
790);
791
792/**
793 *  This method sets the object name to either a copy of a string
794 *  or up to the first four characters of the string based upon
795 *  whether this object class uses strings for names.
796 *
797 *  @param[in] information points to the object information structure
798 *  @param[in] the_object is the object to operate upon
799 *  @param[in] name is a pointer to the name to use
800 *
801 *  @return If successful, true is returned.  Otherwise false is returned.
802 */
803bool _Objects_Set_name(
804  Objects_Information *information,
805  Objects_Control     *the_object,
806  const char          *name
807);
808
809/**
810 *  This function removes the_object from the namespace.
811 *
812 *  @param[in] information points to an Object Information Table
813 *  @param[in] the_object is a pointer to an object
814 */
815void _Objects_Namespace_remove(
816  Objects_Information  *information,
817  Objects_Control      *the_object
818);
819
820/**
821 *  This function removes the_object control pointer and object name
822 *  in the Local Pointer and Local Name Tables.
823 *
824 *  @param[in] information points to an Object Information Table
825 *  @param[in] the_object is a pointer to an object
826 */
827void _Objects_Close(
828  Objects_Information  *information,
829  Objects_Control      *the_object
830);
831
832/*
833 *  Pieces of object.inl are promoted out to the user
834 */
835
836#include <rtems/score/object.inl>
837#if defined(RTEMS_MULTIPROCESSING)
838#include <rtems/score/objectmp.h>
839#endif
840
841#ifdef __cplusplus
842}
843#endif
844
845#endif
846/* end of include file */
Note: See TracBrowser for help on using the repository browser.