make ticktimer scale with system clock setting in loader

This commit is contained in:
bunnie 2025-08-10 17:54:45 +08:00
parent 2cb22e6b10
commit 781c74ba79
2 changed files with 6 additions and 2 deletions

View file

@ -25,6 +25,7 @@ num-derive = { version = "0.4.2", default-features = false }
num-traits = { version = "0.2.14", default-features = false }
xous-semver = "0.1.2"
utralib = { version = "0.1.25", optional = true, default-features = false }
loader = { path = "../../loader", optional = true }
# TODO: fix this
#[target.'cfg(target_arch = "arm")'.dependencies]
@ -39,7 +40,7 @@ precursor = ["utralib/precursor", "susres/precursor", "watchdog"]
hosted = ["utralib/hosted", "susres/hosted", "watchdog"]
renode = ["utralib/renode", "susres/renode", "watchdog"]
cramium-soc = ["utralib/cramium-soc", "utralib/std"]
cramium-soc = ["utralib/cramium-soc", "utralib/std", "loader/cramium-soc"]
cramium-fpga = ["utralib/cramium-fpga"]
hosted-baosec = []

View file

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