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