Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
#include <zephyr/kernel.h>
#include <zephyr/sys/time_units.h>
#include <zephyr/tc_util.h>
#include <zephyr/ztest.h>
Data Structures | |
struct | timer_wrapper |
Macros | |
#define | TIMERS 4 |
#define | TEST_SECONDS 10 |
#define | MAX_CALLBACKS (CONFIG_SYS_CLOCK_TICKS_PER_SEC*TEST_SECONDS)/TIMERS |
Functions | |
K_SEM_DEFINE (timers_sem, 0, K_SEM_MAX_LIMIT) | |
void | tm_fn (struct k_timer *tm) |
ZTEST (timer_tick_train, test_one_tick_timer_train) | |
Test timers can be scheduled 1 tick apart without issues. | |
ZTEST_SUITE (timer_tick_train, NULL, NULL, NULL, NULL, NULL) | |
Variables | |
struct timer_wrapper | timers [4] |
#define MAX_CALLBACKS (CONFIG_SYS_CLOCK_TICKS_PER_SEC*TEST_SECONDS)/TIMERS |
#define TEST_SECONDS 10 |
#define TIMERS 4 |
K_SEM_DEFINE | ( | timers_sem | , |
0 | , | ||
K_SEM_MAX_LIMIT | |||
) |
void tm_fn | ( | struct k_timer * | tm | ) |
ZTEST | ( | timer_tick_train | , |
test_one_tick_timer_train | |||
) |
Test timers can be scheduled 1 tick apart without issues.
Schedules timers with absolute scheduling with a 1 tick period. Measures the total time elapsed and tries to run some fake busy work while doing so. If the print outs don't show up or the timer train is late to the station, the test fails.
ZTEST_SUITE | ( | timer_tick_train | , |
NULL | , | ||
NULL | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
struct timer_wrapper timers[4] |