5 #define csr_read(reg) \
8 asm volatile("csrr %0, " #reg : "=r"(val)); \
11 #define csr_write(reg, val) asm volatile("csrw " #reg ", %0" : : "r"(val))
12 #define csr_set_bits(reg, bits) asm volatile("csrs " #reg ", %0" : : "r"(bits))
13 #define csr_clear_bits(reg, bits) \
14 asm volatile("csrc " #reg ", %0" : : "r"(bits))
16 #define CSR_SSTATUS_SPIE 0x20
17 #define CSR_SSTATUS_SPP 0x100
19 #define CSR_SIE_STIE 0x20
20 #define CSR_SIE_SEIE 0x200
22 #define CSR_SCAUSE_INTR 0x8000000000000000
23 #define CSR_SCAUSE_TIMER_INTR 5
24 #define CSR_SCAUSE_EXT_INTR 9
25 #define CSR_SCAUSE_ECALL_U 8