-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cpu: Add module for dealing with interrupt related CSR
Signed-off-by: Arthur Heymans <[email protected]>
- Loading branch information
1 parent
1858eca
commit 67baa9c
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Licensed under the Apache-2.0 license | ||
|
||
// Standard RISC-V MIE CSR | ||
#[cfg(feature = "riscv")] | ||
pub fn mie_enable_external_interrupts() { | ||
const MEIE: usize = 1 << 11; | ||
unsafe { | ||
core::arch::asm!("csrrs zero, mie, {r}", r = in(reg) MEIE); | ||
} | ||
} | ||
|
||
// VeeR EL2 PRM 5.5.1 Power Management Control Register | ||
// If bit 1 is set, setting bit0 globally enables interrupts, i.e. MIE in mstatus CSR | ||
#[cfg(feature = "riscv")] | ||
pub fn mpmc_halt() { | ||
const HALT: usize = 1 << 0; | ||
unsafe { | ||
core::arch::asm!("csrrs zero, 0x7c6, {r}", r = in(reg) HALT); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters