| 
    Zephyr Project API
    3.2.0
    
   A Scalable Open Source RTOS 
   | 
 
#include <zephyr/tc_util.h>#include <zephyr/ztest.h>#include <zephyr/kernel.h>#include <ksched.h>#include <zephyr/kernel_structs.h>Data Structures | |
| struct | thread_info | 
Macros | |
| #define | T2_STACK_SIZE (2048 + CONFIG_TEST_EXTRA_STACK_SIZE) | 
| #define | STACK_SIZE (384 + CONFIG_TEST_EXTRA_STACK_SIZE) | 
| #define | DELAY_US 50000 | 
| #define | TIMEOUT 1000 | 
| #define | EQUAL_PRIORITY 1 | 
| #define | TIME_SLICE_MS 500 | 
| #define | THREAD_DELAY 1 | 
| #define | SLEEP_MS_LONG 15000 | 
| #define | THREADS_NUM CONFIG_MP_NUM_CPUS | 
| #define | LOOP_COUNT 20000 | 
Enumerations | |
| enum | sync_t { LOCK_IRQ , LOCK_SEM , LOCK_MUTEX } | 
Functions | |
| K_THREAD_STACK_DEFINE (t2_stack,(2048+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
| K_SEM_DEFINE (cpuid_sema, 0, 1) | |
| K_SEM_DEFINE (sema, 0, 1) | |
| static | K_THREAD_STACK_ARRAY_DEFINE (tstack, CONFIG_MP_NUM_CPUS,(384+CONFIG_TEST_EXTRA_STACK_SIZE)) | 
| static int | curr_cpu (void) | 
| static void | t2_fn (void *a, void *b, void *c) | 
| ZTEST (smp, test_smp_coop_threads) | |
| Verify SMP with 2 cooperative threads.  More... | |
| static void | child_fn (void *p1, void *p2, void *p3) | 
| ZTEST (smp, test_cpu_id_threads) | |
| Verify CPU IDs of threads in SMP.  More... | |
| static void | thread_entry (void *p1, void *p2, void *p3) | 
| static void | spin_for_threads_exit (void) | 
| static void | spawn_threads (int prio, int thread_num, int equal_prio, k_thread_entry_t thread_entry, int delay) | 
| static void | abort_threads (int num) | 
| static void | cleanup_resources (void) | 
| ZTEST (smp, test_coop_resched_threads) | |
| Test cooperative threads non-preemption.  More... | |
| ZTEST (smp, test_preempt_resched_threads) | |
| Test preemptness of preemptive thread.  More... | |
| ZTEST (smp, test_yield_threads) | |
| Validate behavior of thread when it yields.  More... | |
| ZTEST (smp, test_sleep_threads) | |
| Test behavior of thread when it sleeps.  More... | |
| static void | thread_wakeup_entry (void *p1, void *p2, void *p3) | 
| static void | wakeup_on_start_thread (int tnum) | 
| static void | check_wokeup_threads (int tnum) | 
| ZTEST (smp, test_wakeup_threads) | |
| Test behavior of wakeup() in SMP case.  More... | |
| static void | thread_get_cpu_entry (void *p1, void *p2, void *p3) | 
| ZTEST (smp, test_get_cpu) | |
| void | k_sys_fatal_error_handler (unsigned int reason, const z_arch_esf_t *esf) | 
| Test interprocessor interrupt.  More... | |
| void | entry_oops (void *p1, void *p2, void *p3) | 
| ZTEST (smp, test_fatal_on_smp) | |
| Test fatal error can be triggered on different core.  More... | |
| static void | workq_handler (struct k_work *work) | 
| ZTEST (smp, test_workq_on_smp) | |
| Test system workq run on different core.  More... | |
| static void | t1_mutex_lock (void *p1, void *p2, void *p3) | 
| static void | t2_mutex_lock (void *p1, void *p2, void *p3) | 
| ZTEST (smp, test_smp_release_global_lock) | |
| Test scenario that a thread release the global lock.  More... | |
| static void | sync_lock_dummy (void *k) | 
| static void | sync_lock_irq (void *k) | 
| static void | sync_unlock_irq (void *k) | 
| static void | sync_lock_sem (void *k) | 
| static void | sync_unlock_sem (void *k) | 
| static void | sync_lock_mutex (void *k) | 
| static void | sync_unlock_mutex (void *k) | 
| static void | sync_init (int lock_type) | 
| static void | inc_global_cnt (void *a, void *b, void *c) | 
| static int | run_concurrency (int type, void *func) | 
| ZTEST (smp, test_inc_concurrency) | |
| Test if the concurrency of SMP works or not.  More... | |
| static void | process_events (void *arg0, void *arg1, void *arg2) | 
| Torture test for context switching code.  More... | |
| static void | signal_raise (void *arg0, void *arg1, void *arg2) | 
| ZTEST (smp, test_smp_switch_torture) | |
| static void * | smp_tests_setup (void) | 
| ZTEST_SUITE (smp, NULL, smp_tests_setup, NULL, NULL, NULL) | |
Variables | |
| struct k_thread | t2 | 
| volatile int | t2_count | 
| volatile int | sync_count = -1 | 
| static int | main_thread_id | 
| static int | child_thread_id | 
| volatile int | rv | 
| static struct k_mutex | smutex | 
| static struct k_sem | smp_sem | 
| static ZTEST_BMEM volatile struct thread_info | tinfo [CONFIG_MP_NUM_CPUS] | 
| static struct k_thread | tthread [CONFIG_MP_NUM_CPUS] | 
| static volatile int | thread_started [CONFIG_MP_NUM_CPUS - 1] | 
| static struct k_poll_signal | tsignal [CONFIG_MP_NUM_CPUS] | 
| static struct k_poll_event | tevent [CONFIG_MP_NUM_CPUS] | 
| static int | global_cnt | 
| static struct k_mutex | smp_mutex | 
| static void(* | sync_lock )(void *) | 
| static void(* | sync_unlock )(void *) | 
| #define DELAY_US 50000 | 
| #define EQUAL_PRIORITY 1 | 
| #define LOOP_COUNT 20000 | 
| #define SLEEP_MS_LONG 15000 | 
| #define STACK_SIZE (384 + CONFIG_TEST_EXTRA_STACK_SIZE) | 
| #define T2_STACK_SIZE (2048 + CONFIG_TEST_EXTRA_STACK_SIZE) | 
| #define THREAD_DELAY 1 | 
| #define THREADS_NUM CONFIG_MP_NUM_CPUS | 
| #define TIME_SLICE_MS 500 | 
| #define TIMEOUT 1000 | 
| enum sync_t | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
| void entry_oops | ( | void * | p1, | 
| void * | p2, | ||
| void * | p3 | ||
| ) | 
      
  | 
  static | 
| K_SEM_DEFINE | ( | cpuid_sema | , | 
| 0 | , | ||
| 1 | |||
| ) | 
| K_SEM_DEFINE | ( | sema | , | 
| 0 | , | ||
| 1 | |||
| ) | 
      
  | 
  static | 
| K_THREAD_STACK_DEFINE | ( | t2_stack | , | 
| (2048+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
| ) | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
TESTPOINT: z_smp_release_global_lock() has been call during context switch but global_lock_cnt has not been decrease because no irq_lock() was called.
      
  | 
  static | 
      
  | 
  static | 
TESTPOINT: call arch_curr_cpu() to get cpu struct
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
| ZTEST | ( | smp | , | 
| test_get_cpu | |||
| ) | 
| ZTEST | ( | smp | , | 
| test_smp_switch_torture | |||
| ) | 
| ZTEST_SUITE | ( | smp | , | 
| NULL | , | ||
| smp_tests_setup | , | ||
| NULL | , | ||
| NULL | , | ||
| NULL | |||
| ) | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
| volatile int rv | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
| volatile int sync_count = -1 | 
      
  | 
  static | 
      
  | 
  static | 
| struct k_thread t2 | 
| volatile int t2_count | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static |