source: rtems/cpukit/rtems/include/rtems/rtems/intr.h @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 7.0 KB
Line 
1/**
2 *  @file rtems/rtems/intr.h
3 *
4 * @defgroup ClassicINTR Interrupts
5 *
6 * @ingroup ClassicRTEMS
7 * @brief Header file for Interrupt Manager
8 *
9 * This include file contains all the constants and structures associated with
10 * the Interrupt Manager.
11 */
12
13/* COPYRIGHT (c) 1989-2013.
14 * On-Line Applications Research Corporation (OAR).
15 *
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.org/license/LICENSE.
19 */
20
21#ifndef _RTEMS_RTEMS_INTR_H
22#define _RTEMS_RTEMS_INTR_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#include <rtems/rtems/status.h>
29#include <rtems/score/isr.h>
30#include <rtems/score/isrlock.h>
31
32/**
33 *  @defgroup ClassicINTR Interrupts
34 *
35 *  @ingroup ClassicRTEMS
36 *
37 *  This encapsulates functionality related to the Classic API Interrupt
38 *  Manager.
39 */
40/**@{*/
41
42/**
43 *  @brief Interrupt level type.
44 */
45typedef ISR_Level rtems_interrupt_level;
46
47/**
48 *  @brief Control block type used to manage the vectors.
49 */
50typedef ISR_Vector_number rtems_vector_number;
51
52/**
53 *  @brief Return type for interrupt handler.
54 */
55typedef ISR_Handler rtems_isr;
56
57#if (CPU_SIMPLE_VECTORED_INTERRUPTS == FALSE)
58
59typedef ISR_Handler_entry rtems_isr_entry;
60
61#else
62/**
63 *  @brief Interrupt handler type.
64 *
65 *  @see rtems_interrupt_catch()
66 */
67typedef rtems_isr ( *rtems_isr_entry )(
68                 rtems_vector_number
69             );
70
71/**
72 * @brief RTEMS Interrupt Catch
73 *
74 * This directive installs @a new_isr_handler as the RTEMS interrupt service
75 * routine for the interrupt vector with number @a vector. The previous RTEMS
76 * interrupt service routine is returned in @a old_isr_handler.
77 * 
78 * @param[in] new_isr_handler is the address of interrupt service routine
79 * @param[in] vector is the interrupt vector number
80 * @param[in] old_isr_handler address at which to store previous ISR address
81 *
82 * @retval RTEMS_SUCCESSFUL and *old_isr_handler filled with previous ISR
83 *              address
84 */
85rtems_status_code rtems_interrupt_catch(
86  rtems_isr_entry      new_isr_handler,
87  rtems_vector_number  vector,
88  rtems_isr_entry     *old_isr_handler
89);
90#endif
91
92/**
93 *  @brief Disable RTEMS Interrupt
94 *
95 *  @note The interrupt level shall be of type @ref rtems_interrupt_level.
96 */
97#define rtems_interrupt_disable( _isr_cookie ) \
98    _ISR_Disable(_isr_cookie)
99
100/**
101 *  @brief Enable RTEMS Interrupt
102 *
103 *  @note The interrupt level shall be of type @ref rtems_interrupt_level.
104 */
105#define rtems_interrupt_enable( _isr_cookie ) \
106    _ISR_Enable(_isr_cookie)
107
108/**
109 *  @brief Flash RTEMS Interrupt
110 *
111 *  @note The interrupt level shall be of type @ref rtems_interrupt_level.
112 */
113#define rtems_interrupt_flash( _isr_cookie ) \
114    _ISR_Flash(_isr_cookie)
115
116/**
117 *  @brief RTEMS Interrupt Is in Progress
118 *
119 *  A return value of true indicates that the caller is an interrupt service
120 *  routine and @b not a thread.  The directives available to an interrupt
121 *  service routine are restricted.
122 */
123#define rtems_interrupt_is_in_progress() \
124    _ISR_Is_in_progress()
125
126/**
127 *  @brief This routine generates an interrupt.
128 *
129 *  @note No implementation.
130 */
131#define rtems_interrupt_cause( _interrupt_to_cause )
132
133/**
134 *  @brief This routine clears the specified interrupt.
135 *
136 *  @note No implementation.
137 */
138#define rtems_interrupt_clear( _interrupt_to_clear )
139
140/**
141 * @defgroup ClassicINTRLocks Interrupt Locks
142 *
143 * @ingroup ClassicINTR
144 *
145 * @brief Low-level lock to protect critical sections accessed by threads and
146 * interrupt service routines.
147 *
148 * On single processor configurations the interrupt locks degrade to simple
149 * interrupt disable/enable sequences.  No additional storage or objects are
150 * required.
151 *
152 * This synchronization primitive is supported on SMP configurations.  Here SMP
153 * locks are used.
154 * @{
155 */
156
157/**
158 * @brief Interrupt lock control.
159 */
160typedef ISR_lock_Control rtems_interrupt_lock;
161
162/**
163 * @brief Local interrupt lock context for acquire and release pairs.
164 */
165typedef ISR_lock_Context rtems_interrupt_lock_context;
166
167/**
168 * @brief Initializer for static initialization of interrupt locks.
169 */
170#define RTEMS_INTERRUPT_LOCK_INITIALIZER( _name ) ISR_LOCK_INITIALIZER( _name )
171
172/**
173 * @brief Initializes an interrupt lock.
174 *
175 * Concurrent initialization leads to unpredictable results.
176 *
177 * @param[in,out] _lock The interrupt lock.
178 * @param[in] _name The name for the interrupt lock.  This name must be
179 * persistent throughout the life time of this lock.
180 */
181#define rtems_interrupt_lock_initialize( _lock, _name ) \
182  _ISR_lock_Initialize( _lock, _name )
183
184/**
185 * @brief Destroys an interrupt lock.
186 *
187 * Concurrent destruction leads to unpredictable results.
188 *
189 * @param[in,out] _lock The interrupt lock control.
190 */
191#define rtems_interrupt_lock_destroy( _lock ) \
192  _ISR_lock_Destroy( _lock )
193
194/**
195 * @brief Acquires an interrupt lock.
196 *
197 * Interrupts will be disabled.  On SMP configurations this function acquires
198 * an SMP lock.
199 *
200 * This function can be used in thread and interrupt context.
201 *
202 * @param[in,out] _lock The interrupt lock.
203 * @param[in,out] _lock_context The local interrupt lock context for an acquire
204 * and release pair.
205 *
206 * @see rtems_interrupt_lock_release().
207 */
208#define rtems_interrupt_lock_acquire( _lock, _lock_context ) \
209  _ISR_lock_ISR_disable_and_acquire( _lock, _lock_context )
210
211/**
212 * @brief Releases an interrupt lock.
213 *
214 * The interrupt status will be restored.  On SMP configurations this function
215 * releases an SMP lock.
216 *
217 * This function can be used in thread and interrupt context.
218 *
219 * @param[in,out] _lock The interrupt lock.
220 * @param[in,out] _lock_context The local interrupt lock context for an acquire
221 * and release pair.
222 *
223 * @see rtems_interrupt_lock_acquire().
224 */
225#define rtems_interrupt_lock_release( _lock, _lock_context ) \
226  _ISR_lock_Release_and_ISR_enable( _lock, _lock_context )
227
228/**
229 * @brief Acquires an interrupt lock in the corresponding interrupt service
230 * routine.
231 *
232 * The interrupt status will remain unchanged.  On SMP configurations this
233 * function acquires an SMP lock.
234 *
235 * In case the corresponding interrupt service routine can be interrupted by
236 * higher priority interrupts and these interrupts enter the critical section
237 * protected by this lock, then the result is unpredictable.
238 *
239 * @param[in,out] _lock The interrupt lock.
240 * @param[in,out] _lock_context The local interrupt lock context for an acquire
241 * and release pair.
242 *
243 * @see rtems_interrupt_lock_release_isr().
244 */
245#define rtems_interrupt_lock_acquire_isr( _lock, _lock_context ) \
246  _ISR_lock_Acquire( _lock, _lock_context )
247
248/**
249 * @brief Releases an interrupt lock in the corresponding interrupt service
250 * routine.
251 *
252 * The interrupt status will remain unchanged.  On SMP configurations this
253 * function releases an SMP lock.
254 *
255 * @param[in,out] _lock The interrupt lock.
256 * @param[in,out] _lock_context The local interrupt lock context for an acquire
257 * and release pair.
258 *
259 * @see rtems_interrupt_lock_acquire_isr().
260 */
261#define rtems_interrupt_lock_release_isr( _lock, _lock_context ) \
262  _ISR_lock_Release( _lock, _lock_context )
263
264/** @} */
265
266#ifdef __cplusplus
267}
268#endif
269
270/**@}*/
271
272#endif
273/* end of include file */
Note: See TracBrowser for help on using the repository browser.