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

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

Defines

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

Functions

void INTC_Init (void)
static void INTC_RegisterGroupHandler (const uint16_t GroupNumber, const uint8_t InterruptLevel, const InterruptHandlerPtr_t Handler) ATTR_ALWAYS_INLINE
static uint_reg_t INTC_GetGroupInterrupts (const uint16_t GroupNumber) 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:

        #include <LUFA/Platform/UC3/InterruptManagement.h>

        ISR(USB_Group_IRQ_Handler)
        {
            // USB group handler code here
        }

        void main(void)
        {
            INTC_Init();
            INTC_RegisterGroupHandler(INTC_IRQ_GROUP(AVR32_USBB_IRQ), AVR32_INTC_INT0, USB_Group_IRQ_Handler);
        }

Define Documentation

#define INTC_IRQ_GROUP (   IRQIndex)    (IRQIndex / 32)

Converts a given interrupt index into its assocated interrupt group.

Parameters:
[in]IRQIndexIndex of the interrupt request to convert.
Returns:
Interrupt group number associated with the interrupt index.
#define INTC_IRQ_LINE (   IRQIndex)    (IRQIndex % 32)

Converts a given interrupt index into its assocated interrupt line.

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

Function Documentation

static uint_reg_t INTC_GetGroupInterrupts ( const uint16_t  GroupNumber) [inline, static]

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.
void INTC_Init ( void  )

Initializes the interrupt controller, nulling out all interrupt handlers ready for new registration. This function should be called once on startup to ensure the interrupt controller is ready for use.

static void INTC_RegisterGroupHandler ( const uint16_t  GroupNumber,
const uint8_t  InterruptLevel,
const InterruptHandlerPtr_t  Handler 
) [inline, static]

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.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines