From 9cc9a830ebcc5f509bd3f63a5c4a8a856d02da74 Mon Sep 17 00:00:00 2001 From: xuxingliang Date: Thu, 18 Jul 2024 22:18:18 +0800 Subject: [PATCH] ostest/smpcall: add smp call from interrupt test Signed-off-by: xuxingliang --- testing/ostest/smp_call.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/testing/ostest/smp_call.c b/testing/ostest/smp_call.c index aa3b740399..4d3de1c69c 100644 --- a/testing/ostest/smp_call.c +++ b/testing/ostest/smp_call.c @@ -41,6 +41,12 @@ static int smp_call_func(void *arg) return OK; } +static void wdg_wdentry(wdparm_t arg) +{ + nxsched_smp_call((1 << CONFIG_SMP_NCPUS) - 1, smp_call_func, + (FAR void *)arg, false); +} + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -53,6 +59,10 @@ void smp_call_test(void) int cpu; int value; int status; + struct wdog_s wdog = + { + 0 + }; printf("smp_call_test: Test start\n"); @@ -102,6 +112,20 @@ void smp_call_test(void) } } + printf("smp_call_test: Call in interrupt, wait\n"); + + memset(&wdog, 0, sizeof(wdog)); + wd_start(&wdog, 0, wdg_wdentry, (wdparm_t)&sem); + for (cpu = 0; cpu < cpucnt; cpu++) + { + status = sem_wait(&sem); + if (status != 0) + { + printf("smp_call_test: smp call in interrupt error\n"); + ASSERT(false); + } + } + printf("smp_call_test: Call multi cpu, wait\n"); nxsched_smp_call(cpuset, smp_call_func, &sem, true);