コード例 #1
0
/*lint -e961*/
VOS_VOID NAS_ESM_InitAttachBearerReestInfo()
{
    VOS_UINT32 ulResult;
    NAS_ESM_ENTITY_STRU *pEsmEntityInfo = NAS_ESM_Entity();
    LNAS_ESM_NV_ATTACH_BEARER_REEST_STRU stTmpAttachBearerNvData = {0};
    /*lint -e718*/
    /*lint -e732*/
    /*lint -e516*/
    ulResult = LPs_NvimItem_Read((EN_NV_ID_ATTACH_BEARER_RE_ESTABLISH),\
                                 (VOS_VOID *)(&stTmpAttachBearerNvData),\
                                 sizeof(LNAS_ESM_NV_ATTACH_BEARER_REEST_STRU));
    /*lint +e516*/
    /*lint +e732*/
    /*lint +e718*/
    /* 判断读取结果 */
    if (ulResult != ERR_MSP_SUCCESS)
    {
        /*打印异常信息*/
        NAS_ESM_ERR_LOG("NAS_ESM_AttachBearerReestInfoInit:ERROR: Cannot Read from NV .");

        stTmpAttachBearerNvData.bitOpAttachBearerReest = NAS_ESM_OP_FALSE;
        stTmpAttachBearerNvData.ulReestTimeLen = 0;
    }

    /*  判断读取参数的有效性 */
    if ((NAS_ESM_OP_TRUE == stTmpAttachBearerNvData.bitOpAttachBearerReest) &&
            (stTmpAttachBearerNvData.ulReestTimeLen > TI_NAS_ESM_ATTACH_BEARER_REEST_TIMER_LEN))
    {
        NAS_ESM_ERR_LOG("NAS_ESM_AttachBearerReestInfoInit:Timer is too long, use default value");
        stTmpAttachBearerNvData.ulReestTimeLen = TI_NAS_ESM_ATTACH_BEARER_REEST_TIMER_LEN;
    }

    /* 拷贝有效数据到ESM Entity */
    pEsmEntityInfo->stAttachBearerReestInfo.stNvData.bitOpAttachBearerReest= stTmpAttachBearerNvData.bitOpAttachBearerReest;
    pEsmEntityInfo->stAttachBearerReestInfo.stNvData.bitOpRsv = 0;
    pEsmEntityInfo->stAttachBearerReestInfo.stNvData.ulReestTimeLen =
        stTmpAttachBearerNvData.ulReestTimeLen * 1000;

    pEsmEntityInfo->stAttachBearerReestInfo.ulEpsbId = NAS_ESM_UNASSIGNED_EPSB_ID;

    NAS_ESM_MEM_SET(&(pEsmEntityInfo->stAttachBearerReestInfo.stTimerInfo), 0, sizeof(NAS_ESM_TIMER_STRU));
    pEsmEntityInfo->stAttachBearerReestInfo.stTimerInfo.enPara = TI_NAS_ESM_ATTACH_BEARER_REEST;

    NAS_ESM_INFO_LOG2("NAS_ESM_AttachBearerReestInfoInit: Param ",
                      pEsmEntityInfo->stAttachBearerReestInfo.stNvData.bitOpAttachBearerReest,
                      pEsmEntityInfo->stAttachBearerReestInfo.stNvData.ulReestTimeLen);
}
コード例 #2
0
/*****************************************************************************
 Function Name  : NAS_LMM_NvimRead
 Discription    : 其他模块调用本函数读一个指定的NV_Item
 Input          : ulNVItemType: NV_Item类型
                  *pData :数据缓存指针
                  *pusDataLen:返回数据长度
 Output         : pusDataLen :返回数据长度
 Return         : 0:数据成功读取,函数正常返回
                  1:未找到要读取的NV项
                  3:传入的缓存不够出错
                  4:系统异常,读取出错
 History:
      1.sunbing   49683      2010-7-22  modify
*****************************************************************************/
NAS_LMM_USIM_NV_RESULT  NAS_LMM_NvimRead(    NAS_LMM_ITEM_TYPE_ENUM_UINT32   ulNVItemType,
                                VOS_VOID                       *pData,
                                const VOS_UINT16                     *pusDataLen )
{
    VOS_UINT32                          ulRslt = NAS_LMM_NVIM_FAIL;
    NAS_NVIM_CTRL_TBL                   stNvCtrlTbl;
    VOS_UINT32                          i;
    NAS_LMM_NV_ACTION_FUN                pActFun = NAS_LMM_NULL_PTR;
    USIMM_GET_FILE_INFO_STRU            stGetFileInfo = {0};

    /*check input params*/
    if((NAS_NVIM_NULL_PTR == pData) ||
        (NAS_NVIM_NULL_PTR == pusDataLen) ||
        (ulNVItemType > EN_NV_ID_PS_END))
    {
        NAS_LMM_NVIM_LOG_ERR("NAS_LMM_NvimRead :Input Para is error");
        return NAS_LMM_NVIM_FAIL;
    }

    NAS_LMM_MEM_SET(g_aucNvimBuff, 0, sizeof(g_aucNvimBuff));

    /*Initalize NVIM ctrl tbl*/
    stNvCtrlTbl.pData                   = pData;
    stNvCtrlTbl.pNvData                 = g_aucNvimBuff;
    stNvCtrlTbl.usDataLen               = *pusDataLen;
    stNvCtrlTbl.usNvDataLen             = *pusDataLen;
    /*lint -e438*/
    /*硬USIM下,并且NV ITEM属于USIM的范围,则从USIM中读取文件*/
    if((EN_NV_ID_USIM_BEGIN          <  ulNVItemType)
        &&(EN_NV_ID_USIM_END            >  ulNVItemType))
    {
        for(i = 0; i < g_ulNvDataMapNum; i++)
        {
            /* 若NV类型相同,则找到了,返回当前的NV动作函数,退出循环 */
            if(ulNVItemType == g_astNvDataMap[i].ulEventType)
            {
                stGetFileInfo.usEfId      = g_astNvDataMap[i].usUsimFileId;
                break;
            }
        }

        if(NAS_USIM_FILE_ID_INVALID == stGetFileInfo.usEfId)
        {
            NAS_LMM_NVIM_LOG_INFO("NAS_LMM_NvimRead :Donot find Usim file ID.");

            return NAS_LMM_NVIM_FAIL;
        }

        /*ucRecordNum默认为1,NAS目前涉及的文件是线形文件,且只有一个记录*/
        stGetFileInfo.ucRecordNum = 1;

        stGetFileInfo.enAppType = USIMM_UMTS_APP;
        /*
        ulRslt = Api_UsimGetFileReq(PS_USIM_CLIENT_MM,
                                    usEfId,
                                    ucRecordNum);
        */


        ulRslt = USIMM_GetFileReq(  PS_PID_MM,
                                    0,
                                    &stGetFileInfo);

        NAS_EMM_GET_SEND_COUNTER()++;

        /*需要返回失败,这样,调用处发现返回失败后,就把全局变量内存清空,
        而不会向里面赋值,真正的赋值要等待收到USIM的READ FILE消息后,才做。*/
        return NAS_LMM_NVIM_HARD_USIM;

    }
    /*lint +e438*/

    /*其他情况从NV中读取信息*/
    /*lint -e718*/
    /*lint -e516*/
    /*lint -e732*/
    ulRslt = LPs_NvimItem_Read(      ulNVItemType,
                                    stNvCtrlTbl.pNvData,
                                    stNvCtrlTbl.usNvDataLen);
    /*lint +e732*/
    /*lint +e516*/
    /*lint +e718*/
    if(ulRslt != EN_NV_OK)
    {
        NAS_LMM_NVIM_LOG_ERR("NAS_LMM_NvimRead:PS_NVIM_Read is fail");
        return NAS_LMM_NVIM_FAIL;
    }

    /* 在g_astNvDataMap中查找对应的NV TYPE*/
    for(i = 0; i < g_ulNvDataMapNum; i++)
    {
        /* 若NV类型相同,则找到了,返回当前的NV动作函数,退出循环 */
        if(ulNVItemType == g_astNvDataMap[i].ulEventType)
        {
           pActFun            = g_astNvDataMap[i].pfDecodeActionFun;
           break;
        }
    }

    if (NAS_LMM_NULL_PTR != pActFun)
    {
        ulRslt = (*pActFun) (&stNvCtrlTbl);
        if(NAS_LMM_NVIM_OK == ulRslt)
        {
            return NAS_LMM_NVIM_OK;
        }
        else
        {
            return NAS_LMM_NVIM_FAIL;
        }
    }
    else /* 如果找不到处理函数,表示当前没有该处理函数 */
    {
        NAS_LMM_NVIM_LOG_ERR("NAS_LMM_NvimRead:Action functin is ERR");
        return NAS_LMM_NVIM_FAIL;
    }

}
コード例 #3
0
VOS_VOID Fc_LteInit(VOS_VOID)
{
    VOS_UINT32                  ulReturnCode;

#if (CDS_FEATURE_ON == CDS_FEATURE_LTE)
    VOS_UINT32                  i;

    /* 从NV读取流控配置信息 */
    /*lint -e718*/
    /*lint -e746*/
    /*lint -e732*/
    /*lint -e830*/
    ulReturnCode = LPs_NvimItem_Read(EN_NV_ID_FLOWCTRL_CONFIG,\
                                    (VOS_VOID *)(&g_stFcLteConfig),\
                                    sizeof(FLOWCTRL_LTE_CONFIG_STRU));
    /*lint +e830*/
    /*lint +e732*/
    /*lint +e746*/
    /*lint +e718*/
    if (PS_SUCC != ulReturnCode)
    {
        PS_PRINTF("Fc_LteInit,LPs_NvimItem_Read FLOWCTRL_LTE_CONFIG fail:%d\n", ulReturnCode);
        /* 初始化为默认值 */
        Fc_LteConfig2Default();
    }

    if(PS_SUCC != FC_LteConfigcheck())
    {
        /* 初始化为默认值 */
        Fc_LteConfig2Default();
    }

    g_stFcLteCpuCtrl.ulFirstDelay = g_stFcLteConfig.stFcCpuConfig.usFirstDelay;
    g_stFcLteCpuCtrl.ulUlDownRate = g_stFcLteConfig.stFcCpuConfig.usUlDownRate;
    g_stFcLteCpuCtrl.ulUlUpRate = g_stFcLteConfig.stFcCpuConfig.usUlUpRate;
    g_stFcLteCpuCtrl.ulHqDownRate = g_stFcLteConfig.stFcCpuConfig.usHqDownRate;
    g_stFcLteCpuCtrl.ulHqUpRate = g_stFcLteConfig.stFcCpuConfig.usHqUpRate;
    g_stFcLteCpuCtrl.ulHqMaxDiscardRate = g_stFcLteConfig.stFcCpuConfig.usHqMaxDiscardRate;
    g_stFcLteCpuCtrl.ulDowngradeThres = g_stFcLteConfig.stFcCpuConfig.usDowngradeThres;
    g_stFcLteCpuCtrl.ulUpgradeThres = g_stFcLteConfig.stFcCpuConfig.usUpgradeThres;

    g_stFcLteTemperatureCtrl.ucInitialPos = g_stFcLteConfig.stFcTemperatureConfig.ucInitialPos;
    g_stFcLteTemperatureCtrl.ulBsrTimerLen = 10;    /* 默认BSR周期10ms */
    g_stFcLteTemperatureCtrl.ucAvailCnt = 0;
    g_stFcLteTemperatureCtrl.ucBsrThresCnt = 0;
    g_stFcLteTemperatureCtrl.ucCurrPos = FC_UL_THROUGHPUT_THRES_CNT;

    for(i = 0; i < FC_UL_THROUGHPUT_THRES_CNT_NV; i++)
    {
        if(0 == g_stFcLteConfig.stFcTemperatureConfig.ulTemperSteps[i])
        {
            break;
        }

        if(g_stFcLteConfig.stFcTemperatureConfig.ulTemperSteps[i] < g_stFcLteConfig.stFcTemperatureConfig.ulMinBsrThr)
        {
            g_stFcLteTemperatureCtrl.ucAvailCnt++;
            /* 周期折算,NV设置为kbps,入口流控基于100ms字节数 */
            g_stFcLteTemperatureCtrl.ulTemperSteps[i] = g_stFcLteConfig.stFcTemperatureConfig.ulTemperSteps[i]*100 / 8;
        }
        else
        {
            g_stFcLteTemperatureCtrl.ucBsrThresCnt++;
        }
    }
    /* 入口流控紧随BSR流控 */
    g_stFcLteTemperatureCtrl.ucAvailCnt += g_stFcLteTemperatureCtrl.ucBsrThresCnt;

    for(; i < FC_UL_THROUGHPUT_THRES_CNT; i++)
    {
        g_stFcLteTemperatureCtrl.ulTemperSteps[i] = 0;
    }

    if(g_stFcLteConfig.stFcTemperatureConfig.ucZeroSupport > 0)
    {
        g_stFcLteTemperatureCtrl.ucAvailCnt++;
    }

    g_ulUlDowngradeFlag = PS_FALSE;

    Fc_KbpsToBsr();
#endif


    /* 从GU NV读取流控配置信息 */
    /*lint -e718*/
    /*lint -e746*/
    /*lint -e732*/
    ulReturnCode = NV_ReadEx(MODEM_ID_0,EN_NV_ITEM_CDS_FC_CONFIG,\
                                    (&g_stFcCdsConfig),\
                                    sizeof(FLOWCTRL_CDS_CONFIG_STRU));
    /*lint +e732*/
    /*lint +e746*/
    /*lint +e718*/

    if (PS_SUCC != ulReturnCode)
    {
        PS_PRINTF("Fc_LteInit,NV_Read FLOWCTRL_CDS_CONFIG fail:%d\n", ulReturnCode);
        /* 初始化为默认值 */
        Fc_CdsConfig2Default();
    }

    if(PS_SUCC != FC_CdsConfigcheck())
    {
        /* 初始化为默认值 */
        Fc_CdsConfig2Default();
    }

    /* 基于NV填充控制结构 */
    if(0 == (FC_CDS_DL_ENABLED_MASK & g_stFcCdsConfig.ulFcEnableMask))
    {
        g_stFcCdsDlCtrl.bDlCdsFcEnable = VOS_FALSE;
    }
    else
    {
        g_stFcCdsDlCtrl.bDlCdsFcEnable = VOS_TRUE;
    }

    g_stFcCdsDlCtrl.ulDiscardThres = g_stFcCdsConfig.stFcCdsDlConfig.ulDiscardThres;
    g_stFcCdsDlCtrl.ulDiscardRate = g_stFcCdsConfig.stFcCdsDlConfig.ulDiscardRate;

    return;
}