2019-05-05 20:56:23 +08:00
|
|
|
/// The classic no-op
|
|
|
|
#[inline]
|
|
|
|
pub fn nop() {
|
2020-05-01 07:11:35 +08:00
|
|
|
unsafe { llvm_asm!("nop" :::: "volatile") }
|
2019-05-05 20:56:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Wait For Event
|
|
|
|
#[inline]
|
|
|
|
pub fn wfe() {
|
2020-05-01 07:11:35 +08:00
|
|
|
unsafe { llvm_asm!("wfe" :::: "volatile") }
|
2019-05-05 20:56:23 +08:00
|
|
|
}
|
2019-05-24 01:05:06 +08:00
|
|
|
|
2019-11-16 06:54:26 +08:00
|
|
|
/// Send Event
|
|
|
|
#[inline]
|
|
|
|
pub fn sev() {
|
2020-05-01 07:11:35 +08:00
|
|
|
unsafe { llvm_asm!("sev" :::: "volatile") }
|
2019-11-16 06:54:26 +08:00
|
|
|
}
|
|
|
|
|
2019-05-24 01:05:06 +08:00
|
|
|
/// Data Memory Barrier
|
|
|
|
#[inline]
|
|
|
|
pub fn dmb() {
|
2020-05-01 07:11:35 +08:00
|
|
|
unsafe { llvm_asm!("dmb" :::: "volatile") }
|
2019-05-24 01:05:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Data Synchronization Barrier
|
|
|
|
#[inline]
|
|
|
|
pub fn dsb() {
|
2020-05-01 07:11:35 +08:00
|
|
|
unsafe { llvm_asm!("dsb" :::: "volatile") }
|
2019-05-24 01:05:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Instruction Synchronization Barrier
|
|
|
|
#[inline]
|
|
|
|
pub fn isb() {
|
2020-05-01 07:11:35 +08:00
|
|
|
unsafe { llvm_asm!("isb" :::: "volatile") }
|
2019-05-24 01:05:06 +08:00
|
|
|
}
|
2020-08-03 11:21:38 +08:00
|
|
|
|
|
|
|
/// Enable IRQ
|
|
|
|
#[inline]
|
|
|
|
pub unsafe fn enable_irq() {
|
|
|
|
llvm_asm!("cpsie i":::: "volatile");
|
|
|
|
}
|
2020-08-03 11:23:41 +08:00
|
|
|
|
|
|
|
/// Exiting IRQ
|
|
|
|
#[inline]
|
|
|
|
pub unsafe fn exit_irq() {
|
|
|
|
llvm_asm!("
|
|
|
|
mrs r0, SPSR
|
|
|
|
msr CPSR, r0
|
|
|
|
" ::: "r0");
|
|
|
|
}
|