pub struct Watchdog<'d> { /* private fields */ }Expand description
Code Watchdog peripheral
Implementations§
Source§impl<'d> Watchdog<'d>
impl<'d> Watchdog<'d>
Sourcepub fn new(
_peri: Peri<'d, CDOG0>,
_irq: impl Binding<CDOG0, InterruptHandler> + 'd,
config: Config,
) -> Result<Self>
pub fn new( _peri: Peri<'d, CDOG0>, _irq: impl Binding<CDOG0, InterruptHandler> + 'd, config: Config, ) -> Result<Self>
Creates a new CDOG instance with the given configuration.
§Arguments
_peri- Peripheral ownership token_irq- Interrupt binding for CDOG0 interrupt handlerconfig- Configuration for fault handling and operational modes
§Returns
Ok(Watchdog)- Successfully configured watchdogErr(Error::WatchdogRunning)- Watchdog is already running and cannot be reconfigured
Sourcepub fn check(&mut self, check: u32)
pub fn check(&mut self, check: u32)
Checks the secure counter value and restarts the watchdog.
This stops the watchdog, verifies the secure counter matches the expected value, and restarts with the same instruction timer reload value.
§Arguments
check- Expected secure counter value
§Note
If the counter doesn’t match, a miscompare fault may be triggered depending on configuration.
Sourcepub fn get_instruction_timer(&self) -> u32
pub fn get_instruction_timer(&self) -> u32
Reads the current instruction timer value.
§Returns
Current countdown value of the instruction timer.
Sourcepub fn get_secure_counter(&self) -> u32
pub fn get_secure_counter(&self) -> u32
§Returns
The software-tracked secure counter value.
Sourcepub fn update_instruction_timer(&mut self, instruction_timer_value: u32)
pub fn update_instruction_timer(&mut self, instruction_timer_value: u32)
Updates the instruction timer reload value.
§Arguments
instruction_timer_value- New timeout period in clock cycles
Sourcepub fn set_persistent_value(&mut self, value: u32)
pub fn set_persistent_value(&mut self, value: u32)
Sets a persistent value in the CDOG peripheral.
This value is stored in the 32 bits PERSISTENT register and persist through resets other than a Power-On Reset (POR).
§Arguments
value- The 32-bit value to store in the persistent register
Sourcepub fn get_persistent_value(&self) -> u32
pub fn get_persistent_value(&self) -> u32
Gets the persistent value from the CDOG peripheral.
§Returns
The 32-bit value stored in the persistent register