1 /**
2  * \file
3  *
4  * \brief Global interrupt management for 8- and 32-bit AVR
5  *
6  * Copyright (c) 2010-2018 Microchip Technology Inc. and its subsidiaries.
7  *
8  * \asf_license_start
9  *
10  * \page License
11  *
12  * Subject to your compliance with these terms, you may use Microchip
13  * software and any derivatives exclusively with Microchip products.
14  * It is your responsibility to comply with third party license terms applicable
15  * to your use of third party software (including open source software) that
16  * may accompany Microchip software.
17  *
18  * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
19  * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
20  * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
21  * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
22  * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
23  * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
24  * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
25  * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE FULLEST EXTENT
26  * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
27  * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
28  * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
29  *
30  * \asf_license_stop
31  *
32  */
33 /*
34  * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
35  */
36 #ifndef UTILS_INTERRUPT_H
37 #define UTILS_INTERRUPT_H
38 
39 #include <parts.h>
40 
41 #if XMEGA || MEGA
42 #  include "interrupt/interrupt_avr8.h"
43 #elif UC3
44 #  include "interrupt/interrupt_avr32.h"
45 #elif SAM || SAMB
46 #  include "interrupt/interrupt_sam_nvic.h"
47 #else
48 #  error Unsupported device.
49 #endif
50 
51 /**
52  * \defgroup interrupt_group Global interrupt management
53  *
54  * This is a driver for global enabling and disabling of interrupts.
55  *
56  * @{
57  */
58 
59 #if defined(__DOXYGEN__)
60 /**
61  * \def CONFIG_INTERRUPT_FORCE_INTC
62  * \brief Force usage of the ASF INTC driver
63  *
64  * Predefine this symbol when preprocessing to force the use of the ASF INTC driver.
65  * This is useful to ensure compatibility across compilers and shall be used only when required
66  * by the application needs.
67  */
68 #  define CONFIG_INTERRUPT_FORCE_INTC
69 #endif
70 
71 //! \name Global interrupt flags
72 //@{
73 /**
74  * \typedef irqflags_t
75  * \brief Type used for holding state of interrupt flag
76  */
77 
78 /**
79  * \def cpu_irq_enable
80  * \brief Enable interrupts globally
81  */
82 
83 /**
84  * \def cpu_irq_disable
85  * \brief Disable interrupts globally
86  */
87 
88 /**
89  * \fn irqflags_t cpu_irq_save(void)
90  * \brief Get and clear the global interrupt flags
91  *
92  * Use in conjunction with \ref cpu_irq_restore.
93  *
94  * \return Current state of interrupt flags.
95  *
96  * \note This function leaves interrupts disabled.
97  */
98 
99 /**
100  * \fn void cpu_irq_restore(irqflags_t flags)
101  * \brief Restore global interrupt flags
102  *
103  * Use in conjunction with \ref cpu_irq_save.
104  *
105  * \param flags State to set interrupt flag to.
106  */
107 
108 /**
109  * \fn bool cpu_irq_is_enabled_flags(irqflags_t flags)
110  * \brief Check if interrupts are globally enabled in supplied flags
111  *
112  * \param flags Currents state of interrupt flags.
113  *
114  * \return True if interrupts are enabled.
115  */
116 
117 /**
118  * \def cpu_irq_is_enabled
119  * \brief Check if interrupts are globally enabled
120  *
121  * \return True if interrupts are enabled.
122  */
123 //@}
124 
125 //! @}
126 
127 /**
128  * \ingroup interrupt_group
129  * \defgroup interrupt_deprecated_group Deprecated interrupt definitions
130  */
131 
132 #endif /* UTILS_INTERRUPT_H */
133