]> git.sur5r.net Git - freertos/blob - Demo/AVR32_UC3/DRIVERS/INTC/intc.h
Start to re-arrange files to include FreeRTOS+ in main download.
[freertos] / Demo / AVR32_UC3 / DRIVERS / INTC / intc.h
1 /*This file is prepared for Doxygen automatic documentation generation.*/\r
2 /*! \file *********************************************************************\r
3  *\r
4  * \brief INTC driver for AVR32 UC3.\r
5  *\r
6  * AVR32 Interrupt Controller driver module.\r
7  *\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
10  * - AppNote:\r
11  *\r
12  * \author               Atmel Corporation: http://www.atmel.com \n\r
13  *                       Support and FAQ: http://support.atmel.no/\r
14  *\r
15  ******************************************************************************/\r
16 \r
17 /* Copyright (c) 2007, Atmel Corporation All rights reserved.\r
18  *\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
21  *\r
22  * 1. Redistributions of source code must retain the above copyright notice,\r
23  * this list of conditions and the following disclaimer.\r
24  *\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
28  *\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
31  *\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
42  */\r
43 \r
44 \r
45 #ifndef _INTC_H_\r
46 #define _INTC_H_\r
47 \r
48 #include "compiler.h"\r
49 \r
50 \r
51 //! Maximal number of interrupt request lines per group.\r
52 #define AVR32_INTC_MAX_NUM_IRQS_PER_GRP             32\r
53 \r
54 //! Number of interrupt priority levels.\r
55 #define AVR32_INTC_NUM_INT_LEVELS                   (1 << AVR32_INTC_IPR0_INTLEV_SIZE)\r
56 \r
57 /*! \name Interrupt Priority Levels\r
58  */\r
59 //! @{\r
60 #define INT0          0 //!< Lowest interrupt priority level.\r
61 #define INT1          1\r
62 #define INT2          2\r
63 #define INT3          3 //!< Highest interrupt priority level.\r
64 //! @}\r
65 \r
66 \r
67 #ifdef __AVR32_ABI_COMPILER__ // Automatically defined when compiling for AVR32, not when assembling.\r
68 \r
69 //! Pointer to interrupt handler.\r
70 #if __GNUC__\r
71 typedef void (*__int_handler)(void);\r
72 #elif __ICCAVR32__\r
73 typedef void (__interrupt *__int_handler)(void);\r
74 #endif\r
75 \r
76 \r
77 /*! \brief Initializes the hardware interrupt controller driver.\r
78  *\r
79  * \note Taken and adapted from Newlib.\r
80  */\r
81 extern void INTC_init_interrupts(void);\r
82 \r
83 /*! \brief Registers an interrupt handler.\r
84  *\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
88  *\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
92  *\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
95  *          be effective.\r
96  *\r
97  * \note Taken and adapted from Newlib.\r
98  */\r
99 extern void INTC_register_interrupt(__int_handler handler, unsigned int irq, unsigned int int_lev);\r
100 \r
101 #endif  // __AVR32_ABI_COMPILER__\r
102 \r
103 \r
104 #endif  // _INTC_H_\r