update New Feature#1113

1. update component to week40
2. add new function smart_no_idle_sw_init
3. change name of smart_ddr_spinlock_init
4. change type of smart_task_del and smart_enable_q_nempty
5. if call smart_enable_q_nempty return faild, we'll call 8 times
6. if call smart_task_del return faild, we'll record
7. smart_reclaim_init_res() don't be called!!!
8. test:
   8.1 SPU(case14)+ARM(case3) :PASS
   8.2 SPU(case20)+ARM(case20):PASS
   8.3 SPU(case21)+ARM(case21):PASS
   8.4 SPU(case34)+ARM(case5) :PASS
   8.5 SPU(case44)+ARM(case5) :PASS
This commit is contained in:
lishuang.xie 2023-10-12 10:28:46 +08:00
parent fe841573fd
commit e34abce4e1
19 changed files with 281 additions and 125 deletions

View File

@ -79,7 +79,7 @@ void ape_mtimer_sync(int32_t nScsId)
}
gSpinLockBuildCell.lock_addr = 0xB7FD1440;
gSpinLockBuildCell.flag_addr = 0xB7FD1444;
smart_ddr_spin_lock_init(&gSpinLockBuildCell);
smart_ddr_spinlock_init(&gSpinLockBuildCell);
smart_ddr_spinlock(&gSpinLockBuildCell);
ape_mtimer_int_init(nTimerId); // mtimer int attach

View File

@ -137,7 +137,7 @@ void stc_timer_ctwint_init()
//gSpinLockCtwInit.lock_loop_addr = 0xB7FD1410;
//gSpinLockCtwInit.unlock_loop_addr = 0xB7FD1410;
//gSpinLockCtwInit.unlock_addr = 0xB7FD1418;
smart_ddr_spin_lock_init(&gSpinLockCtwInit);
smart_ddr_spinlock_init(&gSpinLockCtwInit);
uint32_t intNum = APC_STC_INTR0 + apeId;
// attach interrupt func

View File

@ -12,6 +12,7 @@
#define OSP_HW_BAND (8) /* 硬件队列绑定失败 */
#define OSP_HW_VECT (9) /* 硬件队列获取中断号失败 */
#define OSP_HW_IRQ (10) /* 硬件队列注册中断服务失败 */
#define OSP_HW_EMPTY_ERR (11) /* 硬件队列非空中断使能失败 */
#endif

View File

@ -269,12 +269,18 @@ void osp_start()
g_ape_id = get_core_id();
g_que_id = g_ape_id;
ret = smart_os_debug_init((DBG_DDR_OS_ADDR_BASE + core_id*DBG_DDR_OS_LEN), DBG_DDR_OS_LEN); // 推荐768, 实际1024
ret = smart_os_debug_init((DBG_DDR_OS_ADDR_BASE + core_id*DBG_DDR_OS_LEN), DBG_DDR_OS_LEN); // 推荐0x40, 实际0x100
if (0 != ret)
{
debug_write(DBG_DDR_ERR_IDX(core_id, 31), ret); // ape0: 0xb7e2407c
}
ret = smart_no_idle_sw_init((DBG_DDR_OS_NO_IDLE_BASE + core_id*DBG_DDR_OS_NO_IDLE_LEN), DBG_DDR_OS_NO_IDLE_LEN); // 推荐0x40, 实际0x100
if (0 != ret)
{
debug_write(DBG_DDR_ERR_IDX(core_id, 47), ret);
}
smart_kernel_init(osp_init_start_hook, g_ape_id);
}

View File

@ -636,6 +636,7 @@ int osp_hw_que_init(uint8_t ape_id, uint8_t que_id)
int que_used = -1;
int que_cpuid = -1;
int apeId = get_core_id();
uint8_t u8_loop = 0;
/* communication init */
do
@ -652,7 +653,7 @@ int osp_hw_que_init(uint8_t ape_id, uint8_t que_id)
if (0 != ret)
{
UCP_PRINT_ERROR("[osp_hw_que_init]: smart_que_bind(ape_id = %x, que_id = %x) retunr error\r\n", ape_id, que_id);
//debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xffff);
//debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff01);
debug_write(DBG_DDR_ERR_IDX(apeId, 22), ret);
return -OSP_HW_BAND;
}
@ -661,6 +662,7 @@ int osp_hw_que_init(uint8_t ape_id, uint8_t que_id)
ret = smart_get_que_info(g_que_id, &que_dep, &que_width, &que_used, &que_cpuid);
if (0 != ret)
{
//debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff02);
debug_write(DBG_DDR_ERR_IDX(apeId, 20), ret);
}
UCP_PRINT_LOG("[osp_hw_que_init]: que_id(0x%08x),dep(0x%08x),width(0x%08x),used(0x%08x),cpuid(0x%08x) \r\n", g_que_id, que_dep,que_width,que_used,que_cpuid);
@ -670,32 +672,48 @@ int osp_hw_que_init(uint8_t ape_id, uint8_t que_id)
if (0 >= g_hq_vector)
{
UCP_PRINT_ERROR("[osp_hw_que_init]: smart_get_hq_vector error!!!!!(ape_id = 0x%08x)....\r\n", ape_id);
//debug_write(OSP_DEBUG_POT(g_ape_id, 53), 0xffff);
//debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff03);
debug_write(DBG_DDR_ERR_IDX(apeId, 16), g_hq_vector);
return -OSP_HW_VECT;
}
UCP_PRINT_LOG("[osp_hw_que_init]: hq_vector = 0x%x (apeid = 0x%x, queid = 0x%x)\r\n", g_hq_vector, ape_id, que_id);
debug_write(OSP_DEBUG_POT(g_ape_id, 54), g_hq_vector);
debug_write(OSP_DEBUG_POT(g_ape_id, 55), g_hq_vector);
/* Set req */
ret = smart_irq_request(g_hq_vector, osp_hw_que_irq);
if (0 != ret)
{
UCP_PRINT_ERROR("[osp_hw_que_init]: smart_irq_request error!!!!!(ape_id = 0x%08x)....\r\n", ape_id);
//debug_write(OSP_DEBUG_POT(g_ape_id, 55), 0xffff);
//debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff04);
debug_write(DBG_DDR_ERR_IDX(apeId, 5), ret);
return -OSP_HW_IRQ;
}
smart_enable_q_nempty(que_id);
/* enable no-empty irq */
for (u8_loop = 0; u8_loop < 8; u8_loop++)
{
ret = smart_enable_q_nempty(que_id);
if (OSP_OK == ret)
{
break;
}
}
debug_write(OSP_DEBUG_POT(g_ape_id, 53), u8_loop);
if (OSP_OK != ret)
{
debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff05);
debug_write(OSP_DEBUG_POT(g_ape_id, 54), ret);
return -OSP_HW_EMPTY_ERR;
}
ret = osp_msg_que_init(que_id);
if (OSP_OK != ret)
{
UCP_PRINT_ERROR("[osp_hw_que_init]: osp_msg_que_init error!!!!!(ape_id = 0x%08x)....\r\n", ape_id);
debug_write(OSP_DEBUG_POT(g_ape_id, 56), 0xffff);
debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff06);
return -OSP_PAR_ILL;
}
debug_write(OSP_DEBUG_POT(g_ape_id, 57), 0x0101);
debug_write(OSP_DEBUG_POT(g_ape_id, 56), 0x0101);
UCP_PRINT_LOG("[osp_hw_que_init]: OK \r\n");

View File

@ -25,6 +25,8 @@ int g_prio_array[TASK_MAX] = {0};
int g_task_id_array[TASK_MAX] = {0};
int *g_tcb_handler_tbl[TASK_MAX] = {NULL};
static uint8_t su8_del_task_err_idx = 0;
#ifdef UCP_TICK_ENABLE
extern osp_msg_tick_info st_tick_info;
#endif
@ -728,6 +730,7 @@ void osp_del_timer_task(int task_id)
{
uint8_t u8_loop = 0;
int task_prio = 0;
int ret = 0;
osp_tcb *tcb_handle = NULL;
/* 通过任务ID找到任务控制块信息 */
@ -747,7 +750,14 @@ void osp_del_timer_task(int task_id)
return ;
}
smart_task_del(task_prio); /* 删除任务 */
ret = smart_task_del(task_prio); /* 删除任务 */
if (OSP_OK != ret)
{
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 47), ret);
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 112+su8_del_task_err_idx), task_prio);
su8_del_task_err_idx = (su8_del_task_err_idx+1)&0xF;
}
g_task_id_array[task_prio] = 0; /* 通过优先级清任务列表 */
g_prio_array[task_id] = 0; /* 通过任务ID清优先级列表 */
FREE((char*)((tcb_handle->stack_down)-4)); /* 释放栈空间 */
@ -788,6 +798,7 @@ void osp_del_task(int prio, int scsId)
uint8_t u8_loop = 0;
int task_id = 0;
int ret = 0;
osp_tcb *tcb_handle = NULL;
task_id = g_task_id_array[prio];
@ -816,7 +827,13 @@ void osp_del_task(int prio, int scsId)
if (OSP_EVENT_TYPE == tcb_handle->task_type)
{
/* 删除任务 */
smart_task_del(prio);
ret = smart_task_del(prio);
if (OSP_OK != ret)
{
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 47), ret);
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 112+su8_del_task_err_idx), prio);
su8_del_task_err_idx = (su8_del_task_err_idx+1)&0xF;
}
/* 事件任务,删除事件信号量和软件队列 */
osp_delete_sem(tcb_handle->event_sem);
@ -825,12 +842,24 @@ void osp_del_task(int prio, int scsId)
else if (OSP_NORMAL_TYPE == tcb_handle->task_type)
{
/* 删除任务 */
smart_task_del(prio);
ret = smart_task_del(prio);
if (OSP_OK != ret)
{
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 47), ret);
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 112+su8_del_task_err_idx), prio);
su8_del_task_err_idx = (su8_del_task_err_idx+1)&0xF;
}
}
else
{
/* 删除任务 */
smart_task_del(prio);
ret = smart_task_del(prio);
if (OSP_OK != ret)
{
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 47), ret);
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 112+su8_del_task_err_idx), prio);
su8_del_task_err_idx = (su8_del_task_err_idx+1)&0xF;
}
/* 其他任务,删除信号量 */
osp_delete_sem(tcb_handle->sem);
@ -873,6 +902,7 @@ void osp_del_task_all(int scs_id)
uint8_t u8_task_id = 0;
uint8_t u8_timer_falg = 0; /*0: no timer task; 1: timer task*/
osp_tcb *tcb_handle = NULL;
int ret = 0;
for (u8_task_loop = 0; u8_task_loop < TASK_MAX; u8_task_loop++)
{
@ -926,7 +956,13 @@ void osp_del_task_all(int scs_id)
g_tcb_handler_tbl[u8_task_id] = NULL;
smart_task_del(u8_task_loop); /* 删除任务 */
ret = smart_task_del(u8_task_loop); /* 删除任务 */
if (OSP_OK != ret)
{
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 47), ret);
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 112+su8_del_task_err_idx), u8_task_loop);
su8_del_task_err_idx = (su8_del_task_err_idx+1)&0xF;
}
debug_write(OSP_DEBUG_POT(g_ape_id, 33), u8_task_id);
}

View File

@ -37,7 +37,7 @@ int32_t ctc_cal_intr_init(void)
//gSpinLockCtcInit.lock_loop_addr = 0xB7FD1430;
//gSpinLockCtcInit.unlock_loop_addr = 0xB7FD1434;
//gSpinLockCtcInit.unlock_addr = 0xB7FD1438;
smart_ddr_spin_lock_init(&gSpinLockCtcInit);
smart_ddr_spinlock_init(&gSpinLockCtcInit);
int32_t ctcIntNum = CTC_CAL_INT_APE0 + apeId;
smart_ddr_spinlock(&gSpinLockCtcInit);

View File

@ -42,7 +42,7 @@ int32_t spu_lib_debug_init(uint8_t core_id)
ret = smart_hq_debug_init((DBG_DDR_HW_ADDR_BASE + core_id*DBG_DDR_HW_LEN), DBG_DDR_HW_LEN); // 推荐384实际512
if (0 != ret)
{
debug_write(DBG_DDR_ERR_IDX(core_id, 32), ret); // ape0: 0xb7e24080
debug_write(DBG_DDR_ERR_IDX(core_id, 46), ret); // ape0: 0xb7e24080
ret_val += 1 << 1;
}

View File

@ -28,7 +28,7 @@ typedef struct ECS_DEBUG_INFO_STRUCT
uint32_t ecs_msg_QutQue_ok;
uint32_t ecs_msg_QueIsEmpty_num;
}ecs_debug_info;
ecs_debug_info g_ecs_debug_info; /* ECS¿¿¿¿¿¿¿¿ */
ecs_debug_info g_ecs_debug_info; /* ecs/pet rfm debug info */
#endif
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
@ -46,14 +46,15 @@ static uint32_t gu32_app_recv_que10 = 0;
static uint32_t gu32_app_recv_que11 = 0;
#endif
ecs_hw_que_info_withirq_t g_ecs_hw_que_info; /* ECS¿¿¿¿¿¿¿¿¿¿¿¿ */
ecs_hw_que_info_noirq_t gst_ecs_hw_que_info_noirq; /* ECS¿¿¿¿¿¿¿¿¿¿¿¿¿ */
ecs_hw_que_info_withirq_t g_ecs_hw_que_info; /* ecs/pet rfm hw_que info with irq */
ecs_hw_que_info_noirq_t gst_ecs_hw_que_info_noirq; /* ecs/pet rfm hw_que info without irq*/
extern void ecs_hw_que_irq(void);
void ecs_hw_que_init(uint8_t core_id)
{
int32_t i32ret = 0;
/* communication init */
do
{
@ -72,6 +73,7 @@ void ecs_hw_que_init_withirq(uint8_t core_id, uint8_t que_id)
int32_t que_used = -1;
int32_t que_cpuid = -1;
int32_t apeId = (int32_t)core_id;
uint8_t u8_loop = 0;
memset(&g_ecs_hw_que_info, 0, sizeof(g_ecs_hw_que_info));
g_ecs_hw_que_info.ecs_hq_id = que_id;
@ -126,7 +128,22 @@ void ecs_hw_que_init_withirq(uint8_t core_id, uint8_t que_id)
return ;
}
debug_write(DBG_DDR_COMMON_IDX(core_id, 30), 0x2);
smart_enable_q_nempty(que_id);
/* enable no-empty irq */
for (u8_loop = 0; u8_loop < 8; u8_loop++)
{
ret = smart_enable_q_nempty(que_id);
if (0 == ret)
{
break;
}
}
debug_write(DBG_DDR_ERR_IDX(core_id, 48), u8_loop);
if (0 != ret)
{
debug_write(DBG_DDR_ERR_IDX(core_id, 49), ret);
return ;
}
debug_write(DBG_DDR_COMMON_IDX(core_id, 30), 0x3);
//ecs_msg_que_init(que_id);
//debug_write(DBG_DDR_COMMON_IDX(core_id, 10), 0x4);

View File

@ -74,7 +74,10 @@ void ucp_nop(uint32_t cycleCnt);
#define DBG_DDR_IRQ_ADDR_BASE (0xB7FC0000)
#define DBG_DDR_IRQ_LEN (0x1000)
#define DBG_DDR_OS_ADDR_BASE (0xB7FCD000)
#define DBG_DDR_OS_LEN (0x400)
#define DBG_DDR_OS_LEN (0x100) //(0x400)
#define DBG_DDR_OS_NO_IDLE_BASE (0xB7FCD800)
#define DBG_DDR_OS_NO_IDLE_LEN (0x100)
#define DBG_DDR_HW_ADDR_BASE (0xB7FD0400)
#define DBG_DDR_HW_LEN (0x200)
#define DBG_DDR_SPIN_ADDR_BASE (0xB7FD1400)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -84,8 +84,8 @@ typedef struct{
unsigned int in_failed_cnt;
unsigned int out_success_cnt;
unsigned int in_success_cnt;
unsigned int in_que_depth_val;
unsigned int out_que_depth_val;
unsigned int in_que_depth_addr;
unsigned int out_que_depth_addr;
}hwq_db_info ;
@ -187,8 +187,9 @@ extern int smart_get_que_info(int queid,int *dep,int *width,int *used,int *cpuid
*/
extern void smart_enable_q_nempty(int queid);
//extern void smart_enable_q_nempty(int queid);
//extern void smart_hq_nempty_int_enable(int queid);
extern int smart_enable_q_nempty(int queid);
/*

View File

@ -45,10 +45,10 @@ typedef struct {
// uint32_t last_irq_num; //0x8a4
uint32_t irq_sys_mask[IRQ_SYS_MASK_NUM]; //0x894 -0x8d0
uint32_t irq_sys_status[IRQ_SYS_MASK_NUM]; //0x8d4 -0x910
uint32_t apc_csu_allpendevent0; //0x914
uint32_t apc_csu_intmaskl; //0x918
uint32_t irq_sys_mask[IRQ_SYS_MASK_NUM]; //0x898 -0x8d4
uint32_t irq_sys_status[IRQ_SYS_MASK_NUM]; //0x8d4 -0x914
uint32_t apc_csu_allpendevent0; //0x918
uint32_t apc_csu_intmaskl; //0x91c
}irq_debug_t;

View File

@ -156,11 +156,14 @@ extern void smart_tick_sleep(int cycle);
smart_task_del
: prio
: int
int
0
使
;
*/
extern void smart_task_del(int prio);
extern int smart_task_del(int prio);
/*****************************************************************
sem relation
@ -203,10 +206,23 @@ extern int smart_sem_post(void *sem);
: void *
0 0
:
******************************************/
extern int smart_sem_del(void *sem);
extern int smart_get_reg_prio(int *buf);
/*
smart_reclaim_init_res
void
*/
extern void smart_reclaim_init_res();
/*
smart_irq_debug_init
debug_base_addr buf
@ -217,9 +233,6 @@ extern int smart_sem_del(void *sem);
*/
extern int smart_get_reg_prio(int *buf);
extern int smart_irq_debug_init(uint32_t debug_base_addr, uint32_t len_bytes);
/*
@ -264,16 +277,30 @@ extern int smart_irq_get_run_cnt(uint32_t irqnum);
/*
smart_os_debug_init
debug_base_addr buf
len_bytes buf
len_bytes buf ,0x40
int
0
0
*/
extern int smart_os_debug_init( uint32_t debug_base_addr, uint32_t len_bytes);
/*
smart_no_idle_sw_init
debug_base_addr buf
lens buf 0x40
int
0
0
,idle
*/
extern int smart_no_idle_sw_init(uint32_t debug_base_addr, uint32_t lens);
#endif

View File

@ -15,7 +15,6 @@ typedef struct{
union
{
unsigned int slock;
};
}spinlock_t;
@ -33,19 +32,34 @@ typedef struct{
typedef struct{
// spin_db_info spin_per_ape[APE_NR];
spin_db_info spin_per_ape;
}spin_debug_t;
typedef struct
{
int lock_addr; //锁物理地址
int flag_addr; // 锁标志物理地址
unsigned int lock_addr; //锁物理地址
unsigned int flag_addr; // 锁标志物理地址
}ddr_spinlock_t;
extern int smart_spinlock_init(int lock_index);
extern void smart_spinlock(int lock_index);
extern void smart_spinunlock(int lock_index);
/*
smart_spin_debug_init
: lock_idx
debug_base_addr
: len_bytes
: int
0
: 0
lock_idx ,buf
len_bytes sizeof(spin_debug_t)
spin_debug_t
*/
extern int smart_spin_debug_init(int lock_idx,unsigned int debug_base_addr, int len_bytes);
@ -73,26 +87,51 @@ extern int smart_get_spinlock_cnt(int lock_idx);
extern int smart_get_unspinlock_cnt(int lock_idx);
extern int smart_ddr_spin_lock_init(ddr_spinlock_t *val);
extern int smart_ddr_spinlock_init(ddr_spinlock_t *val);
extern void smart_ddr_spinlock(ddr_spinlock_t *val);
extern void smart_ddr_spinunlock(ddr_spinlock_t *val);
static inline void smart_ddr_spinlock_irq(ddr_spinlock_t *val)
/*
smart_ddr_spinlock_irq
: val
: ddr_spinlock_t
:
: 使
*/
static inline void smart_ddr_spinlock_irq(ddr_spinlock_t *d_lock)
{
__ucps2_IntEn(f_Disable);
smart_ddr_spinlock(val);
smart_ddr_spinlock(d_lock);
}
static inline void smart_ddr_spinunlock_irqrestore(ddr_spinlock_t *val)
/*
smart_ddr_spinunlock_irqrestore
: d_lock
: ddr_spinlock_t
:
: 使
*/
static inline void smart_ddr_spinunlock_irqrestore(ddr_spinlock_t *d_lock)
{
smart_ddr_spinunlock(val);
smart_ddr_spinunlock(d_lock);
__ucps2_IntEn(f_Enable);
}
/*
smart_spinlock_irq
: lock
: int
:
: 使
*/
static inline void smart_spinlock_irq(int lock)
{
@ -101,6 +140,14 @@ static inline void smart_spinlock_irq(int lock)
}
/*
smart_spinunlock_irqrestore
: d_lock
: int
:
: 使
*/
static inline void smart_spinunlock_irqrestore(int lock)
{
smart_spinunlock(lock);

Binary file not shown.