VOS_VOID GU_OamPortCloseProc(OM_PROT_HANDLE_ENUM_UINT32 enHandle, CPM_PHY_PORT_ENUM_UINT32 enPhyPort) { g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCloseNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCloseSlice = OM_GetSlice(); if (enPhyPort == CPM_QueryPhyPort(CPM_OM_COMM)) { GU_OamDisconnectPorts(enPhyPort); g_stAcpuPcToUeSucRecord.stRlsInfo.ulRlsPortClose++; g_stAcpuPcToUeSucRecord.stRlsInfo.ulSlice = OM_GetSlice(); } if (VOS_ERROR != g_astOMPortUDIHandle[enHandle]) { DRV_UDI_CLOSE(g_astOMPortUDIHandle[enHandle]); g_astOMPortUDIHandle[enHandle] = VOS_ERROR; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCloseOkNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCloseOkSlice = OM_GetSlice(); } return; }
/***************************************************************************** 函 数 名 : GU_OamPortStatus 功能描述 : 用于ACPU上面处理物理端口断开后的OM链接断开 输入参数 : pucData: 需要发送的数据内容 ulDataLen: 数据长度 输出参数 : 无 返 回 值 : 无 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年2月2日 作 者 : zhuli 修改内容 : Creat Function *****************************************************************************/ VOS_VOID GU_OamPortStatus(OM_PROT_HANDLE_ENUM_UINT32 enHandle, CPM_PHY_PORT_ENUM_UINT32 enPhyPort,ACM_EVT_E enPortState) { if(ACM_EVT_DEV_SUSPEND == enPortState) { g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOutNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOutTime = OM_GetSlice(); if (enPhyPort == CPM_QueryPhyPort(CPM_OM_COMM)) { GU_OamDisconnectPorts(enPhyPort); g_stAcpuPcToUeSucRecord.stRlsInfo.ulRlsDrvSuspend++; g_stAcpuPcToUeSucRecord.stRlsInfo.ulSlice = OM_GetSlice(); } } else if(ACM_EVT_DEV_READY == enPortState) { g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBINNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBINTime = OM_GetSlice(); } else { LogPrint2("GU_OamUSBStatusCB: The USB Port %d State %d is Unknow", (VOS_INT)enPhyPort, (VOS_INT)enPortState); g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBStateErrNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBStateErrTime = OM_GetSlice(); } return; }
/***************************************************************************** Function : HPA_3GAwakeIsr Description: ISR of W Wake INT Input : void Return : void Other : *****************************************************************************/ VOS_VOID HPA_3GAwakeIsr(VOS_VOID) { VOS_UINT32 ulRegValue; VOS_UINT32 ulBeginSlice; DRV_VICINT_DISABLE(g_ulWBBPAwakeIntNO); SLEEP_AwakeIsr(VOS_RATMODE_WCDMA); ulRegValue = HPA_Read32Reg(WBBP_ARM_INT02_STA_ADDR); /* Clear interrupt */ HPA_Write32Reg(WBBP_ARM_INT02_CLR_1CARD_ADDR, ulRegValue); ulBeginSlice = OM_GetSlice(); while((0 != HPA_Read32Reg(WBBP_ARM_INT02_STA_ADDR)) &&(BBP_DRX_INT_SLICE_COUNT > (OM_GetSlice() - ulBeginSlice))) { ; } DRV_VICINT_ENABLE(g_ulWBBPAwakeIntNO); return; }
/***************************************************************************** 函 数 名 : GU_OamVComStatus 功能描述 : 用于ACPU上面处理VCom端口断开后的OM链接断开 输入参数 : pucData: 需要发送的数据内容 ulDataLen: 数据长度 输出参数 : 无 返 回 值 : 无 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年2月2日 作 者 : zhuli 修改内容 : Creat Function *****************************************************************************/ VOS_VOID GU_OamVComStatus(APP_VCOM_EVT_UINT32 enPortState) { if(APP_VCOM_EVT_RELEASE == enPortState) { g_stVComDebugInfo.ulVCOMOutNum++; g_stVComDebugInfo.ulVCOMOutTime = OM_GetSlice(); if (CPM_VCOM_PORT == CPM_QueryPhyPort(CPM_OM_COMM)) { GU_OamDisconnectPorts(CPM_VCOM_PORT); g_stAcpuPcToUeSucRecord.stRlsInfo.ulRlsDrvSuspend++; g_stAcpuPcToUeSucRecord.stRlsInfo.ulSlice = OM_GetSlice(); } } else if(APP_VCOM_EVT_OPEN == enPortState) { g_stVComDebugInfo.ulVCOMInNum++; g_stVComDebugInfo.ulVCOMInTime = OM_GetSlice(); } else { LogPrint1("GU_OamVComStatus: The VCOM Port State %d is Unknow", (VOS_INT)enPortState); } return; }
VOS_VOID PPM_PortPseudoSyncGetSmp(OM_PROT_HANDLE_ENUM_UINT32 enHandle) { #if 0 if (OM_USB_IND_PORT_HANDLE == enHandle) { if (VOS_OK != VOS_SmP(g_stUsbIndPseudoSync.ulPseudoSyncSemId, 0)) { g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBIndPseudoSyncFailNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBIndPseudoSyncFailSlice = OM_GetSlice(); } } else if (OM_USB_CFG_PORT_HANDLE == enHandle) { if (VOS_OK != VOS_SmP(g_stUsbCfgPseudoSync.ulPseudoSyncSemId, 0)) { g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCnfPseudoSyncFailNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCnfPseudoSyncFailSlice = OM_GetSlice(); } } else { ; } #endif return; }
VOS_VOID PPM_PortCloseProc(OM_PROT_HANDLE_ENUM_UINT32 enHandle, CPM_PHY_PORT_ENUM_UINT32 enPhyPort) { VOS_ULONG ulLockLevel; OM_LOGIC_CHANNEL_ENUM_UINT32 enChannel; VOS_BOOL ulSndMsg; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCloseNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCloseSlice = OM_GetSlice(); if (VOS_ERROR == g_astOMPortUDIHandle[enHandle]) { return; } DRV_UDI_CLOSE(g_astOMPortUDIHandle[enHandle]); g_astOMPortUDIHandle[enHandle] = VOS_ERROR; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCloseOkNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCloseOkSlice = OM_GetSlice(); VOS_SpinLockIntLock(&g_stPpmPortSwitchSpinLock, ulLockLevel); ulSndMsg = VOS_FALSE; enChannel = OM_LOGIC_CHANNEL_BUTT; /* CFG端口处理GU和TL的端口断开,发消息到GU和TL去处理,但不断开CPM的关联 */ if (OM_USB_CFG_PORT_HANDLE == enHandle) { if (enPhyPort == CPM_QueryPhyPort(CPM_OM_CFG_COMM)) { ulSndMsg = VOS_TRUE; enChannel = OM_LOGIC_CHANNEL_CNF; } } /* IND端口断开时发消息到GU和TL去处理,但不断开CPM的关联 */ else if (OM_USB_IND_PORT_HANDLE == enHandle) { if (enPhyPort == CPM_QueryPhyPort(CPM_OM_IND_COMM)) { ulSndMsg = VOS_TRUE; enChannel = OM_LOGIC_CHANNEL_IND; } } else { } VOS_SpinUnlockIntUnlock(&g_stPpmPortSwitchSpinLock, ulLockLevel); if (VOS_TRUE == ulSndMsg) { PPM_DisconnectAllPort(enChannel); } return; }
VOS_UINT OM_ComRx_ICC_OM_CB(VOS_UINT ulChannelID,VOS_INT lLen) { VOS_UINT32 ulResult; VOS_UINT8 *pucData; if (lLen <= 0) { LogPrint("OM_ComRx_ICC_OM_CB: The Data Len is 0.\n"); g_stPcToUeErrRecord.stICCRecFailInfo.ulICCOmParaErrNum++; return VOS_ERR; } if (VOS_NULL_PTR == g_astOMComRxCBTable[OM_OM_ICC_CHANNEL]) /*当前回调函数为空*/ { LogPrint("OM_ComRx_ICC_OM_CB The CB Function is Empty.\n"); g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecLen += lLen; g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecMsgNum++; g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecSlice = OM_GetSlice(); pucData = (VOS_UINT8 *)VOS_MemAlloc(WUEPS_PID_OM, DYNAMIC_MEM_PT, (VOS_UINT32)lLen); if(VOS_NULL_PTR != pucData) { DRV_UDI_READ(g_astOMCCPUIccCtrlTable[OM_OM_ICC_CHANNEL].UDIHdle, pucData, (VOS_UINT32)lLen); VOS_MemFree(WUEPS_PID_OM, pucData); } return VOS_OK; } ulResult = OM_ComRx_ICCDataRec(OM_OM_ICC_CHANNEL, lLen); if (VOS_ERR == ulResult) { LogPrint("OM_ComRx_ICC_OM_CB The Send Data is Failed.\n"); g_stPcToUeErrRecord.stICCRecFailInfo.ulICCOmRecErrLen += lLen; g_stPcToUeErrRecord.stICCRecFailInfo.ulICCOmRecErrMsgNum++; g_stPcToUeErrRecord.stICCRecFailInfo.ulICCOmRecErrSlice = OM_GetSlice(); } else { g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecLen += lLen; g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecMsgNum++; g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecSlice = OM_GetSlice(); } return ulResult; }
VOS_UINT32 OM_AcpuReleaseReq(APP_OM_MSG_EX_STRU *pstAppToOmMsg, VOS_UINT16 usReturnPrimId) { #if (FEATURE_ON == FEATURE_CBT_LOG) if (OM_CBT_LOG_ENABLE_FLAG == g_ulCBTLogEnable) { return VOS_OK; } #endif g_ulAcpuOMSwitchOnOff = OM_STATE_IDLE; /* 通过ICC通道通知CCPU链路断开 */ if(VOS_OK != GU_OamSndPcMsgToCcpu((VOS_UINT8*)pstAppToOmMsg, sizeof(APP_OM_MSG_EX_STRU))) { /* 打印错误 */ LogPrint("OM_AcpuReleaseReq: The ICC UDI Write is Error.\n"); } OM_NotifyOtherCpuReleaseLink(); g_stAcpuPcToUeSucRecord.stRlsData.ulDataLen = OM_GetSlice(); g_stAcpuPcToUeSucRecord.stRlsData.ulNum++; OM_SendAcpuSocpVote(SOCP_VOTE_FOR_SLEEP); return VOS_OK; }
/***************************************************************************** 函 数 名 : GU_OamPortWriteAsyCB 功能描述 : 用于处理OM的异步发送数据的回调 输入参数 : pucData: 需要发送的数据内容 ulDataLen: 数据长度 输出参数 : 无 返 回 值 : 无 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年2月2日 作 者 : zhuli 修改内容 : Creat Function *****************************************************************************/ VOS_VOID GU_OamPortWriteAsyCB(OM_PROT_HANDLE_ENUM_UINT32 enHandle, VOS_UINT8* pucData, VOS_INT lLen) { VOS_UINT32 ulResult; if(lLen < 0) /*USB返回的错误值,保证可以打开SOCP的中断屏蔽*/ { g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCBErrNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBCBErrTime = OM_GetSlice(); SCM_RlsDestBuf(SOCP_CODER_DST_GU_OM, 0); } else { ulResult = SCM_RlsDestBuf(SOCP_CODER_DST_GU_OM, (VOS_UINT32)lLen); if(VOS_OK != ulResult) { LogPrint2("\r\nGU_OamUSBWriteDataCB: SCM_RlsDestBuf return Error 0x%x, Data Len is %d", (VOS_INT)ulResult, lLen); g_stAcpuDebugInfo.ulSocpReadDoneErrLen += lLen; g_stAcpuDebugInfo.ulSocpReadDoneErrNum++; } } g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteCBNum++; return; }
VOS_UINT32 OM_AcpuCnfReleaseProc(APP_OM_MSG_EX_STRU *pstAppToOmMsg, VOS_UINT16 usReturnPrimId) { g_stAcpuCnfCtrlInfo.ulOMSwitchOnOff = OM_STATE_IDLE; /* 通过ICC通道通知CCPU链路断开 */ if(VOS_OK != GU_OamSndPcMsgToCcpu(&g_stAcpuCnfCtrlInfo, (VOS_UINT8*)pstAppToOmMsg, sizeof(APP_OM_MSG_EX_STRU))) { /* 打印错误 */ LogPrint("OM_AcpuReleaseReq: The ICC UDI Write is Error.\n"); } vos_printf("%s %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",__func__); OM_NotifyOtherCpuReleaseLink(); g_ulAcpuDiscRcvCnt++; /* GU连接断开时投票可以睡眠 */ OM_SendAcpuSocpVote(SOCP_VOTE_FOR_SLEEP); g_stAcpuCnfCtrlInfo.stPcToUeSucRecord.stRlsData.ulDataLen = OM_GetSlice(); g_stAcpuCnfCtrlInfo.stPcToUeSucRecord.stRlsData.ulNum++; return VOS_OK; }
/***************************************************************************** 函 数 名 : LOG_GetTick 功能描述 : 获取当前CPU的Tick时间 输入参数 : 无 输出参数 : 无 返 回 值 : LOG_ERR - 操作失败 LOG_OK - 操作成功 修改历史 : 1.日 期 : 2008年7月17日 作 者 : 甘兰 47350 修改内容 : 新生成函数 *****************************************************************************/ VOS_UINT32 LOG_GetTick(VOS_VOID) { #if ((VOS_OS_VER == VOS_VXWORKS)||(VOS_OS_VER == VOS_LINUX)) /*lint -e718*/ /*lint -e746*/ /*在ASIC/FPGA平台下,需要将Slice值转换成tick值,保证和SDT的显示一致*/ VOS_UINT32 ulSlice; ulSlice = OM_GetSlice(); /*Slice值每隔一秒增加32768,通过以下计算转换成10ms的tick值 而先右移7位,再乘以100,是为了防止数据过大而溢出*/ ulSlice >>= 7; ulSlice *= 100; ulSlice >>= 8; return ulSlice; /*lint +e718*/ /*lint +e746*/ #elif(VOS_OS_VER == VOS_WIN32) return (VOS_UINT32)GetTickCount(); #else return LOG_OK; #endif }
VOS_UINT32 GU_OamLogPortSwitch(VOS_UINT32 ulPhyPort) { CPM_PHY_PORT_ENUM_UINT32 enPhyPort; if ((CPM_VCOM_PORT != ulPhyPort) && (CPM_APP_PORT != ulPhyPort)) { vos_printf("\r\n GU_OamPortSwitch: enPhyPort is error.port %d\n", ulPhyPort); return VOS_ERR; } enPhyPort = CPM_QueryPhyPort(CPM_OM_COMM); if (ulPhyPort != enPhyPort) { /* 断开连接 */ GU_OamDisconnectPorts(enPhyPort); g_stAcpuPcToUeSucRecord.stRlsInfo.ulRlsPortSwitch++; g_stAcpuPcToUeSucRecord.stRlsInfo.ulSlice = OM_GetSlice(); CPM_ConnectPorts(ulPhyPort, CPM_OM_COMM); } return VOS_OK; }
VOS_UINT32 IMM_MntnGetOverMemBlkCnt( VOS_UINT8 ucPoolId ) { IMM_MEM_POOL_STRU *pstImmMemPool; IMM_BLK_MEM_DEBUG_STRU *pstImmMemDebugInfo; IMM_MEM_STRU *pstMem; VOS_UINT32 ulBlkMemNum; VOS_UINT32 ulTotolCnt = 0; /* 获取当前CPU Slice */ g_ulCurrentTimeSlice = OM_GetSlice(); pstImmMemPool = IMM_MEM_GET_POOL(ucPoolId); /* 遍历内存池每块内存 */ for (ulBlkMemNum = 0; ulBlkMemNum < pstImmMemPool->usImmMemTotalCnt; ++ulBlkMemNum ) { pstMem = pstImmMemPool->pstImmMemStStartAddr + ulBlkMemNum; pstImmMemDebugInfo = &pstMem->stDbgInfo; /* 内存块状态检查 */ if ( MEM_BLK_STATE_FREE == pstImmMemDebugInfo->enMemStateFlag ) { continue; } /* 判断内存申请时戳与当前时戳之差是否超过门限 */ if ( g_ulOverTimeSliceThreshold <= IMM_MntnTimeDiff(pstImmMemDebugInfo->ulAllocTick, g_ulCurrentTimeSlice)) { ++ ulTotolCnt; } } return ulTotolCnt; }/* IMM_MntnGetOverMemBlkCnt */
VOS_VOID NAS_SMS_SndOmInquireCnfMsg( ID_NAS_OM_INQUIRE_STRU *pstOmInquireMsg ) { ID_NAS_OM_CNF_STRU *pstSmsOmCnf ; pstSmsOmCnf = VOS_NULL_PTR; pstSmsOmCnf = (ID_NAS_OM_CNF_STRU *)PS_MEM_ALLOC(WUEPS_PID_SMS, (sizeof(ID_NAS_OM_CNF_STRU) + sizeof(NAS_OM_SMS_CONFIRM_STRU)) - NAS_OM_DATA_PTR_LEN); /* 申请内存 */ if (VOS_NULL_PTR == pstSmsOmCnf) { NAS_ERROR_LOG(WUEPS_PID_SMS, "NAS_MMC_SndOmInquireCnfMsg:Memory Allocate fail!"); return; } PS_MEM_SET((VOS_INT8*)pstSmsOmCnf, 0 ,sizeof(ID_NAS_OM_CNF_STRU)); pstSmsOmCnf->ucFuncType = 4; pstSmsOmCnf->ucReserve = 0; pstSmsOmCnf->usLength = NAS_OM_DATA_OFFSET + sizeof(NAS_OM_SMS_CONFIRM_STRU); pstSmsOmCnf->ulSn = 0; pstSmsOmCnf->ulTimeStamp = OM_GetSlice(); pstSmsOmCnf->usPrimId = ID_NAS_OM_SMS_CONFIRM; pstSmsOmCnf->usToolsId = pstOmInquireMsg->usToolsId; NAS_SMS_BuildSmsOmInfo((NAS_OM_SMS_CONFIRM_STRU*)(pstSmsOmCnf->aucData)); OM_SendData( (OM_RSP_PACKET_STRU*)pstSmsOmCnf, (sizeof(ID_NAS_OM_CNF_STRU) + sizeof(NAS_OM_SMS_CONFIRM_STRU)) - NAS_OM_DATA_PTR_LEN ); /* 原语发送 */ PS_MEM_FREE(WUEPS_PID_SMS, pstSmsOmCnf); }
/***************************************************************************** Function : HPA_2GAwakeIsr Description: Gsm Awake isr Input : void Return : void Other : *****************************************************************************/ VOS_VOID HPA_2GAwakeIsr(MODEM_ID_ENUM_UINT16 enModemID) { VOS_UINT32 ulBeginSlice; if(enModemID >= MODEM_ID_BUTT) { return; } /*lint -e662 -e661*/ DRV_VICINT_DISABLE(g_aulGBBPAwakeIntNO[enModemID]); /*lint +e662 +e661*/ if (MODEM_ID_0 == enModemID) { SLEEP_AwakeIsr(VOS_RATMODE_GSM); } /*lint -e718 -e746 修改人:ganlan;检视人:徐铖 51137 */ #if ( FEATURE_MULTI_MODEM == FEATURE_ON ) if (MODEM_ID_1 == enModemID) { I1_SLEEP_AwakeIsr(VOS_RATMODE_GSM); } #endif /*lint +e718 +e746 修改人:ganlan;检视人:徐铖 51137 */ HPA_Write32RegMask(g_aulGBBPRegAddr[DRX_INT_CLR][enModemID], OAM_GBBP_WAKE_UP_INT_BIT ); ulBeginSlice = OM_GetSlice(); while((0 != (HPA_Read32Reg(g_aulGBBPRegAddr[DRX_INT_STA][enModemID]) & (OAM_GBBP_WAKE_UP_INT_BIT))) &&(BBP_DRX_INT_SLICE_COUNT > (OM_GetSlice() - ulBeginSlice))) { ; } /*lint -e662 -e661*/ DRV_VICINT_ENABLE(g_aulGBBPAwakeIntNO[enModemID]); /*lint +e662 +e661*/ return; }
/***************************************************************************** Function : HPA_BbpAwakeIsr Description: Gsm&Wcdma Drx isr,Only used for asic platform Input : void Return : void Other : *****************************************************************************/ VOS_VOID HPA_3GSwitchClockIsr(VOS_VOID) { VOS_UINT32 ulBbpStatus; VOS_UINT32 ulBeginSlice; DRV_VICINT_DISABLE(g_ulWBBPSwtichIntNO); ulBbpStatus = HPA_Read32Reg(WBBP_ARM_INT03_STA_ADDR); /* Clear interrupt */ HPA_Write32Reg(WBBP_ARM_INT03_CLR_1CARD_ADDR, ulBbpStatus); if(0 != ulBbpStatus) { ulBeginSlice = OM_GetSlice(); while((0 != HPA_Read32Reg(WBBP_ARM_INT03_STA_ADDR)) &&(BBP_DRX_INT_SLICE_COUNT > (OM_GetSlice() - ulBeginSlice))) { ; } if( BIT_N(WSLEEP_64M_TO_32K_TYPE_BIT) & ulBbpStatus ) { SLEEP_32KIsr(VOS_RATMODE_WCDMA); } else if (BIT_N(WSLEEP_32K_TO_64M_TYPE_BIT) & ulBbpStatus) { SLEEP_NormalClockIsr(VOS_RATMODE_WCDMA); } else { ; } } DRV_VICINT_ENABLE(g_ulWBBPSwtichIntNO); return; }
VOS_VOID OM_AcpuSocpVoteInfoAdd(OM_SOCPVOTEINFO_ENUM_UINT32 enInfoType) { #if(FEATURE_ON == FEATURE_SOCP_ON_DEMAND) if (enInfoType >= OM_SOCPVOTE_INFO_BUTT) { return; } g_astOmAcpuSocpVoteInfo[enInfoType].ulCounter++; g_astOmAcpuSocpVoteInfo[enInfoType].ulSlice = OM_GetSlice(); #endif return; }
/***************************************************************************** Function : HPA_3G0MsIsr Description: ISR of R99 0ms Input : void Return : void Other : *****************************************************************************/ VOS_VOID HPA_3G0MsIsr(VOS_VOID) { if (PWRCTRL_COMM_OFF == DRV_PWRCTRL_PWRSTATUSGET((PWC_COMM_MODE_E)VOS_RATMODE_WCDMA, PWC_COMM_MODULE_BBP_DRX, (PWC_COMM_MODEM_E)MODEM_ID_0)) { VOS_ProtectionReboot(DRX_REPORT_BBP_POWERDOWN_ERROR, PS_FILE_ID_HPA_ISR_C, __LINE__, VOS_NULL_PTR, 0); return; } /* Clear interrupt */ HPA_Write32Reg(WBBP_ARM_INT01_CLR_ADDR, 1); DRV_VICINT_DISABLE(g_ulWBBP0MsIntNO); g_stHpaIntCount.ul0msIntNum++; g_stHpaIntCount.ul0msIntSlice = OM_GetSlice(); #ifdef HPA_ITT Stub_RttRegGet(); if ( VOS_NULL_PTR != g_pfnHpaDspIsrStub ) { g_pfnHpaDspIsrStub(); } #endif /* Read SFN & CFN */ HPA_ReadCfnSfn(); /* Trigger HPA_TransferTaskEntry task to transfer msg between ARM and DSP.*/ atomic_inc(&g_stDspMailBoxTransferCount); VOS_SmV(g_ulHpaTransferSem); g_ul3GISRNum++; DRV_VICINT_ENABLE(g_ulWBBP0MsIntNO); return ; }
VOS_VOID CMMCA_DEBUG_RecordMsgInfo(VOS_UINT32 ulSendPid, VOS_UINT32 ulMsgId) { CMMCA_MNTN_MSG_RECORD_INFO_STRU *pstMsgInfoAddr; VOS_UINT32 ulIndex; pstMsgInfoAddr = CMMCA_DEBUG_GetMsgRecoredInfoAddr(); ulIndex = pstMsgInfoAddr->ulIndex % CMMCA_DEBUG_MSG_RECORD_NUM; pstMsgInfoAddr->astMsgRecord[ulIndex].ulMsgId = ulMsgId; pstMsgInfoAddr->astMsgRecord[ulIndex].ulSendPid = ulSendPid; pstMsgInfoAddr->astMsgRecord[ulIndex].ulRcvTime = OM_GetSlice(); pstMsgInfoAddr->ulIndex++; if (0 == pstMsgInfoAddr->ulIndex % CMMCA_DEBUG_MSG_RECORD_NUM) { CMMCA_DEBUG_TraceMsgRecordInfo(); PS_MEM_SET(pstMsgInfoAddr, 0x0, sizeof(CMMCA_MNTN_MSG_RECORD_INFO_STRU)); } return; }
VOS_VOID USIMM_OmFileCnf(VOS_UINT32 ulResult,VOS_UINT16 usEfLen,VOS_UINT8 *pucEf,VOS_UINT8 ucCmdType) { PS_USIM_OM_TRANS_IND_STRU *pstTransMsg; pstTransMsg = (PS_USIM_OM_TRANS_IND_STRU *)VOS_AllocMsg(WUEPS_PID_USIM, (sizeof(PS_USIM_OM_TRANS_IND_STRU) - VOS_MSG_HEAD_LENGTH) + usEfLen); if (VOS_NULL_PTR == pstTransMsg) { USIMM_ERROR_LOG("USIMM_OmFileCnf: VOS_AllocMsg for Om is Failed"); return; } pstTransMsg->ulReceiverPid = WUEPS_PID_OM; pstTransMsg->usTransPrimId = USIMM_TRANS_PRIMID; /*固定填写0x5001*/ pstTransMsg->ucFuncType = 4; /*对于透明消息,功能类型固定填写4*/ pstTransMsg->usAppLength = 14 + usEfLen; /*14为透明消息结构体usAppLength之后的长度*/ pstTransMsg->ucResult = (VOS_UINT8)ulResult; pstTransMsg->ucEFLen = (VOS_UINT8)(usEfLen); pstTransMsg->ulTimeStamp = OM_GetSlice(); if ( USIMM_OM_GET_CNF == ucCmdType ) { pstTransMsg->usPrimId = USIMM_GET_PRIMID;/*OAM的透明消息,读取文件原语0xAA01*/ } else { pstTransMsg->usPrimId = USIMM_SET_PRIMID;/*OAM的透明消息,更新文件原语0xAA02*/ } if(0 != usEfLen) /*当前存在回复文件内容*/ { VOS_MemCpy(&pstTransMsg->aucData[0],pucEf,usEfLen); } (VOS_VOID)VOS_SendMsg(pstTransMsg->ulSenderPid, pstTransMsg); return; }
/***************************************************************************** Function : HPA_2GFrameClockIsr Description: Gsm BBP frame and clock switch ISR Input : void Return : void Other : *****************************************************************************/ VOS_VOID HPA_2GFrameClockIsr(MODEM_ID_ENUM_UINT16 enModemID) { VOS_UINT32 ulBbpStatus; VOS_UINT32 ulDrxStatus; VOS_UINT32 ulBeginSlice; VOS_UINT32 i; if(enModemID >= MODEM_ID_BUTT) { return; } /* if (PWRCTRL_COMM_OFF == DRV_PWRCTRL_PWRSTATUSGET((PWC_COMM_MODE_E)VOS_RATMODE_GSM, PWC_COMM_MODULE_BBP_DRX, (PWC_COMM_MODEM_E)enModemID)) { VOS_ProtectionReboot(DRX_REPORT_BBP_POWERDOWN_ERROR, PS_FILE_ID_HPA_ISR_C, __LINE__, VOS_NULL_PTR, 0); return; } */ /*lint -e662 -e661*/ DRV_VICINT_DISABLE(g_aulGBBPIntNO[enModemID]); /*lint +e662 +e661*/ #if defined (CHIP_BB_6620CS) if (MODEM_ID_0 == enModemID) { g_stHpaIntCount.ulSOCStatRecord[0] = HPA_Read32Reg(0xF711A674); g_stHpaIntCount.ulSOCStatRecord[1] = HPA_Read32Reg(0xF711A6A8); g_stHpaIntCount.ulSOCStatRecord[2] = HPA_Read32Reg(0xF711A710); g_stHpaIntCount.ulSOCStatRecord[3] = HPA_Read32Reg(0xF711A72C); g_stHpaIntCount.ulSOCStatRecord[4] = HPA_Read32Reg(0xF7410854); g_stHpaIntCount.ulSOCStatRecord[5] = HPA_Read32Reg(0xF741085C); g_stHpaIntCount.ulSOCStatRecord[6] = HPA_Read32Reg(0xF7410864); g_stHpaIntCount.ulSOCStatRecord[7] = HPA_Read32Reg(0xF741086C); g_stHpaIntCount.ulSOCStatRecord[8] = HPA_Read32Reg(0xFDF8A00C); } #endif ulBbpStatus = HPA_Read32Reg(g_aulGBBPRegAddr[INT_STA][enModemID]) & OAM_GBBP_FRAME_INT_BIT; HPA_Write32RegMask(g_aulGBBPRegAddr[INT_CLR][enModemID], ulBbpStatus ); ulDrxStatus = HPA_Read32Reg(g_aulGBBPRegAddr[DRX_INT_STA][enModemID]) & (OAM_GBBP_DRX_CLK_SWITCH_32K_INT_BIT | OAM_GBBP_DRX_CLK_SWITCH_52M_INT_BIT); /* 为了规避BBP在读取TL以及BBP TIMER常开区地址异常bug,在这里进行时钟切换中断读取 异常规避 */ if ( 0 == ( OAM_GBBP_FRAME_INT_BIT & ulBbpStatus ) ) { /* 读取时钟切换中断内容异常时处理流程 */ if( 0 == ulDrxStatus ) { for (i=0; i<3; i++) { ulDrxStatus = HPA_Read32Reg(g_aulGBBPRegAddr[DRX_INT_STA][enModemID]) & (OAM_GBBP_DRX_CLK_SWITCH_32K_INT_BIT | OAM_GBBP_DRX_CLK_SWITCH_52M_INT_BIT); } if( 0 == ulDrxStatus ) { if (MODEM_ID_0 == enModemID) { if (VOS_TRUE == SLEEP_IsAwakeProc(VOS_RATMODE_GSM)) { ulDrxStatus |= OAM_GBBP_DRX_CLK_SWITCH_52M_INT_BIT; } else { ulDrxStatus |= OAM_GBBP_DRX_CLK_SWITCH_32K_INT_BIT; } } #if ( FEATURE_MULTI_MODEM == FEATURE_ON ) if (MODEM_ID_1 == enModemID) { if (VOS_TRUE == I1_SLEEP_IsAwakeProc(VOS_RATMODE_GSM)) { ulDrxStatus |= OAM_GBBP_DRX_CLK_SWITCH_52M_INT_BIT; } else { ulDrxStatus |= OAM_GBBP_DRX_CLK_SWITCH_32K_INT_BIT; } } #endif /*lint -e661*/ g_stHpaIntCount.ulBBPSwitchIsrErrorCount[enModemID]++; g_stHpaIntCount.ulBBPSwitchIsrErrorSlice[enModemID] = OM_GetSlice(); /*lint +e661*/ } } } HPA_Write32RegMask(g_aulGBBPRegAddr[DRX_INT_CLR][enModemID], ulDrxStatus ); if( 0 != ( OAM_GBBP_FRAME_INT_BIT & ulBbpStatus ) ) { ulBeginSlice = OM_GetSlice(); while((0 != (HPA_Read32Reg(g_aulGBBPRegAddr[INT_STA][enModemID]) & OAM_GBBP_FRAME_INT_BIT)) &&(BBP_DRX_INT_SLICE_COUNT > (OM_GetSlice() - ulBeginSlice))) { ; } } if ((0 != ( OAM_GBBP_DRX_CLK_SWITCH_32K_INT_BIT & ulDrxStatus)) || (0 != ( OAM_GBBP_DRX_CLK_SWITCH_52M_INT_BIT & ulDrxStatus))) { ulBeginSlice = OM_GetSlice(); while((0 != (HPA_Read32Reg(g_aulGBBPRegAddr[DRX_INT_STA][enModemID]) & (OAM_GBBP_DRX_CLK_SWITCH_32K_INT_BIT | OAM_GBBP_DRX_CLK_SWITCH_52M_INT_BIT))) &&(BBP_DRX_INT_SLICE_COUNT > (OM_GetSlice() - ulBeginSlice))) { ; } } if( 0 != ( OAM_GBBP_FRAME_INT_BIT & ulBbpStatus ) ) { /*lint -e661*/ g_stHpaIntCount.aulPpIntNum[enModemID]++; g_stHpaIntCount.aulPpIntSlice[enModemID] = OM_GetSlice(); /*lint +e661*/ if(MODEM_ID_1 == enModemID) { g_ul2GISRNum1++; atomic_inc(&g_stGDsp1MailBoxTransferCount); } else { g_ul2GISRNum0++; atomic_inc(&g_stGDspMailBoxTransferCount); } VOS_SmV(g_ulHpaTransferSem); } if (0 != ( OAM_GBBP_DRX_CLK_SWITCH_32K_INT_BIT & ulDrxStatus)) { if (MODEM_ID_0 == enModemID) { SLEEP_32KIsr(VOS_RATMODE_GSM); } /*lint -e718 -e746 修改人:ganlan;检视人:徐铖 51137 */ #if ( FEATURE_MULTI_MODEM == FEATURE_ON ) if (MODEM_ID_1 == enModemID) { I1_SLEEP_32KIsr(VOS_RATMODE_GSM); } #endif /*lint +e718 +e746 修改人:ganlan;检视人:徐铖 51137 */ } if (0 != ( OAM_GBBP_DRX_CLK_SWITCH_52M_INT_BIT & ulDrxStatus)) { if (MODEM_ID_0 == enModemID) { SLEEP_NormalClockIsr(VOS_RATMODE_GSM); } /*lint -e718 -e746 修改人:ganlan;检视人:徐铖 51137 */ #if ( FEATURE_MULTI_MODEM == FEATURE_ON ) if (MODEM_ID_1 == enModemID) { I1_SLEEP_NormalClockIsr(VOS_RATMODE_GSM); } #endif /*lint +e718 +e746 修改人:ganlan;检视人:徐铖 51137 */ } /*lint -e662 -e661*/ DRV_VICINT_ENABLE(g_aulGBBPIntNO[enModemID]); /*lint +e662 +e661*/ }
VOS_VOID CBTPPM_OamCbtPortDataInit(OM_PROT_HANDLE_ENUM_UINT32 enHandle, VOS_VOID *pReadCB, VOS_VOID *pWriteCB, VOS_VOID *pStateCB) { UDI_OPEN_PARAM stUdiPara; ACM_READ_BUFF_INFO stReadBuffInfo; stUdiPara.devid = UDI_ACM_OM_ID; stReadBuffInfo.u32BuffSize = OM_ICC_BUFFER_SIZE; stReadBuffInfo.u32BuffNum = OM_DRV_MAX_IO_COUNT; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenSlice = OM_GetSlice(); if (VOS_ERROR != g_ulCbtPortUDIHandle) { LogPrint("\r\n CBTPPM_OamCbtPortDataInit: The UDI Handle is not Null !"); return; } /* 打开CBT使用的USB通道 */ g_ulCbtPortUDIHandle = DRV_UDI_OPEN(&stUdiPara); if (VOS_ERROR == g_ulCbtPortUDIHandle) { LogPrint("\r\n CBTPPM_OamCbtPortDataInit: Open UDI ACM failed!"); return; } g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenOkNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenOkSlice = OM_GetSlice(); /* 配置CBT使用的USB通道缓存 */ if (VOS_OK != DRV_UDI_IOCTL(g_ulCbtPortUDIHandle, ACM_IOCTL_RELLOC_READ_BUFF, &stReadBuffInfo)) { LogPrint("\r\n CBTPPM_OamCbtPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_RELLOC_READ_BUFF Failed\r\n"); return; } /* 获取USB的IO CTRL口的读缓存 */ if (VOS_OK != DRV_UDI_IOCTL(g_ulCbtPortUDIHandle, ACM_IOCTL_SEND_BUFF_CAN_DMA, &stReadBuffInfo)) { LogPrint("\r\n CBTPPM_OamCbtPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_SEND_BUFF_CAN_DMA Failed\r\n"); return; } /* 注册OM使用的USB读数据回调函数 */ if (VOS_OK != DRV_UDI_IOCTL(g_ulCbtPortUDIHandle, UDI_ACM_IOCTL_SET_READ_CB, pReadCB)) { LogPrint("\r\n CBTPPM_OamCbtPortDataInit, DRV_UDI_IOCTL UDI_ACM_IOCTL_SET_READ_CB Failed\r\n"); return; } if(VOS_OK != DRV_UDI_IOCTL(g_ulCbtPortUDIHandle, ACM_IOCTL_SET_WRITE_CB, pWriteCB)) { LogPrint("\r\n CBTPPM_OamCbtPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_SET_WRITE_CB Failed\r\n"); return; } if(VOS_OK != DRV_UDI_IOCTL(g_ulCbtPortUDIHandle, ACM_IOCTL_SET_EVT_CB, pStateCB)) { LogPrint("\r\n CBTPPM_OamCbtPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_SET_EVT_CB Failed\r\n"); return; } if (VOS_OK != DRV_UDI_IOCTL(g_ulCbtPortUDIHandle, ACM_IOCTL_WRITE_DO_COPY, VOS_NULL_PTR)) { LogPrint("\r\n CBTPPM_OamCbtPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_WRITE_DO_COPY Failed\r\n"); return; } g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenOk2Num++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenOk2Slice = OM_GetSlice(); return; }
if (VOS_NULL_PTR == pstIpsMntnToOmMsg) { PS_LOG(ACPU_PID_NFEXT, PS_SUBMOD_NULL, PS_PRINT_ERROR, "IPS, IPS_MNTN_SndCfgCnf2Om, ERROR, Call PS_ALLOC_MSG_WITH_HEADER_LEN \ fail!"); return; } /* 填充 到 OM的透明消息 */ IPS_FILL_MSG_HEADER(pstIpsMntnToOmMsg, ACPU_PID_OM); pstIpsMntnToOmMsg->usTransPrimId = OM_TRANS_PRIMID; /*透传消息固定填为0x5001*/ pstIpsMntnToOmMsg->ucFuncType = OM_TRANS_FUNC; /*透传功能*/ pstIpsMntnToOmMsg->usAppLength = usIpsMntnToOmMsgLen - PS_OM_TRANS_OM_HEADER_LEN; /*减去usAppLength及其之前的ie长度*/ pstIpsMntnToOmMsg->ulSn = 0; /*暂时填0*/ pstIpsMntnToOmMsg->ulTimeStamp = OM_GetSlice(); pstIpsMntnToOmMsg->usPrimId = usPrimId; /*根据输入消息ID填写*/ pstIpsMntnToOmMsg->usToolsId = 0; /*工具ID,目前暂没有使用*/ /* 填充确认信息 */ if ( (0 != usTransMsgContentLen) && (VOS_NULL_PTR != pTransMsgContent) ) { PS_MEM_CPY(pstIpsMntnToOmMsg->aucData, pTransMsgContent, usTransMsgContentLen); } if ( VOS_OK != PS_SEND_MSG(ACPU_PID_NFEXT, pstIpsMntnToOmMsg) ) { PS_LOG(ACPU_PID_NFEXT, PS_SUBMOD_NULL, PS_PRINT_ERROR, "IPS, IPS_MNTN_SndCfgCnf2Om, ERROR, Call PS_SEND_MSG fail!"); }
/***************************************************************************** 函 数 名 : GU_OamReadPortDataInit 功能描述 : 用于初始化OM使用的设备 输入参数 : enPhyPort: 物理端口号 enHandle: 端口的句柄 pReadCB: 该端口上面的读取回调函数 pWriteCB: 该端口上面的异步写回调函数 pStateCB: 该端口上面的状态回调函数 输出参数 : pUdiHandle: 端口的句柄 返 回 值 : VOS_OK/VOS_ERR 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年2月2日 作 者 : zhuli 修改内容 : Creat Function *****************************************************************************/ VOS_VOID GU_OamReadPortDataInit(CPM_PHY_PORT_ENUM_UINT32 enPhyPort, OM_PROT_HANDLE_ENUM_UINT32 enHandle, VOS_VOID *pReadCB, VOS_VOID *pWriteCB, VOS_VOID *pStateCB) { UDI_OPEN_PARAM stUdiPara; ACM_READ_BUFF_INFO stReadBuffInfo; /*初始化当前使用的USB通道*/ if(CPM_APP_PORT == enPhyPort) { stUdiPara.devid = UDI_ACM_OM_ID; } else if(CPM_CTRL_PORT == enPhyPort) { stUdiPara.devid = UDI_ACM_CTRL_ID; } else if(CPM_HSIC_PORT == enPhyPort) { stUdiPara.devid = UDI_ACM_HSIC_ACM6_ID; } else { LogPrint1("\r\nGU_OamReadPortDataInit: Open Wrong Port %d!", (VOS_INT)enPhyPort); return; } stReadBuffInfo.u32BuffSize = OM_ICC_BUFFER_SIZE; stReadBuffInfo.u32BuffNum = OM_DRV_MAX_IO_COUNT; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenSlice = OM_GetSlice(); if (VOS_ERROR != g_astOMPortUDIHandle[enHandle]) { LogPrint("\r\nGU_OamReadPortDataInit: The UDI Handle is not Null !"); return; } /* 打开OM使用的USB通道 */ g_astOMPortUDIHandle[enHandle] = DRV_UDI_OPEN(&stUdiPara); if (VOS_ERROR == g_astOMPortUDIHandle[enHandle]) { LogPrint("\r\nGU_OamReadPortDataInit: Open UDI ACM failed!"); return; } g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenOkNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenOkSlice = OM_GetSlice(); /* 配置OM使用的USB通道缓存 */ if (VOS_OK != DRV_UDI_IOCTL(g_astOMPortUDIHandle[enHandle], ACM_IOCTL_RELLOC_READ_BUFF, &stReadBuffInfo)) { LogPrint("\r\nGU_OamReadPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_RELLOC_READ_BUFF Failed\r\n"); return; } /* 获取USB的IO CTRL口的读缓存 */ if (VOS_OK != DRV_UDI_IOCTL(g_astOMPortUDIHandle[enHandle], ACM_IOCTL_SEND_BUFF_CAN_DMA, &stReadBuffInfo)) { LogPrint("\r\nGU_OamReadPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_SEND_BUFF_CAN_DMA Failed\r\n"); return; } /* 注册OM使用的USB读数据回调函数 */ if (VOS_OK != DRV_UDI_IOCTL(g_astOMPortUDIHandle[enHandle], UDI_ACM_IOCTL_SET_READ_CB, pReadCB)) { LogPrint("\r\nGU_OamReadPortDataInit, DRV_UDI_IOCTL UDI_ACM_IOCTL_SET_READ_CB Failed\r\n"); return; } if(VOS_OK != DRV_UDI_IOCTL(g_astOMPortUDIHandle[enHandle], ACM_IOCTL_SET_WRITE_CB, pWriteCB)) { LogPrint("\r\nGU_OamReadPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_SET_WRITE_CB Failed\r\n"); return; } if(VOS_OK != DRV_UDI_IOCTL(g_astOMPortUDIHandle[enHandle], ACM_IOCTL_SET_EVT_CB, pStateCB)) { LogPrint("\r\nGU_OamReadPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_SET_WRITE_CB Failed\r\n"); return; } /* 设置通道 0 copy */ if(VOS_OK != DRV_UDI_IOCTL(g_astOMPortUDIHandle[enHandle], ACM_IOCTL_WRITE_DO_COPY, VOS_NULL_PTR)) { LogPrint("\r\nGU_OamReadPortDataInit, DRV_UDI_IOCTL ACM_IOCTL_WRITE_DO_COPY Failed\r\n"); return; } g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenOk2Num++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOpenOk2Slice = OM_GetSlice(); return; }
VOS_UINT32 CBTPPM_OamUsbCbtSendData(VOS_UINT8 *pucVirAddr, VOS_UINT8 *pucPhyAddr, VOS_UINT32 ulDataLen) { VOS_INT32 lRet; ACM_WR_ASYNC_INFO stVcom; VOS_UINT32 ulInSlice; VOS_UINT32 ulOutSlice; VOS_UINT32 ulWriteSlice; if ((VOS_NULL_PTR == pucVirAddr) || (VOS_NULL_PTR == pucPhyAddr)) { /* 打印错误 */ LogPrint("\r\n CBTPPM_OamUsbCbtSendData: Vir or Phy Addr is Null \n"); return CPM_SEND_PARA_ERR; } stVcom.pVirAddr = (VOS_CHAR*)pucVirAddr; stVcom.pPhyAddr = (VOS_CHAR*)pucPhyAddr; stVcom.u32Size = ulDataLen; stVcom.pDrvPriv = VOS_NULL_PTR; g_stAcpuDebugInfo.astPortInfo[OM_USB_CBT_PORT_HANDLE].ulUSBWriteNum1++; ulInSlice = OM_GetSlice(); lRet = DRV_UDI_IOCTL(g_ulCbtPortUDIHandle, ACM_IOCTL_WRITE_ASYNC, &stVcom); g_stAcpuDebugInfo.astPortInfo[OM_USB_CBT_PORT_HANDLE].ulUSBWriteNum2++; ulOutSlice = OM_GetSlice(); if(ulInSlice > ulOutSlice) { ulWriteSlice = ulInSlice - ulOutSlice; } else { ulWriteSlice = ulOutSlice - ulInSlice; } if(ulWriteSlice > g_stAcpuDebugInfo.astPortInfo[OM_USB_CBT_PORT_HANDLE].ulUSBWriteMaxTime) { g_stAcpuDebugInfo.astPortInfo[OM_USB_CBT_PORT_HANDLE].ulUSBWriteMaxTime = ulWriteSlice; } if (BSP_OK == lRet) /*当前发送成功*/ { if (VOS_OK != VOS_SmP(g_ulCbtUsbPseudoSyncSemId, 0)) { LogPrint1("\r\n CBTPPM_OamUsbCbtSendData: DRV_UDI_IOCTL Send Data return Error %d\n", lRet); return VOS_ERR; } return VOS_OK; } else if (BSP_OK > lRet) /*临时错误*/ { /*打印信息,调用UDI接口的错误信息*/ LogPrint1("\r\n CBTPPM_OamUsbCbtSendData: DRV_UDI_IOCTL Send Data return Error %d\n", lRet); g_stAcpuDebugInfo.astPortInfo[OM_USB_CBT_PORT_HANDLE].ulUSBWriteErrNum++; g_stAcpuDebugInfo.astPortInfo[OM_USB_CBT_PORT_HANDLE].ulUSBWriteErrLen += ulDataLen; g_stAcpuDebugInfo.astPortInfo[OM_USB_CBT_PORT_HANDLE].ulUSBWriteErrValue = (VOS_UINT32)lRet; g_stAcpuDebugInfo.astPortInfo[OM_USB_CBT_PORT_HANDLE].ulUSBWriteErrTime = OM_GetSlice(); return VOS_ERR; /*对于临时错误,需要返回NULL丢弃数据*/ } else /*其他错误需要复位单板*/ { /*打印信息,调用UDI接口*/ LogPrint1("\r\n CBTPPM_OamUsbCbtSendData: DRV_UDI_IOCTL Send Data return Error %d\n", lRet); DRV_SYSTEM_ERROR(OAM_USB_SEND_ERROR, (VOS_INT)THIS_FILE_ID, (VOS_INT)__LINE__, (VOS_CHAR *)&lRet, sizeof(VOS_INT32)); return VOS_ERR; } }
VOS_VOID PPM_PortStatus(OM_PROT_HANDLE_ENUM_UINT32 enHandle, CPM_PHY_PORT_ENUM_UINT32 enPhyPort,ACM_EVT_E enPortState) { VOS_ULONG ulLockLevel; OM_LOGIC_CHANNEL_ENUM_UINT32 enChannel; VOS_BOOL ulSndMsg; if (ACM_EVT_DEV_SUSPEND == enPortState) { g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOutNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBOutTime = OM_GetSlice(); VOS_SpinLockIntLock(&g_stPpmPortSwitchSpinLock, ulLockLevel); ulSndMsg = VOS_FALSE; enChannel = OM_LOGIC_CHANNEL_BUTT; /* CFG端口处理GU和TL的端口断开,发消息到GU和TL去处理,但不断开CPM的关联 */ if (OM_USB_CFG_PORT_HANDLE == enHandle) { if (enPhyPort == CPM_QueryPhyPort(CPM_OM_CFG_COMM)) { ulSndMsg = VOS_TRUE; enChannel = OM_LOGIC_CHANNEL_CNF; } } /* IND端口断开时发消息到GU和TL去处理 */ else if (OM_USB_IND_PORT_HANDLE == enHandle) { if (enPhyPort == CPM_QueryPhyPort(CPM_OM_IND_COMM)) { ulSndMsg = VOS_TRUE; enChannel = OM_LOGIC_CHANNEL_IND; } } else { } VOS_SpinUnlockIntUnlock(&g_stPpmPortSwitchSpinLock, ulLockLevel); if (VOS_TRUE == ulSndMsg) { PPM_DisconnectAllPort(enChannel); } } else if(ACM_EVT_DEV_READY == enPortState) { g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBINNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBINTime = OM_GetSlice(); } else { LogPrint2("PPM_PortStatus: The USB Port %d State %d is Unknow", (VOS_INT)enPhyPort, (VOS_INT)enPortState); g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBStateErrNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBStateErrTime = OM_GetSlice(); } return; }
VOS_UINT32 GU_OamPortSend(OM_PROT_HANDLE_ENUM_UINT32 enHandle, VOS_UINT8 *pucData, VOS_UINT32 ulDataLen) { VOS_INT32 lRet; ACM_WR_ASYNC_INFO stVcom; VOS_UINT32 ulInSlice; VOS_UINT32 ulOutSlice; VOS_UINT32 ulWriteSlice; VOS_CHAR aucUsbLog[100]; stVcom.pBuffer = (VOS_CHAR*)pucData; stVcom.u32Size = ulDataLen; stVcom.pDrvPriv= VOS_NULL_PTR; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteNum1++; if (VOS_ERROR == g_astOMPortUDIHandle[enHandle]) { LogPrint("\r\nGU_OamPortSend: USB HANDLE is err. \n"); return CPM_SEND_ERR; } ulInSlice = OM_GetSlice(); /* 返回写入数据长度代表写操作成功 */ lRet = DRV_UDI_IOCTL(g_astOMPortUDIHandle[enHandle], ACM_IOCTL_WRITE_ASYNC, &stVcom); g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteNum2++; ulOutSlice = OM_GetSlice(); if(ulInSlice > ulOutSlice) { ulWriteSlice = ulInSlice - ulOutSlice; } else { ulWriteSlice = ulOutSlice - ulInSlice; } if(ulWriteSlice > g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteMaxTime) { g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteMaxTime = ulWriteSlice; } if (BSP_OK == lRet) /*当前发送成功*/ { return CPM_SEND_OK; } else if(BSP_OK > lRet) /*临时错误*/ { /*打印信息,调用UDI接口的错误信息*/ LogPrint1("\r\nGU_OamPortSend: DRV_UDI_IOCTL Send Data return Error %d\n", lRet); g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteErrNum++; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteErrLen += ulDataLen; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteErrValue = (VOS_UINT32)lRet; g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteErrTime = OM_GetSlice(); if (VOS_OK != OM_AcpuGetLogPath(aucUsbLog, OM_USB_LOG_FILE, OM_USB_UNITARY_LOG_FILE)) { return CPM_SEND_FUNC_NULL; } if( 0 == (g_ulUSBSendErrCnt%USB_SEND_DATA_ERROR_MAX)) /*累计丢包超过限制需要记录到log文件中*/ { OM_Acpu_WriteLogFile(aucUsbLog, (VOS_CHAR *)&g_stAcpuDebugInfo, sizeof(OM_ACPU_DEBUG_INFO)); } g_ulUSBSendErrCnt++; return CPM_SEND_FUNC_NULL; /*对于临时错误,需要返回NULL丢弃数据*/ } else /*其他错误需要复位单板*/ { /*打印信息,调用UDI接口*/ LogPrint1("\r\nGU_OamPortSend: DRV_UDI_IOCTL Send Data return Error %d\n", lRet); DRV_SYSTEM_ERROR(OAM_USB_SEND_ERROR, lRet, (VOS_INT)enHandle, (VOS_CHAR *)&g_stAcpuDebugInfo, sizeof(OM_ACPU_DEBUG_INFO)); return CPM_SEND_ERR; } }
VOS_UINT32 PPM_LogPortSwitch(VOS_UINT32 ulPhyPort, VOS_BOOL ulEffect) { CPM_PHY_PORT_ENUM_UINT32 enPhyCfgPort; CPM_PHY_PORT_ENUM_UINT32 enPhyIndPort; VOS_ULONG ulLockLevel; VOS_BOOL ulSndMsg; if ((CPM_OM_PORT_TYPE_USB != ulPhyPort) && (CPM_OM_PORT_TYPE_VCOM != ulPhyPort)) { vos_printf("\r\n PPM_LogPortSwitch: enPhyPort is error.port %d\n", ulPhyPort); g_stPpmPortSwitchInfo.ulPortTypeErr++; return VOS_ERR; } /* 切换的端口与当前端口一致不切换 */ if (ulPhyPort == g_stPortCfg.enPortNum) { DRV_SOCP_VOTE(SOCP_VOTE_PPM_RCV, SOCP_VOTE_FOR_WAKE); /* 切换到VCOM输出时在LOG延迟写入开启情况下需要重新设置SOCP的超时中断 */ if (CPM_OM_PORT_TYPE_VCOM == g_stPortCfg.enPortNum) { (VOS_VOID)DRV_SOCP_SET_TIMEOUT(SOCP_TIMEOUT_TRF, 0); } /* 为了规避USB输出时开启了延时写入无法连接工具,切换到USB输出时需要重新设置SOCP的超时中断到默认值 */ if (CPM_OM_PORT_TYPE_USB == g_stPortCfg.enPortNum) { (VOS_VOID)DRV_SOCP_SET_TIMEOUT(SOCP_TIMEOUT_TRF, 0x17); } DRV_SOCP_VOTE(SOCP_VOTE_PPM_RCV, SOCP_VOTE_FOR_SLEEP); return VOS_OK; } g_stPpmPortSwitchInfo.ulStartSlice = OM_GetSlice(); enPhyCfgPort = CPM_QueryPhyPort(CPM_OM_CFG_COMM); enPhyIndPort = CPM_QueryPhyPort(CPM_OM_IND_COMM); ulSndMsg = VOS_FALSE; VOS_SpinLockIntLock(&g_stPpmPortSwitchSpinLock, ulLockLevel); /* 切换到VCOM输出 */ if (CPM_OM_PORT_TYPE_VCOM == ulPhyPort) { /* 当前是USB输出 */ if ((CPM_CFG_PORT == enPhyCfgPort) && (CPM_IND_PORT == enPhyIndPort)) { /* 需要断开连接 */ ulSndMsg = VOS_TRUE; CPM_DisconnectPorts(CPM_CFG_PORT, CPM_OM_CFG_COMM); CPM_DisconnectPorts(CPM_IND_PORT, CPM_OM_IND_COMM); } /* 当前OM走VCOM上报 */ CPM_ConnectPorts(CPM_VCOM_CFG_PORT, CPM_OM_CFG_COMM); CPM_ConnectPorts(CPM_VCOM_IND_PORT, CPM_OM_IND_COMM); g_stPortCfg.enPortNum = CPM_OM_PORT_TYPE_VCOM; } /* 切换到USB输出 */ else { /* 当前是VCOM输出 */ if ((CPM_VCOM_CFG_PORT == enPhyCfgPort) && (CPM_VCOM_IND_PORT == enPhyIndPort)) { /* 断开连接 */ ulSndMsg = VOS_TRUE; CPM_DisconnectPorts(CPM_VCOM_CFG_PORT, CPM_OM_CFG_COMM); CPM_DisconnectPorts(CPM_VCOM_IND_PORT, CPM_OM_IND_COMM); } /* OM走USB上报 */ CPM_ConnectPorts(CPM_CFG_PORT, CPM_OM_CFG_COMM); CPM_ConnectPorts(CPM_IND_PORT, CPM_OM_IND_COMM); g_stPortCfg.enPortNum = CPM_OM_PORT_TYPE_USB; } VOS_SpinUnlockIntUnlock(&g_stPpmPortSwitchSpinLock, ulLockLevel); if (VOS_TRUE == ulSndMsg) { PPM_DisconnectAllPort(OM_LOGIC_CHANNEL_CNF); } DRV_SOCP_VOTE(SOCP_VOTE_PPM_RCV, SOCP_VOTE_FOR_WAKE); /* 切换到VCOM输出时在LOG延迟写入开启情况下需要重新设置SOCP的超时中断 */ if (CPM_OM_PORT_TYPE_VCOM == g_stPortCfg.enPortNum) { (VOS_VOID)DRV_SOCP_SET_TIMEOUT(SOCP_TIMEOUT_TRF, 0); } /* 为了规避USB输出时开启了延时写入无法连接工具,切换到USB输出时需要重新设置SOCP的超时中断到默认值 */ if (CPM_OM_PORT_TYPE_USB == g_stPortCfg.enPortNum) { (VOS_VOID)DRV_SOCP_SET_TIMEOUT(SOCP_TIMEOUT_TRF, 0x17); } DRV_SOCP_VOTE(SOCP_VOTE_PPM_RCV, SOCP_VOTE_FOR_SLEEP); g_stPpmPortSwitchInfo.ulSwitchSucc++; g_stPpmPortSwitchInfo.ulEndSlice = OM_GetSlice(); if (VOS_TRUE == ulEffect) { if (VOS_OK != NV_Write(en_NV_Item_Om_Port_Type, &g_stPortCfg, sizeof(OM_CHANNLE_PORT_CFG_STRU))) { vos_printf("\r\n PPM_LogPortSwitch: NV_Write fail\n"); } } return VOS_OK; }