4 * \brief Global interrupt management for 8- and 32-bit AVR
\r
6 * Copyright (c) 2010-2012 Atmel Corporation. All rights reserved.
\r
12 * Redistribution and use in source and binary forms, with or without
\r
13 * modification, are permitted provided that the following conditions are met:
\r
15 * 1. Redistributions of source code must retain the above copyright notice,
\r
16 * this list of conditions and the following disclaimer.
\r
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
\r
19 * this list of conditions and the following disclaimer in the documentation
\r
20 * and/or other materials provided with the distribution.
\r
22 * 3. The name of Atmel may not be used to endorse or promote products derived
\r
23 * from this software without specific prior written permission.
\r
25 * 4. This software may only be redistributed and used in connection with an
\r
26 * Atmel microcontroller product.
\r
28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
\r
29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
\r
32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
\r
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
\r
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
\r
36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
\r
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
\r
38 * POSSIBILITY OF SUCH DAMAGE.
\r
43 #ifndef UTILS_INTERRUPT_H
\r
44 #define UTILS_INTERRUPT_H
\r
49 # include "interrupt/interrupt_avr8.h"
\r
51 # include "interrupt/interrupt_avr32.h"
\r
52 #elif SAM3S || SAM3N || SAM3XA || SAM3U || SAM4S
\r
53 # include "interrupt/interrupt_sam_nvic.h"
\r
55 # error Unsupported device.
\r
59 * \defgroup interrupt_group Global interrupt management
\r
61 * This is a driver for global enabling and disabling of interrupts.
\r
66 #if defined(__DOXYGEN__)
\r
68 * \def CONFIG_INTERRUPT_FORCE_INTC
\r
69 * \brief Force usage of the ASF INTC driver
\r
71 * Predefine this symbol when preprocessing to force the use of the ASF INTC driver.
\r
72 * This is useful to ensure compatibilty accross compilers and shall be used only when required
\r
73 * by the application needs.
\r
75 # define CONFIG_INTERRUPT_FORCE_INTC
\r
78 //! \name Global interrupt flags
\r
81 * \typedef irqflags_t
\r
82 * \brief Type used for holding state of interrupt flag
\r
86 * \def cpu_irq_enable
\r
87 * \brief Enable interrupts globally
\r
91 * \def cpu_irq_disable
\r
92 * \brief Disable interrupts globally
\r
96 * \fn irqflags_t cpu_irq_save(void)
\r
97 * \brief Get and clear the global interrupt flags
\r
99 * Use in conjunction with \ref cpu_irq_restore.
\r
101 * \return Current state of interrupt flags.
\r
103 * \note This function leaves interrupts disabled.
\r
107 * \fn void cpu_irq_restore(irqflags_t flags)
\r
108 * \brief Restore global interrupt flags
\r
110 * Use in conjunction with \ref cpu_irq_save.
\r
112 * \param flags State to set interrupt flag to.
\r
116 * \fn bool cpu_irq_is_enabled_flags(irqflags_t flags)
\r
117 * \brief Check if interrupts are globally enabled in supplied flags
\r
119 * \param flags Currents state of interrupt flags.
\r
121 * \return True if interrupts are enabled.
\r
125 * \def cpu_irq_is_enabled
\r
126 * \brief Check if interrupts are globally enabled
\r
128 * \return True if interrupts are enabled.
\r
135 * \ingroup interrupt_group
\r
136 * \defgroup interrupt_deprecated_group Deprecated interrupt definitions
\r
139 #endif /* UTILS_INTERRUPT_H */
\r