#![cfg_attr(feature = "std", allow(unreachable_code, unused_mut))]
#[inline]
pub fn wait_for_int() {
#[cfg(feature = "std")]
return unimplemented!();
unsafe { asm!("wfi" :::: "volatile") };
}
#[inline]
pub fn wait_for_event() {
#[cfg(feature = "std")]
return unimplemented!();
unsafe { asm!("wfe" :::: "volatile") };
}
#[inline]
pub fn send_event() {
#[cfg(feature = "std")]
return unimplemented!();
unsafe { asm!("sev" :::: "volatile") };
}
#[allow(clippy::empty_loop)]
#[inline]
pub fn self_reset() -> ! {
#[cfg(feature = "std")]
return unimplemented!();
unsafe {
use crate::{map::reg::scb, reg::prelude::*};
use drone_core::token::Token;
asm!("
dmb
cpsid f
" :
:
:
: "volatile"
);
scb::Aircr::<Urt>::take().store(|r| r.write_vectkey(0x05FA).set_sysresetreq());
loop {}
}
}
#[allow(unused_assignments, unused_variables)]
#[inline(always)]
pub fn spin(mut cycles: u32) {
#[cfg(feature = "std")]
return unimplemented!();
unsafe {
asm!("
0:
subs $0, $0, #3
bhi 0b
" : "+r"(cycles)
:
: "cc"
: "volatile"
);
}
}