Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
jitter_drift.c File Reference
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/tc_util.h>
#include <zephyr/ztest.h>

Functions

static void timer_period_fn (struct k_timer *t)
 
static void collect_timer_period_time_samples (void)
 
static void timer_startdelay_fn (struct k_timer *t)
 
static void collect_timer_startdelay_time_samples (void)
 
static uint64_t periodic_diff (uint64_t later, uint64_t earlier)
 
static double cycles_to_us (uint64_t cycles)
 
static void do_test_using (void(*sample_collection_fn)(void), const char *mechanism)
 Test a timers jitter and drift over time.
 
 ZTEST (timer_jitter_drift, test_jitter_drift_timer_period)
 
 ZTEST (timer_jitter_drift, test_jitter_drift_timer_startdelay)
 
 ZTEST_SUITE (timer_jitter_drift, NULL, NULL, NULL, NULL, NULL)
 

Variables

static uint32_t periodic_idx
 
static uint64_t periodic_data [CONFIG_TIMER_TEST_SAMPLES+1]
 
static uint64_t periodic_start
 
static uint64_t periodic_end
 
static struct k_timer periodic_timer
 
static struct k_sem periodic_sem
 

Function Documentation

◆ collect_timer_period_time_samples()

static void collect_timer_period_time_samples ( void  )
static

◆ collect_timer_startdelay_time_samples()

static void collect_timer_startdelay_time_samples ( void  )
static

◆ cycles_to_us()

static double cycles_to_us ( uint64_t  cycles)
static

◆ do_test_using()

static void do_test_using ( void(*)(void)  sample_collection_fn,
const char *  mechanism 
)
static

Test a timers jitter and drift over time.

◆ periodic_diff()

static uint64_t periodic_diff ( uint64_t  later,
uint64_t  earlier 
)
static

◆ timer_period_fn()

static void timer_period_fn ( struct k_timer *  t)
static

◆ timer_startdelay_fn()

static void timer_startdelay_fn ( struct k_timer *  t)
static

◆ ZTEST() [1/2]

ZTEST ( timer_jitter_drift  ,
test_jitter_drift_timer_period   
)

◆ ZTEST() [2/2]

ZTEST ( timer_jitter_drift  ,
test_jitter_drift_timer_startdelay   
)

◆ ZTEST_SUITE()

ZTEST_SUITE ( timer_jitter_drift  ,
NULL  ,
NULL  ,
NULL  ,
NULL  ,
NULL   
)

Variable Documentation

◆ periodic_data

uint64_t periodic_data[CONFIG_TIMER_TEST_SAMPLES+1]
static

◆ periodic_end

uint64_t periodic_end
static

◆ periodic_idx

uint32_t periodic_idx
static

◆ periodic_sem

struct k_sem periodic_sem
static

◆ periodic_start

uint64_t periodic_start
static

◆ periodic_timer

struct k_timer periodic_timer
static