add apis & services for the rtc

This commit is contained in:
bunnie 2025-11-24 18:56:03 +08:00
parent ea083c6573
commit c677f6f78a
3 changed files with 19 additions and 0 deletions

View file

@ -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,
}

View file

@ -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");

View file

@ -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