msmp0-watchdog: reorder system initialization

This commit is contained in:
Siarhei B 2025-08-28 10:14:43 +02:00
parent b618b6bfcd
commit 0a45a4663c

View File

@ -283,6 +283,20 @@ impl Watchdog {
// init delay, 16 cycles
cortex_m::asm::delay(16);
critical_section::with(|_| {
// make sure watchdog triggers BOOTRST
pac::SYSCTL.systemcfg().modify(|w| {
if *T::regs() == pac::WWDT0 {
w.set_wwdtlp0rstdis(false);
}
#[cfg(any(mspm0g110x, mspm0g150x, mspm0g151x, mspm0g310x, mspm0g350x, mspm0g351x))]
if *T::regs() == pac::WWDT1 {
w.set_wwdtlp1rstdis(false);
}
});
});
//init watchdog
T::regs().wwdtctl0().write(|w| {
w.set_clkdiv(config.timeout.get_clkdiv());
@ -299,20 +313,6 @@ impl Watchdog {
w.set_key(vals::Wwdtctl1Key::KEY);
});
critical_section::with(|_| {
// make sure watchdog triggers BOOTRST
pac::SYSCTL.systemcfg().write(|w| {
if *T::regs() == pac::WWDT0 {
w.set_wwdtlp0rstdis(false);
}
#[cfg(any(mspm0g110x, mspm0g150x, mspm0g151x, mspm0g310x, mspm0g350x, mspm0g351x))]
if *T::regs() == pac::WWDT1 {
w.set_wwdtlp1rstdis(false);
}
});
});
Self { regs: T::regs() }
}