/* diag fw */ VOS_VOID st_drx_vote_001(void) { drx_msp_fid_vote_lock(DRX_DIAG_FW_VOTE); VOS_TaskDelay(100); drx_msp_global_debug(); VOS_TaskDelay(100); drx_msp_fid_vote_unlock(DRX_DIAG_FW_VOTE); }
VOS_VOID st_drx_vote_004(void) { drx_msp_global_debug(); VOS_TaskDelay(10); drx_msp_fid_vote_lock(DRX_FTM_MAILBOX_VOTE); drx_msp_global_debug(); VOS_TaskDelay(10); drx_msp_fid_vote_unlock(DRX_FTM_MAILBOX_VOTE); drx_msp_global_debug(); }
/* diag app agent */ VOS_VOID st_drx_vote_002(void) { drx_msp_global_debug(); VOS_TaskDelay(10); drx_msp_fid_vote_lock(DRX_L4A_VOTE); drx_msp_global_debug(); VOS_TaskDelay(10); drx_msp_fid_vote_unlock(DRX_L4A_VOTE); drx_msp_global_debug(); VOS_TaskDelay(10); }
/* diag fw */ VOS_VOID st_drx_vote_001(void) { /* drx_msp_global_debug(); */ drx_msp_fid_vote_lock(DRX_DIAG_MODEM_AGENT_VOTE); VOS_TaskDelay(100); drx_msp_global_debug(); VOS_TaskDelay(100); drx_msp_fid_vote_unlock(DRX_DIAG_MODEM_AGENT_VOTE); /* drx_msp_global_debug();*/ }
/***************************************************************************** 函 数 名 : diag_PortTask 功能描述 : 注册自处理任务 输入参数 : 输出参数 : 返 回 值 : 调用函数 : 被调函数 : 修改历史 : *****************************************************************************/ VOS_VOID diag_PortTask(VOS_VOID) { while(1) { /*TO DO*/ if(DIAG_PORT_GET_INIT(EN_DIAG_SOCKET_BEARER_TCP_20248) == EN_PORT_INIT_SUCC) { /* listen on TCP port to monitor incoming connections*/ /*diag_BindListenTcpSocket();*/ /* receive TCP data on sockets*/ /*diag_AcceptRecvFromSocket();*/ VOS_TaskDelay(10000); } else { VOS_TaskDelay(10000); } } }
GOS_ERROR_CODE tmr_TimerTask(void) { while (1) { tmr_CheckTimers(); VOS_TaskDelay(100); tmr_TimerUpdate(); } return GOS_OK; }
/***************************************************************************** Function : WD_TaskFunc Description: timer task entry Input : void Return : void Other : *****************************************************************************/ VOS_VOID WD_TaskFunc( VOS_UINT32 Para0, VOS_UINT32 Para1, VOS_UINT32 Para2, VOS_UINT32 Para3 ) { OM_LIVE_TIME_CONTROL_STRU stLiveTime = {0}; VOS_UINT32 ulCountCycle = 0; VOS_UINT32 ulCycle = 0; OM_LIVE_TIME_STRU stTotalTime; stTotalTime.ulLiveTime = 0; if ( VOS_OK != NV_ReadEx(MODEM_ID_0, en_NV_Item_LiveTimeControl, (VOS_VOID *)(&stLiveTime), sizeof(OM_LIVE_TIME_CONTROL_STRU))) { stLiveTime.ulEnable= 0; } /* record */ if ( VOS_OK != NV_ReadEx(MODEM_ID_0, en_NV_Item_LiveTime, (VOS_VOID *)(&stTotalTime), sizeof(OM_LIVE_TIME_STRU))) { stLiveTime.ulEnable= 0; } if ( stLiveTime.ulEnable ) { /* minute -> second */ ulCycle = (stLiveTime.ulCycle) * 60; } for( ; ; ) { /* SemTake SEM when releas*/ VOS_TaskDelay(WD_TIME_UNIT); if ( stLiveTime.ulEnable ) { ulCountCycle++; if ( ulCountCycle >= ulCycle ) { ulCountCycle = 0; /* record */ stTotalTime.ulLiveTime += stLiveTime.ulCycle; NV_WriteEx(MODEM_ID_0, en_NV_Item_LiveTime, (VOS_VOID *)(&stTotalTime), sizeof(stTotalTime)); } } } return ; }
//***************************************************************************** // 函数名称: atSetReset // 功能描述: 单板重启命令 "^RESET" // // 参数说明: // ulIndex [in] 用户索引 // // 返 回 值: // TODO: ... // // 调用要求: TODO: ... // 调用举例: TODO: ... //***************************************************************************** VOS_UINT32 atSetReset(VOS_UINT8 ucClientId) { VOS_UINT32 ulRst = AT_OK; gstAtSendData.usBufLen = 0; gstAtSendData.usBufLen = (VOS_UINT16)At_sprintf( AT_CMD_MAX_LEN, (VOS_CHAR*)pgucAtSndCodeAddr, (VOS_CHAR*)pgucAtSndCodeAddr, "OK" ); VOS_TaskDelay(300); /*wait 300 tick*/ BSP_OM_SoftReboot(); return ulRst; }
//切换到下载模式命令单板重启后将进入下载模式 VOS_UINT32 atSetGodLoad(VOS_UINT8 ucClientId) { gstAtSendData.usBufLen = 0; gstAtSendData.usBufLen = (VOS_UINT16)At_sprintf( AT_CMD_MAX_LEN, (VOS_CHAR*)pgucAtSndCodeAddr, (VOS_CHAR*)pgucAtSndCodeAddr, "OK" ); BSP_DLOAD_SetCurMode(DLOAD_MODE_DOWNLOAD); VOS_TaskDelay(500); BSP_DLOAD_SetSoftLoad(true); BSP_OM_SoftReboot(); return AT_OK; }
INT32 EMR_PackOpenDev(char* devNam) { UINT32 i, fd; for (i = 0; i < 3; i++) { fd = open(devNam, O_RDWR); if (fd >= 0) { break; } VOS_TaskDelay(100); } EMR_LOG(LOG_LEVEL_ERROR, "open %s time %d, fd %d ", devNam, i, fd); return fd; }
VOS_VOID TTF_MemRbRxFreeMemTask(VOS_VOID) { /* 解决UT死循环问题 */ #ifdef __UT_CENTER__ VOS_UINT32 ulLoop; #endif VOS_UINT32 ulLoopCnt = 0; VOS_UINT32 ulSmRst = VOS_OK; TTF_RbRxFreeMemTaskInit(); #ifndef __UT_CENTER__ for ( ; ; ) #else for (ulLoop = 0; ulLoop < 1; ulLoop++) #endif { ulSmRst = VOS_SmP(g_ulTtfMemRbFreeSem, 0); /* take信号量失败是异常失败 */ if(VOS_OK != ulSmRst) { ulLoopCnt++; if (ulLoopCnt >= TTF_MEM_RB_TASK_FAIL_CNT_MAX) { DRV_SYSTEM_ERROR((VOS_INT)(TTF_MEM_RB_TASK_FAIL_SEM_ERR), (VOS_INT)ulSmRst, (VOS_INT)g_ulTtfMemRbFreeSem, (VOS_VOID *)&g_ulFreeTtfMemBlkNoticNum, 2 * sizeof(VOS_UINT32)); } TTF_LOG1(UEPS_PID_TTF_MEM_RB_FREE, PS_PRINT_ERROR, "TTF_MemRb, TTF_MEM_RB_RxFreeMemTask : ERROR : VOS_SmP Failed, Error Code = %d !\n", (VOS_INT)ulSmRst); VOS_TaskDelay(2); continue; } /* 释放 */ TTF_MemFreeFromQue(); } }/* TTF_MemRbRxFreeMemTask */
VOS_VOID PS_Qnode_ShowDetailUsedInfo(VOS_VOID) { VOS_UINT32 ulLoop; PS_QNODE_DEBUG_STRU *pstDbg; VOS_UINT32 ulUsedCnt; const VOS_UINT32 ulConsectivePrintCnt = 200; /* 一次性打印个数上限 */ if (PS_QNODE_TRACE_PRINT_ON == g_stMgmt.enIsTracePrintOn) { PS_Qnode_ShowUsedInfo(); ulUsedCnt = 0; for (ulLoop = 0; ulLoop < MAX_PS_QNODE_NUM; ulLoop++) { if (PS_QNODE_USED_STATE == g_astQnode[ulLoop].enState) { pstDbg = &(g_astQnode[ulLoop].stDbg); vos_printf("index = %u, Alloc fileid=%u, line=%u, tick=0x%x, trace fileid=%u, line=%u, tick=0x%x\n", g_astQnode[ulLoop].usIndex, pstDbg->usAllocFileId, pstDbg->usAllocLineNum, pstDbg->ulAllocTick, pstDbg->usTraceFileId, pstDbg->usTraceLineNum, pstDbg->ulTraceTick); ulUsedCnt++; /* 为了防止持续打印将串口打死, 每次打印一定量后, 则延迟, 然后继续打印 */ if (ulUsedCnt >= ulConsectivePrintCnt) { VOS_TaskDelay(10); ulUsedCnt = 0; } } } } else { vos_printf("Enable trace print function by PS_Qnode_SetTracePrint(1).\n"); } return; } /* PS_Qnode_ShowDetailUsedInfo */
VOS_VOID Aging_TestProc(VOS_VOID) { MODEM_ID_ENUM_UINT16 enModemID; VOS_UINT16 usBand; VOS_UINT16 usChannel; VOS_UINT16 usNetworkMode; VOS_UINT16 usPower; VOS_UINT16 usBandIndex; VOS_UINT16 usModType; VOS_UINT16 usSlotCnt; /*指示当前的测试项*/ usBandIndex = g_stOmAgingTestCtrl.usBandIndex; /*假如已经到达测试项末尾,则需要从头开始*/ if ((VOS_UINT32)(usBandIndex + 1) == g_pstOmAgingTestNV->ulNumber) { g_stOmAgingTestCtrl.usBandIndex = 0; } else { g_stOmAgingTestCtrl.usBandIndex = usBandIndex + 1; } enModemID = g_pstOmAgingTestNV->astOmRfConfig[usBandIndex].enModemID; usBand = g_pstOmAgingTestNV->astOmRfConfig[usBandIndex].usBand; usChannel = g_pstOmAgingTestNV->astOmRfConfig[usBandIndex].usChannel; usNetworkMode = g_pstOmAgingTestNV->astOmRfConfig[usBandIndex].usNetworkMode; usModType = g_pstOmAgingTestNV->astOmRfConfig[usBandIndex].usModType; usSlotCnt = g_pstOmAgingTestNV->astOmRfConfig[usBandIndex].usSlotCnt; if ((enModemID >= MODEM_ID_BUTT) || (usNetworkMode > VOS_RATMODE_WCDMA)) { PS_LOG2(WUEPS_PID_AGING, 0, PS_PRINT_ERROR, "Aging_TestProc:Para is error.", (VOS_INT32)enModemID, (VOS_INT32)usNetworkMode); return; } /*如果当前测试项的网络模式不同于上次,则需要重新加载物理层*/ if ((enModemID != g_stOmAgingTestCtrl.enModemID) ||(usNetworkMode != g_stOmAgingTestCtrl.usNetworkMode)) { /*停止上一次的RF发射*/ if (VOS_RATMODE_GSM == g_stOmAgingTestCtrl.usNetworkMode) { g_apstGAgingTestMsg[g_stOmAgingTestCtrl.enModemID]->enTxEnable = UPHY_OAM_AGING_TEST_OFF; (VOS_VOID)VOS_SendMsg(WUEPS_PID_AGING, g_apstGAgingTestMsg[g_stOmAgingTestCtrl.enModemID]); /*需要等待物理层的回复,1s为估计值*/ VOS_TaskDelay(1000); } else if (VOS_RATMODE_WCDMA == g_stOmAgingTestCtrl.usNetworkMode) { g_pstWAgingTestMsg->enTxOnOff = UPHY_OAM_AGING_TEST_OFF; (VOS_VOID)VOS_SendMsg(WUEPS_PID_AGING, g_pstWAgingTestMsg); /*需要等待物理层的回复,1s为估计值*/ VOS_TaskDelay(1000); } else { ;/*Just make pclint happy*/ } /*加载物理层*/ if (VOS_TRUE != SHPA_LoadPhy((VOS_RATMODE_ENUM_UINT32)usNetworkMode, enModemID, UPHY_OAM_BUSINESS_TYPE_CT)) { /*停止定时器*/ OM_STOP_AGING_TEST_TIMER(&g_hAgingTestTimer); PS_LOG(WUEPS_PID_AGING, 0, PS_PRINT_ERROR, "Aging_TestProc:SHPA_LoadPhy fail!"); return; } g_stOmAgingTestCtrl.enModemID = enModemID; g_stOmAgingTestCtrl.usNetworkMode = usNetworkMode; } usPower = g_pstOmAgingTestNV->astOmRfConfig[usBandIndex].usPower; /*根据不同的网络模式进行RF配置*/ if (VOS_RATMODE_GSM == usNetworkMode) { g_apstGAgingTestMsg[enModemID]->enTxEnable = UPHY_OAM_AGING_TEST_ON; g_apstGAgingTestMsg[enModemID]->usFreqNum = (VOS_UINT16)(usBand << OM_G_RF_BAND_SHIFT) | usChannel; g_apstGAgingTestMsg[enModemID]->usTxPower = usPower; g_apstGAgingTestMsg[enModemID]->usSlotCnt = usSlotCnt; g_apstGAgingTestMsg[enModemID]->usModType = usModType; (VOS_VOID)VOS_SendMsg(WUEPS_PID_AGING, g_apstGAgingTestMsg[enModemID]); } else if (VOS_RATMODE_WCDMA == usNetworkMode) { g_pstWAgingTestMsg->enTxOnOff = UPHY_OAM_AGING_TEST_ON; g_pstWAgingTestMsg->usTxBand = usBand; g_pstWAgingTestMsg->usTxChannel = usChannel; g_pstWAgingTestMsg->usTxPower = usPower; (VOS_VOID)VOS_SendMsg(WUEPS_PID_AGING, g_pstWAgingTestMsg); } else { PS_LOG1(WUEPS_PID_AGING, 0, PS_PRINT_WARNING, "Aging_TestProc:usNetworkMode isn't corrcet.", usNetworkMode); } return; }