source: rtems/cpukit/include/rtems/rtems/intr.h @ 2afb22b

5
Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 10.3 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#if !defined(RTEMS_SMP)
93
94/**
95 *  @brief Disable RTEMS Interrupt
96 *
97 *  @note The interrupt level shall be of type @ref rtems_interrupt_level.
98 *
99 *  This macro is only available on uni-processor configurations.  The macro
100 *  rtems_interrupt_local_disable() is available on all configurations.
101 */
102#define rtems_interrupt_disable( _isr_cookie ) \
103    _ISR_Local_disable(_isr_cookie)
104
105/**
106 *  @brief Enable RTEMS Interrupt
107 *
108 *  @note The interrupt level shall be of type @ref rtems_interrupt_level.
109 *
110 *  This macro is only available on uni-processor configurations.  The macro
111 *  rtems_interrupt_local_enable() is available on all configurations.
112 */
113#define rtems_interrupt_enable( _isr_cookie ) \
114    _ISR_Local_enable(_isr_cookie)
115
116/**
117 *  @brief Flash RTEMS Interrupt
118 *
119 *  @note The interrupt level shall be of type @ref rtems_interrupt_level.
120 *
121 *  This macro is only available on uni-processor configurations.  The macro
122 *  rtems_interrupt_local_disable() and rtems_interrupt_local_enable() is
123 *  available on all configurations.
124 */
125#define rtems_interrupt_flash( _isr_cookie ) \
126    _ISR_Local_flash(_isr_cookie)
127
128#endif /* RTEMS_SMP */
129
130/**
131 * @brief This macro disables the interrupts on the current processor.
132 *
133 * On SMP configurations this will not ensure system wide mutual exclusion.
134 * Use interrupt locks instead.
135 *
136 * @param[in] _isr_cookie The previous interrupt level is returned.  The type
137 *   of this variable must be rtems_interrupt_level.
138 *
139 * @see rtems_interrupt_local_enable().
140 */
141#define rtems_interrupt_local_disable( _isr_cookie ) \
142  _ISR_Local_disable( _isr_cookie )
143
144/**
145 * @brief This macro restores the previous interrupt level on the current
146 * processor.
147 *
148 * @param[in] _isr_cookie The previous interrupt level returned by
149 *   rtems_interrupt_local_disable().
150 */
151#define rtems_interrupt_local_enable( _isr_cookie ) \
152  _ISR_Local_enable( _isr_cookie )
153
154/**
155 *  @brief RTEMS Interrupt Is in Progress
156 *
157 *  A return value of true indicates that the caller is an interrupt service
158 *  routine and @b not a thread.  The directives available to an interrupt
159 *  service routine are restricted.
160 */
161#define rtems_interrupt_is_in_progress() \
162    _ISR_Is_in_progress()
163
164/**
165 *  @brief This routine generates an interrupt.
166 *
167 *  @note No implementation.
168 */
169#define rtems_interrupt_cause( _interrupt_to_cause )
170
171/**
172 *  @brief This routine clears the specified interrupt.
173 *
174 *  @note No implementation.
175 */
176#define rtems_interrupt_clear( _interrupt_to_clear )
177
178/**
179 * @defgroup ClassicINTRLocks Interrupt Locks
180 *
181 * @ingroup ClassicINTR
182 *
183 * @brief Low-level lock to protect critical sections accessed by threads and
184 * interrupt service routines.
185 *
186 * On single processor configurations the interrupt locks degrade to simple
187 * interrupt disable/enable sequences.  No additional storage or objects are
188 * required.
189 *
190 * This synchronization primitive is supported on SMP configurations.  Here SMP
191 * locks are used.
192 * @{
193 */
194
195/**
196 * @brief Interrupt lock control.
197 */
198typedef ISR_lock_Control rtems_interrupt_lock;
199
200/**
201 * @brief Local interrupt lock context for acquire and release pairs.
202 */
203typedef ISR_lock_Context rtems_interrupt_lock_context;
204
205/**
206 * @brief Defines an interrupt lock member.
207 *
208 * Do not add a ';' after this macro.
209 *
210 * @param _designator The designator for the interrupt lock.
211 */
212#define RTEMS_INTERRUPT_LOCK_MEMBER( _designator ) \
213  ISR_LOCK_MEMBER( _designator )
214
215/**
216 * @brief Declares an interrupt lock variable.
217 *
218 * Do not add a ';' after this macro.
219 *
220 * @param _qualifier The qualifier for the interrupt lock, e.g. extern.
221 * @param _designator The designator for the interrupt lock.
222 */
223#define RTEMS_INTERRUPT_LOCK_DECLARE( _qualifier, _designator ) \
224  ISR_LOCK_DECLARE( _qualifier, _designator )
225
226/**
227 * @brief Defines an interrupt lock variable.
228 *
229 * Do not add a ';' after this macro.
230 *
231 * @param _qualifier The qualifier for the interrupt lock, e.g. static.
232 * @param _designator The designator for the interrupt lock.
233 * @param _name The name for the interrupt lock.  It must be a string.  The
234 * name is only used if profiling is enabled.
235 */
236#define RTEMS_INTERRUPT_LOCK_DEFINE( _qualifier, _designator, _name ) \
237  ISR_LOCK_DEFINE( _qualifier, _designator, _name )
238
239/**
240 * @brief Defines an interrupt lock variable reference.
241 *
242 * Do not add a ';' after this macro.
243 *
244 * @param _designator The designator for the interrupt lock reference.
245 * @param _target The target for the interrupt lock reference.
246 */
247#define RTEMS_INTERRUPT_LOCK_REFERENCE( _designator, _target ) \
248  ISR_LOCK_REFERENCE( _designator, _target )
249
250/**
251 * @brief Initializer for static initialization of interrupt locks.
252 *
253 * @param _name The name for the interrupt lock.  It must be a string.  The
254 * name is only used if profiling is enabled.
255 */
256#define RTEMS_INTERRUPT_LOCK_INITIALIZER( _name ) ISR_LOCK_INITIALIZER( _name )
257
258/**
259 * @brief Initializes an interrupt lock.
260 *
261 * Concurrent initialization leads to unpredictable results.
262 *
263 * @param[in,out] _lock The interrupt lock.
264 * @param[in] _name The name for the interrupt lock.  This name must be a
265 * string persistent throughout the life time of this lock.  The name is only
266 * used if profiling is enabled.
267 */
268#define rtems_interrupt_lock_initialize( _lock, _name ) \
269  _ISR_lock_Initialize( _lock, _name )
270
271/**
272 * @brief Destroys an interrupt lock.
273 *
274 * Concurrent destruction leads to unpredictable results.
275 *
276 * @param[in,out] _lock The interrupt lock control.
277 */
278#define rtems_interrupt_lock_destroy( _lock ) \
279  _ISR_lock_Destroy( _lock )
280
281/**
282 * @brief Disables interrupts on the current processor.
283 *
284 * This function can be used in thread and interrupt context.
285 *
286 * @param[in,out] _lock_context The local interrupt lock context for an acquire
287 * and release pair.
288 *
289 * @see rtems_interrupt_lock_acquire_isr().
290 */
291#define rtems_interrupt_lock_interrupt_disable( _lock_context ) \
292  _ISR_lock_ISR_disable( _lock_context )
293
294/**
295 * @brief Acquires an interrupt lock.
296 *
297 * Interrupts will be disabled.  On SMP configurations this function acquires
298 * an SMP lock.
299 *
300 * This function can be used in thread and interrupt context.
301 *
302 * @param[in,out] _lock The interrupt lock.
303 * @param[in,out] _lock_context The local interrupt lock context for an acquire
304 * and release pair.
305 *
306 * @see rtems_interrupt_lock_release().
307 */
308#define rtems_interrupt_lock_acquire( _lock, _lock_context ) \
309  _ISR_lock_ISR_disable_and_acquire( _lock, _lock_context )
310
311/**
312 * @brief Releases an interrupt lock.
313 *
314 * The interrupt status will be restored.  On SMP configurations this function
315 * releases an SMP lock.
316 *
317 * This function can be used in thread and interrupt context.
318 *
319 * @param[in,out] _lock The interrupt lock.
320 * @param[in,out] _lock_context The local interrupt lock context for an acquire
321 * and release pair.
322 *
323 * @see rtems_interrupt_lock_acquire().
324 */
325#define rtems_interrupt_lock_release( _lock, _lock_context ) \
326  _ISR_lock_Release_and_ISR_enable( _lock, _lock_context )
327
328/**
329 * @brief Acquires an interrupt lock in the corresponding interrupt service
330 * routine.
331 *
332 * The interrupt status will remain unchanged.  On SMP configurations this
333 * function acquires an SMP lock.
334 *
335 * In case the corresponding interrupt service routine can be interrupted by
336 * higher priority interrupts and these interrupts enter the critical section
337 * protected by this lock, then the result is unpredictable.
338 *
339 * @param[in,out] _lock The interrupt lock.
340 * @param[in,out] _lock_context The local interrupt lock context for an acquire
341 * and release pair.
342 *
343 * @see rtems_interrupt_lock_release_isr().
344 */
345#define rtems_interrupt_lock_acquire_isr( _lock, _lock_context ) \
346  _ISR_lock_Acquire( _lock, _lock_context )
347
348/**
349 * @brief Releases an interrupt lock in the corresponding interrupt service
350 * routine.
351 *
352 * The interrupt status will remain unchanged.  On SMP configurations this
353 * function releases an SMP lock.
354 *
355 * @param[in,out] _lock The interrupt lock.
356 * @param[in,out] _lock_context The local interrupt lock context for an acquire
357 * and release pair.
358 *
359 * @see rtems_interrupt_lock_acquire_isr().
360 */
361#define rtems_interrupt_lock_release_isr( _lock, _lock_context ) \
362  _ISR_lock_Release( _lock, _lock_context )
363
364/** @} */
365
366#ifdef __cplusplus
367}
368#endif
369
370/**@}*/
371
372#endif
373/* end of include file */
Note: See TracBrowser for help on using the repository browser.