Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
tick_timer_train.c File Reference
#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]
 

Macro Definition Documentation

◆ MAX_CALLBACKS

#define MAX_CALLBACKS   (CONFIG_SYS_CLOCK_TICKS_PER_SEC*TEST_SECONDS)/TIMERS

◆ TEST_SECONDS

#define TEST_SECONDS   10

◆ TIMERS

#define TIMERS   4

Function Documentation

◆ K_SEM_DEFINE()

K_SEM_DEFINE ( timers_sem  ,
,
K_SEM_MAX_LIMIT   
)

◆ tm_fn()

void tm_fn ( struct k_timer *  tm)

◆ ZTEST()

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()

ZTEST_SUITE ( timer_tick_train  ,
NULL  ,
NULL  ,
NULL  ,
NULL  ,
NULL   
)

Variable Documentation

◆ timers

struct timer_wrapper timers[4]