diff --git a/services/bao1x-hal-service/src/api.rs b/services/bao1x-hal-service/src/api.rs index 8b1378917..38dfc432f 100644 --- a/services/bao1x-hal-service/src/api.rs +++ b/services/bao1x-hal-service/src/api.rs @@ -1 +1,18 @@ +/// Do not modify the discriminants in this structure. They are used in `libstd` directly. +#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)] +pub enum TimeOp { + /// Sync offsets to hardware RTC + HwSync = 0, + SetUtcTimeMs = 2, + /// Get UTC time in ms since EPOCH + GetUtcTimeMs = 3, // this is the one API call that `std` relies upon + /// Get local time in ms since EPOCH + GetLocalTimeMs = 4, + /// Sets the timezone offset, in milliseconds. + SetTzOffsetMs = 5, + /// Query to see if timezone and time relative to UTC have been set. + WallClockTimeInit = 6, + /// Serialize the internal state for storage across reboots + GetState = 1024, +} diff --git a/services/bao1x-hal-service/src/main.rs b/services/bao1x-hal-service/src/main.rs index a3e34a232..d11415c68 100644 --- a/services/bao1x-hal-service/src/main.rs +++ b/services/bao1x-hal-service/src/main.rs @@ -269,6 +269,7 @@ fn main() { servers::trng::start_trng_service(&bio_ss); #[cfg(feature = "board-dabao")] servers::trng::start_trng_service(); + servers::rtc::start_rtc_service(); let mut msg_opt = None; log::debug!("Starting main loop"); diff --git a/services/bao1x-hal-service/src/servers.rs b/services/bao1x-hal-service/src/servers.rs index 4dca564c3..83dd37d6c 100644 --- a/services/bao1x-hal-service/src/servers.rs +++ b/services/bao1x-hal-service/src/servers.rs @@ -3,4 +3,5 @@ pub mod keyboard; // TRNG server is only needed for baosec; dabao can cheat and use the kernel TRNG port #[cfg(feature = "board-baosec")] mod baosec_hw; +pub mod rtc; pub mod trng; // not public - for internal use only