Zephyr Project API 3.7.0-rc1
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 <zephyr/spinlock.h>

Macros

#define CPU1_STACK_SIZE   1024
 

Functions

 K_THREAD_STACK_DEFINE (cpu1_stack, 1024)
 
 ZTEST (spinlock, test_spinlock_basic)
 Test basic spinlock.
 
static void bounce_once (int id, bool trylock)
 
static void cpu1_fn (void *p1, void *p2, void *p3)
 
 ZTEST (spinlock, test_spinlock_bounce)
 Test spinlock with bounce.
 
 ZTEST (spinlock, test_spinlock_mutual_exclusion)
 Test basic mutual exclusion using interrupt masking.
 
static void trylock_fn (void *p1, void *p2, void *p3)
 
 ZTEST (spinlock, test_trylock)
 Test k_spin_trylock()
 
static void before (void *ctx)
 
 ZTEST_SUITE (spinlock, NULL, NULL, before, NULL, NULL)
 

Variables

struct k_thread cpu1_thread
 
static struct k_spinlock bounce_lock
 
volatile int bounce_owner
 
volatile int bounce_done
 
volatile int trylock_failures
 
volatile int trylock_successes
 

Macro Definition Documentation

◆ CPU1_STACK_SIZE

#define CPU1_STACK_SIZE   1024

Function Documentation

◆ before()

static void before ( void *  ctx)
static

◆ bounce_once()

static void bounce_once ( int  id,
bool  trylock 
)
static

◆ cpu1_fn()

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

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( cpu1_stack  ,
1024   
)

◆ trylock_fn()

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

◆ ZTEST_SUITE()

ZTEST_SUITE ( spinlock  ,
NULL  ,
NULL  ,
before  ,
NULL  ,
NULL   
)

Variable Documentation

◆ bounce_done

volatile int bounce_done

◆ bounce_lock

struct k_spinlock bounce_lock
static

◆ bounce_owner

volatile int bounce_owner

◆ cpu1_thread

struct k_thread cpu1_thread

◆ trylock_failures

volatile int trylock_failures

◆ trylock_successes

volatile int trylock_successes