1 | /* userext.inl |
---|
2 | * |
---|
3 | * This file contains the macro implementation of the inlined routines |
---|
4 | * from the User Extension Handler |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1998. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * Copyright assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.OARcorp.com/rtems/license.html. |
---|
13 | * |
---|
14 | * $Id$ |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef __USER_EXTENSIONS_inl |
---|
18 | #define __USER_EXTENSIONS_inl |
---|
19 | |
---|
20 | /*PAGE |
---|
21 | * |
---|
22 | * _User_extensions_Handler_initialization |
---|
23 | * |
---|
24 | * DESCRIPTION: |
---|
25 | * |
---|
26 | * This routine performs the initialization necessary for this handler. |
---|
27 | */ |
---|
28 | |
---|
29 | RTEMS_INLINE_ROUTINE void _User_extensions_Handler_initialization ( |
---|
30 | User_extensions_Table *initial_extensions |
---|
31 | ) |
---|
32 | { |
---|
33 | _Chain_Initialize_empty( &_User_extensions_List ); |
---|
34 | |
---|
35 | if ( initial_extensions ) { |
---|
36 | _User_extensions_Initial.Callouts = *initial_extensions; |
---|
37 | _Chain_Append( &_User_extensions_List, &_User_extensions_Initial.Node ); |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | /*PAGE |
---|
42 | * |
---|
43 | * _User_extensions_Add_set |
---|
44 | * |
---|
45 | * DESCRIPTION: |
---|
46 | * |
---|
47 | * This routine is used to add a user extension set to the active list. |
---|
48 | */ |
---|
49 | |
---|
50 | RTEMS_INLINE_ROUTINE void _User_extensions_Add_set ( |
---|
51 | User_extensions_Control *the_extension, |
---|
52 | User_extensions_Table *extension_table |
---|
53 | ) |
---|
54 | { |
---|
55 | the_extension->Callouts = *extension_table; |
---|
56 | |
---|
57 | _Chain_Append( &_User_extensions_List, &the_extension->Node ); |
---|
58 | } |
---|
59 | |
---|
60 | /*PAGE |
---|
61 | * |
---|
62 | * _User_extensions_Add_API_set |
---|
63 | * DESCRIPTION: |
---|
64 | * |
---|
65 | * This routine is used to add an API extension set to the active list. |
---|
66 | */ |
---|
67 | |
---|
68 | RTEMS_INLINE_ROUTINE void _User_extensions_Add_API_set ( |
---|
69 | User_extensions_Control *the_extension |
---|
70 | ) |
---|
71 | { |
---|
72 | _Chain_Prepend( &_User_extensions_List, &the_extension->Node ); |
---|
73 | } |
---|
74 | |
---|
75 | /*PAGE |
---|
76 | * |
---|
77 | * _User_extensions_Remove_set |
---|
78 | * |
---|
79 | * DESCRIPTION: |
---|
80 | * |
---|
81 | * This routine is used to remove a user extension set from the active list. |
---|
82 | */ |
---|
83 | |
---|
84 | RTEMS_INLINE_ROUTINE void _User_extensions_Remove_set ( |
---|
85 | User_extensions_Control *the_extension |
---|
86 | ) |
---|
87 | { |
---|
88 | _Chain_Extract( &the_extension->Node ); |
---|
89 | } |
---|
90 | |
---|
91 | /*PAGE |
---|
92 | * |
---|
93 | * _User_extensions_Thread_switch |
---|
94 | * |
---|
95 | * DESCRIPTION: |
---|
96 | * |
---|
97 | * This routine is used to invoke the user extension which |
---|
98 | * is invoked when a context switch occurs. |
---|
99 | */ |
---|
100 | |
---|
101 | RTEMS_INLINE_ROUTINE void _User_extensions_Thread_switch ( |
---|
102 | Thread_Control *executing, |
---|
103 | Thread_Control *heir |
---|
104 | ) |
---|
105 | { |
---|
106 | Chain_Node *the_node; |
---|
107 | User_extensions_Control *the_extension; |
---|
108 | |
---|
109 | for ( the_node = _User_extensions_List.first ; |
---|
110 | !_Chain_Is_tail( &_User_extensions_List, the_node ) ; |
---|
111 | the_node = the_node->next ) { |
---|
112 | |
---|
113 | the_extension = (User_extensions_Control *) the_node; |
---|
114 | |
---|
115 | if ( the_extension->Callouts.thread_switch != NULL ) |
---|
116 | (*the_extension->Callouts.thread_switch)( executing, heir ); |
---|
117 | } |
---|
118 | } |
---|
119 | |
---|
120 | #endif |
---|
121 | /* end of include file */ |
---|