Browse Source

tests: bitarithm_timings: convert to xtimer

dev/timer
Kaspar Schleiser 8 years ago
parent
commit
14cbec41bb
  1. 2
      tests/bitarithm_timings/Makefile
  2. 13
      tests/bitarithm_timings/main.c

2
tests/bitarithm_timings/Makefile

@ -1,4 +1,6 @@
APPLICATION = bitarithm_timings
include ../Makefile.tests_common
USEMODULE += xtimer
include $(RIOTBASE)/Makefile.include

13
tests/bitarithm_timings/main.c

@ -32,12 +32,10 @@
#include <stdio.h>
#include "bitarithm.h"
#include "hwtimer.h"
#include "timex.h"
#include "xtimer.h"
#define TIMEOUT_S (5ul)
#define TIMEOUT_US (TIMEOUT_S * SEC_IN_USEC)
#define TIMEOUT (HWTIMER_TICKS(TIMEOUT_US))
#define TIMEOUT (TIMEOUT_S * SEC_IN_USEC)
#define PER_ITERATION (4)
static void callback(void *done_)
@ -52,7 +50,12 @@ static void run_test(const char *name, unsigned (*test)(unsigned))
unsigned i = 0;
unsigned long count = 0;
hwtimer_set(TIMEOUT, callback, (void *) &done);
xtimer_t xtimer;
xtimer.callback = callback;
xtimer.arg = (void *) &done;
xtimer_set(&xtimer, TIMEOUT);
do {
if (i++ == -1u) {
i = 1;

Loading…
Cancel
Save