#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
#[cfg(not(feature = "nosync"))]
pub use crate::cortex_m::peripherals::cpb::Instance;
pub use crate::cortex_m::peripherals::cpb::{RegisterBlock, ResetValues};
pub use crate::cortex_m::peripherals::cpb::{
BPIALL, DCCIMVAC, DCCISW, DCCMVAC, DCCMVAU, DCCSW, DCIMVAC, DCISW, ICIALLU, ICIMVAU,
};
pub mod CPB {
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0xe000ef50,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
ICIALLU: 0x00000000,
ICIMVAU: 0x00000000,
DCIMVAC: 0x00000000,
DCISW: 0x00000000,
DCCMVAU: 0x00000000,
DCCMVAC: 0x00000000,
DCCSW: 0x00000000,
DCCIMVAC: 0x00000000,
DCCISW: 0x00000000,
BPIALL: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut CPB_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if CPB_TAKEN {
None
} else {
CPB_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if CPB_TAKEN && inst.addr == INSTANCE.addr {
CPB_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub unsafe fn steal() -> Instance {
CPB_TAKEN = true;
INSTANCE
}
}
pub const CPB: *const RegisterBlock = 0xe000ef50 as *const _;