Revert "remove api call for reset_reason"

This reverts commit 1dd514f4be.

not sure why but this breaks stability. suspect a loader bug.
This commit is contained in:
bunnie 2026-05-06 03:28:52 +08:00
parent 1dd514f4be
commit 7ca009d2b0
4 changed files with 25 additions and 0 deletions

View file

@ -749,6 +749,10 @@ impl ClockManagerImpl {
self.iox.set_gpio_pin_value(self.dcdc2_io.0, self.dcdc2_io.1, bao1x_api::IoxValue::Low);
}
}
pub fn reset_reason(&self) -> bao1x_api::ResetReason {
bao1x_api::ResetReason::new_with_raw_value(self.sysctrl.r(utra::sysctrl::SFR_RCUSRCFR))
}
}
#[inline(always)]

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!(),
}
}
}

View file

@ -410,6 +410,10 @@ fn susres_service() {
Some(ClockOp::GetPer) => {
xous::return_scalar(msg.sender, clk_mgr.perclk as usize).unwrap()
}
Some(ClockOp::ResetReason) => {
xous::return_scalar(msg.sender, clk_mgr.reset_reason().raw_value() as usize)
.unwrap()
}
_ => panic!("Incorrect PlatformOp"),
}
}