1 /*
2  * Copyright (c) 2016 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef __TEST_SCHED_H__
8 #define __TEST_SCHED_H__
9 
10 #include <zephyr/kernel.h>
11 #include <zephyr/ztest.h>
12 
13 #define MAX_NUM_THREAD 10
14 #define STACK_SIZE (640 + CONFIG_TEST_EXTRA_STACK_SIZE)
15 
16 K_THREAD_STACK_DECLARE(tstack, STACK_SIZE);
17 K_THREAD_STACK_ARRAY_DECLARE(tstacks, MAX_NUM_THREAD, STACK_SIZE);
18 extern struct k_thread user_thread;
19 extern struct k_sem user_sem;
20 
21 struct thread_data {
22 	k_tid_t tid;
23 	int priority;
24 	int executed;
25 };
26 
27 void spin_for_ms(int ticks);
28 
29 void test_priority_cooperative(void);
30 void test_priority_preemptible(void);
31 void test_priority_preemptible_wait_prio(void);
32 void test_bad_priorities(void);
33 void test_yield_cooperative(void);
34 void test_sleep_cooperative(void);
35 void test_busy_wait_cooperative(void);
36 void test_sleep_wakeup_preemptible(void);
37 void test_pending_thread_wakeup(void);
38 void test_time_slicing_preemptible(void);
39 void test_time_slicing_disable_preemptible(void);
40 void test_lock_preemptible(void);
41 void test_unlock_preemptible(void);
42 void test_unlock_nested_sched_lock(void);
43 void test_sched_is_preempt_thread(void);
44 void test_slice_reset(void);
45 void test_slice_scheduling(void);
46 void test_priority_scheduling(void);
47 void test_wakeup_expired_timer_thread(void);
48 void test_user_k_wakeup(void);
49 void test_user_k_is_preempt(void);
50 void test_k_thread_suspend_init_null(void);
51 void test_k_thread_resume_init_null(void);
52 void test_k_thread_priority_get_init_null(void);
53 void test_k_thread_priority_set_init_null(void);
54 void test_k_thread_priority_set_overmax(void);
55 void test_k_thread_priority_set_upgrade(void);
56 void test_k_wakeup_init_null(void);
57 void test_slice_perthread(void);
58 
59 #endif /* __TEST_SCHED_H__ */
60