1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/riscv: implement irq_is_enabled()

This commit is contained in:
Hauke Petersen 2021-06-29 11:36:38 +02:00
parent 48e2d6e8f9
commit 9a5edcf839

View File

@ -97,6 +97,18 @@ static inline __attribute__((always_inline)) int irq_is_in(void)
return riscv_in_isr;
}
static inline __attribute__((always_inline)) int irq_is_enabled(void)
{
unsigned state;
__asm__ volatile (
"csrr %[dest], mstatus"
:[dest] "=r" (state)
: /* no inputs */
: "memory"
);
return (state & MSTATUS_MIE);
}
#ifdef __cplusplus
}
#endif