示例#1
0
/*lint -save -e958*/
VOS_UINT32 diag_VcomRead(VOS_UINT8 ucDevIndex, VOS_UINT8 *pData, VOS_UINT32 uslength)
{
    VOS_UINT32 ulRet = ERR_MSP_SUCCESS;
#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
    DIAG_PORT_DATA_BUF_STRU * dataNode;
#endif
    /*lint -restore*/
    if((ucDevIndex != DIAG_APPVCOM_CHAN_CTRL)||(NULL == pData)||(0 == uslength))
    {
        diag_printf("[%s]:INVALID PARAMETER ! ucDevIndex :0x%x,uslength :0x%x\n",__FUNCTION__,ucDevIndex,uslength);
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_APPVCOM_READ_ERR,0, uslength, 1);
        return ERR_MSP_INVALID_PARAMETER;
    }

#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
    /*端口切换,丢弃链表中数据*/
    if(DIAG_PORT_GET_CONN_PORT() != EN_DIAG_VCOM_BEABER_DIAG_CTRL)
    {
        for(;;)
        {
            dataNode = diag_PortGetNodeFromDataBuf();
            if(dataNode == NULL)
            {
                break;
            }
            VOS_MemFree(MSP_PID_DIAG_APP_AGENT, dataNode->dataBuf);
            VOS_MemFree(MSP_PID_DIAG_APP_AGENT, dataNode);
        }
    }
#endif

    /*设置当前物理通道*/
    DIAG_PORT_PORT_SWITCH(EN_DIAG_VCOM_BEABER_DIAG_CTRL);
    diag_TraceDebug(pData, uslength);

#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
    /*SOCP不可用或者缓存非空*/
    if((g_diagSocpIsEnable != TRUE) || (ERR_MSP_SUCCESS != diag_PortDataBufIsEmpty()))
    {
        diag_PortAddToDataBuf(EN_DIAG_VCOM_BEABER_DIAG_CTRL, (VOS_UINT8 *)pData, uslength);
        if(ERR_MSP_SUCCESS != diag_SendMsg(MSP_PID_DIAG_APP_AGENT, MSP_PID_DIAG_APP_AGENT,
                                           ID_MSG_DIAG_CMD_PORT_REQ_TO_APP_AGENT, (VOS_UINT8 *)&ulRet, sizeof(VOS_UINT32)))
        {
            diag_printf("[%s]:send msg to diag app agent fail!!!!!!!!\n",__func__);
        }
        return ERR_MSP_SUCCESS;
    }
#endif

    ulRet = SCM_SendDecoderSrc(SOCP_DECODER_SRC_LOM,pData,uslength);
    if(ulRet != ERR_MSP_SUCCESS)
    {
        diag_printf("[%s]:SCM_SendDecoderSrc fail ! ulRet :0x%x\n",__FUNCTION__,ulRet);
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_APPVCOM_READ_ERR,ulRet, 0, 2);
        return ulRet;
    }
    return ERR_MSP_SUCCESS;
}
示例#2
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;
}
示例#3
0
/*****************************************************************************
函 数 名  : diag_PortRdCB
功能描述  :
输入参数  :
输出参数  :
返 回 值  :
调用函数  :
被调函数  :
修改历史  :
	1.日	期	: 2012年8月27日
	 修改内容  : Creat Function

*****************************************************************************/
VOS_VOID diag_PortRdCB(DIAG_PORT_PHY_BEAR_ENUM enPort)
{
    ACM_WR_ASYNC_INFO   acmInfo;
    UDI_HANDLE ulUdiHandle;
    VOS_UINT32 ret;

    ulUdiHandle = DIAG_PORT_GET_HANDLE(enPort);
    if(ulUdiHandle == UDI_INVALID_HANDLE)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,0,1);
        diag_printf("[%s]:invalid handle!!!!!!!!\n",__func__);
        return;
    }
    ret = udi_ioctl(ulUdiHandle,UDI_ACM_IOCTL_GET_READ_BUFFER_CB,&acmInfo);
    if(ret != ERR_MSP_SUCCESS)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,ret,0,2);
        diag_printf("[%s]:get read buffer callback err 0x%x!!!!!!!!\n",__func__,ret);
        return;
    }

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_START,enPort,acmInfo.u32Size,0);

    /* 数据通道不会处理命令请求 */
    if((EN_DIAG_USB_BEARER_DIAG_APP == enPort) || (EN_DIAG_HSIC_BEARER_DIAG_APP == enPort))
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,enPort,3);
        vos_printf("[%s] enPort %d.\n", __FUNCTION__, enPort);
        udi_ioctl(ulUdiHandle,UDI_ACM_IOCTL_RETUR_BUFFER_CB,&acmInfo);
        return ;
    }

    if(VOS_TRUE == g_diagPort_ctrl.bFlag)
    {
        if(0x7e != acmInfo.pBuffer[0])
        {
            vos_printf("[%s] 1 acmInfo.pBuffer[0] %d.\n", __FUNCTION__, acmInfo.pBuffer[0]);
            udi_ioctl(ulUdiHandle,UDI_ACM_IOCTL_RETUR_BUFFER_CB,&acmInfo);
            DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,0,4);
            return ;
        }
        else
        {
            vos_printf("[%s] 2 acmInfo.pBuffer[0] %d.\n", __FUNCTION__, acmInfo.pBuffer[0]);
            g_diagPort_ctrl.bFlag = VOS_FALSE;
        }
    }

    /* V9R1版本,默认VCOM口上报数据,如果从USB口接收到连接请求,则切换到USB口上报数据 */
    diag_LogPortSwitch(DIAG_LOG_PORT_USB);

    diag_TraceDebug(acmInfo.pBuffer, acmInfo.u32Size);

    ret = SCM_SendDecoderSrc(DIAG_PORT_GET_DECODE_SRC(enPort),acmInfo.pBuffer,acmInfo.u32Size);
    if(ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,ret,0,5);
        diag_printf("[%s]:SCM_SendDecoderSrc err 0x%x!!!!!!!!\n",__func__,ret);
    }

    udi_ioctl(ulUdiHandle,UDI_ACM_IOCTL_RETUR_BUFFER_CB,&acmInfo);
    return;

}
示例#4
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;
}
示例#5
0
/*****************************************************************************
函 数 名  : diag_PortRdCB
功能描述  :
输入参数  :
输出参数  :
返 回 值  :
调用函数  :
被调函数  :
修改历史  :
	1.日	期	: 2012年8月27日
	 作    者  : heliping
	 修改内容  : Creat Function

*****************************************************************************/
VOS_VOID diag_PortRdCB(DIAG_PORT_PHY_BEAR_ENUM enPort)
{
    ACM_WR_ASYNC_INFO   acmInfo = {};
    UDI_HANDLE ulUdiHandle;
    VOS_UINT32 ret;
    VOS_UINT32 ulDataLen;
    VOS_CHAR*  pdata;
    static VOS_UINT32 ulTotalLen = 0;
#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
    DIAG_PORT_DATA_BUF_STRU * dataNode;
#endif

    ulUdiHandle = DIAG_PORT_GET_HANDLE(enPort);
    if(ulUdiHandle == UDI_INVALID_HANDLE)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,0,1);
        diag_printf("[%s]:invalid handle!!!!!!!!\n",__func__);
        return;
    }
    ret = (VOS_UINT32)udi_ioctl(ulUdiHandle,UDI_ACM_IOCTL_GET_READ_BUFFER_CB,&acmInfo);
    if(ret != ERR_MSP_SUCCESS)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,0,2);
        diag_printf("[%s]:get read buffer callback err 0x%x!!!!!!!!\n",__func__,ret);
        return;
    }

#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
    /*端口切换,丢弃链表中数据*/
    if(DIAG_PORT_GET_CONN_PORT() != enPort)
    {
        for(;;)
        {
            dataNode = diag_PortGetNodeFromDataBuf();
            if(dataNode == NULL)
            {
                break;
            }
            VOS_MemFree(MSP_PID_DIAG_APP_AGENT, dataNode->dataBuf);
            VOS_MemFree(MSP_PID_DIAG_APP_AGENT, dataNode);
        }
    }
#endif
    ulDataLen = acmInfo.u32Size;
#ifdef FEATURE_UPGRADE_TL
    pdata = acmInfo.pBuffer;
#else
    pdata = acmInfo.pVirAddr;
#endif

    ulTotalLen += ulDataLen;

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_START,ulTotalLen,ulDataLen,0);

    /*设置当前物理通道及通道连接状态*/
    DIAG_PORT_PORT_SWITCH(enPort);

    DIAG_PORT_CHAN_STATE_SWITCH(enPort,ACM_EVT_DEV_READY);
	DIAG_PORT_CHAN_STATE_SWITCH(enPort+1,ACM_EVT_DEV_READY);
    diag_PrintToFile(UsbCtrlRdCB_LogPath, pdata, ulDataLen);
    diag_TraceDebug(pdata, ulDataLen);

#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
    /*SOCP不可用或者缓存非空*/
    if((g_diagSocpIsEnable != TRUE) || (ERR_MSP_SUCCESS != diag_PortDataBufIsEmpty()))
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,0,3);
        diag_PortAddToDataBuf(enPort, (VOS_UINT8 *)(pdata),ulDataLen);
        ret = (VOS_UINT32)udi_ioctl(ulUdiHandle,UDI_ACM_IOCTL_RETUR_BUFFER_CB,&acmInfo);
        if(ret)
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,0,4);
            diag_printf("[%s]:return buffer to acm err 0x%x!!!!!!!!\n",__func__,ret);
        }
        if(ERR_MSP_SUCCESS != diag_SendMsg(MSP_PID_DIAG_APP_AGENT, MSP_PID_DIAG_APP_AGENT,
            ID_MSG_DIAG_CMD_PORT_REQ_TO_APP_AGENT, (VOS_UINT8 *)&ret, sizeof(VOS_UINT32)))
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,0,5);
            diag_printf("[%s]:send msg to diag app agent fail!!!!!!!!\n",__func__);
        }
        return;
    }
#endif

    ret = SCM_SendDecoderSrc(DIAG_PORT_GET_DECODE_SRC(enPort),(VOS_UINT8 *)(pdata),ulDataLen);
    if(ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,0,6);
        diag_printf("[%s]:SCM_SendDecoderSrc err 0x%x!!!!!!!!\n",__func__,ret);
    }

    ret = (VOS_UINT32)udi_ioctl(ulUdiHandle,UDI_ACM_IOCTL_RETUR_BUFFER_CB,&acmInfo);
    if(ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_UDI_READ_END,0,0,7);
        diag_printf("[%s]:SCM_SendDecoderSrc err 0x%x!!!!!!!!\n",__func__,ret);
    }

    return;

}