/*****************************************************************************
 函 数 名  : 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;
}
Beispiel #2
0
VOS_UINT32 diag_PhyWriteAsync(DIAG_PORT_PHY_BEAR_ENUM enPort,VOS_UINT8 *pucDataBuf,VOS_UINT32 ulLen)
{
    VOS_INT32 ret = ERR_MSP_SUCCESS;
    ACM_WR_ASYNC_INFO  stVcom  = {0};
    VOS_INT32 slHandle = 0;

    if(DIAG_PORT_GET_STATE(enPort) ==ACM_EVT_DEV_SUSPEND)
    {
    	SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),ulLen);
    	return ERR_MSP_SUCCESS;
    }

    slHandle = DIAG_PORT_GET_HANDLE(enPort);

    if(slHandle == UDI_INVALID_HANDLE)
    {
         SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),ulLen);
        return ERR_MSP_FAILURE;
    }

#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
    /* 工具已下发断开连接命令,丢数据 */
    if(!(g_ulDiagCfgInfo & (1 << 1)))
    {
        SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),ulLen);
        return ERR_MSP_SUCCESS;
    }
#endif

#ifdef FEATURE_UPGRADE_TL
    stVcom.pBuffer = (VOS_CHAR*)pucDataBuf;
#else
    stVcom.pVirAddr = (VOS_CHAR*)pucDataBuf;
    stVcom.pPhyAddr = (VOS_CHAR*)SCM_CoderDestMemVirtToPhy(DIAG_PORT_GET_CODE_DES(enPort), pucDataBuf);
#endif
    stVcom.u32Size = ulLen;

    DIAG_DEBUG_SDM_FUN((DIAG_DEBUG_MSG_ID_ENUM)(EN_DIAG_DEBUG_TCP_WRT+(VOS_UINT32)enPort), ulLen, 0, 0);

    ret = udi_ioctl((int)slHandle, ACM_IOCTL_WRITE_ASYNC, &stVcom);

    if(ret == ERR_MSP_SUCCESS)
    {
        DIAG_DEBUG_SDM_FUN((DIAG_DEBUG_MSG_ID_ENUM)(EN_DIAG_DEBUG_TCP_WRT_SUCC+(VOS_UINT32)enPort), ulLen, 0, 0);
        return ERR_MSP_SUCCESS;
    }

    SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),ulLen);
    return  (VOS_UINT32)ret;/* [false alarm]:屏蔽Fortify */
}
Beispiel #3
0
/*****************************************************************************
函 数 名  : diag_PortWrtCB
功能描述  :
输入参数  :
输出参数  :
返 回 值  :
调用函数  :
被调函数  :
修改历史  :
	1.日	期	: 2012年8月27日
	 修改内容  : Creat Function

*****************************************************************************/
VOS_VOID diag_PortWrtCB (DIAG_PORT_PHY_BEAR_ENUM enPort,VOS_CHAR* pDoneBuff, VOS_INT s32DoneSize)
{

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_WRT_CB+enPort,(VOS_UINT32)pDoneBuff , (VOS_UINT32)s32DoneSize, 0);

    if(s32DoneSize < 0)
    {

        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_WRT_CB_ERR+enPort,(VOS_UINT32)pDoneBuff , (VOS_UINT32)s32DoneSize, 0);

         //释放编码目标通道的buf
        SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),0);
        return ;
    }


    //释放编码目标通道的buf
    SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),(VOS_UINT32)s32DoneSize);

     return;
}
Beispiel #4
0
/*lint -save -e958*/
VOS_UINT32 diag_VcomWriteSync(DIAG_PORT_PHY_BEAR_ENUM enPort,
                              APP_VCOM_DEV_INDEX_UINT8 enDevIndex,
                              VOS_UINT8 *pucDataBuf,VOS_UINT32 ulLen)
{
    VOS_UINT32 ulRet = ERR_MSP_SUCCESS;

    diag_TraceDebug(pucDataBuf, ulLen);

    if(DIAG_PORT_GET_STATE(enPort) == ACM_EVT_DEV_READY)
    {
        ulRet = APP_VCOM_Send(enDevIndex,pucDataBuf,ulLen);
        SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),ulLen);
    }
    else
    {
        diag_printf("[%s],enport :%d,status :%d\n",__FUNCTION__,enPort,DIAG_PORT_GET_STATE(enPort));
        SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),ulLen);
        return ERR_MSP_FAILURE;
    }
    return ulRet;
}
VOS_VOID PPM_PortWriteAsyCB(OM_PROT_HANDLE_ENUM_UINT32 enHandle, VOS_UINT8* pucData, VOS_INT lLen)
{
    VOS_UINT32      ulRlsLen;

    if(lLen < 0)
    {
        ulRlsLen = 0;
    }
    else
    {
        ulRlsLen = (VOS_UINT32)lLen;
    }

    /* 伪同步接口,释放信号量 */
    if (OM_USB_IND_PORT_HANDLE == enHandle)
    {
        g_stUsbIndPseudoSync.ulLen          = ulRlsLen;
        g_stUsbIndPseudoSync.pucAsyncCBData = pucData;

        /*VOS_SmV(g_stUsbIndPseudoSync.ulPseudoSyncSemId);*/
        SCM_RlsDestBuf(SOCP_CODER_DST_OM_IND, ulRlsLen);
    }
    else if (OM_USB_CFG_PORT_HANDLE == enHandle)
    {
        g_stUsbCfgPseudoSync.ulLen          = ulRlsLen;
        g_stUsbCfgPseudoSync.pucAsyncCBData = pucData;

        /*VOS_SmV(g_stUsbCfgPseudoSync.ulPseudoSyncSemId);*/
        SCM_RlsDestBuf(SOCP_CODER_DST_OM_CNF, ulRlsLen);
    }
    else
    {
        ;
    }

    g_stAcpuDebugInfo.astPortInfo[enHandle].ulUSBWriteCBNum++;

    return;
}
Beispiel #6
0
VOS_UINT32 diag_PhyWriteAsync(DIAG_PORT_PHY_BEAR_ENUM enPort,VOS_UINT8 *pucDataBuf,VOS_UINT32 ulLen)
{
    VOS_INT32 ret = ERR_MSP_SUCCESS;
    ACM_WR_ASYNC_INFO  stVcom  = {0};
    VOS_INT32 slHandle = 0;

    if(DIAG_PORT_GET_STATE(enPort) ==ACM_EVT_DEV_SUSPEND)
    {
    	SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),ulLen);
    	return ERR_MSP_SUCCESS;
    }

    slHandle = DIAG_PORT_GET_HANDLE(enPort);

    if(slHandle == UDI_INVALID_HANDLE)
    {
         SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),ulLen);
        return ERR_MSP_FAILURE;
    }

    stVcom.pBuffer = (VOS_CHAR*)pucDataBuf;
    stVcom.u32Size = ulLen;

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_WRT+enPort, ulLen, 0, 0);

    ret = udi_ioctl((int)slHandle, ACM_IOCTL_WRITE_ASYNC, &stVcom);

    if(ret == ERR_MSP_SUCCESS)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_WRT_SUCC+enPort, ulLen, 0, 0);
        return ERR_MSP_SUCCESS;
    }

    SCM_RlsDestBuf(DIAG_PORT_GET_CODE_DES(enPort),ulLen);
    return  ret;
}
Beispiel #7
0
VOS_UINT32 diag_WriteData( VOS_UINT8* aucDataBuf, VOS_UINT32 enChanID,VOS_UINT32 ulLen)
{
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT32 usSentLen   = 0;

    diag_TraceDebug(aucDataBuf, ulLen);

	if (DIAG_PORT_GET_CONN_PORT() == EN_DIAG_SOCKET_BEARER_TCP_20248)
    {
		ret = diag_TcpSendData(EN_TCP_PORT_DIAG,aucDataBuf, ulLen,&usSentLen);
		SCM_RlsDestBuf(enChanID,ulLen);
        return ret;
    }
    else if (DIAG_PORT_GET_CONN_PORT() == EN_DIAG_USB_BEARER_DIAG_CTRL)
    {
        //回复和主动上报分开通道发送
        if(enChanID == SOCP_CODER_DST_LOM_CNF)
        {
        	return diag_PhyWriteAsync(EN_DIAG_USB_BEARER_DIAG_CTRL,(VOS_UINT8 *)aucDataBuf,(VOS_UINT32)ulLen);
        }
        else if(enChanID == SOCP_CODER_DST_LOM_IND)
        {
            return diag_PhyWriteAsync(EN_DIAG_USB_BEARER_DIAG_APP,(VOS_UINT8 *)aucDataBuf,(VOS_UINT32)ulLen);
        }
    }
	else if (DIAG_PORT_GET_CONN_PORT() == EN_DIAG_HSIC_BEARER_DIAG_CTRL)
    {
        //回复和主动上报分开通道发送
        if(enChanID == SOCP_CODER_DST_LOM_CNF)
        {
        	return diag_PhyWriteAsync(EN_DIAG_HSIC_BEARER_DIAG_CTRL,(VOS_UINT8 *)aucDataBuf,(VOS_UINT32)ulLen);
        }
        else if(enChanID == SOCP_CODER_DST_LOM_IND)
        {
        	return diag_PhyWriteAsync(EN_DIAG_HSIC_BEARER_DIAG_APP,(VOS_UINT8 *)aucDataBuf,(VOS_UINT32)ulLen);
        }
    }
    /*APP VCOM*/
	else if (DIAG_PORT_GET_CONN_PORT() == EN_DIAG_VCOM_BEABER_DIAG_CTRL)
    {
        //回复和主动上报分开通道发送
        if(enChanID == SOCP_CODER_DST_LOM_CNF)
        {
        	return diag_VcomWriteSync(EN_DIAG_VCOM_BEABER_DIAG_CTRL,DIAG_APPVCOM_CHAN_CTRL,\
                (VOS_UINT8 *)aucDataBuf,(VOS_UINT32)ulLen);

        }
        else if(enChanID == SOCP_CODER_DST_LOM_IND)
        {
        	return diag_VcomWriteSync(EN_DIAG_VCOM_BEABER_DIAG_APP,DIAG_APPVCOM_CHAN_APP,\
                (VOS_UINT8 *)aucDataBuf,(VOS_UINT32)ulLen);
        }
    }
    else if(DIAG_PORT_GET_CONN_PORT() == EN_DIAG_SD_BEARER_DIAG)
    {
        if(enChanID == SOCP_CODER_DST_LOM_CNF)
        {
        	return diag_PhyWriteAsync(EN_DIAG_USB_BEARER_DIAG_CTRL,(VOS_UINT8 *)aucDataBuf,(VOS_UINT32)ulLen);
        }
        drx_msp_fid_vote_lock(DRX_DIAG_LOG_SAVE_VOTE);
        diag_StorDataToSD(aucDataBuf, ulLen);

        /* 该处需要直接read data done*/
        SCM_RlsDestBuf(enChanID,ulLen);
        drx_msp_fid_vote_unlock(DRX_DIAG_LOG_SAVE_VOTE);
        return ERR_MSP_SUCCESS;
    }
    else
    {
        g_diagPort_ctrl.ulWritePort = DIAG_PORT_GET_CONN_PORT();

        /*异常情况需要释放*/
        SCM_RlsDestBuf(enChanID,ulLen);
        return ERR_MSP_FAILURE;
    }

    return ERR_MSP_SUCCESS;
}
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;
}