Skip to content

Commit 365fd52

Browse files
pabigotcarlescufi
authored andcommitted
tests: kernel: timer_api: use slew for duration timer test
Reduce the duration of the timer test so that it will fire before the busywait elapses even in the worst case of slew between the tick and busy-wait clocks. Signed-off-by: Peter Bigot <[email protected]>
1 parent ac94ffe commit 365fd52

File tree

1 file changed

+5
-1
lines changed
  • tests/kernel/timer/timer_api/src

1 file changed

+5
-1
lines changed

tests/kernel/timer/timer_api/src/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ void test_timer_period_0(void)
195195
{
196196
init_timer_data();
197197
/** TESTPOINT: set period 0 */
198-
k_timer_start(&period0_timer, K_MSEC(DURATION), K_NO_WAIT);
198+
k_timer_start(&period0_timer,
199+
K_TICKS(k_ms_to_ticks_floor32(DURATION)
200+
- BUSY_SLEW_THRESHOLD_TICKS(DURATION
201+
* USEC_PER_MSEC)),
202+
K_NO_WAIT);
199203
tdata.timestamp = k_uptime_get();
200204
busy_wait_ms(DURATION + 1);
201205

0 commit comments

Comments
 (0)