| LUFA Library 140302 |

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
Interrupt Controller Driver - LUFA/Platform/UC3/InterruptManagement.h
UC3

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:

- LUFA/Platform/UC3/InterruptManagement.c (Makefile source module name: LUFA_SRC_PLATFORM)
- LUFA/Platform/UC3/Exception.S (Makefile source module name: LUFA_SRC_PLATFORM)

# 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);
}

## Macro Definition Documentation

#define INTC_IRQ_GROUP | ( |  | IRQIndex | ) | (IRQIndex / 32)

Converts a given interrupt index into its associated interrupt group.

Parameters

  [in] | IRQIndex | Index 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 associated interrupt line.

Parameters

  [in] | IRQIndex | Index 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] | GroupNumber | Group number of the interrupt group to check.

Returns
  Mask of pending interrupt lines for the given interrupt group.

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] | InterruptLevel | Priority level of the interrupt.

Returns
  Pointer to the associated interrupt handler function, or NULL if no handler set.

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.

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] | GroupNumber | Group number of the interrupt group to register a handler for.
  [in] | InterruptLevel | Priority level for the specified interrupt, a `AVR32_INTC_INT*` mask.
  [in] | Handler | Address of the ISR handler for the interrupt group.