VOS_VOID TTF_MNTN_ErrlogBufGet(VOS_UINT32 ulPid, MODEM_ID_ENUM_UINT16 enModemId, VOS_CHAR *pBuffer, VOS_UINT32 ulBytes) { VOS_UINT32 ulRslt; OM_RING_ID pRingId; if (VOS_NULL_PTR == pBuffer) { PS_LOG(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufGet: pBuffer NULL PTR"); return; } if (enModemId >= MODEM_ID_BUTT) { PS_LOG1(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufGet: Invalid ModemId ", enModemId); return; } pRingId = TTF_ERR_LOG_ENT_RINGID_GET(enModemId); if (VOS_NULL_PTR == pRingId) { PS_LOG(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufGet: pRingId NULL PTR"); return; } ulRslt = VOS_SmP(TTF_ERR_LOG_ENT_SEM_GET(enModemId), TTF_ERR_SEM_TIMEOUT_LEN); if(VOS_OK != ulRslt) { PS_LOG2(ulPid, 0, PS_PRINT_WARNING, "TTF_MNTN_ErrlogBufGet: VOS_SmP <1>, ulRslt<2> fail!", enModemId, (VOS_INT32)ulRslt); return; } ulRslt = (VOS_UINT32)OM_RingBufferGet(pRingId, pBuffer, (VOS_INT)ulBytes); if (ulRslt != ulBytes) { OM_RingBufferFlush(pRingId); PS_LOG2(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufGet: ERROR OM_RingBufferGet fail!", (VOS_INT32)ulRslt, (VOS_INT32)ulBytes); } VOS_SmV(TTF_ERR_LOG_ENT_SEM_GET(enModemId)); }
VOS_UINT32 TTF_MNTN_InitErrLogEnt(VOS_UINT32 ulPid) { MODEM_ID_ENUM_UINT16 enModemId; VOS_UINT32 ulRslt; if (VOS_YES == TTF_ERR_LOG_ENT_STATE_GET()) { return VOS_OK; } PS_MEM_SET(&g_stTtfMntnErrlogEnt, 0, sizeof(TTF_MNTN_ERR_LOG_ENT_STRU)); PS_MEM_SET(apErrLogRptCb, 0, sizeof(apErrLogRptCb)); /* 创建互斥信号量,每个Modem 1个 */ for (enModemId = 0; enModemId < MODEM_ID_BUTT; enModemId++) { ulRslt = VOS_SmMCreate("TFEL", VOS_SEMA4_FIFO, (VOS_UINT32 *)(&TTF_ERR_LOG_ENT_SEM_GET(enModemId))); if (VOS_OK != ulRslt) { PS_LOG2(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_InitErrLogEnt: Create TTF_ERR_LOG_ENT_SEM<1>, ulRslt<2> fail!", enModemId, (VOS_INT32)ulRslt); return ulRslt; } /* 读NV项获取当前上报状态 */ ulRslt = NV_ReadEx(enModemId, en_NV_Item_ErrLogCtrlInfo, &g_stTtfMntnErrlogEnt.stCtrlInfo[enModemId], sizeof(NV_ID_ERR_LOG_CTRL_INFO_STRU)); if (VOS_OK != ulRslt) { PS_LOG1(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_InitErrLogEnt: NV_Read fail!", (VOS_INT32)ulRslt); TTF_ERR_LOG_ENT_CTRL_STATUS_SET(enModemId, OM_APP_STATUS_CLOSE); } TTF_MNTN_InitErrlogBuffer(enModemId); } PS_MEM_SET(&g_stErrLogLiErrCtx, 0, sizeof(TTF_MNTN_ERR_LOG_WRLC_LI_ERR_CTX_STRU)); TTF_ERR_LOG_ENT_STATE_SET(VOS_YES); return VOS_OK; }
VOS_UINT32 TTF_RING_Q_NodeAddrSet(VOS_UINT32 ulPid, TTF_RING_Q_ST *pstRingQ, VOS_VOID **ppNodeAddr,VOS_UINT32 ulNodeCnt) { VOS_UINT32 ulNodeNoLoop; if (VOS_NULL_PTR == pstRingQ ) { PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pstRingQ is Null !"); return PS_FAIL; } if ( VOS_NULL_PTR == pstRingQ->ppNode ) { PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: ppNode is Null !"); return PS_FAIL; } if ( VOS_NULL_PTR == ppNodeAddr ) { PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: ppNodeAddr is Null !"); return PS_FAIL; } if ( 2 > ulNodeCnt) { PS_LOG1(ulPid, 0, PS_PRINT_WARNING, "Warning: ppNodeAddr ulNodeCnt<1> less than 2 !",(VOS_INT32)ulNodeCnt); return PS_FAIL; } if ( ulNodeCnt != pstRingQ->ulMaxSize ) { PS_LOG2(ulPid, 0, PS_PRINT_WARNING, "Warning: RingQ MaxSize<1> is not matched NodeCnt<2>!", (VOS_INT32)pstRingQ->ulMaxSize, (VOS_INT32)ulNodeCnt); return PS_FAIL; } for(ulNodeNoLoop = 0; ulNodeNoLoop < pstRingQ->ulMaxSize; ulNodeNoLoop ++) { pstRingQ->ppNode[ulNodeNoLoop] = ppNodeAddr[ulNodeNoLoop]; } return PS_SUCC; } /* TTF_RING_Q_NodeAddrSet */
VOS_UINT32 TTF_RING_Q_NodeAddrInit(VOS_UINT32 ulPid, TTF_RING_Q_ST *pstRingQ, VOS_VOID **ppNodeAddr,VOS_UINT32 ulNodeCnt,VOS_UINT8 ucSize) { VOS_UINT32 ulNodeLoop; if ( VOS_NULL_PTR == pstRingQ ) { PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pstRingQ is Null !"); return PS_FAIL; } if ( VOS_NULL_PTR == pstRingQ->ppNode ) { PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: ppNode is Null !"); return PS_FAIL; } if ( VOS_NULL_PTR == ppNodeAddr ) { PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: ppNodeAddr is Null !"); return PS_FAIL; } if ( 2 > ulNodeCnt) { PS_LOG1(ulPid, 0, PS_PRINT_WARNING, "Warning: ppNodeAddr ulNodeCnt<1> less than 2 !",(VOS_INT32)ulNodeCnt); return PS_FAIL; } if ( ulNodeCnt != pstRingQ->ulMaxSize ) { PS_LOG2(ulPid, 0, PS_PRINT_WARNING, "Warning: RingQ MaxSize<1> is not matched NodeCnt<2>!", (VOS_INT32)pstRingQ->ulMaxSize, (VOS_INT32)ulNodeCnt); return PS_FAIL; } for (ulNodeLoop = 0; ulNodeLoop < pstRingQ->ulMaxSize; ulNodeLoop++) { /* 核间共享结点的地址 */ /* ppNodeAddr = ppNodeAddr + ulNodeLoop*ucSize; */ pstRingQ->ppNode[ulNodeLoop] = (VOS_VOID *)ppNodeAddr; ppNodeAddr = ppNodeAddr + ucSize; } return PS_SUCC; }
VOS_VOID OM_WriteDspNv(MsgBlock* pMsg) { VOS_UINT32 usIndex; VOS_UINT16 usCount; VOS_UINT16 usNvId; VOS_UINT16 usNvLen; VOS_UINT32 ulResult; DSP_WRITE_NV_STRU *pstWriteNVMsg; DSP_WRITE_NV_CONTEXT_STRU *pstWrteNvContext; VOS_UINT8 *pucNvData; MODEM_ID_ENUM_UINT16 enModemID; enModemID = VOS_GetModemIDFromPid(pMsg->ulSenderPid); /*如果DCXO确认双份再调试*/ pstWriteNVMsg = (DSP_WRITE_NV_STRU *)pMsg; usCount = pstWriteNVMsg->usCount; pstWrteNvContext = (DSP_WRITE_NV_CONTEXT_STRU *)(pstWriteNVMsg->aucNVData); for ( usIndex = 0; usIndex < usCount; usIndex++ ) { usNvId = pstWrteNvContext->usNvId; usNvLen = pstWrteNvContext->usNvLen; pucNvData = pstWrteNvContext->aucNVData; ulResult = NV_WriteEx(enModemID, usNvId, pucNvData, (VOS_UINT32)usNvLen); if ( NV_OK != ulResult ) { PS_LOG2(CCPU_PID_PAM_OM, 0, PS_PRINT_ERROR, "OM_WriteDspNv:NV_Write, NV id: ErrCode :", (VOS_INT32)usNvId, (VOS_INT32)ulResult); return; } pstWrteNvContext = (DSP_WRITE_NV_CONTEXT_STRU *)(pstWrteNvContext->aucNVData + usNvLen); } return; }
VOS_VOID WTTF_MNTN_ErrlogFlushRlcErrEvt(VOS_VOID) { VOS_UINT8 ucAlmLev; VOS_UINT8 ucRbIdIdx; VOS_UINT8 ucRbId; MODEM_ID_ENUM_UINT16 enModemId; ucAlmLev = TTF_ERR_LOG_GET_ALM_LEV(TTF_ERR_LOG_ALM_ID_WRLC_LI_ERR); enModemId = VOS_GetModemIDFromPid(WUEPS_PID_RLC); if (!TTF_ERR_LOG_NEED_RPT_LEV(enModemId, ucAlmLev)) { return; } for (ucRbIdIdx = 0; ucRbIdIdx < g_stErrLogLiErrCtx.ucLiErrRbCnt; ucRbIdIdx++) { ucRbId = g_stErrLogLiErrCtx.aucLiErrRbs[ucRbIdIdx]; if (ucRbId > UTRAN_MAX_RB_ID) { PS_MEM_SET(&g_stErrLogLiErrCtx, 0 ,sizeof(TTF_MNTN_ERR_LOG_WRLC_LI_ERR_CTX_STRU)); PS_LOG2(WUEPS_PID_RLC, 0, PS_PRINT_WARNING, "WTTF_MNTN_ErrlogFlushRlcErrEvt, the rbIdx <1> in g_stErrLogLiErrCtx.ucLiErrRbCnt is RbId <2>.", ucRbIdIdx, ucRbId); return; } /* 异常事件写入缓存中 */ TTF_MNTN_ErrlogBufPut(WUEPS_PID_RLC, (VOS_CHAR *)&(g_stErrLogLiErrCtx.astWrlcLiErrInfo[ucRbId]), sizeof(TTF_MNTN_ERR_LOG_WRLC_LI_ERR_STRU)); } PS_MEM_SET(&g_stErrLogLiErrCtx, 0 ,sizeof(TTF_MNTN_ERR_LOG_WRLC_LI_ERR_CTX_STRU)); return; }
VOS_VOID MmMsgProc (struct MsgCB* pMsg) { VOS_VOID *pRcvMsg = VOS_NULL_PTR; /* 接收消息使用的头地址定义 */ MSG_HEADER_STRU *pMsgHeader; /* 定义MSG_HEADER_STRU类型指针 */ VOS_UINT32 aulRcvTimerMsg[4]; /* 接收消息使用的临时内存定义 */ REL_TIMER_MSG *pTimerMsg = VOS_NULL_PTR; VOS_UINT8 ucEventId = MM_EVENT_ID_INVALID; MM_MSG_MM_STATUS_STRU Msg; if (VOS_NULL_PTR == pMsg) { MM_WARN_LOG( "\nMM:MmMsgProc:MM Msg is null!"); return; } NAS_MM_LogMmStateInfo(g_MmGlobalInfo.ucState); #ifdef __PS_WIN32_RECUR__ if ((WUEPS_PID_MM == pMsg->ulSenderPid) && (WUEPS_PID_MM == pMsg->ulReceiverPid)) { NAS_MM_RestoreContextData(pMsg); } #endif if (g_NasMmImportFunc.ucFuncEnvironment != NAS_MML_GetCurrNetRatType() ) { MM_SndMsgFuncChg(); } /* 等待主Task发来的MM启动消息 */ switch (gucMmProcessFlg) { case WAIT_FOR_NORMAL_MSG: /* 等待处理正常消息: */ pRcvMsg = (VOS_VOID *)pMsg; if (PC_PID_TOOL == pMsg->ulSenderPid) { ucEventId = 78; } else if (VOS_PID_TIMER == pMsg->ulSenderPid) { pTimerMsg = (REL_TIMER_MSG *)pMsg; aulRcvTimerMsg[1] = pTimerMsg->ulName; aulRcvTimerMsg[2] = pTimerMsg->ulPara; ucEventId = Mm_Timer_Event_Analy(aulRcvTimerMsg); } else if ( WUEPS_PID_OM == pMsg->ulSenderPid ) { pMsgHeader = (MSG_HEADER_STRU *)pMsg; /*if (AGENT_MM_INQUIRE == ulMsgId )*/ if (AGENT_MM_INQUIRE == pMsgHeader->ulMsgName) { ucEventId = 78; } else { ucEventId = MM_EVENT_ID_INVALID; } } else if (WUEPS_PID_ADMIN == pMsg->ulSenderPid) { pMsgHeader = (MSG_HEADER_STRU *)pMsg; if (WUEPS_RESET_REQ == pMsgHeader->ulMsgName) { Mm_TimerStop(MM_TIMER_STOP_ALL); if (MM_TIMER_START == gstMmTimerSuspend.ucTimerStatus) { if (VOS_OK != Mm_StopRelTimer(WUEPS_PID_MM, MM_TIMER_PROTECT_SUSPEND, &(gstMmTimerSuspend.stTimer))) { PS_LOG(WUEPS_PID_MM, VOS_NULL, PS_PRINT_WARNING, "MmMsgProc:WARNING: Mm_StopRelTimer VOS_ERRNO_RELTM_STOP_TIMERINVALID."); } gstMmTimerSuspend.ucTimerStatus = MM_TIMER_STOPPED; } PS_LOG(WUEPS_PID_MM, VOS_NULL, PS_PRINT_WARNING, "MmMsgProc:WARNING: ADMIN Reset order."); gucMmProcessFlg = WAIT_FOR_WUEPS_START; /* 等待ADMIN发送启动原语 */ break; } } else { pMsgHeader = ( MSG_HEADER_STRU* )pMsg; /* 得到消息头 */ ucEventId = Mm_Event_Analy(pMsgHeader); } PS_LOG2(WUEPS_PID_MM, VOS_NULL, PS_PRINT_INFO, "MmMsgProc:INFO: MM* Receive Msg,EventId,State:",ucEventId,g_MmGlobalInfo.ucState); if ( MM_EVENT_ID_STATUS_95 == ucEventId ) { PS_MEM_SET(&g_MmMsgMmInfo, 0, sizeof(MM_MSG_MM_INFO_STRU)); Msg.MmIeRjctCause.ucRejCause = NAS_MML_REG_FAIL_CAUSE_SEMANTICALLY_INCORRECT_MSG; Mm_ComMsgMmStatusSnd(&Msg); ucEventId = MM_EVENT_ID_INVALID; } if ( MM_EVENT_ID_STATUS_96 == ucEventId ) { PS_MEM_SET(&g_MmMsgMmInfo, 0, sizeof(MM_MSG_MM_INFO_STRU)); Msg.MmIeRjctCause.ucRejCause = NAS_MML_REG_FAIL_CAUSE_INVALID_MANDATORY_INF; Mm_ComMsgMmStatusSnd(&Msg); ucEventId = MM_EVENT_ID_INVALID; } g_MmSubLyrShare.MmShare.MmSuspendEvent = ucEventId; if ( MM_EVENT_ID_INVALID != ucEventId ) { gaMmStateTable[ucEventId - 1][g_MmGlobalInfo.ucState](pRcvMsg); } /* 收到GU模系统消息后,需要更新MM中保存的net type */ if ( 5 == ucEventId) { g_MmGlobalInfo.enPreRatType = NAS_MML_GetCurrNetRatType(); } break; case WAIT_FOR_WUEPS_START: /* 等待WUEPS_START_REQ消息 */ if (VOS_PID_TIMER == pMsg->ulSenderPid) { } else { pMsgHeader = ( MSG_HEADER_STRU* )pMsg; /* 得到消息头 */ if (( WUEPS_START_REQ == pMsgHeader->ulMsgName) && ( WUEPS_PID_ADMIN == pMsgHeader->ulSenderPid )) { /* 是WUEPS_START_REQ消息 */ #ifdef __PS_WIN32_RECUR__ Mm_ComInit(); #endif gucMmProcessFlg = WAIT_FOR_MMCMM_START_REQ; /* 状态迁移到"等待MMCMM_START_REQ消息" */ } else { /* 无操作; */ } } break; case WAIT_FOR_MMCMM_START_REQ: /* 等待MMCMM_START_REQ消息: */ if (VOS_PID_TIMER == pMsg->ulSenderPid) { } else { pRcvMsg = (VOS_VOID *)pMsg; /* 读取消息地址 */ pMsgHeader = ( MSG_HEADER_STRU* )pMsg; /* 得到消息头 */ if (( MMCMM_START_REQ == pMsgHeader->ulMsgName) && ( WUEPS_PID_MMC == pMsgHeader->ulSenderPid )) { /* 是MMCGMM_START_REQ消息 */ Mm_ComInit(); ucEventId = Mm_Event_Analy(pMsgHeader); if ( MM_EVENT_ID_INVALID != ucEventId ) { gaMmStateTable[ucEventId - 1] [g_MmGlobalInfo.ucState](pRcvMsg); gucMmProcessFlg = WAIT_FOR_NORMAL_MSG; /* 状态迁移到"等待处理正常消息" */ #ifndef __PS_WIN32_RECUR__ if ( VOS_TRUE == NAS_MML_IsSndOmPcRecurMsgValid() ) { NAS_MM_SndOutsideContextData(); } #endif } } /*A32D11534==>*/ else if ((( MMCC_EST_REQ == pMsgHeader->ulMsgName) && ( WUEPS_PID_CC == pMsgHeader->ulSenderPid )) || (( MMSS_EST_REQ == pMsgHeader->ulMsgName) && ( WUEPS_PID_SS == pMsgHeader->ulSenderPid )) || (( MMSMS_EST_REQ == pMsgHeader->ulMsgName) &&( WUEPS_PID_SMS == pMsgHeader->ulSenderPid ))) { ucEventId = Mm_Event_Analy(pMsgHeader); if ( MM_EVENT_ID_INVALID != ucEventId ) { gaMmStateTable[ucEventId - 1][MM_STATE_NULL](pRcvMsg); } } /*<==A32D11534*/ else { /* 无操作; */ } } break; default: PS_LOG(WUEPS_PID_MM, VOS_NULL, PS_PRINT_WARNING, "MmMsgProc:WARNING: gucMmProcessFlg is Abnormal"); break; } /* #ifndef __PS_WIN32_RECUR__ NAS_MML_SetUePcRecurFlg(VOS_TRUE); #endif */ }
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; }
VOS_VOID TTF_MNTN_ErrlogBufPut(VOS_UINT32 ulPid, VOS_CHAR *pBuffer, VOS_UINT32 ulBytes) { MODEM_ID_ENUM_UINT16 enModemId; VOS_UINT32 ulRslt; VOS_UINT32 ulBuffFreeSize; OM_RING_ID pRingId; if (VOS_NULL_PTR == pBuffer) { PS_LOG(ulPid, 0, PS_PRINT_WARNING, "TTF_MNTN_ErrlogBufPut: pBuffer NULL PTR"); return; } enModemId = VOS_GetModemIDFromPid(ulPid); if (enModemId >= MODEM_ID_BUTT) { PS_LOG1(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufPut: Invalid ModemId ", enModemId); return; } pRingId = TTF_ERR_LOG_ENT_RINGID_GET(enModemId); if (VOS_NULL_PTR == pRingId) { PS_LOG(ulPid, 0, PS_PRINT_WARNING, "TTF_MNTN_ErrlogBufPut: pRingId NULL PTR"); return; } ulRslt = VOS_SmP(TTF_ERR_LOG_ENT_SEM_GET(enModemId), TTF_ERR_SEM_TIMEOUT_LEN); if(VOS_OK != ulRslt) { PS_LOG2(ulPid, 0, PS_PRINT_WARNING, "TTF_MNTN_ErrlogBufPut: Create TTF_ERR_LOG_ENT_SEM<1>, ulRslt<2> fail!", enModemId, (VOS_INT32)ulRslt); return; } ulBuffFreeSize =(VOS_UINT32) OM_RingBufferFreeBytes(pRingId); /* Buffer已经不够了,就不再往里面写数据了 */ if (ulBuffFreeSize >= (ulBytes + TTF_ERR_LOG_ENT_GET_BUF_RSV_LEN(enModemId))) { ulRslt = (VOS_UINT32)OM_RingBufferPut(pRingId, pBuffer, (VOS_INT)ulBytes); if (ulBytes != ulRslt) { OM_RingBufferFlush(pRingId); PS_LOG2(ulPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufGet: ERROR OM_RingBufferPut fail!",(VOS_INT32)ulRslt, (VOS_INT32)ulBytes); } } VOS_SmV(TTF_ERR_LOG_ENT_SEM_GET(enModemId)); }
VOS_VOID TTF_MNTN_ErrlogBufRpt(VOS_UINT32 ulSenderPid, VOS_UINT32 ulReceiverPid, MODEM_ID_ENUM_UINT16 enModemId) { VOS_UINT32 ulRslt; VOS_UINT32 ulBufSize; VOS_UINT32 ulMsgLen; OM_RING_ID pRingId; VOS_UINT32 ulCpuID; OM_ERR_LOG_REPORT_CNF_STRU *pstLogRpt; if (enModemId >= MODEM_ID_BUTT) { PS_LOG1(ulSenderPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufRpt: enModemId Invalid!", enModemId); return; } ulCpuID = VOS_GET_CPU_ID(ulReceiverPid); if ( ulCpuID >= VOS_SUPPORT_CPU_NUM_MAX ) { PS_LOG1(ulSenderPid, 0, PS_PRINT_ERROR, "TTF_MNTN_ErrlogBufRpt: ulReceiverPid Invalid!", (VOS_INT32)ulReceiverPid); return; } pRingId = TTF_ERR_LOG_ENT_RINGID_GET(enModemId); /* Default没有异常 */ ulBufSize = 0; if (VOS_NULL_PTR != pRingId) { /* 保留的长度复位 */ TTF_ERR_LOG_ENT_RST_BUF_RSV_LEN(enModemId); /* 将各模块本地缓存的数据写入Buffer */ TTF_MNTN_ErrlogCbRun(enModemId); ulRslt = VOS_SmP(TTF_ERR_LOG_ENT_SEM_GET(enModemId), TTF_ERR_SEM_TIMEOUT_LEN); if(VOS_OK != ulRslt) { PS_LOG2(ulSenderPid, 0, PS_PRINT_WARNING, "TTF_MNTN_ErrlogBufRpt: VOS_SmP <1>, ulRslt<2> fail!", enModemId, (VOS_INT32)ulRslt); return; } ulBufSize = (VOS_UINT32)OM_RingBufferNBytes(pRingId); if (ulBufSize > TTF_ERR_LOG_BUF_SIZE) { OM_RingBufferFlush(pRingId); PS_LOG1(ulSenderPid, 0, PS_PRINT_WARNING, "TTF_MNTN_ErrlogBufGet: ulBufSize invalid!", (VOS_INT32)ulBufSize); ulBufSize = 0; } VOS_SmV(TTF_ERR_LOG_ENT_SEM_GET(enModemId)); } /*lint -e413*/ ulMsgLen = (TTF_OFFSET_OF(OM_ERR_LOG_REPORT_CNF_STRU, aucContent[0])) + ulBufSize; pstLogRpt = (OM_ERR_LOG_REPORT_CNF_STRU *)PS_ALLOC_MSG_WITH_HEADER_LEN(ulSenderPid, ulMsgLen); if (VOS_NULL_PTR == pstLogRpt) { return; } if (0 != ulBufSize) { TTF_MNTN_ErrlogBufGet(ulSenderPid, enModemId, (VOS_CHAR *)(pstLogRpt->aucContent), ulBufSize); } pstLogRpt->ulReceiverPid = ulReceiverPid; pstLogRpt->ulMsgName = ID_OM_ERR_LOG_REPORT_CNF; pstLogRpt->ulMsgType = OM_ERR_LOG_MSG_ERR_REPORT; pstLogRpt->ulMsgSN = VOS_GetSlice(); pstLogRpt->ulRptlen = ulBufSize; /*lint +e413*/ PS_SEND_MSG(UEPS_PID_SN, pstLogRpt); }