Exemple #1
0
/*****************************************************************************
 Function Name   : diag_CfgResetAllSwt
 Description     : 重置开关状态
 Output          : None
 Return          : VOS_UINT32

 History         :
    1.w00182550      2012-12-1  Draft Enact

*****************************************************************************/
VOS_VOID diag_CfgResetAllSwt(VOS_VOID)
{

    /*清空空口开关等状态,清成1是因为DIAG初始化状态不能清*/
    g_ulDiagCfgInfo = 0x1;

    /*清空层间开关状态*/
    VOS_MemSet(g_LayerSrcModuleCfg,0,sizeof(g_LayerSrcModuleCfg));
    VOS_MemSet(g_LayerDecModuleCfg,0,sizeof(g_LayerDecModuleCfg));

    /*清空打印开关状态*/
    VOS_MemSet(g_PrintModuleCfg,0,sizeof(g_PrintModuleCfg));

    /*清空打印总开关状态*/
    g_PrintTotalCfg = DIAG_CFG_PRINT_TOTAL_MODULE_SWT_NOT_USE;

    /*清空用户面消息开关状态*/
    VOS_MemSet(g_stUserPlaneCfg,0,sizeof(g_stUserPlaneCfg));

    /*清空消息过滤开关状态*/
    VOS_MemSet(&g_stMsgCfg,0,sizeof(DIAG_CFG_LOG_CAT_CFG_STRU));


    return;
}
/*****************************************************************************
 函 数 名  : Log_SetPrintLev
 功能描述  : 设置模块的打印级别
 输入参数  : pstLogIdLevel - 指向工具侧发来的模块级别结构体的指针
             ulLength      - 数据的长度
 输出参数  : 无
 返 回 值  : VOS_OK  - 成功
             VOS_ERR - 失败

 修改历史      :
  1.日    期   : 2008年9月9日
    作    者   : 甘兰 47350
    修改内容   : 新生成函数,添加可维可测第三阶段需求
*****************************************************************************/
VOS_UINT32 Log_SetPrintLev(LOG_ID_LEVEL_STRU *pstLogIdLevel, VOS_UINT32 ulLength)
{
    VOS_UINT32         ulIndex;
    VOS_UINT32         ulModuleId;
    VOS_UINT32         ulModuleNum;
    LOG_LEVEL_EN       enPrintLev;

    /*检测参数的合法性*/
    if (VOS_ERR == Log_CheckPara(pstLogIdLevel, ulLength))
    {
        return VOS_ERR;
    }

    /*清空上次配置*/
    VOS_MemSet(g_aulLogPrintLevPsTable, 0, LOG_PS_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN));
    VOS_MemSet(g_aulLogPrintLevDrvTable, 0, LOG_DRV_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN));

    ulModuleNum = pstLogIdLevel->ulModuleNum;

    /*将每个模块的打印级别填入到全局过滤表中*/
    for (ulIndex = 0; ulIndex < ulModuleNum; ulIndex++)
    {
        ulModuleId = pstLogIdLevel->astModuleLev[ulIndex].ulModuleId;
        enPrintLev = pstLogIdLevel->astModuleLev[ulIndex].enPrintLev;

        Log_SetModuleIdLev((LOG_MODULE_ID_EN)ulModuleId, (LOG_SUBMOD_ID_EN)0, enPrintLev);
    }

    return VOS_OK;
}
VOS_UINT32 OM_AcpuEstablishReq(APP_OM_MSG_EX_STRU *pstAppToOmMsg,
                                           VOS_UINT16 usReturnPrimId)
{
    VOS_UINT32                          ulRet;
#if (FEATURE_ON == FEATURE_CBT_LOG)
    VOS_UINT32                          ulState;

    ulState = g_ulAcpuOMSwitchOnOff;
#endif

    VOS_MemSet(&g_stAcpuTraceEventConfig, 0, sizeof(OM_TRACE_EVENT_CONFIG_PS_STRU));
    VOS_MemSet(g_astOmPrintfOutPutLev, 0, OM_PRINTF_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN));
    VOS_MemSet(g_aulLogPrintLevPsTable, 0, LOG_PS_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN));
    VOS_MemSet(g_aulLogPrintLevDrvTable, 0, LOG_DRV_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN));

    /* 先断开链路 */
    g_ulAcpuOMSwitchOnOff = OM_STATE_IDLE;

#if(FEATURE_ON == FEATURE_SOCP_ON_DEMAND)
    OM_AcpuSocpVoteInfoAdd(OM_SOCPVOTE_CALLBEGIN);
    DRV_SOCP_VOTE(SOCP_VOTE_GU_OM_APP, SOCP_VOTE_FOR_WAKE);
    OM_AcpuSocpVoteInfoAdd(OM_SOCPVOTE_CALLEND);
#endif

    /* 以兼容校准工具,建链成功回复状态字0x02 */
    ulRet = 0x02;

    /* 给工具回复建链成功状态 */
    OM_AcpuSendResult(OM_QUERY_FUNC, ulRet, usReturnPrimId);

    /* 激活链路 */
    g_ulAcpuOMSwitchOnOff = OM_STATE_ACTIVE;

#if (FEATURE_ON == FEATURE_CBT_LOG)
    if ((OM_STATE_ACTIVE == ulState) && (OM_CBT_LOG_ENABLE_FLAG == g_ulCBTLogEnable))
    {
        return VOS_OK;
    }
#endif

    /* 通知CCPU链路状态 */
    if(VOS_OK != GU_OamSndPcMsgToCcpu((VOS_UINT8*)pstAppToOmMsg, sizeof(APP_OM_MSG_EX_STRU)))
    {
        /* 打印错误 */
        LogPrint("OM_AcpuEstablishReq: The ICC UDI Write is Error.\n");
    }

    return VOS_OK;
}
VOS_UINT32 CSIMA_SendTPDUOnBaseChan(CSIMA_CBP_CTPDU_MSG_STRU *pstCtpduMsg)
{
    CSIMA_CBP_RTPDU_MSG_STRU            stRtpdu;
    VOS_UINT32                          ulResult;
    USIMM_TPDU_DATA_STRU                stTPDU;

    VOS_MemSet(&stRtpdu, VOS_NULL, sizeof(stRtpdu));

    VOS_MemSet(&stTPDU, VOS_NULL, sizeof(stTPDU));

    stRtpdu.enIPCMsgId = CSIMA_CBP_UICC_RTPDU_MSG;

    /* 参数检查 */
    if (g_stCBPCardStatus.ucCSIMChanNum != pstCtpduMsg->ucChanNum)
    {
       /* 给CBP回复命令执行错误 */
       stRtpdu.usSWStatus = UIM_ERR_TIMEOUT;

       /* 调用CBPCA模块接口将数据发过去 */
       ulResult = CBPCA_SndDataToCbpca(WUEPS_PID_CSIMA,
                                       CSIMA_CBPCA_DATA_REQ,
                                       (VOS_UINT8 *)&stRtpdu,
                                       sizeof(stRtpdu));

        return ulResult;
    }

    VOS_MemCpy(stTPDU.aucTPDUHead, pstCtpduMsg->aucCTPDUHdr, USIMM_TPDU_HEAD_LEN);

    stTPDU.ulDataLen = pstCtpduMsg->usDataLen;
    stTPDU.pucData   = pstCtpduMsg->aucData;

    ulResult = USIMM_SendTPDUReq(WUEPS_PID_CSIMA, VOS_NULL, VOS_NULL_PTR, &stTPDU);

    if (VOS_OK != ulResult)
    {
        /* 给CBP回复命令执行错误 */
        stRtpdu.usSWStatus = UIM_ERR_TIMEOUT;

        /* 调用CBPCA模块接口将数据发过去 */
        ulResult = CBPCA_SndDataToCbpca(WUEPS_PID_CSIMA,
                                        CSIMA_CBPCA_DATA_REQ,
                                        (VOS_UINT8 *)&stRtpdu,
                                        sizeof(stRtpdu));
    }

    return ulResult;
}
/*****************************************************************************
 函 数 名  : at_ftm_ltcommcmd_set
 功能描述  : ID_MSG_FTM_SET_LTCOMMCMD_REQ 处理函数
             进行LTE频段切换
 输入参数  : 无
 输出参数  : 无
 返 回 值  : 成功返回ERR_MSP_SUCCESS, 否则返回其他结果
*****************************************************************************/
VOS_UINT32 at_ftm_ltcommcmd_set(VOS_VOID* pParam)
{
	/*lint -save -e813*/
    FTM_SET_LTCOMMCMD_CNF_STRU  stCnf = { 0 };
    FTM_SET_LTCOMMCMD_REQ_STRU* pstFtmReq   = (FTM_SET_LTCOMMCMD_REQ_STRU*)pParam;
    OM_PHY_COMM_CMD_SET_REQ_STRU stReqToDsp = { 0 };
	/*lint -restore*/
    VOS_UINT32 ulRet = ERR_MSP_SUCCESS;
    VOS_UINT32 i     = 0;

    VOS_MemSet(&ftm_GetMainInfo()->stRdLtCommCmdCnf, 0, sizeof(FTM_RD_LTCOMMCMD_CNF_STRU));
    ftm_GetMainInfo()->stRdLtCommCmdCnf.ulErrCode = ERR_MSP_SUCCESS;

    stReqToDsp.ulMsgId   = OM_PHY_COMM_CMD_SET_REQ;
    stReqToDsp.ulDataLen = pstFtmReq->ulDataLen;
    VOS_MemCpy(stReqToDsp.cData, pstFtmReq->cData, stReqToDsp.ulDataLen);  

    vos_printf("at_ftm_ltcommcmd_set: 1\n");
    for(i=0; i<pstFtmReq->ulDataLen; i++)
    {
       if(i%10 == 0)
       {
          vos_printf("\n");
       }
       vos_printf("%02X", stReqToDsp.cData[i]);     
    }
    vos_printf("\n");

    switch(pstFtmReq->ulCmdDest)
    {
        case EN_LTCOMMCMD_DEST_LDSP_CT:
            ulRet = ftm_mailbox_ltect_write(&stReqToDsp, sizeof(OM_PHY_COMM_CMD_SET_REQ_STRU));
            break;

        case EN_LTCOMMCMD_DEST_LDSP_BT:
            ulRet = ftm_mailbox_ltebt_write(&stReqToDsp, sizeof(OM_PHY_COMM_CMD_SET_REQ_STRU));
            break;

        case EN_LTCOMMCMD_DEST_TDSP_CT:
            ulRet = ftm_mailbox_tdsct_write(&stReqToDsp, sizeof(OM_PHY_COMM_CMD_SET_REQ_STRU));
            break;

        case EN_LTCOMMCMD_DEST_TDSP_BT:
            ulRet = ftm_mailbox_tdsbt_write(&stReqToDsp, sizeof(OM_PHY_COMM_CMD_SET_REQ_STRU));
            break;

        default:
            ulRet = ERR_MSP_FAILURE;
    }

    if (ERR_MSP_SUCCESS != ulRet)
    {
        stCnf.ulErrCode = ERR_MSP_UNKNOWN;
        stCnf.ulDataLen = 0;
        
        return ftm_comm_send(ID_MSG_FTM_SET_LTCOMMCMD_CNF,
            (VOS_UINT32)&stCnf, sizeof(FTM_SET_LTCOMMCMD_CNF_STRU));
    }  
    return ERR_MSP_WAIT_ASYNC;
}
VOS_VOID DMS_Init(VOS_VOID)
{
    VOS_UINT32                          ulport;

    VOS_MemSet(g_astDmsSdmInfoTable, 0, sizeof(g_astDmsSdmInfoTable));

    g_stDmsMainInfo.pfnRdDataCallback  = NULL;
    g_stDmsMainInfo.pfnConnectCallBack = NULL;

    /*初始化所有端口的handle*/
    for (ulport = 0; ulport < DMS_PHY_BEAR_LAST; ulport++)
    {
        g_stDmsMainInfo.stPhyProperty[ulport].lPortHandle = UDI_INVALID_HANDLE;
    }

    /*物理通道默认属性,存在多个物理通道有能力对应一个逻辑通道*/
    g_stDmsMainInfo.stPhyProperty[DMS_PHY_BEAR_USB_PCUI].enLogicChan = DMS_CHANNEL_AT;
    g_stDmsMainInfo.stPhyProperty[DMS_PHY_BEAR_USB_CTRL].enLogicChan = DMS_CHANNEL_AT;



    /* 初始化AT通道使用的静态内存 */
    Dms_StaticBufInit();


    DMS_ReadPortDebugCfgNV();

    mdrv_usb_reg_enablecb(DMS_UsbEnableCB);
    mdrv_usb_reg_disablecb(DMS_UsbDisableCB);

    wake_lock_init(&g_stDmsMainInfo.stwakelock, WAKE_LOCK_SUSPEND, "dms_wakelock");

    return;
}
VOS_VOID STK_UpdateSvcStatus(NAS_STK_SERVICE_STATUS_ENUM_UINT8 enCsServiceStatus)
{
    NAS_STK_SYS_INFO_STRU               stSysInfo;

    VOS_MemSet(&stSysInfo, (VOS_CHAR)0xFF, sizeof(NAS_STK_SYS_INFO_STRU));

    /* 无服务状态处理,无服务时把其它所有的系统信息全部清除 */
    if ((NAS_STK_SERVICE_STATUS_NO_SERVICE == enCsServiceStatus)
     || (NAS_STK_SERVICE_STATUS_DEEP_SLEEP == enCsServiceStatus))
    {
        g_stStkSysInfo.enServiceStatus = SI_STK_NO_SERVICE;

        STK_UpdateSysInfo(&stSysInfo);

        return;
    }
    /* 正常服务 */
    else if (NAS_STK_SERVICE_STATUS_NORMAL_SERVICE == enCsServiceStatus)
    {
        g_stStkSysInfo.enServiceStatus = SI_STK_NORMAL_SERVICE;
    }
    /* 限制服务 */
    else
    {
        g_stStkSysInfo.enServiceStatus = SI_STK_LIMITED_SERVICE;
    }

    return;
}
/*****************************************************************************
 函 数 名  : 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;
}
VOS_UINT32  FC_CPUC_Init( VOS_VOID )
{
    VOS_UINT32                          ulResult;


    ulResult = FC_UL_InitFcPoints(FC_POLICY_ID_CPU_C, &(g_stFcCfg.stFcCfgUmUlRateForCpu));

    if ( VOS_OK != ulResult )
    {
        FC_LOG(PS_PRINT_ERROR, "FC_Init, ERROR, Fail to init FC Points for CPU!\n");
        return VOS_ERR;
    }

    VOS_MemSet(&g_stFcCpuCCtrl, 0, sizeof(g_stFcCpuCCtrl));

    ulResult = VOS_StartRelTimer(&g_stFcTraceCpuLoad.pstTraceCpuLoadTHandle, UEPS_PID_FLOWCTRL_C,
                                  g_stFcTraceCpuLoad.ulTraceCpuLoadTimerLen,
                                  TIMER_FC_CCPU_TRACE_CPULOAD, 0,
                                  VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION);
    if (VOS_OK != ulResult)
    {
        FC_LOG(PS_PRINT_ERROR, "FC_Init, ERROR, Fail to Start Timer!\n");
        return VOS_ERR;
    }

    return VOS_OK;
}
VOS_UINT32 USIMM_GetVsimFile(USIMM_GETFILE_REQ_STRU  *pstMsg)
{
    VOS_UINT32                  ulFileNum = 0;
    USIMM_GETCNF_INFO_STRU      stCnfInfo;

    VOS_MemSet(&stCnfInfo, 0, sizeof(stCnfInfo));

    stCnfInfo.ucRecordNum      = pstMsg->ucRecordNum;
    stCnfInfo.usEfId           = pstMsg->usFileID;

    if(VOS_OK == USIMM_PoolFindFile(pstMsg->usFileID, &ulFileNum, USIMM_UNLIMIT_APP))
    {
        stCnfInfo.usDataLen    = gstUSIMMPOOL.astpoolRecord[ulFileNum].usLen;
        stCnfInfo.usEfLen      = gstUSIMMPOOL.astpoolRecord[ulFileNum].usLen;
        stCnfInfo.pucEf        = gstUSIMMPOOL.astpoolRecord[ulFileNum].pucContent;
        stCnfInfo.ucTotalNum   = 1;

        USIMM_INFO_LOG("USIMM_GetVSimFile: Get File Success from Usimm Pool");

        USIMM_GetFileCnf(pstMsg->ulSenderPid, pstMsg->ulSendPara, USIMM_SW_OK, &stCnfInfo);
    }
    else
    {
        stCnfInfo.usDataLen    = VOS_NULL;
        stCnfInfo.usEfLen      = VOS_NULL;
        stCnfInfo.pucEf        = VOS_NULL_PTR;

        USIMM_INFO_LOG("USIMM_GetVSimFile: Get File Failed from Usimm Pool");

        USIMM_GetFileCnf(pstMsg->ulSenderPid, pstMsg->ulSendPara, USIMM_SW_NOFILE_FOUND, &stCnfInfo);
    }
    return VOS_OK;
}
VOS_UINT32 OM_CreateTraceBuffer(OM_BUF_CTRL_STRU *pstBufCtrl, VOS_INT32 lBufSize)
{
    VOS_UINT_PTR ulRealAddr;

    /* 参数检测 */
    if ((VOS_NULL_PTR == pstBufCtrl) || (0 == lBufSize))
    {
        return VOS_ERR;
    }

    pstBufCtrl->lAlloc   = 0;
    pstBufCtrl->lRelease = 0;
    pstBufCtrl->lPadding = 0;
    pstBufCtrl->lBufSize = lBufSize + 1;

    /*申请uncache的动态内存区*/
    pstBufCtrl->pucBuf = (VOS_UINT8*)VOS_UnCacheMemAlloc((VOS_UINT32)pstBufCtrl->lBufSize, &ulRealAddr);

    /* 分配内存失败 */
    if (VOS_NULL_PTR == pstBufCtrl->pucBuf)
    {
        return VOS_ERR;
    }

    /* 保存buf实地址 */
    pstBufCtrl->pucRealBuf = (VOS_UINT8 *)ulRealAddr;

    vos_printf("\r\nOM_CreateTraceBuffer: real addr=0x%p, virt addr==0x%p\n", ulRealAddr, pstBufCtrl->pucBuf);

    VOS_MemSet(&g_stOmBufRecord, 0, sizeof(g_stOmBufRecord));

    return VOS_OK;
}
/*****************************************************************************
 Prototype      : PPM_SockOMIndComSend
 Description    : 提供给上层OM 主动上报数据发送的接口.
 Input          : pucVirAddr:   数据虚地址
                  pucPhyAddr:   数据实地址
                  ulLength:     数据长度
 Output         : void
 Return Value   : VOS_ERR  - 发送失败
                  VOS_OK   - 发送成功

 History        : ---
    Date        : 2014-05-29
    Author      : h59254
    Modification: Created function
 *****************************************************************************/
VOS_INT32 PPM_SockOMIndComSend(VOS_UINT8 *pucVirAddr, VOS_UINT8 *pucPhyAddr, VOS_UINT16 uslength)
{
    SOCKET                              socket;
    VOS_INT                             nSndNum;
    struct sockaddr_in                  stToAddr;

    (VOS_VOID)VOS_SmP(g_astSockInfo[SOCKET_OM_IND].SmClose, 0);

    socket = g_astSockInfo[SOCKET_OM_IND].socket;

    if (SOCK_NULL == socket)
    {
        VOS_SmV(g_astSockInfo[SOCKET_OM_IND].SmClose);

        return VOS_ERR;
    }

    VOS_MemSet(&stToAddr, 0, sizeof(stToAddr));
    stToAddr.sin_family = AF_INET;
    stToAddr.sin_addr.s_addr = inet_addr(SOCK_WIFI_DEFAULT_ADDR);
    /* 目的端口 */
    stToAddr.sin_port = htons(SOCK_OM_IND_DST_PORT_NUM);

    /* 调用send将数据通过socket发送出去,走UDP */
    nSndNum = sendto(socket, pucVirAddr, uslength, 0, &stToAddr, sizeof(stToAddr));

    VOS_SmV(g_astSockInfo[SOCKET_OM_IND].SmClose);

    if (nSndNum != uslength)
    {
        return VOS_ERR;
    }

    return VOS_OK;
}
Exemple #13
0
/*****************************************************************************
 函 数 名  : DMS_ReadPortCfgFile
 功能描述  : PortCfg虚拟文件读实现
 输入参数  : file --- 文件句柄
             buf  --- 用户空间
             ppos --- 文件偏移,参数未使用
 输出参数  : 无
 返 回 值  : 成功或失败

 修改历史      :
  1.日    期   : 2013年10月25日
    修改内容   : 新生成函数

*****************************************************************************/
ssize_t DMS_ReadPortCfgFile(
    struct file                        *file,
    char __user                        *buf,
    size_t                              len,
    loff_t                             *ppos
)
{
    VOS_CHAR                            acModeTemp[DMS_PORTCFG_FILE_LEN];
    VOS_INT32                           lRlst;
    VOS_UINT32                          ulLength;
    if (*ppos > 0)
    {
        return 0;
    }

    VOS_MemSet(acModeTemp, 0x00, DMS_PORTCFG_FILE_LEN);

    VOS_sprintf((VOS_CHAR *)acModeTemp, "%d", g_stDmsMainInfo.ulPortCfgValue);

    ulLength        = VOS_StrLen(acModeTemp);
    len             = PS_MIN(len, ulLength);

    /*拷贝内核空间数据到用户空间上面*/
    lRlst           = copy_to_user(buf,(VOS_VOID *)acModeTemp, len);

    if (lRlst < 0)
    {
        return -EPERM;
    }

    *ppos += (loff_t)len;

    return (ssize_t)len;
}
VOS_UINT32 CSIMA_CBPEnvelopeSend(CSIMA_CBP_CTPDU_MSG_STRU *pstCtpduMsg)
{
    VOS_UINT32                          ulResult;
    CSIMA_CBP_RTPDU_MSG_STRU            stRtpdu;

    VOS_MemSet(&stRtpdu, VOS_NULL, sizeof(stRtpdu));

    stRtpdu.enIPCMsgId = CSIMA_CBP_UICC_RTPDU_MSG;

    if ((SI_STK_ENVELOPE_EVENTDOWN == pstCtpduMsg->aucData[0])
        && (TAF_NVIM_LC_RAT_COMBINED_CL != g_stLCEnableFlag.enRatCombined))
    {
       /* 给CBP回复命令执行成功 */
       stRtpdu.usSWStatus = 0x9000;

       /* 调用CBPCA模块接口将数据发过去 */
       ulResult = CBPCA_SndDataToCbpca(WUEPS_PID_CSIMA,
                                       CSIMA_CBPCA_DATA_REQ,
                                       (VOS_UINT8 *)&stRtpdu,
                                       sizeof(stRtpdu));
        return ulResult;
    }

    ulResult = CSIMA_SendTPDUOnBaseChan(pstCtpduMsg);

    if (USIMM_API_SUCCESS != ulResult)
    {
        CSIMA_WARNING_LOG("CSIMA_CBPEnvelopeSend: CSIMA_SendTPDUOnBaseChan is Fail");
    }

    return ulResult;
}
VOS_UINT32 OM_GetLogPath(VOS_CHAR *pucBuf, VOS_CHAR *pucOldPath, VOS_CHAR *pucUnitaryPath)
{
    NV_PRODUCT_TYPE_FOR_LOG_DIRECTORY   stLogDir;
    VOS_UINT32                          ulRslt;

    /*lint -e534*/
    VOS_MemSet(&stLogDir, 0, sizeof(stLogDir));
    /*lint +e534*/

    ulRslt = NV_Read(en_NV_Item_ProductTypeForLogDirectory, &stLogDir, sizeof(stLogDir));
    if (VOS_OK != ulRslt)
    {
        /* 读NV失败,直接返回 */
        return VOS_ERR;
    }

    /*0:MBB V3R3 stick/E5,etc.; 1:V3R3 M2M & V7R2; 2:V9R1 phone; 3:K3V3&V8R1;*/
    if ((1 == stLogDir.usProductType) || (3 == stLogDir.usProductType))
    {
        /*lint -e534*/
        VOS_StrCpy(pucBuf, pucUnitaryPath);
        /*lint +e534*/
    }
    else
    {
        /*lint -e534*/
        VOS_StrCpy(pucBuf, pucOldPath);
        /*lint +e534*/
    }

    return VOS_OK;
}
VOS_VOID USIMM_VsimConfidentialDataVerifyErrHandle(VOS_VOID)
{
    NVIM_VSIM_HVSDH_NV_STRU             stDhNv = {0};
    VSIM_ALGORITHM_TYPE_ENUM_UINT32     enAlgorithm = {0};

    USIMM_ClearVsimGlobal();

    /* 清除公私钥 */
    if (NV_OK != NV_Read(en_NV_Item_VSIM_HVSDH_INFO, &stDhNv, sizeof(stDhNv)))
    {
        USIMM_WARNING_LOG("USIMM_VsimConfidentialDataVerify: Get HVSDT Info failed.");
    }

    enAlgorithm = stDhNv.enAlgorithm;

    VOS_MemSet(&stDhNv, 0, sizeof(NVIM_VSIM_HVSDH_NV_STRU));

    stDhNv.enAlgorithm = enAlgorithm;

    if (NV_OK != NV_Write(en_NV_Item_VSIM_HVSDH_INFO, &stDhNv, sizeof(stDhNv)))
    {
        USIMM_WARNING_LOG("USIMM_VsimConfidentialDataVerify: Clean HVSDT Info failed.");
    }

    USIMM_VsimReDhNegotiateInd();

    return;
}
VOS_UINT32 AT_RcvImsaMtStateInd(VOS_VOID * pMsg)
{
    /* 定义局部变量 */
    IMSA_AT_MT_STATES_IND_STRU          *pstMtStatusInd;
    VOS_UINT8                           ucIndex;
    VOS_CHAR                            acString[AT_IMSA_CALL_ASCII_NUM_MAX_LENGTH + 1];

    /* 初始化消息变量 */
    ucIndex     = 0;
    pstMtStatusInd  = (IMSA_AT_MT_STATES_IND_STRU*)pMsg;

    /* 通过ClientId获取ucIndex */
    if ( AT_FAILURE == At_ClientIdToUserId(pstMtStatusInd->usClientId, &ucIndex) )
    {
        AT_WARN_LOG("AT_RcvImsaImpuSetCnf: WARNING:AT INDEX NOT FOUND!");
        return VOS_ERR;
    }

    VOS_MemSet(acString, 0, sizeof(acString));
    VOS_MemCpy(acString, pstMtStatusInd->aucAsciiCallNum, AT_IMSA_CALL_ASCII_NUM_MAX_LENGTH);

    gstAtSendData.usBufLen= (VOS_UINT16)At_sprintf(AT_CMD_MAX_LEN,
                                                   (VOS_CHAR *)pgucAtSndCodeAddr,
                                                   (VOS_CHAR *)pgucAtSndCodeAddr,
                                                   "%s^IMSMTRPT: %s,%d,%d%s",
                                                   gaucAtCrLf,
                                                   acString,
                                                   pstMtStatusInd->ucMtStatus,
                                                   pstMtStatusInd->ulCauseCode,
                                                   gaucAtCrLf);
    /* 调用At_SendResultData发送命令结果 */
    At_SendResultData(ucIndex, pgucAtSndCodeAddr, gstAtSendData.usBufLen);

    return VOS_OK;
}
VOS_VOID STK_ClearPauseCharGobal(VOS_VOID)
{
    VOS_MemSet(&g_stSTKDtmfData, 0, sizeof(g_stSTKDtmfData));

    STK_NORMAL_LOG("STK_ClearPauseCharGobal: Clearn DTMF DATA.");

    return;
}
/*****************************************************************************
 Function Name	 : drx_msp_init
 Description	 : debug func 
 Input			 :			  
 Output 		 : None
 Return 		 : None
 
 History		 :

*****************************************************************************/
VOS_VOID drx_msp_init(VOS_VOID)
{
#if(VOS_OS_VER == VOS_LINUX)
    wake_lock_init(&msp_wakelock, WAKE_LOCK_SUSPEND, "msp_wakeup");
#endif
	/* set global variable */
	VOS_MemSet(&gbl_drx_cur_vote_status, 0, sizeof(drx_msp_debug_vote_s));
}
VOS_VOID  SC_CTX_InitFacGlobalVar( VOS_VOID )
{
    g_stScCtx.stScFacGlobalVar.enScFacAuthStatus = SC_AUTH_STATUS_UNDO;

    VOS_MemSet(g_stScCtx.stScFacGlobalVar.aucScFacRandData, 0, SC_RAND_DATA_LEN);

    return;
}
VOS_VOID USIMM_TelecomAuthCnf(USIMM_AUTH_REQ_STRU *pstMsg, USIMM_TELECOM_AUTH_INFO_STRU *pstCnfInfo)
{
    USIMM_AUTH_CNF_STRU                *pstCnfMsg;

    /* 分配消息内存  */
    pstCnfMsg = (USIMM_AUTH_CNF_STRU*)VOS_AllocMsg(WUEPS_PID_USIM, sizeof(USIMM_AUTH_CNF_STRU)-VOS_MSG_HEAD_LENGTH);

    if (VOS_NULL_PTR == pstCnfMsg)
    {
        USIMM_ERROR_LOG("USIMM_TelecomAuthCnf: VOS_AllocMsg is Failed");

        return;
    }

    VOS_MemSet((VOS_UINT8*)pstCnfMsg + VOS_MSG_HEAD_LENGTH, 0, pstCnfMsg->ulLength);

    pstCnfMsg->ulReceiverPid    = pstMsg->ulSenderPid;
    pstCnfMsg->ulMsgName        = PS_USIM_AUTHENTICATION_CNF;
    pstCnfMsg->enAppType        = pstMsg->enAppType;
    pstCnfMsg->enAuthType       = pstMsg->enAuthType;
    pstCnfMsg->ucOpId           = pstMsg->ucOpId;
    pstCnfMsg->enResult         = pstCnfInfo->enResult;

    if ((VOS_NULL_PTR != pstCnfInfo->pucIK)
        && (sizeof(pstCnfMsg->cnfdata.stTELECnf.aucIK) > pstCnfInfo->pucIK[0]))
    {
        VOS_MemCpy(pstCnfMsg->cnfdata.stTELECnf.aucIK, pstCnfInfo->pucIK, pstCnfInfo->pucIK[0] + 1);
    }

    if ((VOS_NULL_PTR != pstCnfInfo->pucCK)
        && (sizeof(pstCnfMsg->cnfdata.stTELECnf.aucCK) > pstCnfInfo->pucCK[0]))
    {
        VOS_MemCpy(pstCnfMsg->cnfdata.stTELECnf.aucCK, pstCnfInfo->pucCK, pstCnfInfo->pucCK[0] + 1);
    }

    if ((VOS_NULL_PTR != pstCnfInfo->pucGsmKC)
        && (sizeof(pstCnfMsg->cnfdata.stTELECnf.aucGsmKc) > pstCnfInfo->pucGsmKC[0]))
    {
        VOS_MemCpy(pstCnfMsg->cnfdata.stTELECnf.aucGsmKc, pstCnfInfo->pucGsmKC, pstCnfInfo->pucGsmKC[0] + 1);
    }

    if ((VOS_NULL_PTR != pstCnfInfo->pucAuts)
        && (sizeof(pstCnfMsg->cnfdata.stTELECnf.aucAuts) > pstCnfInfo->pucAuts[0]))
    {
        VOS_MemCpy(pstCnfMsg->cnfdata.stTELECnf.aucAuts, pstCnfInfo->pucAuts, pstCnfInfo->pucAuts[0] + 1);
    }

    if ((VOS_NULL_PTR != pstCnfInfo->pucAuthRes)
        && (sizeof(pstCnfMsg->cnfdata.stTELECnf.aucAuthRes) > pstCnfInfo->pucAuthRes[0]))
    {
        VOS_MemCpy(pstCnfMsg->cnfdata.stTELECnf.aucAuthRes, pstCnfInfo->pucAuthRes, pstCnfInfo->pucAuthRes[0] + 1);
    }

    /* 回复消息 */
    (VOS_VOID)VOS_SendMsg(pstCnfMsg->ulSenderPid, pstCnfMsg);

    return;
}
VOS_VOID GU_OamPortInit(VOS_VOID)
{
    VOS_MemSet(&g_stAcpuDebugInfo, 0, sizeof(g_stAcpuDebugInfo));

    VOS_MemSet(g_astOMPortUDIHandle, VOS_ERROR, sizeof(g_astOMPortUDIHandle));

    GU_OamAppPortInit();    /* App 端口的初始化 */

    GU_OamHsicPortInit();   /* Hsic 端口的初始化 */

    /*Ctrl端口的初始化是在端口切换实现*/

    GU_OamVComPortInit();   /* Vcom 端口的初始化 */

    GU_OamErrLogVComPortInit(); /* Error log Vcom 端口的初始化 */

    return;
}
VOS_UINT32 USIMM_AuthenVirtulSim(USIMM_AUTH_REQ_STRU *pstMsg)
{
    VOS_UINT8                           aucOutPut[USIMM_AUTH_RES_LEN+USIMM_AUTH_KC_LEN] = {0};    /*RES+KC*/
    VOS_UINT8                           aucxRes[USIMM_AUTH_RES_LEN+1]                   = {0};    /*长度1Byte+内容*/
    VOS_UINT8                           aucGsmKC[USIMM_AUTH_KC_LEN+1]                   = {0};    /*长度1Byte+内容*/
    VOS_UINT8                           aucKi[USIMM_AUTH_KI_LEN];
    VOS_UINT8                           aucOpc[USIMM_AUTH_OPC_LEN];                               /*不使用,但是需要避免XML里面有*/
    USIMM_TELECOM_AUTH_INFO_STRU        stCnfInfo;

    VOS_MemSet(&stCnfInfo, 0, sizeof(stCnfInfo));

    /* 解密全局变量中的Ki Opc */
    if(VOS_OK != USIMM_VsimGetRealKiOpc(aucKi, aucOpc))
    {
        stCnfInfo.enResult = USIMM_AUTH_GSM_OTHER_FAILURE;

        USIMM_TelecomAuthCnf(pstMsg, &stCnfInfo);

        return VOS_ERR;
    }

    if(USIMM_VSIM_COMPV1 == g_stUSIMMVSimAuthInfo.enAuthType)        /*comp 128 v1*/
    {
        RUNA3A8_V1(aucKi, &pstMsg->aucData[1], aucOutPut);
    }
    else if(USIMM_VSIM_COMPV2 == g_stUSIMMVSimAuthInfo.enAuthType)   /*comp 128 v2*/
    {
        /* coverity[uninit_use_in_call] */
        RUNA3A8_V2(aucKi, &pstMsg->aucData[1], aucOutPut);
    }
    else        /*comp 128 v3*/
    {
        /* coverity[uninit_use_in_call] */
        RUNA3A8_V3(aucKi, &pstMsg->aucData[1], aucOutPut);
    }

    aucxRes[0]  = USIMM_AUTH_RES_LEN;

    VOS_MemCpy(&aucxRes[1], aucOutPut, USIMM_AUTH_RES_LEN);

    aucGsmKC[0] = USIMM_AUTH_KC_LEN;

    VOS_MemCpy(&aucGsmKC[1], &aucOutPut[USIMM_AUTH_RES_LEN], USIMM_AUTH_KC_LEN);

    stCnfInfo.pucAuthRes        = aucxRes;
    stCnfInfo.pucIK             = VOS_NULL_PTR;
    stCnfInfo.pucCK             = VOS_NULL_PTR;
    stCnfInfo.pucGsmKC          = aucGsmKC;
    stCnfInfo.pucAuts           = VOS_NULL_PTR;

    stCnfInfo.enResult          = USIMM_AUTH_GSM_SUCCESS;

    USIMM_TelecomAuthCnf(pstMsg, &stCnfInfo);

    return VOS_OK;
}
VOS_VOID USIMM_ClearVsimGlobal(VOS_VOID)
{
    USIMM_PoolDelAll();

    USIMM_InitGlobalVarOnReset();

    VOS_MemSet(&g_stUSIMMVSimAuthInfo, 0, sizeof(g_stUSIMMVSimAuthInfo));

    return;
}
VOS_VOID  SC_CTX_InitFacGlobalVar( VOS_VOID )
{
    SC_CTX_GetScCtxAddr()->stScFacGlobalVar.enScFacAuthStatus = SC_AUTH_STATUS_UNDO;

    /*lint -e534*/
    VOS_MemSet(SC_CTX_GetScCtxAddr()->stScFacGlobalVar.aucScFacRandData, 0, SC_RAND_DATA_LEN);
    /*lint +e534*/

    return;
}
VOS_UINT32 OM_AcpuCnfEstablishProc(APP_OM_MSG_EX_STRU *pstAppToOmMsg,
                                           VOS_UINT16 usReturnPrimId)
{
    VOS_UINT32                          ulRet;
#ifdef SCM_SNCHECK
    g_stSnCheck.ulCount = 0;
    g_ulSnErrCount      = 0;
#endif
    VOS_MemSet(&g_stAcpuTraceEventConfig, 0, sizeof(OM_TRACE_EVENT_CONFIG_PS_STRU));
    VOS_MemSet(g_astOmPrintfOutPutLev, 0, OM_PRINTF_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN));
    VOS_MemSet(g_aulLogPrintLevPsTable, 0, LOG_PS_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN));
    VOS_MemSet(g_aulLogPrintLevDrvTable, 0, LOG_DRV_MODULE_MAX_NUM*sizeof(LOG_LEVEL_EN));

    /* 先断开链路 */
    g_stAcpuCnfCtrlInfo.ulOMSwitchOnOff = OM_STATE_IDLE;

    /* OM建链后投票禁止睡眠 */
#if(FEATURE_ON == FEATURE_SOCP_ON_DEMAND)
    OM_AcpuSocpVoteInfoAdd(OM_SOCPVOTE_CALLBEGIN);
    DRV_SOCP_VOTE(SOCP_VOTE_GU_OM_APP, SOCP_VOTE_FOR_WAKE);
    OM_AcpuSocpVoteInfoAdd(OM_SOCPVOTE_CALLEND);
#endif

    /* 以兼容校准工具,建链成功回复状态字0x02 */
    ulRet = 0x02;

    g_ulAcpuEstRcvCnt++;

    /* 给工具回复建链成功状态 */
    OM_AcpuSendResultChannel(OM_LOGIC_CHANNEL_CNF, OM_QUERY_FUNC, ulRet, usReturnPrimId);

    /* 激活链路 */
    g_stAcpuCnfCtrlInfo.ulOMSwitchOnOff = OM_STATE_ACTIVE;

    /* 通知CCPU链路状态 */
    if(VOS_OK != GU_OamSndPcMsgToCcpu(&g_stAcpuCnfCtrlInfo,(VOS_UINT8*)pstAppToOmMsg, sizeof(APP_OM_MSG_EX_STRU)))
    {
        /* 打印错误 */
    }

    return VOS_OK;
}
Exemple #27
0
/*****************************************************************************
 Function   : HPA_Init
 Description: HPA Init
 Input      : void
 Return     : OK or Error
 Other      :
 *****************************************************************************/
VOS_UINT32 HPA_Init(VOS_VOID)
{
    /* set SFN & CFN */
    g_ucHpaCfnRead = 0;
    g_usHpaSfnRead = 0;

    /* set to 0 */
    atomic_set(&g_stDspMailBoxTransferCount, 0);
    atomic_set(&g_stGDspMailBoxTransferCount, 0);
    atomic_set(&g_stGDsp1MailBoxTransferCount, 0);

    /*Hpa Error Count global Var. Init*/
    VOS_MemSet((VOS_VOID *)(g_astHpaErrorCount), (VOS_CHAR)0x00,
        sizeof(g_astHpaErrorCount));

    /*Hpa Interrupt Count global Var. Init*/
    VOS_MemSet((VOS_VOID *)(&g_stHpaIntCount), (VOS_CHAR)0x00,
        sizeof(HPA_INT_COUNT_STRU));

    if ( VOS_OK != VOS_SmCCreate( "TRAN", 0, VOS_SEMA4_FIFO, &g_ulHpaTransferSem))
    {
        PS_LOG(UEPS_PID_WHPA, 0, PS_PRINT_WARNING,
            "HPA: creat g_ulHpaTransferSem Err");

        return VOS_ERR;
    }

#ifdef HPA_ITT
    g_pfnHpaDspIsrStub = VOS_NULL_PTR;

    g_pfnHpaIttMsgFilterFunc = VOS_NULL_PTR;
#endif

    if(NV_OK != NV_Read(en_NV_Item_Max_Gsm_Reg_Cnt,&g_stGhpaRegCnt,sizeof(g_stGhpaRegCnt)))
    {
        PS_LOG(UEPS_PID_APM, 0, PS_PRINT_WARNING,
            "HPA: Read en_NV_Item_Max_Gsm_Reg_Cnt Err");
    }

    return VOS_OK;
}
VOS_VOID GU_OamVComPortInit(VOS_VOID)
{
    VOS_MemSet(&g_stVComDebugInfo, 0, sizeof(g_stVComDebugInfo));

#if (VOS_LINUX == VOS_OS_VER)
    sema_init(&g_stVCOMRxBuffSem, 1);
#endif

    APP_VCOM_RegDataCallback(APP_VCOM_DEV_INDEX_LOG, GU_OamVComReadData);

    APP_VCOM_RegEvtCallback(APP_VCOM_DEV_INDEX_LOG, GU_OamVComStatus);

    CPM_PhySendReg(CPM_VCOM_PORT, GU_OamVComSendData);

#if (FEATURE_ON == FEATURE_CBT_LOG)
    APP_VCOM_RegDataCallback(APP_VCOM_DEV_INDEX_CBT, OMRL_AcpuRcvCBTData);
    VOS_MemSet(&g_stVComCBTDebugInfo, 0, sizeof(g_stVComCBTDebugInfo));
#endif

    return;
}
VOS_UINT32 PPM_PortInit(VOS_VOID)
{
    VOS_MemSet(&g_stAcpuDebugInfo, 0, sizeof(g_stAcpuDebugInfo));

    VOS_MemSet(g_astOMPortUDIHandle, VOS_ERROR, sizeof(g_astOMPortUDIHandle));

    VOS_MemSet(&g_stPpmPortSwitchInfo, 0, sizeof(g_stPpmPortSwitchInfo));

    VOS_SpinLockInit(&g_stPpmPortSwitchSpinLock);

    /* USB承载的虚拟端口通道的初始化 */
    PPM_UsbPortInit();

    /* Hsic承载的虚拟端口通道的初始化 */
    PPM_HsicPortInit();

    /* Vcom承载的虚拟端口通道的初始化 */
    PPM_VComPortInit();

    return VOS_OK;
}
VOS_VOID STK_CLCfgInit(VOS_VOID)
{
    if (NV_OK != NV_Read(en_NV_Item_LC_Ctrl_PARA, &g_stLCEnableCfg, sizeof(TAF_NV_LC_CTRL_PARA_STRU)))
    {
        g_stLCEnableCfg.ucLCEnableFlg = VOS_FALSE;
        g_stLCEnableCfg.enRatCombined = TAF_NVIM_LC_RAT_COMBINED_GUL;
    }

    VOS_MemSet(g_astEventResend, 0, sizeof(g_astEventResend));

    return;
}