LUFA Library
Interrupt Controller Driver - LUFA/Platform/UC3/InterruptManagement.h

Interrupt Controller Driver for the AVR32 UC3 microcontrollers. More...

Macros

#define INTC_IRQ_GROUP(IRQIndex)   (IRQIndex / 32)
 
#define INTC_IRQ_LINE(IRQIndex)   (IRQIndex % 32)
 

Functions

static uint_reg_t INTC_GetGroupInterrupts (const uint16_t GroupNumber) ATTR_ALWAYS_INLINE
 
InterruptHandlerPtr_t INTC_GetInterruptHandler (const uint_reg_t InterruptLevel)
 
void INTC_Init (void)
 
static void INTC_RegisterGroupHandler (const uint16_t GroupNumber, const uint8_t InterruptLevel, const InterruptHandlerPtr_t Handler) ATTR_ALWAYS_INLINE
 

Detailed Description

Module Source Dependencies

The following files must be built with any user project that uses this module:

Module Description

Interrupt controller driver for the AVR32 UC3 microcontrollers, for the configuration of interrupt handlers within the device.

Usage Example:

ISR(USB_Group_IRQ_Handler)
{
// USB group handler code here
}
void main(void)
{
INTC_RegisterGroupHandler(INTC_IRQ_GROUP(AVR32_USBB_IRQ), AVR32_INTC_INT0, USB_Group_IRQ_Handler);
}

Macro Definition Documentation

◆ INTC_IRQ_GROUP

#define INTC_IRQ_GROUP (   IRQIndex)    (IRQIndex / 32)

Converts a given interrupt index into its associated interrupt group.

Parameters
[in]IRQIndexIndex of the interrupt request to convert.
Returns
Interrupt group number associated with the interrupt index.

◆ INTC_IRQ_LINE

#define INTC_IRQ_LINE (   IRQIndex)    (IRQIndex % 32)

Converts a given interrupt index into its associated interrupt line.

Parameters
[in]IRQIndexIndex of the interrupt request to convert.
Returns
Interrupt line number associated with the interrupt index.

Function Documentation

◆ INTC_GetGroupInterrupts()

static uint_reg_t INTC_GetGroupInterrupts ( const uint16_t  GroupNumber)
inlinestatic

Retrieves the pending interrupts for a given interrupt group. The result of this function should be masked against interrupt request indexes converted to a request line number via the INTC_IRQ_LINE() macro. To obtain the group number of a given interrupt request, use the INTC_IRQ_GROUP() macro.

Parameters
[in]GroupNumberGroup number of the interrupt group to check.
Returns
Mask of pending interrupt lines for the given interrupt group.

◆ INTC_GetInterruptHandler()

InterruptHandlerPtr_t INTC_GetInterruptHandler ( const uint_reg_t  InterruptLevel)

Retrieves the associated interrupt handler for the interrupt group currently being fired. This is called directly from the exception handler routine before dispatching to the ISR.

Parameters
[in]InterruptLevelPriority level of the interrupt.
Returns
Pointer to the associated interrupt handler function, or NULL if no handler set.

◆ INTC_Init()

void INTC_Init ( void  )

Initializes the interrupt controller ready to handle interrupts. This must be called at the start of the user program before any interrupts are registered or enabled.

◆ INTC_RegisterGroupHandler()

static void INTC_RegisterGroupHandler ( const uint16_t  GroupNumber,
const uint8_t  InterruptLevel,
const InterruptHandlerPtr_t  Handler 
)
inlinestatic

Registers a handler for a given interrupt group. On the AVR32 UC3 devices, interrupts are grouped by peripheral. To save on SRAM used, a single ISR handles all interrupt lines within a single group - to determine the exact line that has interrupted within the group ISR handler, use INTC_GetGroupInterrupts().

If multiple interrupts with the same group are registered, the last registered handler will become the handler called for interrupts raised within that group.

To obtain the group number of a specific interrupt index, use the INTC_IRQ_GROUP() macro.

Parameters
[in]GroupNumberGroup number of the interrupt group to register a handler for.
[in]InterruptLevelPriority level for the specified interrupt, a AVR32_INTC_INT* mask.
[in]HandlerAddress of the ISR handler for the interrupt group.