This is a driver for global enabling and disabling of interrupts.
Modules | |
Deprecated interrupt definitions | |
Macros | |
#define | CONFIG_INTERRUPT_FORCE_INTC |
Force usage of the ASF INTC driver. More... | |
Typedefs | |
typedef void(* | __int_handler )(void) |
Pointer to interrupt handler. More... | |
Global interrupt flags | |
typedef uint32_t | irqflags_t |
Type used for holding state of interrupt flag. More... | |
static irqflags_t | cpu_irq_save (void) |
Get and clear the global interrupt flags. More... | |
static bool | cpu_irq_is_enabled_flags (irqflags_t flags) |
Check if interrupts are globally enabled in supplied flags. More... | |
static void | cpu_irq_restore (irqflags_t flags) |
Restore global interrupt flags. More... | |
#define | cpu_irq_enable() |
Enable interrupts globally. More... | |
#define | cpu_irq_disable() |
Disable interrupts globally. More... | |
#define | cpu_irq_is_enabled() cpu_irq_is_enabled_flags(sysreg_read(AVR32_SR)) |
Check if interrupts are globally enabled. More... | |
Interrupt Service Routine definition and registration | |
#define | ISR(func, int_grp, int_lvl) __attribute__((__interrupt__)) static void func (void) |
Macro to declare an interrupt service routine. More... | |
#define | irq_initialize_vectors() INTC_init_interrupts() |
Initialize interrupt vectors. More... | |
#define | irq_register_handler(func, int_num, int_lvl) |
Register handler for interrupt. More... | |
Global interrupt levels | |
static bool | cpu_irq_level_is_enabled_flags (irqflags_t flags, uint32_t level) |
Check if interrupt level is enabled in supplied flags. More... | |
#define | cpu_irq_level_is_enabled(level) |
Check if interrupt level is enabled. More... | |
#define | cpu_irq_enable_level(level) |
Enable interrupt level. More... | |
#define | cpu_irq_disable_level(level) |
Disable interrupt level. More... | |
#define CONFIG_INTERRUPT_FORCE_INTC |
Force usage of the ASF INTC driver.
Predefine this symbol when preprocessing to force the use of the ASF INTC driver. This is useful to ensure compatibility across compilers and shall be used only when required by the application needs.
#define cpu_irq_disable | ( | ) |
Disable interrupts globally.
Referenced by cpu_irq_save(), pm_bod_disable_irq(), sleepmgr_enter_sleep(), sleepmgr_sleep(), and usart_reset().
#define cpu_irq_disable_level | ( | level | ) |
Disable interrupt level.
level | Interrupt level to disable (0 to 3). |
#define cpu_irq_enable | ( | ) |
Enable interrupts globally.
Referenced by cpu_irq_restore(), main(), pm_bod_disable_irq(), sleepmgr_enter_sleep(), sleepmgr_sleep(), and usart_reset().
#define cpu_irq_enable_level | ( | level | ) |
#define cpu_irq_is_enabled | ( | ) | cpu_irq_is_enabled_flags(sysreg_read(AVR32_SR)) |
Check if interrupts are globally enabled.
Referenced by pm_bod_disable_irq(), and usart_reset().
#define cpu_irq_level_is_enabled | ( | level | ) |
Check if interrupt level is enabled.
level | Interrupt level (0 to 3). |
#define irq_initialize_vectors | ( | ) | INTC_init_interrupts() |
Initialize interrupt vectors.
With GCC, this macro adds code for initialization of the interrupt vectors with the driver for the interrupt controller (INTC).
With IAR and unless CONFIG_INTERRUPT_FORCE_INTC is defined this macro adds no code, since initialization of the INTC is handled by the compiler.
This must be called prior to irq_register_handler.
Referenced by main().
#define irq_register_handler | ( | func, | |
int_num, | |||
int_lvl | |||
) |
Register handler for interrupt.
With GCC, this macro adds code for registering an interrupt handler with the driver for the interrupt controller (INTC).
With IAR and unless CONFIG_INTERRUPT_FORCE_INTC is defined this macro adds no code, since initialization of the INTC is handled by the compiler.
func | Name of handler function to register for interrupt. |
int_num | Number of the interrupt line to register function for. |
int_lvl | Priority level to set for the interrupt's group, in the range 0 to 3 . |
Usage:
Referenced by otg_dual_enable(), and uart_open().
#define ISR | ( | func, | |
int_grp, | |||
int_lvl | |||
) | __attribute__((__interrupt__)) static void func (void) |
Macro to declare an interrupt service routine.
With GCC, this macro only causes the function to be defined as an interrupt service routine, i.e., it does not add any initialization code. A valid function name is required for use with irq_register_handler.
With IAR, this macro defines the function as an interrupt service routine and causes the compiler to add initialization code for the interrupt controller (INTC). The interrupt group and level, as well as a valid function name are therefore required.
Usage:
func | Name for the function, needed by irq_register_handler. |
int_grp | Interrupt group to define service routine for. |
int_lvl | Priority level to set for the interrupt group, in the range 0 to 3 . |
typedef void(* __int_handler)(void) |
Pointer to interrupt handler.
Type used for holding state of interrupt flag.
|
inlinestatic |
Check if interrupts are globally enabled in supplied flags.
flags | Currents state of interrupt flags. |
Referenced by cpu_irq_restore().
|
inlinestatic |
Check if interrupt level is enabled in supplied flags.
flags | State of interrupt flags. |
level | Bit position for interrupt level. |
|
inlinestatic |
Restore global interrupt flags.
Use in conjunction with cpu_irq_save.
flags | State to set interrupt flag to. |
References barrier, cpu_irq_enable, and cpu_irq_is_enabled_flags().
Referenced by osc_disable(), osc_enable(), sleepmgr_lock_mode(), sleepmgr_unlock_mode(), sysclk_disable_pbb_module(), sysclk_enable_pbb_module(), sysclk_priv_disable_module(), sysclk_priv_enable_module(), sysclk_set_source(), uhd_ctrl_request_end(), uhd_disable(), uhd_enable(), uhd_ep_run(), uhd_pipe_trans_complet(), uhd_setup_request(), uhi_cdc_putc(), uhi_cdc_rx_update(), uhi_cdc_tx_send(), uhi_cdc_tx_update(), and uhi_cdc_write_buf().
|
inlinestatic |
Get and clear the global interrupt flags.
Use in conjunction with cpu_irq_restore.
References cpu_irq_disable, and sysreg_read.
Referenced by osc_disable(), osc_enable(), sleepmgr_lock_mode(), sleepmgr_unlock_mode(), sysclk_disable_pbb_module(), sysclk_enable_pbb_module(), sysclk_priv_disable_module(), sysclk_priv_enable_module(), sysclk_set_source(), uhd_ctrl_request_end(), uhd_disable(), uhd_enable(), uhd_ep_run(), uhd_pipe_trans_complet(), uhd_setup_request(), uhi_cdc_putc(), uhi_cdc_rx_update(), uhi_cdc_tx_send(), uhi_cdc_tx_update(), and uhi_cdc_write_buf().