The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 111:4336505e4b1c 1 #ifndef UTILS_INTERRUPT_H
Kojto 111:4336505e4b1c 2 #define UTILS_INTERRUPT_H
Kojto 111:4336505e4b1c 3
Kojto 111:4336505e4b1c 4 #include <parts.h>
Kojto 111:4336505e4b1c 5
Kojto 111:4336505e4b1c 6 #if XMEGA || MEGA || TINY
Kojto 111:4336505e4b1c 7 # include "interrupt/interrupt_avr8.h"
Kojto 111:4336505e4b1c 8 #elif UC3
Kojto 111:4336505e4b1c 9 # include "interrupt/interrupt_avr32.h"
Kojto 111:4336505e4b1c 10 #elif SAM
Kojto 111:4336505e4b1c 11 # include "interrupt/interrupt_sam_nvic.h"
Kojto 111:4336505e4b1c 12 #else
Kojto 111:4336505e4b1c 13 # error Unsupported device.
Kojto 111:4336505e4b1c 14 #endif
Kojto 111:4336505e4b1c 15
Kojto 111:4336505e4b1c 16 /**
Kojto 111:4336505e4b1c 17 * \defgroup interrupt_group Global interrupt management
Kojto 111:4336505e4b1c 18 *
Kojto 111:4336505e4b1c 19 * This is a driver for global enabling and disabling of interrupts.
Kojto 111:4336505e4b1c 20 *
Kojto 111:4336505e4b1c 21 * @{
Kojto 111:4336505e4b1c 22 */
Kojto 111:4336505e4b1c 23
Kojto 111:4336505e4b1c 24 #if defined(__DOXYGEN__)
Kojto 111:4336505e4b1c 25 /**
Kojto 111:4336505e4b1c 26 * \def CONFIG_INTERRUPT_FORCE_INTC
Kojto 111:4336505e4b1c 27 * \brief Force usage of the ASF INTC driver
Kojto 111:4336505e4b1c 28 *
Kojto 111:4336505e4b1c 29 * Predefine this symbol when preprocessing to force the use of the ASF INTC driver.
Kojto 111:4336505e4b1c 30 * This is useful to ensure compatibility across compilers and shall be used only when required
Kojto 111:4336505e4b1c 31 * by the application needs.
Kojto 111:4336505e4b1c 32 */
Kojto 111:4336505e4b1c 33 # define CONFIG_INTERRUPT_FORCE_INTC
Kojto 111:4336505e4b1c 34 #endif
Kojto 111:4336505e4b1c 35
Kojto 111:4336505e4b1c 36 //! \name Global interrupt flags
Kojto 111:4336505e4b1c 37 //@{
Kojto 111:4336505e4b1c 38 /**
Kojto 111:4336505e4b1c 39 * \typedef irqflags_t
Kojto 111:4336505e4b1c 40 * \brief Type used for holding state of interrupt flag
Kojto 111:4336505e4b1c 41 */
Kojto 111:4336505e4b1c 42
Kojto 111:4336505e4b1c 43 /**
Kojto 111:4336505e4b1c 44 * \def cpu_irq_enable
Kojto 111:4336505e4b1c 45 * \brief Enable interrupts globally
Kojto 111:4336505e4b1c 46 */
Kojto 111:4336505e4b1c 47
Kojto 111:4336505e4b1c 48 /**
Kojto 111:4336505e4b1c 49 * \def cpu_irq_disable
Kojto 111:4336505e4b1c 50 * \brief Disable interrupts globally
Kojto 111:4336505e4b1c 51 */
Kojto 111:4336505e4b1c 52
Kojto 111:4336505e4b1c 53 /**
Kojto 111:4336505e4b1c 54 * \fn irqflags_t cpu_irq_save(void)
Kojto 111:4336505e4b1c 55 * \brief Get and clear the global interrupt flags
Kojto 111:4336505e4b1c 56 *
Kojto 111:4336505e4b1c 57 * Use in conjunction with \ref cpu_irq_restore.
Kojto 111:4336505e4b1c 58 *
Kojto 111:4336505e4b1c 59 * \return Current state of interrupt flags.
Kojto 111:4336505e4b1c 60 *
Kojto 111:4336505e4b1c 61 * \note This function leaves interrupts disabled.
Kojto 111:4336505e4b1c 62 */
Kojto 111:4336505e4b1c 63
Kojto 111:4336505e4b1c 64 /**
Kojto 111:4336505e4b1c 65 * \fn void cpu_irq_restore(irqflags_t flags)
Kojto 111:4336505e4b1c 66 * \brief Restore global interrupt flags
Kojto 111:4336505e4b1c 67 *
Kojto 111:4336505e4b1c 68 * Use in conjunction with \ref cpu_irq_save.
Kojto 111:4336505e4b1c 69 *
Kojto 111:4336505e4b1c 70 * \param flags State to set interrupt flag to.
Kojto 111:4336505e4b1c 71 */
Kojto 111:4336505e4b1c 72
Kojto 111:4336505e4b1c 73 /**
Kojto 111:4336505e4b1c 74 * \fn bool cpu_irq_is_enabled_flags(irqflags_t flags)
Kojto 111:4336505e4b1c 75 * \brief Check if interrupts are globally enabled in supplied flags
Kojto 111:4336505e4b1c 76 *
Kojto 111:4336505e4b1c 77 * \param flags Currents state of interrupt flags.
Kojto 111:4336505e4b1c 78 *
Kojto 111:4336505e4b1c 79 * \return True if interrupts are enabled.
Kojto 111:4336505e4b1c 80 */
Kojto 111:4336505e4b1c 81
Kojto 111:4336505e4b1c 82 /**
Kojto 111:4336505e4b1c 83 * \def cpu_irq_is_enabled
Kojto 111:4336505e4b1c 84 * \brief Check if interrupts are globally enabled
Kojto 111:4336505e4b1c 85 *
Kojto 111:4336505e4b1c 86 * \return True if interrupts are enabled.
Kojto 111:4336505e4b1c 87 */
Kojto 111:4336505e4b1c 88 //@}
Kojto 111:4336505e4b1c 89
Kojto 111:4336505e4b1c 90 //! @}
Kojto 111:4336505e4b1c 91
Kojto 111:4336505e4b1c 92 /**
Kojto 111:4336505e4b1c 93 * \ingroup interrupt_group
Kojto 111:4336505e4b1c 94 * \defgroup interrupt_deprecated_group Deprecated interrupt definitions
Kojto 111:4336505e4b1c 95 */
Kojto 111:4336505e4b1c 96
Kojto 111:4336505e4b1c 97 #endif /* UTILS_INTERRUPT_H */