source: rtems/cpukit/score/include/rtems/score/object.h @ 5a58b1e

4.115
Last change on this file since 5a58b1e was 5a58b1e, checked in by Daniel Georgiev <daniel.georgiev95@…>, on 12/01/12 at 14:53:45

score misc: Score misc: Clean up Doxygen #11 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/8013204

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