mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
add vexii-test shims for irq subsystem in kernel
This commit is contained in:
parent
8f2727c582
commit
4fb3a3da43
1 changed files with 21 additions and 0 deletions
|
|
@ -33,20 +33,41 @@ static HANDLING_IRQ: AtomicBool = AtomicBool::new(false);
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
pub fn is_handling_irq() -> bool { HANDLING_IRQ.load(Ordering::SeqCst) }
|
pub fn is_handling_irq() -> bool { HANDLING_IRQ.load(Ordering::SeqCst) }
|
||||||
|
|
||||||
|
#[cfg(not(feature = "vexii-test"))]
|
||||||
fn sim_read() -> usize {
|
fn sim_read() -> usize {
|
||||||
let existing: usize;
|
let existing: usize;
|
||||||
unsafe { core::arch::asm!("csrrs {0}, 0x9C0, zero", out(reg) existing) };
|
unsafe { core::arch::asm!("csrrs {0}, 0x9C0, zero", out(reg) existing) };
|
||||||
existing
|
existing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "vexii-test"))]
|
||||||
fn sim_write(new: usize) { unsafe { core::arch::asm!("csrrw zero, 0x9C0, {0}", in(reg) new) }; }
|
fn sim_write(new: usize) { unsafe { core::arch::asm!("csrrw zero, 0x9C0, {0}", in(reg) new) }; }
|
||||||
|
|
||||||
|
#[cfg(not(feature = "vexii-test"))]
|
||||||
fn sip_read() -> usize {
|
fn sip_read() -> usize {
|
||||||
let existing: usize;
|
let existing: usize;
|
||||||
unsafe { core::arch::asm!("csrrs {0}, 0xDC0, zero", out(reg) existing) };
|
unsafe { core::arch::asm!("csrrs {0}, 0xDC0, zero", out(reg) existing) };
|
||||||
existing
|
existing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "vexii-test")]
|
||||||
|
fn sim_read() -> usize {
|
||||||
|
let legacy_int = utralib::CSR::new(crate::platform::precursor::LEGACY_INT_VMEM as *mut u32);
|
||||||
|
legacy_int.r(crate::platform::precursor::legacy_int::SUPER_MASK) as usize
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "vexii-test")]
|
||||||
|
fn sim_write(new: usize) {
|
||||||
|
let mut legacy_int = utralib::CSR::new(crate::platform::precursor::LEGACY_INT_VMEM as *mut u32);
|
||||||
|
legacy_int.wo(crate::platform::precursor::legacy_int::SUPER_MASK, new as u32);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "vexii-test")]
|
||||||
|
fn sip_read() -> usize {
|
||||||
|
let legacy_int = utralib::CSR::new(crate::platform::precursor::LEGACY_INT_VMEM as *mut u32);
|
||||||
|
legacy_int.r(crate::platform::precursor::legacy_int::SUPER_PENDING) as usize
|
||||||
|
}
|
||||||
|
|
||||||
/// Disable external interrupts
|
/// Disable external interrupts
|
||||||
pub fn disable_all_irqs() {
|
pub fn disable_all_irqs() {
|
||||||
SIM_BACKING.store(sim_read(), Ordering::Relaxed);
|
SIM_BACKING.store(sim_read(), Ordering::Relaxed);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue