Merge branch 'dev_ck_v2.1_whf' into 'dev_ck_v2.1'

新增用户绑核接口osp_set_taskcpu##new feature992

See merge request ucp/driver/ucp4008_platform_arm!14
This commit is contained in:
Xianfeng Du 2023-08-16 16:38:31 +00:00
commit a6cc27e188
5 changed files with 69 additions and 19 deletions

View File

@ -27,6 +27,7 @@
int32_t test_case(uint32_t argc, int32_t* argvp); int32_t test_case(uint32_t argc, int32_t* argvp);
extern OSP_STATUS osp_init(); extern OSP_STATUS osp_init();
extern int32_t osp_set_taskcpu(uint8_t cpu, uint8_t pri);
extern uint8_t osp_sw_queue_init(); extern uint8_t osp_sw_queue_init();
#ifdef ENABLE_JESD_TEST #ifdef ENABLE_JESD_TEST
@ -52,6 +53,7 @@ int32_t main(int32_t argc, char* argvp[])
UCP_API_RFIC_CellSetup(2575770000u, 2575770000u, 100000000u, 0); UCP_API_RFIC_CellSetup(2575770000u, 2575770000u, 100000000u, 0);
#endif #endif
osp_init(); osp_init();
osp_set_taskcpu(7, 95);
drv_init(); drv_init();
#ifdef PALLADIUM_TEST #ifdef PALLADIUM_TEST

View File

@ -59,6 +59,16 @@ brief: osp function init
*/ */
OSP_STATUS osp_init(); OSP_STATUS osp_init();
/********************** set task function *********************/
/*
name: osp_set_taskcpu
para: uint8_t cpu :0-7
para: uint8_t pri :1-99
brief: osp function init
return value:0:success
*/
int32_t osp_set_taskcpu(uint8_t cpu, uint8_t pri);
uint32_t read_stc_local_timer(void); uint32_t read_stc_local_timer(void);
/* /*

View File

@ -177,7 +177,9 @@ extern int32_t osp_task_is_shell(uint32_t taskid);
extern void osp_start_task_all(void); extern void osp_start_task_all(void);
extern int32_t osp_set_net_task_msg_que(int32_t taskid, int32_t txudpid, int32_t rxudpid); extern int32_t osp_set_net_task_msg_que(int32_t taskid, int32_t txudpid, int32_t rxudpid);
extern int32_t osp_local_shell_task_is_reged(void); extern int32_t osp_local_shell_task_is_reged(void);
extern OSP_STATUS osp_regtask(OSP_TASKMSG_REG *TaskRegTbl); extern OSP_STATUS osp_regtask(OSP_TASKMSG_REG *TaskRegTbl);
extern int32_t osp_set_taskcpu(uint8_t cpu, uint8_t pri);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -203,7 +203,7 @@ OSP_STATUS osp_update_log(uint32_t len, uint32_t logid, uint32_t msg_type)
char msg_name[10] = {0}; char msg_name[10] = {0};
int32_t file_idx = 0; int32_t file_idx = 0;
uint32_t type = 0; uint32_t type = 0;
uint32_t ulfreeram = 0; //uint32_t ulfreeram = 0;
if (logid >= MAX_LOG_CFG_NUM || logid < 0) if (logid >= MAX_LOG_CFG_NUM || logid < 0)
{ {
@ -225,12 +225,12 @@ OSP_STATUS osp_update_log(uint32_t len, uint32_t logid, uint32_t msg_type)
UCP_PRINT_LOG("osp_update_log logid:%d type:0x%x cur_sum_len:%u max_file_size_M:%u !\n", logid,type, p_log_file_cfg[logid][type].cur_sum_len, p_log_file_cfg[logid][type].max_file_size_M); UCP_PRINT_LOG("osp_update_log logid:%d type:0x%x cur_sum_len:%u max_file_size_M:%u !\n", logid,type, p_log_file_cfg[logid][type].cur_sum_len, p_log_file_cfg[logid][type].max_file_size_M);
/*判断当前系统是否还有足够空间*/ /*判断当前系统是否还有足够空间*/
ulfreeram = osp_get_freeram(); //ulfreeram = osp_get_freeram();
if((ulfreeram <= FREE_RAM_SIZE) || (1 == g_ucFflushEnable)) if(1 == g_ucFflushEnable)
{ {
sprintf(name, "rm -rf %s%u-%u-%s.log", p_log_file_cfg[logid][type].logname, (p_log_file_cfg[logid][type].cur_file_idx & 0x7)+1, logid, msg_name); //sprintf(name, "rm -rf %s%u-%u-%s.log", p_log_file_cfg[logid][type].logname, (p_log_file_cfg[logid][type].cur_file_idx & 0x7)+1, logid, msg_name);
system(name); //system(name);
UCP_PRINT_LOG("osp_update_log line:%d logid:%d type:0x%x ulfreeram:%u g_ucFflushEnable:%u name:%s\n", __LINE__, logid, type, ulfreeram, g_ucFflushEnable, name); UCP_PRINT_LOG("osp_update_log line:%d logid:%d type:0x%x g_ucFflushEnable:%u name:%s\n", __LINE__, logid, type, g_ucFflushEnable, name);
osp_log_cfg_reload(); osp_log_cfg_reload();
} }

View File

@ -68,13 +68,13 @@ OSP_TASKMSG_REG g_TaskRegTbl[] =
{ {
//{DbgLogTask, "OspDbglog", NOMARL_MSG_PRI(7), NULL, (OSP_FUNCPTR)osp_dbg_log_main, 0, OSP_PROCESS_MSG}, //{DbgLogTask, "OspDbglog", NOMARL_MSG_PRI(7), NULL, (OSP_FUNCPTR)osp_dbg_log_main, 0, OSP_PROCESS_MSG},
//{localshellout, "localshellout", RT_MSG_PRI(10), NULL, (OSP_FUNCPTR)osp_local_shell_out_main, 0, OSP_PROCESS_MSG}, //{localshellout, "localshellout", RT_MSG_PRI(10), NULL, (OSP_FUNCPTR)osp_local_shell_out_main, 0, OSP_PROCESS_MSG},
{localshellin, "localshellin", RT_NOMSG_PRI(98), NULL, (OSP_FUNCPTR)osp_shell_main, 0, OSP_PROCESS_MSG}, //{localshellin, "localshellin", RT_NOMSG_PRI(98), NULL, (OSP_FUNCPTR)osp_shell_main, 0, OSP_PROCESS_MSG},
{remoteshellout, "remoteshellout", RT_NOMSG_PRI(98), NULL, (OSP_FUNCPTR)osp_shell_task, 0, OSP_OTHER_MSG}, //{remoteshellout, "remoteshellout", RT_NOMSG_PRI(98), NULL, (OSP_FUNCPTR)osp_shell_task, 0, OSP_OTHER_MSG},
{OspTickLess, "OspTickLess", RT_NOMSG_PRI(20), NULL, (OSP_FUNCPTR)osp_tick_less, 1, OSP_PROCESS_MSG}, //{OspTickLess, "OspTickLess", RT_NOMSG_PRI(20), NULL, (OSP_FUNCPTR)osp_tick_less, 1, OSP_PROCESS_MSG},
#ifdef HEARTBEAT_ENABLE #ifdef HEARTBEAT_ENABLE
{OspTmrTask, "OspTmrTask", RT_NOMSG_PRI(99), NULL, (OSP_FUNCPTR)OspTimerTask, 2, OSP_OTHER_MSG}, {OspTmrTask, "OspTmrTask", RT_NOMSG_PRI(99), NULL, (OSP_FUNCPTR)OspTimerTask, 2, OSP_OTHER_MSG},
#endif #endif
{OspDbgLog, "OspLogTask", RT_NOMSG_PRI(75), NULL, (OSP_FUNCPTR)osp_oam_msg_proc_task, 0, OSP_OTHER_MSG}, //{OspDbgLog, "OspLogTask", RT_NOMSG_PRI(75), NULL, (OSP_FUNCPTR)osp_oam_msg_proc_task, 0, OSP_OTHER_MSG},
//{ospnetshellrx, "ospnetshellrx", NOMARL_MSG_PRI(6), (OSP_FUNCPTR)osp_net_shell_init, (OSP_FUNCPTR)osp_net_shell_main, 0, OSP_UDP_MSG, (U64)&udp_shell_rx_task}, //{ospnetshellrx, "ospnetshellrx", NOMARL_MSG_PRI(6), (OSP_FUNCPTR)osp_net_shell_init, (OSP_FUNCPTR)osp_net_shell_main, 0, OSP_UDP_MSG, (U64)&udp_shell_rx_task},
}; };
@ -520,15 +520,51 @@ OSP_TASKCB *osp_get_taskcb_base(void)
return gOspTask; return gOspTask;
} }
int32_t osp_set_taskcpu(int32_t taskid, int32_t cpuid) int32_t osp_set_taskcpu(uint8_t cpu, uint8_t pri)
{ {
cpu_set_t mask; OSP_TASKMSG_REG task_reg_tabl[3];
CPU_ZERO(&mask); uint8_t i = 0;
CPU_SET(cpuid, &mask); OSP_STATUS ret = OSP_OK;
osp_assert(0 == pthread_setaffinity_np(gOspTask[taskid].PhreadId, sizeof(mask), &mask)); if (cpu > 7)
return 0; {
UCP_PRINT_DEBUG("coreid %d beyond 7\n", cpu);
return OSP_ERROR;
}
memset(&task_reg_tabl[0], 0, sizeof(OSP_TASKMSG_REG));
task_reg_tabl[0].TaskId = OspDbgLog;
strcpy((void *)&task_reg_tabl[0].TaskName,"OspDbgLog");
task_reg_tabl[0].TaskPri = RT_NOMSG_PRI(pri);
task_reg_tabl[0].Init = NULL;
task_reg_tabl[0].MainLoop = (OSP_FUNCPTR)osp_oam_msg_proc_task;
task_reg_tabl[0].Cpu = cpu;
task_reg_tabl[0].MsgType = OSP_PROCESS_MSG;
memset(&task_reg_tabl[1], 0, sizeof(OSP_TASKMSG_REG));
task_reg_tabl[1].TaskId = localshellin;
strcpy((void *)&task_reg_tabl[1].TaskName,"localshellin");
task_reg_tabl[1].TaskPri = RT_NOMSG_PRI(90);
task_reg_tabl[1].Init = NULL;
task_reg_tabl[1].MainLoop = (OSP_FUNCPTR)osp_shell_main;
task_reg_tabl[1].Cpu = cpu;
task_reg_tabl[1].MsgType = OSP_OTHER_MSG;
memset(&task_reg_tabl[2], 0, sizeof(OSP_TASKMSG_REG));
task_reg_tabl[2].TaskId = remoteshellout;
strcpy((void *)&task_reg_tabl[2].TaskName,"remoteshellout");
task_reg_tabl[2].TaskPri = RT_NOMSG_PRI(91);
task_reg_tabl[2].Init = NULL;
task_reg_tabl[2].MainLoop = (OSP_FUNCPTR)osp_shell_task;
task_reg_tabl[2].Cpu = cpu;
task_reg_tabl[2].MsgType = OSP_OTHER_MSG;
for (i = 0; i < 3; i++)
{
ret = osp_regtask(&task_reg_tabl[i]);
}
return ret;
} }