clic 0.0.0

Core-Local Interrupt Controller (CLIC) RISC-V Privileged Architecture support crate
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Supervisor conditional scratch swap on level change.
use core::arch::asm;

/// Writes the CLIC `sscratchcswl` CSR.
#[inline]
pub unsafe fn write(val: usize) {
    asm!("csrw 0x149, {}", in(reg) val)
}

/// Reads the `sscratchcswl` CSR.
#[inline]
pub fn read() -> usize {
    let bits: usize;
    unsafe { asm!("csrr {}, 0x149", out(reg) bits) };
    bits
}