#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
#[cfg(not(feature = "nosync"))]
pub use crate::imxrt101::peripherals::gpt::Instance;
pub use crate::imxrt101::peripherals::gpt::{RegisterBlock, ResetValues};
pub use crate::imxrt101::peripherals::gpt::{CNT, CR, ICR1, ICR2, IR, OCR1, OCR2, OCR3, PR, SR};
pub mod GPT1 {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x401ec000,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
CR: 0x00000000,
PR: 0x00000000,
SR: 0x00000000,
IR: 0x00000000,
OCR1: 0xFFFFFFFF,
OCR2: 0xFFFFFFFF,
OCR3: 0xFFFFFFFF,
ICR1: 0x00000000,
ICR2: 0x00000000,
CNT: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut GPT1_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if GPT1_TAKEN {
None
} else {
GPT1_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if GPT1_TAKEN && inst.addr == INSTANCE.addr {
GPT1_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
GPT1_TAKEN = true;
INSTANCE
}
}
pub const GPT1: *const RegisterBlock = 0x401ec000 as *const _;
pub mod GPT2 {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x401f0000,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
CR: 0x00000000,
PR: 0x00000000,
SR: 0x00000000,
IR: 0x00000000,
OCR1: 0xFFFFFFFF,
OCR2: 0xFFFFFFFF,
OCR3: 0xFFFFFFFF,
ICR1: 0x00000000,
ICR2: 0x00000000,
CNT: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut GPT2_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if GPT2_TAKEN {
None
} else {
GPT2_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if GPT2_TAKEN && inst.addr == INSTANCE.addr {
GPT2_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
GPT2_TAKEN = true;
INSTANCE
}
}
pub const GPT2: *const RegisterBlock = 0x401f0000 as *const _;