source: rtems/cpukit/score/inline/rtems/score/userext.inl @ c39b35f

Last change on this file since c39b35f was c39b35f, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:55:06

2003-09-04 Joel Sherrill <joel@…>

  • include/rtems/bspIo.h, include/rtems/fs.h, include/rtems/userenv.h, score/include/rtems/debug.h, score/include/rtems/seterr.h, score/include/rtems/system.h, score/include/rtems/score/address.h, score/include/rtems/score/apiext.h, score/include/rtems/score/apimutex.h, score/include/rtems/score/bitfield.h, score/include/rtems/score/chain.h, score/include/rtems/score/context.h, score/include/rtems/score/copyrt.h, score/include/rtems/score/coremsg.h, score/include/rtems/score/coremutex.h, score/include/rtems/score/coresem.h, score/include/rtems/score/heap.h, score/include/rtems/score/interr.h, score/include/rtems/score/isr.h, score/include/rtems/score/mpci.h, score/include/rtems/score/mppkt.h, score/include/rtems/score/object.h, score/include/rtems/score/objectmp.h, score/include/rtems/score/priority.h, score/include/rtems/score/stack.h, score/include/rtems/score/states.h, score/include/rtems/score/sysstate.h, score/include/rtems/score/thread.h, score/include/rtems/score/threadmp.h, score/include/rtems/score/threadq.h, score/include/rtems/score/tod.h, score/include/rtems/score/tqdata.h, score/include/rtems/score/userext.h, score/include/rtems/score/watchdog.h, score/include/rtems/score/wkspace.h, score/inline/rtems/score/address.inl, score/inline/rtems/score/chain.inl, score/inline/rtems/score/coremsg.inl, score/inline/rtems/score/coremutex.inl, score/inline/rtems/score/coresem.inl, score/inline/rtems/score/heap.inl, score/inline/rtems/score/isr.inl, score/inline/rtems/score/mppkt.inl, score/inline/rtems/score/object.inl, score/inline/rtems/score/objectmp.inl, score/inline/rtems/score/priority.inl, score/inline/rtems/score/stack.inl, score/inline/rtems/score/states.inl, score/inline/rtems/score/sysstate.inl, score/inline/rtems/score/thread.inl, score/inline/rtems/score/threadmp.inl, score/inline/rtems/score/tod.inl, score/inline/rtems/score/tqdata.inl, score/inline/rtems/score/userext.inl, score/inline/rtems/score/watchdog.inl, score/inline/rtems/score/wkspace.inl, score/macros/rtems/score/address.inl, score/macros/rtems/score/chain.inl, score/macros/rtems/score/coremsg.inl, score/macros/rtems/score/coremutex.inl, score/macros/rtems/score/coresem.inl, score/macros/rtems/score/heap.inl, score/macros/rtems/score/isr.inl, score/macros/rtems/score/mppkt.inl, score/macros/rtems/score/object.inl, score/macros/rtems/score/objectmp.inl, score/macros/rtems/score/priority.inl, score/macros/rtems/score/stack.inl, score/macros/rtems/score/states.inl, score/macros/rtems/score/sysstate.inl, score/macros/rtems/score/thread.inl, score/macros/rtems/score/threadmp.inl, score/macros/rtems/score/tod.inl, score/macros/rtems/score/tqdata.inl, score/macros/rtems/score/userext.inl, score/macros/rtems/score/watchdog.inl, score/macros/rtems/score/wkspace.inl: URL for license changed.
  • Property mode set to 100644
File size: 4.0 KB
RevLine 
[ac7d5ef0]1/*  userext.inl
2 *
3 *  This file contains the macro implementation of the inlined routines
4 *  from the User Extension Handler
5 *
[08311cc3]6 *  COPYRIGHT (c) 1989-1999.
[ac7d5ef0]7 *  On-Line Applications Research Corporation (OAR).
8 *
[98e4ebf5]9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
[c39b35f]11 *  http://www.rtems.com/license/LICENSE.
[ac7d5ef0]12 *
13 *  $Id$
14 */
15
16#ifndef __USER_EXTENSIONS_inl
17#define __USER_EXTENSIONS_inl
18
[0451b44]19#include <rtems/score/wkspace.h>
20
[ac7d5ef0]21/*PAGE
22 *
[7af623bf]23 *  _User_extensions_Add_set
[ac7d5ef0]24 *
[1a8fde6c]25 *  DESCRIPTION:
26 *
[7af623bf]27 *  This routine is used to add a user extension set to the active list.
[ed11413b]28 *
29 *  NOTE: Must be before _User_extensions_Handler_initialization to
30 *        ensure proper inlining.
[ac7d5ef0]31 */
32
[7af623bf]33RTEMS_INLINE_ROUTINE void _User_extensions_Add_set (
34  User_extensions_Control *the_extension,
35  User_extensions_Table   *extension_table
[ac7d5ef0]36)
37{
[7af623bf]38  the_extension->Callouts = *extension_table;
[ac7d5ef0]39
[7af623bf]40  _Chain_Append( &_User_extensions_List, &the_extension->Node );
[0451b44]41
[7af623bf]42  /*
43   * If a switch handler is present, append it to the switch chain.
44   */
[aadb6b0]45
[7af623bf]46  if ( extension_table->thread_switch != NULL ) {
47    the_extension->Switch.thread_switch = extension_table->thread_switch;
48    _Chain_Append( &_User_extensions_Switches_list, &the_extension->Switch.Node );
[ac7d5ef0]49  }
50}
51
52/*PAGE
53 *
[7af623bf]54 *  _User_extensions_Handler_initialization
[1a8fde6c]55 *
56 *  DESCRIPTION:
57 *
[7af623bf]58 *  This routine performs the initialization necessary for this handler.
[ac7d5ef0]59 */
60
[7af623bf]61RTEMS_INLINE_ROUTINE void _User_extensions_Handler_initialization (
62    unsigned32              number_of_extensions,
63    User_extensions_Table  *initial_extensions
[ac7d5ef0]64)
65{
[7af623bf]66  User_extensions_Control *extension;
67  unsigned32               i;
[ac7d5ef0]68
[7af623bf]69  _Chain_Initialize_empty( &_User_extensions_List );
70  _Chain_Initialize_empty( &_User_extensions_Switches_list );
71
72  if ( initial_extensions ) {
73    extension =
74      _Workspace_Allocate_or_fatal_error(
75        number_of_extensions * sizeof( User_extensions_Control )
76      );
77 
78    memset (
79      extension,
80      0,
81      number_of_extensions * sizeof( User_extensions_Control )
82    );
83 
84    for ( i = 0 ; i < number_of_extensions ; i++ ) {
85      _User_extensions_Add_set (extension, &initial_extensions[i]);
86      extension++;
87    }
88  }
[ac7d5ef0]89}
90
91/*PAGE
92 *
[3a4ae6c]93 *  _User_extensions_Add_API_set
[7af623bf]94 *
[1a8fde6c]95 *  DESCRIPTION:
96 *
97 *  This routine is used to add an API extension set to the active list.
[ac7d5ef0]98 */
[3a4ae6c]99 
[503dc058]100RTEMS_INLINE_ROUTINE void _User_extensions_Add_API_set (
[3a4ae6c]101  User_extensions_Control *the_extension
[ac7d5ef0]102)
103{
[aadb6b0]104  _Chain_Append( &_User_extensions_List, &the_extension->Node );
105
106  /*
107   *  If a switch handler is present, append it to the switch chain.
108   */
109
[02a200d]110  if ( the_extension->Callouts.thread_switch != NULL ) {
111    the_extension->Switch.thread_switch = the_extension->Callouts.thread_switch;
[aadb6b0]112    _Chain_Append(
113      &_User_extensions_Switches_list, &the_extension->Switch.Node );
114  }
[ac7d5ef0]115}
[7af623bf]116
[ac7d5ef0]117/*PAGE
118 *
[3a4ae6c]119 *  _User_extensions_Remove_set
[1a8fde6c]120 *
121 *  DESCRIPTION:
122 *
123 *  This routine is used to remove a user extension set from the active list.
[ac7d5ef0]124 */
125
[503dc058]126RTEMS_INLINE_ROUTINE void _User_extensions_Remove_set (
[3a4ae6c]127  User_extensions_Control  *the_extension
[ac7d5ef0]128)
129{
[3a4ae6c]130  _Chain_Extract( &the_extension->Node );
[7af623bf]131 
132  /*
133   * If a switch handler is present, remove it.
134   */
135
136  if ( the_extension->Callouts.thread_switch != NULL )
137    _Chain_Extract( &the_extension->Switch.Node );
[ac7d5ef0]138}
139
140/*PAGE
141 *
[3a4ae6c]142 *  _User_extensions_Thread_switch
[ac7d5ef0]143 *
[1a8fde6c]144 *  DESCRIPTION:
145 *
146 *  This routine is used to invoke the user extension which
147 *  is invoked when a context switch occurs.
[ac7d5ef0]148 */
149
[503dc058]150RTEMS_INLINE_ROUTINE void _User_extensions_Thread_switch (
[ac7d5ef0]151  Thread_Control *executing,
152  Thread_Control *heir
153)
154{
[7af623bf]155  Chain_Node                     *the_node;
156  User_extensions_Switch_control *the_extension_switch;
157 
158  for ( the_node = _User_extensions_Switches_list.first ;
159        !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ;
[ac7d5ef0]160        the_node = the_node->next ) {
161
[7af623bf]162    the_extension_switch = (User_extensions_Switch_control *) the_node;
[ac7d5ef0]163
[7af623bf]164    (*the_extension_switch->thread_switch)( executing, heir );
[ac7d5ef0]165  }
166}
167
168#endif
169/* end of include file */
Note: See TracBrowser for help on using the repository browser.