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