source: rtems/cpukit/score/include/rtems/score/isr.h @ 11e8bc5

4.115
Last change on this file since 11e8bc5 was 11e8bc5, checked in by Joel Sherrill <joel.sherrill@…>, on 06/29/10 at 00:34:12

2010-06-28 Joel Sherrill <joel.sherrill@…>

PR 1573/cpukit

  • configure.ac, posix/src/killinfo.c, posix/src/psignalclearprocesssignals.c, posix/src/psignalsetprocesssignals.c, posix/src/psignalunblockthread.c, posix/src/pthreadcreate.c, posix/src/pthreadkill.c, posix/src/pthreadsigmask.c, rtems/src/signalsend.c, rtems/src/taskmode.c, score/Makefile.am, score/preinstall.am, score/include/rtems/system.h, score/include/rtems/score/context.h, score/include/rtems/score/isr.h, score/include/rtems/score/thread.h, score/src/isr.c, score/src/isrthreaddispatch.c, score/src/thread.c, score/src/threaddispatch.c, score/src/threadloadenv.c: Add a per cpu data structure which contains the information required by RTEMS for each CPU core. This encapsulates information such as thread executing, heir, idle and dispatch needed.
  • score/include/rtems/score/percpu.h, score/src/percpu.c: New files.
  • Property mode set to 100644
File size: 6.6 KB
Line 
1/**
2 *  @file  rtems/score/isr.h
3 *
4 *  This include file contains all the constants and structures associated
5 *  with the management of processor interrupt levels.  This handler
6 *  supports interrupt critical sections, vectoring of user interrupt
7 *  handlers, nesting of interrupts, and manipulating interrupt levels.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2006.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 *
18 *  $Id$
19 */
20
21#ifndef _RTEMS_SCORE_ISR_H
22#define _RTEMS_SCORE_ISR_H
23
24#include <rtems/score/percpu.h>
25
26/**
27 *  @defgroup ScoreISR ISR Handler
28 *
29 *  This handler encapsulates functionality which provides the foundation
30 *  ISR services used in all of the APIs supported by RTEMS.
31 *
32 *  The ISR Nest level counter variable is maintained as part of the
33 *  per cpu data structure.
34 */
35/**@{*/
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/**
42 *  The following type defines the control block used to manage
43 *  the interrupt level portion of the status register.
44 */
45typedef uint32_t   ISR_Level;
46
47/**
48 *  The following type defines the type used to manage the vectors.
49 */
50typedef uint32_t   ISR_Vector_number;
51
52/**
53 *  Return type for ISR Handler
54 */
55typedef void ISR_Handler;
56
57/**
58 *  Pointer to an ISR Handler
59 */
60#if (CPU_ISR_PASSES_FRAME_POINTER == 1)
61typedef ISR_Handler ( *ISR_Handler_entry )(
62                 ISR_Vector_number,
63                 CPU_Interrupt_frame *
64             );
65#else
66typedef ISR_Handler ( *ISR_Handler_entry )(
67                 ISR_Vector_number
68             );
69#endif
70
71/**
72 *  This constant promotes out the number of vectors truly supported by
73 *  the current CPU being used.  This is usually the number of distinct vectors
74 *  the cpu can vector.
75 */
76#define ISR_NUMBER_OF_VECTORS                CPU_INTERRUPT_NUMBER_OF_VECTORS
77
78/**
79 *  This constant promotes out the highest valid interrupt vector number.
80 */
81#define ISR_INTERRUPT_MAXIMUM_VECTOR_NUMBER  CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER
82
83#if (CPU_SIMPLE_VECTORED_INTERRUPTS == TRUE)
84/**
85 *  The following declares the Vector Table.  Application
86 *  interrupt service routines are vectored by the ISR Handler via this table.
87 */
88SCORE_EXTERN ISR_Handler_entry *_ISR_Vector_table;
89#endif
90
91/**
92 *  This routine performs the initialization necessary for this handler.
93 */
94void _ISR_Handler_initialization ( void );
95
96/**
97 *  This routine disables all interrupts so that a critical section
98 *  of code can be executing without being interrupted.  Upon return,
99 *  the argument _level will contain the previous interrupt mask level.
100 */
101#define _ISR_Disable( _level ) \
102  do { \
103    _CPU_ISR_Disable( _level ); \
104    RTEMS_COMPILER_MEMORY_BARRIER(); \
105  } while (0)
106
107/**
108 *  This routine enables interrupts to the previous interrupt mask
109 *  LEVEL.  It is used at the end of a critical section of code to
110 *  enable interrupts so they can be processed again.
111 */
112#define _ISR_Enable( _level ) \
113  do { \
114    RTEMS_COMPILER_MEMORY_BARRIER(); \
115    _CPU_ISR_Enable( _level ); \
116  } while (0)
117
118/**
119 *  This routine temporarily enables interrupts to the previous
120 *  interrupt mask level and then disables all interrupts so that
121 *  the caller can continue into the second part of a critical
122 *  section.  This routine is used to temporarily enable interrupts
123 *  during a long critical section.  It is used in long sections of
124 *  critical code when a point is reached at which interrupts can
125 *  be temporarily enabled.  Deciding where to flash interrupts
126 *  in a long critical section is often difficult and the point
127 *  must be selected with care to ensure that the critical section
128 *  properly protects itself.
129 */
130#define _ISR_Flash( _level ) \
131  do { \
132    RTEMS_COMPILER_MEMORY_BARRIER(); \
133    _CPU_ISR_Flash( _level ); \
134    RTEMS_COMPILER_MEMORY_BARRIER(); \
135  } while (0)
136
137/**
138 *  This routine installs new_handler as the interrupt service routine
139 *  for the specified vector.  The previous interrupt service routine is
140 *  returned as old_handler.
141 */
142#define _ISR_Install_vector( _vector, _new_handler, _old_handler ) \
143  _CPU_ISR_install_vector( _vector, _new_handler, _old_handler )
144
145/**
146 *  This routine returns the current interrupt level.
147 */
148#define _ISR_Get_level() \
149        _CPU_ISR_Get_level()
150
151/**
152 *  This routine sets the current interrupt level to that specified
153 *  by new_level.  The new interrupt level is effective when the
154 *  routine exits.
155 */
156#define _ISR_Set_level( _new_level ) \
157          do { \
158                RTEMS_COMPILER_MEMORY_BARRIER();  \
159                _CPU_ISR_Set_level( _new_level ); \
160                RTEMS_COMPILER_MEMORY_BARRIER();  \
161        } while (0)
162
163
164/**
165 *  This routine is the interrupt dispatcher.  ALL interrupts
166 *  are vectored to this routine so that minimal context can be saved
167 *  and setup performed before the application's high-level language
168 *  interrupt service routine is invoked.   After the application's
169 *  interrupt service routine returns control to this routine, it
170 *  will determine if a thread dispatch is necessary.  If so, it will
171 *  ensure that the necessary thread scheduling operations are
172 *  performed when the outermost interrupt service routine exits.
173 *
174 *  @note  Implemented in assembly language.
175 */
176void _ISR_Handler( void );
177
178/**
179 *  This routine provides a wrapper so that the routine
180 *  @ref _Thread_Dispatch can be invoked when a reschedule is necessary
181 *  at the end of the outermost interrupt service routine.  This
182 *  wrapper is necessary to establish the processor context needed
183 *  by _Thread_Dispatch and to save the processor context which is
184 *  corrupted by _Thread_Dispatch.  This context typically consists
185 *  of registers which are not preserved across routine invocations.
186 *
187 *  @note  Implemented in assembly language.
188 */
189void _ISR_Dispatch( void );
190
191/**
192 *  Invokes the thread dispatcher or signal extension if necessary.
193 *
194 *  It should be called at the end of interrupt processing.  The interrupt nest
195 *  level must be zero before calling this routine.
196 *
197 *  This is a high level replacement of _ISR_Dispatch().  It must be invoked
198 *  within an environment such that a call to _Thread_Dispatch() is allowed.
199 */
200void _ISR_Thread_dispatch( void );
201
202/**
203 *  This function returns true if the processor is currently servicing
204 *  and interrupt and false otherwise.   A return value of true indicates
205 *  that the caller is an interrupt service routine, NOT a thread.  The
206 */
207#if (CPU_PROVIDES_ISR_IS_IN_PROGRESS == TRUE)
208bool _ISR_Is_in_progress( void );
209#else
210#define _ISR_Is_in_progress() \
211        (_ISR_Nest_level != 0)
212#endif
213
214#include <rtems/score/isr.inl>
215
216#ifdef __cplusplus
217}
218#endif
219
220/**@}*/
221
222#endif
223/* end of include file */
Note: See TracBrowser for help on using the repository browser.