add helper function to determine, if the interrupt flag is set
This commit is contained in:
parent
f198c26851
commit
751dda8f1e
1 changed files with 15 additions and 0 deletions
|
@ -75,6 +75,21 @@ inline static void irq_nested_enable(uint32_t flags) {
|
|||
irq_enable();
|
||||
}
|
||||
|
||||
/** @brief Determines, if the interrupt flags (IF) is ser
|
||||
*
|
||||
* @return
|
||||
* - 1 interrupt flag is set
|
||||
* - 0 interrupt flag is cleared
|
||||
*/
|
||||
inline static uint32_t is_irq_enabled(void)
|
||||
{
|
||||
uint32_t flags;
|
||||
asm volatile("pushf; popl %0": "=r"(flags) : : "memory");
|
||||
if (flags & (1 << 9))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue