add reset reason userspace apis

This commit is contained in:
bunnie 2026-05-06 00:09:21 +08:00
parent c6b1b6bb79
commit 3b4d6a90ed
2 changed files with 17 additions and 0 deletions

View file

@ -37,4 +37,5 @@ pub enum ClockOp {
GetPclk,
GetPer,
DeepSleep,
ResetReason,
}

View file

@ -369,4 +369,20 @@ impl ClockManager {
_ => unimplemented!(),
}
}
pub fn reset_reason(&self) -> bao1x_api::ResetReason {
match send_message(
self.conn,
Message::new_blocking_scalar(
SusresOp::PlatformSpecific.to_usize().unwrap(),
ClockOp::ResetReason.to_usize().unwrap(),
0,
0,
0,
),
) {
Ok(xous::Result::Scalar1(reason)) => bao1x_api::ResetReason::new_with_raw_value(reason as u32),
_ => unimplemented!(),
}
}
}