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