/***************************************************************************** 函 数 名 : FC_CCORE_RcvTimerExpireMsg 功能描述 : 接收定时器消息的分发处理 输入参数 : REL_TIMER_MSG *pTimerMsg 输出参数 : 无 返 回 值 : 无 被调函数 : 修改历史 : 1.日 期 : 2013年10月21日 作 者 : caikai 修改内容 : 新生成函数 *****************************************************************************/ VOS_VOID FC_CCORE_RcvTimerExpireMsg(REL_TIMER_MSG *pTimerMsg) { VOS_UINT32 ulResult; switch (pTimerMsg->ulName) { case TIMER_FC_CCPU_TRACE_CPULOAD: /*====================================*//* 输出可维可测 */ FC_MNTN_TraceCpuLoad(ID_FC_MNTN_CPU_C_CPULOAD, g_stFcTraceCpuLoad.ulCpuLoadRecord); /* 重启定时器 */ ulResult = VOS_StartRelTimer(&g_stFcTraceCpuLoad.pstTraceCpuLoadTHandle, UEPS_PID_FLOWCTRL_C, g_stFcTraceCpuLoad.ulTraceCpuLoadTimerLen, TIMER_FC_CCPU_TRACE_CPULOAD, 0, VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION); if (VOS_OK != ulResult) { FC_LOG2(PS_PRINT_ERROR, "FC_Init, ERROR, Fail to Start Timer! ulResult = %d, ulTraceCpuLoadTimerLen = %d\n", (VOS_INT32)ulResult, (VOS_INT32)g_stFcTraceCpuLoad.ulTraceCpuLoadTimerLen); return; } break; default: break; } return; }
VOS_UINT32 FC_CPUC_Init( VOS_VOID ) { VOS_UINT32 ulResult; ulResult = FC_UL_InitFcPoints(FC_POLICY_ID_CPU_C, &(g_stFcCfg.stFcCfgUmUlRateForCpu)); if ( VOS_OK != ulResult ) { FC_LOG(PS_PRINT_ERROR, "FC_Init, ERROR, Fail to init FC Points for CPU!\n"); return VOS_ERR; } VOS_MemSet(&g_stFcCpuCCtrl, 0, sizeof(g_stFcCpuCCtrl)); ulResult = VOS_StartRelTimer(&g_stFcTraceCpuLoad.pstTraceCpuLoadTHandle, UEPS_PID_FLOWCTRL_C, g_stFcTraceCpuLoad.ulTraceCpuLoadTimerLen, TIMER_FC_CCPU_TRACE_CPULOAD, 0, VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION); if (VOS_OK != ulResult) { FC_LOG(PS_PRINT_ERROR, "FC_Init, ERROR, Fail to Start Timer!\n"); return VOS_ERR; } return VOS_OK; }
VOS_VOID ADS_StartTimer( VOS_UINT32 ulPid, ADS_TIMER_ID_ENUM_UINT32 enTimerId, VOS_UINT32 ulLen ) { VOS_UINT32 ulRet; ADS_TIMER_CTX_STRU *pstTiCtx; VOS_TIMER_PRECISION_ENUM_UINT32 enTmrPrecision; /* 输入参数检查 */ if (0 == ulLen) { ADS_ERROR_LOG1(ACPU_PID_ADS_UL, "ADS_StartTimer:ulLen is",ulLen); return; } if (ulLen >= VOS_TIMER_MAX_LENGTH) { ulLen = VOS_TIMER_MAX_LENGTH - 1; } /* 不在使用的定时器范围内 */ if (enTimerId >= ADS_MAX_TIMER_NUM) { return; } pstTiCtx = ADS_GetTiCtx(); if (ADS_TIMER_STATUS_RUNNING == pstTiCtx[enTimerId].enTimerStatus) { return; } enTmrPrecision = ADS_GetTimerPrecision(enTimerId); ulRet = VOS_StartRelTimer(&(pstTiCtx[enTimerId].hTimer), ulPid, ulLen, enTimerId, 0, VOS_RELTIMER_NOLOOP, enTmrPrecision); if (VOS_OK != ulRet) { ADS_ERROR_LOG(ulPid, "ADS_StartTimer:timer is fail start!"); return; } pstTiCtx[enTimerId].enTimerStatus = ADS_TIMER_STATUS_RUNNING; /*勾包ADS_TIMER_INFO_STRU*/ ADS_MNTN_TraceTimerOperation(ulPid, enTimerId, ulLen, ADS_TIMER_OPERATION_START, ADS_TIMER_STOP_CAUSE_ENUM_BUTT); return; }
VOS_UINT32 RRM_StartTimer ( RRM_RFID_ENUM_UINT16 enRFIDTimerId ) { RRM_RFID_TIMER_CTRL_STRU *pstRFIDTimerAddr; VOS_UINT32 ulRslt; /*获取该状态定时器控制块地址*/ pstRFIDTimerAddr = RRM_GetRFIDTimerAddr(enRFIDTimerId); /*无法获取该定时器控制块地址,说明定时器ID非法*/ if( VOS_NULL_PTR == pstRFIDTimerAddr) { /* 打印错误信息 */ RRM_WARNING_LOG1(UEPS_PID_RRM, "TimerId is Error!", enRFIDTimerId); return VOS_ERR; } /*检查该状态定时器是否在运行,如果正在运行,先停止该定时器。 停止定时器时,VOS会直接将该定时器句柄清除为VOS_NULL_PTR*/ if(VOS_NULL_PTR != pstRFIDTimerAddr->pstStaTHandle) { VOS_StopRelTimer(&(pstRFIDTimerAddr->pstStaTHandle)); } /* 定时器ID设置 */ pstRFIDTimerAddr->enRFIDTimerId = enRFIDTimerId; /* 定时器无参数信息,启动定时器时将定时器参数设置为0 非循环定时器,定时器模式为VOS_RELTIMER_NOLOOP*/ ulRslt = VOS_StartRelTimer( &(pstRFIDTimerAddr->pstStaTHandle), UEPS_PID_RRM, RRM_TMR_DEF_LEN, pstRFIDTimerAddr->enRFIDTimerId, 0, VOS_RELTIMER_NOLOOP, VOS_TIMER_PRECISION_0); /*这里调用的是VOS的接口函数,因此需要使用VOS的返回值进行检查*/ if( VOS_OK != ulRslt) { /* 启动失败,打印失败信息 */ RRM_ERROR_LOG1(UEPS_PID_RRM, "Start TimerId Failure!", enRFIDTimerId); return VOS_ERR; } return VOS_OK; }
/***************************************************************************** Function Name : diag_FsOpenProc Description : 打开或创建文件 Input :VOS_UINT8* pstReq VOS_UINT32 ulCmdId Output : None Return : VOS_UINT32 History : 1.w00182550 2013-1-29 Draft Enact *****************************************************************************/ VOS_UINT32 diag_FsOpenProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId) { DIAG_CMD_FS_OPEN_REQ* pstFsReq = NULL; DIAG_CMD_FS_OPEN_CNF stFsCnf = {0}; VOS_UINT32 ret = ERR_MSP_SUCCESS; pstFsReq = (DIAG_CMD_FS_OPEN_REQ*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq)); /*不支持操作文件的重入操作*/ if (DIAG_FILE_NULL != g_stDiagFileInfo.lFile) { diag_printf("warning: last File import not finished\n"); diag_FsClose(); } /*lint -save -e539*/ diag_fs_log(); /*lint -restore*/ g_stDiagFileInfo.lFile = diag_FsOpen(pstFsReq->szDirectory, (VOS_INT)(pstFsReq->ulMode)); if (g_stDiagFileInfo.lFile < 0) { g_stDiagFileInfo.lFile = DIAG_FILE_NULL; ret = VOS_ERR; } else { /*启动定时器*/ g_stDiagFileInfo.hTimer = VOS_NULL_PTR; ret = VOS_StartRelTimer(&g_stDiagFileInfo.hTimer, diag_GetAgentPid(), DIAG_CMD_FILE_OPS_TIME_OUT_LEN, 0, DIAG_TMR_FILE_OP_TIMEOUT_PARAM,VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION); if(ret != ERR_MSP_SUCCESS) { /*lint -save -e717*/ diag_printf("VOS_StartRelTimer fail [%s]\n",__func__); /*lint -restore*/ } diag_fs_log(); } stFsCnf.ulRet = ret; /*打包回复给FW*/ ret = diag_AgentCnfFun((VOS_UINT8*)&stFsCnf,ulCmdId,sizeof(DIAG_CMD_FS_OPEN_CNF)); diag_fs_log(); return ret; }
/***************************************************************************** 函 数 名 : AT_StartRelTimer 功能描述 : AT启动REL定时器函数 输入参数 : HTIMER *phTm VOS_PID Pid VOS_UINT32 ulLength VOS_UINT32 ulName VOS_UINT32 ulParam VOS_UINT8 ucMode 输出参数 : 无 返 回 值 : VOS_UINT32 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2011年10月5日 修改内容 : 新生成函数 *****************************************************************************/ VOS_UINT32 AT_StartRelTimer( HTIMER *phTm, VOS_UINT32 ulLength, VOS_UINT32 ulName, VOS_UINT32 ulParam, VOS_UINT8 ucMode ) { VOS_UINT32 ulRet; AT_TIMER_OPERATION_STRU stTimer; if (0 == ulLength) { AT_ERR_LOG("AT_StartRelTimer: Start Rel Timer Length is 0!"); return VOS_ERR; } if ( ulLength >= VOS_TIMER_MAX_LENGTH ) { ulLength = VOS_TIMER_MAX_LENGTH - 1; } ulRet = VOS_StartRelTimer(phTm, WUEPS_PID_AT, ulLength, ulName, ulParam, ucMode, VOS_TIMER_PRECISION_5); if (VOS_ERR == ulRet) { AT_ERR_LOG("AT_StartRelTimer: Start Rel Timer Fail!"); } stTimer.ulSenderCpuId = VOS_LOCAL_CPUID; stTimer.ulSenderPid = WUEPS_PID_AT; stTimer.ulReceiverCpuId = VOS_LOCAL_CPUID; stTimer.ulReceiverPid = VOS_PID_TIMER; stTimer.ulLength = sizeof(AT_TIMER_OPERATION_STRU) - VOS_MSG_HEAD_LENGTH; stTimer.ulMsgName = ulName; stTimer.enTimeAction = AT_TIMER_OPERATION_START; stTimer.ulTimeLen = ulLength; OM_AcpuTraceMsgHook(&stTimer); return ulRet; }
VOS_UINT32 diag_FsImportProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId) { DIAG_CMD_FS_IMPORT_REQ* pstFsReq = NULL; DIAG_CMD_FS_IMPORT_CNF stFsCnf = {0}; VOS_UINT32 ret = ERR_MSP_SUCCESS; VOS_INT32 lResult =0; #if(VOS_OS_VER == VOS_LINUX) mm_segment_t old_fs; #endif pstFsReq = (DIAG_CMD_FS_IMPORT_REQ*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq)); if (DIAG_FILE_NULL == g_stDiagFileInfo.lFile) { return ERR_MSP_FAILURE; } diag_fs_log(); /*停止定时器*/ VOS_StopRelTimer(&g_stDiagFileInfo.hTimer); /*写文件完毕,关闭文件*/ if (0 == pstFsReq->ulSize) { diag_fs_log(); diag_FsClose(); /*打包回复给FW*/ stFsCnf.ulRet = ERR_MSP_SUCCESS; ret = diag_AgentCnfFun((VOS_UINT8*)&stFsCnf,ulCmdId,sizeof(DIAG_CMD_FS_IMPORT_CNF)); return ret; } #if(VOS_OS_VER == VOS_LINUX) old_fs = get_fs(); set_fs(KERNEL_DS); #endif #if(VOS_OS_VER == VOS_LINUX) lResult = DIAG_FS_WRITE(g_stDiagFileInfo.lFile, pstFsReq->acContent, pstFsReq->ulSize); #else lResult = DIAG_FS_WRITE((FILE *)g_stDiagFileInfo.lFile, pstFsReq->acContent, pstFsReq->ulSize); #endif diag_fs_log(); #if(VOS_OS_VER == VOS_LINUX) set_fs(old_fs); #endif /*写文件操作失败或者写入长度不正确*/ if ((DIAG_FS_ERROR == lResult)||(lResult != (VOS_INT32)(pstFsReq->ulSize))) { diag_fs_log(); diag_printf("[%s]!,lResult=%d\n",__FUNCTION__,lResult); diag_FsClose(); return VOS_ERR; } /*启动定时器*/ ret = VOS_StartRelTimer(&g_stDiagFileInfo.hTimer, diag_GetAgentPid(),DIAG_CMD_FILE_OPS_TIME_OUT_LEN,0,DIAG_TMR_FILE_OP_TIMEOUT_PARAM,VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION); if(ret != ERR_MSP_SUCCESS) { diag_printf("VOS_StartRelTimer fail [%s]\n",__func__); } stFsCnf.ulRet = ret; /*打包回复给FW*/ ret = diag_AgentCnfFun((VOS_UINT8*)&stFsCnf,ulCmdId,sizeof(DIAG_CMD_FS_IMPORT_CNF)); return ret; }
VOS_UINT32 l4a_StartTimer(HTIMER *phTimerId, L4A_RX_INFO_STRU* pNewNode, VOS_UINT32 ulms) { return VOS_StartRelTimer(phTimerId, MSP_L4_L4A_PID,ulms, 0,(VOS_UINT32)pNewNode,VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION); }
/***************************************************************************** Prototype : Ppp_ReleasePppReq Description : 为AT模块"释放PPP链路"提供对应的API函数。 Input : ---要释放的PPP链路对应的PPP ID Output : --- Return Value : ---VOS_UINT32 Calls : --- Called By : --- History : --- 1.Date : 2005-11-18 Author : --- Modification: Created function *****************************************************************************/ VOS_UINT32 Ppp_ReleasePppReq ( PPP_ID usPppId) { VOS_UINT32 ulRet; /* 可维可测信息上报*/ Ppp_EventMntnInfo(usPppId, AT_PPP_RELEASE_PPP_REQ); if(VOS_OK != PppIsIdValid(usPppId)) { return VOS_ERR; } /* 如果当前PPP在PHASE_NETWORK阶段,属于网侧主动去激活 此时PPP等待和PC间PPP协议结束后通知AT拉管脚信号,并起定时器保护*/ if (PHASE_NETWORK == (PPP_LINK(usPppId)->phase)) { if (VOS_NULL_PTR != (PPP_LINK(usPppId)->lcp.hLcpCloseTimer)) { PS_STOP_REL_TIMER(&(PPP_LINK(usPppId)->lcp.hLcpCloseTimer)); PPP_LINK(usPppId)->lcp.hLcpCloseTimer= VOS_NULL_PTR; } /*起定时器,确保通知拉AT管脚信号*/ ulRet = VOS_StartRelTimer(&(PPP_LINK(usPppId)->lcp.hLcpCloseTimer), PS_PID_APP_PPP, 1000, usPppId, PHASE_TERMINATE_PENDING, VOS_RELTIMER_NOLOOP, VOS_TIMER_PRECISION_5 ); if (VOS_OK != ulRet) { PPP_LINK(usPppId)->lcp.hLcpCloseTimer = VOS_NULL_PTR; PPP_ProcPppDisconnEvent(usPppId); } } /*首先调用PPP模块对应的函数*/ fsm_Close(&(PPP_LINK(usPppId)->ipcp.fsm)); fsm_Close(&(PPP_LINK(usPppId)->lcp.fsm)); /*停止IPCP状态机定时器:*/ if( VOS_NULL_PTR !=((PPP_LINK(usPppId))->ipcp.fsm.timer) ) { VOS_StopRelTimer(&((PPP_LINK(usPppId))->ipcp.fsm.timer)); (PPP_LINK(usPppId))->ipcp.fsm.timer = VOS_NULL_PTR; } /*停止CHAP状态机定时器:*/ if( VOS_NULL_PTR !=((PPP_LINK(usPppId))->chap.auth.hAuthTimer) ) { VOS_StopRelTimer(&((PPP_LINK(usPppId))->chap.auth.hAuthTimer)); (PPP_LINK(usPppId))->chap.auth.hAuthTimer = VOS_NULL_PTR; } /*停止LCP状态机定时器:*/ if( VOS_NULL_PTR !=((PPP_LINK(usPppId))->lcp.fsm.timer) ) { VOS_StopRelTimer(&((PPP_LINK(usPppId))->lcp.fsm.timer)); (PPP_LINK(usPppId))->lcp.fsm.timer = VOS_NULL_PTR; } /*释放待PDP激活定时器*/ if (VOS_NULL_PTR != (PPP_LINK(usPppId)->ipcp.hIpcpPendTimer)) { PS_STOP_REL_TIMER(&(PPP_LINK(usPppId)->ipcp.hIpcpPendTimer)); PPP_LINK(usPppId)->ipcp.hIpcpPendTimer = VOS_NULL_PTR; } /*释放待处理IPCP帧*/ if (VOS_NULL_PTR != (PPP_LINK(usPppId)->ipcp.pstIpcpPendFrame)) { ppp_m_freem(PPP_LINK(usPppId)->ipcp.pstIpcpPendFrame); PPP_LINK(usPppId)->ipcp.pstIpcpPendFrame = VOS_NULL_PTR; } PppFreeId(usPppId); /* 不用释放PPP数据队列,因为只要队列里面有数据,PPP任务就会被调度起来处理, 如果HDLC处理完成而PPP实体已经释放,那么封装或解封装出来的数据自然会被丢弃。 这个API会在AT任务里被调用,如果这里把数据放掉,PPP任务有可能正在使用 */ /* PPP_ClearDataQ(); */ /*返回正确*/ return VOS_OK; }
VOS_UINT32 TAF_SSA_StartTimer( TAF_SSA_TIMER_ID_ENUM_UINT8 enTimerId, VOS_UINT32 ulLen, VOS_UINT8 ucTi ) { TAF_SSA_TIMER_CXT_STRU *pstSsaTimerCtx = VOS_NULL_PTR; VOS_UINT32 i; VOS_UINT32 ulRet; VOS_TIMER_PRECISION_ENUM_UINT32 ulPrecision; NAS_TIMER_OPERATION_STRU stTimer; /*TI有效范围是0-6,8-14*/ if (VOS_FALSE == TAF_SSA_IsTiValid(ucTi)) { SSA_LOG(WARNING_PRINT, "TAF_SSA_StopTimer: Ti invalid!"); return VOS_FALSE; } pstSsaTimerCtx = gastSsaStatetable[ucTi].astSsaTimerCtx; if (0 == ulLen) { SSA_LOG(WARNING_PRINT, "TAF_SSA_StartTimer: timer len is zero!"); return VOS_FALSE; } /* 如果该定时器已经启动则直接返回 */ for ( i = 0 ; i < TAF_SSA_MAX_TIMER_NUM ; i++ ) { if ( ( TAF_SSA_TIMER_STATUS_RUNING == pstSsaTimerCtx[i].enTimerStatus ) && ( enTimerId == pstSsaTimerCtx[i].enTimerId)) { SSA_LOG1(WARNING_PRINT, "TAF_SSA_StartTimer:timer is running", enTimerId); return VOS_FALSE; } } for ( i = 0 ; i < TAF_SSA_MAX_TIMER_NUM ; i++ ) { if ( TAF_SSA_TIMER_STATUS_STOP == pstSsaTimerCtx[i].enTimerStatus ) { break; } } if ( i >= TAF_SSA_MAX_TIMER_NUM) { SSA_LOG1(WARNING_PRINT, "TAF_SSA_StartTimer:too many timer", enTimerId); return VOS_FALSE; } if ( ulLen >= VOS_TIMER_MAX_LENGTH ) { ulLen = VOS_TIMER_MAX_LENGTH - 1; } ulPrecision = NAS_GetTimerPrecision(WUEPS_PID_SS, enTimerId); ulRet = VOS_StartRelTimer(&(pstSsaTimerCtx[i].hTimer), WUEPS_PID_SS, ulLen, enTimerId, ucTi, VOS_RELTIMER_NOLOOP, ulPrecision); if ( VOS_OK != ulRet) { SSA_LOG(WARNING_PRINT, "TAF_SSA_StartTimer: start timer failed!"); return VOS_FALSE; } pstSsaTimerCtx[i].enTimerId = enTimerId; pstSsaTimerCtx[i].enTimerStatus = TAF_SSA_TIMER_STATUS_RUNING; /* 定时器状态勾包出来 */ stTimer.MsgHeader.ulSenderCpuId = VOS_LOCAL_CPUID; stTimer.MsgHeader.ulSenderPid = WUEPS_PID_SS; stTimer.MsgHeader.ulReceiverCpuId = VOS_LOCAL_CPUID; stTimer.MsgHeader.ulReceiverPid = VOS_PID_TIMER; stTimer.MsgHeader.ulLength = sizeof(NAS_TIMER_OPERATION_STRU) - VOS_MSG_HEAD_LENGTH; stTimer.MsgHeader.ulMsgName = enTimerId; stTimer.ulTimeAction = NAS_TIMER_OPERATION_START; stTimer.ulTimeLen = ulLen; DIAG_TraceReport(&stTimer); NAS_TIMER_EventReport(stTimer.MsgHeader.ulMsgName, WUEPS_PID_SS, NAS_OM_EVENT_TIMER_OPERATION_START); return VOS_TRUE; }
VOS_VOID TAF_MMA_StartTimer( TAF_MMA_TIMER_ID_ENUM_UINT32 enTimerId, VOS_UINT32 ulLen ) { TAF_MMA_TIMER_CTX_STRU *pstMmaTimerCtx = VOS_NULL_PTR; VOS_UINT32 i; VOS_UINT32 ulRet; if (0 == ulLen) { TAF_WARNING_LOG1(WUEPS_PID_MMA,"TAF_MMA_StartTimer:timer len is zero!", (VOS_INT32)enTimerId); return; } if (ulLen >= VOS_TIMER_MAX_LENGTH) { ulLen = VOS_TIMER_MAX_LENGTH - 1; } pstMmaTimerCtx = TAF_MMA_GetTimerCtxAddr(); /* 如果缓存队列中该定时器已经启动则直接返回 */ for (i = 0 ; i < TAF_MMA_MAX_TIMER_NUM ; i++) { if ((TAF_MMA_TIMER_STATUS_RUNING == pstMmaTimerCtx[i].enTimerStatus) && (enTimerId == pstMmaTimerCtx[i].enTimerId)) { TAF_WARNING_LOG1(WUEPS_PID_MMA,"TAF_MMA_StartTimer:timer is running!", (VOS_INT32)enTimerId); return; } } for (i = 0 ; i < TAF_MMA_MAX_TIMER_NUM ; i++) { if (TAF_MMA_TIMER_STATUS_STOP == pstMmaTimerCtx[i].enTimerStatus ) { break; } } if (i >= TAF_MMA_MAX_TIMER_NUM) { TAF_WARNING_LOG1(WUEPS_PID_MMA, "TAF_MMA_StartTimer:too many timer", (VOS_INT32)enTimerId); return; } /* 启动定时器 */ ulRet = VOS_StartRelTimer(&(pstMmaTimerCtx[i].hTimer), WUEPS_PID_MMA, ulLen, enTimerId, 0, VOS_RELTIMER_NOLOOP, VOS_TIMER_PRECISION_5); if (VOS_OK != ulRet) { TAF_WARNING_LOG(WUEPS_PID_MMA,"TAF_MMA_StartTimer:VOS_StartRelTimer failed"); return; } pstMmaTimerCtx[i].enTimerId = enTimerId; pstMmaTimerCtx[i].enTimerStatus = TAF_MMA_TIMER_STATUS_RUNING; TAF_MMA_SndOmTimerStatus(TAF_MMA_TIMER_STATUS_RUNING, enTimerId, ulLen); return; }
VOS_VOID RNIC_StartTimer( RNIC_TIMER_ID_ENUM_UINT16 enTimerId, VOS_UINT32 ulLen ) { VOS_UINT32 ulRet; RNIC_TIMER_CTX_STRU *pstRnicTimerCtx; VOS_UINT32 i; RNIC_UL_CTX_STRU *pstUlCtx; VOS_TIMER_PRECISION_ENUM_UINT32 enTimerPrecision; /* 目前按需拨号的功能只在网卡0上有 */ pstUlCtx = RNIC_GetUlCtxAddr(RNIC_RM_NET_ID_0); pstRnicTimerCtx = RNIC_GetTimerAddr(); enTimerPrecision = VOS_TIMER_PRECISION_5; /* 如果缓存队列中该定时器已经启动则直接返回 */ for (i = 0 ; i < RNIC_MAX_TIMER_NUM ; i++) { if ((RNIC_TIMER_STATUS_RUNING == pstRnicTimerCtx[i].enTimerStatus) && (enTimerId == pstRnicTimerCtx[i].enTimerId)) { RNIC_INFO_LOG1(ACPU_PID_RNIC, "RNIC_StartTimer:timer is running", enTimerId); return; } } for (i = 0 ; i < RNIC_MAX_TIMER_NUM ; i++) { if ( RNIC_TIMER_STATUS_STOP == pstRnicTimerCtx[i].enTimerStatus ) { break; } } if (i >= RNIC_MAX_TIMER_NUM) { RNIC_WARNING_LOG1(ACPU_PID_RNIC, "RNIC_StartTimer:too many timer", enTimerId); return; } if (ulLen >= VOS_TIMER_MAX_LENGTH) { ulLen = VOS_TIMER_MAX_LENGTH - 1; } #if (FEATURE_ON == FEATURE_LTE) /* 如果还未设置唤醒源标志,并且是按需断开定时器,则设置该标志,并且设置32K时钟为唤醒源 */ if ((VOS_FALSE == RNIC_GetTimer4WakeFlg()) && (TI_RNIC_DEMAND_DIAL_DISCONNECT == enTimerId)) { BSP_PWC_SetTimer4WakeSrc(); RNIC_SetTimer4WakeFlg(VOS_TRUE); } #endif /* 如果是流量上报定时器,则挂在26M时钟上,以降低功耗 */ if (RNIC_IS_DSFLOW_TIMER_ID(enTimerId)) { enTimerPrecision = VOS_TIMER_NO_PRECISION; } /* VOS_StartRelTimer 启动定时器 */ ulRet = VOS_StartRelTimer(&(pstRnicTimerCtx[i].hTimer), ACPU_PID_RNIC, ulLen, enTimerId, 0, VOS_RELTIMER_NOLOOP, enTimerPrecision); if (VOS_OK != ulRet) { RNIC_WARNING_LOG(ACPU_PID_RNIC, "NAS_MMC_StartTimer:NAS_StartRelTimer failed"); return; } if (TI_RNIC_DEMAND_DIAL_DISCONNECT == enTimerId) { /* 按需拨号统计清零 */ pstUlCtx->stULDataStats.ulULPeriodSndPkts = 0; } pstRnicTimerCtx[i].enTimerId = enTimerId; pstRnicTimerCtx[i].enTimerStatus = RNIC_TIMER_STATUS_RUNING; /* 定时器状态勾包出来 */ }
VOS_UINT32 Aging_TestInit(VOS_VOID) { NAS_MMA_NVIM_RF_AUTO_TEST_FLAG_STRU stRfAutoTestFlg; MODEM_ID_ENUM_UINT16 enModemID; VOS_UINT32 aulReceiverPid[] = {I0_DSP_PID_GPHY, I1_DSP_PID_GPHY}; VOS_MemSet(g_apstGAgingTestMsg, VOS_NULL_PTR, sizeof(g_apstGAgingTestMsg)); g_pstOmAgingTestNV = (OM_AGING_TEST_NV_STRU*)VOS_MemAlloc( WUEPS_PID_AGING, STATIC_MEM_PT, sizeof(OM_AGING_TEST_NV_STRU)); if (VOS_NULL_PTR == g_pstOmAgingTestNV) { PS_LOG(WUEPS_PID_AGING, 0, PS_PRINT_WARNING, "Aging_TestInit: VOS_MemAlloc fail.\n"); return VOS_ERR; } /*读取老化测试需要的NV项*/ if(NV_OK != NV_Read(en_NV_Item_AGING_TEST_TABLE, g_pstOmAgingTestNV, sizeof(OM_AGING_TEST_NV_STRU))) { PS_LOG(WUEPS_PID_AGING, 0, PS_PRINT_WARNING, "Aging_TestInit: NV_Read fail.\n"); return VOS_ERR; } /*判断老化测试是否开启*/ if (VOS_NO == g_pstOmAgingTestNV->ulIsEnable) { return VOS_ERR; } /*读取自动开机使能位*/ if(NV_OK != NV_Read(en_NV_Item_RF_Auto_Test_Flag, &stRfAutoTestFlg, sizeof(NAS_MMA_NVIM_RF_AUTO_TEST_FLAG_STRU))) { PS_LOG(WUEPS_PID_AGING, 0, PS_PRINT_WARNING, "Aging_TestInit: RF NV_Read fail.\n"); return VOS_ERR; } if(VOS_YES == stRfAutoTestFlg.usRfAutoTestFlg) { PS_LOG(WUEPS_PID_AGING, 0, PS_PRINT_WARNING, "Aging_TestInit: Auto test enabled!\n"); return VOS_ERR; } /*参数检测*/ if ((0 == g_pstOmAgingTestNV->ulNumber) || (OM_AGING_TEST_NUM < g_pstOmAgingTestNV->ulNumber) || (0 == g_pstOmAgingTestNV->ulTimerLen)) { return VOS_ERR; } PS_LOG(WUEPS_PID_AGING, 0, PS_PRINT_INFO, "Aging_TestInit: Aging test is launched.\n"); DRV_PWRCTRL_SLEEPVOTE_LOCK(PWRCTRL_SLEEP_FTM); for (enModemID = MODEM_ID_0; enModemID < MODEM_ID_BUTT; enModemID++) { /*初始化发送给G物理层的配置数据包*/ g_apstGAgingTestMsg[enModemID] = (GPHY_OAM_RF_AGING_TEST_REQ_STRU*)VOS_AllocMsg( WUEPS_PID_AGING, sizeof(GPHY_OAM_RF_AGING_TEST_REQ_STRU) - VOS_MSG_HEAD_LENGTH); if (VOS_NULL_PTR == g_apstGAgingTestMsg[enModemID]) { PS_LOG(WUEPS_PID_AGING, 0, PS_PRINT_WARNING, "Aging_TestInit: VOS_AllocMsg fail.\n"); return VOS_ERR; } VOS_ReserveMsg(WUEPS_PID_AGING, (MsgBlock *)g_apstGAgingTestMsg[enModemID]); g_apstGAgingTestMsg[enModemID]->ulReceiverPid = aulReceiverPid[enModemID]; g_apstGAgingTestMsg[enModemID]->enMsgId = ID_OAM_GPHY_RF_AGING_TEST_REQ; } /*初始化发送给W物理层的配置数据包*/ g_pstWAgingTestMsg = (WPHY_OAM_RF_AGING_TEST_REQ_STRU*)VOS_AllocMsg( WUEPS_PID_AGING, sizeof(WPHY_OAM_RF_AGING_TEST_REQ_STRU) - VOS_MSG_HEAD_LENGTH); if (VOS_NULL_PTR == g_pstWAgingTestMsg) { PS_LOG(WUEPS_PID_AGING, 0, PS_PRINT_WARNING, "Aging_TestInit: VOS_AllocMsg fail.\n"); return VOS_ERR; } VOS_ReserveMsg(WUEPS_PID_AGING, (MsgBlock *)g_pstWAgingTestMsg); g_pstWAgingTestMsg->ulReceiverPid = DSP_PID_WPHY; g_pstWAgingTestMsg->enMsgID = ID_OAM_WPHY_RF_AGING_TEST_REQ; /*启动老化测试定时器*/ if (VOS_OK != VOS_StartRelTimer(&g_hAgingTestTimer, WUEPS_PID_AGING, 10000, OM_AGING_START_TIMER, 0, VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION)) { PS_LOG(WUEPS_PID_AGING, 0, PS_PRINT_ERROR, "Aging_TestInit:VOS_StartRelTimer fail!"); return VOS_ERR; } return VOS_OK; }
VOS_VOID CMMCA_StartTimer( VOS_UINT32 ulPid, CMMCA_TIMER_ID_ENUM_UINT32 enTimerId, VOS_UINT32 ulLen, VOS_UINT32 ulParam ) { VOS_UINT32 i; VOS_UINT32 ulRet; CMMCA_TIMER_CTX_STRU *pstTiCtx; VOS_TIMER_PRECISION_ENUM_UINT32 enTmrPrecision; /* 输入参数检查 */ if (0 == ulLen) { CMMCA_ERROR1_LOG("CMMCA_StartTimer:ulLen is", ulLen); return; } if (ulLen >= VOS_TIMER_MAX_LENGTH) { ulLen = VOS_TIMER_MAX_LENGTH - 1; } pstTiCtx = CMMCA_GetTiCtx(); /* 如果该定时器已经启动则直接返回 */ for (i = 0; i < CMMCA_MAX_TIMER_NUM; i++) { if ((CMMCA_TIMER_STATUS_RUNNING == pstTiCtx[i].enTimerStatus) && (enTimerId == pstTiCtx[i].enTimerId)) { return; } } /* 找到一个空闲位置 */ for (i = 0; i < CMMCA_MAX_TIMER_NUM; i++) { if (CMMCA_TIMER_STATUS_STOP == pstTiCtx[i].enTimerStatus ) { break; } } /* 未找到空闲位置,无法保存该定时器信息,直接返回 */ if (i >= CMMCA_MAX_TIMER_NUM) { CMMCA_ERROR1_LOG("CMMCA_StartTimer:i is",i); return; } enTmrPrecision = CMMCA_GetTimerPrecision(enTimerId); ulRet = VOS_StartRelTimer(&(pstTiCtx[i].hTimer), ulPid, ulLen, enTimerId, ulParam, VOS_RELTIMER_NOLOOP, enTmrPrecision); if (VOS_OK != ulRet) { CMMCA_ERROR_LOG("CMMCA_StartTimer:timer is fail start!"); return; } pstTiCtx[i].enTimerId = enTimerId; pstTiCtx[i].enTimerStatus = CMMCA_TIMER_STATUS_RUNNING; /* 勾包CMMCA_TIMER_INFO_STRU */ CMMCA_MNTN_TraceTimerOperation(ulPid, enTimerId, ulLen, CMMCA_TIMER_OPERATION_START); return; }
VOS_VOID Monitor_QueryTask( VOS_VOID ) { #if 0 VOS_UINT32 ulRet; #endif for(;;) { /* 等待信号量 */ VOS_SmP(g_ulMonitorCtrlSem, 0); #if 0 switch ( g_ulMonitorConnectState ) { case MONITOR_IDLE_STATE: if (ID_PHY_MONITOR_QUERY_IND == g_ulMonitorIndType ) /* IDLE态收到环境查询中断 */ { Moniter_SendReq(WUEPS_PID_MONITOR,ID_MONITOR_TEMP_QUERY_REQ); } else /* IDLE态收到进入NORMAL态中断 */ { if (VOS_NULL_PTR == g_hQueryTimer) { ulRet = VOS_StartRelTimer( &g_hQueryTimer, WUEPS_PID_MONITOR, 2000, MONITOR_TIMER_NAME_QUERY, 0, VOS_RELTIMER_LOOP ); if(VOS_OK != ulRet) { g_ulMonitorErrCode |= MONITOR_ERR_CODE_TIMER; } } g_ulMonitorConnectState = MONITOR_CONNECT_STATE; } break; case MONITOR_CONNECT_STATE: /* 进入CONN态 */ if (ID_PHY_MONITOR_QUERY_IND == g_ulMonitorIndType ) /* IDLE态收到环境查询中断 */ { if( VOS_NULL_PTR != g_hQueryTimer ) { VOS_StopRelTimer( &g_hQueryTimer ); } g_hQueryTimer = VOS_NULL_PTR; Moniter_SendReq(WUEPS_PID_MONITOR, ID_MONITOR_TEMP_QUERY_REQ); g_ulMonitorConnectState = MONITOR_IDLE_STATE; } else { g_ulMonitorErrCode |= MONITOR_ERR_CODE_INT; } break; default: break; } #endif } }
VOS_UINT32 diag_FsExportProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId) { //DIAG_CMD_FS_EXPORT_REQ* pstFsReq = NULL; DIAG_CMD_FS_EXPORT_CNF *pstFsCnf = NULL; VOS_UINT32 ret = ERR_MSP_SUCCESS; VOS_UINT32 ulReadSize = 0; #if(VOS_OS_VER == VOS_LINUX) mm_segment_t old_fs; #endif if (DIAG_FILE_NULL == g_stDiagFileInfo.lFile) { diag_fs_log(); return ERR_MSP_FAILURE; } /*停止定时器*/ VOS_StopRelTimer(&g_stDiagFileInfo.hTimer); diag_fs_log(); pstFsCnf = (DIAG_CMD_FS_EXPORT_CNF*)VOS_MemAlloc(diag_GetAgentPid(), DYNAMIC_MEM_PT, sizeof(DIAG_CMD_FS_EXPORT_CNF)+DIAG_TRANSFER_BLOCK_MAX_SIZE); if (VOS_NULL_PTR == pstFsCnf) { diag_fs_log(); diag_FsClose(); return ERR_MSP_FAILURE; } #if(VOS_OS_VER == VOS_LINUX) old_fs = get_fs(); set_fs(KERNEL_DS); #endif #if(VOS_OS_VER == VOS_LINUX) ulReadSize = (VOS_UINT32)DIAG_FS_READ(g_stDiagFileInfo.lFile,(VOS_CHAR*)pstFsCnf + sizeof(DIAG_CMD_FS_EXPORT_CNF), DIAG_TRANSFER_BLOCK_MAX_SIZE); #else ulReadSize = (VOS_UINT32)DIAG_FS_READ((FILE *)g_stDiagFileInfo.lFile,(VOS_CHAR*)pstFsCnf + sizeof(DIAG_CMD_FS_EXPORT_CNF), DIAG_TRANSFER_BLOCK_MAX_SIZE); #endif diag_fs_log(); #if(VOS_OS_VER == VOS_LINUX) set_fs(old_fs); #endif /*读取文件出现错误*/ if (DIAG_FS_ERROR == (VOS_INT32)ulReadSize) { diag_fs_log(); VOS_MemFree(diag_GetAgentPid(),pstFsCnf); diag_FsClose(); return ERR_MSP_FAILURE; } /*表明已经没有内容可以读取,文件内容全部读完*/ if (0 == ulReadSize) { diag_fs_log(); diag_FsClose(); } else { diag_fs_log(); /*启动定时器*/ g_stDiagFileInfo.hTimer = VOS_NULL_PTR; ret = VOS_StartRelTimer(&g_stDiagFileInfo.hTimer, diag_GetAgentPid(), DIAG_CMD_FILE_OPS_TIME_OUT_LEN, 0, DIAG_TMR_FILE_OP_TIMEOUT_PARAM, VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION); if(ret != ERR_MSP_SUCCESS) { diag_printf("VOS_StartRelTimer fail [%s]\n", __func__); } } pstFsCnf->ulRet = ret; pstFsCnf->ulSize = ulReadSize; /*打包回复给FW*/ ret = diag_AgentCnfFun((VOS_UINT8*)pstFsCnf,ulCmdId,sizeof(DIAG_CMD_FS_EXPORT_CNF)+ulReadSize); VOS_MemFree(diag_GetAgentPid(),pstFsCnf); diag_fs_log(); return ret; }
VOS_UINT32 NAS_MMC_StartTimer( NAS_MMC_TIMER_ID_ENUM_UINT16 enTimerId, VOS_UINT32 ulLen ) { NAS_MMC_TIMER_CTX_STRU *pstMmcTimerCtx; VOS_UINT32 i; VOS_UINT32 ulRet; VOS_TIMER_PRECISION_ENUM_UINT32 ulPrecision; pstMmcTimerCtx = NAS_MMC_GetTimerAddr(); if (0 == ulLen) { NAS_INFO_LOG1(WUEPS_PID_MMC,"NAS_MMC_StartTimer:timer len is zero!", (VOS_INT32)enTimerId); return VOS_FALSE; } /* 如果缓存队列中该定时器已经启动则直接返回 */ for ( i = 0 ; i < NAS_MMC_MAX_TIMER_NUM ; i++ ) { if ( ( NAS_MMC_TIMER_STATUS_RUNING == pstMmcTimerCtx[i].enTimerStatus ) && ( enTimerId == pstMmcTimerCtx[i].enTimerId)) { NAS_INFO_LOG1(WUEPS_PID_MMC, "NAS_MMC_StartTimer:timer is running", enTimerId); return VOS_FALSE; } } for ( i = 0 ; i < NAS_MMC_MAX_TIMER_NUM ; i++ ) { if ( NAS_MMC_TIMER_STATUS_STOP == pstMmcTimerCtx[i].enTimerStatus ) { break; } } if ( i >= NAS_MMC_MAX_TIMER_NUM) { NAS_WARNING_LOG1(WUEPS_PID_MMC, "NAS_MMC_StartTimer:too many timer", enTimerId); return VOS_FALSE; } if ( ulLen >= VOS_TIMER_MAX_LENGTH ) { ulLen = VOS_TIMER_MAX_LENGTH - 1; } ulPrecision = NAS_MMC_GetTimerPrecision(enTimerId); ulRet = VOS_StartRelTimer(&(pstMmcTimerCtx[i].hTimer), WUEPS_PID_MMC, ulLen, enTimerId, 0, VOS_RELTIMER_NOLOOP, ulPrecision); if ( VOS_OK != ulRet) { NAS_WARNING_LOG(WUEPS_PID_MMC, "NAS_MMC_StartTimer:NAS_StartRelTimer failed"); return VOS_FALSE; } pstMmcTimerCtx[i].enTimerId = enTimerId; pstMmcTimerCtx[i].enTimerStatus = NAS_MMC_TIMER_STATUS_RUNING; /* 定时器状态勾包出来 */ NAS_MMC_SndOmMmcTimerStatus(NAS_MMC_TIMER_STATUS_RUNING, enTimerId, ulLen); NAS_TIMER_EventReport((VOS_UINT32)enTimerId, WUEPS_PID_MMC, NAS_OM_EVENT_TIMER_OPERATION_START); return VOS_TRUE; }
VOS_VOID RNIC_StartTimer( RNIC_TIMER_ID_ENUM_UINT16 enTimerId, VOS_UINT32 ulLen ) { RNIC_TIMER_CTX_STRU *pstRnicTimerCtx = VOS_NULL_PTR; RNIC_SPEC_CTX_STRU *pstNetCntxt = VOS_NULL_PTR; VOS_TIMER_PRECISION_ENUM_UINT32 enTimerPrecision; VOS_UINT32 ulRet; /* 目前按需拨号的功能只在网卡0上有 */ pstNetCntxt = RNIC_GET_SPEC_NET_CTX(RNIC_RMNET_ID_0); pstRnicTimerCtx = RNIC_GetTimerAddr(); enTimerPrecision = VOS_TIMER_PRECISION_5; /* 不在使用的定时器范围内 */ if (enTimerId >= RNIC_MAX_TIMER_NUM) { return; } /* 如果缓存队列中该定时器已经启动则直接返回 */ if (RNIC_TIMER_STATUS_RUNING == pstRnicTimerCtx[enTimerId].enTimerStatus) { return; } /* 输入参数检查 */ if (0 == ulLen) { RNIC_ERROR_LOG1(ACPU_PID_ADS_UL, "ADS_StartTimer:ulLen is",ulLen); return; } if (ulLen >= VOS_TIMER_MAX_LENGTH) { ulLen = VOS_TIMER_MAX_LENGTH - 1; } #if (FEATURE_ON == FEATURE_LTE) /* 如果还未设置唤醒源标志,并且是按需断开定时器,则设置该标志,并且设置32K时钟为唤醒源 */ if ((VOS_FALSE == RNIC_GetTimer4WakeFlg()) && (TI_RNIC_DEMAND_DIAL_DISCONNECT == enTimerId)) { BSP_PWC_SetTimer4WakeSrc(); RNIC_SetTimer4WakeFlg(VOS_TRUE); } #endif /* 如果是流量上报定时器,则挂在26M时钟上,以降低功耗 */ if (RNIC_IS_DSFLOW_TIMER_ID(enTimerId)) { enTimerPrecision = VOS_TIMER_NO_PRECISION; } /* VOS_StartRelTimer 启动定时器 */ ulRet = VOS_StartRelTimer(&(pstRnicTimerCtx[enTimerId].hTimer), ACPU_PID_RNIC, ulLen, enTimerId, 0, VOS_RELTIMER_NOLOOP, enTimerPrecision); if (VOS_OK != ulRet) { RNIC_WARNING_LOG(ACPU_PID_RNIC, "NAS_MMC_StartTimer:NAS_StartRelTimer failed"); return; } if (TI_RNIC_DEMAND_DIAL_DISCONNECT == enTimerId) { /* 按需拨号统计清零 */ pstNetCntxt->stDsFlowStats.ulPeriodSendPktNum = 0; } pstRnicTimerCtx[enTimerId].enTimerStatus = RNIC_TIMER_STATUS_RUNING; /* 定时器状态勾包出来 */ }