tests: fix thread function signatures
Fix thread function signatures to avoid stack corruption on thread exit. Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
This commit is contained in:
parent
6202459d9f
commit
aa25e212d1
|
@ -125,8 +125,12 @@ void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *pEsf)
|
|||
* In k_sys_fatal_error_handler above we will check that the ESF provided
|
||||
* as a parameter matches these expectations.
|
||||
*/
|
||||
void set_regs_with_known_pattern(void)
|
||||
void set_regs_with_known_pattern(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
__asm__ volatile(
|
||||
"mov r1, #1\n"
|
||||
"mov r2, #2\n"
|
||||
|
@ -178,7 +182,7 @@ ZTEST(arm_interrupt, test_arm_esf_collection)
|
|||
TC_PRINT("Testing ESF Reporting\n");
|
||||
k_thread_create(&esf_collection_thread, esf_collection_stack,
|
||||
K_THREAD_STACK_SIZEOF(esf_collection_stack),
|
||||
(k_thread_entry_t)set_regs_with_known_pattern,
|
||||
set_regs_with_known_pattern,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(PRIORITY), 0,
|
||||
K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -119,8 +119,12 @@ void arm_isr_handler(const void *args)
|
|||
}
|
||||
}
|
||||
|
||||
static void user_thread_entry(uint32_t irq_line)
|
||||
static void user_thread_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
uint32_t irq_line = POINTER_TO_INT(p1);
|
||||
/* User Thread */
|
||||
#if !defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE)
|
||||
ARG_UNUSED(irq_line);
|
||||
|
@ -234,7 +238,7 @@ ZTEST(arm_thread_swap, test_arm_syscalls)
|
|||
k_thread_create(&user_thread,
|
||||
user_thread_stack,
|
||||
K_THREAD_STACK_SIZEOF(user_thread_stack),
|
||||
(k_thread_entry_t)user_thread_entry,
|
||||
user_thread_entry,
|
||||
(uint32_t *)i, NULL, NULL,
|
||||
K_PRIO_COOP(PRIORITY), K_USER,
|
||||
K_NO_WAIT);
|
||||
|
|
|
@ -221,8 +221,12 @@ static void verify_fp_callee_saved(const struct _preempt_float *src,
|
|||
#define ALT_THREAD_OPTIONS 0
|
||||
#endif /* CONFIG_FPU && CONFIG_FPU_SHARING */
|
||||
|
||||
static void alt_thread_entry(void)
|
||||
static void alt_thread_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int init_flag, post_flag;
|
||||
|
||||
/* Lock interrupts to make sure we get preempted only when
|
||||
|
@ -530,7 +534,7 @@ ZTEST(arm_thread_swap, test_arm_thread_swap)
|
|||
k_thread_create(&alt_thread,
|
||||
alt_thread_stack,
|
||||
K_THREAD_STACK_SIZEOF(alt_thread_stack),
|
||||
(k_thread_entry_t)alt_thread_entry,
|
||||
alt_thread_entry,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_COOP(PRIORITY), ALT_THREAD_OPTIONS,
|
||||
K_NO_WAIT);
|
||||
|
|
|
@ -51,8 +51,12 @@ K_SEM_DEFINE(sync_sema, 0, 1);
|
|||
* gets the first timestamp and invokes the software interrupt.
|
||||
*
|
||||
*/
|
||||
static void thread_one(void)
|
||||
static void thread_one(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
k_sem_take(&sync_sema, K_FOREVER);
|
||||
|
||||
timestamp_start = timing_counter_get();
|
||||
|
@ -75,8 +79,12 @@ static void thread_one(void)
|
|||
*
|
||||
* @return 0 on success
|
||||
*/
|
||||
static void thread_two(void)
|
||||
static void thread_two(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
k_sem_give(&sync_sema);
|
||||
while (ctx_switch_counter < NCTXSWITCH) {
|
||||
k_yield();
|
||||
|
@ -104,10 +112,10 @@ int coop_ctx_switch(void)
|
|||
bench_test_start();
|
||||
|
||||
k_thread_create(&thread_one_data, thread_one_stack, STACKSIZE,
|
||||
(k_thread_entry_t)thread_one, NULL, NULL, NULL,
|
||||
thread_one, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(6), 0, K_NO_WAIT);
|
||||
k_thread_create(&thread_two_data, thread_two_stack, STACKSIZE,
|
||||
(k_thread_entry_t)thread_two, NULL, NULL, NULL,
|
||||
thread_two, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(6), 0, K_NO_WAIT);
|
||||
|
||||
end = bench_test_end();
|
||||
|
|
|
@ -60,14 +60,18 @@ static void worker(struct k_work *item)
|
|||
*
|
||||
* @return 0 on success
|
||||
*/
|
||||
void int_thread(void)
|
||||
void int_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
k_sem_take(&INTSEMA, K_FOREVER);
|
||||
irq_offload(latency_test_isr, NULL);
|
||||
k_thread_suspend(k_current_get());
|
||||
}
|
||||
|
||||
K_THREAD_DEFINE(int_thread_id, 512, (k_thread_entry_t)int_thread, NULL, NULL,
|
||||
K_THREAD_DEFINE(int_thread_id, 512, int_thread, NULL, NULL,
|
||||
NULL, 11, 0, 0);
|
||||
|
||||
/**
|
||||
|
|
|
@ -527,10 +527,16 @@ static K_SEM_DEFINE(caller, 0, 1);
|
|||
K_THREAD_STACK_DEFINE(spi_async_stack, STACK_SIZE);
|
||||
static int result = 1;
|
||||
|
||||
static void spi_async_call_cb(struct k_poll_event *evt,
|
||||
struct k_sem *caller_sem,
|
||||
void *unused)
|
||||
static void spi_async_call_cb(void *p1,
|
||||
void *p2,
|
||||
void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct k_poll_event *evt = p1;
|
||||
struct k_sem *caller_sem = p2;
|
||||
int ret;
|
||||
|
||||
LOG_DBG("Polling...");
|
||||
|
@ -636,7 +642,7 @@ ZTEST(spi_loopback, test_spi_loopback)
|
|||
#if (CONFIG_SPI_ASYNC)
|
||||
async_thread_id = k_thread_create(&async_thread,
|
||||
spi_async_stack, STACK_SIZE,
|
||||
(k_thread_entry_t)spi_async_call_cb,
|
||||
spi_async_call_cb,
|
||||
&async_evt, &caller, NULL,
|
||||
K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
#endif
|
||||
|
|
|
@ -46,8 +46,12 @@ static void event_ep_request(const struct device *dev, struct udc_event event)
|
|||
}
|
||||
}
|
||||
|
||||
static void test_udc_thread(const struct device *dev)
|
||||
static void test_udc_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
const struct device *dev = p1;
|
||||
struct udc_event event;
|
||||
|
||||
while (true) {
|
||||
|
@ -423,7 +427,7 @@ static void *test_udc_device_get(void)
|
|||
|
||||
k_thread_create(&test_udc_thread_data, test_udc_stack,
|
||||
K_KERNEL_STACK_SIZEOF(test_udc_stack),
|
||||
(k_thread_entry_t)test_udc_thread,
|
||||
test_udc_thread,
|
||||
(void *)dev, NULL, NULL,
|
||||
K_PRIO_COOP(9), 0, K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -48,15 +48,19 @@ ZTEST(ivshmem, test_ivshmem_plain)
|
|||
"registering handlers should not be supported");
|
||||
}
|
||||
|
||||
static void test_is_usermode(void)
|
||||
static void test_is_usermode(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
zassert_true(k_is_user_context(), "thread left in kernel mode");
|
||||
}
|
||||
|
||||
ZTEST(ivshmem, test_quit_kernel)
|
||||
{
|
||||
#ifdef CONFIG_USERSPACE
|
||||
k_thread_user_mode_enter((k_thread_entry_t)test_is_usermode,
|
||||
k_thread_user_mode_enter(test_is_usermode,
|
||||
NULL, NULL, NULL);
|
||||
#else
|
||||
ztest_test_skip();
|
||||
|
|
|
@ -393,6 +393,10 @@ ZTEST_USER(condvar_tests, test_multiple_condvar_wait_wake)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void cond_init_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_condvar_init(NULL);
|
||||
|
||||
|
@ -403,7 +407,7 @@ static void cond_init_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(condvar_tests, test_condvar_init_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&condvar_tid, stack_1, STACK_SIZE,
|
||||
(k_thread_entry_t)cond_init_null,
|
||||
cond_init_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(0),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -420,6 +424,10 @@ ZTEST_USER(condvar_tests, test_condvar_init_null)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void cond_signal_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_condvar_signal(NULL);
|
||||
|
||||
|
@ -429,6 +437,10 @@ static void cond_signal_null(void *p1, void *p2, void *p3)
|
|||
|
||||
static void cond_broadcast_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_condvar_broadcast(NULL);
|
||||
|
||||
|
@ -438,6 +450,10 @@ static void cond_broadcast_null(void *p1, void *p2, void *p3)
|
|||
|
||||
static void cond_wait_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_condvar_wait(NULL, NULL, K_FOREVER);
|
||||
|
||||
|
@ -448,7 +464,7 @@ static void cond_wait_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(condvar_tests, test_condvar_signal_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&condvar_tid, stack_1, STACK_SIZE,
|
||||
(k_thread_entry_t)cond_signal_null,
|
||||
cond_signal_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(0),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -457,7 +473,7 @@ ZTEST_USER(condvar_tests, test_condvar_signal_null)
|
|||
ZTEST_USER(condvar_tests, test_condvar_broadcast_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&condvar_tid, stack_1, STACK_SIZE,
|
||||
(k_thread_entry_t)cond_broadcast_null,
|
||||
cond_broadcast_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(0),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -467,7 +483,7 @@ ZTEST_USER(condvar_tests, test_condvar_broadcast_null)
|
|||
ZTEST_USER(condvar_tests, test_condvar_wait_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&condvar_tid, stack_1, STACK_SIZE,
|
||||
(k_thread_entry_t)cond_wait_null,
|
||||
cond_wait_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(0),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
|
|
@ -28,8 +28,12 @@ K_THREAD_STACK_DEFINE(usr_fp_thread_stack, STACKSIZE);
|
|||
|
||||
ZTEST_BMEM static volatile int test_ret = TC_PASS;
|
||||
|
||||
static void usr_fp_thread_entry_1(void)
|
||||
static void usr_fp_thread_entry_1(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
k_yield();
|
||||
}
|
||||
|
||||
|
@ -39,8 +43,12 @@ static void usr_fp_thread_entry_1(void)
|
|||
#define K_FLOAT_DISABLE_SYSCALL_RETVAL -ENOTSUP
|
||||
#endif
|
||||
|
||||
static void usr_fp_thread_entry_2(void)
|
||||
static void usr_fp_thread_entry_2(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
k_yield();
|
||||
|
||||
/* System call to disable FP mode */
|
||||
|
@ -65,7 +73,7 @@ ZTEST(k_float_disable, test_k_float_disable_common)
|
|||
* priority as the current thread.
|
||||
*/
|
||||
k_thread_create(&usr_fp_thread, usr_fp_thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)usr_fp_thread_entry_1, NULL, NULL, NULL,
|
||||
usr_fp_thread_entry_1, NULL, NULL, NULL,
|
||||
PRIORITY, K_USER | K_FP_OPTS,
|
||||
K_NO_WAIT);
|
||||
|
||||
|
@ -114,7 +122,7 @@ ZTEST(k_float_disable, test_k_float_disable_syscall)
|
|||
* FP mode.
|
||||
*/
|
||||
k_thread_create(&usr_fp_thread, usr_fp_thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)usr_fp_thread_entry_2, NULL, NULL, NULL,
|
||||
usr_fp_thread_entry_2, NULL, NULL, NULL,
|
||||
PRIORITY, K_INHERIT_PERMS | K_USER | K_FP_OPTS,
|
||||
K_NO_WAIT);
|
||||
|
||||
|
@ -171,8 +179,12 @@ void arm_test_isr_handler(const void *args)
|
|||
}
|
||||
}
|
||||
|
||||
static void sup_fp_thread_entry(void)
|
||||
static void sup_fp_thread_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
/* Verify K_FP_REGS flag is set */
|
||||
if ((sup_fp_thread.base.user_options & K_FP_REGS) == 0) {
|
||||
|
||||
|
@ -249,7 +261,7 @@ ZTEST(k_float_disable, test_k_float_disable_irq)
|
|||
* priority as the current thread.
|
||||
*/
|
||||
k_thread_create(&sup_fp_thread, sup_fp_thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)sup_fp_thread_entry, NULL, NULL, NULL,
|
||||
sup_fp_thread_entry, NULL, NULL, NULL,
|
||||
PRIORITY, K_FP_REGS,
|
||||
K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -135,6 +135,10 @@ static void trigger_offload_interrupt(const bool real_irq, void *work)
|
|||
|
||||
static void t_running(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
k_sem_give(&sync_sem);
|
||||
|
||||
while (wait_for_end == false) {
|
||||
|
@ -189,7 +193,7 @@ static void run_test_offload(int case_type, int real_irq)
|
|||
}
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)t_running,
|
||||
t_running,
|
||||
NULL, NULL, NULL, thread_prio,
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -1084,6 +1084,10 @@ ZTEST(mem_protect_kobj, test_mark_thread_exit_uninitialized)
|
|||
|
||||
static void tThread_object_free_error(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
/* a K_ERR_CPU_EXCEPTION expected */
|
||||
set_fault_valid(true);
|
||||
k_object_free(NULL);
|
||||
|
@ -1108,7 +1112,7 @@ ZTEST(mem_protect_kobj, test_kobject_free_error)
|
|||
|
||||
k_tid_t tid = k_thread_create(&child_thread, child_stack,
|
||||
K_THREAD_STACK_SIZEOF(child_stack),
|
||||
(k_thread_entry_t)&tThread_object_free_error,
|
||||
tThread_object_free_error,
|
||||
(void *)&tid, NULL, NULL,
|
||||
K_PRIO_PREEMPT(1), perm, K_NO_WAIT);
|
||||
|
||||
|
@ -1325,6 +1329,9 @@ struct k_condvar condvar;
|
|||
|
||||
static void entry_error_perm(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
set_fault_valid(true);
|
||||
k_object_access_grant(p1, k_current_get());
|
||||
}
|
||||
|
@ -1364,7 +1371,7 @@ ZTEST(mem_protect_kobj, test_kobject_perm_error)
|
|||
|
||||
k_tid_t tid = k_thread_create(&child_thread, child_stack,
|
||||
K_THREAD_STACK_SIZEOF(child_stack),
|
||||
(k_thread_entry_t)entry_error_perm,
|
||||
entry_error_perm,
|
||||
kobj[i], NULL, NULL,
|
||||
1, K_USER, K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -24,8 +24,12 @@ volatile unsigned int changed;
|
|||
#pragma GCC diagnostic ignored "-Wdangling-pointer"
|
||||
#endif
|
||||
|
||||
void alternate_thread(void)
|
||||
void alternate_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int i;
|
||||
void *sp_val;
|
||||
|
||||
|
@ -68,7 +72,7 @@ ZTEST(stack_pointer_randomness, test_stack_pt_randomization)
|
|||
/* Start thread */
|
||||
for (i = 0; i < THREAD_COUNT; i++) {
|
||||
k_thread_create(&alt_thread_data, alt_thread_stack_area,
|
||||
STACKSIZE, (k_thread_entry_t)alternate_thread,
|
||||
STACKSIZE, alternate_thread,
|
||||
NULL, NULL, NULL, K_HIGHEST_THREAD_PRIO, 0,
|
||||
K_NO_WAIT);
|
||||
k_sleep(K_MSEC(10));
|
||||
|
|
|
@ -129,7 +129,7 @@ ZTEST(stackprot, test_create_alt_thread)
|
|||
{
|
||||
/* Start thread */
|
||||
k_thread_create(&alt_thread_data, alt_thread_stack_area, STACKSIZE,
|
||||
(k_thread_entry_t)alternate_thread, NULL, NULL, NULL,
|
||||
alternate_thread, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(1), K_USER, K_NO_WAIT);
|
||||
|
||||
/* Note that this sleep is required on SMP platforms where
|
||||
|
@ -152,6 +152,9 @@ extern volatile uintptr_t __stack_chk_guard;
|
|||
*/
|
||||
void alternate_thread_canary(void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
ARG_UNUSED(arg2);
|
||||
ARG_UNUSED(arg3);
|
||||
|
||||
TC_PRINT("Starts %s\n", __func__);
|
||||
|
||||
#ifdef CONFIG_STACK_CANARIES_TLS
|
||||
|
@ -173,7 +176,7 @@ ZTEST(stackprot, test_canary_value)
|
|||
{
|
||||
/* Start thread */
|
||||
k_thread_create(&alt_thread_data, alt_thread_stack_area, STACKSIZE,
|
||||
(k_thread_entry_t)alternate_thread_canary,
|
||||
alternate_thread_canary,
|
||||
(void *)__stack_chk_guard, NULL, NULL,
|
||||
K_PRIO_COOP(1), K_USER, K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -451,8 +451,11 @@ ZTEST_USER(userspace, test_pass_noperms_object)
|
|||
}
|
||||
|
||||
|
||||
void thread_body(void)
|
||||
void thread_body(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -465,7 +468,7 @@ ZTEST_USER(userspace, test_start_kernel_thread)
|
|||
/* Try to start a kernel thread from a usermode thread */
|
||||
set_fault(K_ERR_KERNEL_OOPS);
|
||||
k_thread_create(&test_thread, test_stack, STACKSIZE,
|
||||
(k_thread_entry_t)thread_body, NULL, NULL, NULL,
|
||||
thread_body, NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(1), K_INHERIT_PERMS,
|
||||
K_NO_WAIT);
|
||||
zassert_unreachable("Create a kernel thread did not fault");
|
||||
|
@ -568,8 +571,12 @@ ZTEST_USER(userspace, test_access_after_revoke)
|
|||
zassert_unreachable("Using revoked object did not fault");
|
||||
}
|
||||
|
||||
static void umode_enter_func(void)
|
||||
static void umode_enter_func(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
zassert_true(k_is_user_context(),
|
||||
"Thread did not enter user mode");
|
||||
}
|
||||
|
@ -586,7 +593,7 @@ ZTEST(userspace, test_user_mode_enter)
|
|||
{
|
||||
clear_fault();
|
||||
|
||||
k_thread_user_mode_enter((k_thread_entry_t)umode_enter_func,
|
||||
k_thread_user_mode_enter(umode_enter_func,
|
||||
NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,8 @@ static void tmutex_test_lock_unlock(struct k_mutex *pmutex)
|
|||
|
||||
static void tThread_T1_priority_inheritance(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
/* t1 will get mutex first */
|
||||
zassert_true(k_mutex_lock((struct k_mutex *)p1, K_FOREVER) == 0,
|
||||
"access locked resource from spawn thread T1");
|
||||
|
@ -150,6 +152,9 @@ static void tThread_T1_priority_inheritance(void *p1, void *p2, void *p3)
|
|||
|
||||
static void tThread_T2_priority_inheritance(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
if (case_type == 1) {
|
||||
zassert_true(k_mutex_lock((struct k_mutex *)p1, K_FOREVER) == 0,
|
||||
"access locked resource from spawn thread T2");
|
||||
|
@ -166,6 +171,9 @@ static void tThread_T2_priority_inheritance(void *p1, void *p2, void *p3)
|
|||
|
||||
static void tThread_lock_with_time_period(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
zassert_true(k_mutex_lock((struct k_mutex *)p1, K_FOREVER) == 0,
|
||||
"access locked resource from spawn thread");
|
||||
|
||||
|
@ -177,6 +185,9 @@ static void tThread_lock_with_time_period(void *p1, void *p2, void *p3)
|
|||
|
||||
static void tThread_waiter(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
/* This thread participates in recursive locking tests */
|
||||
/* Wait for mutex to be released */
|
||||
zassert_true(k_mutex_lock((struct k_mutex *)p1, K_FOREVER) == 0,
|
||||
|
@ -261,7 +272,7 @@ ZTEST_USER(mutex_api, test_mutex_recursive)
|
|||
thread_ret = TC_FAIL;
|
||||
/* Spawn a waiter thread */
|
||||
k_thread_create(&tdata3, tstack3, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_waiter, &tmutex, NULL, NULL,
|
||||
tThread_waiter, &tmutex, NULL, NULL,
|
||||
K_PRIO_PREEMPT(12),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
||||
|
@ -305,7 +316,7 @@ ZTEST_USER(mutex_api_1cpu, test_mutex_priority_inheritance)
|
|||
|
||||
/* spawn a lower priority thread t1 for holding the mutex */
|
||||
k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_T1_priority_inheritance,
|
||||
tThread_T1_priority_inheritance,
|
||||
&tmutex, &tdata, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_LOW_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -319,7 +330,7 @@ ZTEST_USER(mutex_api_1cpu, test_mutex_priority_inheritance)
|
|||
|
||||
/* spawn a higher priority thread t2 for holding the mutex */
|
||||
k_thread_create(&tdata2, tstack2, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_T2_priority_inheritance,
|
||||
tThread_T2_priority_inheritance,
|
||||
&tmutex, &tdata2, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_HIGH_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -335,7 +346,7 @@ ZTEST_USER(mutex_api_1cpu, test_mutex_priority_inheritance)
|
|||
|
||||
/* spawn a lower priority thread t1 for holding the mutex */
|
||||
k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_T1_priority_inheritance,
|
||||
tThread_T1_priority_inheritance,
|
||||
&tmutex, &tdata, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_HIGH_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -345,7 +356,7 @@ ZTEST_USER(mutex_api_1cpu, test_mutex_priority_inheritance)
|
|||
|
||||
/* spawn a higher priority thread t2 for holding the mutex */
|
||||
k_thread_create(&tdata2, tstack2, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_T2_priority_inheritance,
|
||||
tThread_T2_priority_inheritance,
|
||||
&tmutex, &tdata2, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_LOW_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -361,7 +372,7 @@ ZTEST_USER(mutex_api_1cpu, test_mutex_priority_inheritance)
|
|||
|
||||
/* spawn a lower priority thread t1 for holding the mutex */
|
||||
k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_T1_priority_inheritance,
|
||||
tThread_T1_priority_inheritance,
|
||||
&tmutex, &tdata, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_LOW_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -371,14 +382,14 @@ ZTEST_USER(mutex_api_1cpu, test_mutex_priority_inheritance)
|
|||
|
||||
/* spawn a higher priority thread t2 for holding the mutex */
|
||||
k_thread_create(&tdata2, tstack2, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_T2_priority_inheritance,
|
||||
tThread_T2_priority_inheritance,
|
||||
&tmutex, &tdata2, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_HIGH_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
||||
/* spawn a higher priority thread t3 for holding the mutex */
|
||||
k_thread_create(&tdata3, tstack3, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_lock_with_time_period,
|
||||
tThread_lock_with_time_period,
|
||||
&tmutex, &tdata3, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_MID_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
|
|
@ -47,6 +47,9 @@ void ztest_post_fatal_error_hook(unsigned int reason,
|
|||
|
||||
static void tThread_entry_negative(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int choice = *((int *)p2);
|
||||
|
||||
TC_PRINT("current case is %d\n", choice);
|
||||
|
@ -102,7 +105,7 @@ static int create_negative_test_thread(int choice)
|
|||
case_type = choice;
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_entry_negative,
|
||||
tThread_entry_negative,
|
||||
&mutex, (void *)&case_type, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
perm, K_NO_WAIT);
|
||||
|
|
|
@ -88,7 +88,7 @@ static ZTEST_BMEM SYS_MUTEX_DEFINE(bad_count_mutex);
|
|||
#define CREATE_PARTICIPANT_THREAD(id, pri) \
|
||||
k_thread_create(&thread_##id##_thread_data, thread_##id##_stack_area, \
|
||||
K_THREAD_STACK_SIZEOF(thread_##id##_stack_area), \
|
||||
(k_thread_entry_t)thread_##id, \
|
||||
thread_##id, \
|
||||
NULL, NULL, NULL, \
|
||||
pri, PARTICIPANT_THREAD_OPTIONS, K_FOREVER);
|
||||
#define START_PARTICIPANT_THREAD(id) k_thread_start(&(thread_##id##_thread_data));
|
||||
|
@ -395,7 +395,7 @@ ZTEST_USER_OR_NOT(mutex_complex, test_mutex)
|
|||
|
||||
/* Start thread */
|
||||
k_thread_create(&thread_12_thread_data, thread_12_stack_area, STACKSIZE,
|
||||
(k_thread_entry_t)thread_12, NULL, NULL, NULL,
|
||||
thread_12, NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(12), PARTICIPANT_THREAD_OPTIONS, K_NO_WAIT);
|
||||
k_sleep(K_MSEC(5)); /* Give thread_12 a chance to block on the mutex */
|
||||
|
||||
|
|
|
@ -29,8 +29,12 @@ extern struct sys_mutex private_mutex;
|
|||
*
|
||||
*/
|
||||
|
||||
void thread_12(void)
|
||||
void thread_12(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int rv;
|
||||
|
||||
/* Wait for private mutex to be released */
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#define CREATE_PARTICIPANT_THREAD(id, pri, entry) \
|
||||
k_thread_create(&thread_##id##_thread_data, thread_##id##_stack_area, \
|
||||
K_THREAD_STACK_SIZEOF(thread_##id##_stack_area), \
|
||||
(k_thread_entry_t)entry, \
|
||||
entry, \
|
||||
NULL, NULL, NULL, \
|
||||
pri, PARTICIPANT_THREAD_OPTIONS, K_FOREVER);
|
||||
#define START_PARTICIPANT_THREAD(id) k_thread_start(&(thread_##id##_thread_data));
|
||||
|
|
|
@ -189,6 +189,10 @@ ZTEST(threads_scheduling, test_sleep_wakeup_preemptible)
|
|||
static int executed;
|
||||
static void coop_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
k_sem_take(&pend_sema, K_MSEC(100));
|
||||
executed = 1;
|
||||
}
|
||||
|
@ -211,7 +215,7 @@ ZTEST(threads_scheduling, test_pending_thread_wakeup)
|
|||
|
||||
/* Create a thread which waits for semaphore */
|
||||
k_tid_t tid = k_thread_create(&t, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)coop_thread,
|
||||
coop_thread,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_COOP(1), 0, K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -96,6 +96,10 @@ ZTEST_USER(threads_scheduling, test_user_k_is_preempt)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_suspend_init_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_thread_suspend(NULL);
|
||||
|
||||
|
@ -116,7 +120,7 @@ static void thread_suspend_init_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(threads_scheduling, test_k_thread_suspend_init_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&user_thread, ustack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_suspend_init_null,
|
||||
thread_suspend_init_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -133,6 +137,10 @@ ZTEST_USER(threads_scheduling, test_k_thread_suspend_init_null)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_resume_init_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_thread_resume(NULL);
|
||||
|
||||
|
@ -153,7 +161,7 @@ static void thread_resume_init_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(threads_scheduling, test_k_thread_resume_init_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&user_thread, ustack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_resume_init_null,
|
||||
thread_resume_init_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -170,6 +178,10 @@ ZTEST_USER(threads_scheduling, test_k_thread_resume_init_null)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_priority_get_init_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_thread_priority_get(NULL);
|
||||
|
||||
|
@ -190,7 +202,7 @@ static void thread_priority_get_init_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(threads_scheduling, test_k_thread_priority_get_init_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&user_thread, ustack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_priority_get_init_null,
|
||||
thread_priority_get_init_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -207,6 +219,10 @@ ZTEST_USER(threads_scheduling, test_k_thread_priority_get_init_null)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_priority_set_init_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_thread_priority_set(NULL, 0);
|
||||
|
||||
|
@ -227,7 +243,7 @@ static void thread_priority_set_init_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(threads_scheduling, test_k_thread_priority_set_init_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&user_thread, ustack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_priority_set_init_null,
|
||||
thread_priority_set_init_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -244,6 +260,10 @@ ZTEST_USER(threads_scheduling, test_k_thread_priority_set_init_null)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_priority_set_overmax(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
|
||||
/* set valid priority value outside the priority range will invoke fatal error */
|
||||
|
@ -265,7 +285,7 @@ static void thread_priority_set_overmax(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(threads_scheduling, test_k_thread_priority_set_overmax)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&user_thread, ustack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_priority_set_overmax,
|
||||
thread_priority_set_overmax,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -282,6 +302,10 @@ ZTEST_USER(threads_scheduling, test_k_thread_priority_set_overmax)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_priority_set_upgrade(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
|
||||
/* at first, set an valid priority */
|
||||
|
@ -305,7 +329,7 @@ static void thread_priority_set_upgrade(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(threads_scheduling, test_k_thread_priority_set_upgrade)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&user_thread, ustack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_priority_set_upgrade,
|
||||
thread_priority_set_upgrade,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -322,6 +346,10 @@ ZTEST_USER(threads_scheduling, test_k_thread_priority_set_upgrade)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_wakeup_init_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_wakeup(NULL);
|
||||
|
||||
|
@ -342,7 +370,7 @@ static void thread_wakeup_init_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(threads_scheduling, test_k_wakeup_init_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&user_thread, ustack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_wakeup_init_null,
|
||||
thread_wakeup_init_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
|
|
@ -1150,6 +1150,10 @@ ZTEST(semaphore_1cpu, test_sem_queue_mutual_exclusion)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_sem_give_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_sem_give(NULL);
|
||||
|
||||
|
@ -1169,7 +1173,7 @@ static void thread_sem_give_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(semaphore_null_case, test_sem_give_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_sem_give_null,
|
||||
thread_sem_give_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -1181,6 +1185,10 @@ ZTEST_USER(semaphore_null_case, test_sem_give_null)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_sem_init_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_sem_init(NULL, 0, 1);
|
||||
|
||||
|
@ -1200,7 +1208,7 @@ static void thread_sem_init_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(semaphore_null_case, test_sem_init_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_sem_init_null,
|
||||
thread_sem_init_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -1212,6 +1220,10 @@ ZTEST_USER(semaphore_null_case, test_sem_init_null)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_sem_take_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_sem_take(NULL, K_MSEC(1));
|
||||
|
||||
|
@ -1231,7 +1243,7 @@ static void thread_sem_take_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(semaphore_null_case, test_sem_take_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_sem_take_null,
|
||||
thread_sem_take_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -1243,6 +1255,10 @@ ZTEST_USER(semaphore_null_case, test_sem_take_null)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_sem_reset_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_sem_reset(NULL);
|
||||
|
||||
|
@ -1262,7 +1278,7 @@ static void thread_sem_reset_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(semaphore_null_case, test_sem_reset_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_sem_reset_null,
|
||||
thread_sem_reset_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -1274,6 +1290,10 @@ ZTEST_USER(semaphore_null_case, test_sem_reset_null)
|
|||
#ifdef CONFIG_USERSPACE
|
||||
static void thread_sem_count_get_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_sem_count_get(NULL);
|
||||
|
||||
|
@ -1293,7 +1313,7 @@ static void thread_sem_count_get_null(void *p1, void *p2, void *p3)
|
|||
ZTEST_USER(semaphore_null_case, test_sem_count_get_null)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_sem_count_get_null,
|
||||
thread_sem_count_get_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
|
|
@ -100,8 +100,12 @@ static int sleep_time_valid(uint32_t start, uint32_t end, uint32_t dur)
|
|||
return dt >= dur && dt <= (dur + TICK_MARGIN);
|
||||
}
|
||||
|
||||
static void test_thread(int arg1, int arg2)
|
||||
static void test_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int arg1 = POINTER_TO_INT(p1);
|
||||
int arg2 = POINTER_TO_INT(p2);
|
||||
uint32_t start_tick;
|
||||
uint32_t end_tick;
|
||||
|
||||
|
@ -171,8 +175,12 @@ static void irq_offload_isr(const void *arg)
|
|||
k_wakeup((k_tid_t) arg);
|
||||
}
|
||||
|
||||
static void helper_thread(int arg1, int arg2)
|
||||
static void helper_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int arg1 = POINTER_TO_INT(p1);
|
||||
int arg2 = POINTER_TO_INT(p2);
|
||||
|
||||
k_sem_take(&helper_thread_sem, K_FOREVER);
|
||||
/* Wake the test thread */
|
||||
|
@ -205,7 +213,7 @@ ZTEST(sleep, test_sleep)
|
|||
|
||||
test_thread_id = k_thread_create(&test_thread_data, test_thread_stack,
|
||||
THREAD_STACK,
|
||||
(k_thread_entry_t) test_thread,
|
||||
test_thread,
|
||||
0, 0, NULL, TEST_THREAD_PRIORITY,
|
||||
0, K_NO_WAIT);
|
||||
|
||||
|
@ -213,7 +221,7 @@ ZTEST(sleep, test_sleep)
|
|||
|
||||
helper_thread_id = k_thread_create(&helper_thread_data,
|
||||
helper_thread_stack, THREAD_STACK,
|
||||
(k_thread_entry_t) helper_thread,
|
||||
helper_thread,
|
||||
0, 0, NULL, HELPER_THREAD_PRIORITY,
|
||||
0, K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -575,6 +575,10 @@ ZTEST(smp, test_wakeup_threads)
|
|||
/* a thread for testing get current cpu */
|
||||
static void thread_get_cpu_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int bsp_id = *(int *)p1;
|
||||
int cpu_id = -1;
|
||||
|
||||
|
@ -660,7 +664,7 @@ ZTEST(smp, test_get_cpu)
|
|||
_cpu_id = arch_curr_cpu()->id;
|
||||
|
||||
thread_id = k_thread_create(&t2, t2_stack, T2_STACK_SIZE,
|
||||
(k_thread_entry_t)thread_get_cpu_entry,
|
||||
thread_get_cpu_entry,
|
||||
&_cpu_id, NULL, NULL,
|
||||
K_PRIO_COOP(2),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -849,6 +853,9 @@ ZTEST(smp, test_workq_on_smp)
|
|||
|
||||
static void t1_mutex_lock(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
/* t1 will get mutex first */
|
||||
k_mutex_lock((struct k_mutex *)p1, K_FOREVER);
|
||||
|
||||
|
@ -859,6 +866,9 @@ static void t1_mutex_lock(void *p1, void *p2, void *p3)
|
|||
|
||||
static void t2_mutex_lock(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
zassert_equal(_current->base.global_lock_count, 0,
|
||||
"thread global lock cnt %d is incorrect",
|
||||
_current->base.global_lock_count);
|
||||
|
@ -894,14 +904,14 @@ ZTEST(smp, test_smp_release_global_lock)
|
|||
|
||||
tinfo[0].tid =
|
||||
k_thread_create(&tthread[0], tstack[0], STACK_SIZE,
|
||||
(k_thread_entry_t)t1_mutex_lock,
|
||||
t1_mutex_lock,
|
||||
&smutex, NULL, NULL,
|
||||
K_PRIO_PREEMPT(5),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
||||
tinfo[1].tid =
|
||||
k_thread_create(&tthread[1], tstack[1], STACK_SIZE,
|
||||
(k_thread_entry_t)t2_mutex_lock,
|
||||
t2_mutex_lock,
|
||||
&smutex, NULL, NULL,
|
||||
K_PRIO_PREEMPT(3),
|
||||
K_INHERIT_PERMS, K_MSEC(1));
|
||||
|
@ -1004,8 +1014,12 @@ static void inc_global_cnt(void *a, void *b, void *c)
|
|||
}
|
||||
}
|
||||
|
||||
static int run_concurrency(int type, void *func)
|
||||
static int run_concurrency(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int type = POINTER_TO_INT(p1);
|
||||
k_thread_entry_t func = p2;
|
||||
uint32_t start_t, end_t;
|
||||
|
||||
sync_init(type);
|
||||
|
@ -1014,21 +1028,21 @@ static int run_concurrency(int type, void *func)
|
|||
|
||||
tinfo[0].tid =
|
||||
k_thread_create(&tthread[0], tstack[0], STACK_SIZE,
|
||||
(k_thread_entry_t)func,
|
||||
func,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(1),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
||||
tinfo[1].tid =
|
||||
k_thread_create(&tthread[1], tstack[1], STACK_SIZE,
|
||||
(k_thread_entry_t)func,
|
||||
func,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(1),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
||||
k_tid_t tid =
|
||||
k_thread_create(&t2, t2_stack, T2_STACK_SIZE,
|
||||
(k_thread_entry_t)func,
|
||||
func,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(1),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -1087,6 +1101,9 @@ ZTEST(smp, test_inc_concurrency)
|
|||
*/
|
||||
static void process_events(void *arg0, void *arg1, void *arg2)
|
||||
{
|
||||
ARG_UNUSED(arg1);
|
||||
ARG_UNUSED(arg2);
|
||||
|
||||
uintptr_t id = (uintptr_t) arg0;
|
||||
|
||||
while (1) {
|
||||
|
@ -1137,7 +1154,7 @@ ZTEST(smp, test_smp_switch_torture)
|
|||
K_POLL_MODE_NOTIFY_ONLY, &tsignal[i]);
|
||||
|
||||
k_thread_create(&tthread[i], tstack[i], STACK_SIZE,
|
||||
(k_thread_entry_t) process_events,
|
||||
process_events,
|
||||
(void *) i, NULL, NULL, K_PRIO_PREEMPT(i + 1),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ static void enter_user_mode_entry(void *p1, void *p2, void *p3)
|
|||
zassert_true(z_is_thread_essential(), "Thread isn't set"
|
||||
" as essential\n");
|
||||
|
||||
k_thread_user_mode_enter((k_thread_entry_t)umode_entry,
|
||||
k_thread_user_mode_enter(umode_entry,
|
||||
k_current_get(), NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@ static bool fatal_error_signaled;
|
|||
|
||||
static void thread_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
z_thread_essential_set();
|
||||
|
||||
if (z_is_thread_essential()) {
|
||||
|
@ -47,7 +51,7 @@ static void thread_entry(void *p1, void *p2, void *p3)
|
|||
ZTEST(threads_lifecycle, test_essential_thread_operation)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&kthread_thread, kthread_stack,
|
||||
STACKSIZE, (k_thread_entry_t)thread_entry, NULL,
|
||||
STACKSIZE, thread_entry, NULL,
|
||||
NULL, NULL, K_PRIO_PREEMPT(0), 0,
|
||||
K_NO_WAIT);
|
||||
|
||||
|
@ -68,6 +72,10 @@ void k_sys_fatal_error_handler(unsigned int reason,
|
|||
|
||||
static void abort_thread_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
z_thread_essential_set();
|
||||
|
||||
if (z_is_thread_essential()) {
|
||||
|
@ -94,7 +102,7 @@ static void abort_thread_entry(void *p1, void *p2, void *p3)
|
|||
ZTEST(threads_lifecycle, test_essential_thread_abort)
|
||||
{
|
||||
k_tid_t tid = k_thread_create(&kthread_thread1, kthread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)abort_thread_entry,
|
||||
abort_thread_entry,
|
||||
NULL, NULL, NULL, K_PRIO_PREEMPT(0), 0,
|
||||
K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -24,6 +24,10 @@ K_THREAD_STACK_DEFINE(tstack1, STACK_SIZE);
|
|||
|
||||
static void thread_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
k_msleep(SLEEP_MS);
|
||||
}
|
||||
|
||||
|
@ -48,7 +52,7 @@ void thread_callback_unlocked(const struct k_thread *thread, void *user_data)
|
|||
if (create_thread) {
|
||||
in_callback_tid = k_thread_create(&tdata1, tstack1,
|
||||
STACK_SIZE,
|
||||
(k_thread_entry_t)thread_entry,
|
||||
thread_entry,
|
||||
NULL, NULL, NULL, K_PRIO_PREEMPT(0),
|
||||
0, K_NO_WAIT);
|
||||
create_thread = false;
|
||||
|
@ -98,7 +102,7 @@ ZTEST(threads_lifecycle_1cpu, test_k_thread_foreach)
|
|||
|
||||
/* Create new thread which should add a new entry to the thread list */
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack,
|
||||
STACK_SIZE, (k_thread_entry_t)thread_entry, NULL,
|
||||
STACK_SIZE, thread_entry, NULL,
|
||||
NULL, NULL, K_PRIO_PREEMPT(0), 0, K_NO_WAIT);
|
||||
k_msleep(1);
|
||||
|
||||
|
@ -147,7 +151,7 @@ ZTEST(threads_lifecycle_1cpu, test_k_thread_foreach_unlocked)
|
|||
|
||||
/* Create new thread which should add a new entry to the thread list */
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack,
|
||||
STACK_SIZE, (k_thread_entry_t)thread_entry, NULL,
|
||||
STACK_SIZE, thread_entry, NULL,
|
||||
NULL, NULL, K_PRIO_PREEMPT(0), 0, K_NO_WAIT);
|
||||
k_msleep(1);
|
||||
|
||||
|
|
|
@ -110,6 +110,10 @@ void *block;
|
|||
|
||||
static void delayed_thread_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
execute_flag = 1;
|
||||
|
||||
zassert_unreachable("Delayed thread shouldn't be executed");
|
||||
|
@ -134,7 +138,7 @@ ZTEST(threads_lifecycle_1cpu, test_delayed_thread_abort)
|
|||
* current thread
|
||||
*/
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)delayed_thread_entry, NULL, NULL, NULL,
|
||||
delayed_thread_entry, NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(1), 0, K_MSEC(100));
|
||||
|
||||
/* Give up CPU */
|
||||
|
|
|
@ -18,8 +18,12 @@ K_SEM_DEFINE(sem_thread1, 0, 1);
|
|||
* @brief thread2 portion to test setting the priority
|
||||
*
|
||||
*/
|
||||
void thread2_set_prio_test(void)
|
||||
void thread2_set_prio_test(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
/* lower thread2 priority by 5 */
|
||||
k_sem_take(&sem_thread2, K_FOREVER);
|
||||
thread2_data = k_thread_priority_get(k_current_get());
|
||||
|
@ -72,7 +76,7 @@ ZTEST(threads_lifecycle, test_threads_priority_set)
|
|||
int thread2_prio = prio + 1;
|
||||
|
||||
k_tid_t thread2_id = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread2_set_prio_test,
|
||||
thread2_set_prio_test,
|
||||
NULL, NULL, NULL, thread2_prio, 0,
|
||||
K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ static void test_thread(void *p1, void *p2, void *p3)
|
|||
|
||||
static void tThread_entry_negative(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int choice = *((int *)p1);
|
||||
uint32_t perm = K_INHERIT_PERMS;
|
||||
|
||||
|
@ -114,7 +117,7 @@ static void create_negative_test_thread(int choice)
|
|||
case_type = choice;
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_entry_negative,
|
||||
tThread_entry_negative,
|
||||
(void *)&case_type, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
perm, K_NO_WAIT);
|
||||
|
|
|
@ -22,6 +22,10 @@ static K_THREAD_STACK_DEFINE(tstack, STACK_SIZE);
|
|||
|
||||
static void thread_timer_start_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_timer_start(NULL, K_MSEC(DURATION), K_NO_WAIT);
|
||||
|
||||
|
@ -47,7 +51,7 @@ ZTEST_USER(timer_api_error, test_timer_start_null)
|
|||
#endif
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_timer_start_null,
|
||||
thread_timer_start_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -57,6 +61,10 @@ ZTEST_USER(timer_api_error, test_timer_start_null)
|
|||
|
||||
static void thread_timer_stop_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_timer_stop(NULL);
|
||||
|
||||
|
@ -81,7 +89,7 @@ ZTEST_USER(timer_api_error, test_timer_stop_null)
|
|||
#endif
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_timer_stop_null,
|
||||
thread_timer_stop_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -91,6 +99,10 @@ ZTEST_USER(timer_api_error, test_timer_stop_null)
|
|||
|
||||
static void thread_timer_status_get_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_timer_status_get(NULL);
|
||||
|
||||
|
@ -115,7 +127,7 @@ ZTEST_USER(timer_api_error, test_timer_status_get_null)
|
|||
#endif
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_timer_status_get_null,
|
||||
thread_timer_status_get_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -125,6 +137,10 @@ ZTEST_USER(timer_api_error, test_timer_status_get_null)
|
|||
|
||||
static void thread_timer_status_sync_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_timer_status_sync(NULL);
|
||||
|
||||
|
@ -149,7 +165,7 @@ ZTEST_USER(timer_api_error, test_timer_status_sync_null)
|
|||
#endif
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_timer_status_sync_null,
|
||||
thread_timer_status_sync_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -159,6 +175,10 @@ ZTEST_USER(timer_api_error, test_timer_status_sync_null)
|
|||
|
||||
static void thread_timer_remaining_ticks_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_timer_remaining_ticks(NULL);
|
||||
|
||||
|
@ -183,7 +203,7 @@ ZTEST_USER(timer_api_error, test_timer_remaining_ticks_null)
|
|||
#endif
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_timer_remaining_ticks_null,
|
||||
thread_timer_remaining_ticks_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -193,6 +213,10 @@ ZTEST_USER(timer_api_error, test_timer_remaining_ticks_null)
|
|||
|
||||
static void thread_timer_expires_ticks_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_timer_expires_ticks(NULL);
|
||||
|
||||
|
@ -216,7 +240,7 @@ ZTEST_USER(timer_api_error, test_timer_expires_ticks_null)
|
|||
ztest_test_skip();
|
||||
#endif
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_timer_expires_ticks_null,
|
||||
thread_timer_expires_ticks_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -226,6 +250,10 @@ ZTEST_USER(timer_api_error, test_timer_expires_ticks_null)
|
|||
|
||||
static void thread_timer_user_data_get_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
k_timer_user_data_get(NULL);
|
||||
|
||||
|
@ -249,7 +277,7 @@ ZTEST_USER(timer_api_error, test_timer_user_data_get_null)
|
|||
ztest_test_skip();
|
||||
#endif
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_timer_user_data_get_null,
|
||||
thread_timer_user_data_get_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -259,6 +287,10 @@ ZTEST_USER(timer_api_error, test_timer_user_data_get_null)
|
|||
|
||||
static void thread_timer_user_data_set_null(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int user_data = 1;
|
||||
|
||||
ztest_set_fault_valid(true);
|
||||
|
@ -285,7 +317,7 @@ ZTEST_USER(timer_api_error, test_timer_user_data_set_null)
|
|||
#endif
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)thread_timer_user_data_set_null,
|
||||
thread_timer_user_data_set_null,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
K_USER | K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
|
|
@ -124,12 +124,13 @@ static void reset_results(void)
|
|||
num_results = 0;
|
||||
}
|
||||
|
||||
static void coop_work_main(int arg1, int arg2)
|
||||
static void coop_work_main(void *p1, void *p2, void *p3)
|
||||
{
|
||||
int i;
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ARG_UNUSED(arg1);
|
||||
ARG_UNUSED(arg2);
|
||||
int i;
|
||||
|
||||
/* Let the preempt thread submit the first work item. */
|
||||
k_msleep(SUBMIT_WAIT / 2);
|
||||
|
@ -150,7 +151,7 @@ static void delayed_test_items_submit(void)
|
|||
int i;
|
||||
|
||||
k_thread_create(&co_op_data, co_op_stack, STACK_SIZE,
|
||||
(k_thread_entry_t)coop_work_main,
|
||||
coop_work_main,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(10), 0, K_NO_WAIT);
|
||||
|
||||
for (i = 0; i < NUM_TEST_ITEMS; i += 2) {
|
||||
|
@ -271,12 +272,13 @@ static void test_delayed_init(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void coop_delayed_work_main(int arg1, int arg2)
|
||||
static void coop_delayed_work_main(void *p1, void *p2, void *p3)
|
||||
{
|
||||
int i;
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
ARG_UNUSED(arg1);
|
||||
ARG_UNUSED(arg2);
|
||||
int i;
|
||||
|
||||
/* Let the preempt thread submit the first work item. */
|
||||
k_msleep(SUBMIT_WAIT / 2);
|
||||
|
@ -301,7 +303,7 @@ static void test_delayed_submit(void)
|
|||
int i;
|
||||
|
||||
k_thread_create(&co_op_data, co_op_stack, STACK_SIZE,
|
||||
(k_thread_entry_t)coop_delayed_work_main,
|
||||
coop_delayed_work_main,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(10), 0, K_NO_WAIT);
|
||||
|
||||
for (i = 0; i < NUM_TEST_ITEMS; i += 2) {
|
||||
|
@ -313,10 +315,11 @@ static void test_delayed_submit(void)
|
|||
|
||||
}
|
||||
|
||||
static void coop_delayed_work_cancel_main(int arg1, int arg2)
|
||||
static void coop_delayed_work_cancel_main(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(arg1);
|
||||
ARG_UNUSED(arg2);
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
k_work_schedule(&delayed_tests[1].work, K_MSEC(WORK_ITEM_WAIT));
|
||||
|
||||
|
@ -342,7 +345,7 @@ ZTEST(workqueue_delayed, test_delayed_cancel)
|
|||
k_work_cancel_delayable(&delayed_tests[0].work);
|
||||
|
||||
k_thread_create(&co_op_data, co_op_stack, STACK_SIZE,
|
||||
(k_thread_entry_t)coop_delayed_work_cancel_main,
|
||||
coop_delayed_work_cancel_main,
|
||||
NULL, NULL, NULL, K_HIGHEST_THREAD_PRIO, 0, K_NO_WAIT);
|
||||
|
||||
TC_PRINT(" - Waiting for work to finish\n");
|
||||
|
|
|
@ -133,9 +133,12 @@ ZTEST(fdtable, test_z_free_fd)
|
|||
zassert_equal_ptr(obj, NULL, "obj is not NULL after freeing");
|
||||
}
|
||||
|
||||
static void test_cb(void *fd_ptr)
|
||||
static void test_cb(void *p1, void *p2, void *p3)
|
||||
{
|
||||
int fd = POINTER_TO_INT(fd_ptr);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int fd = POINTER_TO_INT(p1);
|
||||
const struct fd_op_vtable *vtable;
|
||||
int *obj;
|
||||
|
||||
|
@ -163,7 +166,7 @@ ZTEST(fdtable, test_z_fd_multiple_access)
|
|||
|
||||
k_thread_create(&fd_thread, fd_thread_stack,
|
||||
K_THREAD_STACK_SIZEOF(fd_thread_stack),
|
||||
(k_thread_entry_t)test_cb,
|
||||
test_cb,
|
||||
INT_TO_POINTER(shared_fd), NULL, NULL,
|
||||
CONFIG_ZTEST_THREAD_PRIORITY, 0, K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -150,6 +150,8 @@ ZTEST(net_buf_tests, test_net_buf_2)
|
|||
|
||||
static void test_3_thread(void *arg1, void *arg2, void *arg3)
|
||||
{
|
||||
ARG_UNUSED(arg3);
|
||||
|
||||
struct k_fifo *fifo = (struct k_fifo *)arg1;
|
||||
struct k_sem *sema = (struct k_sem *)arg2;
|
||||
struct net_buf *buf;
|
||||
|
@ -192,7 +194,7 @@ ZTEST(net_buf_tests, test_net_buf_3)
|
|||
|
||||
k_thread_create(&test_3_thread_data, test_3_thread_stack,
|
||||
K_THREAD_STACK_SIZEOF(test_3_thread_stack),
|
||||
(k_thread_entry_t) test_3_thread, &fifo, &sema, NULL,
|
||||
test_3_thread, &fifo, &sema, NULL,
|
||||
K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
|
||||
zassert_true(k_sem_take(&sema, TEST_TIMEOUT) == 0,
|
||||
|
|
|
@ -789,10 +789,11 @@ static void recv_cb_timeout(struct net_context *context,
|
|||
net_pkt_unref(pkt);
|
||||
}
|
||||
|
||||
void timeout_thread(struct net_context *ctx, void *param2, void *param3)
|
||||
void timeout_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
int family = POINTER_TO_INT(param2);
|
||||
int32_t timeout = POINTER_TO_INT(param3);
|
||||
struct net_context *ctx = p1;
|
||||
int family = POINTER_TO_INT(p2);
|
||||
int32_t timeout = POINTER_TO_INT(p3);
|
||||
int ret;
|
||||
|
||||
ret = net_context_recv(ctx, recv_cb_timeout, K_MSEC(timeout),
|
||||
|
@ -818,7 +819,7 @@ void timeout_thread(struct net_context *ctx, void *param2, void *param3)
|
|||
static k_tid_t start_timeout_v6_thread(int32_t timeout)
|
||||
{
|
||||
return k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)timeout_thread,
|
||||
timeout_thread,
|
||||
udp_v6_ctx, INT_TO_POINTER(AF_INET6),
|
||||
INT_TO_POINTER(timeout),
|
||||
K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
|
@ -827,7 +828,7 @@ static k_tid_t start_timeout_v6_thread(int32_t timeout)
|
|||
static k_tid_t start_timeout_v4_thread(int32_t timeout)
|
||||
{
|
||||
return k_thread_create(&thread_data, thread_stack, STACKSIZE,
|
||||
(k_thread_entry_t)timeout_thread,
|
||||
timeout_thread,
|
||||
udp_v4_ctx, INT_TO_POINTER(AF_INET),
|
||||
INT_TO_POINTER(timeout),
|
||||
K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
|
|
|
@ -776,8 +776,12 @@ ZTEST(net_iface, test_v4_addr_add_rm)
|
|||
#define MY_ADDR_V4_USER { { { 10, 0, 0, 2 } } }
|
||||
#define UNKNOWN_ADDR_V4_USER { { { 5, 6, 7, 8 } } }
|
||||
|
||||
static void v4_addr_add_user(void)
|
||||
static void v4_addr_add_user(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct in_addr my_addr = MY_ADDR_V4_USER;
|
||||
bool ret;
|
||||
|
||||
|
@ -788,7 +792,7 @@ static void v4_addr_add_user(void)
|
|||
static void v4_addr_add_user_from_userspace(void)
|
||||
{
|
||||
k_thread_access_grant(k_current_get(), net_if_get_by_index(1));
|
||||
k_thread_user_mode_enter((k_thread_entry_t)v4_addr_add_user, NULL,
|
||||
k_thread_user_mode_enter(v4_addr_add_user, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -805,8 +809,12 @@ static void v4_addr_lookup_user(void)
|
|||
zassert_equal(ret, 0, "IPv4 address found");
|
||||
}
|
||||
|
||||
static void v4_addr_rm_user(void)
|
||||
static void v4_addr_rm_user(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct in_addr my_addr = MY_ADDR_V4_USER;
|
||||
bool ret;
|
||||
|
||||
|
@ -817,7 +825,7 @@ static void v4_addr_rm_user(void)
|
|||
static void v4_addr_rm_user_from_userspace(void)
|
||||
{
|
||||
k_thread_access_grant(k_current_get(), net_if_get_by_index(1));
|
||||
k_thread_user_mode_enter((k_thread_entry_t)v4_addr_rm_user, NULL,
|
||||
k_thread_user_mode_enter(v4_addr_rm_user, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -940,8 +948,12 @@ ZTEST(net_iface, test_v6_addr_add_rm_solicited)
|
|||
#define UNKNOWN_ADDR_V6_USER { { { 0x20, 0x01, 0x0d, 0xb8, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, 0, 0, 0x66 } } }
|
||||
|
||||
static void v6_addr_add_user(void)
|
||||
static void v6_addr_add_user(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct in6_addr my_addr = MY_ADDR_V6_USER;
|
||||
bool ret;
|
||||
|
||||
|
@ -952,7 +964,7 @@ static void v6_addr_add_user(void)
|
|||
static void v6_addr_add_user_from_userspace(void)
|
||||
{
|
||||
k_thread_access_grant(k_current_get(), net_if_get_by_index(1));
|
||||
k_thread_user_mode_enter((k_thread_entry_t)v6_addr_add_user, NULL,
|
||||
k_thread_user_mode_enter(v6_addr_add_user, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -969,8 +981,12 @@ static void v6_addr_lookup_user(void)
|
|||
zassert_equal(ret, 0, "IPv6 address found");
|
||||
}
|
||||
|
||||
static void v6_addr_rm_user(void)
|
||||
static void v6_addr_rm_user(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct in6_addr my_addr = MY_ADDR_V6_USER;
|
||||
bool ret;
|
||||
|
||||
|
@ -984,7 +1000,7 @@ static void v6_addr_rm_user(void)
|
|||
static void v6_addr_rm_user_from_userspace(void)
|
||||
{
|
||||
k_thread_access_grant(k_current_get(), net_if_get_by_index(1));
|
||||
k_thread_user_mode_enter((k_thread_entry_t)v6_addr_rm_user, NULL,
|
||||
k_thread_user_mode_enter(v6_addr_rm_user, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -995,8 +1011,12 @@ ZTEST(net_iface, test_v6_addr_add_rm_user_from_userspace)
|
|||
v6_addr_rm_user_from_userspace();
|
||||
}
|
||||
|
||||
static void netmask_addr_add(void)
|
||||
static void netmask_addr_add(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct in_addr my_netmask = { { { 255, 255, 255, 0 } } };
|
||||
bool ret;
|
||||
|
||||
|
@ -1006,13 +1026,13 @@ static void netmask_addr_add(void)
|
|||
|
||||
ZTEST(net_iface, test_netmask_addr_add)
|
||||
{
|
||||
netmask_addr_add();
|
||||
netmask_addr_add(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void netmask_addr_add_from_userspace(void)
|
||||
{
|
||||
k_thread_access_grant(k_current_get(), net_if_get_by_index(1));
|
||||
k_thread_user_mode_enter((k_thread_entry_t)netmask_addr_add, NULL,
|
||||
k_thread_user_mode_enter(netmask_addr_add, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -1021,8 +1041,12 @@ ZTEST(net_iface, test_netmask_addr_add_from_userspace)
|
|||
netmask_addr_add_from_userspace();
|
||||
}
|
||||
|
||||
static void gw_addr_add(void)
|
||||
static void gw_addr_add(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct in_addr my_gw = { { { 192, 0, 2, 254 } } };
|
||||
bool ret;
|
||||
|
||||
|
@ -1032,13 +1056,13 @@ static void gw_addr_add(void)
|
|||
|
||||
ZTEST(net_iface, test_gw_addr_add)
|
||||
{
|
||||
gw_addr_add();
|
||||
gw_addr_add(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void gw_addr_add_from_userspace(void)
|
||||
{
|
||||
k_thread_access_grant(k_current_get(), net_if_get_by_index(1));
|
||||
k_thread_user_mode_enter((k_thread_entry_t)gw_addr_add, NULL,
|
||||
k_thread_user_mode_enter(gw_addr_add, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -1047,21 +1071,25 @@ ZTEST(net_iface, test_gw_addr_add_from_userspace)
|
|||
gw_addr_add_from_userspace();
|
||||
}
|
||||
|
||||
static void get_by_index(void)
|
||||
static void get_by_index(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
zassert_not_null(net_if_get_by_index(1),
|
||||
"Cannot get interface at index 1");
|
||||
}
|
||||
|
||||
ZTEST(net_iface, test_get_by_index)
|
||||
{
|
||||
get_by_index();
|
||||
get_by_index(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void get_by_index_from_userspace(void)
|
||||
{
|
||||
k_thread_access_grant(k_current_get(), net_if_get_by_index(1));
|
||||
k_thread_user_mode_enter((k_thread_entry_t)get_by_index, NULL,
|
||||
k_thread_user_mode_enter(get_by_index, NULL,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -105,8 +105,12 @@ void test_requesting_nm(void)
|
|||
"Requesting Net MGMT failed");
|
||||
}
|
||||
|
||||
static void thrower_thread(void)
|
||||
static void thrower_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
while (1) {
|
||||
k_sem_take(&thrower_lock, K_FOREVER);
|
||||
|
||||
|
@ -253,7 +257,7 @@ static void initialize_event_tests(void)
|
|||
|
||||
k_thread_create(&thrower_thread_data, thrower_stack,
|
||||
K_THREAD_STACK_SIZEOF(thrower_stack),
|
||||
(k_thread_entry_t)thrower_thread,
|
||||
thrower_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||
}
|
||||
|
||||
|
|
|
@ -262,8 +262,10 @@ static void test_inject(const struct device *dev, uint64_t addr, uint64_t mask,
|
|||
zassert_equal(ret, 0, "Error setting ctrl");
|
||||
}
|
||||
|
||||
static int check_values(void *p1, void *p2, void *p3)
|
||||
static void check_values(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
intptr_t address = (intptr_t)p1;
|
||||
intptr_t type = (intptr_t)p2;
|
||||
intptr_t addr, errtype;
|
||||
|
@ -280,8 +282,6 @@ static int check_values(void *p1, void *p2, void *p3)
|
|||
/* Verify page address and error type */
|
||||
zassert_equal(addr, address, "Error address wrong");
|
||||
zassert_equal(errtype, type, "Error type wrong");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ibecc_error_inject_test(uint64_t addr, uint64_t mask, uint64_t type)
|
||||
|
@ -299,7 +299,7 @@ static void ibecc_error_inject_test(uint64_t addr, uint64_t mask, uint64_t type)
|
|||
test_inject(dev, addr, mask, type);
|
||||
|
||||
#if defined(CONFIG_USERSPACE)
|
||||
k_thread_user_mode_enter((k_thread_entry_t)check_values,
|
||||
k_thread_user_mode_enter(check_values,
|
||||
(void *)addr,
|
||||
(void *)type,
|
||||
NULL);
|
||||
|
|
|
@ -102,6 +102,10 @@ static struct rtio_mpsc mpsc_q;
|
|||
|
||||
static void mpsc_consumer(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct rtio_mpsc_node *n;
|
||||
struct mpsc_node *nn;
|
||||
|
||||
|
@ -124,6 +128,10 @@ static void mpsc_consumer(void *p1, void *p2, void *p3)
|
|||
|
||||
static void mpsc_producer(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct mpsc_node *n;
|
||||
uint32_t id = (uint32_t)(uintptr_t)p1;
|
||||
|
||||
|
@ -163,7 +171,7 @@ ZTEST(rtio_mpsc, test_mpsc_threaded)
|
|||
TC_PRINT("starting consumer\n");
|
||||
mpsc_tinfo[0].tid =
|
||||
k_thread_create(&mpsc_thread[0], mpsc_stack[0], MPSC_STACK_SIZE,
|
||||
(k_thread_entry_t)mpsc_consumer,
|
||||
mpsc_consumer,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_PREEMPT(5),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
@ -172,7 +180,7 @@ ZTEST(rtio_mpsc, test_mpsc_threaded)
|
|||
TC_PRINT("starting producer %i\n", i);
|
||||
mpsc_tinfo[i].tid =
|
||||
k_thread_create(&mpsc_thread[i], mpsc_stack[i], MPSC_STACK_SIZE,
|
||||
(k_thread_entry_t)mpsc_producer,
|
||||
mpsc_producer,
|
||||
(void *)(uintptr_t)i, NULL, NULL,
|
||||
K_PRIO_PREEMPT(5),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
|
|
@ -141,6 +141,9 @@ RTIO_SPSC_DEFINE(spsc, uint32_t, 4);
|
|||
|
||||
static void t1_consume(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct rtio_spsc_spsc *ezspsc = p1;
|
||||
uint32_t retries = 0;
|
||||
uint32_t *val = NULL;
|
||||
|
@ -162,6 +165,9 @@ static void t1_consume(void *p1, void *p2, void *p3)
|
|||
|
||||
static void t2_produce(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct rtio_spsc_spsc *ezspsc = p1;
|
||||
uint32_t retries = 0;
|
||||
uint32_t *val = NULL;
|
||||
|
@ -201,13 +207,13 @@ ZTEST(rtio_spsc, test_spsc_threaded)
|
|||
|
||||
tinfo[0].tid =
|
||||
k_thread_create(&tthread[0], tstack[0], STACK_SIZE,
|
||||
(k_thread_entry_t)t1_consume,
|
||||
t1_consume,
|
||||
&spsc, NULL, NULL,
|
||||
K_PRIO_PREEMPT(5),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
tinfo[1].tid =
|
||||
k_thread_create(&tthread[1], tstack[1], STACK_SIZE,
|
||||
(k_thread_entry_t)t2_produce,
|
||||
t2_produce,
|
||||
&spsc, NULL, NULL,
|
||||
K_PRIO_PREEMPT(5),
|
||||
K_INHERIT_PERMS, K_NO_WAIT);
|
||||
|
|
|
@ -201,6 +201,9 @@ void ztest_post_assert_fail_hook(void)
|
|||
|
||||
static void tThread_entry(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
int sub_type = *(int *)p1;
|
||||
|
||||
printk("case type is %d\n", case_type);
|
||||
|
@ -249,7 +252,7 @@ static int run_trigger_thread(int i)
|
|||
}
|
||||
|
||||
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
|
||||
(k_thread_entry_t)tThread_entry,
|
||||
tThread_entry,
|
||||
(void *)&case_type, NULL, NULL,
|
||||
K_PRIO_PREEMPT(THREAD_TEST_PRIORITY),
|
||||
perm, K_NO_WAIT);
|
||||
|
|
Loading…
Reference in a new issue