source: rtems/cpukit/score/include/rtems/score/object.h @ 790b50b

4.104.115
Last change on this file since 790b50b was 790b50b, checked in by Joel Sherrill <joel.sherrill@…>, on 12/17/08 at 22:46:05

2008-12-17 Joel Sherrill <joel.sherrill@…>

  • sapi/include/rtems/extension.h, sapi/include/rtems/io.h, sapi/src/exinit.c, sapi/src/extension.c, sapi/src/io.c, score/include/rtems/score/mpci.h, score/include/rtems/score/object.h, score/include/rtems/score/thread.h, score/include/rtems/score/tod.h, score/include/rtems/score/userext.h, score/include/rtems/score/wkspace.h, score/src/coretod.c, score/src/mpci.c, score/src/object.c, score/src/thread.c, score/src/userext.c, score/src/wkspace.c: Convert SAPI manager and SuperCore? Handler initialization routines to directly pull parameters from configuration table.
  • 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 *  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 bool    (*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#if defined(RTEMS_MULTIPROCESSING)
295  OBJECTS_REMOTE = 2,         /* object is remote */
296#endif
297  OBJECTS_LOCAL  = 0,         /* object is local */
298  OBJECTS_ERROR  = 1          /* id was invalid */
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  bool              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 true if names are strings. */
353  bool              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/**
438 *  This function performs the initialization necessary for this handler.
439 */
440void _Objects_Handler_initialization(void);
441
442/**
443 *  This function extends an object class information record.
444 *
445 *  @param[in] information points to an object class information block.
446 */
447void _Objects_Extend_information(
448  Objects_Information *information
449);
450
451/**
452 *  This function shrink an object class information record.
453 *
454 *  @param[in] information points to an object class information block.
455 */
456void _Objects_Shrink_information(
457  Objects_Information *information
458);
459
460/**
461 *  This function initializes an object class information record.
462 *  SUPPORTS_GLOBAL is TRUE if the object class supports global
463 *  objects, and FALSE otherwise.  Maximum indicates the number
464 *  of objects required in this class and size indicates the size
465 *  in bytes of each control block for this object class.  The
466 *  name length and string designator are also set.  In addition,
467 *  the class may be a task, therefore this information is also included.
468 *
469 *  @param[in] information points to an object class information block.
470 *  @param[in] the_api indicates the API associated with this information block.
471 *  @param[in] the_class indicates the class of object being managed
472 *             by this information block.  It is specific to @a the_api.
473 *  @param[in] maximum is the maximum number of instances of this object
474 *             class which may be concurrently active.
475 *  @param[in] size is the size of the data structure for this class.
476 *  @param[in] is_string is TRUE if this object uses string style names.
477 *  @param[in] maximum_name_length is the maximum length of object names.
478 */
479void _Objects_Initialize_information (
480  Objects_Information *information,
481  Objects_APIs         the_api,
482  uint32_t             the_class,
483  uint32_t             maximum,
484  uint16_t             size,
485  bool                 is_string,
486  uint32_t             maximum_name_length
487#if defined(RTEMS_MULTIPROCESSING)
488  ,
489  bool                 supports_global,
490  Objects_Thread_queue_Extract_callout extract
491#endif
492);
493
494/**
495 *  This function returns the highest numeric value of a valid
496 *  API for the specified @a api.
497 *
498 *  @param[in] api is the API of interest
499 *
500 *  @return A positive integer on success and -1 otherwise.
501 */
502int _Objects_API_maximum_class(
503  uint32_t api
504);
505
506/**
507 *  This function allocates a object control block from
508 *  the inactive chain of free object control blocks.
509 *
510 *  @param[in] information points to an object class information block.
511 */
512Objects_Control *_Objects_Allocate(
513  Objects_Information *information
514);
515
516/**
517 *  This function allocates the object control block
518 *  specified by the index from the inactive chain of
519 *  free object control blocks.
520 *
521 *  @param[in] information points to an object class information block.
522 *  @param[in] the_index is the index of the object to allocate.
523 *  @param[in] sizeof_control is the size of the object control block.
524 */
525Objects_Control *_Objects_Allocate_by_index(
526  Objects_Information *information,
527  uint16_t             the_index,
528  uint16_t             sizeof_control
529);
530
531/**
532 *
533 *  This function frees a object control block to the
534 *  inactive chain of free object control blocks.
535 *
536 *  @param[in] information points to an object class information block.
537 *  @param[in] the_object points to the object to deallocate.
538 */
539void _Objects_Free(
540  Objects_Information *information,
541  Objects_Control     *the_object
542);
543
544/**
545 *  This macro is used to build a thirty-two bit style name from
546 *  four characters.  The most significant byte will be the
547 *  character @a _C1.
548 *
549 *  @param[in] _C1 is the first character of the name
550 *  @param[in] _C2 is the second character of the name
551 *  @param[in] _C3 is the third character of the name
552 *  @param[in] _C4 is the fourth character of the name
553 */
554#define  _Objects_Build_name( _C1, _C2, _C3, _C4 ) \
555  ( (uint32_t)(_C1) << 24 | \
556    (uint32_t)(_C2) << 16 | \
557    (uint32_t)(_C3) << 8 | \
558    (uint32_t)(_C4) )
559
560/**
561 *  This function implements the common portion of the object
562 *  identification directives.  This directive returns the object
563 *  id associated with name.  If more than one object of this class
564 *  is named name, then the object to which the id belongs is
565 *  arbitrary.  Node indicates the extent of the search for the
566 *  id of the object named name.  If the object class supports global
567 *  objects, then the search can be limited to a particular node
568 *  or allowed to encompass all nodes.
569 */
570typedef enum {
571  OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL,
572  OBJECTS_INVALID_NAME,
573  OBJECTS_INVALID_ADDRESS,
574  OBJECTS_INVALID_ID,
575  OBJECTS_INVALID_NODE
576} Objects_Name_or_id_lookup_errors;
577
578/**
579 *  This macro defines the first entry in the
580 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
581 */
582#define OBJECTS_NAME_ERRORS_FIRST OBJECTS_NAME_OR_ID_LOOKUP_SUCCESSFUL
583
584/**
585 *  This macro defines the last entry in the
586 *  @ref Objects_Name_or_id_lookup_errors enumerated list.
587 */
588#define OBJECTS_NAME_ERRORS_LAST  OBJECTS_INVALID_NODE
589
590/**
591 *  This method converts an object name to an Id.  It performs a look up
592 *  using the object information block for this object class.
593 *
594 *  @param[in] information points to an object class information block.
595 *  @param[in] name is the name of the object to find.
596 *  @param[in] node is the set of nodes to search.
597 *  @param[in] id will contain the Id if the search is successful.
598 *
599 *  @return This method returns one of the values from the
600 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
601 *          successful or failure.  On success @a id will contain the Id of
602 *          the requested object.
603 */
604Objects_Name_or_id_lookup_errors _Objects_Name_to_id_u32(
605  Objects_Information *information,
606  uint32_t             name,
607  uint32_t             node,
608  Objects_Id          *id
609);
610
611/**
612 *  This method converts an object name to an Id.  It performs a look up
613 *  using the object information block for this object class.
614 *
615 *  @param[in] information points to an object class information block.
616 *  @param[in] name is the name of the object to find.
617 *  @param[in] id will contain the Id if the search is successful.
618 *
619 *  @return This method returns one of the values from the
620 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
621 *          successful or failure.  On success @a id will contain the Id of
622 *          the requested object.
623 */
624Objects_Name_or_id_lookup_errors _Objects_Name_to_id_string(
625  Objects_Information *information,
626  const char          *name,
627  Objects_Id          *id
628);
629
630/**
631 *  This function implements the common portion of the object Id
632 *  to name directives.  This function returns the name
633 *  associated with object id.
634 *
635 *  @param[in] id is the Id of the object whose name we are locating.
636 *  @param[in] name will contain the name of the object, if found.
637 *
638 *  @return This method returns one of the values from the
639 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
640 *          successful or failure.  On success @a name will contain the name of
641 *          the requested object.
642 *
643 *  @note This function currently does not support string names.
644 */
645Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
646  Objects_Id      id,
647  Objects_Name   *name
648);
649
650/**
651 *  This function maps object ids to object control blocks.
652 *  If id corresponds to a local object, then it returns
653 *  the_object control pointer which maps to id and location
654 *  is set to OBJECTS_LOCAL.  If the object class supports global
655 *  objects and the object id is global and resides on a remote
656 *  node, then location is set to OBJECTS_REMOTE, and the_object
657 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
658 *  and the_object is undefined.
659 *
660 *  @param[in] information points to an object class information block.
661 *  @param[in] id is the Id of the object whose name we are locating.
662 *  @param[in] location will contain an indication of success or failure.
663 *
664 *  @return This method returns one of the values from the
665 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
666 *          successful or failure.  On success @a id will contain the Id of
667 *          the requested object.
668 *
669 *  @note _Objects_Get returns with dispatching disabled for
670 *  local and remote objects.  _Objects_Get_isr_disable returns with
671 *  dispatching disabled for remote objects and interrupts for local
672 *  objects.
673 */
674Objects_Control *_Objects_Get (
675  Objects_Information *information,
676  Objects_Id           id,
677  Objects_Locations   *location
678);
679
680/**
681 *  This function maps object ids to object control blocks.
682 *  If id corresponds to a local object, then it returns
683 *  the_object control pointer which maps to id and location
684 *  is set to OBJECTS_LOCAL.  If the object class supports global
685 *  objects and the object id is global and resides on a remote
686 *  node, then location is set to OBJECTS_REMOTE, and the_object
687 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
688 *  and the_object is undefined.
689 *
690 *  @param[in] information points to an object class information block.
691 *  @param[in] id is the Id of the object whose name we are locating.
692 *  @param[in] location will contain an indication of success or failure.
693 *  @param[in] level is the interrupt level being turned.
694 *
695 *  @return This method returns one of the values from the
696 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
697 *          successful or failure.  On success @a name will contain the name of
698 *          the requested object.
699 *
700 *  @note _Objects_Get returns with dispatching disabled for
701 *  local and remote objects.  _Objects_Get_isr_disable returns with
702 *  dispatchng disabled for remote objects and interrupts for local
703 *  objects.
704 */
705Objects_Control *_Objects_Get_isr_disable(
706  Objects_Information *information,
707  Objects_Id           id,
708  Objects_Locations   *location,
709  ISR_Level           *level
710);
711
712/**
713 *  This function maps object index to object control blocks which must.
714 *  be local.  The parameter the_object control pointer which maps to id
715 *  and location is set to OBJECTS_LOCAL.  Otherwise, location is set to
716    OBJECTS_ERROR and the_object is undefined.
717 *
718 *  @param[in] information points to an object class information block.
719 *  @param[in] id is the Id of the object whose name we are locating.
720 *  @param[in] location will contain an indication of success or failure.
721 *
722 *  @return This method returns a pointer to the object associated with ID.
723 *
724 *  @return This method returns one of the values from the
725 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
726 *          successful or failure.  On success @a id will contain the id of
727 *          the requested object.
728 *
729 *  @note _Objects_Get returns with dispatching disabled for
730 *  local and remote objects.  _Objects_Get_isr_disable returns with
731 *  dispatching disabled for remote objects and interrupts for local
732 *  objects.
733 */
734Objects_Control *_Objects_Get_by_index (
735  Objects_Information *information,
736  Objects_Id           id,
737  Objects_Locations   *location
738);
739
740/**
741 *  This function maps object ids to object control blocks.
742 *  If id corresponds to a local object, then it returns
743 *  the_object control pointer which maps to id and location
744 *  is set to OBJECTS_LOCAL.  If the object class supports global
745 *  objects and the object id is global and resides on a remote
746 *  node, then location is set to OBJECTS_REMOTE, and the_object
747 *  is undefined.  Otherwise, location is set to OBJECTS_ERROR
748 *  and the_object is undefined.
749 *
750 *  @param[in] information points to an object class information block.
751 *  @param[in] id is the Id of the object whose name we are locating.
752 *  @param[in] location will contain an indication of success or failure.
753 *
754 *  @return This method returns one of the values from the
755 *          @ref Objects_Name_or_id_lookup_errors enumeration to indicate
756 *          successful or failure.  On success @a id will contain the Id of
757 *          the requested object.
758 *
759 *  @note _Objects_Get returns with dispatching disabled for
760 *  local and remote objects.  _Objects_Get_isr_disable returns with
761 *  dispatching disabled for remote objects and interrupts for local
762 *  objects.
763 */
764Objects_Control *_Objects_Get_no_protection(
765  Objects_Information *information,
766  Objects_Id           id,
767  Objects_Locations   *location
768);
769
770/**
771 *  Like @ref _Objects_Get, but is used to find "next" open object.
772 *
773 *  @param[in] information points to an object class information block.
774 *  @param[in] id is the Id of the object whose name we are locating.
775 *  @param[in] location_p will contain an indication of success or failure.
776 *  @param[in] next_id_p is the Id of the next object we will look at.
777 *
778 *  @return This method returns the pointer to the object located or
779 *          NULL on error.
780 */
781Objects_Control *_Objects_Get_next(
782    Objects_Information *information,
783    Objects_Id           id,
784    Objects_Locations   *location_p,
785    Objects_Id          *next_id_p
786);
787
788/**
789 *  This function return the information structure given
790 *  an the API and Class.  This can be done independent of
791 *  the existence of any objects created by the API.
792 *
793 *  @param[in] the_api indicates the API for the information we want
794 *  @param[in] the_class indicates the Class for the information we want
795 *
796 *  @return This method returns a pointer to the Object Information Table
797 *          for the class of objects which corresponds to this object ID.
798 */
799Objects_Information *_Objects_Get_information(
800  Objects_APIs   the_api,
801  uint32_t       the_class
802);
803
804/**
805 *  This function return the information structure given
806 *  an id of an object.
807 *
808 *  @param[in] id is an object ID
809 *
810 *  @return This method returns a pointer to the Object Information Table
811 *          for the class of objects which corresponds to this object ID.
812 */
813Objects_Information *_Objects_Get_information_id(
814  Objects_Id  id
815);
816
817/**
818 *  This method objects the name of an object and returns its name
819 *  in the form of a C string.  It attempts to be careful about
820 *  overflowing the user's string and about returning unprintable characters.
821 *
822 *  @param[in] id is the object to obtain the name of
823 *  @param[in] length indicates the length of the caller's buffer
824 *  @param[in] name points a string which will be filled in.
825 *
826 *  @return This method returns @a name or NULL on error. @a *name will
827 *          contain the name if successful.
828 */
829char *_Objects_Get_name_as_string(
830  Objects_Id   id,
831  size_t       length,
832  char        *name
833);
834
835/**
836 *  This method sets the object name to either a copy of a string
837 *  or up to the first four characters of the string based upon
838 *  whether this object class uses strings for names.
839 *
840 *  @param[in] information points to the object information structure
841 *  @param[in] the_object is the object to operate upon
842 *  @param[in] name is a pointer to the name to use
843 *
844 *  @return If successful, TRUE is returned.  Otherwise FALSE is returned.
845 */
846bool _Objects_Set_name(
847  Objects_Information *information,
848  Objects_Control     *the_object,
849  const char          *name
850);
851
852/**
853 *  This function removes the_object from the namespace.
854 *
855 *  @param[in] information points to an Object Information Table
856 *  @param[in] the_object is a pointer to an object
857 */
858void _Objects_Namespace_remove(
859  Objects_Information  *information,
860  Objects_Control      *the_object
861);
862
863/**
864 *  This function removes the_object control pointer and object name
865 *  in the Local Pointer and Local Name Tables.
866 *
867 *  @param[in] information points to an Object Information Table
868 *  @param[in] the_object is a pointer to an object
869 */
870void _Objects_Close(
871  Objects_Information  *information,
872  Objects_Control      *the_object
873);
874
875/*
876 *  Pieces of object.inl are promoted out to the user
877 */
878
879#include <rtems/score/object.inl>
880#if defined(RTEMS_MULTIPROCESSING)
881#include <rtems/score/objectmp.h>
882#endif
883
884#ifdef __cplusplus
885}
886#endif
887
888#endif
889/* end of include file */
Note: See TracBrowser for help on using the repository browser.