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

4.115
Last change on this file since e655f7e was e655f7e, checked in by Alex Ivanov <alexivanov97@…>, on 11/29/12 at 18:39:19

score misc: Score misc: Clean up Doxygen #5

  • Property mode set to 100644
File size: 27.0 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
140/**
141 *  This is the bit position of the starting bit of the node portion of
142 *  the object Id.
143 */
144#define OBJECTS_NODE_START_BIT  16U
145
146/**
147 *  This is the bit position of the starting bit of the API portion of
148 *  the object Id.
149 */
150#define OBJECTS_API_START_BIT   24U
151
152/**
153 *  This is the bit position of the starting bit of the class portion of
154 *  the object Id.
155 */
156#define OBJECTS_CLASS_START_BIT 27U
157
158/**
159 *  This mask is used to extract the index portion of an object Id.
160 */
161#define OBJECTS_INDEX_MASK      (Objects_Id)0x0000ffffU
162
163/**
164 *  This mask is used to extract the node portion of an object Id.
165 */
166#define OBJECTS_NODE_MASK       (Objects_Id)0x00ff0000U
167
168/**
169 *  This mask is used to extract the API portion of an object Id.
170 */
171#define OBJECTS_API_MASK        (Objects_Id)0x07000000U
172
173/**
174 *  This mask is used to extract the class portion of an object Id.
175 */
176#define OBJECTS_CLASS_MASK      (Objects_Id)0xf8000000U
177
178/**
179 *  This mask represents the bits that is used to ensure no extra bits
180 *  are set after shifting to extract the index portion of an object Id.
181 */
182#define OBJECTS_INDEX_VALID_BITS  (Objects_Id)0x0000ffffU
183
184/**
185 *  This mask represents the bits that is used to ensure no extra bits
186 *  are set after shifting to extract the node portion of an object Id.
187 */
188#define OBJECTS_NODE_VALID_BITS   (Objects_Id)0x000000ffU
189
190/**
191 *  This mask represents the bits that is used to ensure no extra bits
192 *  are set after shifting to extract the API portion of an object Id.
193 */
194#define OBJECTS_API_VALID_BITS    (Objects_Id)0x00000007U
195
196/**
197 *  This mask represents the bits that is used to ensure no extra bits
198 *  are set after shifting to extract the class portion of an object Id.
199 */
200#define OBJECTS_CLASS_VALID_BITS  (Objects_Id)0x0000001fU
201
202/**
203 *  Mask to enable unlimited objects.  This is used in the configuration
204 *  table when specifying the number of configured objects.
205 */
206#define OBJECTS_UNLIMITED_OBJECTS 0x80000000U
207
208/**
209 *  This is the lowest value for the index portion of an object Id.
210 */
211#define OBJECTS_ID_INITIAL_INDEX  (0)
212
213/**
214 *  This is the highest value for the index portion of an object Id.
215 */
216#define OBJECTS_ID_FINAL_INDEX    (0xffffU)
217#endif
218
219/**
220 *  This enumerated type is used in the class field of the object ID.
221 */
222typedef enum {
223  OBJECTS_NO_API       = 0,
224  OBJECTS_INTERNAL_API = 1,
225  OBJECTS_CLASSIC_API  = 2,
226  OBJECTS_POSIX_API    = 3
227} Objects_APIs;
228
229/** This macro is used to generically specify the last API index. */
230#define OBJECTS_APIS_LAST OBJECTS_POSIX_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 *  @brief Shrink an object class information record
451 *
452 *  This function shrink an object class information record.
453 *  The object's name and object space are released. The local_table
454 *  etc block does not shrink. The InActive list needs to be scanned
455 *  to find the objects are remove them.
456 * 
457 *  @param[in] information points to an object class information block.
458 */
459void _Objects_Shrink_information(
460  Objects_Information *information
461);
462
463/**
464 *  @brief Initialize object Information
465 *
466 *  This function initializes an object class information record.
467 *  SUPPORTS_GLOBAL is true if the object class supports global
468 *  objects, and false otherwise.  Maximum indicates the number
469 *  of objects required in this class and size indicates the size
470 *  in bytes of each control block for this object class.  The
471 *  name length and string designator are also set.  In addition,
472 *  the class may be a task, therefore this information is also included.
473 *
474 *  @param[in] information points to an object class information block.
475 *  @param[in] the_api indicates the API associated with this information block.
476 *  @param[in] the_class indicates the class of object being managed
477 *             by this information block.  It is specific to @a the_api.
478 *  @param[in] maximum is the maximum number of instances of this object
479 *             class which may be concurrently active.
480 *  @param[in] size is the size of the data structure for this class.
481 *  @param[in] is_string is true if this object uses string style names.
482 *  @param[in] maximum_name_length is the maximum length of object names.
483 */
484void _Objects_Initialize_information (
485  Objects_Information *information,
486  Objects_APIs         the_api,
487  uint16_t             the_class,
488  uint32_t             maximum,
489  uint16_t             size,
490  bool                 is_string,
491  uint32_t             maximum_name_length
492#if defined(RTEMS_MULTIPROCESSING)
493  ,
494  bool                 supports_global,
495  Objects_Thread_queue_Extract_callout extract
496#endif
497);
498
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 *  This function allocates a object control block from
513 *  the inactive chain of free object control blocks.
514 *
515 *  @param[in] information points to an object class information block.
516 */
517Objects_Control *_Objects_Allocate(
518  Objects_Information *information
519);
520
521/**
522 *
523 *  This function frees a object control block to the
524 *  inactive chain of free object control blocks.
525 *
526 *  @param[in] information points to an object class information block.
527 *  @param[in] the_object points to the object to deallocate.
528 */
529void _Objects_Free(
530  Objects_Information *information,
531  Objects_Control     *the_object
532);
533
534/**
535 *  This macro is used to build a thirty-two bit style name from
536 *  four characters.  The most significant byte will be the
537 *  character @a _C1.
538 *
539 *  @param[in] _C1 is the first character of the name
540 *  @param[in] _C2 is the second character of the name
541 *  @param[in] _C3 is the third character of the name
542 *  @param[in] _C4 is the fourth character of the name
543 */
544#define  _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
545  ( (uint32_t)(_C1) << 24 | \
546    (uint32_t)(_C2) << 16 | \
547    (uint32_t)(_C3) << 8 | \
548    (uint32_t)(_C4) )
549
550/**
551 *  This function implements the common portion of the object
552 *  identification directives.  This directive returns the object
553 *  id associated with name.  If more than one object of this class
554 *  is named name, then the object to which the id belongs is
555 *  arbitrary.  Node indicates the extent of the search for the
556 *  id of the object named name.  If the object class supports global
557 *  objects, then the search can be limited to a particular node
558 *  or allowed to encompass all nodes.
559 */
560typedef enum {
561  OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL,
562  OBJECTS_INVALID_NAME,
563  OBJECTS_INVALID_ADDRESS,
564  OBJECTS_INVALID_ID,
565  OBJECTS_INVALID_NODE
566} Objects_Name_or_id_lookup_errors;
567
568/**
569 *  This macro defines the first entry in the
570 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
571 */
572#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL
573
574/**
575 *  This macro defines the last entry in the
576 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
577 */
578#define OBJECTS_NAME_ERRORS_LAST  OBJECTS_INVALID_NODE
579
580/**
581 *  This method converts an object name to an Id.  It performs a look up
582 *  using the object information block for this object class.
583 *
584 *  @param[in] information points to an object class information block.
585 *  @param[in] name is the name of the object to find.
586 *  @param[in] node is the set of nodes to search.
587 *  @param[in] id will contain the Id if the search is successful.
588 *
589 *  @return This method returns one of the values from the
590 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
591 *          successful or failure.  On success @a id will contain the Id of
592 *          the requested object.
593 */
594Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
595  Objects_Information *information,
596  uint32_t             name,
597  uint32_t             node,
598  Objects_Id          *id
599);
600
601#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
602/**
603 *  This method converts an object name to an Id.  It performs a look up
604 *  using the object information block for this object class.
605 *
606 *  @param[in] information points to an object class information block.
607 *  @param[in] name is the name of the object to find.
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_string(
616  Objects_Information *information,
617  const char          *name,
618  Objects_Id          *id
619);
620#endif
621
622/**
623 *  This function implements the common portion of the object Id
624 *  to name directives.  This function returns the name
625 *  associated with object id.
626 *
627 *  @param[in] id is the Id of the object whose name we are locating.
628 *  @param[in] name will contain the name of the object, if found.
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 name will contain the name of
633 *          the requested object.
634 *
635 *  @note This function currently does not support string names.
636 */
637Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
638  Objects_Id      id,
639  Objects_Name   *name
640);
641
642/**
643 *  This function maps object ids to object control blocks.
644 *  If id corresponds to a local object, then it returns
645 *  the_object control pointer which maps to id and location
646 *  is set to OBJECTS_LOCAL.  If the object class supports global
647 *  objects and the object id is global and resides on a remote
648 *  node, then location is set to OBJECTS_REMOTE, and the_object
649 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
650 *  and the_object is undefined.
651 *
652 *  @param[in] information points to an object class information block.
653 *  @param[in] id is the Id of the object whose name we are locating.
654 *  @param[in] location will contain an indication of success or failure.
655 *
656 *  @return This method returns one of the values from the
657 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
658 *          successful or failure.  On success @a id will contain the Id of
659 *          the requested object.
660 *
661 *  @note _Objects_Get returns with dispatching disabled for
662 *  local and remote objects.  _Objects_Get_isr_disable returns with
663 *  dispatching disabled for remote objects and interrupts for local
664 *  objects.
665 */
666Objects_Control *_Objects_Get (
667  Objects_Information *information,
668  Objects_Id           id,
669  Objects_Locations   *location
670);
671
672/**
673 *  This function maps object ids to object control blocks.
674 *  If id corresponds to a local object, then it returns
675 *  the_object control pointer which maps to id and location
676 *  is set to OBJECTS_LOCAL.  If the object class supports global
677 *  objects and the object id is global and resides on a remote
678 *  node, then location is set to OBJECTS_REMOTE, and the_object
679 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
680 *  and the_object is undefined.
681 *
682 *  @param[in] information points to an object class information block.
683 *  @param[in] id is the Id of the object whose name we are locating.
684 *  @param[in] location will contain an indication of success or failure.
685 *  @param[in] level is the interrupt level being turned.
686 *
687 *  @return This method returns one of the values from the
688 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
689 *          successful or failure.  On success @a name will contain the name of
690 *          the requested object.
691 *
692 *  @note _Objects_Get returns with dispatching disabled for
693 *  local and remote objects.  _Objects_Get_isr_disable returns with
694 *  dispatchng disabled for remote objects and interrupts for local
695 *  objects.
696 */
697Objects_Control *_Objects_Get_isr_disable(
698  Objects_Information *information,
699  Objects_Id           id,
700  Objects_Locations   *location,
701  ISR_Level           *level
702);
703
704/**
705 *  @brief  Get No protection Object
706 *
707 *  This function maps object ids to object control blocks.
708 *  If id corresponds to a local object, then it returns
709 *  the_object control pointer which maps to id and location
710 *  is set to OBJECTS_LOCAL.  If the object class supports global
711 *  objects and the object id is global and resides on a remote
712 *  node, then location is set to OBJECTS_REMOTE, and the_object
713 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
714 *  and the_object is undefined.
715 *
716 *  @param[in] information points to an object class information block.
717 *  @param[in] id is the Id of the object whose name we are locating.
718 *  @param[in] location will contain an indication of success or failure.
719 *
720 *  @return This method returns one of the values from the
721 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
722 *          successful or failure.  On success @a id will contain the Id of
723 *          the requested object.
724 *
725 *  @note _Objects_Get returns with dispatching disabled for
726 *  local and remote objects.  _Objects_Get_isr_disable returns with
727 *  dispatching disabled for remote objects and interrupts for local
728 *  objects.
729 */
730Objects_Control *_Objects_Get_no_protection(
731  Objects_Information *information,
732  Objects_Id           id,
733  Objects_Locations   *location
734);
735
736/**
737 *  Like @ref _Objects_Get, but is used to find "next" open object.
738 *
739 *  @param[in] information points to an object class information block.
740 *  @param[in] id is the Id of the object whose name we are locating.
741 *  @param[in] location_p will contain an indication of success or failure.
742 *  @param[in] next_id_p is the Id of the next object we will look at.
743 *
744 *  @return This method returns the pointer to the object located or
745 *          NULL on error.
746 */
747Objects_Control *_Objects_Get_next(
748    Objects_Information *information,
749    Objects_Id           id,
750    Objects_Locations   *location_p,
751    Objects_Id          *next_id_p
752);
753
754/**
755 *  @brief Get Object Information
756 *
757 *  This function return the information structure given
758 *  an the API and Class.  This can be done independent of
759 *  the existence of any objects created by the API.
760 *
761 *  @param[in] the_api indicates the API for the information we want
762 *  @param[in] the_class indicates the Class for the information we want
763 *
764 *  @return This method returns a pointer to the Object Information Table
765 *          for the class of objects which corresponds to this object ID.
766 */
767Objects_Information *_Objects_Get_information(
768  Objects_APIs   the_api,
769  uint16_t       the_class
770);
771
772/**
773 *  This function return the information structure given
774 *  an id of an object.
775 *
776 *  @param[in] id is an object ID
777 *
778 *  @return This method returns a pointer to the Object Information Table
779 *          for the class of objects which corresponds to this object ID.
780 */
781Objects_Information *_Objects_Get_information_id(
782  Objects_Id  id
783);
784
785/**
786 *  @brief _Objects_Get_name_as_string
787 * 
788 *  This method objects the name of an object and returns its name
789 *  in the form of a C string.  It attempts to be careful about
790 *  overflowing the user's string and about returning unprintable characters.
791 *
792 *  @param[in] id is the object to obtain the name of
793 *  @param[in] length indicates the length of the caller's buffer
794 *  @param[in] name points a string which will be filled in.
795 *
796 *  @return This method returns @a name or NULL on error. @a *name will
797 *          contain the name if successful.
798 */
799char *_Objects_Get_name_as_string(
800  Objects_Id   id,
801  size_t       length,
802  char        *name
803);
804
805/**
806 *  This method sets the object name to either a copy of a string
807 *  or up to the first four characters of the string based upon
808 *  whether this object class uses strings for names.
809 *
810 *  @param[in] information points to the object information structure
811 *  @param[in] the_object is the object to operate upon
812 *  @param[in] name is a pointer to the name to use
813 *
814 *  @return If successful, true is returned.  Otherwise false is returned.
815 */
816bool _Objects_Set_name(
817  Objects_Information *information,
818  Objects_Control     *the_object,
819  const char          *name
820);
821
822/**
823 *  This function removes the_object from the namespace.
824 *
825 *  @param[in] information points to an Object Information Table
826 *  @param[in] the_object is a pointer to an object
827 */
828void _Objects_Namespace_remove(
829  Objects_Information  *information,
830  Objects_Control      *the_object
831);
832
833/**
834 *  This function removes the_object control pointer and object name
835 *  in the Local Pointer and Local Name Tables.
836 *
837 *  @param[in] information points to an Object Information Table
838 *  @param[in] the_object is a pointer to an object
839 */
840void _Objects_Close(
841  Objects_Information  *information,
842  Objects_Control      *the_object
843);
844
845/*
846 *  Pieces of object.inl are promoted out to the user
847 */
848
849#include <rtems/score/object.inl>
850#if defined(RTEMS_MULTIPROCESSING)
851#include <rtems/score/objectmp.h>
852#endif
853
854#ifdef __cplusplus
855}
856#endif
857
858#endif
859/* end of include file */
Note: See TracBrowser for help on using the repository browser.