diff --git a/mips-mcu/Cargo.toml b/mips-mcu/Cargo.toml index fd3eebb..4b0da74 100644 --- a/mips-mcu/Cargo.toml +++ b/mips-mcu/Cargo.toml @@ -2,8 +2,8 @@ name = "mips-mcu" description = "Low level access to MIPS MCU cores" categories = ["embedded", "hardware-support", "no-std"] -keywords = ["mips", "register", "peripheral"] -version = "0.3.0" +keywords = ["mips", "pic32", "register", "peripheral"] +version = "0.3.1" authors = ["Stephan "] repository = "https://github.com/kiffie/pic32-rs" license = "MIT OR Apache-2.0" diff --git a/mips-mcu/bin/libmipsmcu.a b/mips-mcu/bin/libmipsmcu.a index 11190df..37214b2 100644 Binary files a/mips-mcu/bin/libmipsmcu.a and b/mips-mcu/bin/libmipsmcu.a differ diff --git a/mips-mcu/bin/mips_irq.S b/mips-mcu/bin/mips_irq.S index 1b9bbc3..6b41ad3 100644 --- a/mips-mcu/bin/mips_irq.S +++ b/mips-mcu/bin/mips_irq.S @@ -63,3 +63,14 @@ mips_restore_irq: nop .end mips_restore_irq +# wait for interrupts +# +# void mips_wait(void) +# +.global mips_wait +.ent mips_wait +mips_wait: + wait + jr ra + nop +.end mips_wait diff --git a/mips-mcu/src/interrupt.rs b/mips-mcu/src/interrupt.rs index 5974233..8d3e37b 100644 --- a/mips-mcu/src/interrupt.rs +++ b/mips-mcu/src/interrupt.rs @@ -48,3 +48,16 @@ pub unsafe fn restore(previous_status: IrqSave) { } mips_restore_irq(previous_status) } + +/// Wait for interrupts +/// +/// Use the MIPS `wait` instruction to wait for interrupts and to put the +/// processor in a power saving mode. +pub fn wait() { + extern "C" { + fn mips_wait(); + } + unsafe { + mips_wait(); + } +}