#[inline(always)]
pub unsafe fn disable() {
match () {
#[cfg(target_arch = "arm")]
() => {
asm!("cpsid i" :::: "volatile");
}
#[cfg(not(target_arch = "arm"))]
() => {}
}
}
#[inline(always)]
pub unsafe fn enable() {
match () {
#[cfg(target_arch = "arm")]
() => {
asm!("cpsie i" :::: "volatile");
}
#[cfg(not(target_arch = "arm"))]
() => {}
}
}
pub unsafe fn free<F>(f: F)
where F: FnOnce()
{
let primask = ::register::primask::read();
disable();
f();
if primask & 1 == 0 {
enable();
}
}