1 |
583 |
jeremybenn |
/*This file is prepared for Doxygen automatic documentation generation.*/
|
2 |
|
|
/*! \file *********************************************************************
|
3 |
|
|
*
|
4 |
|
|
* \brief INTC driver for AVR32 UC3.
|
5 |
|
|
*
|
6 |
|
|
* AVR32 Interrupt Controller driver module.
|
7 |
|
|
*
|
8 |
|
|
* - Compiler: IAR EWAVR32 and GNU GCC for AVR32
|
9 |
|
|
* - Supported devices: All AVR32 devices with an INTC module can be used.
|
10 |
|
|
* - AppNote:
|
11 |
|
|
*
|
12 |
|
|
* \author Atmel Corporation: http://www.atmel.com \n
|
13 |
|
|
* Support and FAQ: http://support.atmel.no/
|
14 |
|
|
*
|
15 |
|
|
******************************************************************************/
|
16 |
|
|
|
17 |
|
|
/* Copyright (c) 2007, Atmel Corporation All rights reserved.
|
18 |
|
|
*
|
19 |
|
|
* Redistribution and use in source and binary forms, with or without
|
20 |
|
|
* modification, are permitted provided that the following conditions are met:
|
21 |
|
|
*
|
22 |
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
23 |
|
|
* this list of conditions and the following disclaimer.
|
24 |
|
|
*
|
25 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
26 |
|
|
* this list of conditions and the following disclaimer in the documentation
|
27 |
|
|
* and/or other materials provided with the distribution.
|
28 |
|
|
*
|
29 |
|
|
* 3. The name of ATMEL may not be used to endorse or promote products derived
|
30 |
|
|
* from this software without specific prior written permission.
|
31 |
|
|
*
|
32 |
|
|
* THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
33 |
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
34 |
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND
|
35 |
|
|
* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
|
36 |
|
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
37 |
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
38 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
39 |
|
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
40 |
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
41 |
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
42 |
|
|
*/
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
#ifndef _INTC_H_
|
46 |
|
|
#define _INTC_H_
|
47 |
|
|
|
48 |
|
|
#include "compiler.h"
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
//! Maximal number of interrupt request lines per group.
|
52 |
|
|
#define AVR32_INTC_MAX_NUM_IRQS_PER_GRP 32
|
53 |
|
|
|
54 |
|
|
//! Number of interrupt priority levels.
|
55 |
|
|
#define AVR32_INTC_NUM_INT_LEVELS (1 << AVR32_INTC_IPR0_INTLEV_SIZE)
|
56 |
|
|
|
57 |
|
|
/*! \name Interrupt Priority Levels
|
58 |
|
|
*/
|
59 |
|
|
//! @{
|
60 |
|
|
#define INT0 0 //!< Lowest interrupt priority level.
|
61 |
|
|
#define INT1 1
|
62 |
|
|
#define INT2 2
|
63 |
|
|
#define INT3 3 //!< Highest interrupt priority level.
|
64 |
|
|
//! @}
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
#ifdef __AVR32_ABI_COMPILER__ // Automatically defined when compiling for AVR32, not when assembling.
|
68 |
|
|
|
69 |
|
|
//! Pointer to interrupt handler.
|
70 |
|
|
#if __GNUC__
|
71 |
|
|
typedef void (*__int_handler)(void);
|
72 |
|
|
#elif __ICCAVR32__
|
73 |
|
|
typedef void (__interrupt *__int_handler)(void);
|
74 |
|
|
#endif
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
/*! \brief Initializes the hardware interrupt controller driver.
|
78 |
|
|
*
|
79 |
|
|
* \note Taken and adapted from Newlib.
|
80 |
|
|
*/
|
81 |
|
|
extern void INTC_init_interrupts(void);
|
82 |
|
|
|
83 |
|
|
/*! \brief Registers an interrupt handler.
|
84 |
|
|
*
|
85 |
|
|
* \param handler Interrupt handler to register.
|
86 |
|
|
* \param irq IRQ of the interrupt handler to register.
|
87 |
|
|
* \param int_lev Interrupt priority level to assign to the group of this IRQ.
|
88 |
|
|
*
|
89 |
|
|
* \warning The interrupt handler must manage the `rete' instruction, what can
|
90 |
|
|
* be done thanks to pure assembly, inline assembly or the
|
91 |
|
|
* `__attribute__((__interrupt__))' C function attribute.
|
92 |
|
|
*
|
93 |
|
|
* \warning If several interrupt handlers of a same group are registered with
|
94 |
|
|
* different priority levels, only the latest priority level set will
|
95 |
|
|
* be effective.
|
96 |
|
|
*
|
97 |
|
|
* \note Taken and adapted from Newlib.
|
98 |
|
|
*/
|
99 |
|
|
extern void INTC_register_interrupt(__int_handler handler, unsigned int irq, unsigned int int_lev);
|
100 |
|
|
|
101 |
|
|
#endif // __AVR32_ABI_COMPILER__
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
#endif // _INTC_H_
|