VOS_UINT32 diag_DrxDataSampleProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    DIAG_CMD_DRX_DATA_SAMPLE_REG_WR_REQ_STRU *psDataSample = NULL;
    DIAG_CMD_DRX_DATA_SAMPLE_REG_WR_CNF_STRU stCnfDataSample = {0};
    VOS_UINT32 ret = 0;
    VOS_UINT32 ulDataLen = 0;

    psDataSample = (DIAG_CMD_DRX_DATA_SAMPLE_REG_WR_REQ_STRU*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));

    ulDataLen = ((MSP_DIAG_HEAD_STRU*)(DIAG_OFFSET_SOCP_GET_DIAG_HEAD(pstReq)))->ulDataSize - sizeof(MSP_DIAG_DATA_REQ_STRU);

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_BBP_SAMPLE,psDataSample->enBBPDataSampleCtrl,0,0);
    /*lint -save -e830*/
    if(BBP_DATA_SAMPLE_START == psDataSample->enBBPDataSampleCtrl)
    {
    /*lint -restore*/
        ret = diag_SendMsg(MSP_PID_DIAG_AGENT, MSP_PID_BBP_AGENT,ID_MSG_REQ_DRX_DATA_SAMPLE_START, \
        (VOS_UINT8*)psDataSample, ulDataLen);
    }
    else if(BBP_DATA_SAMPLE_STOP == psDataSample->enBBPDataSampleCtrl)
    {
        ret = diag_SendMsg(MSP_PID_DIAG_AGENT, MSP_PID_BBP_AGENT,ID_MSG_REQ_DRX_DATA_SAMPLE_STOP, \
        (VOS_UINT8*)psDataSample, ulDataLen);
    }
    else
    {
        ret = ERR_MSP_FAILURE;
    }

    /*打包回复给FW*/
    stCnfDataSample.ulRet = ret;
    ret = diag_AgentCnfFun((VOS_UINT8*)&stCnfDataSample,ulCmdId,sizeof(DIAG_CMD_DRX_DATA_SAMPLE_REG_WR_CNF_STRU));

    return ret;
}
VOS_UINT32 diag_AgentCnfFun(VOS_UINT8* pstCmdCnf,VOS_UINT32 ulCmdId,VOS_UINT32 ulDataSize )
{
    DIAG_CMD_AGENT_TO_FW_CNF_STRU* pstCnf = NULL;
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT32 ulSendSize =0;

    ulSendSize = sizeof(DIAG_CMD_AGENT_TO_FW_CNF_STRU)+ ulDataSize;

    pstCnf = VOS_MemAlloc(diag_GetAgentPid(),DYNAMIC_MEM_PT,ulSendSize);

    if(NULL != pstCnf)
    {
        pstCnf->ulCmdId = ulCmdId;
        VOS_MemCpy(pstCnf->aucData, pstCmdCnf, ulDataSize);
        /*lint -save -e40*/
#if(VOS_OS_VER == VOS_LINUX)
        ret = diag_SendMsg(diag_GetAgentPid(),MSP_PID_DIAG_FW,ID_MSG_DIAG_CMD_CNF_APP_AGENT_TO_FW,\
                  (VOS_UINT8*)pstCnf,ulSendSize);
#else
        ret = diag_SendMsg(diag_GetAgentPid(),MSP_PID_DIAG_FW,ID_MSG_DIAG_CMD_CNF_AGENT_TO_FW,\
                  (VOS_UINT8*)pstCnf,ulSendSize);
#endif
        /*lint -restore  +e40*/
        VOS_MemFree(diag_GetAgentPid(), pstCnf);
        return ret;
	}
    else
    {
    	 diag_printf("[%s]: malloc fail!\n",__FUNCTION__);
         return ERR_MSP_MALLOC_FAILUE;
    }
}
Ejemplo n.º 3
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;
}
Ejemplo n.º 4
0
/*****************************************************************************
 Function Name   : diag_ConnProc
 Description     : 该函数用于处理ConnProcEntry传进来的HSO连接命令
 Input           : pstReq 待处理数据
 Output          : None
 Return          : VOS_UINT32

 History         :
    1.y00228784      2012-11-22  Draft Enact

*****************************************************************************/
VOS_UINT32 diag_ConnProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    VOS_UINT32 ret      = ERR_MSP_SUCCESS;
    VOS_UINT32 ulCnfRst = ERR_MSP_UNAVAILABLE;
#if (VOS_OS_VER == VOS_LINUX)
    DIAG_CMD_HOST_CONNECT_CNF_STRU stCnf = {0};
    NV_ITEM_PWC_SWITCH_STRU stPwrctrlSwitch = {0};
    VOS_UINT32 ulPwrFlag = 0;
    LPS_SWITCH_PARA_STRU stDrxControlFlag = {0};
    UE_SW_BUILD_VER_INFO_STRU *pstBuildVer =NULL;
    DIAG_CMD_REPLAY_SET_REQ_STRU stReplay= {0};
#endif

    /*重置所有开关状态为未打开*/
    diag_CfgResetAllSwt();

    /*设置连接状态开关值*/
    ulCnfRst = diag_CfgSetGlobalBitValue(&g_ulDiagCfgInfo,DIAG_CFG_CONN_BIT,DIAG_CFG_SWT_OPEN);

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_CONN_CFG, ulCnfRst, 0, 0);

#if (VOS_OS_VER == VOS_LINUX)
    VOS_MemSet(&(stCnf.stBuildVersion), 0, sizeof(DIAG_CMD_UE_BUILD_VER_STRU));

    /*获取版本信息*/
    pstBuildVer = BSP_GetBuildVersion();
    if(pstBuildVer!=NULL)
    {
        pstBuildVer->ulProductNo = BSP_HwGetVerMain();
        stCnf.stBuildVersion.usVVerNo        = pstBuildVer->ulVVerNo;
        stCnf.stBuildVersion.usRVerNo        = pstBuildVer->ulRVerNo;
        stCnf.stBuildVersion.usCVerNo        = pstBuildVer->ulCVerNo;
        stCnf.stBuildVersion.usBVerNo        = pstBuildVer->ulBVerNo;
        stCnf.stBuildVersion.usSpcNo         = pstBuildVer->ulSpcNo;
        stCnf.stBuildVersion.usHardwareVerNo = pstBuildVer->ulCustomVer;
        stCnf.stBuildVersion.ulProductNo     = pstBuildVer->ulProductNo;
    }

    /*获取IMEI号*/
    ret = diag_GetImei(stCnf.szImei);
    if(ret)
    {
    }

    /*获取软件版本号*/
    VOS_MemSet(&stCnf.stUeSoftVersion,0,sizeof(DIAG_CMD_UE_SOFT_VERSION_STRU));

    /*获取数采基地址*/
    stCnf.ulChipBaseAddr = (VOS_UINT32)BSP_OM_GetChipType();
    //stCnf.ulChipBaseAddr = (VOS_UINT32)V7R1_PILOT_CHIP;

    /*路测信息获取*/
    ret = NVM_Read(EN_NV_ID_AGENT_FLAG,&(stCnf.stAgentFlag),sizeof(NV_ITEM_AGENT_FLAG_STRU));
    if(ret)
    {
    }

    /*低功耗开关获取*/
    ret = NVM_Read(EN_NV_ID_PWC_SWITCH,&stPwrctrlSwitch,sizeof(NV_ITEM_PWC_SWITCH_STRU));
    if(ret)
    {
    }
    ulPwrFlag = stPwrctrlSwitch.drxLBbpPd;

    ret = NVM_Read(EN_NV_ID_SWITCH_PARA,&stDrxControlFlag,sizeof(stDrxControlFlag));
    if(ret)
    {
    }
    stCnf.ulDrxControlFlag = stDrxControlFlag.ulDrxControlFlag & ulPwrFlag;
    /*lint -save -e40*/

    ulCnfRst |= diag_SendMsg(diag_GetAgentPid(),PS_PID_MM,ID_MSG_DIAG_CMD_REPLAY_TO_PS,(VOS_UINT8*)&stReplay,\
                             sizeof(DIAG_CMD_REPLAY_SET_REQ_STRU));
    /*lint -restore  +e40*/
    /*获取当前存取模式*/
    stCnf.ulLpdMode = diag_GetLogSendType();

    /*处理结果*/
    stCnf.ulRc = ulCnfRst;

    /*组包给FW回复*/
    ret = diag_AgentCnfFun((VOS_UINT8*)&stCnf,ulCmdId,sizeof(DIAG_CMD_HOST_CONNECT_CNF_STRU));
#else
    /*lint -e18 -e718 -e628 -e830 -e746*/
    diag_EnableSocpChan();
    /*lint +e18 +e718 +e628 +e830 +e746*/
#endif
    return ret;
}
Ejemplo n.º 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;

}