mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
add irq disabling routine
This commit is contained in:
parent
c66a7c47fb
commit
44f50a992a
1 changed files with 20 additions and 0 deletions
|
|
@ -9,6 +9,26 @@ pub(crate) fn enable_irq(irq_no: usize) {
|
|||
mim::write(mim::read() | (1 << irq_no));
|
||||
}
|
||||
|
||||
pub(crate) fn disable_all_irqs() {
|
||||
// Note that the vexriscv "IRQ Mask" register is inverse-logic --
|
||||
// that is, setting a bit in the "mask" register unmasks (i.e. enables) it.
|
||||
mim::write(0);
|
||||
unsafe { mie::clear_mext() };
|
||||
unsafe { mstatus::clear_mie() };
|
||||
// redo delegations
|
||||
unsafe {
|
||||
#[rustfmt::skip]
|
||||
core::arch::asm!(
|
||||
"li t0, 0xffffffff",
|
||||
"csrw mideleg, t0",
|
||||
"csrw medeleg, t0",
|
||||
// Re-install the machine mode trap handler
|
||||
"la t0, abort",
|
||||
"csrw mtvec, t0",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn irq_setup() {
|
||||
unsafe {
|
||||
#[rustfmt::skip]
|
||||
|
|
|
|||
Loading…
Reference in a new issue