4.115
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Get Object Information |
---|
5 | * @ingroup ScoreObject |
---|
6 | */ |
---|
7 | |
---|
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.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifdef HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/system.h> |
---|
22 | #include <rtems/score/object.h> |
---|
23 | #include <rtems/score/thread.h> |
---|
24 | #include <rtems/score/wkspace.h> |
---|
25 | |
---|
26 | Objects_Information *_Objects_Get_information( |
---|
27 | Objects_APIs the_api, |
---|
28 | uint16_t the_class |
---|
29 | ) |
---|
30 | { |
---|
31 | Objects_Information *info; |
---|
32 | int the_class_api_maximum; |
---|
33 | |
---|
34 | if ( !the_class ) |
---|
35 | return NULL; |
---|
36 | |
---|
37 | /* |
---|
38 | * This call implicitly validates the_api so we do not call |
---|
39 | * _Objects_Is_api_valid above here. |
---|
40 | */ |
---|
41 | the_class_api_maximum = _Objects_API_maximum_class( the_api ); |
---|
42 | if ( the_class_api_maximum == 0 ) |
---|
43 | return NULL; |
---|
44 | |
---|
45 | if ( the_class > (uint32_t) the_class_api_maximum ) |
---|
46 | return NULL; |
---|
47 | |
---|
48 | if ( !_Objects_Information_table[ the_api ] ) |
---|
49 | return NULL; |
---|
50 | |
---|
51 | info = _Objects_Information_table[ the_api ][ the_class ]; |
---|
52 | if ( !info ) |
---|
53 | return NULL; |
---|
54 | |
---|
55 | /* |
---|
56 | * In a multprocessing configuration, we may access remote objects. |
---|
57 | * Thus we may have 0 local instances and still have a valid object |
---|
58 | * pointer. |
---|
59 | */ |
---|
60 | #if !defined(RTEMS_MULTIPROCESSING) |
---|
61 | if ( info->maximum == 0 ) |
---|
62 | return NULL; |
---|
63 | #endif |
---|
64 | |
---|
65 | return info; |
---|
66 | } |
---|
67 | |
---|
Note: See
TracBrowser
for help on using the repository browser.