# arch/avr32/include/arch/interrupt.h File Reference

AVR32-specific interrupt masking/unmasking. More...

`#include <compiler.h>`
`#include <arch/sysreg.h>`
`#include <stdbool.h>`

Include dependency graph for interrupt.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | cpu_irq_is_enabled_flags(flags) (!((flags) & SYSREG_SR_GM))
| Test if interrupts are enabled in flags.
#define | cpu_irq_is_enabled() cpu_irq_is_enabled_flags(sysreg_read(SR))
| Test if interrupts are enabled.
## Functions
static __always_inline unsigned long | cpu_irq_save (void)
| Save the current interrupt state and disable interrupts.
static __always_inline void | cpu_irq_restore (unsigned long flags)
| Restore saved interrupt state.
static bool | cpu_is_in_hardirq_handler (void)
| Test if the CPU is currently executing an interrupt handler.

## Detailed Description

AVR32-specific interrupt masking/unmasking.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All AVR32 devices
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file interrupt.h.

## Define Documentation

#define cpu_irq_is_enabled | ( |  | ) | cpu_irq_is_enabled_flags(sysreg_read(SR))

Test if interrupts are enabled.

Return values:

  | true | If interrups are enabled
  | false | If interrupts are disabled

Definition at line 87 of file interrupt.h.

Referenced by softirq_enable(), softirq_priv_do_pending(), udc_ep_submit_in_req(), and udc_ep_submit_out_req().

#define cpu_irq_is_enabled_flags | ( | flags |  | ) | (!((flags) & SYSREG_SR_GM))

Test if interrupts are enabled in flags.

Parameters:

  | flags | Saved interrupt state

Return values:

  | true | If flags indicates interrups are enabled
  | false | If flags indicates interrupts are disabled

Definition at line 79 of file interrupt.h.

## Function Documentation

static __always_inline void cpu_irq_restore | ( | unsigned long | flags | ) | `[static]`

Restore saved interrupt state.

Parameters:

  | flags | A cookie returned by cpu_irq_save()

Definition at line 67 of file interrupt.h.

References avr32_write_sr, and barrier.

Referenced by console_drv_putchar(), console_drv_write(), gpio_register_irq_handler(), mem_pool_alloc(), mem_pool_free(), msc_do_read(), msc_queue_empty(), pm_priv_set_main_clock(), timer_do_pending(), udc_attach(), udc_detach(), udc_ep_clear_wedge(), udc_ep_create(), udc_ep_destroy(), udc_ep_flush(), udc_ep_set_wedge(), usbb_udc_configure_ep(), workqueue_add_item(), workqueue_add_item_safe(), and workqueue_remove_item().

static __always_inline unsigned long cpu_irq_save | ( | void |  | ) | `[static]`

Save the current interrupt state and disable interrupts.

Returns:
  A cookie indicating the interrupt state before interrupts were disabled.

Definition at line 53 of file interrupt.h.

References cpu_irq_disable.

Referenced by console_drv_putchar(), console_drv_write(), gpio_register_irq_handler(), mem_pool_alloc(), mem_pool_free(), msc_do_read(), msc_queue_empty(), pm_priv_set_main_clock(), timer_do_pending(), udc_attach(), udc_detach(), udc_ep_clear_wedge(), udc_ep_create(), udc_ep_destroy(), udc_ep_flush(), udc_ep_set_wedge(), usbb_udc_configure_ep(), workqueue_add_item(), workqueue_add_item_safe(), and workqueue_remove_item().

static bool cpu_is_in_hardirq_handler | ( | void |  | ) | `[inline, static]`

Test if the CPU is currently executing an interrupt handler.

Return values:

  | true | The CPU is in an interrupt handler
  | false | The CPU is not in an interrupt handler

Definition at line 95 of file interrupt.h.