VOS_INT GU_OamVComReadData(VOS_UINT8 ucDevIndex, VOS_UINT8 *pData, VOS_UINT32 uslength) { if(ucDevIndex != APP_VCOM_DEV_INDEX_LOG) { vos_printf("\r\n GU_OamVComReadData:PhyPort port is error: %d\n", ucDevIndex); return VOS_ERR; } #if (VOS_LINUX == VOS_OS_VER) down(&g_stVCOMRxBuffSem); #endif g_stVComDebugInfo.ulVCOMRcvNum++; g_stVComDebugInfo.ulVCOMRcvLen += uslength; if ((VOS_NULL_PTR == pData) || (0 == uslength)) { #if (VOS_LINUX == VOS_OS_VER) up(&g_stVCOMRxBuffSem); #endif vos_printf("\r\n GU_OamVComReadData:Send data is NULL\n"); return VOS_ERR; } if (CPM_PORT_BUTT == CPM_QueryPhyPort(CPM_OM_COMM)) { CPM_ConnectPorts(CPM_VCOM_PORT, CPM_OM_COMM); } /*lint -e40*/ OM_ACPU_DEBUG_TRACE((VOS_UINT8*)pData, uslength, OM_ACPU_USB_CB); /*lint +e40*/ if(VOS_OK != CPM_ComRcv(CPM_VCOM_PORT, pData, uslength)) { g_stVComDebugInfo.ulVCOMRcvErrNum++; g_stVComDebugInfo.ulVCOMRcvErrLen += uslength; vos_printf("\r\n Info: GU_OamVComReadData:Call CPM_ComRcv is fail, PhyPort is CPM_VCOM_PORT \n"); } #if (VOS_LINUX == VOS_OS_VER) up(&g_stVCOMRxBuffSem); #endif return VOS_OK; }
/***************************************************************************** 函 数 名 : GU_OamUSBReadData 功能描述 : 用于ACPU上面底软把数据通过ICC发送给OM模块 输入参数 : enPhyPort: 物理端口 UdiHandle:设备句柄 输出参数 : 无 返 回 值 : VOS_ERR/VOS_OK 调用函数 : 被调函数 : 修改历史 : 1.日 期 : 2012年2月2日 作 者 : zhuli 修改内容 : Creat Function *****************************************************************************/ VOS_INT32 GU_OamReadPortData(CPM_PHY_PORT_ENUM_UINT32 enPhyPort, UDI_HANDLE UdiHandle) { ACM_WR_ASYNC_INFO stInfo; CPM_PHY_PORT_ENUM_UINT32 enPcvoiceRet; CPM_PHY_PORT_ENUM_UINT32 enDiagRet; if (VOS_ERROR == UdiHandle) { LogPrint("\r\nGU_OamReadPortData: Input HANDLE is err. \n"); return VOS_ERR; } VOS_MemSet(&stInfo, 0, sizeof(stInfo)); /* 获取USB的IO CTRL口的读缓存 */ if (VOS_OK != DRV_UDI_IOCTL(UdiHandle, UDI_ACM_IOCTL_GET_READ_BUFFER_CB, &stInfo)) { LogPrint("\r\nGU_OamReadPortData:Call DRV_UDI_IOCTL is Failed\n"); return VOS_ERR; } /*lint -e40*/ OM_ACPU_DEBUG_TRACE((VOS_UINT8*)stInfo.pBuffer, stInfo.u32Size, OM_ACPU_USB_CB); /*lint +e40*/ /*判断当前是否承载的是Pcvoice*/ enPcvoiceRet = CPM_QueryPhyPort(CPM_PCVOICE_COMM); enDiagRet = CPM_QueryPhyPort(CPM_DIAG_COMM); if ((enPhyPort != enPcvoiceRet)&&(enPhyPort != enDiagRet)) { CPM_PnpAppPortCB(enPhyPort, VOS_TRUE); /*需要重新链接物理和逻辑端口关系*/ } if(VOS_OK != CPM_ComRcv(enPhyPort, (VOS_UINT8*)stInfo.pBuffer, stInfo.u32Size)) { LogPrint1("\r\n Info: GU_OamReadPortData:Call CPM_ComRcv is NULL, PhyPort is %d\n", (VOS_INT)enPhyPort); } if(VOS_OK != DRV_UDI_IOCTL(UdiHandle, UDI_ACM_IOCTL_RETUR_BUFFER_CB, &stInfo)) { LogPrint("\r\nGU_OamReadPortData:Call DRV_UDI_IOCTL UDI_ACM_IOCTL_RETUR_BUFFER_CB is Failed\n"); } return VOS_OK; }
VOS_INT32 CBTPPM_OamUsbCbtReadDataCB(VOS_VOID) { ACM_WR_ASYNC_INFO stInfo; CBTCPM_RCV_FUNC pFunc; if (VOS_ERROR == g_ulCbtPortUDIHandle) { LogPrint("\r\n CBTPPM_OamUsbCbtReadDataCB: Input HANDLE is err. \n"); return VOS_ERR; } VOS_MemSet(&stInfo, 0, sizeof(stInfo)); /* 获取USB的IO CTRL口的读缓存 */ if (VOS_OK != DRV_UDI_IOCTL(g_ulCbtPortUDIHandle, UDI_ACM_IOCTL_GET_READ_BUFFER_CB, &stInfo)) { LogPrint("\r\n CBTPPM_OamUsbCbtReadDataCB:Call DRV_UDI_IOCTL is Failed\n"); return VOS_ERR; } /*lint -e40*/ OM_ACPU_DEBUG_TRACE((VOS_UINT8*)stInfo.pVirAddr, stInfo.u32Size, OM_ACPU_USB_CB); /*lint +e40*/ /* 数据接收函数 */ pFunc = CBTCPM_GetRcvFunc(); if (VOS_NULL_PTR != pFunc) { if (VOS_OK != pFunc((VOS_UINT8 *)stInfo.pVirAddr, stInfo.u32Size)) { /* 增加可维可测计数 */ } } if(VOS_OK != DRV_UDI_IOCTL(g_ulCbtPortUDIHandle, UDI_ACM_IOCTL_RETUR_BUFFER_CB, &stInfo)) { LogPrint("\r\n CBTPPM_OamUsbCbtReadDataCB:Call DRV_UDI_IOCTL UDI_ACM_IOCTL_RETUR_BUFFER_CB is Failed\n"); return VOS_ERR; } return VOS_OK; }
VOS_INT CBTPPM_OamVComCbtReadData(VOS_UINT8 ucDevIndex, VOS_UINT8 *pData, VOS_UINT32 ullength) { CBTCPM_RCV_FUNC pFunc; if (ucDevIndex != APP_VCOM_DEV_INDEX_LOG) { vos_printf("\r\n CBTPPM_OamVComCbtReadData:PhyPort port is error: %d\n", ucDevIndex); return VOS_ERR; } g_stVComDebugInfo[OM_LOGIC_CHANNEL_CBT ].ulVCOMRcvNum++; g_stVComDebugInfo[OM_LOGIC_CHANNEL_CBT ].ulVCOMRcvLen += ullength; if ((VOS_NULL_PTR == pData) || (0 == ullength)) { vos_printf("\r\n CBTPPM_OamVComCbtReadData:Send data is NULL\n"); return VOS_ERR; } /*lint -e40*/ OM_ACPU_DEBUG_TRACE((VOS_UINT8*)pData, ullength, OM_ACPU_VCOM_CB); /*lint +e40*/ pFunc = CBTCPM_GetRcvFunc(); /* 数据接收函数 */ if (VOS_NULL_PTR == pFunc) { return VOS_ERR; } if (VOS_OK != pFunc((VOS_UINT8*)pData, ullength)) { g_stVComDebugInfo[OM_LOGIC_CHANNEL_CBT ].ulVCOMRcvErrNum++; g_stVComDebugInfo[OM_LOGIC_CHANNEL_CBT ].ulVCOMRcvErrLen += ullength; vos_printf("\r\n Info: CBTPPM_OamVComCbtReadData:Call CBT Data Rcv Func fail\n"); return VOS_ERR; } return VOS_OK; }
VOS_VOID GU_OamSocpSendDataToUDI(SOCP_CODER_DST_ENUM_U32 enChanID, VOS_UINT8 *pucData, VOS_UINT8 *pucPHYData, VOS_UINT32 ulDataLen) { VOS_UINT32 ulResult; VOS_UINT32 ulRet = VOS_ERR; CPM_PHY_PORT_ENUM_UINT32 enPhyport; VOS_UINT32 ulSendDataLen; VOS_BOOL bReadDoneFlag = VOS_FALSE; VOS_BOOL bUsbSendSucFlag = VOS_FALSE; /*参数检查*/ SOCP_SEND_DATA_PARA_CHECK(enChanID, ulDataLen, pucData); GU_OamGetSendDataLen(ulDataLen, &ulSendDataLen, &enPhyport); /*lint -e40*/ OM_ACPU_DEBUG_TRACE(pucData, ulSendDataLen, OM_ACPU_SEND_USB); /*lint +e40*/ ulResult = CPM_ComSend(CPM_OM_COMM, pucData, ulSendDataLen); OMRL_AcpuHdlcData(pucData, ulSendDataLen); if(CPM_SEND_ERR == ulResult) /*当前通道已经发送失败,调用SOCP通道无数据搬运*/ { g_stAcpuDebugInfo.ulUSBSendErrNum++; g_stAcpuDebugInfo.ulUSBSendErrLen += ulSendDataLen; bReadDoneFlag = VOS_TRUE; } else if(CPM_SEND_FUNC_NULL == ulResult) /*当前通道异常,扔掉所有数据*/ { bReadDoneFlag = VOS_TRUE; g_stAcpuDebugInfo.ulOmDiscardNum++; g_stAcpuDebugInfo.ulOmDiscardLen += ulDataLen; } else if(CPM_SEND_OK == ulResult) { if ((CPM_APP_PORT != enPhyport)&&(CPM_CTRL_PORT != enPhyport)&&(CPM_HSIC_PORT != enPhyport)) /*对于当前是同步步发送的端口需要马上释放SOCP*/ { bReadDoneFlag = VOS_TRUE; } else { ulRet = VOS_OK; } bUsbSendSucFlag = VOS_TRUE; } else { LogPrint1("GU_OamUSBWriteDataCB: CPM_ComSend return Error %d", (VOS_INT)ulResult); } if (VOS_TRUE == bReadDoneFlag) { ulRet = SCM_RlsDestBuf(SOCP_CODER_DST_GU_OM, ulSendDataLen); if(VOS_OK != ulRet) { g_stAcpuDebugInfo.ulSocpReadDoneErrNum++; g_stAcpuDebugInfo.ulSocpReadDoneErrLen += ulSendDataLen; LogPrint1("GU_OamSocpSendDataToUDI: SCM_RlsDestBuf return Error %d", (VOS_INT)ulRet); } } if ((VOS_OK == ulRet) && (VOS_TRUE == bUsbSendSucFlag)) { g_stAcpuDebugInfo.ulUSBSendNum++; g_stAcpuDebugInfo.ulUSBSendLen += ulSendDataLen; if(g_stAcpuDebugInfo.ulUSBSendLen > OM_DATA_MAX_LENGTH) { g_stAcpuDebugInfo.ulUSBSendRealNum++; g_stAcpuDebugInfo.ulUSBSendLen -= OM_DATA_MAX_LENGTH; } } return; }