rt_hw_cpu_shutdown: implement default weak function

and remvoe duplicated default functions in each cpu/bsp level
This commit is contained in:
Meco Man 2023-08-07 12:42:10 -04:00
parent cb810dfe75
commit c6a2f5b7bd
41 changed files with 25 additions and 394 deletions

View File

@ -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");

View File

@ -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);
}
}

View File

@ -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);
}
}
/*@}*/

View File

@ -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.
*/

View File

@ -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);
}
}
/*@}*/

View File

@ -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);
}
}
/*@}*/

View File

@ -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)
{

View File

@ -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);
/**@}*/

View File

@ -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");

View File

@ -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__ */

View File

@ -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,

View File

@ -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);
}
/*@}*/

View File

@ -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);
}
/*@}*/

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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)

View File

@ -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");

View File

@ -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;

View File

@ -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);
}
/*@}*/

View File

@ -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);
}
}
/*@}*/

View File

@ -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);
}
}
/*@}*/

View File

@ -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);
}
/*@}*/

View File

@ -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);
}
}
/*@}*/

View File

@ -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);
}
}

View File

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

View File

@ -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

View File

@ -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);
}
}

View File

@ -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");

View File

@ -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");

View File

@ -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
*

View File

@ -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;

View File

@ -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:

View File

@ -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");

View File

@ -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);
}

View File

@ -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";