diff --git a/services/xous-ticktimer/Cargo.toml b/services/xous-ticktimer/Cargo.toml index 82183f79a..0fa7f0422 100644 --- a/services/xous-ticktimer/Cargo.toml +++ b/services/xous-ticktimer/Cargo.toml @@ -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 = [] diff --git a/services/xous-ticktimer/src/platform/bao1x/implementation.rs b/services/xous-ticktimer/src/platform/bao1x/implementation.rs index 0c2bcf6ad..42b0743ac 100644 --- a/services/xous-ticktimer/src/platform/bao1x/implementation.rs +++ b/services/xous-ticktimer/src/platform/bao1x/implementation.rs @@ -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")]