boarc: nsim: add source code to initialize board and start os
Signed-off-by: Jingru <jingru@synopsys.com>
This commit is contained in:
@@ -43,25 +43,33 @@ __API__ cpu_hrtimer_t tos_cpu_hrtimer_read(void);
|
||||
|
||||
#endif
|
||||
|
||||
__KERNEL__ void cpu_init(void);
|
||||
|
||||
__KERNEL__ void cpu_reset(void);
|
||||
__KNL__ void cpu_init(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_init(k_cycle_t cycle_per_tick);
|
||||
|
||||
__KERNEL__ void cpu_sched_start(void);
|
||||
__KNL__ void cpu_reset(void);
|
||||
|
||||
__KERNEL__ void cpu_context_switch(void);
|
||||
|
||||
__KERNEL__ void cpu_irq_context_switch(void);
|
||||
__KNL__ void cpu_systick_init(k_cycle_t cycle_per_tick);
|
||||
|
||||
|
||||
__KNL__ void cpu_sched_start(void);
|
||||
|
||||
|
||||
__KNL__ void cpu_context_switch(void);
|
||||
|
||||
|
||||
__KNL__ void cpu_irq_context_switch(void);
|
||||
|
||||
#if TOS_CFG_TASK_STACK_DRAUGHT_DEPTH_DETACT_EN > 0u
|
||||
|
||||
__KERNEL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_size, int *depth);
|
||||
|
||||
__KNL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_size, int *depth);
|
||||
|
||||
#endif
|
||||
|
||||
__KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
|
||||
__KNL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
void *arg,
|
||||
void *exit,
|
||||
k_stack_t *stk_base,
|
||||
@@ -69,29 +77,39 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
|
||||
#if TOS_CFG_TICKLESS_EN > 0u
|
||||
|
||||
__KERNEL__ void cpu_systick_resume(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_suspend(void);
|
||||
__KNL__ void cpu_systick_resume(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_reload_reset(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_pending_reset(void);
|
||||
__KNL__ void cpu_systick_suspend(void);
|
||||
|
||||
__KERNEL__ k_time_t cpu_systick_max_delay_millisecond(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_expires_set(k_time_t millisecond);
|
||||
__KNL__ void cpu_systick_reload_reset(void);
|
||||
|
||||
__KERNEL__ void cpu_systick_reset(void);
|
||||
|
||||
__KNL__ void cpu_systick_pending_reset(void);
|
||||
|
||||
|
||||
__KNL__ k_time_t cpu_systick_max_delay_millisecond(void);
|
||||
|
||||
|
||||
__KNL__ void cpu_systick_expires_set(k_time_t millisecond);
|
||||
|
||||
|
||||
__KNL__ void cpu_systick_reset(void);
|
||||
|
||||
#endif
|
||||
|
||||
#if TOS_CFG_PWR_MGR_EN > 0u
|
||||
|
||||
__KERNEL__ void cpu_sleep_mode_enter(void);
|
||||
|
||||
__KERNEL__ void cpu_stop_mode_enter(void);
|
||||
__KNL__ void cpu_sleep_mode_enter(void);
|
||||
|
||||
__KERNEL__ void cpu_standby_mode_enter(void);
|
||||
|
||||
__KNL__ void cpu_stop_mode_enter(void);
|
||||
|
||||
|
||||
__KNL__ void cpu_standby_mode_enter(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -99,11 +117,13 @@ __KERNEL__ void cpu_standby_mode_enter(void);
|
||||
|
||||
#if defined (TOS_CFG_CPU_ARM_FPU_EN) && (TOS_CFG_CPU_ARM_FPU_EN == 1U)
|
||||
|
||||
__KERNEL__ void cpu_flush_fpu(void);
|
||||
|
||||
__KNL__ void cpu_flush_fpu(void);
|
||||
|
||||
#endif /* TOS_CFG_CPU_ARM_FPU_EN */
|
||||
|
||||
__KERNEL__ void cpu_fault_diagnosis(void);
|
||||
|
||||
__KNL__ void cpu_fault_diagnosis(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -73,7 +73,7 @@ __API__ void tos_cpu_cpsr_restore(cpu_cpsr_t cpsr)
|
||||
port_cpsr_restore(cpsr);
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_init(void)
|
||||
__KNL__ void cpu_init(void)
|
||||
{
|
||||
k_cpu_cycle_per_tick = TOS_CFG_CPU_CLOCK / k_cpu_tick_per_second;
|
||||
cpu_systick_init(k_cpu_cycle_per_tick);
|
||||
@@ -83,28 +83,28 @@ __KERNEL__ void cpu_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_reset(void)
|
||||
__KNL__ void cpu_reset(void)
|
||||
{
|
||||
port_cpu_reset();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_sched_start(void) // 启动任务调度器
|
||||
__KNL__ void cpu_sched_start(void) // 启动任务调度器
|
||||
{
|
||||
port_sched_start();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_context_switch(void)
|
||||
__KNL__ void cpu_context_switch(void)
|
||||
{
|
||||
port_context_switch();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_irq_context_switch(void)
|
||||
__KNL__ void cpu_irq_context_switch(void)
|
||||
{
|
||||
// port_irq_context_switch();
|
||||
// DO NOTHING
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_systick_init(k_cycle_t cycle_per_tick)
|
||||
__KNL__ void cpu_systick_init(k_cycle_t cycle_per_tick)
|
||||
{
|
||||
port_systick_priority_set(TOS_CFG_CPU_SYSTICK_PRIO);
|
||||
port_systick_config(cycle_per_tick);
|
||||
@@ -129,7 +129,7 @@ __STATIC_INLINE__ void cpu_systick_reload(k_cycle_t cycle_per_tick)
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
__KERNEL__ void cpu_systick_resume(void)
|
||||
__KNL__ void cpu_systick_resume(void)
|
||||
{
|
||||
port_systick_resume();
|
||||
}
|
||||
@@ -139,17 +139,17 @@ __KERNEL__ void cpu_systick_resume(void)
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
__KERNEL__ void cpu_systick_suspend(void)
|
||||
__KNL__ void cpu_systick_suspend(void)
|
||||
{
|
||||
port_systick_suspend();
|
||||
}
|
||||
|
||||
__KERNEL__ k_time_t cpu_systick_max_delay_millisecond(void)
|
||||
__KNL__ k_time_t cpu_systick_max_delay_millisecond(void)
|
||||
{
|
||||
return port_systick_max_delay_millisecond();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_systick_expires_set(k_time_t millisecond)
|
||||
__KNL__ void cpu_systick_expires_set(k_time_t millisecond)
|
||||
{
|
||||
k_cycle_t cycles;
|
||||
|
||||
@@ -158,12 +158,12 @@ __KERNEL__ void cpu_systick_expires_set(k_time_t millisecond)
|
||||
cpu_systick_reload(cycles - 12); /* interrupt delay */
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_systick_pending_reset(void)
|
||||
__KNL__ void cpu_systick_pending_reset(void)
|
||||
{
|
||||
port_systick_pending_reset();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_systick_reset(void)
|
||||
__KNL__ void cpu_systick_reset(void)
|
||||
{
|
||||
cpu_systick_reload(k_cpu_cycle_per_tick);
|
||||
}
|
||||
@@ -172,24 +172,24 @@ __KERNEL__ void cpu_systick_reset(void)
|
||||
|
||||
#if TOS_CFG_PWR_MGR_EN > 0u
|
||||
|
||||
__KERNEL__ void cpu_sleep_mode_enter(void)
|
||||
__KNL__ void cpu_sleep_mode_enter(void)
|
||||
{
|
||||
port_sleep_mode_enter();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_stop_mode_enter(void)
|
||||
__KNL__ void cpu_stop_mode_enter(void)
|
||||
{
|
||||
port_stop_mode_enter();
|
||||
}
|
||||
|
||||
__KERNEL__ void cpu_standby_mode_enter(void)
|
||||
__KNL__ void cpu_standby_mode_enter(void)
|
||||
{
|
||||
port_standby_mode_enter();
|
||||
}
|
||||
|
||||
#endif /* TOS_CFG_PWR_MGR_EN */
|
||||
|
||||
__KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
__KNL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
void *arg,
|
||||
void *exit,
|
||||
k_stack_t *stk_base,
|
||||
@@ -214,7 +214,7 @@ __KERNEL__ k_stack_t *cpu_task_stk_init(void *entry,
|
||||
|
||||
#if TOS_CFG_TASK_STACK_DRAUGHT_DEPTH_DETACT_EN > 0u
|
||||
|
||||
__KERNEL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_size, int *depth)
|
||||
__KNL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_size, int *depth)
|
||||
{
|
||||
uint8_t *slot;
|
||||
uint8_t *sp, *bp;
|
||||
@@ -244,7 +244,7 @@ __KERNEL__ k_err_t cpu_task_stack_draught_depth(k_stack_t *stk_base, size_t stk_
|
||||
#if TOS_CFG_FAULT_BACKTRACE_EN > 0u
|
||||
|
||||
|
||||
__KERNEL__ void cpu_fault_diagnosis(void)
|
||||
__KNL__ void cpu_fault_diagnosis(void)
|
||||
{
|
||||
port_fault_diagnosis();
|
||||
}
|
||||
|
@@ -45,6 +45,11 @@
|
||||
#include "board.h"
|
||||
#include "arc/arc_exception.h"
|
||||
|
||||
__PORT__ void port_cpu_reset(void)
|
||||
{
|
||||
exc_entry_reset();
|
||||
}
|
||||
|
||||
__PORT__ void port_systick_config(uint32_t cycle_per_tick) // Configure SysTick to generate an interrupt every cycle_per_tick
|
||||
{
|
||||
timer_int_clear(0); // nsim #define BOARD_SYS_TIMER_ID TIMER_0
|
||||
|
Reference in New Issue
Block a user