Skip to content

Commit

Permalink
smp
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuzhuzhus committed Sep 13, 2024
1 parent f0dc4c9 commit 35112e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
7 changes: 4 additions & 3 deletions components/drivers/smp/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
#define DBG_LVL DBG_INFO
#include <rtdbg.h>

struct rt_smp_call rt_smp_work[RT_CPUS_NR];
rt_atomic_t rt_smp_wait;
rt_err_t smp_call_handler(struct rt_smp_event *event)
static struct rt_smp_call rt_smp_work[RT_CPUS_NR];
static rt_atomic_t rt_smp_wait;

static rt_err_t smp_call_handler(struct rt_smp_event *event)
{
switch (event->event_id)
{
Expand Down
14 changes: 7 additions & 7 deletions examples/utest/testcases/smp/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#include "utest.h"
#include "utest_assert.h"
#include "smp.h"
int pass_count = 0;
int pass = 1000;
struct rt_spinlock lock;
static int pass_count = 0;
static int pass = 1000;
static struct rt_spinlock lock;

void test_call(void *data)
static void test_call(void *data)
{
rt_spin_lock(&lock);
int *i = (int *)data;
Expand All @@ -18,7 +18,7 @@ void test_call(void *data)
}


void test1()
static void test1()
{
int cpu_mask = 0xf;
for (int i = 0; i < 1000; i++)
Expand All @@ -34,7 +34,7 @@ void test1()
uassert_true(pass_count == pass);
}

void test_call2(void *data)
static void test_call2(void *data)
{
rt_spin_lock(&lock);
int a = 100000;
Expand All @@ -43,7 +43,7 @@ void test_call2(void *data)
(*i)++;
rt_spin_unlock(&lock);
}
void test2(void)
static void test2(void)
{
int data = 0;
rt_smp_call_each_cpu(test_call2, &data, SMP_CALL_WAIT_ALL);
Expand Down

0 comments on commit 35112e2

Please sign in to comment.