Skip to content

Commit

Permalink
add interrupt::wait()
Browse files Browse the repository at this point in the history
  • Loading branch information
kiffie committed Jul 9, 2023
1 parent 4507847 commit 682fcd6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mips-mcu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <kiffie@mailbox.org>"]
repository = "https://github.com/kiffie/pic32-rs"
license = "MIT OR Apache-2.0"
Expand Down
Binary file modified mips-mcu/bin/libmipsmcu.a
Binary file not shown.
11 changes: 11 additions & 0 deletions mips-mcu/bin/mips_irq.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions mips-mcu/src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 682fcd6

Please sign in to comment.