source: rtems/cpukit/score/src/apiext.c @ 04b5d17

4.115
Last change on this file since 04b5d17 was 04b5d17, checked in by Sebastian Huber <sebastian.huber@…>, on 11/28/12 at 09:45:38

score: Add API extensions post switch list

Move post switch hook from API_extensions_Control to new
API_extensions_Post_switch_control. Rename
_API_extensions_Run_postswitch() in _API_extensions_Run_post_switch().
Add _API_extensions_Post_switch_list and
_API_extensions_Add_post_switch().

  • Property mode set to 100644
File size: 2.0 KB
Line 
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
25void _API_extensions_Initialization( void )
26{
27 _Chain_Initialize_empty( &_API_extensions_List );
28 _Chain_Initialize_empty( &_API_extensions_Post_switch_list );
29}
30
31void _API_extensions_Add(
32  API_extensions_Control *the_extension
33)
34{
35  _Chain_Append( &_API_extensions_List, &the_extension->Node );
36}
37
38void _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
67void _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}
Note: See TracBrowser for help on using the repository browser.