aboutsummaryrefslogtreecommitdiff
path: root/src/interrupt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/interrupt.rs')
-rw-r--r--src/interrupt.rs38
1 files changed, 2 insertions, 36 deletions
diff --git a/src/interrupt.rs b/src/interrupt.rs
index c5da48d..68719ec 100644
--- a/src/interrupt.rs
+++ b/src/interrupt.rs
@@ -26,25 +26,7 @@ pub unsafe trait InterruptNumber: Copy {
/// Disables all interrupts
#[inline]
pub fn disable() {
- match () {
- #[cfg(all(cortex_m, feature = "inline-asm"))]
- () => unsafe {
- llvm_asm!("cpsid i" ::: "memory" : "volatile");
- },
-
- #[cfg(all(cortex_m, not(feature = "inline-asm")))]
- () => unsafe {
- extern "C" {
- fn __cpsid();
- }
-
- // XXX do we need a explicit compiler barrier here?
- __cpsid();
- },
-
- #[cfg(not(cortex_m))]
- () => unimplemented!(),
- }
+ call_asm!(__cpsid());
}
/// Enables all the interrupts
@@ -54,23 +36,7 @@ pub fn disable() {
/// - Do not call this function inside an `interrupt::free` critical section
#[inline]
pub unsafe fn enable() {
- match () {
- #[cfg(all(cortex_m, feature = "inline-asm"))]
- () => llvm_asm!("cpsie i" ::: "memory" : "volatile"),
-
- #[cfg(all(cortex_m, not(feature = "inline-asm")))]
- () => {
- extern "C" {
- fn __cpsie();
- }
-
- // XXX do we need a explicit compiler barrier here?
- __cpsie();
- }
-
- #[cfg(not(cortex_m))]
- () => unimplemented!(),
- }
+ call_asm!(__cpsie());
}
/// Execute closure `f` in an interrupt-free context.