VOS_UINT32  NAS_LMM_BufMsgInQue(
    NAS_LMM_FSM_MSG_BUF_STRU*            pstFsmAddr,
    VOS_UINT32                          ulPriLevel)

{
    VOS_UINT32                          ulRslt = NAS_LMM_FAIL;
    VOS_UINT8                           *pucCnt = NAS_LMM_NULL_PTR;

    /* 入参检查出错 */
    /* 打印错误信息 */

    if ( (ulPriLevel < NAS_LMM_STORE_HIGH_PRIO_MSG ) ||
         (ulPriLevel > NAS_LMM_STORE_LOW_PRIO_MSG ))
    {
        NAS_LMM_PUBM_LOG1_ERR("NAS_LMM_BufMsgInQue, error: ... ",ulPriLevel);
        return NAS_LMM_FAIL;
    }

    if(NAS_LMM_NULL_PTR == pstFsmAddr)
    {
        NAS_LMM_PUBM_LOG_ERR("NAS_LMM_BufMsgInQue, error: NAS_LMM_NULL_PTR == pstFsmAddr ");
        return NAS_LMM_FAIL;
    }

    /* 依据优先级更新Queue的信息 */
    if( NAS_LMM_STORE_HIGH_PRIO_MSG      == ulPriLevel )
    {
        pucCnt                           = &(pstFsmAddr->ucHighPrioCnt);
    }
    else if( NAS_LMM_STORE_LOW_PRIO_MSG  == ulPriLevel )
    {
        pucCnt                           = &(pstFsmAddr->ucLowPrioCnt);
    }
    else
    {
        NAS_LMM_PUBM_LOG_NORM("NAS_LMM_BufMsgInQue: OTHER PRIO QUE ");
    }

    /* 更新Count的值 */
    if( NAS_LMM_NULL_PTR                 != pucCnt )
    {
        *pucCnt                          += 1;
        if( *pucCnt                      <= NAS_EMM_BUF_MSG_MAX_NUM )
        {
            ulRslt                      = NAS_LMM_SUCC;
        }
        else
        {
            NAS_LMM_PUBM_LOG_NORM("NAS_LMM_BufMsgInQue: QUE is overflow ");;
        }

    }

    return( ulRslt );
}
/*****************************************************************************
 Function Name  : NAS_LMM_FSM_PopStackCombine()
 Discription    : 出栈综合操作,包括3个操作:
                                    状态出栈,
                                    定时器出栈,
                                    全局变量出栈,
                  目前只有启动MRRC的RRC连接建立和释放两个过程涉及此操作,
                  后续鉴权过程会涉及到;
 Input          : 并行状态机ID, UE1.0中固定填NAS_LMM_PARALLEL_FSM_EMM
 Output         : None
 Return         : None
 History:
      1.  hanlufeng 41410  Draft Enact
*****************************************************************************/
VOS_VOID    NAS_LMM_FSM_PopStackCombine(
                NAS_LMM_PARALLEL_FSM_ENUM_UINT16 enParalFsmId)
{

    /* 入口检查 */
    if ( NAS_LMM_PARA_FSM_ID_INVALID(enParalFsmId))
    {
        NAS_LMM_PUBM_LOG1_ERR("RRC_FSM_BeginProcess, FsmId error, FsmId",
                            enParalFsmId);

        return;
    }


    /***************出栈前环境打印操作***************/
#if 0
    /* 打印出栈前的状态 */
    NAS_LMM_PrintFsmState(enParalFsmId);

    /* 打印当前状态涉及到的定时器状态 */
    NAS_LMM_PrintFsmTimer(enParalFsmId);
#endif
    /* 打印当前状态涉及到的全局变量的值 */




    /***************出栈操作***************/

    /* 状态机出栈操作 */
    NAS_LMM_FSM_PopState(enParalFsmId);

    /* 定时器状态出栈*/
    NAS_LMM_FSM_PopTimer(enParalFsmId);

    /* 相关全局变量出栈*/
    NAS_LMM_FSM_PopGlobPar();



    /***************出栈后环境打印操作***************/
    NAS_LMM_PUBM_LOG_NORM("======================================================================================");
    NAS_LMM_PUBM_LOG_NORM("======NAS_EMM Pop State To:======");

    /* 打印当前状态 */
    NAS_LMM_PrintFsmState(enParalFsmId);
    NAS_LMM_PUBM_LOG_NORM("======================================================================================");
    /* 打印当前状态涉及到的定时器状态 */
   /* NAS_LMM_PrintFsmTimer(enParalFsmId);
    */
    /* 打印当前状态涉及到的全局变量的值 */


    return;
}
/*****************************************************************************
 Function Name   : NAS_LMM_ReadMmcUsimFile
 Description     : 部分USIM文件是MMC读取的,LMM从MMC那里读到LMM中来
                   和V1R1比较,这些文件在V7中不再读:
                        6F62    MMC_READ_HPLMN_SEL_FILE_ID
                        6F7B    MMC_READ_FORBIDDEN_PLMN_LIST_FILE_ID
                        6F60    MMC_READ_UPLMN_SEL_FILE_ID
                        6F61    MMC_READ_OPLMN_SEL_FILE_ID
                        6F31    MMC_READ_HPLMN_PERI_FILE_ID
                        6FAD    MMC_READ_MNC_LENGTH_FILE_ID
                        6FDC    Last RPLMN Selection Indication

 Input           : None
 Output          : None
 Return          : VOS_UINT32

 History         :
    1.HanLufeng 41410      2011-2-23  Draft Enact

*****************************************************************************/
NAS_LMM_USIM_READ_RST_ENUM_UINT32  NAS_LMM_ReadMmcUsimFile(VOS_VOID)
{


    VOS_UINT32                          ulRst;
    PS_USIM_GET_FILE_CNF_STRU          *pstUsimCnfMsg;

    pstUsimCnfMsg = (PS_USIM_GET_FILE_CNF_STRU *)(g_aucNvimBuff);

    /*PC REPLAY MODIFY BY LEILI BEGIN*/
    /* 6F07    MMC_READ_IMSI_FILE_ID 读USIM卡提供的接口函数 */
    ulRst = NAS_EMM_GetCardIMSI((VOS_UINT8 *)(pstUsimCnfMsg->aucEf));
    /*PC REPLAY MODIFY BY LEILI END*/
    if(USIMM_API_SUCCESS != ulRst)
    {
        NAS_LMM_EMM_PLMN_LOG1_ERR("NAS_LMM_ReadMmcUsimFile : read IMSI err: ",
                                  ulRst);
        return  NAS_LMM_USIM_READ_HARD_IMSI_ERR;
    }
    else
    {
        /* 打印从USIM读出的原始码流 */
        NAS_LMM_PUBM_LOG_NORM("\n");
        NAS_LMM_PUBM_LOG_NORM("====== USIMM_GetCardIMSI: IMSI:  ======");
        NAS_COMM_PrintArray(             NAS_COMM_GET_MM_PRINT_BUF(),
                                         pstUsimCnfMsg->aucEf,
                                         NAS_LMM_NVIM_IMSI_FILE_LEN);
        NAS_LMM_PUBM_LOG_NORM("\n");

        /* 准备一下 NAS_LMM_ProcessHardUsimCnf 的入口参数 */
        pstUsimCnfMsg->usEfId   = NAS_USIM_FILE_ID_IMSI;
        pstUsimCnfMsg->usEfLen  = NAS_LMM_NVIM_IMSI_FILE_LEN;
        pstUsimCnfMsg->ucRecordNum = 0;
        pstUsimCnfMsg->ucTotalNum  = 0;

        /* 解码 */
        ulRst = NAS_LMM_ProcessHardUsimCnf(pstUsimCnfMsg);
        if(NAS_LMM_NVIM_OK != ulRst)
        {
            NAS_LMM_EMM_PLMN_LOG1_ERR("NAS_LMM_ReadMmcUsimFile : Decode IMSI err: ", ulRst);
            return  NAS_LMM_USIM_READ_HARD_IMSI_ERR;
        }
    }

    return  NAS_LMM_USIM_READ_SUCC;


    /* 不再读取 :   6F38    MMC_READ_UST_FILE_ID */
}
Example #4
0
VOS_UINT32  NAS_EMM_PreProcMsgEmmStatus( NAS_EMM_CN_MSG_STRU_UNION  * pCnMsg )
{
    NAS_EMM_CN_EMM_STATU_STRU           *pstTmpRcvMsg       = NAS_EMM_NULL_PTR;

    NAS_LMM_PUBM_LOG_NORM("NAS_EMM_PreProcMsgEmmStatus enter!");

    /*结构化消息,取出消息体*/
    pstTmpRcvMsg                 = (NAS_EMM_CN_EMM_STATU_STRU *)pCnMsg;

    NAS_LMM_PUBM_LOG1_NORM("NAS_EMM_PreProcMsgEmmStatus: EMM ERROR CAUSE ",pstTmpRcvMsg->ucEmmCause);

    return NAS_LMM_MSG_HANDLED;
}
VOS_UINT32  NAS_LMM_ExistMsgInFsmQue(NAS_LMM_PARALLEL_FSM_ENUM_UINT16 enParalFsmId,
                                 VOS_UINT32                 ulPriLevel)
{
    NAS_LMM_FSM_MSG_BUF_STRU             *pstFsmMsgBuffAddr = NAS_LMM_NULL_PTR;
    VOS_UINT8                           ucMsgCont = NAS_EMM_MSG_BUF_EMPTY;
    VOS_UINT32                          ulRsltExistMsgInQue = NAS_LMM_FAIL;


    /* 获取缓存 FSM Buffer的地址 */
    pstFsmMsgBuffAddr                   = NAS_LMM_GetFsmBufAddr( enParalFsmId );
    if(NAS_LMM_NULL_PTR                  == pstFsmMsgBuffAddr)
    {
        NAS_LMM_PUBM_LOG_WARN(           "NAS_LMM_ExistMsgInFsmQue, Get pstFsmMsgBuffAddr Fail!");
        return  NAS_LMM_FAIL;

    }
    if (NAS_LMM_STORE_HIGH_PRIO_MSG == ulPriLevel)
    {
        NAS_LMM_PUBM_LOG_NORM("NAS_LMM_ExistMsgInFsmQue: HIGH PRIO QUE!");
        ucMsgCont                       = pstFsmMsgBuffAddr->ucHighPrioCnt;
    }
    else if (NAS_LMM_STORE_LOW_PRIO_MSG == ulPriLevel)
    {
        NAS_LMM_PUBM_LOG_NORM("NAS_LMM_ExistMsgInFsmQue: LOW PRIO QUE!");
        ucMsgCont                       = pstFsmMsgBuffAddr->ucLowPrioCnt;
    }
    else
    {
        NAS_LMM_PUBM_LOG_WARN("NAS_LMM_ExistMsgInFsmQue: OTHER PRIO QUE!");
    }

    if (NAS_EMM_MSG_BUF_EMPTY != ucMsgCont)
    {
        NAS_LMM_PUBM_LOG_NORM("NAS_ExistMsgInFsmQue: EXIST MSG IN QUE!");
        ulRsltExistMsgInQue = NAS_LMM_SUCC;
    }

    return ulRsltExistMsgInQue;
}
VOS_VOID  NAS_LMM_BufMsgQueFree( VOS_VOID )
{
    /* 当前只考虑释放EMM和MMC的高低优先级;如果以后用到其它的Que或中优先级,
    ** 需要添加对应的资源的处理 */

    NAS_LMM_PUBM_LOG_NORM( "NAS_LMM_BufMsgQueFree" );

    NAS_LMM_ClearBufMsgQue( NAS_LMM_PARALLEL_FSM_EMM , NAS_LMM_STORE_HIGH_PRIO_MSG );
    NAS_LMM_ClearBufMsgQue( NAS_LMM_PARALLEL_FSM_EMM , NAS_LMM_STORE_LOW_PRIO_MSG );
    /*NAS_LMM_ClearBufMsgQue( NAS_LMM_PARALLEL_FSM_MMC , NAS_LMM_STORE_HIGH_PRIO_MSG );
    NAS_LMM_ClearBufMsgQue( NAS_LMM_PARALLEL_FSM_MMC , NAS_LMM_STORE_LOW_PRIO_MSG );*/
    NAS_LMM_ClearBufMsgQue( NAS_LMM_PARALLEL_FSM_SECU , NAS_LMM_STORE_HIGH_PRIO_MSG );
    NAS_LMM_ClearBufMsgQue( NAS_LMM_PARALLEL_FSM_SECU , NAS_LMM_STORE_LOW_PRIO_MSG );
}
NAS_LMM_BUFF_MSG_STRU * NAS_LMM_GetStoreBufMsgAddr(
                NAS_LMM_FSM_MSG_BUF_STRU*        pstFsmAddr,
                VOS_UINT32                      ulPriLevel)
{
    NAS_LMM_BUFF_MSG_STRU				*pstMsgBuffAddr = NAS_LMM_NULL_PTR;
    VOS_UINT8                           ucCnt;

    /* 入参检查出错 */
    /* 打印错误信息 */
    if ( (ulPriLevel < NAS_LMM_STORE_HIGH_PRIO_MSG ) ||
         (ulPriLevel > NAS_LMM_STORE_LOW_PRIO_MSG ))
    {
        NAS_LMM_PUBM_LOG1_ERR("NAS_GetStoreBufMsgAddr, error: ... ",ulPriLevel);
        return NAS_LMM_NULL_PTR;
    }

    if(NAS_LMM_NULL_PTR == pstFsmAddr)
    {
        NAS_LMM_PUBM_LOG_ERR("NAS_GetStoreBufMsgAddr, error: NAS_LMM_NULL_PTR == pstFsmAddr ");
        return NAS_LMM_NULL_PTR;
    }

    /* 依据优先级获得缓存Buffer的地址*/

    if( NAS_LMM_STORE_HIGH_PRIO_MSG == ulPriLevel )
    {
        ucCnt = pstFsmAddr->ucHighPrioCnt;
        if(ucCnt < NAS_EMM_BUF_MSG_MAX_NUM)
        {
            pstMsgBuffAddr = (pstFsmAddr->astHighPrioBufQue+ucCnt);
        }
    }
    else if( NAS_LMM_STORE_LOW_PRIO_MSG == ulPriLevel )
    {
        ucCnt = pstFsmAddr->ucLowPrioCnt;
        if(ucCnt < NAS_EMM_BUF_MSG_MAX_NUM)
        {
            pstMsgBuffAddr = (pstFsmAddr->astLowPrioBufQue+ucCnt);
        }
    }
    else
    {
        NAS_LMM_PUBM_LOG_NORM("NAS_GetStoreBufMsgAddr: OTHER QUE ADDR");
    }
    return( pstMsgBuffAddr );
}
/*****************************************************************************
 Function Name  : 清除MM层各状态机的栈
 Discription    : NAS_LMM_FSM_ClearStackResource
 Input          :
 Output         : None
 Return         : None
 History:
      1.  hanlufeng 41410  Draft Enact
*****************************************************************************/
VOS_VOID    NAS_LMM_FSM_ClearStackResource(VOS_VOID)
{
    VOS_UINT32                          ulFsmId;
    NAS_LMM_FSM_STATE_STACK_STRU        *pEmmStack;

    NAS_LMM_PUBM_LOG_NORM("NAS_LMM_FSM_ClearStackResource enter.");

    for(ulFsmId = NAS_LMM_PARALLEL_FSM_EMM;
        ulFsmId < NAS_LMM_PARALLEL_FSM_BUTT;
        ulFsmId++)
    {
        pEmmStack   = NAS_LMM_GetFsmStackAddr(ulFsmId);

        /* 栈顶位置指示,即栈深度,设为0 */
        pEmmStack->ucStackDepth             = NAS_EMM_STACK_EMPTY;
    }

    return;
}
/*******************************************************************************
  Module   :
  Function : NAS_LMM_SendMrrcDataReq_SMS
  Input    : pMsg         :SMS透传过来的消息
  Output   :
  NOTE     :
  Return   :VOS_VOID
  History  :
    1.  FTY  2011.11.14  新规作成

*******************************************************************************/
VOS_VOID    NAS_EMM_SMS_SendMrrcDataReq_SmsData( MsgBlock * pMsg)
{
    NAS_EMM_MRRC_DATA_REQ_STRU         *pMrrcDataReqMsg    = NAS_EMM_NULL_PTR;
    SMS_LMM_DATA_REQ_STRU               *pRcvSmsMsg        = NAS_EMM_NULL_PTR ;

    NAS_LMM_PUBM_LOG_NORM("NAS_EMM_SMS_SendMrrcDataReq_SmsData enter!");

    if (NAS_EMM_NULL_PTR == pMsg)
    {
        /*打印错误*/
        NAS_EMM_PUBU_LOG_ERR("NAS_EMM_SMS_SendMrrcDataReq_SmsData: Input para is invalid!--pMsg is NULL!");
        return;
    }

    /* 以最短消息长度申请DOPRA消息 */
    pMrrcDataReqMsg = (VOS_VOID *)NAS_LMM_MEM_ALLOC(NAS_EMM_INTRA_MSG_MAX_SIZE);
    if(NAS_EMM_NULL_PTR == pMrrcDataReqMsg)
    {
        NAS_EMM_PUBU_LOG_ERR( "NAS_EMM_SMS_SendMrrcDataReq_SmsData: MSG ALLOC ERR !!");
        return;
    }

    pRcvSmsMsg = (SMS_LMM_DATA_REQ_STRU *)pMsg;

    /* 构造MRRC_DATA_REQ 消息*/
    NAS_EMM_SMS_CompMsgUpLinkNasTransportMrrcDataReqMsg(pMrrcDataReqMsg,  &(pRcvSmsMsg->stSmsMsg));

    /*空口消息上报 UPLINK NAS TRANSPORT*/
    NAS_LMM_SendOmtAirMsg(NAS_EMM_OMT_AIR_MSG_UP, NAS_EMM_UPLINK_NAS_TRANSPORT,(NAS_MSG_STRU *)&(pMrrcDataReqMsg->stNasMsg));

    /*关键事件上报 UPLINK NAS TRANSPORT*/
    NAS_LMM_SendOmtKeyEvent(EMM_OMT_KE_EMM_UPLINK_NAS_TRANSPORT);

    /* 发送消息(Send the msg of) MRRC_DATA_REQ(UPLINK NAS TRANSPORT) */
    NAS_EMM_SndUplinkNasMsg(pMrrcDataReqMsg);

    NAS_LMM_MEM_FREE(pMrrcDataReqMsg);

    return;

}
VOS_VOID NAS_EMM_SendImsiDetachReqMo( VOS_VOID )
{
    NAS_LMM_FSM_STATE_STRU               stEmmState;

    NAS_LMM_PUBM_LOG_NORM("NAS_EMM_SendImsiDetachReqMo is enter.");

    /*启动定时器T3421*/
    NAS_LMM_StartStateTimer(         TI_NAS_EMM_T3421);

    /*修改状态:进入主状态EMM_MS_REG子状态EMM_SS_REG_IMSI_DETACH_WATI_CN_DETACH_CNF*/
    stEmmState.enFsmId                    = NAS_LMM_PARALLEL_FSM_EMM;
    stEmmState.enMainState                = EMM_MS_REG;
    stEmmState.enSubState                 = EMM_SS_REG_IMSI_DETACH_WATI_CN_DETACH_CNF;
    stEmmState.enStaTId                   = TI_NAS_EMM_T3421;
    NAS_LMM_StaTransProc(stEmmState);

    /*向MRRC发送DETACH REQUEST消息*/
    NAS_EMM_MrrcSendDetReqMo();

    return;
}
VOS_VOID    NAS_LMM_AddTaInTaList
(
    const   NAS_MM_TA_STRU              *pstTa,
    NAS_MM_TA_LIST_STRU                 *pstTaList,
    VOS_UINT32                          ulListNumMax
)
{
    VOS_UINT32                          i;

    if (NAS_LMM_MATCH_SUCCESS == NAS_LMM_TaMatchTaList(pstTa, pstTaList))
    {
         NAS_LMM_PUBM_LOG_NORM("NAS_LMM_AddTaInTaList: TA is already in TaiList. ");
         return;
    }

    /* 列表中不存在当前要加入被禁列表的TA*/
    /* TA个数没有到最大,直接将TA加到末尾 */
    if (ulListNumMax > pstTaList->ulTaNum)
    {
        NAS_LMM_TaCpy(&pstTaList->astTa[pstTaList->ulTaNum],pstTa);
        pstTaList->ulTaNum++;
    }
    /* TA个数到最大,将TA加到末尾,其余TA往前移动,第一个TA移出 */
    else
    {
        pstTaList->ulTaNum             = ulListNumMax;

        for (i=0; i<(ulListNumMax -1) ; i++)
        {
            NAS_LMM_TaCpy(&(pstTaList->astTa[i]),
                         &(pstTaList->astTa[i+1]));
        }

        NAS_LMM_TaCpy(&(pstTaList->astTa[i]),
                     pstTa);
    }
    return;

}
VOS_VOID  NAS_EMM_InitBufMsgQue( VOS_VOID )
{
    VOS_UINT32                          ulCont;
    NAS_LMM_FSM_MSG_BUF_STRU             *pstEmmFsmMsgBuf;

    NAS_LMM_PUBM_LOG_NORM(
    "NAS_EMM_InitBufMsgQue              START INIT...");

    /* 当前状态初始化 */
    /* 缓存消息队列初始化 */
    pstEmmFsmMsgBuf                     = NAS_LMM_GetFsmBufQueueAddr(NAS_LMM_PARALLEL_FSM_EMM);
    pstEmmFsmMsgBuf->ucHighPrioCnt      = NAS_EMM_MSG_BUF_EMPTY;
    pstEmmFsmMsgBuf->ucMidPrioCnt       = NAS_EMM_MSG_BUF_EMPTY;
    pstEmmFsmMsgBuf->ucLowPrioCnt       = NAS_EMM_MSG_BUF_EMPTY;
    for ( ulCont = 0; ulCont < NAS_EMM_BUF_MSG_MAX_NUM; ulCont++ )
    {
        pstEmmFsmMsgBuf->astHighPrioBufQue[ulCont].pBuffMsg = NAS_LMM_NULL_PTR;
        pstEmmFsmMsgBuf->astMidPrioBufQue[ulCont].pBuffMsg = NAS_LMM_NULL_PTR;
        pstEmmFsmMsgBuf->astLowPrioBufQue[ulCont].pBuffMsg = NAS_LMM_NULL_PTR;
    }

}
/*******************************************************************************
  Module   :
  Function : NAS_EMM_SMS_CompMsgUpLinkNasTransportMrrcDataReqMsg
  Input    :pMsg         :SMS透传过来的消息
  Output   :pMrrcDataReqMsg  : 指向 LRRC_LNAS_MSG_STRU
  NOTE     :
  Return   :
  History  :
    1.  FTY  2011.11.15  新规作成

*******************************************************************************/
VOS_VOID NAS_EMM_SMS_CompMsgUpLinkNasTransportMrrcDataReqMsg
                    (NAS_EMM_MRRC_DATA_REQ_STRU *pMrrcDataReqMsg, const LMM_SMS_MSG_STRU * pSmsMsg)
{
    VOS_UINT32               uldataReqMsgLenNoHeader   = NAS_LMM_NULL;
    VOS_UINT32               ulCnNasMsgLen             = NAS_LMM_NULL;

    NAS_LMM_PUBM_LOG_NORM("NAS_EMM_CompMsgUpLinkNasTransportMrrcDataReqMsg enter!");

    /*构造MRRC_DATA_REQ 中的 NAS_MSG_STRU,即CN消息(Compose the msg of):UpLink NAS Transport*/
    NAS_EMM_SMS_CompCnUplinkNasTransportMsg(pMrrcDataReqMsg->stNasMsg.aucNasMsg, &ulCnNasMsgLen, pSmsMsg);

    pMrrcDataReqMsg->stNasMsg.ulNasMsgSize = ulCnNasMsgLen;

    uldataReqMsgLenNoHeader = NAS_EMM_CountMrrcDataReqLen(ulCnNasMsgLen);

    if ( NAS_EMM_INTRA_MSG_MAX_SIZE < uldataReqMsgLenNoHeader )
    {
        /* 打印错误信息 */
        NAS_LMM_PUBM_LOG_ERR("NAS_EMM_SMS_CompMsgUpLinkNasTransportMrrcDataReqMsg, Size error ");

        return ;
    }

    /* 填写MRRC_DATA_REQ 的DOPRA消息头 */
    EMM_COMP_MM_MSG_HEADER(pMrrcDataReqMsg, uldataReqMsgLenNoHeader);

    /* 填写MRRC_DATA_REQ 的消息ID标识 */
    pMrrcDataReqMsg->ulMsgId                 = ID_NAS_LMM_INTRA_MRRC_DATA_REQ;

    /*填充 NAS_EMM_NAS_UPLINK_NAS_TRANSPORT*/
    pMrrcDataReqMsg->enEstCaue     = LRRC_LNAS_EST_CAUSE_MO_DATA;
    pMrrcDataReqMsg->enCallType    = LRRC_LNAS_CALL_TYPE_ORIGINATING_CALL;
    pMrrcDataReqMsg->enEmmMsgType  = NAS_EMM_NAS_UPLINK_NAS_TRANSPORT;
    pMrrcDataReqMsg->enDataCnf     = LRRC_LMM_DATA_CNF_NOT_NEED;
    pMrrcDataReqMsg->ulEsmMmOpId   = NAS_LMM_OPID;

    return;
}
Example #14
0
VOS_UINT32  NAS_EMM_PreProcMsgEmmInfo( NAS_EMM_CN_MSG_STRU_UNION  * pCnMsg )
{
    NAS_EMM_INFO_STRU                   *pstEmmInfo;
    NAS_EMM_CN_EMM_INFO_STRU            *pstTmpRcvMsg       = NAS_EMM_NULL_PTR;
    VOS_UINT8                           ucCount = 0;

    NAS_LMM_PUBM_LOG_NORM("NAS_EMM_PreProcMsgEmmInfo enter!");

    pstTmpRcvMsg               = (NAS_EMM_CN_EMM_INFO_STRU*)pCnMsg;
    pstEmmInfo                 = NAS_LMM_GetEmmInfoNasEmmInfoListAddr();

    NAS_LMM_MEM_SET(pstEmmInfo, 0, sizeof(NAS_EMM_INFO_STRU));

    /* 上报网络时间和网络名称,只要能收到,就可以上报给AT,对流程没有影响,可以不做限制;
    而且未注册时,网络也不会有下行消息下发*/
    if(NAS_EMM_BIT_SLCT == pstTmpRcvMsg->bitOpFullName)
    {
        pstEmmInfo->bitOpFullName           = NAS_EMM_BIT_SLCT;
        NAS_LMM_MEM_CPY(                   pstEmmInfo->aucOperatorNameLong,
                                           pstTmpRcvMsg->aucOperatorNameLong,
                                           MMC_LMM_MAX_OPER_LONG_NAME_LEN);
        ucCount++;
    }

    if(NAS_EMM_BIT_SLCT == pstTmpRcvMsg->bitOpShortName)
    {
        pstEmmInfo->bitOpShortName          = NAS_EMM_BIT_SLCT;
        NAS_LMM_MEM_CPY(                   pstEmmInfo->aucOperatorNameShort,
                                           pstTmpRcvMsg->aucOperatorNameShort,
                                           MMC_LMM_MAX_OPER_SHORT_NAME_LEN);
        ucCount++;
    }

    if(NAS_EMM_BIT_SLCT == pstTmpRcvMsg->bitOpLocTimeZone)
    {
        pstEmmInfo->bitOpLocTimeZone        = NAS_EMM_BIT_SLCT;
        NAS_LMM_MEM_CPY(                   &(pstEmmInfo->stLocTimeZone),
                                           &(pstTmpRcvMsg->stLocTimeZone),
                                           sizeof(NAS_EMM_CN_TIMEZONE_STRU));
        ucCount++;
    }

    if(NAS_EMM_BIT_SLCT == pstTmpRcvMsg->bitOpUniTimeLocTimeZone)
    {
        pstEmmInfo->bitOpUniTimeLocTimeZone = NAS_EMM_BIT_SLCT;
        NAS_LMM_MEM_CPY(                   &(pstEmmInfo->stTimeZoneAndTime),
                                           &(pstTmpRcvMsg->stTimeZoneAndTime),
                                           sizeof(NAS_EMM_CN_TIMEZONE_UNITIME_STRU));
	ucCount++;
    }

    if(NAS_EMM_BIT_SLCT == pstTmpRcvMsg->bitOpDaylightTime)
    {
        pstEmmInfo->bitOpDaylightTime       = NAS_EMM_BIT_SLCT;
        NAS_LMM_MEM_CPY(                   &(pstEmmInfo->enDaylightSavingTime),
                                           &(pstTmpRcvMsg->enDaylightSavingTime),
                                           sizeof(NAS_LMM_DAYLIGHT_SAVE_TIME_ENUM_UINT8));
        ucCount++;
    }
    if(0 != ucCount)
    {
        NAS_EMM_SendMmcEmmInfoInd(pstEmmInfo);
    }
    return NAS_LMM_MSG_HANDLED;
}
VOS_VOID    NAS_LMM_ClearBufMsgQue(
                NAS_LMM_PARALLEL_FSM_ENUM_UINT16     enParalFsmId,
                VOS_UINT32                          ulBufPriLevel)
{

    NAS_LMM_FSM_MSG_BUF_STRU             *pstFsmMsgBuffAddr  = NAS_LMM_NULL_PTR;
    NAS_LMM_BUFF_MSG_STRU				*pstBuffer          = NAS_LMM_NULL_PTR;
    NAS_LMM_BUFF_MSG_STRU				*pstQueMsg          = NAS_LMM_NULL_PTR;
    VOS_UINT8                           *pucCnt             = NAS_LMM_NULL_PTR;
    VOS_UINT8                           ucFreeCnt;
    VOS_UINT32                          ulRslt;

    /* 获取缓存FSM Buffer的地址 */
    pstFsmMsgBuffAddr                   = NAS_LMM_GetFsmBufAddr( enParalFsmId );
    if(NAS_LMM_NULL_PTR                  == pstFsmMsgBuffAddr)
    {
        NAS_LMM_PUBM_LOG_WARN(           "NAS_LMM_ClearBufMsgQue, Get pstFsmMsgBuffAddr Fail!");
        return;

    }

    /* 依据优先级取消息  */
    if (NAS_LMM_STORE_HIGH_PRIO_MSG      == ulBufPriLevel)
    {
        pucCnt                           = &(pstFsmMsgBuffAddr->ucHighPrioCnt);
        pstQueMsg                        = pstFsmMsgBuffAddr->astHighPrioBufQue;
    }
    else if (NAS_LMM_STORE_LOW_PRIO_MSG      == ulBufPriLevel)
    {
        pucCnt                           = &(pstFsmMsgBuffAddr->ucLowPrioCnt );
        pstQueMsg                        = pstFsmMsgBuffAddr->astLowPrioBufQue;
    }
    else
    {
        NAS_LMM_PUBM_LOG_NORM("NAS_LMM_ClearBufMsgQue: OTHER QUE");
    }

    /* 释放消息*/
    if ( (pucCnt != NAS_LMM_NULL_PTR) && (pstQueMsg != NAS_LMM_NULL_PTR) )
    {
        for(ucFreeCnt = 0 ; (ucFreeCnt < *pucCnt) && (ucFreeCnt < NAS_EMM_BUF_MSG_MAX_NUM) ; ucFreeCnt++)
        {
            pstBuffer                   = pstQueMsg[ucFreeCnt].pBuffMsg;
            ulRslt = NAS_COMM_FreeBuffItem(NAS_COMM_BUFF_TYPE_EMM, pstBuffer);

            if (NAS_COMM_BUFF_SUCCESS != ulRslt)
            {
                NAS_LMM_PUBM_LOG_WARN("NAS_LMM_ClearBufMsgQue, Memory Free is not succ");
            }

            /* 赋初值   */
            pstQueMsg[ucFreeCnt].pBuffMsg
                                        = NAS_LMM_NULL_PTR;
            pstQueMsg[ucFreeCnt].ulEvtType
                                        = 0;

            NAS_LMM_PUBM_LOG3_NORM(       "NAS_LMM_ClearBufMsgQue: Free Msg: enParalFsmId:,ulBufPriLevel,*pucCnt",
                                          enParalFsmId,ulBufPriLevel,*pucCnt);

        }

        *pucCnt                         = 0;
    }

    return;
}
VOS_UINT32 NAS_LMM_OutMsgFromQue( NAS_LMM_PARALLEL_FSM_ENUM_UINT16 enParalFsmId,
                                        VOS_UINT32         ulBufPriLevel,
                                        NAS_LMM_BUFF_MSG_STRU   *pstGetMsg)
{
    VOS_UINT32                          ulLoop;
    VOS_UINT8                           *pucMsgCnt          = NAS_LMM_NULL_PTR;
    NAS_LMM_BUFF_MSG_STRU				*pstBuffer          = NAS_LMM_NULL_PTR;
    NAS_LMM_FSM_MSG_BUF_STRU             *pstFsmMsgBuffAddr  = NAS_LMM_NULL_PTR;
    VOS_UINT32                          ulRslt              = NAS_LMM_NOT_TRAVEL_BUFFER_MSG;


    /* 参数检查*/
    if (enParalFsmId != NAS_LMM_PARALLEL_FSM_EMM )
    {
        NAS_LMM_PUBM_LOG1_WARN("NAS_LMM_OutMsgFromQue: FsmId error, FsmId:", enParalFsmId);
        return ulRslt;
    }

    if (NAS_LMM_NULL_PTR == pstGetMsg)
    {
        NAS_LMM_PUBM_LOG_WARN("NAS_LMM_OutMsgFromQue: pstGetMsg is null");
        return ulRslt;
    }

    /* 获取缓存FSM Buffer的地址 */

    pstFsmMsgBuffAddr                   = NAS_LMM_GetFsmBufAddr( enParalFsmId );
    if(NAS_LMM_NULL_PTR                  == pstFsmMsgBuffAddr)
    {
        NAS_LMM_PUBM_LOG_WARN(           "NAS_LMM_OutMsgFromQue, Get pstFsmMsgBuffAddr Fail!");
        return  ulRslt;

    }

    /* 依据优先级取相关参数*/

    if (NAS_LMM_STORE_HIGH_PRIO_MSG == ulBufPriLevel)
    {
        NAS_LMM_PUBM_LOG_NORM("NAS_LMM_OutMsgFromQue: high prio buff");
        pstBuffer = pstFsmMsgBuffAddr->astHighPrioBufQue;
        pucMsgCnt = &(pstFsmMsgBuffAddr->ucHighPrioCnt);

    }
    else if (NAS_LMM_STORE_LOW_PRIO_MSG == ulBufPriLevel)
    {

        NAS_LMM_PUBM_LOG_NORM("NAS_LMM_OutMsgFromQue: low prio buff");
        pstBuffer = pstFsmMsgBuffAddr->astLowPrioBufQue;
        pucMsgCnt = &(pstFsmMsgBuffAddr->ucLowPrioCnt);
    }
    else
    {
        NAS_LMM_PUBM_LOG_WARN("NAS_LMM_OutMsgFromQue is entered");
        return ulRslt;
    }


    /* 队列中有消息存在 */

    if ((*pucMsgCnt > 0) && (*pucMsgCnt <= NAS_EMM_BUF_MSG_MAX_NUM))
    {
        NAS_LMM_PUBM_LOG1_NORM("NAS_LMM_OutMsgFromQue: ucMsgCnt valid, *pucMsgCnt = ",*pucMsgCnt);

        /* 将第一个发送出来 */
        pstGetMsg->ulEvtType = pstBuffer[0].ulEvtType;
        pstGetMsg->pBuffMsg = pstBuffer[0].pBuffMsg;

        /* 后面的依次前移 */
        for (ulLoop = 1; ulLoop < *pucMsgCnt; ulLoop++)
        {
            pstBuffer[ulLoop - 1].pBuffMsg  = pstBuffer[ulLoop].pBuffMsg;
            pstBuffer[ulLoop - 1].ulEvtType = pstBuffer[ulLoop].ulEvtType;
        }

        /* 将消息缓存指针置空 */
        pstBuffer[*pucMsgCnt - 1].pBuffMsg = VOS_NULL_PTR;
        pstBuffer[*pucMsgCnt - 1].ulEvtType = 0;

        /* 数目-1 */
        (*pucMsgCnt) --;

        ulRslt = NAS_LMM_TRAVEL_BUFFER_MSG;

    }
    else
    {
        NAS_LMM_PUBM_LOG_NORM("NAS_LMM_OutMsgFromQue: *pucMsgCnt is invalid");
    }

    return ulRslt;
}