1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Holding for API Extension Functions |
---|
5 | * |
---|
6 | * @ingroup ScoreAPIExtension |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 1989-1999. |
---|
11 | * On-Line Applications Research Corporation (OAR). |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.org/license/LICENSE. |
---|
16 | */ |
---|
17 | |
---|
18 | #if HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <rtems/system.h> |
---|
23 | #include <rtems/score/apiext.h> |
---|
24 | |
---|
25 | void _API_extensions_Initialization( void ) |
---|
26 | { |
---|
27 | _Chain_Initialize_empty( &_API_extensions_List ); |
---|
28 | } |
---|
29 | |
---|
30 | void _API_extensions_Add( |
---|
31 | API_extensions_Control *the_extension |
---|
32 | ) |
---|
33 | { |
---|
34 | _Chain_Append( &_API_extensions_List, &the_extension->Node ); |
---|
35 | } |
---|
36 | |
---|
37 | #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) |
---|
38 | |
---|
39 | void _API_extensions_Run_predriver( void ) |
---|
40 | { |
---|
41 | Chain_Node *the_node; |
---|
42 | API_extensions_Control *the_extension; |
---|
43 | |
---|
44 | for ( the_node = _Chain_First( &_API_extensions_List ); |
---|
45 | !_Chain_Is_tail( &_API_extensions_List, the_node ) ; |
---|
46 | the_node = the_node->next ) { |
---|
47 | |
---|
48 | the_extension = (API_extensions_Control *) the_node; |
---|
49 | |
---|
50 | if ( the_extension->predriver_hook ) |
---|
51 | (*the_extension->predriver_hook)(); |
---|
52 | } |
---|
53 | } |
---|
54 | #endif |
---|
55 | |
---|
56 | void _API_extensions_Run_postdriver( void ) |
---|
57 | { |
---|
58 | Chain_Node *the_node; |
---|
59 | API_extensions_Control *the_extension; |
---|
60 | |
---|
61 | for ( the_node = _Chain_First( &_API_extensions_List ); |
---|
62 | !_Chain_Is_tail( &_API_extensions_List, the_node ) ; |
---|
63 | the_node = the_node->next ) { |
---|
64 | |
---|
65 | the_extension = (API_extensions_Control *) the_node; |
---|
66 | |
---|
67 | /* |
---|
68 | * Currently all APIs configure this hook so it is always non-NULL. |
---|
69 | */ |
---|
70 | #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) |
---|
71 | if ( the_extension->postdriver_hook ) |
---|
72 | #endif |
---|
73 | (*the_extension->postdriver_hook)(); |
---|
74 | } |
---|
75 | } |
---|