diff --git a/app/src/main.c b/app/src/main.c index 084e874..4bb78b5 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -27,6 +27,7 @@ int32_t test_case(uint32_t argc, int32_t* argvp); extern OSP_STATUS osp_init(); +extern int32_t osp_set_taskcpu(uint8_t cpu, uint8_t pri); extern uint8_t osp_sw_queue_init(); #ifdef ENABLE_JESD_TEST @@ -52,6 +53,7 @@ int32_t main(int32_t argc, char* argvp[]) UCP_API_RFIC_CellSetup(2575770000u, 2575770000u, 100000000u, 0); #endif osp_init(); + osp_set_taskcpu(7, 95); drv_init(); #ifdef PALLADIUM_TEST diff --git a/interface/arm_interface.h b/interface/arm_interface.h index 52c5109..b81437f 100644 --- a/interface/arm_interface.h +++ b/interface/arm_interface.h @@ -59,6 +59,16 @@ brief: osp function 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); /* diff --git a/osp/inc/ospTask.h b/osp/inc/ospTask.h index ba51002..a578d7a 100644 --- a/osp/inc/ospTask.h +++ b/osp/inc/ospTask.h @@ -177,7 +177,9 @@ extern int32_t osp_task_is_shell(uint32_t taskid); 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_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 } diff --git a/osp/src/ospLog.c b/osp/src/ospLog.c index b76a319..6e89f09 100644 --- a/osp/src/ospLog.c +++ b/osp/src/ospLog.c @@ -228,8 +228,8 @@ OSP_STATUS osp_update_log(uint32_t len, uint32_t logid, uint32_t msg_type) ulfreeram = osp_get_freeram(); if((ulfreeram <= FREE_RAM_SIZE) || (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); - system(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); 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); osp_log_cfg_reload(); } diff --git a/osp/src/ospTask.c b/osp/src/ospTask.c index f1a859a..bfe11e2 100644 --- a/osp/src/ospTask.c +++ b/osp/src/ospTask.c @@ -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}, //{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}, - {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}, + //{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}, + //{OspTickLess, "OspTickLess", RT_NOMSG_PRI(20), NULL, (OSP_FUNCPTR)osp_tick_less, 1, OSP_PROCESS_MSG}, #ifdef HEARTBEAT_ENABLE {OspTmrTask, "OspTmrTask", RT_NOMSG_PRI(99), NULL, (OSP_FUNCPTR)OspTimerTask, 2, OSP_OTHER_MSG}, #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}, }; @@ -520,15 +520,51 @@ OSP_TASKCB *osp_get_taskcb_base(void) 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; - CPU_ZERO(&mask); - CPU_SET(cpuid, &mask); - - osp_assert(0 == pthread_setaffinity_np(gOspTask[taskid].PhreadId, sizeof(mask), &mask)); - return 0; + OSP_TASKMSG_REG task_reg_tabl[3]; + uint8_t i = 0; + OSP_STATUS ret = OSP_OK; + + if (cpu > 7) + { + 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; } -