This commit is contained in:
zhujiale 2024-09-13 15:41:43 +08:00 committed by Rbb666
parent aafc0ae0f8
commit d8956e415e
2 changed files with 11 additions and 10 deletions

View File

@ -14,9 +14,10 @@
#define DBG_LVL DBG_INFO #define DBG_LVL DBG_INFO
#include <rtdbg.h> #include <rtdbg.h>
struct rt_smp_call rt_smp_work[RT_CPUS_NR]; static struct rt_smp_call rt_smp_work[RT_CPUS_NR];
rt_atomic_t rt_smp_wait; static rt_atomic_t rt_smp_wait;
rt_err_t smp_call_handler(struct rt_smp_event *event)
static rt_err_t smp_call_handler(struct rt_smp_event *event)
{ {
switch (event->event_id) switch (event->event_id)
{ {

View File

@ -2,11 +2,11 @@
#include "utest.h" #include "utest.h"
#include "utest_assert.h" #include "utest_assert.h"
#include "smp.h" #include "smp.h"
int pass_count = 0; static int pass_count = 0;
int pass = 1000; static int pass = 1000;
struct rt_spinlock lock; static struct rt_spinlock lock;
void test_call(void *data) static void test_call(void *data)
{ {
rt_spin_lock(&lock); rt_spin_lock(&lock);
int *i = (int *)data; int *i = (int *)data;
@ -18,7 +18,7 @@ void test_call(void *data)
} }
void test1() static void test1()
{ {
int cpu_mask = 0xf; int cpu_mask = 0xf;
for (int i = 0; i < 1000; i++) for (int i = 0; i < 1000; i++)
@ -34,7 +34,7 @@ void test1()
uassert_true(pass_count == pass); uassert_true(pass_count == pass);
} }
void test_call2(void *data) static void test_call2(void *data)
{ {
rt_spin_lock(&lock); rt_spin_lock(&lock);
int a = 100000; int a = 100000;
@ -43,7 +43,7 @@ void test_call2(void *data)
(*i)++; (*i)++;
rt_spin_unlock(&lock); rt_spin_unlock(&lock);
} }
void test2(void) static void test2(void)
{ {
int data = 0; int data = 0;
rt_smp_call_each_cpu(test_call2, &data, SMP_CALL_WAIT_ALL); rt_smp_call_each_cpu(test_call2, &data, SMP_CALL_WAIT_ALL);