diff --git a/public/ape_spu/driver/src/ape_mtimer.s.c b/public/ape_spu/driver/src/ape_mtimer.s.c index 15cf056..b613c71 100644 --- a/public/ape_spu/driver/src/ape_mtimer.s.c +++ b/public/ape_spu/driver/src/ape_mtimer.s.c @@ -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 diff --git a/public/ape_spu/driver/src/ape_stc_timer.s.c b/public/ape_spu/driver/src/ape_stc_timer.s.c index b8bc1ad..a07119a 100644 --- a/public/ape_spu/driver/src/ape_stc_timer.s.c +++ b/public/ape_spu/driver/src/ape_stc_timer.s.c @@ -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 diff --git a/public/ape_spu/osp/inc/err_num.h b/public/ape_spu/osp/inc/err_num.h index a366a4a..c771719 100644 --- a/public/ape_spu/osp/inc/err_num.h +++ b/public/ape_spu/osp/inc/err_num.h @@ -1,17 +1,18 @@ #ifndef __ERR_NUM_H__ #define __ERR_NUM_H__ -#define OSP_OK (0) /* 正常返回 */ -#define OSP_PAR_ILL (1) /* 入参错误 */ -#define OSP_PAR_REP (2) /* 入参重复 */ -#define OSP_QUE_FULL (3) /* 软队列满 */ -#define OSP_QUE_EMPT (4) /* 软队列空 */ -#define OSP_MEM_FULL (5) /* 内存申请失败 */ -#define OSP_NO_FILE (6) /* 无对应配置文件 */ -#define OSP_ERROR (7) /* 失败返回 */ -#define OSP_HW_BAND (8) /* 硬件队列绑定失败 */ -#define OSP_HW_VECT (9) /* 硬件队列获取中断号失败 */ -#define OSP_HW_IRQ (10) /* 硬件队列注册中断服务失败 */ +#define OSP_OK (0) /* 正常返回 */ +#define OSP_PAR_ILL (1) /* 入参错误 */ +#define OSP_PAR_REP (2) /* 入参重复 */ +#define OSP_QUE_FULL (3) /* 软队列满 */ +#define OSP_QUE_EMPT (4) /* 软队列空 */ +#define OSP_MEM_FULL (5) /* 内存申请失败 */ +#define OSP_NO_FILE (6) /* 无对应配置文件 */ +#define OSP_ERROR (7) /* 失败返回 */ +#define OSP_HW_BAND (8) /* 硬件队列绑定失败 */ +#define OSP_HW_VECT (9) /* 硬件队列获取中断号失败 */ +#define OSP_HW_IRQ (10) /* 硬件队列注册中断服务失败 */ +#define OSP_HW_EMPTY_ERR (11) /* 硬件队列非空中断使能失败 */ #endif diff --git a/public/ape_spu/osp/src/osp_init.s.c b/public/ape_spu/osp/src/osp_init.s.c index f398d9e..16ca957 100644 --- a/public/ape_spu/osp/src/osp_init.s.c +++ b/public/ape_spu/osp/src/osp_init.s.c @@ -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); } diff --git a/public/ape_spu/osp/src/osp_msg.s.c b/public/ape_spu/osp/src/osp_msg.s.c index 83c0ad9..624ee14 100644 --- a/public/ape_spu/osp/src/osp_msg.s.c +++ b/public/ape_spu/osp/src/osp_msg.s.c @@ -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"); diff --git a/public/ape_spu/osp/src/osp_sem.s.c b/public/ape_spu/osp/src/osp_sem.s.c index 7a21b82..d97da37 100644 --- a/public/ape_spu/osp/src/osp_sem.s.c +++ b/public/ape_spu/osp/src/osp_sem.s.c @@ -59,15 +59,15 @@ void osp_post_sem(sem_t *sem) void osp_delete_sem(sem_t *sem) { - int ret = 0; - int apeId = get_core_id(); + int ret = 0; + int apeId = get_core_id(); if (NULL != sem) { ret = smart_sem_del(sem); - if (0 != ret) - { - debug_write(DBG_DDR_ERR_IDX(apeId, 30), ret); - } + if (0 != ret) + { + debug_write(DBG_DDR_ERR_IDX(apeId, 30), ret); + } } else { diff --git a/public/ape_spu/osp/src/osp_task.s.c b/public/ape_spu/osp/src/osp_task.s.c index 18ccf42..584e2f2 100644 --- a/public/ape_spu/osp/src/osp_task.s.c +++ b/public/ape_spu/osp/src/osp_task.s.c @@ -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 @@ -726,8 +728,9 @@ alloc_stack_failed: void osp_del_timer_task(int task_id) { - uint8_t u8_loop = 0; - int task_prio = 0; + 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); } diff --git a/public/common/driver/src/ctc_intr.s.c b/public/common/driver/src/ctc_intr.s.c index 67d19ac..f8f3663 100644 --- a/public/common/driver/src/ctc_intr.s.c +++ b/public/common/driver/src/ctc_intr.s.c @@ -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); diff --git a/public/common/platform/src/lib_debug_init.s.c b/public/common/platform/src/lib_debug_init.s.c index 27d5c3e..6736e89 100644 --- a/public/common/platform/src/lib_debug_init.s.c +++ b/public/common/platform/src/lib_debug_init.s.c @@ -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; } diff --git a/public/common/platform/src/spu_hw_queue.s.c b/public/common/platform/src/spu_hw_queue.s.c index 49d0b45..a59d15c 100644 --- a/public/common/platform/src/spu_hw_queue.s.c +++ b/public/common/platform/src/spu_hw_queue.s.c @@ -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,15 +46,16 @@ 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 */ + + /* communication init */ do { i32ret = smart_hq_init(core_id); @@ -71,7 +72,8 @@ void ecs_hw_que_init_withirq(uint8_t core_id, uint8_t que_id) int32_t que_width = -1; int32_t que_used = -1; int32_t que_cpuid = -1; - int32_t apeId = (int32_t)core_id; + 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); diff --git a/public/common/utility/inc/ucp_utility.h b/public/common/utility/inc/ucp_utility.h index b7633a7..4ba845a 100644 --- a/public/common/utility/inc/ucp_utility.h +++ b/public/common/utility/inc/ucp_utility.h @@ -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) diff --git a/public/rtos/ape_spu/libsmartos.a b/public/rtos/ape_spu/libsmartos.a index d2a500d..25e7609 100644 Binary files a/public/rtos/ape_spu/libsmartos.a and b/public/rtos/ape_spu/libsmartos.a differ diff --git a/public/rtos/common/libhwque.a b/public/rtos/common/libhwque.a index 243408a..8752bd5 100644 Binary files a/public/rtos/common/libhwque.a and b/public/rtos/common/libhwque.a differ diff --git a/public/rtos/common/libspinlock.a b/public/rtos/common/libspinlock.a index 86d0c14..ec5c4a8 100644 Binary files a/public/rtos/common/libspinlock.a and b/public/rtos/common/libspinlock.a differ diff --git a/public/rtos/inc/hwque.h b/public/rtos/inc/hwque.h index 076b7b2..6c80494 100644 --- a/public/rtos/inc/hwque.h +++ b/public/rtos/inc/hwque.h @@ -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); /* diff --git a/public/rtos/inc/inter_vector.h b/public/rtos/inc/inter_vector.h index 8026396..93ba5c3 100644 --- a/public/rtos/inc/inter_vector.h +++ b/public/rtos/inc/inter_vector.h @@ -45,103 +45,103 @@ 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; /* - 函数名称:smart_irq_request - 输入参数: vector - 输入参数:func - 返回类型: int - 返回值: 小于0 表示失败 - 返回值: 0 表示成功 - 函数功能: 中断注册接口 + 函数名称:smart_irq_request + 输入参数: vector + 输入参数:func + 返回类型: int + 返回值: 小于0 表示失败 + 返回值: 0 表示成功 + 函数功能: 中断注册接口 */ extern int smart_irq_request(uint32_t vector,irq_handler func); /* - 函数名称:smart_irq_enable - 输入参数: vector - 返回类型: int - 返回值: 小于0 表示失败 - 返回值: 0 表示成功 - 函数功能: 中断使能接口 + 函数名称:smart_irq_enable + 输入参数: vector + 返回类型: int + 返回值: 小于0 表示失败 + 返回值: 0 表示成功 + 函数功能: 中断使能接口 */ extern int smart_irq_enable(uint32_t vector); /* - 函数名称:smart_irq_disable - 输入参数: vector - 返回类型: int - 返回值: 小于0 表示失败 - 返回值: 0 表示成功 - 函数功能: 中断去使能接口 + 函数名称:smart_irq_disable + 输入参数: vector + 返回类型: int + 返回值: 小于0 表示失败 + 返回值: 0 表示成功 + 函数功能: 中断去使能接口 */ extern int smart_irq_disable(uint32_t vector); /* - 函数名称:smart_irq_debug_init - 输入参数: debug_base_addr - 输入参数:len_bytes - 返回类型: int - 返回值: 小于0 表示失败 - 返回值: 0 表示成功 - 函数功能: 中断调试接口, - 注意: - 通过地址与,长度指定相应的buf 数据空间,存放相应的中断调试信息。 - 这些调试信息已经格式化,地址由用户指定,len_bytes 不能小于sizeof(irq_debug_t) - 数据格式化内容是 irq_debug_t + 函数名称:smart_irq_debug_init + 输入参数: debug_base_addr + 输入参数:len_bytes + 返回类型: int + 返回值: 小于0 表示失败 + 返回值: 0 表示成功 + 函数功能: 中断调试接口, + 注意: + 通过地址与,长度指定相应的buf 数据空间,存放相应的中断调试信息。 + 这些调试信息已经格式化,地址由用户指定,len_bytes 不能小于sizeof(irq_debug_t) + 数据格式化内容是 irq_debug_t */ extern int smart_irq_debug_init(uint32_t debug_base_addr, uint32_t len_bytes); /* - 函数名称:smart_irq_get_type_cnt - 输入参数: num_type - 返回类型: int - 返回值: 0 表示当前type 类型计数为0 - 返回值: 非0 表示当前type 类型有计数 - 函数功能: 获取某种中断计数 + 函数名称:smart_irq_get_type_cnt + 输入参数: num_type + 返回类型: int + 返回值: 0 表示当前type 类型计数为0 + 返回值: 非0 表示当前type 类型有计数 + 函数功能: 获取某种中断计数 */ extern uint32_t smart_irq_get_type_cnt(irq_cnt_type_t num_type); /* - 函数名称:smart_irq_get_run_cnt - 输入参数: irq_num:中断号 - 返回类型: int - 返回值: 小于0 表示获取失败。输入参数有问题 - 返回值: 为0 表示相应中断没有触发 - 返回值: 非0 表示中断产生的次数 - 函数功能:获取相应中断号的中断计数 + 函数名称:smart_irq_get_run_cnt + 输入参数: irq_num:中断号 + 返回类型: int + 返回值: 小于0 表示获取失败。输入参数有问题 + 返回值: 为0 表示相应中断没有触发 + 返回值: 非0 表示中断产生的次数 + 函数功能:获取相应中断号的中断计数 */ extern int smart_irq_get_run_cnt(uint32_t irqnum); /* - 函数名称:smart_get_cpuid - 输入参数: 无 - 返回类型: int - 返回值: 当前的cpuid 号 - 函数功能:获取当前核cpuid 号 + 函数名称:smart_get_cpuid + 输入参数: 无 + 返回类型: int + 返回值: 当前的cpuid 号 + 函数功能:获取当前核cpuid 号 */ extern int smart_get_cpuid(); /* - 函数名称:smart_irq_init - 输入参数: cpuid - 返回类型: int - 返回值: 非0 初始化失败 - 函数功能:中断初始化 + 函数名称:smart_irq_init + 输入参数: cpuid + 返回类型: int + 返回值: 非0 初始化失败 + 函数功能:中断初始化 */ extern int smart_irq_init(int cpuid); diff --git a/public/rtos/inc/smartos.h b/public/rtos/inc/smartos.h index 1d5927b..859a5b9 100644 --- a/public/rtos/inc/smartos.h +++ b/public/rtos/inc/smartos.h @@ -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 diff --git a/public/rtos/inc/spinlock.h b/public/rtos/inc/spinlock.h index c3be272..1311cb2 100644 --- a/public/rtos/inc/spinlock.h +++ b/public/rtos/inc/spinlock.h @@ -14,38 +14,52 @@ typedef enum typedef struct{ union { - unsigned int slock; - + unsigned int slock; }; }spinlock_t; #define APE_NR 12 typedef struct{ - unsigned int spinlock_count; - unsigned int unspinlock_count; - unsigned int spinlock_loop; + unsigned int spinlock_count; + unsigned int unspinlock_count; + unsigned int spinlock_loop; unsigned int g_spin_count; // unsigned int unspinlock_loop; }spin_db_info ; typedef struct{ -// spin_db_info spin_per_ape[APE_NR]; - spin_db_info spin_per_ape; - + // 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); diff --git a/public/rtos/rfm_spu/libinterrupt.a b/public/rtos/rfm_spu/libinterrupt.a index 0049d47..8e0d988 100644 Binary files a/public/rtos/rfm_spu/libinterrupt.a and b/public/rtos/rfm_spu/libinterrupt.a differ