29#include "vendor/riscv_csr.h"
38#define CPU_CSR_MCAUSE_CAUSE_MSK (0x0fffu)
40extern volatile int riscv_in_isr;
45static inline __attribute__((always_inline))
unsigned int irq_enable(
void)
51 "csrrs %[dest], mstatus, %[mask]"
53 :[mask]
"i" (MSTATUS_MIE)
62static inline __attribute__((always_inline))
unsigned int irq_disable(
void)
68 "csrrc %[dest], mstatus, %[mask]"
70 :[mask]
"i" (MSTATUS_MIE)
85 "csrw mstatus, %[state]"
95static inline __attribute__((always_inline))
bool irq_is_in(
void)
100static inline __attribute__((always_inline))
bool irq_is_enabled(
void)
105 "csrr %[dest], mstatus"
110 return (state & MSTATUS_MIE);
MAYBE_INLINE void irq_restore(unsigned state)
This function restores the IRQ disable bit in the status register to the value contained within passe...
MAYBE_INLINE unsigned irq_disable(void)
This function sets the IRQ disable bit in the status register.
MAYBE_INLINE bool irq_is_enabled(void)
Test if IRQs are currently enabled.
MAYBE_INLINE unsigned irq_enable(void)
This function clears the IRQ disable bit in the status register.
MAYBE_INLINE bool irq_is_in(void)
Check whether called from interrupt service routine.