tests/timer_api: Make sure constant time conversions are constants
When the timer frequency is known at compile time, make sure we can use any time conversion macro as a global initializer. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
d8b276e929
commit
1b057d6295
1 changed files with 9 additions and 0 deletions
|
@ -33,7 +33,16 @@ struct test_rec {
|
|||
(void *)test_##src##_to_##dst##_##round##prec \
|
||||
} \
|
||||
|
||||
#ifdef CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME
|
||||
#define TESTVAR(src, dst, round, prec)
|
||||
#else
|
||||
#define TESTVAR(src, dst, round, prec) \
|
||||
uint##prec##_t test_##src##_to_##dst##_##round##prec##_val = \
|
||||
k_##src##_to_##dst##_##round##prec(42);
|
||||
#endif
|
||||
|
||||
#define TESTFUNC(src, dst, round, prec) \
|
||||
TESTVAR(src, dst, round, prec) \
|
||||
static uint##prec##_t test_##src##_to_##dst##_##round##prec(uint##prec##_t t) { \
|
||||
return k_##src##_to_##dst##_##round##prec(t); \
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue