#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
#[cfg(not(feature = "nosync"))]
pub use crate::imxrt101::peripherals::rtwdog::Instance;
pub use crate::imxrt101::peripherals::rtwdog::{RegisterBlock, ResetValues};
pub use crate::imxrt101::peripherals::rtwdog::{CNT, CS, TOVAL, WIN};
pub mod RTWDOG {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x400bc000,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
CS: 0x00002980,
CNT: 0x00000000,
TOVAL: 0x00000400,
WIN: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut RTWDOG_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if RTWDOG_TAKEN {
None
} else {
RTWDOG_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if RTWDOG_TAKEN && inst.addr == INSTANCE.addr {
RTWDOG_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
RTWDOG_TAKEN = true;
INSTANCE
}
}
pub const RTWDOG: *const RegisterBlock = 0x400bc000 as *const _;