From cbab2efe7ec41efd7bfd0ca9c46675c5c37b0cb7 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Mon, 27 Oct 2014 17:44:33 +0100 Subject: [PATCH] core: hwtimer: use disable/restoreIRQ --- core/hwtimer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/hwtimer.c b/core/hwtimer.c index e878ffb1cd..b20e5c67f5 100644 --- a/core/hwtimer.c +++ b/core/hwtimer.c @@ -148,15 +148,17 @@ static int _hwtimer_set(unsigned long offset, void (*callback)(void*), void *ptr { DEBUG("_hwtimer_set: offset=%lu callback=%p ptr=%p absolute=%d\n", offset, callback, ptr, absolute); + unsigned state; + if (!inISR()) { - dINT(); + state = disableIRQ(); } int n = lifo_get(lifo); if (n == -1) { if (!inISR()) { - eINT(); + restoreIRQ(state); } puts("No hwtimer left."); @@ -178,7 +180,7 @@ static int _hwtimer_set(unsigned long offset, void (*callback)(void*), void *ptr lpm_prevent_sleep++; if (!inISR()) { - eINT(); + restoreIRQ(state); } return n;