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