Internal Interrupt Processing

Defines

#define INTC_DEFINE_HANDLER(id, handler, level)
 Define an interrupt handler for an integrated peripheral.
#define intc_set_irq_data(id, data)
 Associate a data pointer with an interrupt.
#define intc_get_irq_data(id, pdata)
 Get the data pointer associated with an interrupt.
#define intc_setup_handler(id, level, data)
 Set up an interrupt handler.
#define intc_remove_handler(id)
 Remove an interrupt handler.

Detailed Description

This module includes functionality to help setting up interrupt handlers for internal (on-chip) interrupts. Such interrupts are generated by chip-internal modules and usually have a very direct path to the interrupt handler in order to minimize interrupt latency.

There may be minor differences between architectures, but in general, handlers for internal interrupts are set up in two steps:

Interrupt numbers are specified correspond to the vector number on AVR, and the interrupt group number on AVR32. An AVR32-specific function, intc_get_group_requests(), can be used to distinguish between multiple interrupts inside of a group.


Define Documentation

#define INTC_DEFINE_HANDLER ( id,
handler,
level   ) 
Value:
extern void *intc_priv_data_sym(id);            \
        extern void __attribute__((__signal__))         \
                        intc_priv_entry_sym(id)(void);  \
        void intc_priv_entry_sym(id)(void)              \
        {                                               \
                handler(intc_priv_data_sym(id));        \
        }                                               \
        void *intc_priv_data_sym(id)

Define an interrupt handler for an integrated peripheral.

This binds an interrupt handler function to a low-level entry point, which takes care of saving/restoring registers, finding the handler-specific data, and running any code dealing with soft interrupt handling, etc. before returning.

Note:
This is not a function-like macro; it should not be called from within functions. Instead, it should be invoked at the top level right after the definition of the interrupt handler function.
Parameters:
id The interrupt vector ID
handler The interrupt handler function
level The priority level of this interrupt

Definition at line 54 of file intc.h.

#define intc_get_irq_data ( id,
pdata   ) 
Value:
do {                                            \
                extern void *intc_priv_data_sym(id);    \
                *(pdata) = intc_priv_data_sym(id);      \
        } while (0)

Get the data pointer associated with an interrupt.

If the value stored in *pdata is NULL, no interrupt handler has been set up for interrupt id.

Parameters:
id The interrupt ID
pdata Pointer to a variable in which to store the data pointer

Definition at line 84 of file intc.h.

#define intc_remove_handler ( id   ) 
Value:
do {                                            \
                extern void *intc_priv_data_sym(id);    \
                intc_priv_data_sym(id) = 0;             \
        } while (0)

Remove an interrupt handler.

This will remove a registered interrupt handler, making it possible to set up a different one by calling intc_setup_handler().

Note:
This function doesn't actually reprogram the interrupt controller; it just makes it possible to register a different handler for this interrupt later.
Parameters:
id The interrupt ID to disassociate with the handler

Definition at line 95 of file intc.h.

#define intc_set_irq_data ( id,
data   ) 
Value:
do {                                            \
                extern void *intc_priv_data_sym(id);    \
                intc_priv_data_sym(id) = (data);        \
        } while (0)

Associate a data pointer with an interrupt.

Parameters:
id The interrupt ID
data Data to be associated with the interrupt

Definition at line 78 of file intc.h.

#define intc_setup_handler ( id,
level,
data   ) 
Value:
do {                                            \
                intc_set_irq_data(id, data);            \
        } while (0)

Set up an interrupt handler.

This function sets up the internal interrupt controller for handling a given interrupt through the specified handler.

Note:
Usually, this is the only reference to the handler function and associated low-level entry code. This means that it is perfectly ok to define handlers for more interrupts than needed -- if they aren't actually enabled by calling this function, they will get discarded at link-time when --gc-sections is used.
Parameters:
id The interrupt number to associate with the handler
level The priority level for this interrupt
data Data to be associated with this interrupt
Precondition:
A handler for this interrupt has not already been set up.

Definition at line 90 of file intc.h.

Referenced by at90usb_init().

Generated on Thu Apr 29 14:10:35 2010 for xplain-bc by  doxygen 1.6.3