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

Macros

#define THREAD_STACK   (384 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define TEST_TICKS_TO_SLEEP   (CONFIG_SYS_CLOCK_TICKS_PER_SEC / 2)
 

Functions

static K_THREAD_STACK_DEFINE (helper_tstack,(384+CONFIG_TEST_EXTRA_STACK_SIZE))
 
static void helper_thread (void *p1, void *p2, void *p3)
 
static int ticks_to_sleep (int ticks)
 
static int test_early_sleep_post_kernel (void)
 
 SYS_INIT (test_early_sleep_post_kernel, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE)
 
static int test_early_sleep_app (void)
 
 SYS_INIT (test_early_sleep_app, APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEVICE)
 
 ZTEST (earlysleep, test_early_sleep)
 Test early sleep.
 
 ZTEST_SUITE (earlysleep, NULL, NULL, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL)
 

Variables

static struct k_thread helper_tdata
 
static k_tid_t helper_ttid
 
static int actual_sleep_ticks
 
static int actual_post_kernel_sleep_ticks
 
static int actual_app_sleep_ticks
 
static bool test_failure = true
 

Macro Definition Documentation

◆ TEST_TICKS_TO_SLEEP

#define TEST_TICKS_TO_SLEEP   (CONFIG_SYS_CLOCK_TICKS_PER_SEC / 2)

◆ THREAD_STACK

#define THREAD_STACK   (384 + CONFIG_TEST_EXTRA_STACK_SIZE)

Function Documentation

◆ helper_thread()

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

◆ K_THREAD_STACK_DEFINE()

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

◆ SYS_INIT() [1/2]

SYS_INIT ( test_early_sleep_app  ,
APPLICATION  ,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE   
)

◆ SYS_INIT() [2/2]

SYS_INIT ( test_early_sleep_post_kernel  ,
POST_KERNEL  ,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE   
)

◆ test_early_sleep_app()

static int test_early_sleep_app ( void  )
static

◆ test_early_sleep_post_kernel()

static int test_early_sleep_post_kernel ( void  )
static

◆ ticks_to_sleep()

static int ticks_to_sleep ( int  ticks)
static

◆ ZTEST()

ZTEST ( earlysleep  ,
test_early_sleep   
)

Test early sleep.

See also
k_sleep()

◆ ZTEST_SUITE()

ZTEST_SUITE ( earlysleep  ,
NULL  ,
NULL  ,
ztest_simple_1cpu_before  ,
ztest_simple_1cpu_after  ,
NULL   
)

Variable Documentation

◆ actual_app_sleep_ticks

int actual_app_sleep_ticks
static

◆ actual_post_kernel_sleep_ticks

int actual_post_kernel_sleep_ticks
static

◆ actual_sleep_ticks

int actual_sleep_ticks
static

◆ helper_tdata

struct k_thread helper_tdata
static

◆ helper_ttid

k_tid_t helper_ttid
static

◆ test_failure

bool test_failure = true
static