diff --git a/cpu/native/include/hwtimer_cpu.h b/cpu/native/include/hwtimer_cpu.h index d324b4ff9a615c19cd67929e44c7b8688b102584..2e4ba477c126556fd28247df1cda2bf318f661d5 100644 --- a/cpu/native/include/hwtimer_cpu.h +++ b/cpu/native/include/hwtimer_cpu.h @@ -14,6 +14,8 @@ * @} */ +#include "periph_conf.h" + #ifndef HWTIMER_CPU_H_ #define HWTIMER_CPU_H_ @@ -24,7 +26,7 @@ extern "C" { #define HWTIMER_MAXTIMERS 1 #define HWTIMER_SPEED 1000000 #define HWTIMER_MAXTICKS (0xFFFFFFFF) -#define HWTIMER_SPIN_BARRIER 20 +#define HWTIMER_SPIN_BARRIER NATIVE_TIMER_MIN_RES #ifdef __cplusplus } diff --git a/cpu/native/include/periph_conf.h b/cpu/native/include/periph_conf.h index 187de84d6e0a995cae0874376679e847de05be5a..7efe40b4887ab6cb53f019c5cee6f348fcb61fe3 100644 --- a/cpu/native/include/periph_conf.h +++ b/cpu/native/include/periph_conf.h @@ -20,6 +20,13 @@ extern "C" { #endif +/** + * @name hardware timer clock skew avoidance + * @{ + */ +#define NATIVE_TIMER_MIN_RES 200 +/** @} */ + /** * @name Random Number Generator configuration * @{ diff --git a/cpu/native/periph/timer.c b/cpu/native/periph/timer.c index 9e467b79b8e0430cea1b86c386912675ab4e1fce..6c1fff901d303a62357c62c9c947441eabbfa37f 100644 --- a/cpu/native/periph/timer.c +++ b/cpu/native/periph/timer.c @@ -46,8 +46,6 @@ #define NATIVE_TIMER_SPEED 1000000 -#define NATIVE_TIMER_MIN_RES 200 - static unsigned long time_null; static void (*_callback)(int); diff --git a/tests/hwtimer_spin/main.c b/tests/hwtimer_spin/main.c index 7a411d514d2fc9b00d44d8c55971812d07beb734..dc0842b4ec80a289eb2066153292a90f8dfa2cbc 100644 --- a/tests/hwtimer_spin/main.c +++ b/tests/hwtimer_spin/main.c @@ -32,7 +32,7 @@ int main(void) " this test was successful."); puts("If you do not see that message, something went wrong.\n"); - for (unsigned long r = 10000; r > 0; r--) { + for (unsigned long r = 1000; r > 0; r--) { for (unsigned long i = HWTIMER_SPIN_BARRIER; i > 0; i--) { hwtimer_wait(i); } diff --git a/tests/hwtimer_wait/main.c b/tests/hwtimer_wait/main.c index 70c9f68ac861ef4b9d836deb950bfdea2cfd28da..b6aad533ebff2d7ca1b4fb0ab8b1caca4677680e 100644 --- a/tests/hwtimer_wait/main.c +++ b/tests/hwtimer_wait/main.c @@ -29,7 +29,7 @@ int main(void) puts("This is a regression test for a race condition in hwtimer_wait."); puts("When the race condition is hit, the timer will wait for a very very long time."); - long iterations = 10000; + long iterations = 1000; long start_duration = (HWTIMER_SPIN_BARRIER + 1) << 5; long duration = iterations * start_duration * 2L;