projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merged from external project:
[bertos.git]
/
bertos
/
drv
/
timer.c
diff --git
a/bertos/drv/timer.c
b/bertos/drv/timer.c
index dfc27aefb53ccee74c8edaa141052e0b98010ee5..4d1309466da6b37fb870ad244aa4f802df57f74a 100644
(file)
--- a/
bertos/drv/timer.c
+++ b/
bertos/drv/timer.c
@@
-52,7
+52,7
@@
#include <cpu/irq.h>
#include <cpu/power.h> // cpu_relax()
#include <cpu/irq.h>
#include <cpu/power.h> // cpu_relax()
-#include <kern/pr
eempt
.h> // proc_decQuantun()
+#include <kern/pr
oc_p
.h> // proc_decQuantun()
/*
* Include platform-specific binding code if we're hosted.
/*
* Include platform-specific binding code if we're hosted.
@@
-286,15
+286,10
@@
void timer_busyWait(hptime_t delay)
hptime_t now, prev = timer_hw_hpread();
hptime_t delta;
hptime_t now, prev = timer_hw_hpread();
hptime_t delta;
- for(;;)
+ for
(;;)
{
now = timer_hw_hpread();
{
now = timer_hw_hpread();
- /*
- * We rely on hptime_t being unsigned here to
- * reduce the modulo to an AND in the common
- * case of TIMER_HW_CNT.
- */
- delta = (now - prev) % TIMER_HW_CNT;
+ delta = (now < prev) ? (TIMER_HW_CNT - prev + now) : (now - prev);
if (delta >= delay)
break;
delay -= delta;
if (delta >= delay)
break;
delay -= delta;
@@
-357,7
+352,7
@@
DEFINE_TIMER_ISR
/* Perform hw IRQ handling */
timer_hw_irq();
/* Perform hw IRQ handling */
timer_hw_irq();
-
+
TIMER_STROBE_OFF;
}
TIMER_STROBE_OFF;
}