zhujiale 11 ماه پیش
والد
کامیت
244cf61af6
4فایلهای تغییر یافته به همراه10 افزوده شده و 8 حذف شده
  1. 1 2
      components/smp/smp.c
  2. 3 2
      examples/utest/testcases/smp/smp.c
  3. 4 2
      include/rtdef.h
  4. 2 2
      libcpu/aarch64/common/setup.c

+ 1 - 2
components/smp/smp.c

@@ -107,7 +107,7 @@ void rt_smp_call_func_cond(int cpu_mask, smp_call_func_back func, void *data,rt_
             tmp_id++;
             tmp_mask = tmp_mask >> 1;
         }
-        rt_hw_ipi_send(RT_IPI_FUNC, cpu_mask);
+        rt_hw_ipi_send(RT_FUNC_IPI, cpu_mask);
     }
 
     if(need_wait)
@@ -143,4 +143,3 @@ void smp_init(void)
         rt_spin_lock_init(&global_work[i].lock);
     }
 }
-

+ 3 - 2
examples/utest/testcases/smp/smp.c

@@ -26,10 +26,9 @@ void test1()
         cpu_mask = rand() % 0xf;
         if (cpu_mask == 0)
             pass--;
-        rt_call_each_cpu(test_call, &cpu_mask, SMP_CALL_NO_WAIT);
+        rt_call_any_cpu(cpu_mask,test_call, &cpu_mask, SMP_CALL_WAIT_ALL);
         if (i % 20 == 0)
             rt_kprintf("#");
-        rt_thread_mdelay(1);
     }
     rt_kprintf("\n");
     uassert_true(pass_count == pass);
@@ -57,6 +56,8 @@ void test2(void)
 
 static rt_err_t utest_tc_init(void)
 {
+    pass_count = 0;
+    pass       = 1000;
     rt_spin_lock_init(&lock);
     return RT_EOK;
 }

+ 4 - 2
include/rtdef.h

@@ -672,10 +672,12 @@ typedef struct rt_cpu_usage_stats *rt_cpu_usage_stats_t;
 #define RT_STOP_IPI                     1
 #endif /* RT_STOP_IPI */
 
-#ifndef RT_IPI_FUNC
-#define RT_IPI_FUNC                     2
+#ifndef RT_FUNC_IPI
+#define RT_FUNC_IPI                     2
 #endif
 
+#define RT_MAX_IPI                      3
+
 #define _SCHEDULER_CONTEXT(fileds) fileds
 
 /**

+ 2 - 2
libcpu/aarch64/common/setup.c

@@ -306,10 +306,10 @@ void rt_hw_common_setup(void)
     /* Install the IPI handle */
     rt_hw_ipi_handler_install(RT_SCHEDULE_IPI, rt_scheduler_ipi_handler);
     rt_hw_ipi_handler_install(RT_STOP_IPI, rt_scheduler_ipi_handler);
-    rt_hw_ipi_handler_install(RT_IPI_FUNC, rt_smp_call_ipi_handler);
+    rt_hw_ipi_handler_install(RT_FUNC_IPI, rt_smp_call_ipi_handler);
     rt_hw_interrupt_umask(RT_SCHEDULE_IPI);
     rt_hw_interrupt_umask(RT_STOP_IPI);
-    rt_hw_interrupt_umask(RT_IPI_FUNC);
+    rt_hw_interrupt_umask(RT_FUNC_IPI);
 #endif
 }