summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/apiext.h
blob: cdf09f8013b7fe165f38e96efec832816748eba1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/** 
 *  @file apiext.h
 *
 *  This is the API Extensions Handler.
 */

/*
 *  COPYRIGHT (c) 1989-2004.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.com/license/LICENSE.
 *
 *  $Id$
 */

#ifndef __API_EXTENSIONS_h
#define __API_EXTENSIONS_h

/**
 *  @defgroup ScoreAPIExtension API Extension Handler
 *
 *  This group contains functionality which provides mechanisms for the
 *  SuperCore to perform API specific actions without there being 
 *  "up-references" from the SuperCore to APIs.  If these references 
 *  were allowed in the implementation, the cohesion would be too high
 *  and adding an API would be more difficult.  The SuperCore is supposed
 *  to be largely independent of any API.
 */
/**@{*/

#include <rtems/score/chain.h>
#include <rtems/score/thread.h>

/**
 *  This type defines the prototype of the Predriver Hook.
 */
typedef void (*API_extensions_Predriver_hook)(void);

/**
 *  This type defines the prototype of the Postdriver Hook.
 */
typedef void (*API_extensions_Postdriver_hook)(void);

/**
 *  This type defines the prototype of the Postswitch Hook.
 */
typedef void (*API_extensions_Postswitch_hook)(
                 Thread_Control *
             );

/**
 *  The control structure which defines the points at which an API
 *  can add an extension to the system initialization thread.
 */
typedef struct {
  /** This field allows this structure to be used with the Chain Handler. */
  Chain_Node                      Node;
  /**
   * This field is the callout invoked during RTEMS initialization after
   * RTEMS data structures are initialized before device driver initialization
   * has occurred.
   *
   * @note If this field is NULL, no extension is invoked.
   */
  API_extensions_Predriver_hook   predriver_hook;
  /**
   * This field is the callout invoked during RTEMS initialization after
   * RTEMS data structures and device driver initialization has occurred
   * but before multitasking is initiated.
   *
   * @note If this field is NULL, no extension is invoked.
   */
  API_extensions_Postdriver_hook  postdriver_hook;
  /**
   * This field is the callout invoked during each context switch
   * in the context of the heir thread.
   *
   * @note If this field is NULL, no extension is invoked.
   */
  API_extensions_Postswitch_hook  postswitch_hook;
}  API_extensions_Control;

/**
 *  This is the list of API extensions to the system initialization.
 */
SCORE_EXTERN Chain_Control _API_extensions_List;

/**
 *  This routine initializes the API extension handler.
 */
void _API_extensions_Initialization( void );

/**
 *  This routine adds an extension to the active set of API extensions.
 *
 *  @param the_extension (in) is the extension set to add.
 */
void _API_extensions_Add(
  API_extensions_Control *the_extension
);

/**
 *  This routine executes all of the predriver callouts.
 */
void _API_extensions_Run_predriver( void );

/**
 *  This routine executes all of the postdriver callouts.
 */
void _API_extensions_Run_postdriver( void );

/**
 *  This routine executes all of the post context switch callouts.
 */
 */
void _API_extensions_Run_postswitch( void );

/**@}*/

#endif
/* end of include file */