Karg  v0.2.0
The kernel of CargOS
csr.h File Reference
#include <types.h>

Go to the source code of this file.

Macros

#define csr_read(reg)
 
#define csr_write(reg, val)   asm volatile("csrw " #reg ", %0" : : "r"(val))
 
#define csr_set_bits(reg, bits)   asm volatile("csrs " #reg ", %0" : : "r"(bits))
 
#define csr_clear_bits(reg, bits)    asm volatile("csrc " #reg ", %0" : : "r"(bits))
 
#define CSR_SSTATUS_SPIE   0x20
 
#define CSR_SSTATUS_SPP   0x100
 
#define CSR_SIE_STIE   0x20
 
#define CSR_SIE_SEIE   0x200
 
#define CSR_SCAUSE_INTR   0x8000000000000000
 
#define CSR_SCAUSE_TIMER_INTR   5
 
#define CSR_SCAUSE_EXT_INTR   9
 
#define CSR_SCAUSE_ECALL_U   8
 

Macro Definition Documentation

◆ csr_clear_bits

#define csr_clear_bits (   reg,
  bits 
)     asm volatile("csrc " #reg ", %0" : : "r"(bits))

◆ csr_read

#define csr_read (   reg)
Value:
({ \
usize val; \
asm volatile("csrr %0, " #reg : "=r"(val)); \
val; \
})
#define reg(reg)
Definition: plic.c:11

◆ CSR_SCAUSE_ECALL_U

#define CSR_SCAUSE_ECALL_U   8

◆ CSR_SCAUSE_EXT_INTR

#define CSR_SCAUSE_EXT_INTR   9

◆ CSR_SCAUSE_INTR

#define CSR_SCAUSE_INTR   0x8000000000000000

◆ CSR_SCAUSE_TIMER_INTR

#define CSR_SCAUSE_TIMER_INTR   5

◆ csr_set_bits

#define csr_set_bits (   reg,
  bits 
)    asm volatile("csrs " #reg ", %0" : : "r"(bits))

◆ CSR_SIE_SEIE

#define CSR_SIE_SEIE   0x200

◆ CSR_SIE_STIE

#define CSR_SIE_STIE   0x20

◆ CSR_SSTATUS_SPIE

#define CSR_SSTATUS_SPIE   0x20

◆ CSR_SSTATUS_SPP

#define CSR_SSTATUS_SPP   0x100

◆ csr_write

#define csr_write (   reg,
  val 
)    asm volatile("csrw " #reg ", %0" : : "r"(val))