-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests/periph_timer: Cleanup #14808
tests/periph_timer: Cleanup #14808
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -20,8 +20,10 @@ | |||||||||
|
||||||||||
#include <stdio.h> | ||||||||||
#include <stdint.h> | ||||||||||
#include <stdatomic.h> | ||||||||||
#include <stdlib.h> | ||||||||||
|
||||||||||
#include "macros/units.h" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This fixes the failing test on usb-kw41z (and probably on other boards) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. I'll fix tonight. (Feel free to (force) push instead, of you want.) |
||||||||||
#include "periph/timer.h" | ||||||||||
|
||||||||||
/** | ||||||||||
|
@@ -35,10 +37,18 @@ | |||||||||
#define CHAN_OFFSET (5000U) /* fire every 5ms */ | ||||||||||
#define COOKIE (100U) /* for checking if arg is passed */ | ||||||||||
|
||||||||||
static volatile int fired; | ||||||||||
static volatile uint32_t sw_count; | ||||||||||
static volatile uint32_t timeouts[MAX_CHANNELS]; | ||||||||||
static volatile unsigned args[MAX_CHANNELS]; | ||||||||||
#ifndef XTIMER_HZ | ||||||||||
#define XTIMER_HZ MHZ(1) | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a minor style improvement.
Suggested change
I can try on usb-kw41z, remote, hifive1b. |
||||||||||
#endif | ||||||||||
|
||||||||||
#ifndef TIMER_SPEED | ||||||||||
#define TIMER_SPEED XTIMER_HZ | ||||||||||
#endif | ||||||||||
|
||||||||||
static atomic_int fired; | ||||||||||
static atomic_uint_least32_t sw_count; | ||||||||||
static atomic_uint_least32_t timeouts[MAX_CHANNELS]; | ||||||||||
static atomic_uint args[MAX_CHANNELS]; | ||||||||||
|
||||||||||
static void cb(void *arg, int chan) | ||||||||||
{ | ||||||||||
|
@@ -89,7 +99,7 @@ static int test_timer(unsigned num) | |||||||||
timer_start(TIMER_DEV(num)); | ||||||||||
/* wait for all channels to fire */ | ||||||||||
do { | ||||||||||
++sw_count; | ||||||||||
sw_count++; | ||||||||||
} while (fired != set); | ||||||||||
/* collect results */ | ||||||||||
for (int i = 0; i < fired; i++) { | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW this should have been 250kHz :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also noticed that and even opened a PR until I noticed that #14799 was removing it...