#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
#[cfg(not(feature = "nosync"))]
pub use crate::imxrt101::peripherals::ewm::Instance;
pub use crate::imxrt101::peripherals::ewm::{RegisterBlock, ResetValues};
pub use crate::imxrt101::peripherals::ewm::{CLKCTRL, CLKPRESCALER, CMPH, CMPL, CTRL, SERV};
pub mod EWM {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x400b4000,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
CTRL: 0x00000000,
SERV: 0x00000000,
CMPL: 0x00000000,
CMPH: 0x000000FF,
CLKCTRL: 0x00000000,
CLKPRESCALER: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut EWM_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if EWM_TAKEN {
None
} else {
EWM_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if EWM_TAKEN && inst.addr == INSTANCE.addr {
EWM_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
EWM_TAKEN = true;
INSTANCE
}
}
pub const EWM: *const RegisterBlock = 0x400b4000 as *const _;