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.com/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 | _Chain_Initialize_empty( &_API_extensions_Post_switch_list ); |
---|
29 | } |
---|
30 | |
---|
31 | void _API_extensions_Add( |
---|
32 | API_extensions_Control *the_extension |
---|
33 | ) |
---|
34 | { |
---|
35 | _Chain_Append( &_API_extensions_List, &the_extension->Node ); |
---|
36 | } |
---|
37 | |
---|
38 | void _API_extensions_Add_post_switch( |
---|
39 | API_extensions_Post_switch_control *post_switch |
---|
40 | ) |
---|
41 | { |
---|
42 | _Chain_Append_if_is_off_chain_unprotected( |
---|
43 | &_API_extensions_Post_switch_list, |
---|
44 | &post_switch->Node |
---|
45 | ); |
---|
46 | } |
---|
47 | |
---|
48 | #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) |
---|
49 | |
---|
50 | void _API_extensions_Run_predriver( void ) |
---|
51 | { |
---|
52 | Chain_Node *the_node; |
---|
53 | API_extensions_Control *the_extension; |
---|
54 | |
---|
55 | for ( the_node = _Chain_First( &_API_extensions_List ); |
---|
56 | !_Chain_Is_tail( &_API_extensions_List, the_node ) ; |
---|
57 | the_node = the_node->next ) { |
---|
58 | |
---|
59 | the_extension = (API_extensions_Control *) the_node; |
---|
60 | |
---|
61 | if ( the_extension->predriver_hook ) |
---|
62 | (*the_extension->predriver_hook)(); |
---|
63 | } |
---|
64 | } |
---|
65 | #endif |
---|
66 | |
---|
67 | void _API_extensions_Run_postdriver( void ) |
---|
68 | { |
---|
69 | Chain_Node *the_node; |
---|
70 | API_extensions_Control *the_extension; |
---|
71 | |
---|
72 | for ( the_node = _Chain_First( &_API_extensions_List ); |
---|
73 | !_Chain_Is_tail( &_API_extensions_List, the_node ) ; |
---|
74 | the_node = the_node->next ) { |
---|
75 | |
---|
76 | the_extension = (API_extensions_Control *) the_node; |
---|
77 | |
---|
78 | /* |
---|
79 | * Currently all APIs configure this hook so it is always non-NULL. |
---|
80 | */ |
---|
81 | #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) |
---|
82 | if ( the_extension->postdriver_hook ) |
---|
83 | #endif |
---|
84 | (*the_extension->postdriver_hook)(); |
---|
85 | } |
---|
86 | } |
---|