1 | /* apiext.c |
---|
2 | * |
---|
3 | * XXX |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-1999. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #if HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems/system.h> |
---|
20 | #include <rtems/score/apiext.h> |
---|
21 | |
---|
22 | /*PAGE |
---|
23 | * |
---|
24 | * _API_extensions_Initialization |
---|
25 | */ |
---|
26 | |
---|
27 | void _API_extensions_Initialization( void ) |
---|
28 | { |
---|
29 | _Chain_Initialize_empty( &_API_extensions_List ); |
---|
30 | } |
---|
31 | |
---|
32 | /*PAGE |
---|
33 | * |
---|
34 | * _API_extensions_Add |
---|
35 | */ |
---|
36 | |
---|
37 | void _API_extensions_Add( |
---|
38 | API_extensions_Control *the_extension |
---|
39 | ) |
---|
40 | { |
---|
41 | _Chain_Append( &_API_extensions_List, &the_extension->Node ); |
---|
42 | } |
---|
43 | |
---|
44 | #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) |
---|
45 | /*PAGE |
---|
46 | * |
---|
47 | * _API_extensions_Run_predriver |
---|
48 | */ |
---|
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 = _API_extensions_List.first ; |
---|
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 | /*PAGE |
---|
68 | * |
---|
69 | * _API_extensions_Run_postdriver |
---|
70 | */ |
---|
71 | |
---|
72 | void _API_extensions_Run_postdriver( void ) |
---|
73 | { |
---|
74 | Chain_Node *the_node; |
---|
75 | API_extensions_Control *the_extension; |
---|
76 | |
---|
77 | for ( the_node = _API_extensions_List.first ; |
---|
78 | !_Chain_Is_tail( &_API_extensions_List, the_node ) ; |
---|
79 | the_node = the_node->next ) { |
---|
80 | |
---|
81 | the_extension = (API_extensions_Control *) the_node; |
---|
82 | |
---|
83 | /* |
---|
84 | * Currently all APIs configure this hook so it is always non-NULL. |
---|
85 | */ |
---|
86 | #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) |
---|
87 | if ( the_extension->postdriver_hook ) |
---|
88 | #endif |
---|
89 | (*the_extension->postdriver_hook)(); |
---|
90 | } |
---|
91 | } |
---|
92 | |
---|
93 | /*PAGE |
---|
94 | * |
---|
95 | * _API_extensions_Run_postswitch |
---|
96 | */ |
---|
97 | |
---|
98 | void _API_extensions_Run_postswitch( void ) |
---|
99 | { |
---|
100 | Chain_Node *the_node; |
---|
101 | API_extensions_Control *the_extension; |
---|
102 | |
---|
103 | for ( the_node = _API_extensions_List.first ; |
---|
104 | !_Chain_Is_tail( &_API_extensions_List, the_node ) ; |
---|
105 | the_node = the_node->next ) { |
---|
106 | |
---|
107 | the_extension = (API_extensions_Control *) the_node; |
---|
108 | |
---|
109 | /* |
---|
110 | * Currently the ITRON API is the only API which does not |
---|
111 | * provide this hook. |
---|
112 | */ |
---|
113 | #if defined(RTEMS_ITRON_API) |
---|
114 | if ( the_extension->postswitch_hook ) |
---|
115 | #endif |
---|
116 | (*the_extension->postswitch_hook)( _Thread_Executing ); |
---|
117 | } |
---|
118 | } |
---|
119 | |
---|
120 | /* end of file */ |
---|