25#include "vendor/riscv_csr.h"
34#define CPU_CSR_MCAUSE_CAUSE_MSK (0x0fffu)
41#ifndef CONFIG_PRINT_VERBOSE_TRAP_INFO
42# define CONFIG_PRINT_VERBOSE_TRAP_INFO 0
45extern volatile int riscv_in_isr;
50static inline __attribute__((always_inline))
unsigned int irq_enable(
void)
56 "csrrs %[dest], mstatus, %[mask]"
58 :[mask]
"i" (MSTATUS_MIE)
67static inline __attribute__((always_inline))
unsigned int irq_disable(
void)
73 "csrrc %[dest], mstatus, %[mask]"
75 :[mask]
"i" (MSTATUS_MIE)
90 "csrw mstatus, %[state]"
100static inline __attribute__((always_inline))
bool irq_is_in(
void)
105static inline __attribute__((always_inline))
bool irq_is_enabled(
void)
110 "csrr %[dest], mstatus"
115 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.