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/kernel.h>
#include <ksched.h>
#include <ipi.h>
#include <zephyr/kernel_structs.h>

Macros

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define NUM_THREADS   (CONFIG_MP_MAX_NUM_CPUS - 1)
 
#define DELAY_FOR_IPIS   200
 
#define PRIORITY_HIGH   5
 
#define PRIORITY_MED_HIGH   6
 
#define PRIORITY_MED_LOW   7
 
#define PRIORITY_LOW   9
 

Functions

 K_THREAD_STACK_DEFINE (stack2,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (stack3,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_DEFINE (stack4,(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_EVENT_DEFINE (my_event)
 
static void show_executing_threads (const char *str)
 
static void timer_expiry_fn (struct k_timer *timer)
 Should the threads not be scheduled as expected, abort threads T2, T3 and T4 and allow the system to recover.
 
void thread3_entry (void *p1, void *p2, void *p3)
 
void thread4_entry (void *p1, void *p2, void *p3)
 
void thread2_entry (void *p1, void *p2, void *p3)
 
 ZTEST (ipi_cascade, test_ipi_cascade)
 
 ZTEST_SUITE (ipi_cascade, NULL, NULL, NULL, NULL, NULL)
 

Variables

static struct k_thread thread2
 
static struct k_thread thread3
 
static struct k_thread thread4
 
static bool thread1_ready
 
static bool thread2_ready
 
static int cpu_t1
 
static int cpu_t2
 
static int cpu_t3
 
static int cpu_t4
 
static struct k_timer my_timer
 
static volatile bool timer_expired
 

Macro Definition Documentation

◆ DELAY_FOR_IPIS

#define DELAY_FOR_IPIS   200

◆ NUM_THREADS

#define NUM_THREADS   (CONFIG_MP_MAX_NUM_CPUS - 1)

◆ PRIORITY_HIGH

#define PRIORITY_HIGH   5

◆ PRIORITY_LOW

#define PRIORITY_LOW   9

◆ PRIORITY_MED_HIGH

#define PRIORITY_MED_HIGH   6

◆ PRIORITY_MED_LOW

#define PRIORITY_MED_LOW   7

◆ STACK_SIZE

#define STACK_SIZE   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)

Function Documentation

◆ K_EVENT_DEFINE()

K_EVENT_DEFINE ( my_event  )

◆ K_THREAD_STACK_DEFINE() [1/3]

K_THREAD_STACK_DEFINE ( stack2  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [2/3]

K_THREAD_STACK_DEFINE ( stack3  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE() [3/3]

K_THREAD_STACK_DEFINE ( stack4  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ show_executing_threads()

static void show_executing_threads ( const char *  str)
static

◆ thread2_entry()

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

◆ thread3_entry()

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

◆ thread4_entry()

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

◆ timer_expiry_fn()

static void timer_expiry_fn ( struct k_timer *  timer)
static

Should the threads not be scheduled as expected, abort threads T2, T3 and T4 and allow the system to recover.

The main thread (T1/test_ipi_cascade) will verify that the timer did not execute.

◆ ZTEST()

ZTEST ( ipi_cascade  ,
test_ipi_cascade   
)

◆ ZTEST_SUITE()

ZTEST_SUITE ( ipi_cascade  ,
NULL  ,
NULL  ,
NULL  ,
NULL  ,
NULL   
)

Variable Documentation

◆ cpu_t1

int cpu_t1
static

◆ cpu_t2

int cpu_t2
static

◆ cpu_t3

int cpu_t3
static

◆ cpu_t4

int cpu_t4
static

◆ my_timer

struct k_timer my_timer
static

◆ thread1_ready

bool thread1_ready
static

◆ thread2

struct k_thread thread2
static

◆ thread2_ready

bool thread2_ready
static

◆ thread3

struct k_thread thread3
static

◆ thread4

struct k_thread thread4
static

◆ timer_expired

volatile bool timer_expired
static