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

4.104.115
Last change on this file since dea3eccb was dea3eccb, checked in by Joel Sherrill <joel.sherrill@…>, on 09/06/09 at 15:24:08

2009-09-06 Sebastian Huber <Sebastian.Huber@…>

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