source: rtems/cpukit/score/macros/rtems/score/userext.inl @ d2ac7c3

4.104.114.84.95
Last change on this file since d2ac7c3 was d2ac7c3, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 8, 2003 at 9:02:33 PM

2003-09-08 Mikec Ivica <mikici@…>

  • inline/rtems/score/userext.inl, macros/rtems/score/userext.inl: Add missing cast.
  • Property mode set to 100644
File size: 3.4 KB
Line 
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-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#ifndef __USER_EXTENSIONS_inl
17#define __USER_EXTENSIONS_inl
18
19#include <rtems/score/wkspace.h>
20
21/*PAGE
22 *
23 *  _User_extensions_Add_set
24 *
25 *  NOTE: Must be before _User_extensions_Handler_initialization to
26 *        ensure proper inlining.
27 */
28 
29#define _User_extensions_Add_set( _the_extension, _extension_table ) \
30  do { \
31    (_the_extension)->Callouts = *(_extension_table); \
32    \
33    _Chain_Append( &_User_extensions_List, &(_the_extension)->Node ); \
34    \
35    if ( (_the_extension)->Callouts.thread_switch != NULL ) { \
36      (_the_extension)->Switch.thread_switch = \
37        (_the_extension)->Callouts.thread_switch; \
38      _Chain_Append( \
39        &_User_extensions_Switches_list, \
40        &(_the_extension)->Switch.Node \
41     ); \
42    } \
43  } while ( 0 )
44 
45
46/*PAGE
47 *
48 *  _User_extensions_Handler_initialization
49 *
50 */
51
52#define _User_extensions_Handler_initialization( \
53  _number_of_extensions, _initial_extensions \
54) \
55  { \
56    User_extensions_Control *extension; \
57    unsigned32               i; \
58    \
59    _Chain_Initialize_empty( &_User_extensions_List ); \
60    _Chain_Initialize_empty( &_User_extensions_Switches_list ); \
61    \
62    if ( (_initial_extensions) ) { \
63      extension = (User_extensions_Control *) \
64        _Workspace_Allocate_or_fatal_error( \
65          sizeof(User_extensions_Control) * _number_of_extensions ); \
66      \
67      memset ( \
68        extension, \
69        0, \
70        _number_of_extensions * sizeof( User_extensions_Control ) \
71      ); \
72      \
73      for ( i = 0 ; i < _number_of_extensions ; i++ ) { \
74        _User_extensions_Add_set (extension, &_initial_extensions[i]); \
75        extension++; \
76      } \
77    } \
78  }
79
80/*PAGE
81 *
82 *  _User_extensions_Add_API_set
83 */
84 
85#define _User_extensions_Add_API_set( _the_extension ) \
86  do { \
87    _Chain_Append( &_User_extensions_List, &(_the_extension)->Node ); \
88    \
89    if ( (_the_extension)->Callouts.thread_switch != NULL ) { \
90      (_the_extension)->Switch.thread_switch = \
91          (_the_extension)->Callouts.thread_switch; \
92      _Chain_Append( \
93        &_User_extensions_Switches_list, &(_the_extension)->Switch.Node ); \
94    } \
95  } while ( 0 )
96 
97/*PAGE
98 *
99 *  _User_extensions_Remove_set
100 */
101
102#define _User_extensions_Remove_set( _the_extension ) \
103  do { \
104    _Chain_Extract( &(_the_extension)->Node ); \
105    \
106    if ( (_the_extension)->Callouts.thread_switch != NULL ) { \
107      _Chain_Extract( &(_the_extension)->Node ); \
108    } \
109  } while (0)
110
111/*PAGE
112 *
113 *  _User_extensions_Thread_switch
114 *
115 */
116
117#define _User_extensions_Thread_switch( _executing, _heir ) \
118  do { \
119    Chain_Node                     *the_node; \
120    User_extensions_Switch_control *the_extension_switch; \
121    \
122    for ( the_node = _User_extensions_Switches_list.first ; \
123          !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ; \
124          the_node = the_node->next ) { \
125      \
126      the_extension_switch = (User_extensions_Switch_control *) the_node; \
127      \
128      (*the_extension_switch->thread_switch)( _executing, _heir ); \
129    } \
130  } while (0)
131
132#endif
133/* end of include file */
Note: See TracBrowser for help on using the repository browser.