Procházet zdrojové kódy

rt_hw_cpu_shutdown: implement default weak function

and remvoe duplicated default functions in each cpu/bsp level
Meco Man před 1 rokem
rodič
revize
c6a2f5b7bd
41 změnil soubory, kde provedl 25 přidání a 394 odebrání
  1. 1 1
      bsp/allwinner_tina/libcpu/cpuport.c
  2. 0 13
      bsp/bluetrum/libcpu/cpu/cpuport.c
  3. 0 11
      bsp/imx6sx/cortex-a9/cpu/cpu.c
  4. 0 22
      bsp/mipssim/drivers/board.c
  5. 0 11
      bsp/raspberry-pi/raspi2/cpu/cpu.c
  6. 0 12
      bsp/raspberry-pi/raspi3-32/cpu/cpu.c
  7. 1 1
      bsp/rockchip/rk3568/driver/board.c
  8. 0 10
      documentation/doxygen/hardware.h
  9. 1 1
      libcpu/aarch64/common/cpu.c
  10. 0 2
      libcpu/aarch64/common/cpu.h
  11. 0 8
      libcpu/arc/em/cpuport.c
  12. 0 19
      libcpu/arm/AT91SAM7S/cpu.c
  13. 0 18
      libcpu/arm/AT91SAM7X/cpu.c
  14. 1 1
      libcpu/arm/am335x/cpu.c
  15. 1 1
      libcpu/arm/arm926/cpuport.c
  16. 1 1
      libcpu/arm/armv6/cpuport.c
  17. 1 1
      libcpu/arm/cortex-a/cpuport.c
  18. 0 10
      libcpu/arm/cortex-m3/cpuport.c
  19. 0 10
      libcpu/arm/cortex-m33/cpuport.c
  20. 0 10
      libcpu/arm/cortex-m4/cpuport.c
  21. 0 10
      libcpu/arm/cortex-m7/cpuport.c
  22. 0 19
      libcpu/arm/cortex-r4/cpu.c
  23. 1 1
      libcpu/arm/dm36x/cpuport.c
  24. 0 19
      libcpu/arm/lpc214x/cpuport.c
  25. 0 19
      libcpu/arm/lpc24xx/cpu.c
  26. 0 13
      libcpu/arm/realview-a8-vmm/cpu.c
  27. 0 15
      libcpu/arm/s3c24x0/cpu.c
  28. 0 19
      libcpu/arm/s3c44b0/cpu.c
  29. 0 16
      libcpu/arm/sep4020/cpu.c
  30. 0 16
      libcpu/arm/zynqmp-r5/cpu.c
  31. 0 9
      libcpu/avr32/uc3/cpu.c
  32. 0 12
      libcpu/mips/gs232/cpuport.c
  33. 0 13
      libcpu/risc-v/common/cpuport.c
  34. 1 1
      libcpu/risc-v/t-head/c906/cpuport.c
  35. 1 1
      libcpu/risc-v/virt64/cpuport.c
  36. 0 11
      libcpu/rx/cpuport.c
  37. 0 10
      libcpu/ti-dsp/c28x/cpuport.c
  38. 0 15
      libcpu/ti-dsp/c6x/cpuport.c
  39. 1 1
      libcpu/unicore32/sep6200/cpu.c
  40. 0 11
      libcpu/xilinx/microblaze/cpu.c
  41. 14 0
      src/kservice.c

+ 1 - 1
bsp/allwinner_tina/libcpu/cpuport.c

@@ -160,7 +160,7 @@ void rt_hw_cpu_reset()
  *  shutdown CPU
  *
  */
-void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_uint32_t level;
     rt_kprintf("shutdown...\n");

+ 0 - 13
bsp/bluetrum/libcpu/cpu/cpuport.c

@@ -52,16 +52,3 @@ rt_uint8_t *rt_hw_stack_init(void       *tentry,
     /* return task's current stack address */
     return (rt_uint8_t *)stk;
 }
-
-/** shutdown CPU */
-void rt_hw_cpu_shutdown(void)
-{
-    rt_uint32_t level;
-    rt_kprintf("shutdown...\n");
-
-    level = rt_hw_interrupt_disable();
-    while (level)
-    {
-        RT_ASSERT(0);
-    }
-}

+ 0 - 11
bsp/imx6sx/cortex-a9/cpu/cpu.c

@@ -17,17 +17,6 @@
  */
 /*@{*/
 
-/** shutdown CPU */
-void rt_hw_cpu_shutdown()
-{
-	rt_uint32_t level;
-	rt_kprintf("shutdown...\n");
 
-	level = rt_hw_interrupt_disable();
-	while (level)
-	{
-		RT_ASSERT(0);
-	}
-}
 
 /*@}*/

+ 0 - 22
bsp/mipssim/drivers/board.c

@@ -26,28 +26,6 @@
 
 extern unsigned char __bss_end;
 
-/**
- * this function will reset CPU
- *
- */
-void rt_hw_cpu_reset(void)
-{
-    rt_kprintf("reboot system...\n");
-    while (1);
-}
-
-/**
- * this function will shutdown CPU
- *
- */
-void rt_hw_cpu_shutdown(void)
-{
-    rt_kprintf("shutdown...\n");
-
-    while (1);
-}
-
-
 /**
  * This is the timer interrupt service routine.
  */

+ 0 - 11
bsp/raspberry-pi/raspi2/cpu/cpu.c

@@ -17,17 +17,6 @@
  */
 /*@{*/
 
-/** shutdown CPU */
-void rt_hw_cpu_shutdown()
-{
-    rt_uint32_t level;
-    rt_kprintf("shutdown...\n");
 
-    level = rt_hw_interrupt_disable();
-    while (level)
-    {
-        RT_ASSERT(0);
-    }
-}
 
 /*@}*/

+ 0 - 12
bsp/raspberry-pi/raspi3-32/cpu/cpu.c

@@ -75,17 +75,5 @@ void rt_hw_spin_unlock(rt_hw_spinlock_t *lock)
  */
 /*@{*/
 
-/** shutdown CPU */
-void rt_hw_cpu_shutdown()
-{
-    rt_uint32_t level;
-    rt_kprintf("shutdown...\n");
-
-    level = rt_hw_interrupt_disable();
-    while (level)
-    {
-        RT_ASSERT(0);
-    }
-}
 
 /*@}*/

+ 1 - 1
bsp/rockchip/rk3568/driver/board.c

@@ -133,7 +133,7 @@ void start_cpu(int argc, char *argv[])
 MSH_CMD_EXPORT(start_cpu, start_cpu);
 
 #ifdef RT_AMP_SLAVE
-void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     if (psci_ops.cpu_off)
     {

+ 0 - 10
documentation/doxygen/hardware.h

@@ -74,14 +74,4 @@ void rt_hw_interrupt_umask(int vector);
 void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler,
                             rt_isr_handler_t *old_handler);
 
-/**
- * This function will reset whole platform.
- */
-void rt_hw_cpu_reset(void);
-
-/**
- * This function will halt whole platform.
- */
-void rt_hw_cpu_shutdown(void);
-
 /**@}*/

+ 1 - 1
libcpu/aarch64/common/cpu.c

@@ -357,7 +357,7 @@ const char *rt_hw_cpu_arch(void)
 }
 
 /** shutdown CPU */
-rt_weak void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_uint32_t level;
     rt_kprintf("shutdown...\n");

+ 0 - 2
libcpu/aarch64/common/cpu.h

@@ -56,8 +56,6 @@ extern struct cpu_ops_t cpu_ops_spin_tbl;
 
 #endif /* RT_USING_SMP */
 
-extern void rt_hw_cpu_shutdown(void);
-
 extern void (*system_off)(void);
 
 #endif /* __RT_HW_CPU_H__ */

+ 0 - 8
libcpu/arc/em/cpuport.c

@@ -29,14 +29,6 @@ struct init_stack_frame {
     rt_uint32_t r0;
 };
 
-/**
- * shutdown CPU
- */
-rt_weak void rt_hw_cpu_shutdown(void)
-{
-
-}
-
 rt_uint8_t *rt_hw_stack_init(void       *tentry,
                              void       *parameter,
                              rt_uint8_t *stack_addr,

+ 0 - 19
libcpu/arm/AT91SAM7S/cpu.c

@@ -16,23 +16,4 @@
  */
 /*@{*/
 
-/**
- * this function will reset CPU
- *
- */
-void rt_hw_cpu_reset()
-{
-}
-
-/**
- * this function will shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_kprintf("shutdown...\n");
-
-    while (1);
-}
-
 /*@}*/

+ 0 - 18
libcpu/arm/AT91SAM7X/cpu.c

@@ -16,23 +16,5 @@
  */
 /*@{*/
 
-/**
- * this function will reset CPU
- *
- */
-void rt_hw_cpu_reset()
-{
-}
-
-/**
- * this function will shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_kprintf("shutdown...\n");
-
-    while (1);
-}
 
 /*@}*/

+ 1 - 1
libcpu/arm/am335x/cpu.c

@@ -182,7 +182,7 @@ rt_base_t rt_hw_cpu_dcache_status()
  *  shutdown CPU
  *
  */
-rt_weak void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_base_t level;
     rt_kprintf("shutdown...\n");

+ 1 - 1
libcpu/arm/arm926/cpuport.c

@@ -161,7 +161,7 @@ void rt_hw_cpu_reset()
  *  shutdown CPU
  *
  */
-rt_weak void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_base_t level;
     rt_kprintf("shutdown...\n");

+ 1 - 1
libcpu/arm/armv6/cpuport.c

@@ -162,7 +162,7 @@ void rt_hw_cpu_reset()
  *  shutdown CPU
  *
  */
-rt_weak void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_base_t level;
     rt_kprintf("shutdown...\n");

+ 1 - 1
libcpu/arm/cortex-a/cpuport.c

@@ -74,7 +74,7 @@ void rt_hw_spin_unlock(rt_hw_spinlock_t *lock)
 /*@{*/
 
 /** shutdown CPU */
-rt_weak void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_base_t level;
     rt_kprintf("shutdown...\n");

+ 0 - 10
libcpu/arm/cortex-m3/cpuport.c

@@ -343,16 +343,6 @@ void rt_hw_hard_fault_exception(struct exception_info * exception_info)
     while (1);
 }
 
-/**
- * shutdown CPU
- */
-rt_weak void rt_hw_cpu_shutdown(void)
-{
-    rt_kprintf("shutdown...\n");
-
-    RT_ASSERT(0);
-}
-
 /**
  * reset CPU
  */

+ 0 - 10
libcpu/arm/cortex-m33/cpuport.c

@@ -485,16 +485,6 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
     while (1);
 }
 
-/**
- * shutdown CPU
- */
-rt_weak void rt_hw_cpu_shutdown(void)
-{
-    rt_kprintf("shutdown...\n");
-
-    RT_ASSERT(0);
-}
-
 /**
  * reset CPU
  */

+ 0 - 10
libcpu/arm/cortex-m4/cpuport.c

@@ -428,16 +428,6 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
     while (1);
 }
 
-/**
- * shutdown CPU
- */
-rt_weak void rt_hw_cpu_shutdown(void)
-{
-    rt_kprintf("shutdown...\n");
-
-    RT_ASSERT(0);
-}
-
 /**
  * reset CPU
  */

+ 0 - 10
libcpu/arm/cortex-m7/cpuport.c

@@ -427,16 +427,6 @@ void rt_hw_hard_fault_exception(struct exception_info *exception_info)
     while (1);
 }
 
-/**
- * shutdown CPU
- */
-rt_weak void rt_hw_cpu_shutdown(void)
-{
-    rt_kprintf("shutdown...\n");
-
-    RT_ASSERT(0);
-}
-
 /**
  * reset CPU
  */

+ 0 - 19
libcpu/arm/cortex-r4/cpu.c

@@ -16,25 +16,6 @@
  */
 /*@{*/
 
-/**
- * this function will reset CPU
- *
- */
-void rt_hw_cpu_reset()
-{
-}
-
-/**
- * this function will shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_kprintf("shutdown...\n");
-
-    while (1);
-}
-
 #ifdef __TI_COMPILER_VERSION__
 #ifdef RT_USING_CPU_FFS
 int __rt_ffs(int value)

+ 1 - 1
libcpu/arm/dm36x/cpuport.c

@@ -160,7 +160,7 @@ void rt_hw_cpu_reset()
  *  shutdown CPU
  *
  */
-rt_weak void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_base_t level;
     rt_kprintf("shutdown...\n");

+ 0 - 19
libcpu/arm/lpc214x/cpuport.c

@@ -159,25 +159,6 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
     return old_handler;
 }
 
-/**
- * this function will reset CPU
- *
- */
-void rt_hw_cpu_reset(void)
-{
-}
-
-/**
- * this function will shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_kprintf("shutdown...\n");
-
-    while (1);
-}
-
 void rt_hw_trap_irq(void)
 {
     int irqno;

+ 0 - 19
libcpu/arm/lpc24xx/cpu.c

@@ -16,23 +16,4 @@
  */
 /*@{*/
 
-/**
- * this function will reset CPU
- *
- */
-void rt_hw_cpu_reset()
-{
-}
-
-/**
- * this function will shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_kprintf("shutdown...\n");
-
-    while (1);
-}
-
 /*@}*/

+ 0 - 13
libcpu/arm/realview-a8-vmm/cpu.c

@@ -17,17 +17,4 @@
  */
 /*@{*/
 
-/** shutdown CPU */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_base_t level;
-    rt_kprintf("shutdown...\n");
-
-    level = rt_hw_interrupt_disable();
-    while (level)
-    {
-        RT_ASSERT(0);
-    }
-}
-
 /*@}*/

+ 0 - 15
libcpu/arm/s3c24x0/cpu.c

@@ -167,20 +167,5 @@ void rt_hw_cpu_reset()
     /* NEVER REACHED */
 }
 
-/**
- *  shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_base_t level;
-    rt_kprintf("shutdown...\n");
-
-    level = rt_hw_interrupt_disable();
-    while (level)
-    {
-        RT_ASSERT(0);
-    }
-}
 
 /*@}*/

+ 0 - 19
libcpu/arm/s3c44b0/cpu.c

@@ -96,23 +96,4 @@ rt_base_t rt_hw_cpu_dcache_status()
     return rt_hw_cpu_icache_status();
 }
 
-/**
- * this function will reset CPU
- *
- */
-void rt_hw_cpu_reset()
-{
-}
-
-/**
- * this function will shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_kprintf("shutdown...\n");
-
-    while (1);
-}
-
 /*@}*/

+ 0 - 16
libcpu/arm/sep4020/cpu.c

@@ -169,20 +169,4 @@ void rt_hw_cpu_reset()
     /* NEVER REACHED */
 }
 
-/**
- *  shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_base_t level;
-    rt_kprintf("shutdown...\n");
-
-    level = rt_hw_interrupt_disable();
-    while (level)
-    {
-        RT_ASSERT(RT_NULL);
-    }
-}
-
 /*@}*/

+ 0 - 16
libcpu/arm/zynqmp-r5/cpu.c

@@ -18,19 +18,3 @@ void rt_hw_cpu_reset()
     while (1);  /* loop forever and wait for reset to happen */
     /* NEVER REACHED */
 }
-
-/**
- *  shutdown CPU
- *
- */
-void rt_hw_cpu_shutdown()
-{
-    rt_base_t level;
-    rt_kprintf("shutdown...\n");
-
-    level = rt_hw_interrupt_disable();
-    while (level)
-    {
-        RT_ASSERT(0);
-    }
-}

+ 0 - 9
libcpu/avr32/uc3/cpu.c

@@ -15,15 +15,6 @@
  */
 /*@{*/
 
-/**
- *  shutdown CPU
- *
- */
-void rt_hw_cpu_shutdown()
-{
-    rt_kprintf("shutdown...\n");
 
-    RT_ASSERT(0);
-}
 
 /*@}*/

+ 0 - 12
libcpu/mips/gs232/cpuport.c

@@ -34,18 +34,6 @@ void rt_hw_cpu_reset(void)
     while (1);
 }
 
-/**
- * this function will shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown(void)
-{
-    rt_kprintf("shutdown...\n");
-
-    while (1);
-}
-
-
 #define Hit_Invalidate_I    0x10
 #define Hit_Invalidate_D    0x11
 #define CONFIG_SYS_CACHELINE_SIZE   32

+ 0 - 13
libcpu/risc-v/common/cpuport.c

@@ -97,16 +97,3 @@ rt_weak void rt_hw_context_switch_interrupt(rt_ubase_t from, rt_ubase_t to, rt_t
     return ;
 }
 #endif /* end of RT_USING_SMP */
-
-/** shutdown CPU */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_base_t level;
-    rt_kprintf("shutdown...\n");
-
-    level = rt_hw_interrupt_disable();
-    while (level)
-    {
-        RT_ASSERT(0);
-    }
-}

+ 1 - 1
libcpu/risc-v/t-head/c906/cpuport.c

@@ -106,7 +106,7 @@ void rt_hw_context_switch_interrupt(rt_ubase_t from, rt_ubase_t to, rt_thread_t
 #endif /* end of RT_USING_SMP */
 
 /** shutdown CPU */
-void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_uint32_t level;
     rt_kprintf("shutdown...\n");

+ 1 - 1
libcpu/risc-v/virt64/cpuport.c

@@ -108,7 +108,7 @@ void rt_hw_context_switch_interrupt(rt_ubase_t from, rt_ubase_t to, rt_thread_t
 #endif /* end of RT_USING_SMP */
 
 /** shutdown CPU */
-void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_uint32_t level;
     rt_kprintf("shutdown...\n");

+ 0 - 11
libcpu/rx/cpuport.c

@@ -174,17 +174,6 @@ void rt_hw_context_switch_interrupt(rt_uint32_t from, rt_uint32_t to)
     ENTER_INTERRUPT();
 }
 
-/**
- * shut down the chip
- *
- * @author LXZ (2014/11/8)
- */
-rt_weak void rt_hw_cpu_shutdown(void)
-{
-    rt_kprintf("shutdown...\n");
-
-    RT_ASSERT(0);
-}
 /**
  * switch to the first thread,it just call one time
  *

+ 0 - 10
libcpu/ti-dsp/c28x/cpuport.c

@@ -158,16 +158,6 @@ int __rt_ffs(int value)
 }
 #endif
 
-/**
- * shutdown CPU
- */
-rt_weak void rt_hw_cpu_shutdown(void)
-{
-    rt_kprintf("shutdown...\n");
-
-    RT_ASSERT(0);
-}
-
 void rt_interrupt_enter(void)
 {
     rt_base_t level;

+ 0 - 15
libcpu/ti-dsp/c6x/cpuport.c

@@ -13,21 +13,6 @@
 
 #include "trap.h"
 
-/*------------ rt_hw_cpu_shutdown() function ----------------------------------
- * DESCRIPTION: Shutdown CPU
- * ARGUMENTS:
- * None
- * RETURNED VALUE: None
------------------------------------------------------------------------------*/
-rt_weak void rt_hw_cpu_shutdown(void)
-{
-    rt_kprintf("shutdown...\n");
-
-    rt_hw_interrupt_disable();
-
-    RT_ASSERT(0);
-}
-
 /*------------ nested_exception_handler() function ---------------------------
  * DESCRIPTION: Function handles Nested Exception
  * ARGUMENTS:

+ 1 - 1
libcpu/unicore32/sep6200/cpu.c

@@ -260,7 +260,7 @@ void rt_hw_cpu_reset()
  *  shutdown CPU
  *
  */
-rt_weak void rt_hw_cpu_shutdown()
+void rt_hw_cpu_shutdown(void)
 {
     rt_base_t level;
     rt_kprintf("shutdown...\n");

+ 0 - 11
libcpu/xilinx/microblaze/cpu.c

@@ -10,14 +10,3 @@
 
 #include <rtthread.h>
 
-/**
- * this function will shutdown CPU
- *
- */
-rt_weak void rt_hw_cpu_shutdown()
-{
-    rt_kprintf("shutdown...\n");
-
-    while (1);
-}
-

+ 14 - 0
src/kservice.c

@@ -77,6 +77,20 @@ rt_weak void rt_hw_cpu_reset(void)
     return;
 }
 
+rt_weak void rt_hw_cpu_shutdown(void)
+{
+    rt_base_t level;
+    LOG_I("CPU shutdown...");
+    LOG_W("Using default rt_hw_cpu_shutdown()."
+        "Please consider implementing rt_hw_cpu_reset() in another file.");
+    level = rt_hw_interrupt_disable();
+    while (level)
+    {
+        RT_ASSERT(RT_NULL);
+    }
+    return;
+}
+
 rt_weak const char *rt_hw_cpu_arch(void)
 {
     return "unknown";