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

4.104.114.84.95
Last change on this file since baff4da was baff4da, checked in by Joel Sherrill <joel.sherrill@…>, on 11/01/04 at 13:22:41

2004-11-01 Joel Sherrill <joel@…>

  • score/cpu/no_cpu/rtems/score/cpu.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/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/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: Add Doxygen comments -- working modifications which are not complete and may have broken code. Committing so work and testing can proceed.
  • score/Doxyfile, score/mainpage.h: New files.
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/**
2 *  @file userext.inl
3 *
4 *  This file contains the macro implementation of the inlined routines
5 *  from the User Extension Handler
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2004.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef __USER_EXTENSIONS_inl
20#define __USER_EXTENSIONS_inl
21
22#include <rtems/score/wkspace.h>
23
24/**
25 *  @addtogroup ScoreUserExt
26 *  @{
27 */
28
29/**
30 *  This routine is used to add a user extension set to the active list.
31 *
32 *  @note Must be before _User_extensions_Handler_initialization to
33 *        ensure proper inlining.
34 */
35
36RTEMS_INLINE_ROUTINE void _User_extensions_Add_set (
37  User_extensions_Control *the_extension,
38  User_extensions_Table   *extension_table
39)
40{
41  the_extension->Callouts = *extension_table;
42
43  _Chain_Append( &_User_extensions_List, &the_extension->Node );
44
45  /*
46   * If a switch handler is present, append it to the switch chain.
47   */
48
49  if ( extension_table->thread_switch != NULL ) {
50    the_extension->Switch.thread_switch = extension_table->thread_switch;
51    _Chain_Append( &_User_extensions_Switches_list, &the_extension->Switch.Node );
52  }
53}
54
55/**
56 *  This routine performs the initialization necessary for this handler.
57 */
58
59RTEMS_INLINE_ROUTINE void _User_extensions_Handler_initialization (
60    uint32_t                number_of_extensions,
61    User_extensions_Table  *initial_extensions
62)
63{
64  User_extensions_Control *extension;
65  uint32_t                 i;
66
67  _Chain_Initialize_empty( &_User_extensions_List );
68  _Chain_Initialize_empty( &_User_extensions_Switches_list );
69
70  if ( initial_extensions ) {
71    extension = (User_extensions_Control *)
72      _Workspace_Allocate_or_fatal_error(
73        number_of_extensions * sizeof( User_extensions_Control )
74      );
75 
76    memset (
77      extension,
78      0,
79      number_of_extensions * sizeof( User_extensions_Control )
80    );
81 
82    for ( i = 0 ; i < number_of_extensions ; i++ ) {
83      _User_extensions_Add_set (extension, &initial_extensions[i]);
84      extension++;
85    }
86  }
87}
88
89/**
90 *  This routine is used to add an API extension set to the active list.
91 */
92 
93RTEMS_INLINE_ROUTINE void _User_extensions_Add_API_set (
94  User_extensions_Control *the_extension
95)
96{
97  _Chain_Append( &_User_extensions_List, &the_extension->Node );
98
99  /*
100   *  If a switch handler is present, append it to the switch chain.
101   */
102
103  if ( the_extension->Callouts.thread_switch != NULL ) {
104    the_extension->Switch.thread_switch = the_extension->Callouts.thread_switch;
105    _Chain_Append(
106      &_User_extensions_Switches_list, &the_extension->Switch.Node );
107  }
108}
109
110/**
111 *  This routine is used to remove a user extension set from the active list.
112 */
113
114RTEMS_INLINE_ROUTINE void _User_extensions_Remove_set (
115  User_extensions_Control  *the_extension
116)
117{
118  _Chain_Extract( &the_extension->Node );
119 
120  /*
121   * If a switch handler is present, remove it.
122   */
123
124  if ( the_extension->Callouts.thread_switch != NULL )
125    _Chain_Extract( &the_extension->Switch.Node );
126}
127
128/**
129 *  This routine is used to invoke the user extension which
130 *  is invoked when a context switch occurs.
131 */
132
133RTEMS_INLINE_ROUTINE void _User_extensions_Thread_switch (
134  Thread_Control *executing,
135  Thread_Control *heir
136)
137{
138  Chain_Node                     *the_node;
139  User_extensions_Switch_control *the_extension_switch;
140 
141  for ( the_node = _User_extensions_Switches_list.first ;
142        !_Chain_Is_tail( &_User_extensions_Switches_list, the_node ) ;
143        the_node = the_node->next ) {
144
145    the_extension_switch = (User_extensions_Switch_control *) the_node;
146
147    (*the_extension_switch->thread_switch)( executing, heir );
148  }
149}
150
151/**@}*/
152
153#endif
154/* end of include file */
Note: See TracBrowser for help on using the repository browser.