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