~ruther/avr-device

0e4336163e2c127475344364cd6663cb0bc47847 — Rahix 4 years ago 00312ea
Add asm module for assembly instructions

Add a new module containing wrapper functions for various assembly
instructions.  These functions are marked inline(always) to ensure they
will always just generate the single instruction as expected.

Signed-off-by: Rahix <rahix@rahix.de>
2 files changed, 20 insertions(+), 0 deletions(-)

A src/asm.rs
M src/lib.rs
A src/asm.rs => src/asm.rs +19 -0
@@ 0,0 1,19 @@
//! Assembly instructions

/// No Operation
#[inline(always)]
pub fn nop() {
    unsafe { llvm_asm!("nop") }
}

/// Sleep / Wait For Interrupt
#[inline(always)]
pub fn sleep() {
    unsafe { llvm_asm!("sleep") }
}

/// Watchdog Reset
#[inline(always)]
pub fn wdr() {
    unsafe { llvm_asm!("wdr") }
}

M src/lib.rs => src/lib.rs +1 -0
@@ 23,6 23,7 @@
#![feature(llvm_asm)]

pub mod interrupt;
pub mod asm;

#[allow(unused_imports)]
use generic::*;

Do not follow this link