Skip to content

Commit

Permalink
[nrf fromlist] tests: kernel: timer: Fix failing tests
Browse files Browse the repository at this point in the history
This commit provides an additional threshold value for comparison when
a custom k_busy_wait() implementation is chosen.

Upstream PR: zephyrproject-rtos/zephyr#73068

Signed-off-by: Adam Kondraciuk <[email protected]>
  • Loading branch information
adamkondraciuk authored and bjarki-andreasen committed Sep 23, 2024
1 parent 3c6039a commit ab063f0
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/kernel/timer/timer_api/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,22 @@ struct timer_data {
*/
#define INEXACT_MS_CONVERT ((CONFIG_SYS_CLOCK_TICKS_PER_SEC % MSEC_PER_SEC) != 0)

#if CONFIG_NRF_RTC_TIMER
/* On Nordic SOCs one or both of the tick and busy-wait clocks may
* derive from sources that have slews that sum to +/- 13%.
#if CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT && CONFIG_NRF_RTC_TIMER
/* On Nordic SOCs using RTC_TIMER as the system timer and custom k_busy_wait() implementation,
* one or both of the tick and busy-wait clocks may derive from sources that have slews that
* sum to +/- 13%.
*/
#define BUSY_TICK_SLEW_PPM 130000U
#elif CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT && CONFIG_NRF_GRTC_TIMER
/* On Nordic SOCs using GRTC_TIMER as the system timer and custom k_busy_wait() implementation,
* one or both of the tick and busy-wait clocks may derive from sources that have slews that
* sum to +/- 2%.
*/
#define BUSY_TICK_SLEW_PPM 20000U
#else
/* On other platforms assume the clocks are perfectly aligned. */
/* In other cases assume the clocks are perfectly aligned. */
#define BUSY_TICK_SLEW_PPM 0U
#endif
#endif /* CONFIG_ARCH_HAS_CUSTOM_BUSY_WAIT && CONFIG_NRF_RTC_TIMER */
#define PPM_DIVISOR 1000000U

/* If the tick clock is faster or slower than the busywait clock the
Expand Down

0 comments on commit ab063f0

Please sign in to comment.