1. update Feature Enhancement#1353 to dev_ck_v2.1
2. update Feature Enhancement#1360 to dev_ck_v2.1 3. add test macro: OSP_DEBUG_TEST 4. TASK_MAX: 64 --> 20 (task num and timer task num) 5. one slot supports max 20 tasks 6. TEST: 6.1 spu(case0)+arm(case0): pass 6.2 spu(case14)+arm(case20): pass 6.3 spu(case20)+arm(case20): pass 6.4 spu(case21)+arm(case21): pass 6.5 spu(case34)+arm(case5): pass 6.6 spu(case44)+arm(case5): pass
This commit is contained in:
parent
f1401c2ae6
commit
4da71189f9
@ -6,8 +6,8 @@
|
||||
#define APE_CFG_FILE_NAME_LEN (64)
|
||||
#define APE_CFG_FILE_NUM (64)
|
||||
|
||||
#define OSP_CFG_FLAG_START (0xB0B0B0B0) /* 默认Flag,表示等待读配置文件 */
|
||||
#define OSP_CFG_PHY_ADDR (0x10400000) /* 根据内存规划分配 */
|
||||
#define OSP_CFG_FLAG_START (0xB0B0B0B0) /* 默认Flag,表示等待读配置文件 */
|
||||
#define OSP_CFG_PHY_ADDR (0x10400000) /* 根据内存规划分配 */
|
||||
|
||||
typedef struct tag_osp_file_reg{
|
||||
char name[APE_CFG_FILE_NAME_LEN];
|
||||
@ -20,5 +20,5 @@ extern int osp_cfgfile_init(void);
|
||||
extern void osp_cfgfile_rev(osp_file_reg *head, int num);
|
||||
extern int osp_cfgfile_read();
|
||||
|
||||
#endif
|
||||
#endif /* __OSP_CFGFILE_H__ */
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
#ifndef __OSP_HEAP__
|
||||
#define __OSP_HEAP__
|
||||
|
||||
#if 0
|
||||
extern int8_t osp_heap_mem_init(uint32_t addr, uint32_t size);
|
||||
extern char *osp_heap_malloc(uint32_t size);
|
||||
extern void osp_heap_free(char *p);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __OSP_HEAP__ */
|
||||
|
||||
|
@ -7,12 +7,8 @@ typedef struct tag_osp_im_mem_reg{
|
||||
}osp_im_mem_reg;
|
||||
|
||||
extern char *osp_malloc(int size);
|
||||
extern void osp_free(char *p);
|
||||
extern void osp_heapmem_test(void);
|
||||
extern int osp_mem_init(void);
|
||||
extern int osp_show_im_mem_by_coreid(uint8_t core_id);
|
||||
|
||||
//extern uint32_t osp_get_ddr_mem(void);
|
||||
extern void osp_free(char *p);
|
||||
extern int osp_mem_init(void);
|
||||
|
||||
/*
|
||||
实际IM的地址空间:0x0000 0000 -- 0x0003 FFFF,共256K
|
||||
@ -21,5 +17,5 @@ extern int osp_show_im_mem_by_coreid(uint8_t core_id);
|
||||
//#define OSP_MEM_POOL_START (0x00020000) /* 平台内存管理的空间在IM内存空间 */
|
||||
#define OSP_MEM_POOL_SIZE (0x00009400) /* 平台可分配的IM内存空间大小[32K(任务栈)+5K(配置文件4K+预留1K)=37K] */
|
||||
|
||||
#endif
|
||||
#endif /* __OSP_MEM_H__ */
|
||||
|
||||
|
@ -23,7 +23,7 @@ void osp_show_msg_dbg_info_by_taskid(uint8_t taskid);
|
||||
void osp_show_msg_dbg_info_by_coreid_taskid(uint8_t coreid, uint8_t taskid);
|
||||
#endif /* UCP_OSP_DBG_HW_CNT_ENABLE */
|
||||
|
||||
#endif
|
||||
#endif /* OSP_MSG_DBG_ENABLE */
|
||||
|
||||
/* 消息类型 */
|
||||
typedef enum OSP_MSG_TYPE
|
||||
@ -102,5 +102,5 @@ extern void osp_get_hw_que_cnt(uint32_t *pu32irq_cnt, uint32_t *pu32irq_ok, uint
|
||||
|
||||
extern void osp_show_msg_info(void);
|
||||
|
||||
#endif
|
||||
#endif /* __OSP_MSG_H__ */
|
||||
|
||||
|
@ -3,24 +3,13 @@
|
||||
|
||||
#include "osp_msg.h"
|
||||
|
||||
#if 0
|
||||
typedef struct osp_sw_queue_msg_struct{
|
||||
int idx:16;
|
||||
int pool_id:16;
|
||||
}osp_sw_q_msg_st;
|
||||
#endif
|
||||
|
||||
#define OSP_QUE_DEP (32)
|
||||
#define OSP_QUE_SIZE (4)//(OSP_MSG_HEAD_LEN) //(16)
|
||||
#define OSP_QUE_SIZE (4) //(OSP_MSG_HEAD_LEN) //(16)
|
||||
|
||||
typedef struct osp_ape_que_info_struct
|
||||
{
|
||||
uint32_t enque_idx; /*osp_sw_enque idx*/
|
||||
uint32_t deque_idx; /*osp_sw_deque idx*/
|
||||
//uint32_t Dep; /*que depth */
|
||||
//uint32_t Rev0;
|
||||
//uint32_t CurNum; /*current free num */
|
||||
//uint32_t Rev[3];
|
||||
uint32_t enque_count;
|
||||
uint32_t deque_count;
|
||||
uint32_t full_count;
|
||||
@ -34,5 +23,5 @@ extern int osp_sw_queue_int(osp_sw_queue *p_sw_queue_head);
|
||||
extern int osp_sw_deque(osp_msg_head **pmsg_head, osp_sw_queue *que);
|
||||
extern int osp_sw_enque(osp_msg_head *pmsg_head, osp_sw_queue *que);
|
||||
|
||||
#endif
|
||||
#endif /* __OSP_SW_QUEUE_H__ */
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
#include "osp_type_def.h"
|
||||
#include "osp_sw_queue.h"
|
||||
|
||||
#define TASK_MAX (64)
|
||||
#define TASK_MAX (20) //(64) /* IM优化,单核最多任务个数:20个 */
|
||||
#define TASK_ID_MAX (64)
|
||||
#define PRIO_MIN (64)
|
||||
#define M_STACK_SIZE (8192)
|
||||
#define TOP_VALUE0 (0x242424bd)
|
||||
@ -73,16 +74,15 @@ typedef struct OSP_TASK_INFO_EX
|
||||
OSP_TASKENTRY_FUNC task_entry; /* 任务循环体 */
|
||||
}osp_task_info_ex;
|
||||
|
||||
extern int g_task_id_array[TASK_MAX];
|
||||
extern int g_cur_task_id;
|
||||
extern int g_task_id_array[TASK_ID_MAX];
|
||||
extern int g_task_id_table[TASK_MAX];
|
||||
extern uint8_t g_taskid_num;
|
||||
extern int *g_tcb_handler_tbl[TASK_MAX];
|
||||
extern int *g_tcb_handler_tbl[TASK_ID_MAX];
|
||||
|
||||
#define TCB_GET(id) (g_tcb_handler_tbl[id])
|
||||
|
||||
typedef struct osp_task_ext_com_struct{
|
||||
uint32_t end_flag; /* 0xffff --> end */
|
||||
uint32_t end_flag; /* 0xffff --> end */
|
||||
uint32_t task_id; // 任务ID(全局统一定义)
|
||||
uint32_t task_type; // 任务类型
|
||||
uint32_t sem_value; // 信号量(事件触发型需要)
|
||||
@ -131,5 +131,5 @@ extern int osp_get_cur_task_id();
|
||||
extern uint8_t osp_task_id_is_true(int task_id);
|
||||
extern void osp_show_task_info(void);
|
||||
|
||||
#endif
|
||||
#endif /* __OSP_TASK_H__ */
|
||||
|
||||
|
@ -4,11 +4,9 @@
|
||||
#include "osp_type_def.h"
|
||||
#include "stc_timer.h"
|
||||
|
||||
#define OSP_TIMER_TASK_MAX (64)
|
||||
#define OSP_TIMER_TASK_MAX (20) //(64) /* IM优化,单核最多定时点任务个数:20个 */
|
||||
#define OSP_TIMER_COUNTS (OSP_TIMER_TASK_MAX -1)
|
||||
#define OSP_TMR_POINT_MAX TDD_TMR_POINT_MAX
|
||||
|
||||
extern void stc_timer_set_tmrpoint(stStcTimerPoint *pTmrPoint);
|
||||
#define OSP_TMR_POINT_MAX (TDD_TMR_POINT_MAX)
|
||||
|
||||
/* 静态定时点注册信息结构体 */
|
||||
typedef struct osp_timer_cfg_inf_st{
|
||||
@ -36,18 +34,15 @@ typedef struct osp_id_timer_st{
|
||||
char task_id;
|
||||
}osp_id_timer_t;
|
||||
|
||||
extern int g_osp_timer_desc_idx; /* OSP侧任务模块注册定时点任务时,需要记录 */
|
||||
extern osp_timer_desc g_osp_timer_desc[64]; /* OSP侧任务模块注册定时点任务时,需要记录 */
|
||||
extern int g_osp_timer_desc_idx; /* OSP侧任务模块注册定时点任务时,需要记录 */
|
||||
extern osp_timer_desc g_osp_timer_desc[OSP_TIMER_TASK_MAX]; /* OSP侧任务模块注册定时点任务时,需要记录 */
|
||||
|
||||
extern void osp_timer_init(void); /* 初始化 */
|
||||
extern void osp_timer_sync(int scsId);/* 定时点任务设置完毕,启动 */
|
||||
extern void osp_timer_unsync(int scsId);/* 删除定时点任务配置信息和设置,删除任务 */
|
||||
extern void osp_timer_sync(int scsId); /* 定时点任务设置完毕,启动 */
|
||||
extern void osp_timer_unsync(int scsId); /* 删除定时点任务配置信息和设置,删除任务 */
|
||||
extern void osp_timer_unsync_notask(int scs_id); /* 只清空定时点配置信息和设备,未删除任务 */
|
||||
//extern void osp_timer_clear_task(); /* 清除所有定时点任务 */
|
||||
//extern void osp_timer_clear_stctimer(); /* 清除STC timer的设置 */
|
||||
extern void osp_timer_call_task(); /* 顺序触发定时点任务 */
|
||||
//extern void osp_timer_restart(void); /* 定时点任务从首位开始 */
|
||||
extern void osp_timer_call_task_spe(uint8_t u8slot, uint8_t u8taskidx); /* 指定触发某定时点任务 */
|
||||
|
||||
#endif
|
||||
#endif /* __OSP_TIMER_H__ */
|
||||
|
||||
|
@ -8,9 +8,6 @@ extern int g_ape_id;
|
||||
typedef unsigned int UINTPTR;
|
||||
typedef void sem_t;
|
||||
|
||||
//#define NULLPTR (void *)(0)
|
||||
#define MALLOC osp_malloc
|
||||
#define FREE osp_free
|
||||
#define STRCPY strcpy
|
||||
|
||||
#define OSP_NELEMENTS(x) ((sizeof(x)/sizeof((x)[0])))
|
||||
@ -18,28 +15,10 @@ typedef void sem_t;
|
||||
#define OS_ENTER_CRITICAL() smart_int_disable()
|
||||
#define OS_EXIT_CRITICAL() smart_int_enable()
|
||||
|
||||
#define OSP_DEBUG_TEST
|
||||
|
||||
#define OSP_DEBUG_POT(ape_id, idx) (DBG_DDR_IDX_OSP_BASE + (ape_id*240) + idx)
|
||||
#define OSP2_DEBUG_POT(ape_id, idx) (DBG_DDR_IDX_OSP2_BASE + (ape_id*1024) + idx)
|
||||
|
||||
#if 0
|
||||
#define CMD_DEBUG_LEVEL (0)
|
||||
#define ERR_DEBUG_LEVEL (1)
|
||||
#define WARNING_DEBUG_LEVEL (2)
|
||||
#define RUN_DEBUG_LEVEL (3)
|
||||
#define DBG_DEBUG_LEVEL (4)
|
||||
|
||||
#define PLOAD_EX_W(ptr) __ucps2_load_ext_mem((char*)ptr, f_W)
|
||||
#define PLOAD_EX_S(ptr) __ucps2_load_ext_mem((char*)ptr, f_S)
|
||||
#define PLOAD_EX_B(ptr) __ucps2_load_ext_mem((char*)ptr, f_B)
|
||||
|
||||
#define PLOAD_EX_V_W(ptr) __ucps2_load_ext_mem_v((char*)ptr, f_W)
|
||||
#define PLOAD_EX_V_S(ptr) __ucps2_load_ext_mem_v((char*)ptr, f_S)
|
||||
#define PLOAD_EX_V_B(ptr) __ucps2_load_ext_mem_v((char*)ptr, f_B)
|
||||
|
||||
#define PSTORE_EX_W(ptr, value) __ucps2_store_ext_mem((char*)ptr, value, f_W)
|
||||
#define PSTORE_EX_S(ptr, value) __ucps2_store_ext_mem((char*)ptr, value, f_S)
|
||||
#define PSTORE_EX_B(ptr, value) __ucps2_store_ext_mem((char*)ptr, value, f_B)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* __OSP_TYPE_DEF_H__ */
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
#define OSP_CFG_FILE_ADDR (OSP_CFG_INFO_ADDR + OSP_CFG_INFO_SIZE) /* 配置文件的地址 */
|
||||
#define OSP_CFG_FILE_SIZE (OSP_CFG_PHY_SIZE - OSP_CFG_INFO_SIZE - OSP_CFG_OFFSET) /* 配置文件的总大小 */
|
||||
|
||||
osp_file_reg *g_cfgfile_head = NULL;/* 配置文件 */
|
||||
int g_cfgfile_num = 0; /* 配置文件个数 */
|
||||
osp_file_reg *g_cfgfile_head = NULL; /* 配置文件 */
|
||||
int8_t g_cfgfile_num = 0; /* 配置文件个数 */
|
||||
|
||||
int osp_get_cfgfile(char* name, uint32_t *pbuf, int* psize)
|
||||
{
|
||||
@ -61,14 +61,15 @@ int osp_get_cfgfile(char* name, uint32_t *pbuf, int* psize)
|
||||
{
|
||||
*pbuf = head->phy_addr;
|
||||
*psize = head->len;
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 105), head->len);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 106), head->phy_addr);
|
||||
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
#endif
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
rdmcycle(&clockEnd);
|
||||
clockCnt = clockEnd - clockBegin;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 204), clockCnt);
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -77,6 +78,7 @@ int osp_get_cfgfile(char* name, uint32_t *pbuf, int* psize)
|
||||
clockCnt = clockEnd - clockBegin;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 204), clockCnt);
|
||||
#endif
|
||||
|
||||
return -(OSP_NO_FILE);
|
||||
}
|
||||
|
||||
@ -87,8 +89,10 @@ void osp_cfgfile_rev(osp_file_reg *head, int num)
|
||||
memcpy_ucp((g_cfgfile_head+g_cfgfile_num), (head), sizeof(osp_file_reg) * num);
|
||||
//memcpy(g_cfgfile_head+g_cfgfile_num, head, sizeof(osp_file_reg) * num);
|
||||
g_cfgfile_num += num;
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 103), g_cfgfile_head->len);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 104), g_cfgfile_head->phy_addr);
|
||||
#endif
|
||||
|
||||
return;
|
||||
}
|
||||
@ -103,8 +107,9 @@ int osp_cfgfile_read()
|
||||
osp_file_reg *head = NULL;
|
||||
|
||||
cfg_flag = do_read_volatile(OSP_CFG_PHY_ADDR);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 101), cfg_flag);
|
||||
|
||||
#endif
|
||||
if (OSP_CFG_FLAG_OK != cfg_flag)
|
||||
{
|
||||
UCP_PRINT_ERROR("osp_cfgfile_read flag[0x%x]", cfg_flag);
|
||||
@ -113,7 +118,9 @@ int osp_cfgfile_read()
|
||||
|
||||
cfg_num = do_read_volatile(OSP_CFG_PHY_ADDR + OSP_CFG_NUM);
|
||||
UCP_PRINT_LOG("cfg_num = %x\r\n", cfg_num);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 102), cfg_num);
|
||||
#endif
|
||||
head = (osp_file_reg*)(OSP_CFG_INFO_ADDR);
|
||||
|
||||
if(0 != cfg_num)
|
||||
@ -124,7 +131,6 @@ int osp_cfgfile_read()
|
||||
return OSP_OK;
|
||||
}
|
||||
|
||||
|
||||
/* 配置文件模块初始化函数 */
|
||||
int osp_cfgfile_init(void)
|
||||
{
|
||||
@ -135,7 +141,8 @@ int osp_cfgfile_init(void)
|
||||
return -OSP_MEM_FULL;
|
||||
}
|
||||
|
||||
memset(g_cfgfile_head, 0, sizeof(osp_file_reg) * APE_CFG_FILE_NUM);
|
||||
memset(g_cfgfile_head, 0, (sizeof(osp_file_reg) * APE_CFG_FILE_NUM));
|
||||
g_cfgfile_num = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "osp_heap.h"
|
||||
#include "smartos.h"
|
||||
|
||||
#if 0
|
||||
#define DDR_ALIGN(x, align) (((unsigned int)(x)+(align -1))&~(align-1))
|
||||
|
||||
typedef struct DoubleLinkNode
|
||||
@ -15,8 +16,8 @@ typedef struct DoubleLinkNode
|
||||
struct DoubleLinkNode *next;
|
||||
}osp_heap_node;
|
||||
|
||||
#define OSP_HEAP_NODE_SIZE sizeof(osp_heap_node)
|
||||
#define OSP_HEAP_BUF_TO_HEAD(pbuf) (osp_heap_node *)((UINTPTR)pbuf - OSP_HEAP_NODE_SIZE)
|
||||
#define OSP_HEAP_NODE_SIZE sizeof(osp_heap_node)
|
||||
#define OSP_HEAP_BUF_TO_HEAD(pbuf) (osp_heap_node *)((UINTPTR)pbuf - OSP_HEAP_NODE_SIZE)
|
||||
|
||||
typedef struct heap_mem
|
||||
{
|
||||
@ -269,3 +270,5 @@ void osp_heap_free(char *p)
|
||||
return ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -26,9 +26,6 @@ extern void phy_init();
|
||||
extern void tod_int_init();
|
||||
extern void spu_shell_task(void);
|
||||
extern int osp_shell_init(void);
|
||||
//extern uint32_t osp_task_timer_cfg(osp_timer_cfg_inf *timer_tbl, int apeid);
|
||||
//extern void shellMain(void* data);
|
||||
//extern void cpri_drv_10ms_task();
|
||||
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
extern osp_msg_tick_info st_tick_info;
|
||||
@ -139,7 +136,6 @@ void osp_ape_loop_test_task(void* data)
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
osp_task_inf g_osp_task_inf_tb[] =
|
||||
{
|
||||
{1, 20, (int8_t*)"osp_recv", 20, osp_ape_loop_test_init, osp_ape_loop_test_task, 2048},
|
||||
@ -166,7 +162,9 @@ static uint32_t gu32OpsHeartbeatCnt = 0;
|
||||
void osp_heartbeat_task(void)
|
||||
{
|
||||
gu32OpsHeartbeatCnt++;
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 15), gu32OpsHeartbeatCnt);
|
||||
#endif
|
||||
heart_beat_write();
|
||||
return ;
|
||||
}
|
||||
@ -194,8 +192,9 @@ void osp_init()
|
||||
UCP_PRINT_ERROR("osp_hw_que_init failed\r\n");
|
||||
return ;
|
||||
}
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 0), 1);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 0), ++flag); //0x1
|
||||
#endif
|
||||
|
||||
/* 内存模块初始化 */
|
||||
ret = osp_mem_init(); /* 根据讨论平台侧可使用的内存为IM区域 */
|
||||
@ -203,32 +202,38 @@ void osp_init()
|
||||
UCP_PRINT_ERROR("osp_mem_init failed\r\n");
|
||||
return ;
|
||||
}
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 0), ++flag); //0x2
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 1), 2);
|
||||
UCP_PRINT_LOG("osp_mem_init OK\r\n");
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 0), ++flag); //0x2
|
||||
#endif
|
||||
|
||||
/* 配置文件模块初始化 */
|
||||
osp_cfgfile_init();
|
||||
UCP_PRINT_LOG("osp_cfgfile_init OK\r\n");
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 2), 3);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 0), ++flag); //0x3
|
||||
#endif
|
||||
|
||||
/* 任务模块初始化 */
|
||||
osp_task_init();
|
||||
UCP_PRINT_LOG("osp_task_init OK\r\n");
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 3), 4);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 0), ++flag); //0x4
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* DDR二次管理 */
|
||||
//osp_heap_mem_init(OSP_PHY_DDR_ADDR, OSP_PHY_DDR_SIZE);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 0), ++flag); //0x5
|
||||
#endif
|
||||
|
||||
/* Msg init */
|
||||
spu_shell_init();
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 0), ++flag); //0x5
|
||||
#endif
|
||||
|
||||
osp_task_info_ex ape_shell_recv = {56, (int8_t*)"ape_shell_task", 56, 4096, OSP_NORMAL_TYPE, 1, 0, 0, NULL, (OSP_TASKENTRY_FUNC)spu_shell_task};
|
||||
//printf("osp shell ok\r\n");
|
||||
|
||||
/* 平台任务注册 */
|
||||
osp_task_create(&ape_shell_recv);
|
||||
@ -241,13 +246,16 @@ void osp_init()
|
||||
|
||||
//osp_task_reg(g_osp_task_inf_tb, g_osp_task_ext_tb, g_ape_id);
|
||||
|
||||
#if 0
|
||||
/* 握手完成,ARM侧已经读完配置文件,APE侧取文件 */
|
||||
//osp_cfgfile_read();
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 4), 5);
|
||||
#endif
|
||||
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 0), ++flag); //0x6
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 4), 5);
|
||||
UCP_PRINT_LOG("osp_init done \r\n");
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 0), ++flag); //0x6
|
||||
#endif
|
||||
|
||||
return ;
|
||||
}
|
||||
@ -288,9 +296,11 @@ void osp_var_init()
|
||||
{
|
||||
/* 设置配置文件标识位 */
|
||||
do_write(OSP_CFG_PHY_ADDR, OSP_CFG_FLAG_START);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(get_core_id(), 100), OSP_CFG_FLAG_START);
|
||||
|
||||
#endif
|
||||
__ucps2_synch(0);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,6 @@
|
||||
|
||||
#define OSP_MEM_IM_FLAG (0x121212ef)
|
||||
|
||||
//osp_im_mem_reg g_ddr_mem_res;
|
||||
|
||||
typedef struct osp_double_link_node_struct
|
||||
{
|
||||
int len;
|
||||
@ -24,19 +22,22 @@ typedef struct osp_double_link_node_struct
|
||||
struct osp_double_link_node_struct *next;
|
||||
}osp_mem_node;
|
||||
|
||||
#define OSP_NODE_SIZE sizeof(osp_mem_node)
|
||||
#define OSP_MEM_BUF_TO_HEAD(pbuf) (osp_mem_node *)((UINTPTR)pbuf - OSP_NODE_SIZE)
|
||||
#define OSP_NODE_SIZE sizeof(osp_mem_node)
|
||||
#define OSP_MEM_BUF_TO_HEAD(pbuf) (osp_mem_node *)((UINTPTR)pbuf - OSP_NODE_SIZE)
|
||||
|
||||
typedef struct osp_mem_cb
|
||||
{
|
||||
osp_mem_node *root;
|
||||
osp_mem_node *cur_avaliable;
|
||||
}osp_mem_cb;
|
||||
|
||||
#define OSP_MEM_CB_SIZE sizeof(osp_mem_cb)
|
||||
|
||||
//static osp_mem_node *g_osp_mem_im_head = NULLPTR;
|
||||
osp_mem_cb g_st_osp_mem_im_head;
|
||||
|
||||
extern int osp_show_im_mem_by_coreid(uint8_t core_id);
|
||||
|
||||
/*
|
||||
函数功能:查找内存节点
|
||||
从内存节点查看剩余空间是否还够分配
|
||||
@ -155,7 +156,9 @@ int osp_mem_init(void)
|
||||
if (NULL == g_st_osp_mem_im_head.root)
|
||||
{
|
||||
UCP_PRINT_LOG("osp_mem_init malloc error.\r\n");
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 8), 0xFFFFEEEE);
|
||||
#endif
|
||||
return -OSP_ERROR;
|
||||
}
|
||||
g_st_osp_mem_im_head.root->len = (OSP_MEM_POOL_SIZE - OSP_MEM_CB_SIZE - OSP_NODE_SIZE);
|
||||
@ -164,8 +167,11 @@ int osp_mem_init(void)
|
||||
g_st_osp_mem_im_head.root->next = NULL;
|
||||
g_st_osp_mem_im_head.root->prev = NULL;
|
||||
g_st_osp_mem_im_head.cur_avaliable = g_st_osp_mem_im_head.root;
|
||||
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 9), g_st_osp_mem_im_head.root->len);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 10), g_st_osp_mem_im_head.root);
|
||||
#endif
|
||||
|
||||
spu_insert_cmd_ext("im_ape_id", (OSP_FUNCPTR)osp_show_im_mem_by_coreid, "osp im info by id", 1);
|
||||
|
||||
@ -177,9 +183,8 @@ int osp_mem_init(void)
|
||||
char *osp_malloc_im_mem(uint32_t size)
|
||||
{
|
||||
osp_mem_node *node;
|
||||
//osp_mem_node *nextnode;
|
||||
//osp_mem_node* new;
|
||||
uint32_t len = ALIGN(size, 4);
|
||||
|
||||
node = osp_search_node(g_st_osp_mem_im_head.cur_avaliable, len);
|
||||
if(!node)
|
||||
{
|
||||
@ -196,16 +201,9 @@ char *osp_malloc_im_mem(uint32_t size)
|
||||
//new = osp_split_node(node, len);
|
||||
g_st_osp_mem_im_head.cur_avaliable = osp_split_node(node, len);
|
||||
|
||||
/*nextnode = osp_get_next_node(new);
|
||||
//UCP_PRINT_LOG("nextnode is 0x%08x, \r\n", nextnode);
|
||||
if(NULLPTR != nextnode){
|
||||
if(osp_node_need_merge(new, nextnode)){
|
||||
osp_node_merge(new, nextnode);
|
||||
}
|
||||
}*/
|
||||
|
||||
//memset((void*)((UINTPTR)node + OSP_NODE_SIZE), 0, len);
|
||||
//UCP_PRINT_LOG("(UINTPTR)node + OSP_NODE_SIZE is 0x%08x, len is 0x%08x\r\n",(UINTPTR)node + OSP_NODE_SIZE , len );
|
||||
|
||||
return (char*)((UINTPTR)node + OSP_NODE_SIZE);
|
||||
}
|
||||
|
||||
@ -244,15 +242,8 @@ int osp_free_im_mem(char* pbuf)
|
||||
osp_node_merge(prenode, node);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void osp_heapmem_test(void)
|
||||
{
|
||||
char *p;
|
||||
p = osp_malloc_im_mem(32);
|
||||
p = osp_malloc_im_mem(32);
|
||||
osp_free_im_mem(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int osp_show_im_mem(void)
|
||||
@ -292,15 +283,11 @@ int osp_show_im_mem_by_coreid(uint8_t core_id)
|
||||
|
||||
osp_mem_node * node= g_st_osp_mem_im_head.root;
|
||||
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 26), core_id);
|
||||
|
||||
if (core_id != g_ape_id)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 27), 0xaaaabbbb);
|
||||
|
||||
while(node){
|
||||
UCP_PRINT_ERROR("node:0x%x,len=%d,IsBusy=%d,Flag=0x%x, next=0x%x", node, node->len, node->IsBusy, node->u32flag, node->next);
|
||||
if(node->IsBusy){
|
||||
@ -319,19 +306,14 @@ int osp_show_im_mem_by_coreid(uint8_t core_id)
|
||||
}
|
||||
|
||||
|
||||
void *osp_TaskMemGet(int task_id,int size) //加锁
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 对外接口:申请内存空间 */
|
||||
char *osp_malloc(int size)
|
||||
{
|
||||
char *p;
|
||||
OS_ENTER_CRITICAL();
|
||||
p = osp_malloc_im_mem(size);
|
||||
//p = dmalloc(size, DM3);
|
||||
OS_EXIT_CRITICAL();
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@ -341,25 +323,16 @@ void osp_free(char *p)
|
||||
osp_free_im_mem(p);
|
||||
p = NULL;
|
||||
OS_EXIT_CRITICAL();
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
/* 若提供 getFreeSpace()接口可有该函数 */
|
||||
void osp_show_memory(void)
|
||||
{
|
||||
//int freeSpace;
|
||||
#if 0
|
||||
freeSpace = getFreeSpace(IM);
|
||||
UCP_PRINT_LOG("0x%08x bytes are free in IM\r\n", freeSpace);
|
||||
freeSpace = getFreeSpace(DM0);
|
||||
UCP_PRINT_LOG("0x%08x bytes are free in DM0\r\n", freeSpace);
|
||||
freeSpace = getFreeSpace(DM1);
|
||||
UCP_PRINT_LOG("0x%08x bytes are free in DM1\r\n", freeSpace);
|
||||
freeSpace = getFreeSpace(DM2);
|
||||
UCP_PRINT_LOG("0x%08x bytes are free in DM2\r\n", freeSpace);
|
||||
freeSpace = getFreeSpace(DM3);
|
||||
UCP_PRINT_LOG("0x%08x bytes are free in DM3\r\n", freeSpace);
|
||||
#endif
|
||||
osp_show_im_mem();
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -48,7 +48,9 @@ char *osp_alloc_msg(int size)
|
||||
if ((size+OSP_MSG_HEAD_LEN) > OSP_APE_MSG_SIG_SIZE)
|
||||
{
|
||||
UCP_PRINT_ERROR("osp_alloc_msg: error (size = 0x%08x)\r\n", size);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 70), size);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -57,7 +59,9 @@ char *osp_alloc_msg(int size)
|
||||
{
|
||||
/* 没有取到地址空间 */
|
||||
UCP_PRINT_ERROR("osp_alloc_msg: error (no addr)\r\n");
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 71), 0xffff);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 72), ((uint32_t)addr + (uint32_t)OSP_MSG_HEAD_LEN));
|
||||
@ -168,12 +172,6 @@ int osp_send_msg(uint32_t msg_addr,
|
||||
|
||||
memcpy_ucp((void*)pmsg_head, (void*)&st_msg_head, OSP_MSG_HEAD_LEN);
|
||||
__ucps2_synch(0);
|
||||
/*do_write((char*)(&pmsg_head->msg_size), msg_len);
|
||||
do_write_byte((char*)(&pmsg_head->msg_type), msg_type);
|
||||
do_write_byte((char*)(&pmsg_head->src_core_id), src_core_id);
|
||||
do_write_byte((char*)(&pmsg_head->dst_core_id), dst_core_id);
|
||||
do_write_byte((char*)(&pmsg_head->src_task_id), src_task_id);
|
||||
do_write_byte((char*)(&pmsg_head->dst_task_id), dst_task_id);*/
|
||||
|
||||
/* 核内通信,消息入软件队列 */
|
||||
//if (UCP4008_KERNEL_INNER == msg_type)
|
||||
@ -194,10 +192,10 @@ int osp_send_msg(uint32_t msg_addr,
|
||||
//g_u32_inner_cnt_ok++;
|
||||
/* 入队成功,释放信号量,触发事件任务 */
|
||||
osp_post_event_sem(dst_task_id);
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
gst_osp_msg_dbg_info[src_task_id].u32msg_inner_send_ok++;
|
||||
gst_osp_msg_dbg_info[dst_task_id].u32msg_swque_in_ok++;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
debug_write(OSP_DEBUG_HW_POT(g_ape_id, 36), ++gu32_osp_sendto_inner_ok);
|
||||
@ -219,11 +217,11 @@ int osp_send_msg(uint32_t msg_addr,
|
||||
debug_write(OSP_DEBUG_HW_POT(g_ape_id, 37), ++gu32_osp_sendto_inner_ng);
|
||||
#endif
|
||||
}
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 73), g_u32_inner_cnt_err);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 74), g_u32_inner_cnt);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 75), g_u32_inner_cnt_ok);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -393,11 +391,11 @@ int osp_send_msg(uint32_t msg_addr,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 76), g_u32_inter_cnt_err);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 77), g_u32_inter_cnt);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 78), g_u32_inter_cnt_ok);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
rdmcycle(&clockEnd);
|
||||
@ -430,9 +428,10 @@ void osp_recv_msg(osp_msg_head **pmsg_head)
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
rdmcycle(&st_tick_info.u32_deque2_tick);
|
||||
#endif
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
gst_osp_msg_dbg_info[task_id].u32msg_swque_recv++;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -455,7 +454,9 @@ void osp_hw_que_irq(void)
|
||||
#endif
|
||||
|
||||
g_irq_num++;
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 58), g_irq_num);
|
||||
#endif
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
debug_write(OSP_DEBUG_HW_POT(g_ape_id, 38), g_irq_num);
|
||||
@ -478,7 +479,9 @@ void osp_hw_que_irq(void)
|
||||
{
|
||||
g_irq_out_err++;
|
||||
UCP_PRINT_ERROR("[osp_hw_que_irq]: smart_out_que error... que_id = 0x%x \r\n", g_que_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 59), g_irq_out_err);
|
||||
#endif
|
||||
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 27), ret);
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
@ -570,13 +573,15 @@ void osp_hw_que_irq(void)
|
||||
|
||||
if (OSP_OK != osp_task_id_is_true(dst_task_id))
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 66), dst_task_id);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 67), ++g_irq_task_id_err);
|
||||
#endif
|
||||
return ;
|
||||
}
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
gst_osp_msg_dbg_info[dst_task_id].u32msg_hwque_recv++;
|
||||
#endif
|
||||
#endif
|
||||
l_tcb = (osp_tcb*)TCB_GET(dst_task_id);
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
rdmcycle(&st_tick_info.u32_irq_enque1_tick);
|
||||
@ -590,8 +595,10 @@ void osp_hw_que_irq(void)
|
||||
{
|
||||
g_irq_sw_err++;
|
||||
UCP_PRINT_ERROR("[osp_hw_que_irq]: osp_sw_enque error (dst_task_id = 0x%08x)\r\n", dst_task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 60), dst_task_id);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 61), g_irq_sw_err);
|
||||
#endif
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
gst_osp_msg_dbg_info[dst_task_id].u32msg_swque_in_ng++;
|
||||
#endif
|
||||
@ -614,8 +621,9 @@ void osp_hw_que_irq(void)
|
||||
#endif
|
||||
|
||||
g_irq_ok++;
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 62), g_irq_ok);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 60), dst_task_id);
|
||||
#endif
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
debug_write(OSP_DEBUG_HW_POT(g_ape_id, 39), g_irq_ok);
|
||||
@ -645,15 +653,19 @@ int osp_hw_que_init(uint8_t ape_id, uint8_t que_id)
|
||||
}
|
||||
while(ret != 0);
|
||||
UCP_PRINT_LOG("[osp_hw_que_init]: smart_hq_init OK\r\n");
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 50), ape_id);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 51), que_id);
|
||||
#endif
|
||||
|
||||
/* Band */
|
||||
ret = smart_que_bind(ape_id, 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), 0xff01);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff01);
|
||||
#endif
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 22), ret);
|
||||
return -OSP_HW_BAND;
|
||||
}
|
||||
@ -662,7 +674,9 @@ 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);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff02);
|
||||
#endif
|
||||
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);
|
||||
@ -672,19 +686,25 @@ 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, 52), 0xff03);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff03);
|
||||
#endif
|
||||
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);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 55), g_hq_vector);
|
||||
#endif
|
||||
|
||||
/* 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, 52), 0xff04);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff04);
|
||||
#endif
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 5), ret);
|
||||
return -OSP_HW_IRQ;
|
||||
}
|
||||
@ -698,11 +718,15 @@ int osp_hw_que_init(uint8_t ape_id, uint8_t que_id)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 53), u8_loop);
|
||||
#endif
|
||||
if (OSP_OK != ret)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff05);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 54), ret);
|
||||
#endif
|
||||
return -OSP_HW_EMPTY_ERR;
|
||||
}
|
||||
|
||||
@ -710,10 +734,14 @@ int osp_hw_que_init(uint8_t ape_id, uint8_t 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);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 52), 0xff06);
|
||||
#endif
|
||||
return -OSP_PAR_ILL;
|
||||
}
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 56), 0x0101);
|
||||
#endif
|
||||
|
||||
UCP_PRINT_LOG("[osp_hw_que_init]: OK \r\n");
|
||||
|
||||
@ -721,9 +749,10 @@ int osp_hw_que_init(uint8_t ape_id, uint8_t que_id)
|
||||
memset(&st_tick_info, 0, sizeof(st_tick_info));
|
||||
#endif
|
||||
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
memset(&gst_osp_msg_dbg_info, 0, sizeof(osp_msg_dbg_info_t)*TASK_MAX);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return OSP_OK;
|
||||
}
|
||||
|
||||
@ -733,24 +762,24 @@ void osp_get_hw_que_cnt(uint32_t *pu32irq_cnt, uint32_t *pu32irq_ok, uint32_t *p
|
||||
*pu32irq_ok = g_irq_ok;
|
||||
*pu32irq_err = g_irq_out_err;
|
||||
*pu32sw_err = g_irq_sw_err;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
void osp_show_msg_info(void)
|
||||
{
|
||||
int i;
|
||||
osp_tcb *tcb_val;
|
||||
uint8_t ucCoreId = 0;
|
||||
uint8_t i = 0;
|
||||
osp_tcb *tcb_val = NULL;
|
||||
char pbuf[2048];
|
||||
int len = 0;
|
||||
uint8_t ucCoreId = 0;
|
||||
|
||||
ucCoreId = get_core_id();
|
||||
|
||||
|
||||
len = sprintf(pbuf,"\n\r%-8s%-8s%-25s%-10s%-5s\n\r","coreId", "Id", "name","inner","inter");
|
||||
|
||||
for(i=0; i< g_taskid_num; i++,len=0)
|
||||
for (i = 0; i < g_taskid_num; i++, len=0)
|
||||
{
|
||||
tcb_val = (osp_tcb*)g_tcb_handler_tbl[g_task_id_table[i]];
|
||||
|
||||
@ -771,7 +800,9 @@ void osp_show_msg_dbg_info_by_taskid(uint8_t taskid)
|
||||
|
||||
if (OSP_OK != osp_task_id_is_true(taskid))
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 68), taskid);
|
||||
#endif
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -810,7 +841,9 @@ void osp_show_msg_dbg_info_by_coreid_taskid(uint8_t coreid, uint8_t taskid)
|
||||
|
||||
if (OSP_OK != osp_task_id_is_true(taskid))
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 68), taskid);
|
||||
#endif
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -835,6 +868,7 @@ void osp_show_msg_dbg_info_by_coreid_taskid(uint8_t coreid, uint8_t taskid)
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
#endif /* UCP_OSP_DBG_HW_CNT_ENABLE */
|
||||
#endif
|
||||
|
||||
|
@ -70,6 +70,7 @@ int osp_msg_que_deque(uint32_t *pvalue)
|
||||
UCP_PRINT_LOG("osp_msg_que_deque: de_idx = %x\r\n", g_str_msg_que.de_idx);
|
||||
|
||||
osp_post_sem(g_str_msg_que.sem);
|
||||
|
||||
return OSP_OK;
|
||||
}
|
||||
|
||||
|
@ -7,21 +7,24 @@
|
||||
#include "ucp_utility.h"
|
||||
#include "ucp_printf.h"
|
||||
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
uint32_t g_u32_osp_wait_sem_err = 0;
|
||||
uint32_t g_u32_osp_post_sem_err = 0;
|
||||
uint32_t g_u32_osp_del_sem_err = 0;
|
||||
uint32_t g_u32_osp_wait_event_sem_err = 0;
|
||||
uint32_t g_u32_osp_post_event_sem_err = 0;
|
||||
uint32_t g_u32_osp_post_timer_event_sem = 0;
|
||||
#endif
|
||||
|
||||
void *osp_create_sem(int cnt)
|
||||
{
|
||||
int apeId = get_core_id();
|
||||
void* ptr = smart_sem_create(cnt);
|
||||
if (NULL == ptr)
|
||||
{
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 28), 0xFFFFFFFF);
|
||||
}
|
||||
int apeId = get_core_id();
|
||||
void* ptr = smart_sem_create(cnt);
|
||||
if (NULL == ptr)
|
||||
{
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 28), 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -33,28 +36,34 @@ void osp_wait_sem(sem_t *sem)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_u32_osp_wait_sem_err++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 40), g_u32_osp_wait_sem_err);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 40), ++g_u32_osp_wait_sem_err);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void osp_post_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_post(sem);
|
||||
if (0 != ret)
|
||||
{
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 29), ret);
|
||||
}
|
||||
if (0 != ret)
|
||||
{
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 29), ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_u32_osp_post_sem_err++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 41), g_u32_osp_post_sem_err);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 41), ++g_u32_osp_post_sem_err);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void osp_delete_sem(sem_t *sem)
|
||||
@ -66,14 +75,17 @@ void osp_delete_sem(sem_t *sem)
|
||||
ret = smart_sem_del(sem);
|
||||
if (0 != ret)
|
||||
{
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 30), ret);
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 30), ret);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_u32_osp_del_sem_err++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 42), g_u32_osp_post_sem_err);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 42), ++g_u32_osp_post_sem_err);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void osp_wait_event_sem(int task_id)
|
||||
@ -85,10 +97,13 @@ void osp_wait_event_sem(int task_id)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_u32_osp_wait_event_sem_err++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 43), g_u32_osp_wait_event_sem_err);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 43), ++g_u32_osp_wait_event_sem_err);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 44), task_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void osp_post_event_sem(int task_id)
|
||||
@ -100,10 +115,13 @@ void osp_post_event_sem(int task_id)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_u32_osp_post_event_sem_err++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 45), g_u32_osp_post_event_sem_err);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 45), ++g_u32_osp_post_event_sem_err);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 46), task_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void osp_post_timer_event_sem(int task_id)
|
||||
@ -115,9 +133,12 @@ void osp_post_timer_event_sem(int task_id)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_u32_osp_post_timer_event_sem++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 47), g_u32_osp_post_timer_event_sem);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 47), ++g_u32_osp_post_timer_event_sem);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 48), task_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,9 @@ int osp_sw_enque(osp_msg_head *pmsg_head, osp_sw_queue *que)
|
||||
{
|
||||
if (NULL == que)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 88), 0xffffffff);
|
||||
#endif
|
||||
return -OSP_PAR_ILL;
|
||||
}
|
||||
|
||||
@ -42,7 +44,9 @@ int osp_sw_enque(osp_msg_head *pmsg_head, osp_sw_queue *que)
|
||||
if((que->enque_count - que->deque_count) >= OSP_QUE_DEP)
|
||||
{
|
||||
que->full_count++;
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 80), que->full_count);
|
||||
#endif
|
||||
return -OSP_QUE_FULL;
|
||||
}
|
||||
|
||||
@ -50,11 +54,11 @@ int osp_sw_enque(osp_msg_head *pmsg_head, osp_sw_queue *que)
|
||||
//memcpy((que->que_msg+(que->enque_idx)*OSP_QUE_SIZE), &pmsg_head, sizeof(osp_msg_head));
|
||||
que->enque_idx = (que->enque_idx +1)&(que->mask);
|
||||
que->enque_count++;
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 81), pmsg_head);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 82), que->enque_count);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 83), que->deque_count);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//osp_post_sem(que->msg_sem);
|
||||
return OSP_OK;
|
||||
@ -73,7 +77,9 @@ int osp_sw_deque(osp_msg_head **pmsg_head, osp_sw_queue *que)
|
||||
if(que->enque_count == que->deque_count)
|
||||
{
|
||||
que->empty_count++;
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 84), que->empty_count);
|
||||
#endif
|
||||
return -OSP_QUE_EMPT;
|
||||
}
|
||||
|
||||
@ -82,11 +88,11 @@ int osp_sw_deque(osp_msg_head **pmsg_head, osp_sw_queue *que)
|
||||
que->deque_idx = (que->deque_idx+1)&(que->mask);
|
||||
que->deque_count++;
|
||||
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 85), *pmsg_head);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 86), que->enque_count);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 87), que->deque_count);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//osp_post_sem(que->msg_sem);
|
||||
return OSP_OK;
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <string.h>
|
||||
#include "osp_type_def.h"
|
||||
#include "osp_task.h"
|
||||
//#include "osp_type_def.h"
|
||||
#include "err_num.h"
|
||||
#include "osp_msg.h"
|
||||
#include "osp_sw_queue.h"
|
||||
#include "osp_task.h"
|
||||
//#include "osp_sw_queue.h"
|
||||
#include "osp_timer.h"
|
||||
#include "osp_sem.h"
|
||||
#include "osp_mem.h"
|
||||
@ -14,16 +14,13 @@
|
||||
#include "spu_shell.h"
|
||||
|
||||
#define DE_ONE_VALUE (1)
|
||||
//int idle_preem_times = 0;
|
||||
|
||||
int g_cur_task_id = 0;
|
||||
|
||||
int g_task_id_table[TASK_MAX] = {0};
|
||||
int g_task_id_table[TASK_MAX] = {0};
|
||||
uint8_t g_taskid_num = 0;
|
||||
|
||||
int g_prio_array[TASK_MAX] = {0};
|
||||
int g_task_id_array[TASK_MAX] = {0};
|
||||
int *g_tcb_handler_tbl[TASK_MAX] = {NULL};
|
||||
int g_prio_array[TASK_ID_MAX] = {0};
|
||||
int g_task_id_array[TASK_ID_MAX] = {0};
|
||||
int *g_tcb_handler_tbl[TASK_ID_MAX] = {NULL};
|
||||
|
||||
static uint8_t su8_del_task_err_idx = 0;
|
||||
|
||||
@ -32,20 +29,24 @@ extern osp_msg_tick_info st_tick_info;
|
||||
#endif
|
||||
|
||||
#ifdef OSP_TASK_DBG_ENABLE
|
||||
osp_task_dbg_info_t gst_osp_task_dbg_info[TASK_MAX];
|
||||
osp_task_dbg_info_t gst_osp_task_dbg_info[TASK_ID_MAX];
|
||||
#endif
|
||||
|
||||
/* 任务模块初始化函数 */
|
||||
void osp_task_init(void)
|
||||
{
|
||||
memset(g_tcb_handler_tbl, 0 , TASK_MAX*sizeof(int));
|
||||
memset(g_prio_array, 0, sizeof(g_prio_array));
|
||||
memset(g_task_id_array, 0, sizeof(g_task_id_array));
|
||||
memset(g_task_id_table, 0, (TASK_MAX*sizeof(int)));
|
||||
memset(g_prio_array, 0, sizeof(g_prio_array));
|
||||
memset(g_task_id_array, 0, sizeof(g_task_id_array));
|
||||
memset(g_tcb_handler_tbl, 0, (TASK_ID_MAX*sizeof(int)));
|
||||
g_taskid_num = 0;
|
||||
|
||||
#ifdef OSP_TASK_DBG_ENABLE
|
||||
memset(&gst_osp_task_dbg_info, 0, sizeof(osp_task_dbg_info_t)*TASK_MAX);
|
||||
#endif
|
||||
|
||||
spu_insert_cmd_ext("i_ape", (OSP_FUNCPTR)osp_show_task_info, "osp show task info", 0);
|
||||
|
||||
#ifdef OSP_MSG_DBG_ENABLE
|
||||
spu_insert_cmd_ext("e_ape", (OSP_FUNCPTR)osp_show_msg_info, "osp show msg info", 0);
|
||||
|
||||
@ -53,7 +54,8 @@ void osp_task_init(void)
|
||||
spu_insert_cmd_ext("em_ape", (OSP_FUNCPTR)osp_show_msg_dbg_info_by_coreid_taskid, "osp show msg by id", 2);
|
||||
#endif /* UCP_OSP_DBG_HW_CNT_ENABLE */
|
||||
|
||||
#endif
|
||||
#endif /* OSP_MSG_DBG_ENABLE */
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -65,35 +67,29 @@ static void osp_event_task(void *data)
|
||||
(tcb_val->init_func == NULL)? 0:tcb_val->init_func();
|
||||
while(1)
|
||||
{
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 49), tcb_val->task_id);
|
||||
osp_wait_sem(tcb_val->event_sem);
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
rdmcycle(&st_tick_info.u32_sem_wait_tick);
|
||||
#endif
|
||||
osp_recv_msg(&ptr);
|
||||
//UCP_PRINT_ERROR("osp_event_task >>> ptr = 0x%x, data = 0x%x, size = 0x%x\r\n", ptr, ptr->data, ptr->msg_size);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 36), (uint32_t)(ptr->data));
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 37), ptr->msg_size);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 38), (uint32_t)(ptr));
|
||||
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
rdmcycle(&st_tick_info.u32_callback_tick);
|
||||
#endif
|
||||
|
||||
#ifdef OSP_TASK_DBG_ENABLE
|
||||
tcb_val->run_times++;
|
||||
gst_osp_task_dbg_info[tcb_val->task_id].u32Call_before++;
|
||||
#endif
|
||||
|
||||
tcb_val->loop_fun(ptr->data, ptr->msg_size);
|
||||
|
||||
#ifdef OSP_TASK_DBG_ENABLE
|
||||
gst_osp_task_dbg_info[tcb_val->task_id].u32Call_after++;
|
||||
//UCP_PRINT_ERROR("event:id=%d,%d,%d", tcb_val->task_id, gst_osp_task_dbg_info[tcb_val->task_id].u32Call_before, gst_osp_task_dbg_info[tcb_val->task_id].u32Call_after);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
uint32_t g_u32_osp_mtimer_cnt = 0;
|
||||
uint32_t g_u32_osp_mtimer_callback_cnt = 0;
|
||||
#endif
|
||||
static void osp_mtimer_task(void *data)
|
||||
{
|
||||
osp_tcb *tcb_val = (osp_tcb*)data;
|
||||
@ -102,21 +98,16 @@ static void osp_mtimer_task(void *data)
|
||||
while(1)
|
||||
{
|
||||
osp_wait_sem(tcb_val->sem); //本文件不要存在os 接口函数
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
g_u32_osp_mtimer_cnt++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 11), g_u32_osp_mtimer_cnt);
|
||||
#endif
|
||||
|
||||
#ifdef OSP_TASK_DBG_ENABLE
|
||||
tcb_val->run_times++;
|
||||
gst_osp_task_dbg_info[tcb_val->task_id].u32Call_before++;
|
||||
#endif
|
||||
|
||||
tcb_val->loop_fun(data);
|
||||
|
||||
#ifdef OSP_TASK_DBG_ENABLE
|
||||
gst_osp_task_dbg_info[tcb_val->task_id].u32Call_after++;
|
||||
#endif
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
g_u32_osp_mtimer_callback_cnt++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 12), g_u32_osp_mtimer_callback_cnt);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -133,7 +124,9 @@ static void osp_loop_task(void *data)
|
||||
tcb_val->run_times++;
|
||||
gst_osp_task_dbg_info[tcb_val->task_id].u32Call_before++;
|
||||
#endif
|
||||
|
||||
tcb_val->loop_fun(data);
|
||||
|
||||
#ifdef OSP_TASK_DBG_ENABLE
|
||||
gst_osp_task_dbg_info[tcb_val->task_id].u32Call_after++;
|
||||
#endif
|
||||
@ -172,7 +165,6 @@ static void osp_driver_task(void *data)
|
||||
osp_del_task(tcb_val->priority, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void osp_osp_task(void *data)
|
||||
@ -267,7 +259,7 @@ int osp_task_reg(osp_task_inf *task_array, osp_task_ext_inf *task_ext_array, int
|
||||
UCP_PRINT_ERROR("task entry is none\n\r");
|
||||
return -OSP_PAR_ILL;
|
||||
}
|
||||
if(osp_task_ptr->task_id > TASK_MAX)
|
||||
if(osp_task_ptr->task_id > TASK_ID_MAX)
|
||||
{
|
||||
UCP_PRINT_ERROR("task id is error\n\r");
|
||||
return -OSP_PAR_ILL;
|
||||
@ -341,16 +333,16 @@ int osp_task_reg(osp_task_inf *task_array, osp_task_ext_inf *task_ext_array, int
|
||||
{
|
||||
UCP_PRINT_ERROR("task 0x%08x sw_que alloc failed\n\r",osp_task_ptr->task_id);
|
||||
osp_delete_sem(tcb_handle->event_sem);
|
||||
FREE((stack_down-4));
|
||||
FREE((char*)tcb_handle);
|
||||
osp_free((stack_down-4));
|
||||
osp_free((char*)tcb_handle);
|
||||
return -OSP_MEM_FULL;
|
||||
}
|
||||
if (OSP_OK != osp_sw_queue_int(tcb_handle->que_head))
|
||||
{
|
||||
UCP_PRINT_ERROR("task 0x%08x sw_que alloc failed\n\r", osp_task_ptr->task_id);
|
||||
osp_delete_sem(tcb_handle->event_sem);
|
||||
FREE((stack_down-4));
|
||||
FREE((char*)tcb_handle);
|
||||
osp_free((stack_down-4));
|
||||
osp_free((char*)tcb_handle);
|
||||
return -1;
|
||||
}
|
||||
//memset(tcb_handle->que_head, 0, sizeof(osp_sw_queue));
|
||||
@ -428,15 +420,15 @@ int osp_task_reg(osp_task_inf *task_array, osp_task_ext_inf *task_ext_array, int
|
||||
debug_write(DBG_DDR_ERR_IDX(apeid, 25), ret);
|
||||
if (OSP_EVENT_TYPE == local_ext_info_p->task_type)
|
||||
{
|
||||
FREE((char*)(tcb_handle->que_head));
|
||||
osp_free((char*)(tcb_handle->que_head));
|
||||
osp_delete_sem(tcb_handle->event_sem);
|
||||
}
|
||||
else
|
||||
{
|
||||
osp_delete_sem(tcb_handle->sem);
|
||||
}
|
||||
FREE((stack_down-4));
|
||||
FREE((char*)tcb_handle);
|
||||
osp_free((stack_down-4));
|
||||
osp_free((char*)tcb_handle);
|
||||
return -1;
|
||||
}
|
||||
if (0 != ret)
|
||||
@ -458,7 +450,7 @@ int osp_task_reg(osp_task_inf *task_array, osp_task_ext_inf *task_ext_array, int
|
||||
osp_task_ptr++;
|
||||
continue;
|
||||
tcb_malloc_failed:
|
||||
FREE(stack_down);
|
||||
osp_free(stack_down);
|
||||
malloc_stack_failed:
|
||||
g_prio_array[osp_task_ptr->task_id] = 0;
|
||||
g_task_id_array[osp_task_ptr->task_prio] = 0;
|
||||
@ -505,74 +497,82 @@ int osp_task_create(osp_task_info_ex *t_info_val)
|
||||
int ret = -1;
|
||||
if(t_info_val->task_entry == NULL)
|
||||
{
|
||||
UCP_PRINT_ERROR("task entry is none\n\r");
|
||||
UCP_PRINT_ERROR("task(%d) entry is none", t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x10);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
#endif
|
||||
return -OSP_PAR_ILL;
|
||||
}
|
||||
if(t_info_val->task_id > TASK_MAX)
|
||||
if(t_info_val->task_id > TASK_ID_MAX)
|
||||
{
|
||||
UCP_PRINT_ERROR("task id is error\n\r");
|
||||
UCP_PRINT_ERROR("task(%d) id is error", t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x11);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
#endif
|
||||
return -OSP_PAR_ILL;
|
||||
}
|
||||
if(t_info_val->task_prio > PRIO_MIN)
|
||||
{
|
||||
UCP_PRINT_ERROR("task PRIO is error\n\r");
|
||||
UCP_PRINT_ERROR("task(%d) PRIO is error", t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x12);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 22), t_info_val->task_prio);
|
||||
#endif
|
||||
return -OSP_PAR_ILL;
|
||||
}
|
||||
if(t_info_val->stack_size > M_STACK_SIZE)
|
||||
{
|
||||
UCP_PRINT_ERROR("task stack size is to large\n\r");
|
||||
UCP_PRINT_ERROR("task(%d) stack size is to large", t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x13);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 23), t_info_val->stack_size);
|
||||
#endif
|
||||
return -OSP_PAR_ILL;
|
||||
}
|
||||
if(g_prio_array[t_info_val->task_id] != 0)
|
||||
{
|
||||
UCP_PRINT_ERROR("task prio is repeat\n\r");
|
||||
UCP_PRINT_ERROR("task register failed passed\n\r");
|
||||
UCP_PRINT_ERROR("task(%d) prio is repeat", t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x14);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 24), t_info_val->task_id);
|
||||
#endif
|
||||
return -OSP_PAR_REP;
|
||||
}
|
||||
g_prio_array[t_info_val->task_id] = t_info_val->task_prio;
|
||||
if(g_task_id_array[t_info_val->task_prio] != 0)
|
||||
{
|
||||
UCP_PRINT_ERROR("task 0x%08x id is repeat\n\r",t_info_val->task_id);
|
||||
UCP_PRINT_ERROR("task register failed passed\n\r");
|
||||
UCP_PRINT_ERROR("task(%d) id is repeat",t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x15);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 25), t_info_val->task_id);
|
||||
#endif
|
||||
return -OSP_PAR_REP;
|
||||
}
|
||||
g_task_id_array[t_info_val->task_prio] = t_info_val->task_id;
|
||||
stack_down = (char*)MALLOC(t_info_val->stack_size + 12);
|
||||
stack_down = (char*)osp_malloc((t_info_val->stack_size + 12));
|
||||
if(stack_down == NULL)
|
||||
{
|
||||
UCP_PRINT_ERROR("task 0x%08x stack alloc failed\n\r",t_info_val->task_id);
|
||||
UCP_PRINT_ERROR("task(%d) stack alloc failed",t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x16);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 26), t_info_val->task_id);
|
||||
#endif
|
||||
goto alloc_stack_failed;
|
||||
}
|
||||
*(int*)stack_down = LOW_VALUE0;
|
||||
stack_down += 4;
|
||||
stack_top = stack_down + t_info_val->stack_size;
|
||||
*((int*)(stack_top + 4)) = TOP_VALUE0;
|
||||
tcb_handle = (osp_tcb*)MALLOC(sizeof(osp_tcb));
|
||||
tcb_handle = (osp_tcb*)osp_malloc(sizeof(osp_tcb));
|
||||
if(tcb_handle == NULL)
|
||||
{
|
||||
UCP_PRINT_ERROR("task 0x%08x tcb alloc failed\n\r",t_info_val->task_id);
|
||||
UCP_PRINT_ERROR("task(%d) tcb alloc failed",t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x17);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 27), t_info_val->task_id);
|
||||
#endif
|
||||
goto tcb_alloc_failed;
|
||||
}
|
||||
memset(tcb_handle, 0, sizeof(osp_tcb));
|
||||
@ -584,11 +584,13 @@ int osp_task_create(osp_task_info_ex *t_info_val)
|
||||
tcb_handle->sem = osp_create_sem(0);
|
||||
if (NULL == tcb_handle->sem)
|
||||
{
|
||||
UCP_PRINT_ERROR("task=%d, create sem error.\n\r", t_info_val->task_id);
|
||||
UCP_PRINT_ERROR("task(%d) create sem error", t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x18);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
FREE((stack_down-4));
|
||||
FREE((char*)tcb_handle);
|
||||
#endif
|
||||
osp_free((stack_down-4));
|
||||
osp_free((char*)tcb_handle);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -598,35 +600,39 @@ int osp_task_create(osp_task_info_ex *t_info_val)
|
||||
tcb_handle->event_sem = osp_create_sem(0);
|
||||
if (NULL == tcb_handle->event_sem)
|
||||
{
|
||||
UCP_PRINT_ERROR("task=%d, create sem error.\n\r", t_info_val->task_id);
|
||||
UCP_PRINT_ERROR("task(%d) create sem error", t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x19);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
FREE((stack_down-4));
|
||||
FREE((char*)tcb_handle);
|
||||
#endif
|
||||
osp_free((stack_down-4));
|
||||
osp_free((char*)tcb_handle);
|
||||
return -1;
|
||||
}
|
||||
tcb_handle->que_head = (osp_sw_queue*)osp_malloc(sizeof(osp_sw_queue));
|
||||
if (NULL == tcb_handle->que_head)
|
||||
{
|
||||
UCP_PRINT_ERROR("task 0x%08x sw_que alloc failed\n\r", t_info_val->task_id);
|
||||
UCP_PRINT_ERROR("task(%d) sw_que alloc failed", t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x1a);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 28), t_info_val->task_id);
|
||||
#endif
|
||||
osp_delete_sem(tcb_handle->event_sem);
|
||||
FREE((stack_down-4));
|
||||
FREE((char*)tcb_handle);
|
||||
osp_free((stack_down-4));
|
||||
osp_free((char*)tcb_handle);
|
||||
return -1;
|
||||
}
|
||||
if (OSP_OK != osp_sw_queue_int(tcb_handle->que_head))
|
||||
{
|
||||
UCP_PRINT_ERROR("task 0x%08x sw_que init failed\n\r", t_info_val->task_id);
|
||||
UCP_PRINT_ERROR("task(%d) sw_que init failed", t_info_val->task_id);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x1b);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 19), t_info_val->task_id);
|
||||
#endif
|
||||
osp_delete_sem(tcb_handle->event_sem);
|
||||
FREE((char*)(tcb_handle->que_head));
|
||||
FREE((stack_down-4));
|
||||
FREE((char*)tcb_handle);
|
||||
osp_free((char*)(tcb_handle->que_head));
|
||||
osp_free((stack_down-4));
|
||||
osp_free((char*)tcb_handle);
|
||||
return -1;
|
||||
}
|
||||
//memset(tcb_handle->que_head, 0, sizeof(osp_sw_queue));
|
||||
@ -642,7 +648,6 @@ int osp_task_create(osp_task_info_ex *t_info_val)
|
||||
tcb_handle->loop_fun = t_info_val->task_entry;
|
||||
tcb_handle->data = t_info_val->task_prio;
|
||||
strncpy(tcb_handle->task_name, (const char*)t_info_val->task_name, (OSP_TASK_NAME_LEN-1));
|
||||
//STRCPY(tcb_handle->task_name, (const char*)t_info_val->task_name);
|
||||
g_tcb_handler_tbl[tcb_handle->task_id] = (int*)tcb_handle;
|
||||
|
||||
//if((t_info_val->t_off != 0)&&(t_info_val->s_bitmap != 0))
|
||||
@ -650,14 +655,14 @@ int osp_task_create(osp_task_info_ex *t_info_val)
|
||||
{
|
||||
if(g_osp_timer_desc_idx >= OSP_TIMER_COUNTS)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x1c);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 29), t_info_val->task_id);
|
||||
UCP_PRINT_ERROR("timer point is overflow\n\r");
|
||||
UCP_PRINT_ERROR("timer cfg failed\n\r");
|
||||
#endif
|
||||
UCP_PRINT_ERROR("task(%d) timer point is overflow\n\r", t_info_val->task_id);
|
||||
osp_delete_sem(tcb_handle->sem);
|
||||
FREE((stack_down-4));
|
||||
FREE((char*)tcb_handle);
|
||||
osp_free((stack_down-4));
|
||||
osp_free((char*)tcb_handle);
|
||||
return -1;
|
||||
}
|
||||
g_osp_timer_desc[g_osp_timer_desc_idx].task_id = t_info_val->task_id;
|
||||
@ -708,28 +713,33 @@ int osp_task_create(osp_task_info_ex *t_info_val)
|
||||
debug_write(DBG_DDR_ERR_IDX(g_ape_id, 26), ret);
|
||||
if (OSP_EVENT_TYPE == t_info_val->task_type)
|
||||
{
|
||||
FREE((char*)(tcb_handle->que_head));
|
||||
osp_free((char*)(tcb_handle->que_head));
|
||||
osp_delete_sem(tcb_handle->event_sem);
|
||||
}
|
||||
else
|
||||
{
|
||||
osp_delete_sem(tcb_handle->sem);
|
||||
}
|
||||
FREE((stack_down-4));
|
||||
FREE((char*)tcb_handle);
|
||||
osp_free((stack_down-4));
|
||||
osp_free((char*)tcb_handle);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 20), 0x1d);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 21), t_info_val->task_id);
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
UCP_PRINT_LOG("smart_task_create return:%d, task_id=%d, num=%d", ret, tcb_handle->task_id, g_taskid_num);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 22), ret);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 23), t_info_val->task_id);
|
||||
|
||||
#endif
|
||||
if (su8_index < 5)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, (225+su8_index)), t_info_val->task_id);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, (230+su8_index)), stack_top);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, (235+su8_index)), stack_down);
|
||||
#endif
|
||||
}
|
||||
su8_index++;
|
||||
|
||||
@ -752,13 +762,14 @@ int osp_task_create(osp_task_info_ex *t_info_val)
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
tcb_alloc_failed:
|
||||
FREE(stack_down);
|
||||
osp_free(stack_down);
|
||||
alloc_stack_failed:
|
||||
g_prio_array[t_info_val->task_id] = 0;
|
||||
g_task_id_array[t_info_val->task_prio] = 0;
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -781,8 +792,10 @@ void osp_del_timer_task(int task_id)
|
||||
tcb_handle = (osp_tcb*)g_tcb_handler_tbl[task_id];
|
||||
if(NULL == tcb_handle)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 13), 0x20);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 14), task_id);
|
||||
#endif
|
||||
UCP_PRINT_ERROR("osp_del_timer_task: no tcb_handle(task_id=%d)", task_id);
|
||||
return ;
|
||||
}
|
||||
@ -790,9 +803,10 @@ void osp_del_timer_task(int task_id)
|
||||
task_prio = g_prio_array[task_id];
|
||||
if (task_prio <= 0)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 13), 0x21);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 14), task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 14), task_id);
|
||||
#endif
|
||||
UCP_PRINT_ERROR("osp_del_timer_task: no task_prio(task_id=%d)", task_id);
|
||||
return ;
|
||||
}
|
||||
@ -800,18 +814,23 @@ void osp_del_timer_task(int task_id)
|
||||
ret = smart_task_del(task_prio); /* 删除任务 */
|
||||
if (OSP_OK != ret)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 13), 0x22);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 14), task_id);
|
||||
#endif
|
||||
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;
|
||||
|
||||
UCP_PRINT_ERROR("osp_del_timer_task: os return(%d)(task_id=%d)", ret, task_id);
|
||||
return ;
|
||||
}
|
||||
|
||||
g_task_id_array[task_prio] = 0; /* 通过优先级清任务列表 */
|
||||
g_prio_array[task_id] = 0; /* 通过任务ID清优先级列表 */
|
||||
FREE((char*)((tcb_handle->stack_down)-4)); /* 释放栈空间 */
|
||||
osp_free((char*)((tcb_handle->stack_down)-4)); /* 释放栈空间 */
|
||||
osp_delete_sem(tcb_handle->sem); /* 删除信号量 */
|
||||
FREE((char*)tcb_handle); /* 释放任务控制块 */
|
||||
osp_free((char*)tcb_handle); /* 释放任务控制块 */
|
||||
g_tcb_handler_tbl[task_id] = NULL;
|
||||
|
||||
for (u8_loop = 0; u8_loop < g_taskid_num; u8_loop++)
|
||||
@ -847,6 +866,7 @@ void osp_del_timer_task(int task_id)
|
||||
0x33: os delete task failed
|
||||
#25: task id
|
||||
*/
|
||||
|
||||
void osp_del_task(int prio, int scsId)
|
||||
{
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
@ -864,10 +884,11 @@ void osp_del_task(int prio, int scsId)
|
||||
if (0 == task_id)
|
||||
{
|
||||
/* 任务不存在 */
|
||||
UCP_PRINT_ERROR("osp_del_task: task_id = 0x%08x(prio = 0x%08x), not exsit.\r\n", task_id, prio);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 24), 0x30);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 25), task_id);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 32), task_id);
|
||||
#endif
|
||||
UCP_PRINT_ERROR("osp_del_task: task_id=%d(prio=%d), not exsit.\r\n", task_id, prio);
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -875,16 +896,20 @@ void osp_del_task(int prio, int scsId)
|
||||
tcb_handle = (osp_tcb*)g_tcb_handler_tbl[task_id];
|
||||
if(NULL == tcb_handle)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 24), 0x31);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 25), task_id);
|
||||
#endif
|
||||
UCP_PRINT_ERROR("osp_del_task: no tcb_handle(task_id=%d)", task_id);
|
||||
return ;
|
||||
}
|
||||
|
||||
if (prio != tcb_handle->priority)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 24), 0x32);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 25), task_id);
|
||||
#endif
|
||||
UCP_PRINT_ERROR("osp_del_task: prio id error(%d,%d)", prio, tcb_handle->priority);
|
||||
return ;
|
||||
}
|
||||
@ -906,11 +931,16 @@ void osp_del_task(int prio, int scsId)
|
||||
ret = smart_task_del(prio);
|
||||
if (OSP_OK != ret)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 24), 0x33);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 25), task_id);
|
||||
#endif
|
||||
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;
|
||||
|
||||
UCP_PRINT_ERROR("osp_del_task: os return(%d)(task_id=%d)", ret, task_id);
|
||||
return ;
|
||||
}
|
||||
|
||||
/* 事件任务,删除事件信号量和软件队列 */
|
||||
@ -923,11 +953,16 @@ void osp_del_task(int prio, int scsId)
|
||||
ret = smart_task_del(prio);
|
||||
if (OSP_OK != ret)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 24), 0x33);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 25), task_id);
|
||||
#endif
|
||||
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;
|
||||
|
||||
UCP_PRINT_ERROR("osp_del_task: os return(%d)(task_id=%d)", ret, task_id);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
else if (OSP_TIMER_TYPE == tcb_handle->task_type)
|
||||
@ -941,11 +976,16 @@ void osp_del_task(int prio, int scsId)
|
||||
ret = smart_task_del(prio);
|
||||
if (OSP_OK != ret)
|
||||
{
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 24), 0x33);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 25), task_id);
|
||||
#endif
|
||||
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;
|
||||
|
||||
UCP_PRINT_ERROR("osp_del_task: os return(%d)(task_id=%d)", ret, task_id);
|
||||
return ;
|
||||
}
|
||||
|
||||
/* 其他任务,删除信号量 */
|
||||
@ -955,8 +995,8 @@ void osp_del_task(int prio, int scsId)
|
||||
g_task_id_array[prio] = 0; /* 通过优先级清任务列表 */
|
||||
g_prio_array[task_id] = 0; /* 通过任务ID清优先级列表 */
|
||||
|
||||
FREE((char*)((tcb_handle->stack_down)-4)); /* 释放栈空间 */
|
||||
FREE((char*)tcb_handle); /* 释放任务控制块 */
|
||||
osp_free((char*)((tcb_handle->stack_down)-4)); /* 释放栈空间 */
|
||||
osp_free((char*)tcb_handle); /* 释放任务控制块 */
|
||||
|
||||
g_tcb_handler_tbl[task_id] = NULL;
|
||||
|
||||
@ -973,7 +1013,9 @@ void osp_del_task(int prio, int scsId)
|
||||
|
||||
/* 删除任务 */
|
||||
//smart_task_del(prio);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 33), task_id);
|
||||
#endif
|
||||
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
rdmcycle(&clockEnd);
|
||||
@ -983,6 +1025,7 @@ void osp_del_task(int prio, int scsId)
|
||||
return ;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void osp_del_task_all(int scs_id)
|
||||
{
|
||||
uint8_t u8_task_loop = 0;
|
||||
@ -999,7 +1042,9 @@ void osp_del_task_all(int scs_id)
|
||||
{
|
||||
/* 任务不存在 */
|
||||
UCP_PRINT_ERROR("osp_del_task: task_id = 0x%08x(prio = 0x%08x), not exsit.\r\n", u8_task_id, u8_task_loop);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 32), u8_task_id);
|
||||
#endif
|
||||
continue;
|
||||
//return ;
|
||||
}
|
||||
@ -1017,7 +1062,6 @@ void osp_del_task_all(int scs_id)
|
||||
osp_timer_unsync_notask(scs_id);
|
||||
u8_timer_falg++;
|
||||
}
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 34), u8_timer_falg);
|
||||
osp_delete_sem(tcb_handle->sem); /* 删除信号量 */
|
||||
}
|
||||
else if (OSP_EVENT_TYPE == tcb_handle->task_type)
|
||||
@ -1038,8 +1082,8 @@ void osp_del_task_all(int scs_id)
|
||||
|
||||
g_task_id_array[u8_task_loop] = 0; /* 通过优先级清任务列表 */
|
||||
g_prio_array[u8_task_id] = 0; /* 通过任务ID清优先级列表 */
|
||||
FREE((char*)((tcb_handle->stack_down)-4)); /* 释放栈空间 */
|
||||
FREE((char*)tcb_handle); /* 释放任务控制块 */
|
||||
osp_free((char*)((tcb_handle->stack_down)-4)); /* 释放栈空间 */
|
||||
osp_free((char*)tcb_handle); /* 释放任务控制块 */
|
||||
|
||||
g_tcb_handler_tbl[u8_task_id] = NULL;
|
||||
|
||||
@ -1050,7 +1094,9 @@ void osp_del_task_all(int scs_id)
|
||||
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;
|
||||
}
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 33), u8_task_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
g_taskid_num = 0;
|
||||
@ -1064,6 +1110,7 @@ void osp_del_task_all(int scs_id)
|
||||
|
||||
return ;
|
||||
}
|
||||
#endif
|
||||
|
||||
void osp_delay_cycle(int cycle)
|
||||
{
|
||||
@ -1073,7 +1120,7 @@ void osp_delay_cycle(int cycle)
|
||||
void *get_sw_queue_head(int task_id)
|
||||
{
|
||||
osp_tcb *l_tcb = (osp_tcb*)(TCB_GET(task_id));
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 34), task_id);
|
||||
|
||||
return l_tcb->que_head;
|
||||
}
|
||||
|
||||
@ -1085,7 +1132,7 @@ int osp_get_cur_task_id()
|
||||
{
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 24), task_pro);
|
||||
}
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 35), task_pro);
|
||||
|
||||
return g_task_id_array[task_pro];
|
||||
}
|
||||
|
||||
@ -1095,12 +1142,13 @@ uint8_t osp_task_id_is_true(int task_id)
|
||||
{
|
||||
return OSP_OK;
|
||||
}
|
||||
|
||||
return OSP_ERROR;
|
||||
}
|
||||
|
||||
void osp_show_task_info(void)
|
||||
{
|
||||
int i;
|
||||
uint8_t i;
|
||||
osp_tcb *tcb_val;
|
||||
char pbuf[2048];
|
||||
int st_top_s = 0;
|
||||
@ -1114,7 +1162,7 @@ void osp_show_task_info(void)
|
||||
len = sprintf(pbuf,"\n\r%-8s%-8s%-20s%10s%15s%8s%12s%12s%12s%15s%12s%12s%12s\n\r",
|
||||
"coreId", "Id", "name","end_times","cpu-pri","type", "stacktop", "stackdown", "stacksize","stack_state", "run_times", "preem_task", "preem_times");
|
||||
|
||||
for(i=0; i< g_taskid_num; i++,len=0)
|
||||
for(i = 0; i < g_taskid_num; i++, len=0)
|
||||
{
|
||||
tcb_val = (osp_tcb*)g_tcb_handler_tbl[g_task_id_table[i]];
|
||||
st_top_s = TOP_STACK_GUARD0(tcb_val->stack_top);
|
||||
@ -1133,6 +1181,7 @@ void osp_show_task_info(void)
|
||||
|
||||
spu_shellinfo_to_arm(pbuf, len, UCP4008_OSP_SHELL);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -11,18 +11,11 @@ osp_id_timer_t g_task_off_tbl[10][100] = {0}; /* 根据定时点任务,分
|
||||
osp_timer_desc g_osp_timer_desc[OSP_TIMER_TASK_MAX] ={0}; /* 定时点任务与定时点信息汇总 */
|
||||
int g_osp_timer_desc_idx = 0;
|
||||
|
||||
uint32_t g_mtimer_cnt = 0; /* 定时点任务总个数(同g_osp_timer_desc_idx) */
|
||||
uint32_t g_mtimer_loop = 0; /* 定时点触发任务,用其表示第n个任务 */
|
||||
|
||||
extern int find_lsb(uint32_t u32_val);
|
||||
extern void ape_mtimer_sync(int nScsId);
|
||||
extern void ape_mtimer_unsync(int nScsId);
|
||||
extern void stc_timer_set_tmrpoint(stStcTimerPoint *pTmrPoint);
|
||||
|
||||
//uint32_t g_task_timer_offset_forsoc[120] = {0};
|
||||
char g_register_task_buf[OSP_TMR_POINT_MAX] = {0};
|
||||
uint8_t gu8_register_task_group[10][100] = {0};
|
||||
//char g_t_off_larger[50] = {0};
|
||||
uint8_t gu8_register_task_group[10][OSP_TIMER_TASK_MAX] = {0}; /* 100 -> OSP_TIMER_TASK_MAX,一个时隙最多20个定时点任务 */
|
||||
uint16_t g_reg_task_index = 0;
|
||||
|
||||
stStcTimerPoint g_stcTimerPoint[OSP_TMR_POINT_MAX] = {0};
|
||||
@ -33,8 +26,8 @@ void osp_timer_clear_stctimer()
|
||||
memset(g_stcTimerPoint, 0, sizeof(g_stcTimerPoint));
|
||||
for (u16_loop = 0; u16_loop < 10; u16_loop++)
|
||||
{
|
||||
g_stcTimerPoint[u16_loop*50].pointVal = 0;
|
||||
g_stcTimerPoint[u16_loop*50].lastFlag = 1;
|
||||
g_stcTimerPoint[u16_loop*OSP_TIMER_TASK_MAX].pointVal = 0;
|
||||
g_stcTimerPoint[u16_loop*OSP_TIMER_TASK_MAX].lastFlag = 1;
|
||||
}
|
||||
stc_timer_set_tmrpoint(g_stcTimerPoint);
|
||||
}
|
||||
@ -51,17 +44,6 @@ void osp_timer_clear_task()
|
||||
osp_del_timer_task(g_osp_timer_desc[u16_loop].task_id);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
for (u16_loop = 0; u16_loop < g_reg_task_index; u16_loop++)
|
||||
{
|
||||
//UCP_PRINT_ERROR("loop=%d, taskid=%d", u16_loop, g_register_task_buf[u16_loop]);
|
||||
if (g_register_task_buf[u16_loop] > 0)
|
||||
{
|
||||
osp_del_timer_task(g_register_task_buf[u16_loop]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* OSP侧定时点任务初始化 */
|
||||
@ -69,15 +51,10 @@ void osp_timer_init()
|
||||
{
|
||||
g_osp_timer_desc_idx = 0;
|
||||
g_reg_task_index = 0;
|
||||
g_mtimer_cnt = 0;
|
||||
g_mtimer_loop = 0;
|
||||
memset(g_osp_timer_desc, 0, sizeof(g_osp_timer_desc));
|
||||
memset(g_register_task_buf, 0, sizeof(g_register_task_buf));
|
||||
memset(gu8_register_task_group, 0, sizeof(gu8_register_task_group));
|
||||
//memset(g_t_off_larger, 0, sizeof(g_t_off_larger));
|
||||
memset(g_task_off_tbl, 0, sizeof(g_task_off_tbl));
|
||||
memset(g_stcTimerPoint, 0, sizeof(g_stcTimerPoint));
|
||||
//memset(g_task_timer_offset_forsoc, 0, sizeof(g_task_timer_offset_forsoc));
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -121,7 +98,6 @@ void osp_timer_sync(int scsId)
|
||||
|
||||
ape_mtimer_sync(scsId); // scs id
|
||||
|
||||
//static char once[50] = {0};
|
||||
int tmp_bitmap;
|
||||
int tbl_index = 0;
|
||||
int slot_id = 0;
|
||||
@ -150,28 +126,26 @@ void osp_timer_sync(int scsId)
|
||||
stc_timer_index = 0;
|
||||
for(j = 0; j < 100;j++)
|
||||
{
|
||||
if (50 <= stc_timer_index)
|
||||
if (OSP_TIMER_TASK_MAX <= stc_timer_index)
|
||||
{
|
||||
UCP_PRINT_ERROR("one slot timer tasks overflow\n\r");
|
||||
return ;
|
||||
}
|
||||
if (0 == j)
|
||||
{
|
||||
g_stcTimerPoint[i*50 + stc_timer_index].pointVal = 0;
|
||||
g_stcTimerPoint[i*50 + stc_timer_index].lastFlag = 0;
|
||||
g_stcTimerPoint[i*OSP_TIMER_TASK_MAX + stc_timer_index].pointVal = 0;
|
||||
g_stcTimerPoint[i*OSP_TIMER_TASK_MAX + stc_timer_index].lastFlag = 0;
|
||||
stc_timer_index++;
|
||||
lastOffset = 0;
|
||||
|
||||
if ((0 == g_task_off_tbl[i][j].t_offset) && (0 != g_task_off_tbl[i][j].task_id))
|
||||
{
|
||||
g_register_task_buf[g_reg_task_index] = (char)(g_task_off_tbl[i][j].task_id);
|
||||
gu8_register_task_group[i][stc_timer_index-1] = (uint8_t)(g_task_off_tbl[i][j].task_id);
|
||||
g_reg_task_index++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 第一个点:无task id 或偏移非0,需要加一个假的 */
|
||||
g_register_task_buf[g_reg_task_index] = 0;
|
||||
gu8_register_task_group[i][stc_timer_index-1] = 0;
|
||||
g_reg_task_index++;
|
||||
}
|
||||
@ -180,34 +154,24 @@ void osp_timer_sync(int scsId)
|
||||
{
|
||||
if(g_task_off_tbl[i][j].task_id != 0)
|
||||
{
|
||||
g_stcTimerPoint[i*50 + stc_timer_index].pointVal = g_task_off_tbl[i][j].t_offset - lastOffset; //g_stcTimerPoint[i*50 + stc_timer_index-1].pointVal;
|
||||
g_stcTimerPoint[i*50 + stc_timer_index].lastFlag = 0;
|
||||
g_stcTimerPoint[i*OSP_TIMER_TASK_MAX + stc_timer_index].pointVal = g_task_off_tbl[i][j].t_offset - lastOffset; //g_stcTimerPoint[i*50 + stc_timer_index-1].pointVal;
|
||||
g_stcTimerPoint[i*OSP_TIMER_TASK_MAX + stc_timer_index].lastFlag = 0;
|
||||
lastOffset = g_task_off_tbl[i][j].t_offset;
|
||||
stc_timer_index++;
|
||||
|
||||
g_register_task_buf[g_reg_task_index] = (char)(g_task_off_tbl[i][j].task_id);
|
||||
|
||||
gu8_register_task_group[i][stc_timer_index-1] = (uint8_t)(g_task_off_tbl[i][j].task_id);
|
||||
g_reg_task_index++;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
if(g_task_off_tbl[i][j].task_id != 0)
|
||||
{
|
||||
g_task_timer_offset_forsoc[g_reg_task_index] = i*tti + g_task_off_tbl[i][j].t_offset;
|
||||
g_register_task_buf[g_reg_task_index] = (char)(g_task_off_tbl[i][j].task_id);
|
||||
g_reg_task_index++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/* 补最后一个的状态 */
|
||||
g_stcTimerPoint[i*50 + stc_timer_index -1].lastFlag = 1;
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 225+i), stc_timer_index);
|
||||
g_stcTimerPoint[i*OSP_TIMER_TASK_MAX + stc_timer_index -1].lastFlag = 1;
|
||||
}
|
||||
stc_timer_set_tmrpoint(g_stcTimerPoint);
|
||||
//stc_timer_set_tmrpoint(g_task_timer_offset_forsoc, g_reg_task_index);
|
||||
#ifdef OSP_DEBUG_TEST
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 90), g_reg_task_index);
|
||||
#endif
|
||||
}
|
||||
g_mtimer_cnt = g_reg_task_index;
|
||||
#ifdef UCP_TICK_ENABLE
|
||||
rdmcycle(&clockEnd);
|
||||
clockCnt = clockEnd - clockBegin;
|
||||
@ -244,10 +208,6 @@ void osp_timer_unsync_notask(int scs_id)
|
||||
return ;
|
||||
}
|
||||
|
||||
int get_register_task_id(int index)
|
||||
{
|
||||
return (int)g_register_task_buf[index];
|
||||
}
|
||||
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
uint32_t g_timer_num = 0;
|
||||
@ -255,11 +215,18 @@ uint32_t g_timer_task = 0;
|
||||
uint32_t g_timer_notask = 0;
|
||||
uint32_t g_u16_osp_timer_call_loop = 0;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
int get_register_task_id(int index)
|
||||
{
|
||||
return (int)g_register_task_buf[index];
|
||||
}
|
||||
|
||||
void osp_timer_call_task()
|
||||
{
|
||||
int task_id = 0;
|
||||
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
g_timer_num++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 94), g_timer_num);
|
||||
|
||||
@ -267,32 +234,31 @@ void osp_timer_call_task()
|
||||
rdmcycle(&clockTick);
|
||||
debug_write(OSP2_DEBUG_POT(g_ape_id, g_u16_osp_timer_call_loop), clockTick);
|
||||
g_u16_osp_timer_call_loop = (g_u16_osp_timer_call_loop+1)&0x1FF; /* 512个计数循环覆盖 */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (g_mtimer_loop >= g_mtimer_cnt)
|
||||
{
|
||||
g_mtimer_loop = 0;
|
||||
}
|
||||
task_id = get_register_task_id(g_mtimer_loop);
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 91), task_id);
|
||||
|
||||
if(task_id > 0)
|
||||
{
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
g_timer_task++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 95), g_timer_task);
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 92), task_id);
|
||||
#endif
|
||||
#endif
|
||||
osp_post_timer_event_sem(task_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
#ifdef UCP_OSP_DBG_ENABLE
|
||||
g_timer_notask++;
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 96), g_timer_notask);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
g_mtimer_loop++;
|
||||
//debug_write(OSP_DEBUG_POT(g_ape_id, 93), g_mtimer_loop);
|
||||
|
||||
return ;
|
||||
}
|
||||
@ -300,8 +266,10 @@ void osp_timer_call_task()
|
||||
void osp_timer_restart(void)
|
||||
{
|
||||
g_mtimer_loop = 0;
|
||||
|
||||
return ;
|
||||
}
|
||||
#endif
|
||||
|
||||
void osp_timer_call_task_spe(uint8_t u8slot, uint8_t u8taskidx)
|
||||
{
|
||||
@ -323,6 +291,7 @@ void osp_timer_call_task_spe(uint8_t u8slot, uint8_t u8taskidx)
|
||||
debug_write(OSP_DEBUG_POT(g_ape_id, 96), g_timer_notask);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -77,29 +77,29 @@ static uint32_t gu32_app_recv_que11 = 0;
|
||||
#endif
|
||||
|
||||
#define APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
typedef struct ECS_APP_IFC_STRUCT
|
||||
{
|
||||
uint32_t ecs_msg_deque_num;
|
||||
uint32_t ecs_msg_deque_par_err;
|
||||
uint32_t ecs_msg_alloc_size_err;
|
||||
uint32_t ecs_msg_deque_err;
|
||||
uint32_t ecs_msg_send_num;
|
||||
uint32_t ecs_msg_InQue_err;
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
typedef struct ECS_APP_IFC_STRUCT
|
||||
{
|
||||
uint32_t ecs_msg_deque_num;
|
||||
uint32_t ecs_msg_deque_par_err;
|
||||
uint32_t ecs_msg_alloc_size_err;
|
||||
uint32_t ecs_msg_deque_err;
|
||||
uint32_t ecs_msg_send_num;
|
||||
uint32_t ecs_msg_InQue_err;
|
||||
uint32_t ecs_msg_get_info_empty_num;
|
||||
uint32_t ecs_msg_get_info_OutQue_err;
|
||||
uint32_t ecs_msg_get_info_num;
|
||||
}ecs_app_dbg_info;
|
||||
}ecs_app_dbg_info;
|
||||
|
||||
ecs_app_dbg_info g_ecs_app_debug_info;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int8_t ecs_msg_que_init(uint16_t core_id)
|
||||
{
|
||||
memset(&g_ecs_msg_que, 0, sizeof(g_ecs_msg_que));
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
memset(&g_ecs_app_debug_info, 0, sizeof(g_ecs_app_debug_info));
|
||||
#endif
|
||||
#endif
|
||||
g_ecs_msg_que.que_id = (uint16_t)core_id - 8;
|
||||
g_ecs_msg_que.de_idx = 0;
|
||||
g_ecs_msg_que.dep = ECS_APE_MSG_NUM;
|
||||
@ -119,10 +119,10 @@ int32_t ecs_msg_que_deque(uint32_t *pvalue)
|
||||
/* check */
|
||||
if (NULL == pvalue)
|
||||
{
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_deque_par_err++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 9), g_ecs_app_debug_info.ecs_msg_deque_par_err);
|
||||
#endif
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -138,10 +138,10 @@ int32_t ecs_msg_que_deque(uint32_t *pvalue)
|
||||
{
|
||||
g_ecs_msg_que.de_idx = (g_ecs_msg_que.de_idx +1);
|
||||
}
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_deque_num++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 10), g_ecs_app_debug_info.ecs_msg_deque_num);
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -157,10 +157,10 @@ char *osp_alloc_msg(int32_t size)
|
||||
if ((size+ECS_MSG_HEAD_LEN) > ECS_APE_MSG_SIG_SIZE)
|
||||
{
|
||||
UCP_PRINT_ERROR("ecs_alloc_msg: error (size = 0x%08x)\r\n", size);
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_alloc_size_err++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 11), g_ecs_app_debug_info.ecs_msg_alloc_size_err);
|
||||
#endif
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -169,10 +169,10 @@ char *osp_alloc_msg(int32_t size)
|
||||
{
|
||||
/* no buffer */
|
||||
UCP_PRINT_ERROR("ecs_alloc_msg: error (no addr)\r\n");
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_deque_err++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 12), g_ecs_app_debug_info.ecs_msg_deque_err);
|
||||
#endif
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
return (char*)((uint32_t)addr + (uint32_t)ECS_MSG_HEAD_LEN);
|
||||
@ -191,10 +191,10 @@ int32_t osp_send_msg(uint32_t msg_addr,
|
||||
ecs_msg_head st_msg_head;
|
||||
int32_t ret_queue = -1;
|
||||
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_send_num++;
|
||||
int32_t core_id = get_core_id();
|
||||
#endif
|
||||
#endif
|
||||
pmsg_head = (ecs_msg_head*)((uint32_t)msg_addr - (uint32_t)ECS_MSG_HEAD_LEN);
|
||||
st_msg_head.msg_size = msg_len;
|
||||
st_msg_head.msg_type = msg_type;
|
||||
@ -212,11 +212,11 @@ int32_t osp_send_msg(uint32_t msg_addr,
|
||||
if (0 != ret_queue)
|
||||
{
|
||||
UCP_PRINT_ERROR("ecs_send_msg: error(smart_in_que) que_id = 0x%08x addr = 0x%08x\r\n", dst_core_id, msg_addr);
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_InQue_err++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 13), g_ecs_app_debug_info.ecs_msg_InQue_err);
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 19), ret_queue);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
switch (dst_core_id)
|
||||
@ -288,9 +288,9 @@ int32_t osp_send_msg(uint32_t msg_addr,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 14), g_ecs_app_debug_info.ecs_msg_send_num);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
switch (dst_core_id)
|
||||
@ -376,10 +376,10 @@ int32_t osp_send_msg_oam(uint32_t msg_addr,
|
||||
ecs_msg_head st_msg_head;
|
||||
int32_t ret_queue = -1;
|
||||
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_send_num++;
|
||||
int32_t core_id = get_core_id();
|
||||
#endif
|
||||
#endif
|
||||
pmsg_head = (ecs_msg_head*)((uint32_t)msg_addr - (uint32_t)ECS_MSG_HEAD_LEN);
|
||||
st_msg_head.msg_size = msg_len;
|
||||
//st_msg_head.msg_type = ;
|
||||
@ -395,11 +395,11 @@ int32_t osp_send_msg_oam(uint32_t msg_addr,
|
||||
if (0 != ret_queue)
|
||||
{
|
||||
UCP_PRINT_ERROR("ecs_send_msg: error(smart_in_que) que_id = 0x%08x addr = 0x%08x\r\n", dst_core_id, msg_addr);
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_InQue_err++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 13), g_ecs_app_debug_info.ecs_msg_InQue_err);
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 19), ret_queue);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
switch (dst_core_id)
|
||||
@ -560,20 +560,20 @@ uint8_t ecs_hw_que_get_info(uint8_t que_id, uint32_t* pmsg_addr, uint32_t* pmsg_
|
||||
ret = smart_que_is_empty(que_id);
|
||||
if (0 != ret)
|
||||
{
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_get_info_empty_num++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 15), g_ecs_app_debug_info.ecs_msg_get_info_empty_num);
|
||||
#endif
|
||||
#endif
|
||||
return 1; /* 无数据 */
|
||||
}
|
||||
/* 取出数据 */
|
||||
ret = smart_out_que(que_id, &u32addr);
|
||||
if (0 != ret)
|
||||
{
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_get_info_OutQue_err++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 16), g_ecs_app_debug_info.ecs_msg_get_info_OutQue_err);
|
||||
#endif
|
||||
#endif
|
||||
return 2; /* 取不出数据 */
|
||||
}
|
||||
|
||||
@ -658,10 +658,10 @@ uint8_t ecs_hw_que_get_info(uint8_t que_id, uint32_t* pmsg_addr, uint32_t* pmsg_
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
g_ecs_app_debug_info.ecs_msg_get_info_num++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 17), g_ecs_app_debug_info.ecs_msg_get_info_num);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#include "ucp_drv_common.h"
|
||||
|
||||
#define TDD_TMR_POINT_MAX 500 // 1个TDD周期内,可设置的最多定时点个数
|
||||
#define TDD_SLOT_NUM_MAX 10
|
||||
#define TDD_TMR_POINT_MAX (200) //(500) // 1个TDD周期内,可设置的最多定时点个数
|
||||
#define TDD_SLOT_NUM_MAX 10
|
||||
|
||||
#define STC_RT_PALLADIUM 100000000
|
||||
#define STC_RT 1000000000
|
||||
|
@ -1,18 +1,18 @@
|
||||
// +FHDR------------------------------------------------------------
|
||||
// Copyright (c) 2022 SmartLogic.
|
||||
// ALL RIGHTS RESERVED
|
||||
// -----------------------------------------------------------------
|
||||
// Filename : log_client.h
|
||||
// Author : xianfeng.du
|
||||
// Created On : 2023-02-06
|
||||
// Last Modified :
|
||||
// -----------------------------------------------------------------
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// -FHDR------------------------------------------------------------
|
||||
// +FHDR------------------------------------------------------------
|
||||
// Copyright (c) 2022 SmartLogic.
|
||||
// ALL RIGHTS RESERVED
|
||||
// -----------------------------------------------------------------
|
||||
// Filename : log_client.h
|
||||
// Author : xianfeng.du
|
||||
// Created On : 2023-02-06
|
||||
// Last Modified :
|
||||
// -----------------------------------------------------------------
|
||||
// Description:
|
||||
//
|
||||
//
|
||||
// -FHDR------------------------------------------------------------
|
||||
|
||||
#ifndef __SPU_LOG_CLIENT_H__
|
||||
#ifndef __SPU_LOG_CLIENT_H__
|
||||
#define __SPU_LOG_CLIENT_H__
|
||||
|
||||
#include "typedef.h"
|
||||
@ -22,27 +22,27 @@
|
||||
#define SPU_LOG_CLIENT_BUF_SIZE (512) /* Log软件队列一个队列的消息长512Bytes */
|
||||
#define SPU_LOG_CLIENT_BUF_DEPTH (128) /* Log软件队列每个APE的深度为128个消息*/
|
||||
|
||||
typedef struct tSpuLogClientInfo {
|
||||
uint32_t alloc;
|
||||
uint32_t bufBase;
|
||||
uint32_t bufSize;
|
||||
uint16_t ringSize;
|
||||
uint16_t ringMask;
|
||||
} SpuLogClientInfo_t;
|
||||
typedef struct tSpuLogClientInfo {
|
||||
uint32_t alloc;
|
||||
uint32_t bufBase;
|
||||
uint32_t bufSize;
|
||||
uint16_t ringSize;
|
||||
uint16_t ringMask;
|
||||
} SpuLogClientInfo_t;
|
||||
|
||||
typedef struct tSpuLogCommonInfo {
|
||||
uint32_t alloc[MAX_NUM_SPU];
|
||||
typedef struct tSpuLogCommonInfo {
|
||||
uint32_t alloc[MAX_NUM_SPU];
|
||||
} SpuLogCommonInfo_t;
|
||||
|
||||
typedef union tSpuLogMsgInfo {
|
||||
uint32_t value;
|
||||
struct {
|
||||
uint32_t cell_id : 4;
|
||||
uint32_t core_id : 4;
|
||||
uint32_t buf_idx : 8;
|
||||
uint32_t buf_size : 16;
|
||||
//uint32_t rsv : 0;
|
||||
};
|
||||
typedef union tSpuLogMsgInfo {
|
||||
uint32_t value;
|
||||
struct {
|
||||
uint32_t cell_id : 4;
|
||||
uint32_t core_id : 4;
|
||||
uint32_t buf_idx : 8;
|
||||
uint32_t buf_size : 16;
|
||||
//uint32_t rsv : 0;
|
||||
};
|
||||
} SpuLogMsgInfo_t;
|
||||
|
||||
void spu_log_client_init(void);
|
||||
|
@ -62,7 +62,11 @@ void ecs_hw_que_init(uint8_t core_id)
|
||||
}
|
||||
while(i32ret != 0);
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init]: smart_hq_init OK\r\n");
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 28), core_id);
|
||||
#endif
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
void ecs_hw_que_init_withirq(uint8_t core_id, uint8_t que_id)
|
||||
@ -78,17 +82,16 @@ void ecs_hw_que_init_withirq(uint8_t core_id, uint8_t que_id)
|
||||
memset(&g_ecs_hw_que_info, 0, sizeof(g_ecs_hw_que_info));
|
||||
g_ecs_hw_que_info.ecs_hq_id = que_id;
|
||||
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_withirq]: smart_hq_init OK\r\n");
|
||||
UCP_PRINT_EMPTY("[ecs_withirq]: smart_hq_init OK\r\n");
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 29), que_id);
|
||||
#endif
|
||||
|
||||
/* Band */
|
||||
ret = smart_que_bind(core_id, que_id);
|
||||
if (0 != ret)
|
||||
{
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_withirq]: smart_que_bind error!!!!!(core_id = 0x%x, que_id= 0x%x)\r\n", core_id, que_id);
|
||||
//#ifdef ECS_PALLADIUM_TEST
|
||||
//debug_write((ECS_LOG_INDEX + 20), core_id);
|
||||
//#endif
|
||||
UCP_PRINT_EMPTY("[ecs_withirq]: smart_que_bind error!(core_id=%d, que_id=%d)", core_id, que_id);
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 23), ret);
|
||||
return ;
|
||||
}
|
||||
@ -99,35 +102,35 @@ void ecs_hw_que_init_withirq(uint8_t core_id, uint8_t que_id)
|
||||
{
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 21), ret);
|
||||
}
|
||||
UCP_PRINT_EMPTY("[ecs_withirq]: que_id(%d),dep(%d),width(%d),used(%d),cpuid(%d)", que_id, que_dep,que_width,que_used,que_cpuid);
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 30), 0x1);
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_withirq]: que_id(0x%08x),dep(0x%08x),width(0x%08x),used(0x%08x),cpuid(0x%08x) \r\n", que_id, que_dep,que_width,que_used,que_cpuid);
|
||||
#endif
|
||||
|
||||
/* Get queue vector */
|
||||
g_ecs_hw_que_info.ecs_hq_vector = smart_get_hq_vector(core_id, que_id);
|
||||
if (0 >= g_ecs_hw_que_info.ecs_hq_vector)
|
||||
{
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_withirq]: smart_get_hq_vector error!!!!!(core_id = 0x%08x)....\r\n", core_id);
|
||||
//#ifdef ECS_PALLADIUM_TEST
|
||||
//debug_write((ECS_LOG_INDEX + 21), core_id);
|
||||
//#endif
|
||||
UCP_PRINT_EMPTY("[ecs_withirq]: smart_get_hq_vector error!(core_id=%d)", core_id);
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 17), g_ecs_hw_que_info.ecs_hq_vector);
|
||||
return ;
|
||||
}
|
||||
UCP_PRINT_EMPTY("[ecs_withirq]: hq_vector=%d (coreid=%d, quei=%d)", g_ecs_hw_que_info.ecs_hq_vector, core_id, que_id);
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 31), g_ecs_hw_que_info.ecs_hq_vector);
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_withirq]: hq_vector = 0x%x (coreid = 0x%x, queid = 0x%x)\r\n", g_ecs_hw_que_info.ecs_hq_vector, core_id, que_id);
|
||||
#endif
|
||||
|
||||
/* Set req */
|
||||
ret = smart_irq_request(g_ecs_hw_que_info.ecs_hq_vector, ecs_hw_que_irq);
|
||||
if (0 != ret)
|
||||
{
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_withirq]: smart_irq_request error!!!!!(core_id = 0x%08x)....\r\n", core_id);
|
||||
//#ifdef ECS_PALLADIUM_TEST
|
||||
//debug_write((ECS_LOG_INDEX + 22), core_id);
|
||||
//#endif
|
||||
UCP_PRINT_EMPTY("[ecs_withirq]: smart_irq_request error!(core_id=%d)", core_id);
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 7), ret);
|
||||
return ;
|
||||
}
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 30), 0x2);
|
||||
#endif
|
||||
|
||||
/* enable no-empty irq */
|
||||
for (u8_loop = 0; u8_loop < 8; u8_loop++)
|
||||
@ -144,11 +147,11 @@ void ecs_hw_que_init_withirq(uint8_t core_id, uint8_t que_id)
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 49), ret);
|
||||
return ;
|
||||
}
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
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);
|
||||
#endif
|
||||
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_withirq]: OK \r\n");
|
||||
UCP_PRINT_EMPTY("[ecs_withirq]: OK \r\n");
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -167,7 +170,7 @@ void ecs_hw_que_init_noirq(uint8_t core_id, uint8_t que_id)
|
||||
i32ret = smart_que_bind(core_id, que_id);
|
||||
if (0 != i32ret)
|
||||
{
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_noirq]: smart_que_bind error!!!!!(core_id = 0x%x, que_id= 0x%x)\r\n", core_id, que_id);
|
||||
UCP_PRINT_EMPTY("[ecs_noirq]: smart_que_bind error!(core_id=%d, que_id=%d)", core_id, que_id);
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 39), i32ret);
|
||||
return ;
|
||||
}
|
||||
@ -178,17 +181,19 @@ void ecs_hw_que_init_noirq(uint8_t core_id, uint8_t que_id)
|
||||
{
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 40), i32ret);
|
||||
}
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_noirq]: que_id(0x%08x),dep(0x%08x),width(0x%08x),used(0x%08x),cpuid(0x%08x) \r\n", que_id, i32que_dep, i32que_width, i32que_used, i32que_cpuid);
|
||||
UCP_PRINT_EMPTY("[ecs_noirq]: que_id(%d),dep(%d),width(%d),used(%d),cpuid(%d)", que_id, i32que_dep, i32que_width, i32que_used, i32que_cpuid);
|
||||
|
||||
/* Get queue vector */
|
||||
gst_ecs_hw_que_info_noirq.ecs_hq_vector = smart_get_hq_vector(core_id, que_id);
|
||||
if (0 >= gst_ecs_hw_que_info_noirq.ecs_hq_vector)
|
||||
{
|
||||
UCP_PRINT_EMPTY("[ecs_hw_que_init_noirq]: smart_get_hq_vector error!!!!!(core_id = 0x%08x)....\r\n", core_id);
|
||||
UCP_PRINT_EMPTY("[ecs_noirq]: smart_get_hq_vector error!(core_id=%d)", core_id);
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 17), gst_ecs_hw_que_info_noirq.ecs_hq_vector);
|
||||
return ;
|
||||
}
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 32), que_id);
|
||||
#endif
|
||||
|
||||
return ;
|
||||
}
|
||||
@ -199,33 +204,33 @@ uint32_t gu32_ecs_recv_cnt = 0;
|
||||
ALWAYS_INLINE int32_t ecs_hw_que_send(uint8_t u8dst_que_id, uint32_t u32value)
|
||||
{
|
||||
int32_t i32ret = 0;
|
||||
int32_t apeId = get_core_id();
|
||||
int32_t core_id = get_core_id();
|
||||
|
||||
i32ret = smart_in_que(u8dst_que_id, u32value);
|
||||
if (0 != i32ret)
|
||||
{
|
||||
//UCP_PRINT_ERROR("[ecs_hw_que_send]: error(smart_in_que) que_id = 0x%08x addr = 0x%08x\r\n", u8dst_que_id, u32value);
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 41), i32ret);
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 41), i32ret);
|
||||
return i32ret;
|
||||
}
|
||||
gu32_ecs_send_cnt++;
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 43), gu32_ecs_send_cnt);
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 43), gu32_ecs_send_cnt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int32_t ecs_hw_que_recv(uint8_t u8dst_que_id, uint32_t *pu32value)
|
||||
{
|
||||
int32_t i32ret = 0;
|
||||
int32_t apeId = get_core_id();
|
||||
int32_t core_id = get_core_id();
|
||||
|
||||
/* is empty */
|
||||
i32ret = smart_que_is_empty(u8dst_que_id);
|
||||
if (0 != i32ret)
|
||||
{
|
||||
/* no message return */
|
||||
#ifdef APP_PALLADIUM_TEST
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 47), i32ret);
|
||||
#endif
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -233,12 +238,12 @@ ALWAYS_INLINE int32_t ecs_hw_que_recv(uint8_t u8dst_que_id, uint32_t *pu32value)
|
||||
if (0 != i32ret)
|
||||
{
|
||||
//UCP_PRINT_ERROR("[ecs_hw_que_recv]: smart_out_que error... que_id = 0x%08x \r\n", u8dst_que_id);
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 42), i32ret);
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 42), i32ret);
|
||||
return i32ret;
|
||||
}
|
||||
gu32_ecs_recv_cnt++;
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 44), gu32_ecs_recv_cnt);
|
||||
debug_write(DBG_DDR_ERR_IDX(apeId, 45), *pu32value);
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 44), gu32_ecs_recv_cnt);
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 45), *pu32value);
|
||||
return i32ret;
|
||||
}
|
||||
|
||||
@ -253,9 +258,9 @@ void ecs_hw_que_irq(void)
|
||||
ecs_msg_head *pmsg_head = NULL;
|
||||
int32_t core_id = get_core_id();
|
||||
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
g_ecs_debug_info.ecs_msg_irq_num++;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
debug_write(OSP_DEBUG_HW_POT(core_id, 38), g_ecs_debug_info.ecs_msg_irq_num);
|
||||
@ -264,20 +269,21 @@ void ecs_hw_que_irq(void)
|
||||
ret = smart_que_is_empty(g_ecs_hw_que_info.ecs_hq_id);
|
||||
while(ret == 0)
|
||||
{
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
g_ecs_debug_info.ecs_msg_OutQue_num++;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* out queue */
|
||||
ret = smart_out_que(g_ecs_hw_que_info.ecs_hq_id, &idx);
|
||||
if (0 != ret)
|
||||
{
|
||||
UCP_PRINT_ERROR("[ecs_hw_que_irq]: smart_out_que error... que_id = 0x%08x \r\n", g_ecs_hw_que_info.ecs_hq_id);
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
g_ecs_debug_info.ecs_msg_OutQue_err++;
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 33), g_ecs_debug_info.ecs_msg_OutQue_err);
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 34), g_ecs_debug_info.ecs_msg_irq_num);
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 35), g_ecs_debug_info.ecs_msg_OutQue_num);
|
||||
#endif
|
||||
#endif
|
||||
debug_write(DBG_DDR_ERR_IDX(core_id, 28), ret);
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
@ -286,19 +292,19 @@ void ecs_hw_que_irq(void)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
g_ecs_debug_info.ecs_msg_QutQue_ok++;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
UCP_PRINT_LOG("[ecs_hw_que_irq]: smart_out_que(0x%08x), addr = 0x%08x\r\n", g_ecs_hw_que_info.ecs_hq_id, idx);
|
||||
if (NULL != g_ecs_hw_que_info.irq_entry)
|
||||
{
|
||||
pmsg_head = (ecs_msg_head*)((uint32_t)idx - (uint32_t)ECS_MSG_HEAD_LEN);
|
||||
len = do_read((char*)(&pmsg_head->msg_size));
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 36), g_ecs_debug_info.ecs_msg_irq_num);
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 37), g_ecs_debug_info.ecs_msg_OutQue_num);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef UCP_OSP_DBG_HW_CNT_ENABLE
|
||||
uint8_t src_core_id = do_read_byte((char*)(&pmsg_head->src_core_id));
|
||||
@ -384,16 +390,14 @@ void ecs_hw_que_irq_callback(ECS_HWQUE_IRQ_FUNC func)
|
||||
{
|
||||
if (NULL == func)
|
||||
{
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
#ifdef ECS_PALLADIUM_TEST
|
||||
int32_t core_id = get_core_id();
|
||||
debug_write(DBG_DDR_COMMON_IDX(core_id, 38), 0xF0F0F0F0);
|
||||
#endif
|
||||
#endif
|
||||
return ;
|
||||
}
|
||||
g_ecs_hw_que_info.irq_entry = func;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
/*****************************************************/
|
||||
|
||||
|
||||
|
@ -38,9 +38,10 @@ uint8_t gu8osp_print_level = 0;
|
||||
void spu_log_init(uint8_t level)
|
||||
{
|
||||
gu8osp_print_level = level;//LOG_ERROR; //LOG_DEBUG;
|
||||
#ifdef SPU_LOG_TEST_FLAG
|
||||
#ifdef SPU_LOG_TEST_FLAG
|
||||
memset(&gstspu_log_dbg, 0, sizeof(gstspu_log_dbg));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
@ -61,21 +62,22 @@ uint8_t spu_log_level_set(spu_log_level_e emlog_level)
|
||||
|
||||
/* 获取平台Log打印级别 */
|
||||
uint8_t spu_log_level_get(void)
|
||||
{
|
||||
UCP_PRINT_LOG("spu_log_level_get gu8osp_print_level %u", gu8osp_print_level);
|
||||
|
||||
{
|
||||
UCP_PRINT_LOG("spu_log_level_get gu8osp_print_level %u", gu8osp_print_level);
|
||||
|
||||
return gu8osp_print_level;
|
||||
}
|
||||
|
||||
uint32_t spu_vsprint_log(char *dst, const char *fmt, ...)
|
||||
uint32_t spu_vsprint_log(char *dst, const char *fmt, ...)
|
||||
{
|
||||
uint32_t u32str_len = 0;
|
||||
va_list st_va_list;
|
||||
va_start(st_va_list, fmt);
|
||||
u32str_len = vsprintf(dst, fmt, st_va_list);
|
||||
va_end(st_va_list);
|
||||
uint32_t u32str_len = 0;
|
||||
va_list st_va_list;
|
||||
va_start(st_va_list, fmt);
|
||||
u32str_len = vsprintf(dst, fmt, st_va_list);
|
||||
va_end(st_va_list);
|
||||
return u32str_len;
|
||||
}
|
||||
}
|
||||
|
||||
/* 平台打印输出函数 */
|
||||
void spu_log_output(uint8_t level, const char *fmt, ...)
|
||||
{
|
||||
@ -327,46 +329,46 @@ void osp_sendLog_print(int level, char* pbuf, int size, int cell_id)
|
||||
|
||||
#ifdef PCIE_BACKHAUL
|
||||
#include "../../../pet_rfm_spu0/driver/inc/ucp_pcie_traffic.h"
|
||||
#define LOGBUFSIZE 256
|
||||
#define LOGBUFSIZE (256)
|
||||
char tmp_buf[LOGBUFSIZE] = {0};
|
||||
|
||||
void com_debug_log(const char *fmt, ...)
|
||||
{
|
||||
PcieEpMemBarStruct_t* pUcpMemBar = (PcieEpMemBarStruct_t *)0x08740000;//pMemSection->baseAddr;
|
||||
{
|
||||
PcieEpMemBarStruct_t* pUcpMemBar = (PcieEpMemBarStruct_t *)0x08740000;//pMemSection->baseAddr;
|
||||
//uint32_t core_id = get_core_id();
|
||||
uint32_t count = 0;
|
||||
uint32_t count = 0;
|
||||
uint32_t i = 0;
|
||||
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
while(1)
|
||||
{
|
||||
count++;
|
||||
|
||||
va_list args;
|
||||
va_start(args,fmt);
|
||||
while(1)
|
||||
{
|
||||
count++;
|
||||
if(do_read((void *)&pUcpMemBar->command[PCI_ENDPOINT_UCPEP_EP_ED]) == 0)
|
||||
{
|
||||
vsnprintf(tmp_buf, LOGBUFSIZE, fmt, args);
|
||||
{
|
||||
vsnprintf(tmp_buf, LOGBUFSIZE, fmt, args);
|
||||
//ape_csu_dma_1D_L2G_ch2ch3_transfer((uint64_t)((uint32_t)(tmp_buf-0x100000)), pUcpMemBar->log_buf, 1024, inst_id, 1);
|
||||
//memcpy_ucp(pUcpMemBar->log_buf, tmp_buf, 1024);
|
||||
for(i=0;i<LOGBUFSIZE;i++)
|
||||
{
|
||||
do_write_byte((char *)(&pUcpMemBar->log_buf[i]), tmp_buf[i]);
|
||||
}
|
||||
}
|
||||
do_write((uint32_t*)&pUcpMemBar->command[PCI_ENDPOINT_UCPEP_EP_ED], 1);
|
||||
//do_write(((uint32_t*)(&APC_CSU_DMAZSTEPL0) + (apeId<<6) + (i<<3)), 4096);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 1
|
||||
if(count > 1000)
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
ucp_nop(100);
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 1
|
||||
if(count > 1000)
|
||||
{
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
ucp_nop(100);
|
||||
}
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user