コード例 #1
0
VOS_VOID diag_PortAddToDataBuf(DIAG_PORT_PHY_BEAR_ENUM enPort, VOS_UINT8 * data, VOS_UINT32 dataSize)
{
    DIAG_PORT_DATA_BUF_STRU * pNewNode = NULL;

    /*申请一个节点大小*/
    pNewNode = (DIAG_PORT_DATA_BUF_STRU *)VOS_MemAlloc(MSP_PID_DIAG_APP_AGENT, DYNAMIC_MEM_PT, sizeof(DIAG_PORT_DATA_BUF_STRU));
    if (NULL == pNewNode)
    {
        diag_printf("%s: alloc mem for new node fail\n", __FUNCTION__);
        return;
    }

    /*申请数据空间*/
    pNewNode->dataBuf = (VOS_UINT8 *)VOS_MemAlloc(MSP_PID_DIAG_APP_AGENT, DYNAMIC_MEM_PT, dataSize);
    if (NULL == pNewNode->dataBuf)
    {
        diag_printf("%s: alloc mem for data buf fail\n", __FUNCTION__);
        return;
    }
    pNewNode->port     = enPort;
    pNewNode->dataLen  = dataSize;
    VOS_MemCpy(pNewNode->dataBuf, data, dataSize);

    (VOS_VOID)VOS_SmP(g_diagPortSem,0);
    /* 插入节点到链表尾部 */
    blist_add_tail(&pNewNode->dataList, &g_diagPortDataBuf.dataList);
    (VOS_VOID)VOS_SmV(g_diagPortSem);
}
コード例 #2
0
VOS_VOID SI_STK_DecodeMoSmsRspSpecial(
    VOS_UINT32                          ulDataLen,
    VOS_UINT8                           *pucCmdData,
    SI_STK_ENVELOPE_RSP_STRU            *pstRspData)
{
    VOS_UINT32  ulTagOffset;

    ulTagOffset = SI_STKFindTag(ADDRESS_TAG, pucCmdData, ulDataLen, 1);

    if(ulTagOffset != SI_TAGNOTFOUND)
    {
        pstRspData->uResp.MoSmsCtrlRsp.Addr1.ucLen = pucCmdData[ulTagOffset] - 1;
        pstRspData->uResp.MoSmsCtrlRsp.Addr1.ucNumType = pucCmdData[ulTagOffset+1];
        pstRspData->uResp.MoSmsCtrlRsp.Addr1.pucAddr
            = (SI_UINT8*)VOS_MemAlloc(MAPS_STK_PID, DYNAMIC_MEM_PT, pstRspData->uResp.MoSmsCtrlRsp.Addr1.ucLen);

        if(VOS_NULL_PTR != pstRspData->uResp.MoSmsCtrlRsp.Addr1.pucAddr)
        {
            /*lint -e534*/
            VOS_MemCpy(pstRspData->uResp.MoSmsCtrlRsp.Addr1.pucAddr,
                &pucCmdData[ulTagOffset+2], pstRspData->uResp.MoSmsCtrlRsp.Addr1.ucLen);
            /*lint +e534*/
        }

        pstRspData->uResp.MoSmsCtrlRsp.OP_Addr1 = 1;
    }

    ulTagOffset = SI_STKFindTag(ADDRESS_TAG, pucCmdData, ulDataLen, 2);

    if(ulTagOffset != SI_TAGNOTFOUND)
    {
        pstRspData->uResp.MoSmsCtrlRsp.Addr2.ucLen = pucCmdData[ulTagOffset] - 1;
        pstRspData->uResp.MoSmsCtrlRsp.Addr2.ucNumType = pucCmdData[ulTagOffset+1];
        pstRspData->uResp.MoSmsCtrlRsp.Addr2.pucAddr
            = (SI_UINT8*)VOS_MemAlloc(MAPS_STK_PID, DYNAMIC_MEM_PT, pstRspData->uResp.MoSmsCtrlRsp.Addr2.ucLen);

        if(VOS_NULL_PTR != pstRspData->uResp.MoSmsCtrlRsp.Addr2.pucAddr)
        {
            /*lint -e534*/
            VOS_MemCpy(pstRspData->uResp.MoSmsCtrlRsp.Addr2.pucAddr,
                &pucCmdData[ulTagOffset+2], pstRspData->uResp.MoSmsCtrlRsp.Addr2.ucLen);
            /*lint +e534*/
        }

        pstRspData->uResp.MoSmsCtrlRsp.OP_Addr2 = 1;
    }

    return;
}
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;
    }
}
コード例 #4
0
VOS_UINT32 OM_ComRx_ICCDataRec(OM_ICC_CHANNEL_ENUM_UINT32 enChannelId, VOS_INT32 lLen)
{
    VOS_UINT8 *pucData;
    VOS_INT32 lResult;

    /*申请内存用于保存ICC传递的数据*/
    pucData = (VOS_UINT8 *)VOS_MemAlloc(WUEPS_PID_OM, DYNAMIC_MEM_PT, (VOS_UINT32)lLen);

    if (VOS_NULL_PTR == pucData)
    {
        LogPrint1("OM_ComRx_ICCDataRec: VOS_MemAlloc is Failed, Data Len is %d.\n", lLen);

        return VOS_ERR;
    }

    /*读取ICC传递的数据*/
    lResult = DRV_UDI_READ(g_astOMCCPUIccCtrlTable[enChannelId].UDIHdle, pucData, (VOS_UINT32)lLen);
    if (lLen != lResult)
    {
        VOS_MemFree(WUEPS_PID_OM, pucData);
        LogPrint("OM_ComRx_ICCDataRec: DRV_UDI_READ is Failed.\n");

        return VOS_ERR;
    }

    /*ICC数据处理函数返回错误*/
    if (VOS_OK != g_astOMComRxCBTable[enChannelId](pucData, (VOS_UINT16)lLen))
    {
        LogPrint("OM_ComRx_ICCDataRec: The CB function is Failed.\n");
    }

    VOS_MemFree(WUEPS_PID_OM, pucData);

    return VOS_OK;
}
コード例 #5
0
/*****************************************************************************
 函 数 名  : OM_ComRx_ICC_Init
 功能描述  : 用于OM在CCPU初始化ICC通道
 输入参数  : 无
 输出参数  : 无
 返 回 值  : VOS_ERR/VOS_OK
 调用函数  :
 被调函数  :
 修改历史  :
   1.日    期  : 2011年3月10日
     作    者  : l46160
     修改内容  : Creat Function
*****************************************************************************/
VOS_UINT32 OM_ComRx_ICC_Init(VOS_VOID)
{
    OM_ICC_UDI_CTRL_STRU                astACPUICCCtrlTable;

    /*初始化 ICC通道*/
    VOS_MemSet((&astACPUICCCtrlTable), 0, sizeof(astACPUICCCtrlTable));

    astACPUICCCtrlTable.pstICCAttr = (ICC_CHAN_ATTR_S*)VOS_MemAlloc(ACPU_PID_OM,
                                                                       STATIC_MEM_PT,
                                                                       sizeof(ICC_CHAN_ATTR_S));
    if(VOS_NULL_PTR == astACPUICCCtrlTable.pstICCAttr)
    {
        return VOS_ERR;             /*分配内存失败单板会重启,因此不需要释放之前已经申请的内存*/
    }

    astACPUICCCtrlTable.enICCId                    = UDI_ICC_GUOM0;

    astACPUICCCtrlTable.pstICCAttr->u32Priority    = OM_ICC_CHANNEL_PRIORITY;
    astACPUICCCtrlTable.pstICCAttr->u32TimeOut     = OM_ICC_HANDSHAKE_TIME_MAX;
    astACPUICCCtrlTable.pstICCAttr->u32FIFOInSize  = OM_ICC_BUFFER_SIZE;
    astACPUICCCtrlTable.pstICCAttr->u32FIFOOutSize = OM_ICC_BUFFER_SIZE;
    astACPUICCCtrlTable.pstICCAttr->enChanMode     = ICC_CHAN_MODE_PACKET;
    astACPUICCCtrlTable.pstICCAttr->event_cb       = GU_OamAcpu_ICCError_CB;
    astACPUICCCtrlTable.pstICCAttr->write_cb       = VOS_NULL_PTR;

    if(VOS_ERROR == DRV_ICC_OPEN(astACPUICCCtrlTable.enICCId, astACPUICCCtrlTable.pstICCAttr))
    {
        /* 打开失败时记录当前ICC通道信息 */
        VOS_ProtectionReboot(OM_APP_ICC_INIT_ERROR, THIS_FILE_ID, __LINE__,VOS_NULL_PTR,0);

        return VOS_ERR;
    }

    return VOS_OK;
}
コード例 #6
0
VOS_UINT32 atQryDLoadVer(VOS_UINT8 ucClientId)
{
    VOS_UINT32 ulRst = AT_OK;
    VOS_UINT8* pData = NULL;
    gstAtSendData.usBufLen = 0;

    pData = VOS_MemAlloc(WUEPS_PID_AT, (DYNAMIC_MEM_PT), UPGRADE_STR_BUF_SIZE);
    if(NULL == pData)
    {
        CmdErrProc(ucClientId, ERR_MSP_MALLOC_FAILUE, 0, NULL);
        return AT_ERROR;
    }

    MSP_MEMSET(pData,0,UPGRADE_STR_BUF_SIZE);
    ulRst = BSP_DLOAD_GetDloadVer((BSP_CHAR *)pData,UPGRADE_STR_BUF_SIZE);
    if(ulRst != ERR_MSP_SUCCESS)
    {
        VOS_MemFree(WUEPS_PID_AT, pData);
        CmdErrProc(ucClientId, ulRst, 0, NULL);
        return AT_ERROR;
    }

    gstAtSendData.usBufLen = (VOS_UINT16)At_sprintf( AT_CMD_MAX_LEN,
                                           (VOS_CHAR *)pgucAtSndCodeAddr,
                                           (VOS_CHAR*)pgucAtSndCodeAddr,
                                           "\r%s\r",
                                           pData
                                         );

    VOS_MemFree(WUEPS_PID_AT, pData);

    return AT_OK;
}
コード例 #7
0
VOS_UINT32 at_ftm_scalibRdFun(VOS_VOID* pParam)
{
    VOS_UINT32 ret                        = ERR_MSP_SUCCESS;
    FTM_RD_SCALIB_CNF_STRU  * pstCnf = NULL;

    pstCnf = (FTM_RD_SCALIB_CNF_STRU *)VOS_MemAlloc(MSP_SYS_FTM_PID, (DYNAMIC_MEM_PT), sizeof(FTM_RD_SCALIB_CNF_STRU));
    
    if (NULL != pstCnf)
    {
        if (NULL == gst_systemSetting)
        {
            pstCnf->ulErrCode = ERR_MSP_FAILURE;
        }
        else
        {
            pstCnf->ulErrCode = ERR_MSP_SUCCESS;
        }
        ret = ftm_SendDataMsg(MSP_SYS_FTM_PID, WUEPS_PID_AT, ID_MSG_FTM_RD_SCALIB_CNF,
            (VOS_UINT32) pstCnf, sizeof(FTM_RD_SCALIB_CNF_STRU));
        VOS_MemFree(MSP_SYS_FTM_PID, pstCnf);
    }
	else
	{
		ret = ERR_MSP_NO_MORE_MEMORY;
	}

    return ret;
}
コード例 #8
0
VOS_UINT32 diag_GetNvListProc(VOS_UINT8* pstReq)
{
    VOS_UINT32 ret, ulNvNum, ulTotalLen;
    DIAG_CMD_NV_LIST_CNF_STRU* pstNVCnf = NULL;
    DIAG_CMD_NV_LIST_CNF_STRU stNVCnf = {0};
    MSP_DIAG_CNF_INFO_STRU stDiagInfo = {0};
    DIAG_FRAME_INFO_STRU *pstDiagHead;

    pstDiagHead = (DIAG_FRAME_INFO_STRU*)(pstReq);

    stDiagInfo.ulMsgType = DIAG_MSG_TYPE_BSP;

    ulNvNum = NV_GetNVIdListNum();
    if (0 == ulNvNum)
    {
        diag_printf("[%s]: ulNvNum=%d!\n",__FUNCTION__, ulNvNum);
        goto DIAG_ERROR;
    }

    /*APP_HEAD + Result + NV nums + NV ID/LEN lists*/
    ulTotalLen = sizeof(DIAG_CMD_NV_LIST_CNF_STRU) + (ulNvNum*sizeof(NV_LIST_INFO_STRU));

    pstNVCnf = (DIAG_CMD_NV_LIST_CNF_STRU*)VOS_MemAlloc(MSP_PID_DIAG_APP_AGENT, DYNAMIC_MEM_PT, ulTotalLen);

    if (VOS_NULL_PTR == pstNVCnf)
    {
        diag_printf("[%s]:malloc error!\n",__FUNCTION__);
        goto DIAG_ERROR;
    }

    /*获取每个NV项的ID和长度*/
    ret = NV_GetNVIdList(pstNVCnf->astNvList);
    if (NV_OK != ret)
    {
        VOS_MemFree(MSP_PID_DIAG_APP_AGENT, pstNVCnf);
        goto DIAG_ERROR;
    }

    DIAG_MSG_COMMON_PROC(stDiagInfo, (*pstNVCnf), pstDiagHead);

    pstNVCnf->ulCount    = ulNvNum;
    pstNVCnf->ulRc       = ERR_MSP_SUCCESS;

    ret = DIAG_MsgReport(&stDiagInfo, pstNVCnf, ulTotalLen);

    VOS_MemFree(MSP_PID_DIAG_APP_AGENT, pstNVCnf);

    return ret;

DIAG_ERROR:

    DIAG_MSG_COMMON_PROC(stDiagInfo, stNVCnf, pstDiagHead);

    stNVCnf.ulCount      = 0;
    stNVCnf.ulRc         = ERR_MSP_FAILURE;

    ret = DIAG_MsgReport(&stDiagInfo, &stNVCnf, sizeof(stNVCnf));

    return ret;
}
コード例 #9
0
struct ppp_mbuf *
ppp_m_get_Debug(VOS_INT32 m_len, VOS_UINT32 ulFileID, VOS_UINT32 ulLineNum)
{
    struct ppp_mbuf    *bp;

    if (m_len <= 0)
    {
        PPP_MNTN_LOG1(PS_PID_APP_PPP, 0, LOG_LEVEL_WARNING,"Request for ppp_mbuf denied,m_len %d",m_len);
        return VOS_NULL_PTR;
    }

    /*去除对TTFMem.h的依赖*/
    /*bp  = TTF_MALLOC_WITH_FILE_LINE(PS_PID_APP_PPP, sizeof(struct ppp_mbuf) + m_len, ulFileID, (VOS_INT32)ulLineNum);*/

    bp  = VOS_MemAlloc(PS_PID_APP_PPP, DYNAMIC_MEM_PT, sizeof(struct ppp_mbuf) + m_len);

    if (VOS_NULL_PTR == bp)
    {
        return VOS_NULL_PTR;
    }

    PS_MEM_SET(bp, '\0', sizeof(struct ppp_mbuf));
    bp->m_size  = m_len;
    bp->m_len   = m_len;

    return bp;
}
コード例 #10
0
SC_ERROR_CODE_ENUM_UINT32 SC_COMM_RsaDecrypt(
    VOS_UINT8                          *pucPwd,
    VOS_UINT32                          ulCipherLen,
    VOS_UINT8                          *pucPubContent,
    VOS_UINT32                         *pulPubLen
)
{
    VOS_UINT32                          ulResult;
    VOS_INT32                           lResult;
    VOS_UINT32                          ulLen;
    SC_AK_FILE_STRU                    *pstAKFile;

    pstAKFile = (SC_AK_FILE_STRU*)VOS_MemAlloc(WUEPS_PID_OM, DYNAMIC_MEM_PT, sizeof(SC_AK_FILE_STRU));

    if (VOS_NULL_PTR == pstAKFile)
    {
        SC_ERROR_LOG("SC_COMM_RsaDecrypt: VOS Alloc Memory is failed.");
        /* 返回内存申请失败 */
        return SC_ERROR_CODE_ALLOC_MEM_FAIL;
    }

    /* 读取AK-FILE并校验签名 */
    ulResult = SC_COMM_ReadSCFileAndCmpSign(SC_SECRET_FILE_TYPE_AK,
                                            pstAKFile->aucAuthPubKey,
                                            sizeof(SC_AK_FILE_STRU));

    if (SC_ERROR_CODE_NO_ERROR != ulResult)
    {
        VOS_MemFree(WUEPS_PID_OM, pstAKFile);

        SC_ERROR1_LOG("SC_COMM_RsaDecrypt: SC_COMM_ReadSCFileAndCmpSign is failed.", ulResult);

        return ulResult;
    }

    ulLen = *pulPubLen;

    /* 对输入的密文进行RSA解密 */
    lResult = CRYPTO_RSA_DECRYPT((VOS_CHAR*)pucPwd,
                                 (VOS_INT)ulCipherLen,
                                 (VOS_CHAR*)pstAKFile->aucAuthPubKey,
                                 sizeof(SC_AK_FILE_STRU),
                                 (VOS_CHAR*)pucPubContent,
                                 (VOS_INT*)pulPubLen);

    /* 底软返回失败 */
    if ((VOS_OK != lResult) || (ulLen != *pulPubLen))
    {
        VOS_MemFree(WUEPS_PID_OM, pstAKFile);

        SC_ERROR2_LOG("SC_COMM_RsaDecrypt: CRYPTO_RSA_DECRYPT is failed.", lResult, *pulPubLen);

        return SC_ERROR_CODE_RSA_DECRYPT_FAIL;
    }

    VOS_MemFree(WUEPS_PID_OM, pstAKFile);

    return SC_ERROR_CODE_NO_ERROR;
}
コード例 #11
0
VOS_VOID USIMM_VsimDecodeCardType(VOS_CHAR                  *pucStr,
                                            VOS_UINT32                  ulStrLen,
                                            USIMM_CARD_TYPE_ENUM_UINT32 *pulCardType)
{
    VOS_CHAR                    *pcTemp;
    VOS_UINT32                  ulDataLen;

    *pulCardType = USIMM_CARD_NOCARD;   /*默认返回无卡*/

    if(VOS_NULL == ulStrLen)
    {
        USIMM_ERROR_LOG("USIMM_VSIMDecodeCardType: Card Type is NULL!");

        return;
    }

    /*申请用于存放卡类型的内存*/
    pcTemp = (VOS_CHAR*)VOS_MemAlloc(WUEPS_PID_USIM, DYNAMIC_MEM_PT, ulStrLen);

    if(VOS_NULL_PTR == pcTemp)
    {
        USIMM_ERROR_LOG("USIMM_VSIMDecodeCardType: VOS_MemAlloc is NULL!");

        return;
    }

    /*过滤特殊字符*/
    OAM_XML_GetStrContent(pucStr, ulStrLen, pcTemp, &ulDataLen);

    if(VOS_NULL == ulDataLen)
    {
        USIMM_ERROR_LOG("USIMM_VSIMDecodeCardType: Card Type Content is NULL!");

        VOS_MemFree(WUEPS_PID_USIM, pcTemp);

        return;
    }

/*lint -e418*/
    if(VOS_OK == VOS_MemCmp(USIMM_VSIM_USIM_STR, pcTemp, ulDataLen))
    {
        *pulCardType = USIMM_CARD_USIM;
    }
    else if(VOS_OK == VOS_MemCmp(USIMM_VSIM_SIM_STR, pcTemp, ulDataLen))
/*lint +e418*/
    {
        *pulCardType = USIMM_CARD_SIM;
    }
    else
    {
        USIMM_ERROR_LOG("USIMM_VSIMDecodeCardType: Card Type is not support!");
    }

    VOS_MemFree(WUEPS_PID_USIM, pcTemp);    /*释放用于存放卡类型的内存*/

    return;
}
コード例 #12
0
VOS_UINT32 OM_AcpuGetNvIdList(APP_OM_MSG_EX_STRU *pstAppToOmMsg,
                                          VOS_UINT16 usReturnPrimId)
{
    VOS_UINT32              ulNvNum;
    VOS_UINT32              ulTotalLen;
    OM_APP_MSG_EX_STRU      *pstOmToAppMsg;
    VOS_UINT32              ulResult;
    OM_APP_GET_NV_LIST_STRU *pstOmGetNvList;

    ulNvNum = NV_GetNVIdListNum();
    /*No NV exist*/
    if (0 == ulNvNum)
    {
        OM_AcpuSendResultChannel(pstAppToOmMsg->ucCpuId, pstAppToOmMsg->ucFuncType, VOS_ERR, usReturnPrimId);
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "OM_AcpuGetNvIdList:No NV exist.\n");
        return VOS_ERR;
    }

    /*APP_HEAD + Result + NV nums + NV ID/LEN lists*/
    ulTotalLen = sizeof(OM_APP_MSG_EX_STRU) + sizeof(VOS_UINT32)
                        + (ulNvNum*sizeof(NV_LIST_INFO_STRU));

    pstOmToAppMsg = (OM_APP_MSG_EX_STRU*)VOS_MemAlloc(
                                   WUEPS_PID_OM, DYNAMIC_MEM_PT, ulTotalLen);

    if (VOS_NULL_PTR == pstOmToAppMsg)
    {
        OM_AcpuSendResultChannel(pstAppToOmMsg->ucCpuId, pstAppToOmMsg->ucFuncType, VOS_ERR, usReturnPrimId);
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "OM_AcpuGetNvIdList:VOS_MemAlloc Fail.");
        return VOS_ERR;
    }

    pstOmGetNvList = (OM_APP_GET_NV_LIST_STRU*)(pstOmToAppMsg->aucPara);

    /*获取每个NV项的ID和长度*/
    ulResult = NV_GetNVIdList(pstOmGetNvList->astNvInfo);
    if (NV_OK != ulResult)
    {
        VOS_MemFree(WUEPS_PID_OM, pstOmToAppMsg);

        OM_AcpuSendResultChannel(pstAppToOmMsg->ucCpuId, pstAppToOmMsg->ucFuncType, ulResult, usReturnPrimId);
        PS_LOG(WUEPS_PID_OM, 0, PS_PRINT_ERROR, "OM_AcpuGetNvIdList:VOS_MemAlloc Fail.");
        return VOS_ERR;
    }

    /*填写执行结果和NV项数目*/
    pstOmGetNvList->ulErrorCode     = VOS_OK;
    pstOmGetNvList->usCount         = (VOS_UINT16)ulNvNum;
    pstOmGetNvList->ucMsgIndex      = 1;    /*分包索引,先默认为1*/
    pstOmGetNvList->ucTotalMsgCnt   = 1;    /*分包总数,先默认为1*/

    pstOmToAppMsg->usLength = (VOS_UINT16)(ulTotalLen - VOS_OM_HEADER_LEN);
    OM_AcpuSendContentChannel(pstAppToOmMsg->ucCpuId, pstAppToOmMsg->ucFuncType, (OM_RSP_PACKET_STRU *)pstOmToAppMsg, usReturnPrimId);
    VOS_MemFree(WUEPS_PID_OM, pstOmToAppMsg);
    return VOS_OK;
}
コード例 #13
0
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;
}
/*****************************************************************************
 函 数 名  : ftm_mailbox_msgproc
 功能描述  : 邮箱数据读取
 输入参数  : enMbxType 邮箱数据类型
 输出参数  : 无
 返 回 值  : 0无数据,大于0为邮箱数据长度
*****************************************************************************/
VOS_UINT32 ftm_mailbox_msgproc(MAILBOX_SERVICE_TYPE_E enMbxType)
{
    VOS_UINT32 ulRet      = 0;
    VOS_UINT32 ulMsgSize  = 0;
    VOS_VOID* pMailBoxMsg = NULL;
    MsgBlock* pMsgBlock   = NULL;
    VOS_UINT32 ret = ERR_MSP_UNKNOWN;

    /* 读取消息长度 */
    HAL_SDMLOG("[%s] BEIGN TO READ DATA.\n", __FUNCTION__);
    ulMsgSize = BSP_MailBox_ComMsgSize(enMbxType);
    HAL_SDMLOG("[%s] BEIGN TO READ DATA.LEN = %d\n", __FUNCTION__,ulMsgSize);
    if(ulMsgSize == 0 )
    {
        return ulMsgSize;
    }

    pMailBoxMsg = VOS_MemAlloc(MSP_SYS_FTM_PID, ((DYNAMIC_MEM_PT)), ulMsgSize);
    if(NULL == pMailBoxMsg)
    {
        HAL_SDMLOG("[%s] VOS_MemAlloc failed.\n", __FUNCTION__);
        return 0;
    }

    /* 读取邮箱数据 */
    ulRet = BSP_MailBox_ComMsgRead(enMbxType, pMailBoxMsg, ulMsgSize, EN_MAILBOX_SLEEP_WAKEUP);
    if(ulRet != BSP_OK)
    {
        VOS_MemFree(MSP_SYS_FTM_PID, pMailBoxMsg);
        return 0;
    }

    /* 发送消息到MSP_SYS_FTM_PID任务 */
    pMsgBlock = (MsgBlock*)VOS_AllocMsg(MSP_SYS_FTM_PID, sizeof(OS_MSG_STRU));

    if (pMsgBlock)
    {
        OS_MSG_STRU* pMsg = (OS_MSG_STRU*)pMsgBlock->aucValue;

        pMsgBlock->ulReceiverPid = MSP_SYS_FTM_PID;
        pMsgBlock->ulSenderPid   = MSP_SYS_FTM_PID;
        pMsg->ulMsgId  = ID_MSG_L1A_CT_IND;
        pMsg->ulParam1 = pMailBoxMsg;
        pMsg->ulParam2 = ulMsgSize;

        ret = VOS_SendMsg(MSP_SYS_FTM_PID, pMsgBlock);
        if (ret != VOS_OK)
        {
            HAL_SDMLOG("[%s] send msg to MSP_SYS_FTM_PID FAILED \n",  __FUNCTION__);
        }
    }

    return ulMsgSize;
}
コード例 #15
0
VOS_UINT OM_ComRx_ICC_OM_CB(VOS_UINT ulChannelID,VOS_INT lLen)
{
    VOS_UINT32 ulResult;
    VOS_UINT8 *pucData;

    if (lLen <= 0)
    {
        LogPrint("OM_ComRx_ICC_OM_CB: The Data Len is 0.\n");

        g_stPcToUeErrRecord.stICCRecFailInfo.ulICCOmParaErrNum++;

        return VOS_ERR;
    }

    if (VOS_NULL_PTR == g_astOMComRxCBTable[OM_OM_ICC_CHANNEL])  /*当前回调函数为空*/
    {
        LogPrint("OM_ComRx_ICC_OM_CB The CB Function is Empty.\n");

        g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecLen += lLen;
        g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecMsgNum++;
        g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecSlice = OM_GetSlice();

        pucData = (VOS_UINT8 *)VOS_MemAlloc(WUEPS_PID_OM, DYNAMIC_MEM_PT, (VOS_UINT32)lLen);

        if(VOS_NULL_PTR != pucData)
        {
            DRV_UDI_READ(g_astOMCCPUIccCtrlTable[OM_OM_ICC_CHANNEL].UDIHdle, pucData, (VOS_UINT32)lLen);
            VOS_MemFree(WUEPS_PID_OM, pucData);
        }

        return VOS_OK;
    }

    ulResult = OM_ComRx_ICCDataRec(OM_OM_ICC_CHANNEL, lLen);

    if (VOS_ERR == ulResult)
    {
        LogPrint("OM_ComRx_ICC_OM_CB The Send Data is Failed.\n");

        g_stPcToUeErrRecord.stICCRecFailInfo.ulICCOmRecErrLen += lLen;
        g_stPcToUeErrRecord.stICCRecFailInfo.ulICCOmRecErrMsgNum++;
        g_stPcToUeErrRecord.stICCRecFailInfo.ulICCOmRecErrSlice = OM_GetSlice();
    }
    else
    {
        g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecLen += lLen;
        g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecMsgNum++;
        g_stPcToUeSucRecord.stICCRecSUCInfo.ulICCOmRecSlice = OM_GetSlice();
    }

    return ulResult;
}
コード例 #16
0
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;


}
コード例 #17
0
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;
}
コード例 #18
0
VOS_UINT32 USIMM_AddVsimVerifyHashPara(VOS_CHAR *pucFileStr, VOS_UINT32 ulFileLen, VOS_CHAR *pcValue, VOS_UINT32 ulValueLen)
{
    VOS_UINT32      ulContentLen;
    VOS_CHAR        *pcContent;

    if((VOS_NULL_PTR == pcValue)||(VOS_NULL == ulValueLen))
    {
        USIMM_ERROR_LOG("USIMM_AddVsimVerifyHashPara: Para is NULL!");
        return VOS_ERR;
    }

    pcContent = (VOS_CHAR*)VOS_MemAlloc(WUEPS_PID_USIM, DYNAMIC_MEM_PT, ulValueLen);

    if(VOS_NULL_PTR == pcContent)
    {
        USIMM_ERROR_LOG("USIMM_AddVsimVerifyHashPara: VOS_MemAlloc is NULL!");
        return VOS_ERR;
    }

    /*过滤特殊字符*/
    OAM_XML_FilterStrInvalidChar(pcValue, ulValueLen, pcContent, &ulContentLen);

    if(VOS_NULL == ulContentLen)
    {
        USIMM_ERROR_LOG("USIMM_AddVsimVerifyHashPara: OAM_XML_GetStrContent return 0!");

        VOS_MemFree(WUEPS_PID_USIM, pcContent);

        return VOS_ERR;
    }

    if(USIMM_VSIM_SIM_KEY_HASH_LEN < ulContentLen) /*检查Base16编码长度,不能超过当前全局变量的最大值*/
    {
        USIMM_ERROR_LOG("USIMM_AddVsimVerifyHashPara: Base16Decode Result is too long!");

        VOS_MemFree(WUEPS_PID_USIM, pcContent);

        return VOS_ERR;
    }

    VOS_MemCpy(g_stUSIMMVSimAuthInfo.aucSimKeyHash, pcContent, ulContentLen);

    VOS_MemFree(WUEPS_PID_USIM, pcContent);

    return VOS_OK;
}
コード例 #19
0
/*****************************************************************************
 Function Name   : diag_FsScanProc
 Description     : 扫描所有文件或文件夹信息
 Input           :VOS_UINT8* pstReq
                VOS_UINT32 ulCmdId
 Output          : None
 Return          : VOS_UINT32

 History         :
    1.w00182550      2013-1-29  Draft Enact

*****************************************************************************/
VOS_UINT32 diag_FsScanProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    DIAG_CMD_FS_SCAN_DIR_REQ* pstFsReq = NULL;
    DIAG_CMD_FS_SCAN_DIR_CNF* pstFsCnf = NULL;
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT32              ulTotalNum;
    VOS_UINT32              ulTotalSize;

    pstFsReq = (DIAG_CMD_FS_SCAN_DIR_REQ*)(DIAG_OFFSET_HEAD_GET_DATA(pstReq));

   /*得到目录内,文件和文件夹的总个数、总的名字长度*/
    if(VOS_OK != diag_FsGetDirInfo(pstFsReq->szDirectory,&ulTotalNum))
    {
        return VOS_ERR;
    }

    /*计算返回给工具侧消息包的长度*/
    ulTotalSize = (ulTotalNum* sizeof(DIAG_DIR_FILE_INFO_STRU)+ sizeof(DIAG_CMD_FS_SCAN_DIR_CNF));

    pstFsCnf = (DIAG_CMD_FS_SCAN_DIR_CNF*)VOS_MemAlloc(diag_GetAgentPid(), DYNAMIC_MEM_PT, ulTotalSize);
    if (VOS_NULL_PTR == pstFsCnf)
    {
        return VOS_ERR;
    }

    /*获取每个文件和文件夹的信息*/
    /*lint -save -e539*/
	if(ulTotalNum>0)
	{
    	ret = diag_FsGetItemInfo(pstFsReq->szDirectory,pstFsCnf->stDirInfo);
	}
    /*lint -restore*/

    pstFsCnf->ulRet = ret;
    pstFsCnf->ulDirNum= ulTotalNum;
    pstFsCnf->ulDirInfoLen= ulTotalNum * sizeof(DIAG_DIR_FILE_INFO_STRU);

    /*打包回复给FW*/
    ret = diag_AgentCnfFun((VOS_UINT8*)pstFsCnf,ulCmdId,ulTotalSize);
    /*lint -save -e50*/
    VOS_MemFree(diag_GetAgentPid(), pstFsCnf);
    /*lint -restore*/
    return ret;

}
コード例 #20
0
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;
}
コード例 #21
0
VOS_UINT32 VOS_ICC_Init(VOS_VOID)
{
   OM_ICC_UDI_CTRL_STRU                astCCPUICCCtrlTable;

    /*初始化 ICC通道*/
    /*lint -e534*/
    VOS_MemSet((&astCCPUICCCtrlTable), 0, sizeof(astCCPUICCCtrlTable));
    /*lint +e534*/

    astCCPUICCCtrlTable.pstICCAttr = (ICC_CHAN_ATTR_S*)VOS_MemAlloc(CCPU_PID_PAM_OM,
                                                              STATIC_MEM_PT,
                                                              sizeof(ICC_CHAN_ATTR_S));
    if(VOS_NULL_PTR == astCCPUICCCtrlTable.pstICCAttr)
    {
        return VOS_ERR;
    }

    astCCPUICCCtrlTable.enICCId               = UDI_ICC_GUOM4;
    astCCPUICCCtrlTable.pstICCAttr->read_cb   = V_ICC_OSAMsg_CB;

    astCCPUICCCtrlTable.pstICCAttr->u32Priority    = OM_ICC_CHANNEL_PRIORITY;  /* 统一使用最高优先级 */
    astCCPUICCCtrlTable.pstICCAttr->u32TimeOut     = OM_ICC_HANDSHAKE_TIME_MAX;
    astCCPUICCCtrlTable.pstICCAttr->u32FIFOInSize  = OSA_ICC_BUFFER_SIZE;
    astCCPUICCCtrlTable.pstICCAttr->u32FIFOOutSize = OSA_ICC_BUFFER_SIZE;
    astCCPUICCCtrlTable.pstICCAttr->enChanMode     = ICC_CHAN_MODE_PACKET;
    astCCPUICCCtrlTable.pstICCAttr->event_cb       = VOS_ICCError_CB;
    astCCPUICCCtrlTable.pstICCAttr->write_cb       = VOS_NULL_PTR;

    if (VOS_ERROR == DRV_ICC_OPEN(astCCPUICCCtrlTable.enICCId, astCCPUICCCtrlTable.pstICCAttr))
    {
        /* 打开失败时记录当前ICC通道信息 */
        VOS_ProtectionReboot(OM_APP_ICC_INIT_ERROR, THIS_FILE_ID, __LINE__, VOS_NULL_PTR,0);
        return VOS_ERR;
    }

    VOS_IccDebugInfoInit();

    return VOS_OK;
}
コード例 #22
0
VOS_UINT32 SCM_SoftDecodeCfgHdlcInit(OM_HDLC_STRU *pstHdlc)
{
    /* 申请用于HDLC解封装的缓存 */
    pstHdlc->pucDecapBuff    = (VOS_UINT8 *)VOS_MemAlloc(MSP_PID_DIAG_APP_AGENT, STATIC_MEM_PT, SCM_DATA_RCV_PKT_SIZE);

    if (VOS_NULL_PTR == pstHdlc->pucDecapBuff)
    {
        /*lint -e534*/
        vos_printf("SCM_SoftDecodeCfgHdlcInit: Alloc Decapsulate buffer fail!.\n");
        /*lint +e534*/

        return VOS_ERR;
    }

    /* HDLC解封装缓存长度赋值 */
    pstHdlc->ulDecapBuffSize = SCM_DATA_RCV_PKT_SIZE;

    /* 初始化HDLC解封装控制上下文 */
    Om_HdlcInit(pstHdlc);

    return VOS_OK;
}
コード例 #23
0
VOS_VOID OM_SndPrintfToOm(VOS_CHAR *pcData, VOS_UINT32 ulLength)
{
    VOS_UINT32          ulRet;
    OM_APP_TRACE_STRU   *pstAppMsg;

    /* 分配消息空间 */
    pstAppMsg = (OM_APP_TRACE_STRU*)VOS_MemAlloc(WUEPS_PID_OM,
                                         DYNAMIC_MEM_PT, ulLength + OM_APP_TRACE_LEN);
    if (VOS_NULL_PTR == pstAppMsg)
    {
        g_ulPrintfErrType = OM_ERR_MALLOC;
        return;
    }

    /* 拷贝消息内容 */
    VOS_MemCpy(pstAppMsg->aucPara, pcData, ulLength);

    /* 添加消息头部字段 */
    pstAppMsg->stAppHeader.ucFuncType   = OM_PRINTF_FUNC;
    pstAppMsg->stAppHeader.usLength     = ((VOS_UINT16)ulLength + OM_APP_TRACE_LEN)
                                                                - VOS_OM_HEADER_LEN;
    pstAppMsg->usPrimId                 = OM_APP_OM_PRINTF_IND;
    pstAppMsg->usToolId                 = 0;

    /* 添加消息序号和时间戳 */
    OM_AcpuAddSNTime(&(pstAppMsg->stAppHeader.ulSn), &(pstAppMsg->stAppHeader.ulTimeStamp));

    /* 调用OM API将数据放入OM链路 ringbuffer*/
    ulRet = OM_AcpuSendData((OM_RSP_PACKET_STRU*)pstAppMsg, (VOS_UINT16)(ulLength + OM_APP_TRACE_LEN));
    if (VOS_OK != ulRet)
    {
        g_ulPrintfErrType = OM_ERR_SENDTOOMBUF;
    }

    VOS_MemFree(WUEPS_PID_OM, pstAppMsg);

    return;
}
コード例 #24
0
VOS_UINT32 at_ftm_scellinfoRdFun(VOS_VOID* pParam)
{
    VOS_UINT32 ret                           = ERR_MSP_SUCCESS;
    FTM_RD_SCELLINFO_CNF_STRU  * pstCnf = NULL;

    pstCnf = (FTM_RD_SCELLINFO_CNF_STRU *)VOS_MemAlloc(MSP_SYS_FTM_PID ,(DYNAMIC_MEM_PT), sizeof(FTM_RD_SCELLINFO_CNF_STRU));

    if (NULL != pstCnf)
    {
        MSP_MEMSET(pstCnf, 0x00, sizeof(FTM_RD_SCELLINFO_CNF_STRU));
        ret = DHI_getCurrentCellInfo(&(pstCnf->scellinfoStru));
        pstCnf->ulErrCode = ret;
        ret = ftm_SendDataMsg(MSP_SYS_FTM_PID, WUEPS_PID_AT, ID_MSG_FTM_RD_SCELLINFO_CNF,
            (VOS_UINT32) pstCnf, sizeof(FTM_RD_SCELLINFO_CNF_STRU));
        VOS_MemFree(MSP_SYS_FTM_PID, pstCnf);
    }
	else
	{
		ret = ERR_MSP_NO_MORE_MEMORY;
	}

    return ret;
}
コード例 #25
0
VOS_VOID SI_STK_DecodeCCRspSpecial(
    VOS_UINT32                          ulDataLen,
    VOS_UINT8                           *pucCmdData,
    SI_STK_ENVELOPE_RSP_STRU            *pstRspData)
{
    VOS_UINT8   aucTagList[]={ADDRESS_TAG,SS_STRING_TAG,USSD_STRING_TAG,PDP_CONTEXT_ACTIVATION_PAR_TAG,EPSPDN_ACTIVE_PARA_TAG};
    VOS_UINT32  i;
    VOS_UINT32  ulCCTagOffset;

    for(i=0; i<sizeof(aucTagList); i++)
    {
        ulCCTagOffset = SI_STKFindTag(aucTagList[i], pucCmdData, ulDataLen, 1);

        if(ulCCTagOffset != SI_TAGNOTFOUND)
        {
            pstRspData->uResp.CallCtrlRsp.SpecialData.ucTag = pucCmdData[ulCCTagOffset-1] & 0x7F;
            pstRspData->uResp.CallCtrlRsp.SpecialData.ucLen = pucCmdData[ulCCTagOffset];
            pstRspData->uResp.CallCtrlRsp.SpecialData.pValue
                = (SI_UINT8*)VOS_MemAlloc(MAPS_STK_PID, DYNAMIC_MEM_PT, pucCmdData[ulCCTagOffset]);

            if(VOS_NULL_PTR != pstRspData->uResp.CallCtrlRsp.SpecialData.pValue)
            {
                /*lint -e534*/
                VOS_MemCpy(pstRspData->uResp.CallCtrlRsp.SpecialData.pValue,
                    &pucCmdData[ulCCTagOffset+1], pucCmdData[ulCCTagOffset]);
                /*lint +e534*/
            }

            pstRspData->uResp.CallCtrlRsp.OP_SepcialData = 1;

            return;
        }
    }

    return;
}
コード例 #26
0
VOS_UINT32 CBT_GreenChannel(CBT_MODEM_SSID_STRU stModemSsid, CBT_COMPONENT_MODE_STRU stCompMode, VOS_UINT16 usPrimId,
                            VOS_UINT8 *pucData, VOS_UINT16 usLen)
{
    CBT_UNIFORM_MSG_STRU *           pstAppMsg;
    VOS_UINT32                       ulResult;

    pstAppMsg = (CBT_UNIFORM_MSG_STRU *)VOS_MemAlloc(PC_PID_TOOL,
                                         DYNAMIC_MEM_PT, usLen + CBT_MSG_HEAD_EX_LENGTH);
    if (NULL == pstAppMsg)
    {
        PS_LOG(CCPU_PID_CBT, 0, PS_PRINT_ERROR, "CBT_GreenChannel:VOS_MemAlloc.\n");
        return VOS_ERR;
    }

    CBT_ResetMsgHead(pstAppMsg);

    pstAppMsg->stMsgHeader.stModemSsid = stModemSsid;
    pstAppMsg->usMsgId                 = usPrimId;
    pstAppMsg->stCompMode              = stCompMode;
    pstAppMsg->ulMsgLength             = usLen;

    /*假如内容长度为0,表示没有发送内容*/
    if ((0 != usLen) && (VOS_NULL_PTR != pucData))
    {
        /*lint -e534*/
        VOS_MemCpy(pstAppMsg->aucPara, pucData, usLen);
        /*lint +e534*/
    }

    ulResult = CBT_SendData((CBT_UNIFORM_MSG_STRU *)pstAppMsg, usLen + CBT_MSG_HEAD_EX_LENGTH);
    /*lint -e534*/
    VOS_MemFree(CCPU_PID_CBT, pstAppMsg);
    /*lint +e534*/

    return ulResult;
}
コード例 #27
0
VOS_UINT32  TTF_RING_Q_Init(VOS_UINT32 ulPid, TTF_RING_Q_ST *pstRingQ, VOS_UINT32 ulMaxSize )
{
    VOS_VOID **ppNode;


    if (VOS_NULL_PTR == pstRingQ )
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: pstRingQ is Null !");
        return PS_FAIL;
    }

    if ( 2 > ulMaxSize)
    {
        PS_LOG1(ulPid, 0, PS_PRINT_WARNING, "Warning: RingQ  ulMaxSize<1> less than 2 !",(VOS_INT32)ulMaxSize);
        return PS_FAIL;
    }

    #if( VOS_OS_VER == VOS_WIN32 )
    ppNode  = (VOS_VOID **)malloc(sizeof(VOS_VOID *) * ulMaxSize);
    #else
    ppNode  = (VOS_VOID **)VOS_MemAlloc(ulPid, (STATIC_MEM_PT), (sizeof(VOS_VOID *) * ulMaxSize));
    #endif

    if(VOS_NULL_PTR == ppNode )
    {
        PS_LOG(ulPid, 0, PS_PRINT_WARNING, "Warning: RingQ Init Malloc Fail!");
        return PS_FAIL;
    }

    pstRingQ->ppNode       = ppNode;
    pstRingQ->ulFront      = 0;
    pstRingQ->ulRear       = 0;
    pstRingQ->ulMaxSize    = ulMaxSize;
    return PS_SUCC;

} /* TTF_RING_Q_Init */
VOS_UINT32 diag_FsExportProc(VOS_UINT8* pstReq,VOS_UINT32 ulCmdId)
{
    //DIAG_CMD_FS_EXPORT_REQ* pstFsReq = NULL;
    DIAG_CMD_FS_EXPORT_CNF *pstFsCnf = NULL;
    VOS_UINT32 ret = ERR_MSP_SUCCESS;
    VOS_UINT32 ulReadSize = 0;
#if(VOS_OS_VER == VOS_LINUX)
    mm_segment_t old_fs;
#endif


    if (DIAG_FILE_NULL == g_stDiagFileInfo.lFile)
    {

		diag_fs_log();
         return ERR_MSP_FAILURE;
    }

    /*停止定时器*/
    VOS_StopRelTimer(&g_stDiagFileInfo.hTimer);
	diag_fs_log();

    pstFsCnf = (DIAG_CMD_FS_EXPORT_CNF*)VOS_MemAlloc(diag_GetAgentPid(), DYNAMIC_MEM_PT, sizeof(DIAG_CMD_FS_EXPORT_CNF)+DIAG_TRANSFER_BLOCK_MAX_SIZE);
    if (VOS_NULL_PTR == pstFsCnf)
    {

		diag_fs_log();
        diag_FsClose();
        return ERR_MSP_FAILURE;

    }

#if(VOS_OS_VER == VOS_LINUX)
    old_fs = get_fs();
    set_fs(KERNEL_DS);
#endif

#if(VOS_OS_VER == VOS_LINUX)
    ulReadSize = (VOS_UINT32)DIAG_FS_READ(g_stDiagFileInfo.lFile,(VOS_CHAR*)pstFsCnf + sizeof(DIAG_CMD_FS_EXPORT_CNF), DIAG_TRANSFER_BLOCK_MAX_SIZE);
#else
    ulReadSize = (VOS_UINT32)DIAG_FS_READ((FILE *)g_stDiagFileInfo.lFile,(VOS_CHAR*)pstFsCnf + sizeof(DIAG_CMD_FS_EXPORT_CNF), DIAG_TRANSFER_BLOCK_MAX_SIZE);
#endif

	diag_fs_log();

#if(VOS_OS_VER == VOS_LINUX)
    set_fs(old_fs);
#endif

    /*读取文件出现错误*/
    if (DIAG_FS_ERROR == (VOS_INT32)ulReadSize)
    {

		diag_fs_log();
        VOS_MemFree(diag_GetAgentPid(),pstFsCnf);
        diag_FsClose();
        return ERR_MSP_FAILURE;

    }

    /*表明已经没有内容可以读取,文件内容全部读完*/
    if (0 == ulReadSize)
    {

		diag_fs_log();
        diag_FsClose();
    }
    else
    {

		diag_fs_log();
        /*启动定时器*/
        g_stDiagFileInfo.hTimer = VOS_NULL_PTR;
        ret = VOS_StartRelTimer(&g_stDiagFileInfo.hTimer, diag_GetAgentPid(), DIAG_CMD_FILE_OPS_TIME_OUT_LEN, 0, DIAG_TMR_FILE_OP_TIMEOUT_PARAM, VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION);
        if(ret != ERR_MSP_SUCCESS)
        {
            diag_printf("VOS_StartRelTimer fail [%s]\n", __func__);
        }

	}

    pstFsCnf->ulRet = ret;
    pstFsCnf->ulSize = ulReadSize;

    /*打包回复给FW*/
    ret = diag_AgentCnfFun((VOS_UINT8*)pstFsCnf,ulCmdId,sizeof(DIAG_CMD_FS_EXPORT_CNF)+ulReadSize);
    VOS_MemFree(diag_GetAgentPid(),pstFsCnf);

	diag_fs_log();
    return ret;

}
VOS_UINT32  diag_FsGetDirInfo(VOS_CHAR *pDirName, VOS_UINT32 *pulTotalNum)
{
    VOS_INT32 				dir_handle =0;
	VOS_INT32				nRead =0;
	VOS_INT32				nCount =0;
	VOS_UINT32				i=0;
	VOS_UINT8*				buf =NULL;

    DIAG_DIRENT_STRU        *pstTmpDirent;
    mm_segment_t old_fs;

    old_fs = get_fs();
    set_fs(KERNEL_DS);

    /*打开目录*/
    if((dir_handle = DIAG_FS_OPENDIR((VOS_CHAR*)pDirName,DIAG_FS_RDONLY|DIAG_FS_DIRECTORY,0))< 0)
    {
        set_fs(old_fs);
		printk( "[%s]DIAG_FS_OPENDIR error!",__FUNCTION__);
        return VOS_ERR;
    }

	buf =(VOS_UINT8*)VOS_MemAlloc(diag_GetAgentPid(), DYNAMIC_MEM_PT,MSP_DF_DIR_BUF_LEN);
    if(NULL == buf)
    {
        printk( "[%s]Alloc mem error!",__FUNCTION__);
		DIAG_FS_CLOSEDIR(dir_handle);
		set_fs(old_fs);
        return VOS_ERR;
    }
	nRead = DIAG_FS_GETDENTS(dir_handle, (struct linux_dirent __user *)buf, MSP_DF_DIR_BUF_LEN);

	if(-1 == nRead)
	{
		printk("[%s]dents error,nRead=%d!\n",__FUNCTION__,(VOS_INT)nRead);
		*pulTotalNum =0;
		VOS_MemFree(diag_GetAgentPid(), buf);
		DIAG_FS_CLOSEDIR(dir_handle);
		set_fs(old_fs);
		return VOS_ERR;
	}

	if(0 == nRead)
	{
		diag_printf("[%s]dents zero!\n",__FUNCTION__);
		*pulTotalNum = 0;
		VOS_MemFree(diag_GetAgentPid(), buf);
		DIAG_FS_CLOSEDIR(dir_handle);
		set_fs(old_fs);
		return VOS_OK;
	}

	for(i=0; i<(VOS_UINT32)nRead;)
	{
	    pstTmpDirent = (DIAG_DIRENT_STRU*)(buf + i);
		i += pstTmpDirent->d_reclen;

		if((0 == VOS_StrCmp((char *) pstTmpDirent->d_name, "."))
			||(0 == VOS_StrCmp ((char *) pstTmpDirent->d_name, "..")))
        {
        	diag_printf("diag_FsGetDirInfo:d_name=%S!\n",pstTmpDirent->d_name);
            continue;
        }
#if 0
	    if (nCount>=FILENAME_NUM_MAX)
        {
        	DIAG_FS_CLOSEDIR(dir_handle);
	        set_fs(old_fs);
            return VOS_ERR;
        }
#endif
		nCount++;
	}

	*pulTotalNum = nCount;

     /*关闭目录*/
    if (DIAG_FS_ERROR == DIAG_FS_CLOSEDIR(dir_handle))
    {
        VOS_MemFree(diag_GetAgentPid(), buf);
    	printk("[%s]DIAG_FS_CLOSEDIR zero!\n",__FUNCTION__);
        set_fs(old_fs);
        return VOS_ERR;
    }

    VOS_MemFree(diag_GetAgentPid(), buf);

    set_fs(old_fs);
    return VOS_OK;
}
VOS_UINT32 diag_FsGetItemInfo(VOS_CHAR *pDirectory,DIAG_DIR_FILE_INFO_STRU *pstDirFileInfo)
{
    /*lint -save -e958*/
    DIAG_DIRENT_STRU        *pstTmpDirent;
    DIAG_STAT_STRU           stStat;
    VOS_UINT8              *pDirName;
    VOS_UINT16              usDirLen;
    VOS_UINT32              ultemp_len = 0;
    VOS_INT32 				dir_handle =0;
    /*lint -restore*/
    /*再次打开目录*/
    dir_handle = (VOS_INT32)DIAG_FS_OPENDIR(pDirectory,DIAG_FS_RDONLY|DIAG_FS_DIRECTORY,0);  /* [false alarm]:屏蔽Fortify */
    if(dir_handle < 0)
    {
        return VOS_ERR;
    }

    /*分配空间用来存放文件或文件夹的路径,加1是因为后面需要添加斜杠*/
    pDirName = (VOS_UINT8*)VOS_MemAlloc(diag_GetAgentPid(), DYNAMIC_MEM_PT,MSP_DF_DIR_MAX_LEN);
    if (VOS_NULL_PTR == pDirName)
    {
        DIAG_FS_CLOSEDIR(dir_handle);
        return VOS_ERR;

    }

    /*将目录路径拷贝进文件路径中*/
    usDirLen = (VOS_UINT16)VOS_StrLen((VOS_CHAR*)pDirectory);
    VOS_MemCpy(pDirName, pDirectory, usDirLen);

    /*由于目录路径是不以斜杠结束,在与文件名结合时,需要添加斜杠*/
    pDirName[usDirLen] = '/';
    usDirLen++;

    do
    {
        /*遍历整个pstDir指向路径中的所有文件和文件夹*/
        pstTmpDirent = (DIAG_DIRENT_STRU *)DIAG_FS_READDIR(dir_handle);

        /*readdir的返回值为空,表明目录浏览完毕*/
        /*lint -save -e830*/
        if (VOS_NULL_PTR != pstTmpDirent)
        /*lint -restore*/
        {
            /*得到文件或文件夹名的长度*/
            ultemp_len = (VOS_UINT16)VOS_StrLen(pstTmpDirent->d_name);  /* [false alarm]:屏蔽Fortify */

            /*由于文件或文件夹路径需要以'\0'作为结束,所以在Copy时,长度加1*/
            VOS_MemCpy(pDirName + usDirLen,pstTmpDirent->d_name, ultemp_len + 1);

            /*通过stat获取文件或文件夹的信息*/
            /*lint -save -e628*/
            if (DIAG_FS_ERROR == DIAG_FS_STAT((VOS_CHAR*)pDirName, &stStat))/*lint !e628*/
            {
            /*lint -restore*/
                pstDirFileInfo->ulItemType = DIAG_FS_ITEM_FILE;
                pstDirFileInfo->st_size    = 0;
                pstDirFileInfo->st_mode    = 0;
                pstDirFileInfo->st_atime   = 0;
                pstDirFileInfo->st_mtime   = 0;
                pstDirFileInfo->st_ctime   = 0;
            }
            else
            {
                /*目录*/
                if (0 != (DIAG_IF_DIR&stStat.st_mode))
                {

                    pstDirFileInfo->ulItemType = DIAG_FS_ITEM_FOLDER;
                }
                /*文件*/
                else
                {
                    pstDirFileInfo->ulItemType = DIAG_FS_ITEM_FILE;
                }
                pstDirFileInfo->st_size   = (stStat.st_size & 0xFFFFFFFF);/* 目前文件大小不会超过32位大小 */
                pstDirFileInfo->st_atime  = (VOS_INT32)(stStat.st_atime);
                pstDirFileInfo->st_mtime  = (VOS_INT32)(stStat.st_mtime);
                pstDirFileInfo->st_ctime  = (VOS_INT32)(stStat.st_ctime);
                pstDirFileInfo->st_mode   = stStat.st_mode;
            }

            /*文件或文件夹名*/
            VOS_MemCpy(pstDirFileInfo->aucDirName, pstTmpDirent->d_name, ultemp_len +1);
            /* coverity[suspicious_pointer_arithmetic] */
            pstDirFileInfo = pstDirFileInfo + sizeof(DIAG_DIR_FILE_INFO_STRU );
        }
    }while(VOS_NULL_PTR != pstTmpDirent);

    VOS_MemFree(diag_GetAgentPid(), pDirName);
    DIAG_FS_CLOSEDIR(dir_handle);

    return VOS_OK;

}