apply deferred-init + box idiom to susres

This commit is contained in:
bunnie 2023-07-16 17:37:25 +08:00
parent 79ecd62015
commit 95239eb05f

View file

@ -188,13 +188,14 @@ mod implementation {
// Set EV_ENABLE, this starts pre-emption
sr.os_timer.wfo(utra::timer0::EV_ENABLE_ZERO, 0b1);
sr
}
pub fn init(&mut self) {
xous::claim_interrupt(
utra::susres::SUSRES_IRQ,
susres_handler,
(&mut sr) as *mut SusResHw as *mut usize,
self as *mut SusResHw as *mut usize,
).expect("couldn't claim IRQ");
sr
}
pub fn ignore_wfi(&mut self) {
self.csr.wfo(utra::susres::WFI_OVERRIDE, 1);
@ -557,7 +558,8 @@ static SHOULD_RESUME: AtomicBool = AtomicBool::new(false);
fn main() -> ! {
// Start the OS timer which is responsible for setting up preemption.
// os_timer::init();
let mut susres_hw = implementation::SusResHw::new();
let mut susres_hw = Box::new(implementation::SusResHw::new());
susres_hw.init();
log_server::init_wait().unwrap();
// debugging note: it's actually easiest to debug using client-side hooks. Search for