source: rtems/cpukit/score/include/rtems/score/object.h @ 4b5ddf2

4.104.114.95
Last change on this file since 4b5ddf2 was 4b5ddf2, checked in by Ralf Corsepius <ralf.corsepius@…>, on 05/31/08 at 05:31:18

Move #include's out of extern "C" {}.

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