diff --git a/cpu/cc2430/dev/clock.c b/cpu/cc2430/dev/clock.c index 09e60af31..d34097c92 100644 --- a/cpu/cc2430/dev/clock.c +++ b/cpu/cc2430/dev/clock.c @@ -56,17 +56,17 @@ static volatile __data clock_time_t count = 0; /* Uptime in ticks */ static volatile __data clock_time_t seconds = 0; /* Uptime in secs */ /*---------------------------------------------------------------------------*/ /** - * One delay is about 0.6 us, so this function delays for len * 0.6 us + * Each iteration is ~1.0xy usec, so this function delays for roughly len usec */ void clock_delay(unsigned int len) { - unsigned int i; - for(i = 0; i< len; i++) { - __asm - nop - __endasm; + DISABLE_INTERRUPTS(); + while(len--) { + ASM(nop); ASM(nop); ASM(nop); + ASM(nop); ASM(nop); } + ENABLE_INTERRUPTS(); } /*---------------------------------------------------------------------------*/ /** diff --git a/cpu/cc253x/dev/clock.c b/cpu/cc253x/dev/clock.c index c67b3a93b..66f24d56c 100644 --- a/cpu/cc253x/dev/clock.c +++ b/cpu/cc253x/dev/clock.c @@ -59,15 +59,16 @@ static volatile __data clock_time_t count = 0; /* Uptime in ticks */ static volatile __data clock_time_t seconds = 0; /* Uptime in secs */ /*---------------------------------------------------------------------------*/ /** - * One delay is about 0.6 us, so this function delays for len * 0.6 us + * Each iteration is ~1.0xy usec, so this function delays for roughly len usec */ void clock_delay(unsigned int len) { - unsigned int i; - for(i = 0; i< len; i++) { + DISABLE_INTERRUPTS(); + while(len--) { ASM(nop); } + ENABLE_INTERRUPTS(); } /*---------------------------------------------------------------------------*/ /**