Ejemplo n.º 1
0
        /*异常情况需要释放*/
        SCM_RlsDestBuf(enChanID,ulLen);
        return ERR_MSP_FAILURE;
    }

    return ERR_MSP_SUCCESS;
}


//*****************************************************************************/
// 功能描述  :处理HDLC编码目标通道数据,初始化时注册到CDM模块
// 参数说明  : ulChanID:目标通道ID
//                         pBuf: 数据指针
//                        ulDataSize: 数据长度
//
// 返回值    :  ERR_MSP_SUCCESS   操作成功
//                       ERR_MSP_INVALID_PARAMETER    参数出错
//*****************************************************************************/
VOS_UINT32 diag_SocpCodeDesDataProc(SOCP_CODER_DST_ENUM_U32 enChanID,VOS_UINT8 *pucData, VOS_UINT8 *pucPHYData,VOS_UINT32 ulSize)
{
    VOS_UINT32 Ret;
    VOS_UINT32 send_len = 0;

    /*SCM 代码中没有限制发送最大长度*/
    if(DIAG_SOCP_SEND_SIZE_MAX < ulSize)
    {
        send_len = DIAG_SOCP_SEND_SIZE_MAX;
    }
    else
    {
        send_len = ulSize;
    }
    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_CODE_PACKET_RCVE, enChanID, (VOS_UINT32)send_len, 0);

    if(pucData == NULL)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_CODE_PACKET_RCVE_ERROR, enChanID, (VOS_UINT32)send_len, 1);
        return ERR_MSP_INVALID_PARAMETER;
    }

    Ret = diag_WriteData(pucData,enChanID,send_len);
    if(ERR_MSP_SUCCESS != Ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_CODE_PACKET_RCVE_ERROR, enChanID, (VOS_UINT32)send_len, 3);
    }
    return Ret;

}
Ejemplo n.º 2
0
/*****************************************************************************
函 数 名  : diag_PortClose
功能描述  :
输入参数  :
输出参数  :
返 回 值  :
调用函数  :
被调函数  :
修改历史  :
	1.日	期	: 2012年8月27日
	 修改内容  : Creat Function

*****************************************************************************/
VOS_UINT32 diag_PortClose(DIAG_PORT_PHY_BEAR_ENUM enPort)
{
    VOS_INT32 slVcomRet = 0;
    VOS_INT32 slHandle = UDI_INVALID_HANDLE;

    slHandle = DIAG_PORT_GET_HANDLE(enPort);

    if(slHandle ==UDI_INVALID_HANDLE)
    {
        return ERR_MSP_SUCCESS;
    }

    DIAG_DEBUG_SDM_FUN((DIAG_DEBUG_MSG_ID_ENUM)(EN_DIAG_DEBUG_TCP_CLOSE+(VOS_UINT32)enPort), 0, 0, 0);

    g_diagPort_ctrl.bFlag = VOS_FALSE;
    slVcomRet = udi_close(slHandle);
    if (slVcomRet == ERR_MSP_SUCCESS)
    {
		DIAG_PORT_HANDLE_SWITCH(enPort,UDI_INVALID_HANDLE);
		DIAG_PORT_CHAN_STATE_SWITCH(enPort,ACM_EVT_DEV_SUSPEND);
        return (VOS_UINT32)slVcomRet;
    }

    DIAG_DEBUG_SDM_FUN((DIAG_DEBUG_MSG_ID_ENUM)(EN_DIAG_DEBUG_TCP_CLOSE_ERR+(VOS_UINT32)enPort), (VOS_UINT32)slVcomRet, 0, 0);

    return ERR_MSP_FAILURE;

}
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
VOS_UINT32 diag_AgentMsgProcInit(enum VOS_INIT_PHASE_DEFINE ip)
{
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
    DIAG_MSG_SOCP_VOTE_REQ_STRU * voteReq;
#endif

    if (ip == VOS_IP_RESTART)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT,ret,0,0);

        /*DIAG SOCP BUF初始化*/
        ret = diag_BufCtrlGlobalInit();
        if(ret != ERR_MSP_SUCCESS)
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT_ERROR,ret,0,0);
            return ret;
        }

        /*设置DIAG初始化bit*/
        ret = diag_CfgSetGlobalBitValue(&g_ulDiagCfgInfo,DIAG_CFG_INIT_BIT,DIAG_CFG_SWT_OPEN);
        if(ret != ERR_MSP_SUCCESS)
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT_ERROR,ret,0,1);
            return ret;
        }

#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
#if 0
        if(ERR_MSP_SUCCESS != VOS_SmBCreate(NULL, 0, VOS_SEMA4_FIFO, &g_diagAgentSem))
        {
            diag_printf("[%s]:agent sem init err!\n",__FUNCTION__);
            return ERR_MSP_FAILURE;
        }
#endif
        voteReq = (DIAG_MSG_SOCP_VOTE_REQ_STRU *)VOS_AllocMsg(MSP_PID_DIAG_AGENT,(sizeof(DIAG_MSG_SOCP_VOTE_REQ_STRU) - 20));
        if(voteReq == NULL)
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT_ERROR,ERR_MSP_FAILURE,2,2);
            return ERR_MSP_FAILURE;
        }

        voteReq->ulReceiverPid = MSP_PID_DIAG_APP_AGENT;
        voteReq->ulSenderPid   = MSP_PID_DIAG_AGENT;
        voteReq->ulLength      = sizeof(DIAG_MSG_SOCP_VOTE_REQ_STRU) - 20;
        voteReq->ulVoteId      = SOCP_VOTE_DIAG_COMM;
        voteReq->ulVoteType    = SOCP_VOTE_FOR_SLEEP;
        ret = VOS_SendMsg(MSP_PID_DIAG_AGENT, voteReq);
        if(ret != ERR_MSP_SUCCESS)
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_INIT_ERROR,ret,3,2);
            return ret;
        }
#endif
    }
    return ret;
}
/*****************************************************************************
 Function Name   : diag_GetCoderSrcBuf
 Description     : 申请编码源通道Buf的接口
 Input           :VOS_UINT32 ulLen
                SOCP_CODER_SRC_ENUM_U32 ulChanID
 Output          : None
 Return          : VOS_UINT32

 History         :
    1.w00182550      2012-11-19  Draft Enact

*****************************************************************************/
VOS_UINT8* diag_GetCoderSrcBuf(VOS_UINT32 ulLen,SOCP_CODER_SRC_ENUM_U32 ulChanID)
{
    VOS_UINT8* aucBuf = NULL;
    VOS_UINT32 ulIndex = 0;
    VOS_UINT32 ulRet = 0;

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_GET_SRC_BUF_START, ulChanID, (VOS_UINT32)ulLen, 0);
    ulLen = ALIGN_DDR_WITH_4BYTE(ulLen);
#if (VOS_LINUX== VOS_OS_VER)
#if(FEATURE_SOCP_ON_DEMAND == FEATURE_ON)
    if(g_diagSocpIsEnable == FALSE)
    {
        vos_printf("%s socp is disable\n", __FUNCTION__);
        return NULL;
    }
#endif
#endif

    /*clean 使用过的RD和MEM buffer*/
    ulRet = diag_ReleaseLogBuf(ulChanID);
    if(ERR_MSP_SUCCESS != ulRet)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_GET_SRC_BUF_START_ERROR, ulChanID, (VOS_UINT32)ulRet, 0);
        diag_printf("Function:%s ulRet = %d Error\n", __FUNCTION__, ulRet);
        return NULL;
    }

    if( SCM_CODER_SRC_MAX_LEN  <= ulLen)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_GET_SRC_BUF_START_ERROR, ulChanID, (VOS_UINT32)ulLen, 2);
        return NULL;
    }

    /*根据通道类型获取要申请哪个BUF数据*/
    ulIndex = diag_GetBufIndex(ulChanID);

    /*获取编码源通道Buf*/
    aucBuf = diag_AllocLogMem(&g_stDiagBufCtrl[ulIndex], (VOS_INT32)ulLen);

    if(aucBuf == NULL)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_GET_SRC_BUF_START_ERROR, ulChanID, (VOS_UINT32)ulLen, 1);
        g_stDiagToHsoErrRecord.usAllocMemErr++;
        return NULL;
    }
    else
    {
        return aucBuf;
    }

}
VOS_UINT32 diag_DspTransProcEntry(VOS_UINT8* pstReq ,VOS_UINT32 ulCmdId)
{
    VOS_UINT32 ulLen = 0;
    DIAG_CMD_DSP_CNF_STRU stRttCnf = {0};
	VOS_UINT32 ret = 0;
	MSP_DIAG_HEAD_STRU *pstDspMsg = NULL;
	VOS_UINT8* pData = NULL;
    VOS_UINT32 ulServeType = EN_MAILBOX_SERVICE_LTE_OM;

    if(MSP_STRU_ID_28_31_GROUP_TDS_DSP == (MSP_STRU_ID_28_31_CMD_GROUP(ulCmdId)))
    {
		DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TDS_DSP_CNF,ulCmdId,0,0);
		ulServeType = EN_MAILBOX_SERVICE_TDS_OM;
    }
	else
	{
		DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_LTE_DSP_CNF,ulCmdId,0,0);
	}

    /* DSP消息的ID和size */
    pstDspMsg = (MSP_DIAG_HEAD_STRU*)(pstReq+sizeof(MSP_SOCP_HEAD_STRU));

    ulLen = sizeof(VOS_UINT32) + (pstDspMsg->ulDataSize - DRA_RTT_NOT_NEED_CHARS_LEN);

    pData = VOS_MemAlloc(MSP_PID_DIAG_AGENT,DYNAMIC_MEM_PT,ulLen);
    if(NULL == pData)
    {
        return ERR_MSP_MALLOC_FAILUE;
    }

    /* 写入消息ID */
    *(VOS_UINT32*)(pData) = pstDspMsg->ulID;

    /* 写入消息内容 */
    VOS_MemCpy((pData + sizeof(VOS_UINT32)), (pstReq + DIAG_FULL_HEAD_LEN), (pstDspMsg->ulDataSize - DRA_RTT_NOT_NEED_CHARS_LEN));

    ret = BSP_MailBox_ComMsgWrite((MAILBOX_SERVICE_TYPE_E)ulServeType, pData, ulLen, EN_MAILBOX_SLEEP_WAKEUP);
    if(ERR_MSP_SUCCESS != ret)
    {
        /* 开机时DSP未启动时,HSO下发DSP操作导致写失败,避免打印刷屏,屏蔽打印 */
//        printf("write BSP_MailBox_ComMsgWrite fail!\n");
    }

    VOS_MemFree(MSP_PID_DIAG_AGENT,pData);

    /*模拟DSP回复*/
    stRttCnf.ulRc = ret;
    ret = diag_AgentCnfFun((VOS_UINT8*)&stRttCnf,ulCmdId,sizeof(DIAG_CMD_DSP_CNF_STRU));
    return ret;
}
Ejemplo n.º 7
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 */
}
Ejemplo n.º 8
0
/*****************************************************************************
 Function Name   : diag_PrintCfgProc
 Description     : 该函数用于处理CfgProcEntry传进来的打印开关命令
 Input           : pstReq 待处理数据
 Output          : None
 Return          : VOS_UINT32

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

*****************************************************************************/
VOS_UINT32 diag_PrintCfgProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    MSP_DIAG_HEAD_STRU *pstDiagHead = NULL;
    DIAG_CMD_LOG_CAT_PRINT_REQ_STRU* pstPrintSwtReq = NULL;
    DIAG_CMD_LOG_CAT_PRINT_CNF_STRU stPrintSwtCnf = {0};
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT32 ulSetRet;

    pstDiagHead = (MSP_DIAG_HEAD_STRU*)(DIAG_OFFSET_SOCP_GET_DIAG_HEAD(pstReq));

    pstPrintSwtReq = (DIAG_CMD_LOG_CAT_PRINT_REQ_STRU*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));


    /*设置打印开关到全局变量中*/
    ulSetRet = diag_CfgSetPrintSwt(pstPrintSwtReq, pstDiagHead->ulDataSize - sizeof(MSP_DIAG_DATA_REQ_STRU));
    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_PRINT_CFG, ulSetRet, 0, 0);

    stPrintSwtCnf.ulRc = ulSetRet;

    stPrintSwtCnf.ulModuleId = pstPrintSwtReq->ulModuleId;

#if(VOS_OS_VER == VOS_LINUX)
    /*组包给FW回复*/
    ret = diag_AgentCnfFun((VOS_UINT8*)&stPrintSwtCnf,ulCmdId,sizeof(DIAG_CMD_LOG_CAT_PRINT_CNF_STRU));
#endif
    return ret;

}
VOS_UINT32 diag_DrxSampleGenProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    DIAG_CMD_DRX_SAMPLE_REG_WR_REQ_STRU *psDrxSample = NULL;
	DIAG_CMD_DRX_SAMPLE_REG_WR_CNF_STRU stCnfDrxSample = {0};
	VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT32 ulDataLen = 0;

	ulDrxSampleGenEnterCnt ++;
	psDrxSample = (DIAG_CMD_DRX_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,psDrxSample->ulOmDrxSampleId,0,0);

    ret = BSP_MailBox_ComMsgWrite(EN_MAILBOX_SERVICE_LTE_HS_DIAG, psDrxSample, ulDataLen, EN_MAILBOX_SLEEP_WAKEUP);
	if(ret != VOS_OK)
	{
		ret = ERR_MSP_FAILURE;
	}

	ulDrxSampleGenExitCnt ++;

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

	return ret;

}
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;
}
Ejemplo n.º 11
0
VOS_VOID diag_PortEvtCB(ACM_EVT_E  ulEvt,DIAG_PORT_PHY_BEAR_ENUM enPort)
{
    DIAG_PORT_CONNECT_STA_PFN pfnConn = DIAG_PORT_GET_CONN_CALLBACK();

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_EVT+enPort, ulEvt, 0, 0);

    if(ACM_EVT_DEV_READY==ulEvt)
    {
		DIAG_PORT_CHAN_STATE_SWITCH(enPort,ACM_EVT_DEV_READY);
        return ;
    }
    else
    {
        if(diag_GetLogSendType() == EN_DIAG_SEND_LOG_TO_SD)
        {
            return ;
        }

        //通知逻辑通道状态
        if(pfnConn!=NULL)
        {
            pfnConn(DIAG_DISCONN);
        }
		DIAG_PORT_CHAN_STATE_SWITCH(enPort,ACM_EVT_DEV_SUSPEND);
    }
    return;
}
/*****************************************************************************
 Function Name   : diag_SendCoderSrcToSocp
 Description     : 写入编码源数据到SOCP
 Input           :VOS_UINT8 *pBuf
                VOS_UINT32 ulLen
                SOCP_CODER_SRC_ENUM_U32 ulCodeSrcId
 Output          : None
 Return          : VOS_UINT32

 History         :
    1.w00182550      2012-11-19  Draft Enact

*****************************************************************************/
VOS_UINT32 diag_SendCoderSrcToSocp(VOS_UINT8 *pBuf,VOS_UINT32 ulLen, SOCP_CODER_SRC_ENUM_U32 ulCodeSrcId)
{
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT8  *pucRealMemAddr;
    VOS_UINT32 ulIndex = 0;

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_CODE_PACKET_START, ulCodeSrcId, (VOS_UINT32)ulLen, 0);

    /*根据通道类型获取要申请哪个BUF数据*/
    ulIndex = diag_GetBufIndex(ulCodeSrcId);

    /*配给SOCP必须为实地址*/
    /*lint -save -e40*/
    pucRealMemAddr = diag_BuffVirtToPhy(pBuf,(VOS_UINT8*)g_DiagMemVirt,(VOS_UINT8*)DIAG_MEM_ADDR_BASE,(VOS_UINT32)(g_stDiagBufCtrl[ulIndex].lBufSize));
    /*lint -restore*/

    if (VOS_NULL_PTR == pucRealMemAddr)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_CODE_PACKET_START_ERROR, ulCodeSrcId, (VOS_UINT32)ulLen, 0);
        /*如果发送失败,将申请的buf归还*/
        g_stDiagBufCtrl[ulIndex].lAlloc -= (VOS_INT32)ulLen;

        g_stDiagToHsoErrRecord.usSendAddrErr++;

        return ERR_MSP_INVALID_OP;
    }

#if((VOS_OS_VER == VOS_VXWORKS) || (VOS_OS_VER == VOS_RTOSCK))
    /*数据发送前,刷cache*/
    DIAG_FLUSH_CACHE(pBuf, ulLen);
#endif

    /*将数据发给SOCP*/
    ret = SCM_SendCoderSrc(ulCodeSrcId,pucRealMemAddr,ulLen);
    if(ret != ERR_MSP_SUCCESS)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_CODE_PACKET_START_ERROR, ulCodeSrcId, (VOS_UINT32)ulLen, 1);
        /*如果发送失败,将申请的buf归还*/
		g_stDiagBufCtrl[ulIndex].lAlloc -= (VOS_INT32)ulLen;

        g_stDiagToHsoErrRecord.usSendSocpDataErr++;
    }

    return ret;

}
VOS_UINT32 diag_DrxSampleGetAddrProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    DIAG_CMD_DRX_SAMPLE_GET_ADDR_REQ_STRU *psDrxSample = NULL;
	DIAG_CMD_DRX_SAMPLE_GET_ADDR_CNF_STRU stCnfDrxSample = {0};
	VOS_UINT32 ret = ERR_MSP_SUCCESS;

	VOS_UINT32 ulAddrType 	= 0;


	ulDrxSampleGetAddrEnterCnt ++;
	psDrxSample = (DIAG_CMD_DRX_SAMPLE_GET_ADDR_REQ_STRU*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));


	DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_BBP_SAMPLE,psDrxSample->eDiagDrxSampleAddr,0,0);

	ulAddrType = psDrxSample->eDiagDrxSampleAddr;

    stCnfDrxSample.ulDrxSampleType = ulAddrType;
	/* 获取对应的寄存器地址*/
	switch (ulAddrType)
	{
		case DRX_SAMPLE_BBP_DMA_BASE_ADDR:
			stCnfDrxSample.ulDrxSampleAddr = (VOS_UINT32)DRV_GET_IP_BASE_ADDR(BSP_IP_TYPE_BBPDMA);
			/* add code here */
			break;
		case DRX_SAMPLE_BBP_DBG_BASE_ADDR:
			stCnfDrxSample.ulDrxSampleAddr = (VOS_UINT32)DRV_GET_IP_BASE_ADDR(BSP_IP_TYPE_BBPDBG);
			/* add code here */
			break;
		case DRX_SAMPLE_BBP_SRC_BASE_ADDR:
			stCnfDrxSample.ulDrxSampleAddr = (VOS_UINT32)DRV_GET_IP_BASE_ADDR(BSP_IP_TYPE_BBPSRC);
			/* add code here */
			break;
		case DRX_SAMPLE_POW_ONOFF_CLK_BASE_ADDR:
			stCnfDrxSample.ulDrxSampleAddr = (VOS_UINT32)DRV_GET_IP_BASE_ADDR(BSP_IP_TYPE_SYSCTRL);
			/* add code here */
			break;
		case DRX_SAMPLE_SOCP_BASE_ADDR:
			stCnfDrxSample.ulDrxSampleAddr = (VOS_UINT32)DRV_GET_IP_BASE_ADDR(BSP_IP_TYPE_SOCP);
			/* add code here */
			break;
		default:
			break;
	}

	ulDrxSampleGetAddrExitCnt ++;

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

	return ret;

}
VOS_UINT32 diag_RegWrProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
	DIAG_CMD_REG_WR_REQ_STRU* pstRegWRReq = NULL;
	DIAG_CMD_REG_WR_PARA_STRU* pstReqWrStru     = NULL;
    DIAG_CMD_REG_WR_CNF_PARA_STRU *pstCnfWrStru = NULL;
    DIAG_CMD_REG_WR_CNF_PARA_STRU *pstTempCnf = NULL;
    MSP_DIAG_HEAD_STRU *pstDiagHead             = NULL;
    VOS_UINT32 ulNum  = 0;
    VOS_UINT32 i = 0;
    VOS_UINT32 ret = 0;
    VOS_UINT32 ulMsgLen =0,ulLen = 0;

    /*入参判断*/
    pstDiagHead = (MSP_DIAG_HEAD_STRU*)(DIAG_OFFSET_SOCP_GET_DIAG_HEAD(pstReq));
    pstRegWRReq = (DIAG_CMD_REG_WR_REQ_STRU*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));

    ulLen = (pstDiagHead->ulDataSize - sizeof(MSP_DIAG_DATA_REQ_STRU));
    if((0 != ulLen % sizeof(DIAG_CMD_REG_WR_PARA_STRU)) ||(0 == ulLen))
    {
        return ERR_MSP_INVALID_PARAMETER;
    }

    ulNum = (pstDiagHead->ulDataSize - sizeof(MSP_DIAG_DATA_REQ_STRU)) / sizeof(DIAG_CMD_REG_WR_PARA_STRU);
    ulMsgLen = sizeof(DIAG_CMD_REG_WR_CNF_PARA_STRU) * ulNum;

	DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_NV_WR,ulNum,0,0);

    pstCnfWrStru = (DIAG_CMD_REG_WR_CNF_PARA_STRU*)VOS_MemAlloc(MSP_PID_DIAG_AGENT, DYNAMIC_MEM_PT,ulMsgLen);
    if(NULL == pstCnfWrStru)
    {
        return ERR_MSP_MALLOC_FAILUE;
    }

    pstTempCnf = pstCnfWrStru;
    for (i = 0; i < ulNum; i++)
    {
        /*lint -save -e740*/
        pstReqWrStru = (DIAG_CMD_REG_WR_PARA_STRU*)pstRegWRReq + i;
        /*lint -restore*/
        /* 组包命令参数*/
        ret = diag_SetRegValue(pstReqWrStru);

        pstTempCnf->ulAddr = pstReqWrStru->ulAddr;
        pstTempCnf->ulRc   = ret;
        pstTempCnf ++;
    }

    /*打包回复给FW*/
    ret = diag_AgentCnfFun((VOS_UINT8*)pstCnfWrStru,ulCmdId,ulMsgLen);

     VOS_MemFree(MSP_PID_DIAG_AGENT,pstCnfWrStru);

    return ret;
}
Ejemplo n.º 15
0
VOS_VOID diag_UsbClose(VOS_VOID)
{
	VOS_UINT32 ulRet = 0;

	DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_VCOM_DISABLE,0, 0, 0);

	/*关闭DIAG USB CTRL通道*/
	ulRet = diag_UsbCtrlClose();
	if(ERR_MSP_SUCCESS!=ulRet)
	{
		DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_VCOM_DISABLE_ERR,0, 0, 1);
	}

	/*关闭DIAG USB DATA通道*/
	ulRet = diag_UsbAppClose();
	if(ERR_MSP_SUCCESS!=ulRet)
	{
		DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_VCOM_DISABLE_ERR,0, 0, 2);
	}
}
Ejemplo n.º 16
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;
}
Ejemplo n.º 17
0
VOS_VOID diag_UsbOpen(VOS_VOID)
{
	VOS_UINT32 ulRet = 0;

	DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_VCOM_INIT, 0, 0, 0);

	/*打开 DIAG USB CTRL CNF通道*/
	ulRet = diag_UsbCtrlOpen();
	if(ERR_MSP_SUCCESS!=ulRet)
	{
		vos_printf("diag_UsbCtrlOpen failed.\n");
		DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_VCOM_INIT_ERR,0, 0, 1);
	}

	/*打开 DIAG USB DATA IND通道*/
	ulRet = diag_UsbAppOpen();
	if(ERR_MSP_SUCCESS!=ulRet)
	{
		vos_printf("diag_UsbAppOpen failed.\n");
		DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_VCOM_INIT_ERR,0, 0, 2);
	}
}
VOS_UINT32 diag_RegRdProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
	DIAG_CMD_REG_RD_REQ_STRU* pstRegQryReq = NULL;
    DIAG_CMD_REG_RD_CNF_PARA_STRU *pstRegQryCnf = NULL;
    DIAG_CMD_REG_RD_CNF_PARA_STRU *pstTempCnf = NULL;
    MSP_DIAG_HEAD_STRU *pstDiagHead         = NULL;
    VOS_UINT32 *pulReqRdAddr                = NULL;
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT32 ulNum  = 0;
    VOS_UINT32 i = 0;
    VOS_UINT32 ulMsgLen = 0;

    pstDiagHead = (MSP_DIAG_HEAD_STRU*)(DIAG_OFFSET_SOCP_GET_DIAG_HEAD(pstReq));
    pstRegQryReq = (DIAG_CMD_REG_RD_REQ_STRU*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));

    ulNum = (pstDiagHead->ulDataSize - sizeof(MSP_DIAG_DATA_REQ_STRU)) / sizeof(VOS_UINT32);
    ulMsgLen = sizeof(DIAG_CMD_REG_RD_CNF_PARA_STRU) * ulNum;


	DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_REG_RD,ulNum,0,0);

    pstRegQryCnf = (DIAG_CMD_REG_RD_CNF_PARA_STRU*)VOS_MemAlloc(MSP_PID_DIAG_AGENT, DYNAMIC_MEM_PT,ulMsgLen);
    if(NULL == pstRegQryCnf)
    {
        return ERR_MSP_MALLOC_FAILUE;
    }

    pstTempCnf = pstRegQryCnf;

    for (i = 0; i < ulNum; i++)
    {
        /*lint -save -e740*/
        pulReqRdAddr = ((VOS_UINT32*)pstRegQryReq) + i;
        /*lint -restore*/
        ret = (VOS_UINT32)diag_RegRead(*pulReqRdAddr, ADDRTYPE32BIT, &(pstRegQryCnf->ulRegValue));
		if(ERR_MSP_SUCCESS == ret)
		{
			pstTempCnf->ulRc = ret;
			pstTempCnf->ulAddr =*pulReqRdAddr;
		}
        pstTempCnf++;
    }

    ret = diag_AgentCnfFun((VOS_UINT8*)pstRegQryCnf,ulCmdId,ulMsgLen);

    VOS_MemFree(MSP_PID_DIAG_AGENT,pstRegQryCnf);

    return ret;


}
Ejemplo n.º 19
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;
}
VOS_VOID diag_AgentSendMsgToDsp(DIAG_SOCP_STATE_ENUM_U32 state)
{
    DIAG_MSG_TO_DSP_STRU pData;
    VOS_UINT32  ret;

    pData.ulMsgId = 0;
    pData.ulOpId  = g_diagDspDebugInfo.ulSendOpId++;
    pData.ulReq   = state;

    ret = BSP_MailBox_ComMsgWrite(EN_MAILBOX_SERVICE_RTT_SYS_CTRL, &pData, sizeof(DIAG_MSG_TO_DSP_STRU), EN_MAILBOX_SLEEP_WAKEUP);
    if(ERR_MSP_SUCCESS != ret)
    {
        diag_printf("%s: send to dsp fail ret=0x%x\n", __FUNCTION__, ret);
        DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 5, 0, 0);
        return ;
    }
}
Ejemplo n.º 21
0
/*****************************************************************************
 Function Name   : diag_DisConnProc
 Description     : 该函数用于处理ConnProcEntry传进来的HSO断开命令
 Input           : pstReq 待处理数据
 Output          : None
 Return          : VOS_UINT32

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

*****************************************************************************/
VOS_UINT32 diag_DisConnProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    DIAG_CMD_HOST_DISCONNECT_CNF_STRU stCnfDisConn = {0};
    VOS_UINT32 ulRst = ERR_MSP_SUCCESS;

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

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_DIS_CONN_CFG, 0, 0, 0);

    stCnfDisConn.ulRc = ulRst;

#if(VOS_OS_VER == VOS_LINUX)
    /*组包给FW回复*/
    ulRst = diag_AgentCnfFun((VOS_UINT8*)&stCnfDisConn,ulCmdId,sizeof(DIAG_CMD_HOST_DISCONNECT_CNF_STRU));
#endif
    return ulRst;
}
VOS_UINT32 diag_DspTransCnfProc(VOS_UINT8 * aucSocpPacket)
{
    DIAG_CMD_DSP_CNF_STRU stRttCnf = {0};
	VOS_UINT32 ret = 0;
    VOS_UINT32 ulCmdId = 0;
	MSP_DIAG_HEAD_STRU *pstDspMsg = NULL;
    VOS_UINT32 ulLen = 0;
	VOS_UINT8* pData = NULL;

    ulCmdId = (((MSP_DIAG_HEAD_STRU*)DIAG_OFFSET_SOCP_GET_DIAG_HEAD(aucSocpPacket))->ulID);

    /* DSP消息的ID和size */
    pstDspMsg = (MSP_DIAG_HEAD_STRU*)(aucSocpPacket+sizeof(MSP_SOCP_HEAD_STRU));

    ulLen = sizeof(VOS_UINT32) + (pstDspMsg->ulDataSize - DRA_RTT_NOT_NEED_CHARS_LEN);

    pData = VOS_MemAlloc(MSP_PID_DIAG_AGENT,DYNAMIC_MEM_PT,ulLen);
    if(NULL == pData)
    {
        return ERR_MSP_MALLOC_FAILUE;
    }

    /* 写入消息ID */
    *(VOS_UINT32*)(pData) = pstDspMsg->ulID;

    /* 写入消息内容 */
    VOS_MemCpy((pData + sizeof(VOS_UINT32)), (aucSocpPacket + DIAG_FULL_HEAD_LEN), (pstDspMsg->ulDataSize - DRA_RTT_NOT_NEED_CHARS_LEN));

	DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_LTE_DSP_CNF,0,0,0);

    ret = BSP_MailBox_ComMsgWrite(EN_MAILBOX_SERVICE_LTE_OM, pData, ulLen, EN_MAILBOX_SLEEP_WAKEUP);
    if(ERR_MSP_SUCCESS != ret)
    {
        /* 开机时DSP未启动时,HSO下发DSP操作导致写失败,避免打印刷屏,屏蔽打印 */
//        printf("write BSP_MailBox_ComMsgWrite fail!\n");
    }

    VOS_MemFree(MSP_PID_DIAG_AGENT,pData);

    /*模拟DSP回复*/
    stRttCnf.ulRc = ERR_MSP_SUCCESS;
    ret = diag_AgentCnfFun((VOS_UINT8*)&stRttCnf,ulCmdId,sizeof(DIAG_CMD_DSP_CNF_STRU));
    return ret;
}
Ejemplo n.º 23
0
VOS_VOID diag_CloseSocket(DIAG_TCPIP_PORT_ENUM enTcpPort)
{
    DIAG_TCPIP_CTRL_INFO_STRU *pstDiagTcpInfo;

    pstDiagTcpInfo = diag_GetTcpInfo();

    diag_TcpPortLock(enTcpPort);

    if (INVALID_SOCKET != pstDiagTcpInfo->astTcpIpPort[enTcpPort].Tcp)
    {
        shutdown(pstDiagTcpInfo->astTcpIpPort[enTcpPort].Tcp, SHUT_RDWR);
        closesocket(pstDiagTcpInfo->astTcpIpPort[enTcpPort].Tcp);

        DIAG_DEBUG_SDM_FUN(EN_DIAG_TCP_SOCKET_CLOSE, (VOS_UINT32)(pstDiagTcpInfo->astTcpIpPort[enTcpPort].Tcp), 0, 0);

        pstDiagTcpInfo->astTcpIpPort[enTcpPort].Tcp = INVALID_SOCKET;
    }

    diag_TcpPortUnLock(enTcpPort);
}
Ejemplo n.º 24
0
/*****************************************************************************
 Function Name   : diag_AirCfgProc
 Description     : 该函数用于处理CfgProcEntry传进来的空口开关命令
 Input           : pstReq 待处理数据
 Output          : None
 Return          : VOS_UINT32

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

*****************************************************************************/
VOS_UINT32 diag_AirCfgProc (VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    DIAG_CMD_LOG_CAT_AIR_REQ_STRU* pstAirSwtReq = NULL;
    DIAG_CMD_LOG_CAT_AIR_CNF_STRU stAirSwtCnf = {0};
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    ENUM_DIAG_CFG_SWT_U8 enLSwitch = 0;
    ENUM_DIAG_CFG_SWT_U8 enGuSwitch = 0;
    VOS_UINT32 ulSetRet = 0;/*lint !e958 */

    pstAirSwtReq = (DIAG_CMD_LOG_CAT_AIR_REQ_STRU*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));/*lint !e958 */

    /*设置LT空口开关值*/
    enLSwitch = DIAG_GET_CFG_SWT(pstAirSwtReq->ulSwitch);
    enGuSwitch = DIAG_GET_CFG_SWT(pstAirSwtReq->ulGuSwitch);

    ulSetRet = diag_CfgSetGlobalBitValue(&g_ulDiagCfgInfo,DIAG_CFG_LT_AIR_BIT,enLSwitch);

    /*设置GU空口开关值*/
    ulSetRet |= diag_CfgSetGlobalBitValue(&g_ulDiagCfgInfo,DIAG_CFG_GU_AIR_BIT,enGuSwitch);

    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AIR_CFG, pstAirSwtReq->ulSwitch, ulSetRet, 0);

    if(ERR_MSP_SUCCESS == ulSetRet)
    {
        stAirSwtCnf.ulRc = ERR_MSP_SUCCESS;
    }
    else
    {
        stAirSwtCnf.ulRc = ERR_MSP_FAILURE;
    }

#if(VOS_OS_VER == VOS_LINUX)
    /*组包给FW回复*/
    ret = diag_AgentCnfFun((VOS_UINT8*)&stAirSwtCnf,ulCmdId,sizeof(DIAG_CMD_LOG_CAT_AIR_CNF_STRU));
#endif
    return ret;
}
Ejemplo n.º 25
0
/*****************************************************************************
 Function Name   : diag_EventCfgProc
 Description     : 该函数用于处理CfgProcEntry传进来的事件开关命令
 Input           : pstReq 待处理数据
 Output          : None
 Return          : VOS_UINT32

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

*****************************************************************************/
VOS_UINT32 diag_EventCfgProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    DIAG_CMD_LOG_CAT_EVENT_REQ_STRU* pstEvtSwtReq = NULL;
    DIAG_CMD_LOG_CAT_EVENT_CNF_STRU stEvtSwtCnf = {0};
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT32 ulSetRet;
    ENUM_DIAG_CFG_SWT_U8 enSwitch =0;

    pstEvtSwtReq = (DIAG_CMD_LOG_CAT_EVENT_REQ_STRU*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));

    /*设置事件开关值*/
    enSwitch = DIAG_GET_CFG_SWT(pstEvtSwtReq->ulSwitch);
    ulSetRet = diag_CfgSetGlobalBitValue(&g_ulDiagCfgInfo,DIAG_CFG_EVENT_BIT,enSwitch);
    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_EVENT_CFG, pstEvtSwtReq->ulSwitch, ulSetRet, 0);

    stEvtSwtCnf.ulRc = ulSetRet;
    stEvtSwtCnf.ulSwitch = pstEvtSwtReq->ulSwitch;

#if(VOS_OS_VER == VOS_LINUX)
    /*组包给FW回复*/
    ret = diag_AgentCnfFun((VOS_UINT8*)&stEvtSwtCnf,ulCmdId,sizeof(DIAG_CMD_LOG_CAT_EVENT_CNF_STRU));
#endif
    return ret;
}
Ejemplo n.º 26
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;

}
VOS_UINT32 diag_DrxSampleGetChnSizeProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
	DIAG_CMD_DRX_SAMPLE_GET_CHNSIZE_REQ_STRU *psDrxSample = NULL;
	DIAG_CMD_DRX_SAMPLE_GET_CHNSIZE_CNF_STRU stCnfDrxSample = {0};
	VOS_UINT32 ret = ERR_MSP_SUCCESS;

	VOS_UINT32 ulAddrType = 0;

	ulDrxSampleGetChnSizeEnterCnt ++;
	psDrxSample = (DIAG_CMD_DRX_SAMPLE_GET_CHNSIZE_REQ_STRU*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));


	DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_BBP_SAMPLE,psDrxSample->eDiagDrxSampleChnSize,0,0);

	ulAddrType = psDrxSample->eDiagDrxSampleChnSize;
	switch (ulAddrType)
	{
		case DRX_SAMPLE_BBP_DMA_LOG0_CHNSIZE:
			stCnfDrxSample.ulChnAddr = BBP_LOG0_MEM_ADDR;
            stCnfDrxSample.ulChnSize = BBP_LOG0_MEM_SIZE;
			break;
		case DRX_SAMPLE_BBP_DMA_LOG1_CHNSIZE:
			stCnfDrxSample.ulChnAddr = BBP_LOG1_MEM_ADDR;
            stCnfDrxSample.ulChnSize = BBP_LOG1_MEM_SIZE;
			break;
		case DRX_SAMPLE_BBP_DMA_LOG2_CHNSIZE:
			stCnfDrxSample.ulChnAddr = BBP_LOG2_MEM_ADDR;
            stCnfDrxSample.ulChnSize = BBP_LOG2_MEM_SIZE;
			break;
		case DRX_SAMPLE_BBP_DMA_LOG3_CHNSIZE:
			stCnfDrxSample.ulChnAddr = BBP_LOG3_MEM_ADDR;
            stCnfDrxSample.ulChnSize = BBP_LOG3_MEM_SIZE;
            break;
		case DRX_SAMPLE_BBP_DMA_LOG4_CHNSIZE:
			stCnfDrxSample.ulChnAddr = BBP_LOG4_MEM_ADDR;
            stCnfDrxSample.ulChnSize = BBP_LOG4_MEM_SIZE;
            break;
		case DRX_SAMPLE_BBP_DMA_LOG5_CHNSIZE:
			stCnfDrxSample.ulChnAddr = BBP_LOG5_MEM_ADDR;
            stCnfDrxSample.ulChnSize = BBP_LOG5_MEM_SIZE;
            break;
		case DRX_SAMPLE_BBP_DMA_LOG6_CHNSIZE:
			stCnfDrxSample.ulChnAddr = BBP_LOG6_MEM_ADDR;
            stCnfDrxSample.ulChnSize = BBP_LOG6_MEM_SIZE;
            break;
		case DRX_SAMPLE_BBP_DMA_LOG7_CHNSIZE:
			stCnfDrxSample.ulChnAddr = BBP_LOG7_MEM_ADDR;
            stCnfDrxSample.ulChnSize = BBP_LOG7_MEM_SIZE;
			break;
		case DRX_SAMPLE_BBP_DMA_DATA_CHNSIZE:
            /*lint -save -e778*/
			stCnfDrxSample.ulChnAddr = BBP_DS_MEM_ADDR;
            stCnfDrxSample.ulChnSize = BBP_DS_MEM_SIZE;
            /*lint -restore*/
			break;
		default:
			break;
	}
	ulDrxSampleGetChnSizeExitCnt ++;

	/*打包回复给FW*/
	stCnfDrxSample.ulRet = ret;
    stCnfDrxSample.ulChnType = ulAddrType;
	ret = diag_AgentCnfFun((VOS_UINT8*)&stCnfDrxSample, ulCmdId,sizeof(DIAG_CMD_DRX_SAMPLE_GET_CHNSIZE_CNF_STRU));

	return ret;

}
VOS_UINT32 diag_AgentDispatchCmd(VOS_UINT8* pstReq)
{
    VOS_UINT32 ret =ERR_MSP_FAILURE;
    VOS_UINT32 ulCmdId = 0;

    if(NULL == pstReq)
    {
        return ret;
    }
    ulCmdId = (((MSP_DIAG_HEAD_STRU*)DIAG_OFFSET_SOCP_GET_DIAG_HEAD(pstReq))->ulID);
    DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_AGENT_DISPATCH_CMD,ulCmdId,0,0);/* [false alarm]:屏蔽Fortify */

    if(MSP_STRU_ID_28_31_GROUP_MSP == MSP_STRU_ID_28_31_CMD_GROUP(ulCmdId))
    {
        switch (MSP_STRU_ID_16_23_CMD_TYPE(ulCmdId))
        {
            /*根据二级字段区分是给ps的透传命令还是msp内部命令或者PMU的命令*/
            case MSP_STRU_ID_16_23_MSP_CMD:
                switch(MSP_STRU_ID_8_11_CMD_CATEGORY(ulCmdId))
                {
                    /*根据命令ID范围区分是哪种msp内部命令*/
                	case DIAG_CATEGORY_BBP:
                        ret = diag_BbpProcEntry(pstReq,ulCmdId);
                        break;
                    case DIAG_CATEGORY_CFG:
                        ret = diag_CfgProcEntry(pstReq,ulCmdId);
                        break;
                    case DIAG_CATEGORY_GTR:
                        ret = diag_GtrProcEntry(pstReq,ulCmdId);
						break;
                    default:
                        break;
                }
                break;

            case MSP_STRU_ID_16_23_SYS_CMD:
                switch(MSP_STRU_ID_8_11_CMD_CATEGORY(ulCmdId))
                {
                    case DIAG_CATEGORY_CONN:
                        ret = diag_ConnProcEntry(pstReq,ulCmdId);
                        break;
                    default:
                        break;
                }
                break;

            default:
                break;
        }
    }
    else if((MSP_STRU_ID_28_31_GROUP_LTE_DSP == MSP_STRU_ID_28_31_CMD_GROUP(ulCmdId))||
            (MSP_STRU_ID_28_31_GROUP_TDS_DSP == MSP_STRU_ID_28_31_CMD_GROUP(ulCmdId)))
    {
         ret = diag_DspTransProcEntry(pstReq,ulCmdId);
    }
/*lint -e553*/
#if (FEATURE_BSP_LCH_OM == FEATURE_ON)
/*lint +e553*/
    else if(MSP_STRU_ID_28_31_GROUP_BSP == MSP_STRU_ID_28_31_CMD_GROUP(ulCmdId))
    {
        switch (MSP_STRU_ID_16_23_CMD_TYPE(ulCmdId))
        {
            case MSP_STRU_ID_16_23_BSP_CMD:
                ret =  diag_BspProcEntry(pstReq,ulCmdId);
                break;
            default:
                break;
        }
    }
#endif
    else
    {
    }
    return ret;
}
Ejemplo n.º 29
0
/*****************************************************************************
函 数 名  : diag_PortOpen
功能描述  :
输入参数  :
输出参数  :
返 回 值  :
调用函数  :
被调函数  :
修改历史  :
	1.日	期	: 2012年8月27日
	 修改内容  : Creat Function

*****************************************************************************/
VOS_UINT32 diag_PortOpen(DIAG_PORT_PHY_BEAR_ENUM enPort,UDI_DEVICE_ID devid,\
    VOS_VOID * pEvtCB,VOS_VOID* pWrtCB,VOS_VOID* pRdCB)
{

	UDI_HANDLE slUartHd  = 0;
	VOS_UINT32 ret		= ERR_MSP_SUCCESS;
	UDI_OPEN_PARAM  stParam = {0};
    ACM_READ_BUFF_INFO  stReadParam;

	if(DIAG_PORT_GET_HANDLE(enPort) != UDI_INVALID_HANDLE)
	{
		return ERR_MSP_SUCCESS;
	}

	DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_OPEN+enPort, 0, 0, 0);

	stParam.devid = devid;
	slUartHd = udi_open(&stParam);

    if(UDI_INVALID_HANDLE == slUartHd)
    {
        return ERR_MSP_FAILURE;
    }

    stReadParam.u32BuffSize = DIAG_DATA_READ_BUFFER_SIZE;
    stReadParam.u32BuffNum  = DIAG_DATA_MAX_BUFFER_COUNT;

    ret = udi_ioctl(slUartHd,ACM_IOCTL_RELLOC_READ_BUFF,&stReadParam);
    if(ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_OPEN_ERR+enPort, (VOS_UINT32)slUartHd, ret, 1);
        goto ERR_OUT;
    }

    ret = udi_ioctl(slUartHd,ACM_IOCTL_SEND_BUFF_CAN_DMA,&stReadParam);
    if(ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_OPEN_ERR+enPort, (VOS_UINT32)slUartHd, ret, 2);
        goto ERR_OUT;
    }

    ret = udi_ioctl((int)slUartHd,ACM_IOCTL_SET_READ_CB, pRdCB);
    if(ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_OPEN_ERR+enPort, (VOS_UINT32)slUartHd, ret, 3);
        goto ERR_OUT;
    }
    ret = udi_ioctl((int)slUartHd,ACM_IOCTL_SET_WRITE_CB, pWrtCB);
    if(ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_OPEN_ERR+enPort, (VOS_UINT32)slUartHd, ret, 4);
        goto ERR_OUT;
    }
    ret = udi_ioctl((int)slUartHd, (int)ACM_IOCTL_SET_EVT_CB, pEvtCB);
    if(ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_OPEN_ERR+enPort, (VOS_UINT32)slUartHd, ret, 5);
        goto ERR_OUT;
    }

    ret = udi_ioctl((int)slUartHd, (int)ACM_IOCTL_WRITE_DO_COPY, 0);
    if(ret)
    {
        DIAG_DEBUG_SDM_FUN(EN_DIAG_DEBUG_TCP_OPEN_ERR+enPort, (VOS_UINT32)slUartHd, ret, 6);
        goto ERR_OUT;
    }

    g_diagPort_ctrl.bFlag = VOS_TRUE;

    DIAG_PORT_HANDLE_SWITCH(enPort,slUartHd);   /*修改端口句柄*/
    DIAG_PORT_CHAN_STATE_SWITCH(enPort,ACM_EVT_DEV_READY);/*打开之后修改端口状态*/
    return ERR_MSP_SUCCESS;
ERR_OUT:
    udi_close(slUartHd);
    return ret;

}
VOS_VOID diag_MailboxSelfTask(VOS_VOID)
{
    VOS_UINT32 len, ret;
    DIAG_MSG_DSP_CNF_TO_AGENT_STRU * pData;

    if(ERR_MSP_SUCCESS != VOS_SmBCreate("diagmbx", 0, VOS_SEMA4_FIFO, &g_diagMbxSem))
    {
        diag_printf("[%s]:agent sem init err!\n",__FUNCTION__);
        return ;
    }

    /* 向邮箱注册回调函数 */
    if(ERR_MSP_SUCCESS != BSP_MailBox_ComNotifyReg(EN_MAILBOX_SERVICE_RTT_SYS_CTRL, diag_MailboxCb))
    {
        diag_printf("[%s]:BSP_MailBox_ComNotifyReg err!\n",__FUNCTION__);
        return ;
    }
    /*lint -save -e716*/
    while(1)
    /*lint -restore*/
    {
        if(VOS_OK != VOS_SmP(g_diagMbxSem, 0))
        {
            diag_printf("[%s] VOS_SmP failed.\n", __FUNCTION__);

            continue;
        }

        DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 0, 0, 0);

        len = BSP_MailBox_ComMsgSize(EN_MAILBOX_SERVICE_RTT_SYS_CTRL);
        if(0 == len)
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 1, 0, 0);
            continue ;
        }

        /* VOS消息体在事先分配好的内存中查找空闲,没有阻塞操作 */
        pData = (DIAG_MSG_DSP_CNF_TO_AGENT_STRU *)VOS_AllocMsg(MSP_PID_DIAG_AGENT, len);
        if(VOS_NULL == pData)
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 2, 0, 0);
            continue ;
        }

        /* (pData+20)表示把邮箱中的内容直接读取到消息中 */
        ret = BSP_MailBox_ComMsgRead(EN_MAILBOX_SERVICE_RTT_SYS_CTRL, ((VOS_UINT8 *)pData+VOS_MSG_HEAD_LENGTH), len, EN_MAILBOX_SLEEP_WAKEUP);
        if(ret)
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 3, 0, 0);
            continue;
        }

        pData->ulReceiverPid = MSP_PID_DIAG_AGENT;
        pData->ulSenderPid   = MSP_PID_DIAG_AGENT;
        pData->ulLength      = len;

        /* 注意,只能给自己发消息,跨核发消息中会有阻塞接口,不能在中断中调用 */
        ret = VOS_SendMsg(MSP_PID_DIAG_AGENT, pData);
        if (ret != VOS_OK)
        {
            DIAG_DEBUG_SDM_FUN(EN_DIAG_AGENT_LDSP_MB_MSG, 4, 0, 0);
        }
    }
}