From a5303a707f29a754c5576d63d9b2b7d91c5b687e Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 22 Dec 2025 02:05:46 +0800 Subject: [PATCH] define backup flags --- libs/bao1x-api/src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/bao1x-api/src/lib.rs b/libs/bao1x-api/src/lib.rs index 4ea4293d0..241d3efb0 100644 --- a/libs/bao1x-api/src/lib.rs +++ b/libs/bao1x-api/src/lib.rs @@ -18,6 +18,8 @@ pub mod signatures; pub use offsets::*; pub mod clocks; pub mod pubkeys; +use arbitrary_int::u31; +use bitbybit::bitfield; pub use clocks::*; /// UF2 Family ID. Randomly generated, no collisions with the known list, still to be merged @@ -44,6 +46,19 @@ pub const SERVER_NAME_KBD: &str = "_Matrix keyboard driver_"; /// circular dependencies on the IFRAM block. pub const SERVER_NAME_BAO1X_HAL: &str = "_bao1x-SoC HAL_"; +/// Flags register in the backup register bank. Used to track system state between soft resets. +#[bitfield(u32)] +#[derive(PartialEq, Eq, Debug)] +pub struct BackupFlags { + #[bits(1..=31, rw)] + reserved: u31, + /// When `false`, indicates that the time in the RTC register is not synchronized to the offset + /// that is read from disk. Upon first encounter with an external time source, the offset should + /// be captured and recorded to disk. + #[bit(0, rw)] + rtc_synchronized: bool, +} + pub mod camera { #[derive(Clone, Copy)] pub enum Resolution {