cleanup after debugging ticktimer

the problem was that the load signal was not being respected
by the hardware, small patch to FPGA required but now all is OK.
This commit is contained in:
bunnie 2021-05-01 20:56:12 +08:00
parent b28dff273f
commit c7f1fe0817
3 changed files with 4 additions and 11 deletions

View file

@ -78,7 +78,7 @@ fn rkyv_test_client() -> ! {
}
// let the loop run a bit, then try a suspend
if idx == 1 {
if idx == 3 {
// TODO: add a self-wakeup RTC alarm once we're beyond the touch-and-go phase
susres.initiate_suspend().unwrap();
}

View file

@ -319,14 +319,8 @@ mod implementation {
}
// restore the ticktimer
self.csr.wfo(utra::susres::CONTROL_PAUSE, 1); // ensure that the ticktimer is paused before we try to load it
self.csr.wo(utra::susres::RESUME_TIME0, time as u32);
self.csr.wo(utra::susres::RESUME_TIME1, (time >> 32) as u32);
// load the saved value -- can only be done while the timer is paused
self.csr.wo(utra::susres::CONTROL,
self.csr.ms(utra::susres::CONTROL_PAUSE, 1) |
self.csr.ms(utra::susres::CONTROL_LOAD, 1)
);
println!("Ticktimer loaded with {}", time);
// set up pre-emption timer
@ -344,11 +338,10 @@ mod implementation {
// start the tickttimer running
self.csr.wo(utra::susres::CONTROL,
self.csr.ms(utra::susres::CONTROL_PAUSE, 1) |
self.csr.ms(utra::susres::CONTROL_LOAD, 1)
);
log::info!("Resume {} / control {}", self.csr.r(utra::susres::RESUME_TIME0), self.csr.r(utra::susres::CONTROL));
log::info!("Ticktimer loaded with {} / {}", time, self.csr.r(utra::susres::TIME0));
log::trace!("Resume {} / control {}", self.csr.r(utra::susres::RESUME_TIME0), self.csr.r(utra::susres::CONTROL));
log::trace!("Ticktimer loaded with {} / {}", time, self.csr.r(utra::susres::TIME0));
self.csr.wo(utra::susres::CONTROL, 0);
println!("Ticktimer and OS timer now running");

View file

@ -295,7 +295,7 @@ mod implementation {
}
log::trace!("ticktimer enable: {}", self.csr.r(utra::ticktimer::EV_ENABLE));
log::info!("ticktimer time/target: {}/{}", self.csr.r(utra::ticktimer::TIME0), self.csr.r(utra::ticktimer::MSLEEP_TARGET0));
log::trace!("ticktimer time/target: {}/{}", self.csr.r(utra::ticktimer::TIME0), self.csr.r(utra::ticktimer::MSLEEP_TARGET0));
}
}
}