1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 14:33:52 +01:00

native: timer: synchronize HWTIMER_SPIN_BARRIER with timer min resolution

This keeps the test/hwtimer_wait test duration correct.
This commit is contained in:
Benoît Canet 2015-07-09 16:09:59 +02:00
parent f95aaa6bf6
commit e01329796d
5 changed files with 12 additions and 5 deletions

View File

@ -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
}

View File

@ -20,6 +20,13 @@
extern "C" {
#endif
/**
* @name hardware timer clock skew avoidance
* @{
*/
#define NATIVE_TIMER_MIN_RES 200
/** @} */
/**
* @name Random Number Generator configuration
* @{

View File

@ -46,8 +46,6 @@
#define NATIVE_TIMER_SPEED 1000000
#define NATIVE_TIMER_MIN_RES 200
static unsigned long time_null;
static void (*_callback)(int);

View File

@ -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);
}

View File

@ -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;