mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/atmega_common: implement irq_is_enabled()
This commit is contained in:
parent
d4181b91fa
commit
48e2d6e8f9
@ -103,6 +103,21 @@ __attribute__((always_inline)) static inline int irq_is_in(void)
|
||||
return (state & AVR8_STATE_FLAG_ISR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Test if interrupts are currently enabled
|
||||
*/
|
||||
__attribute__((always_inline)) static inline int irq_is_enabled(void)
|
||||
{
|
||||
uint8_t mask;
|
||||
__asm__ volatile(
|
||||
"in %[dest], __SREG__" "\n\t"
|
||||
: [dest] "=r"(mask)
|
||||
: /* no inputs */
|
||||
: "memory"
|
||||
);
|
||||
return mask & (1 << 7);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user