RTEMS
objectgetinfo.c
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-2008.
10  * On-Line Applications Research Corporation (OAR).
11  *
12  * The license and distribution terms for this file may be
13  * found in the file LICENSE in this distribution or at
14  * http://www.rtems.org/license/LICENSE.
15  */
16 
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
21 #include <rtems/score/objectimpl.h>
22 
24  Objects_APIs the_api,
25  uint16_t the_class
26 )
27 {
28  Objects_Information *info;
29  int the_class_api_maximum;
30 
31  if ( !the_class )
32  return NULL;
33 
34  /*
35  * This call implicitly validates the_api so we do not call
36  * _Objects_Is_api_valid above here.
37  */
38  the_class_api_maximum = _Objects_API_maximum_class( the_api );
39  if ( the_class_api_maximum == 0 )
40  return NULL;
41 
42  if ( the_class > (uint32_t) the_class_api_maximum )
43  return NULL;
44 
45  if ( !_Objects_Information_table[ the_api ] )
46  return NULL;
47 
48  info = _Objects_Information_table[ the_api ][ the_class ];
49  if ( !info )
50  return NULL;
51 
52  /*
53  * In a multprocessing configuration, we may access remote objects.
54  * Thus we may have 0 local instances and still have a valid object
55  * pointer.
56  */
57  #if !defined(RTEMS_MULTIPROCESSING)
58  if ( _Objects_Get_maximum_index( info ) == 0 )
59  return NULL;
60  #endif
61 
62  return info;
63 }
64 
static __inline__ Objects_Maximum _Objects_Get_maximum_index(const Objects_Information *information)
Returns the maximum index of the specified object class.
Definition: objectimpl.h:642
Objects_Information * _Objects_Get_information(Objects_APIs the_api, uint16_t the_class)
Gets object information.
Definition: objectgetinfo.c:23
Objects_Information **const _Objects_Information_table[OBJECTS_APIS_LAST+1]
Inlined Routines in the Object Handler.
The information structure used to manage each API class of objects.
Definition: objectdata.h:176
Objects_APIs
Definition: object.h:174
unsigned int _Objects_API_maximum_class(uint32_t api)
Returns highest numeric value of a valid API for the specified API.