Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
#include <zephyr/irq_offload.h>
#include <zephyr/kernel_structs.h>

Macros

#define NUM_THREADS   ARRAY_SIZE(worker_priorities)
 
#define STACK_SIZE   (640 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define PRI(n)   (worker_priorities[n])
 

Enumerations

enum  { METAIRQ , COOP , PREEMPTIBLE }
 

Functions

 K_THREAD_STACK_DEFINE (manager_stack,(640+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_ARRAY_DEFINE (worker_stacks, ARRAY_SIZE(worker_priorities),(640+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_SEM_DEFINE (main_sem, 0, 1)
 
void wakeup_src_thread (int id)
 
void manager (void *p1, void *p2, void *p3)
 
void irq_waker (const void *p)
 
void validate_wakeup (int src, int target, k_tid_t last_thread)
 
void worker (void *p1, void *p2, void *p3)
 
 ZTEST (suite_preempt, test_preempt)
 Test preemption.
 
 ZTEST_SUITE (suite_preempt, NULL, NULL, NULL, NULL, NULL)
 

Variables

enum { ... }  worker_priorities []
 
k_tid_t last_wakeup_thread
 
struct k_thread manager_thread
 
struct k_thread worker_threads [ARRAY_SIZE(worker_priorities)]
 
struct k_sem worker_sems [ARRAY_SIZE(worker_priorities)]
 
int wakeup_target
 
volatile int do_lock
 
volatile int do_irq
 
volatile int do_sleep
 
volatile int do_yield
 

Macro Definition Documentation

◆ NUM_THREADS

#define NUM_THREADS   ARRAY_SIZE(worker_priorities)

◆ PRI

#define PRI (   n)    (worker_priorities[n])

◆ STACK_SIZE

#define STACK_SIZE   (640 + CONFIG_TEST_EXTRA_STACK_SIZE)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
METAIRQ 
COOP 
PREEMPTIBLE 

Function Documentation

◆ irq_waker()

void irq_waker ( const void *  p)

◆ K_SEM_DEFINE()

K_SEM_DEFINE ( main_sem  ,
,
 
)

◆ K_THREAD_STACK_ARRAY_DEFINE()

K_THREAD_STACK_ARRAY_DEFINE ( worker_stacks  ,
ARRAY_SIZE(worker_priorities ,
(640+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( manager_stack  ,
(640+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ manager()

void manager ( void *  p1,
void *  p2,
void *  p3 
)

◆ validate_wakeup()

void validate_wakeup ( int  src,
int  target,
k_tid_t  last_thread 
)

◆ wakeup_src_thread()

void wakeup_src_thread ( int  id)

◆ worker()

void worker ( void *  p1,
void *  p2,
void *  p3 
)

◆ ZTEST_SUITE()

ZTEST_SUITE ( suite_preempt  ,
NULL  ,
NULL  ,
NULL  ,
NULL  ,
NULL   
)

Variable Documentation

◆ do_irq

volatile int do_irq

◆ do_lock

volatile int do_lock

◆ do_sleep

volatile int do_sleep

◆ do_yield

volatile int do_yield

◆ last_wakeup_thread

k_tid_t last_wakeup_thread

◆ manager_thread

struct k_thread manager_thread

◆ wakeup_target

int wakeup_target

◆ []

enum { ... } worker_priorities[]
Initial value:
= {
}
@ METAIRQ
Definition main.c:43
@ PREEMPTIBLE
Definition main.c:43
@ COOP
Definition main.c:43

◆ worker_sems

struct k_sem worker_sems[ARRAY_SIZE(worker_priorities)]

◆ worker_threads

struct k_thread worker_threads[ARRAY_SIZE(worker_priorities)]