embassy-mcxa

Crates

git

Versions

mcx-a256

Flavors

Watchdog

Struct Watchdog 

Source
pub struct Watchdog<'d> { /* private fields */ }
Expand description

Code Watchdog peripheral

Implementations§

Source§

impl<'d> Watchdog<'d>

Source

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 handler
  • config - Configuration for fault handling and operational modes
§Returns
  • Ok(Watchdog) - Successfully configured watchdog
  • Err(Error::WatchdogRunning) - Watchdog is already running and cannot be reconfigured
Source

pub fn start(&mut self, instruction_timer_value: u32, secure_counter_value: u32)

Starts the watchdog with specified timer and counter values.

§Arguments
  • instruction_timer_value - Number of clock cycles before timeout
  • secure_counter_value - Initial value of the secure counter
§Note

If the watchdog is already running, this will stop it first.

Source

pub fn add(&mut self, add: u32)

Adds a value to the secure counter.

§Arguments
  • add - Value to add to the secure counter
Source

pub fn sub(&mut self, sub: u32)

§Arguments
  • sub - Value to subtract from the secure counter
Source

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.

Source

pub fn get_instruction_timer(&self) -> u32

Reads the current instruction timer value.

§Returns

Current countdown value of the instruction timer.

Source

pub fn get_secure_counter(&self) -> u32

§Returns

The software-tracked secure counter value.

Source

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
Source

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
Source

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

Auto Trait Implementations§

§

impl<'d> Freeze for Watchdog<'d>

§

impl<'d> RefUnwindSafe for Watchdog<'d>

§

impl<'d> Send for Watchdog<'d>

§

impl<'d> Sync for Watchdog<'d>

§

impl<'d> Unpin for Watchdog<'d>

§

impl<'d> !UnwindSafe for Watchdog<'d>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.