Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference
#include <zephyr/tc_util.h>
#include <zephyr/ztest.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/sys/util.h>
#include <zephyr/irq_offload.h>
#include <stdbool.h>

Macros

#define THREAD_STACK   (384 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define TEST_THREAD_PRIORITY   -4
 
#define HELPER_THREAD_PRIORITY   -10
 
#define ONE_SECOND   (MSEC_PER_SEC)
 
#define ONE_SECOND_ALIGNED    (uint32_t)(k_ticks_to_ms_floor64(k_ms_to_ticks_ceil32(ONE_SECOND) + _TICK_ALIGN))
 
#define TICK_MARGIN   1
 

Functions

static K_THREAD_STACK_DEFINE (test_thread_stack,(384+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static K_THREAD_STACK_DEFINE (helper_thread_stack,(384+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static void test_objects_init (void)
 
static void align_to_tick_boundary (void)
 
static int sleep_time_valid (uint32_t start, uint32_t end, uint32_t dur)
 
static void test_thread (void *p1, void *p2, void *p3)
 
static void irq_offload_isr (const void *arg)
 
static void helper_thread (void *p1, void *p2, void *p3)
 
 ZTEST (sleep, test_sleep)
 Test sleep functionality.
 
static void forever_thread_entry (void *p1, void *p2, void *p3)
 
 ZTEST (sleep, test_sleep_forever)
 
static void * sleep_setup (void)
 
 ZTEST_SUITE (sleep, NULL, sleep_setup, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL)
 

Variables

static struct k_sem test_thread_sem
 
static struct k_sem helper_thread_sem
 
static struct k_sem task_sem
 
static k_tid_t test_thread_id
 
static k_tid_t helper_thread_id
 
static struct k_thread test_thread_data
 
static struct k_thread helper_thread_data
 
static bool test_failure = true
 

Macro Definition Documentation

◆ HELPER_THREAD_PRIORITY

#define HELPER_THREAD_PRIORITY   -10

◆ ONE_SECOND

#define ONE_SECOND   (MSEC_PER_SEC)

◆ ONE_SECOND_ALIGNED

#define ONE_SECOND_ALIGNED    (uint32_t)(k_ticks_to_ms_floor64(k_ms_to_ticks_ceil32(ONE_SECOND) + _TICK_ALIGN))

◆ TEST_THREAD_PRIORITY

#define TEST_THREAD_PRIORITY   -4

◆ THREAD_STACK

#define THREAD_STACK   (384 + CONFIG_TEST_EXTRA_STACK_SIZE)

◆ TICK_MARGIN

#define TICK_MARGIN   1

Function Documentation

◆ align_to_tick_boundary()

static void align_to_tick_boundary ( void  )
static

◆ forever_thread_entry()

static void forever_thread_entry ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ helper_thread()

static void helper_thread ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ irq_offload_isr()

static void irq_offload_isr ( const void *  arg)
static

◆ K_THREAD_STACK_DEFINE() [1/2]

static K_THREAD_STACK_DEFINE ( helper_thread_stack  ,
(384+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ K_THREAD_STACK_DEFINE() [2/2]

static K_THREAD_STACK_DEFINE ( test_thread_stack  ,
(384+CONFIG_TEST_EXTRA_STACK_SIZE)   
)
static

◆ sleep_setup()

static void * sleep_setup ( void  )
static

◆ sleep_time_valid()

static int sleep_time_valid ( uint32_t  start,
uint32_t  end,
uint32_t  dur 
)
static

◆ test_objects_init()

static void test_objects_init ( void  )
static

◆ test_thread()

static void test_thread ( void *  p1,
void *  p2,
void *  p3 
)
static

◆ ZTEST()

ZTEST ( sleep  ,
test_sleep_forever   
)

◆ ZTEST_SUITE()

ZTEST_SUITE ( sleep  ,
NULL  ,
sleep_setup  ,
ztest_simple_1cpu_before  ,
ztest_simple_1cpu_after  ,
NULL   
)

Variable Documentation

◆ helper_thread_data

struct k_thread helper_thread_data
static

◆ helper_thread_id

k_tid_t helper_thread_id
static

◆ helper_thread_sem

struct k_sem helper_thread_sem
static

◆ task_sem

struct k_sem task_sem
static

◆ test_failure

bool test_failure = true
static

◆ test_thread_data

struct k_thread test_thread_data
static

◆ test_thread_id

k_tid_t test_thread_id
static

◆ test_thread_sem

struct k_sem test_thread_sem
static