+ /* Enable C linkage for C++ Compilers: */\r
+ #if defined(__cplusplus)\r
+ extern "C" {\r
+ #endif\r
+\r
+ /* Private Interface - For use in library only: */\r
+ #if !defined(__DOXYGEN__)\r
+ /* External Variables: */\r
+ extern const void EVBA_Table;\r
+ extern const uint32_t Autovector_Table[];\r
+ extern InterruptHandlerPtr_t InterruptHandlers[AVR32_INTC_NUM_INT_GRPS];\r
+ #endif\r
+\r
+ /* Public Interface - May be used in end-application: */\r
+ /* Macros: */\r
+ /** Converts a given interrupt index into its assocated interrupt group.\r
+ *\r
+ * \param[in] IRQIndex Index of the interrupt request to convert.\r
+ *\r
+ * \return Interrupt group number associated with the interrupt index.\r
+ */\r
+ #define INTC_IRQ_GROUP(IRQIndex) (IRQIndex / 32)\r
+\r
+ /** Converts a given interrupt index into its assocated interrupt line.\r
+ *\r
+ * \param[in] IRQIndex Index of the interrupt request to convert.\r
+ *\r
+ * \return Interrupt line number associated with the interrupt index.\r
+ */\r
+ #define INTC_IRQ_LINE(IRQIndex) (IRQIndex % 32)\r
+\r
+ /* Type Defines: */\r
+ /** Type define for an interrupt handler ISR function. */\r
+ typedef void (*InterruptHandlerPtr_t)(void);\r
+\r
+ /* Function Prototypes: */\r
+ /** Initializes the interrupt controller, nulling out all interrupt handlers ready for new registration. This\r
+ * function should be called once on startup to ensure the interrupt controller is ready for use.\r
+ */\r
+ void INTC_Init(void);\r
+\r
+ /* Inline Functions: */\r
+ /** Registers a handler for a given interrupt group. On the AVR32 UC3 devices, interrupts are grouped by\r
+ * peripheral. To save on SRAM used, a single ISR handles all interrupt lines within a single group - to\r
+ * determine the exact line that has interrupted within the group ISR handler, use \ref INTC_GetGroupInterrupts().\r
+ *\r
+ * If multiple interrupts with the same group are registered, the last registered handler will become the\r
+ * handler called for interrupts raised within that group.\r
+ *\r
+ * To obtain the group number of a specific interrupt index, use the \ref INTC_IRQ_GROUP() macro.\r
+ *\r
+ * \param[in] GroupNumber Group number of the interrupt group to register a handler for.\r
+ * \param[in] InterruptLevel Priority level for the specified interrupt, a \c AVR32_INTC_INT* mask.\r
+ * \param[in] Handler Address of the ISR handler for the interrupt group.\r
+ */\r
+ static inline void INTC_RegisterGroupHandler(const uint16_t GroupNumber,\r
+ const uint8_t InterruptLevel,\r
+ const InterruptHandlerPtr_t Handler) ATTR_ALWAYS_INLINE;\r
+ static inline void INTC_RegisterGroupHandler(const uint16_t GroupNumber,\r
+ const uint8_t InterruptLevel,\r
+ const InterruptHandlerPtr_t Handler)\r
+ {\r
+ InterruptHandlers[GroupNumber] = Handler;\r
+ AVR32_INTC.ipr[GroupNumber] = Autovector_Table[InterruptLevel];\r
+ }\r
+ \r
+ /** Retrieves the pending interrupts for a given interrupt group. The result of this function should be masked\r
+ * against interrupt request indexes converted to a request line number via the \ref INTC_IRQ_LINE() macro. To\r
+ * obtain the group number of a given interrupt request, use the \ref INTC_IRQ_GROUP() macro.\r
+ *\r
+ * \param[in] GroupNumber Group number of the interrupt group to check.\r
+ *\r
+ * \return Mask of pending interrupt lines for the given interrupt group.\r
+ */\r
+ static inline uint_reg_t INTC_GetGroupInterrupts(const uint16_t GroupNumber) ATTR_ALWAYS_INLINE;\r
+ static inline uint_reg_t INTC_GetGroupInterrupts(const uint16_t GroupNumber)\r
+ {\r
+ return AVR32_INTC.irr[GroupNumber];\r
+ }\r
+ \r
+ /* Disable C linkage for C++ Compilers: */\r
+ #if defined(__cplusplus)\r
+ }\r