fix timing interval to match the CPU clock frequency

This commit is contained in:
bunnie 2025-10-25 21:36:21 +08:00
parent 51ad124180
commit 63b848df28
2 changed files with 11 additions and 3 deletions

View file

@ -26,6 +26,7 @@ num-traits = { version = "0.2.14", default-features = false }
xous-semver = "0.1.5"
utralib = { version = "0.1.26", optional = true, default-features = false }
loader = { path = "../../loader", optional = true }
bao1x-api = { path = "../../libs/bao1x-api", optional = true }
# TODO: fix this
#[target.'cfg(target_arch = "arm")'.dependencies]
@ -40,7 +41,9 @@ precursor = ["utralib/precursor", "susres/precursor", "watchdog"]
hosted = ["utralib/hosted", "susres/hosted", "watchdog"]
renode = ["utralib/renode", "susres/renode", "watchdog"]
bao1x = ["utralib/bao1x", "utralib/std", "loader/bao1x"]
board-dabao = []
board-baosec = []
bao1x = ["utralib/bao1x", "utralib/std", "bao1x-api"]
hosted-baosec = []
susres = []

View file

@ -114,10 +114,15 @@ impl XousTickTimer {
#[cfg(feature = "watchdog")]
wdt: CSR::new(wdt.as_mut_ptr() as *mut u32),
};
// TODO: base this off of some system-level constant
#[cfg(feature = "board-dabao")]
xtt.csr.wo(
utra::ticktimer::CLOCKS_PER_TICK,
(loader::SYSTEM_CLOCK_FREQUENCY / 2) / (1000 * TICKS_PER_MS as u32),
(bao1x_api::dabao::DEFAULT_FCLK_FREQUENCY / 2) / (1000 * TICKS_PER_MS as u32),
);
#[cfg(feature = "board-baosec")]
xtt.csr.wo(
utra::ticktimer::CLOCKS_PER_TICK,
(bao1x_api::baosec::DEFAULT_FCLK_FREQUENCY / 2) / (1000 * TICKS_PER_MS as u32),
);
#[cfg(feature = "watchdog")]