VOS_VOID MTC_IntrusionModemPowerStateChange(
    MODEM_ID_ENUM_UINT16                enModemId,
    MTC_MODEM_POWER_STATE_ENUM_UINT8    enPowerState
)
{
    if (MTC_MODEM_POWER_OFF == enPowerState)
    {
        if (MODEM_ID_0 == enModemId)
        {
            if (MTC_MODEM_POWER_ON == MTC_GetModemPowerState(MODEM_ID_1))
            {
                /* 给Modem1的GAS发送启用B3指示 */
                MTC_IntrusionEnableB3();
            }
        }
        else
        {
            if (MTC_MODEM_POWER_ON == MTC_GetModemPowerState(MODEM_ID_0))
            {
                /* 给Modem0的TD&LTE发送启用B39指示 */
                MTC_IntrusionEnableB39();
            }
        }
    }

    return;
}
VOS_VOID MTC_ProcIntrusionStrategy(VOS_VOID)
{
    MTC_MODEM_POWER_STATE_ENUM_UINT8        enModem0PowerState;
    MTC_MODEM_POWER_STATE_ENUM_UINT8        enModem1PowerState;
    VOS_UINT32                              ulLoop;
    VOS_UINT32                              ulLineNum;
    MTC_INTRUSION_GSM_BAND_STATE_ENUM_UINT8 enGsmBandState;
    MTC_INTRUSION_TL_BAND_STATE_ENUM_UINT8  enTLBandState;
    MTC_CS_SERVICE_STATE_ENUM_UINT8         enCsSrvState;
    FUNC_VOID                               pFunc           = VOS_NULL_PTR;

    /* 获取Modem0与Modem1的开机状态,只有在同时开机的情况下才进行裁决 */
    enModem0PowerState  = MTC_GetModemPowerState(MODEM_ID_0);
    enModem1PowerState  = MTC_GetModemPowerState(MODEM_ID_1);
    if ( (MTC_MODEM_POWER_ON != enModem0PowerState)
      || (MTC_MODEM_POWER_ON != enModem1PowerState) )
    {
        return;
    }

    /* 获取本地存储的频段信息,查询裁决策略表,执行对应操作 */
    ulLineNum       = sizeof(g_astMtcIntrusionRulingStrategyTbl) / sizeof(MTC_INTRUSION_RULING_STRATEGY_STRU);
    enGsmBandState  = MTC_GetModem1GsmBandState();
    enTLBandState   = MTC_GetModem0TLBandState();
    enCsSrvState    = MTC_GetModemCsSrvExistFlg(MODEM_ID_1);

    for (ulLoop = 0; ulLoop < ulLineNum; ulLoop++)
    {
        if (g_astMtcIntrusionRulingStrategyTbl[ulLoop].enGsmBandState != enGsmBandState)
        {
            continue;
        }

        if (g_astMtcIntrusionRulingStrategyTbl[ulLoop].enTLBandState != enTLBandState)
        {
            continue;
        }

        if (MTC_CS_SERVICE_STATE_BUTT != g_astMtcIntrusionRulingStrategyTbl[ulLoop].enCsSrvState)
        {
            if (enCsSrvState != g_astMtcIntrusionRulingStrategyTbl[ulLoop].enCsSrvState)
            {
                continue;
            }
        }

        pFunc = g_astMtcIntrusionRulingStrategyTbl[ulLoop].pFunc;

        break;
    }

    if (VOS_NULL_PTR != pFunc)
    {
        pFunc();
    }

    return;
}
VOS_VOID MTC_ChangeNarrowBandDcsState(
    PS_BOOL_ENUM_UINT8                  enEnableFlag
)
{
    /* 如果与当前状态一致则直接返回 */
    if (MTC_GetNarrowDcsEnalbeFlag() == enEnableFlag)
    {
        return;
    }

    /* 只有在该Modem开机时才下发裁决指示 */
    if (MTC_MODEM_POWER_ON == MTC_GetModemPowerState(MODEM_ID_1))
    {
        /* 判断当前接入技术是否支持G模*/
        if (VOS_TRUE == MTC_IsSupportRatType(MODEM_ID_1, MTC_RATMODE_GSM))
        {
            /* 给副卡GAS下发Narrow Band dcs 裁决 */
            MTC_SndRrcBandCfgInd(I1_UEPS_PID_GAS, enEnableFlag);
        }
    }

    /* 记录Notch标志 */
    MTC_SetNarrowDcsEnalbeFlag(enEnableFlag);

    return;
}
VOS_VOID MTC_SndImsaModem1InfoInd(VOS_VOID)
{
    MTC_IMSA_MODEM1_INFO_IND_STRU      *pstModem1Info = VOS_NULL_PTR;

    /* IMSA没有Start则不需要发消息 */
    if (MTC_MODEM_POWER_ON != MTC_GetModemImsaState(MODEM_ID_0))
    {
        return;
    }

    /* 申请消息包 */
    pstModem1Info = (MTC_IMSA_MODEM1_INFO_IND_STRU *)MTC_ALLOC_MSG_WITH_HDR(sizeof(MTC_IMSA_MODEM1_INFO_IND_STRU));
    if (VOS_NULL_PTR == pstModem1Info)
    {
        MTC_ERROR_LOG("MTC_SndImsaModem1InfoInd: Alloc Msg Fail!");
        return;
    }

    /* 清空消息内容 */
    PS_MEM_SET(MTC_GET_MSG_ENTITY(pstModem1Info), 0x00, MTC_GET_MSG_LENGTH(pstModem1Info));

    /* 填充消息头 */
    MTC_CFG_IMSA_MSG_HDR(pstModem1Info, ID_MTC_IMSA_MODEM1_INFO_IND);

    /* 填写Modem1的信息 */
    pstModem1Info->enPowerState = MTC_GetModemPowerState(MODEM_ID_1);

    /* 发送消息 */
    MTC_SEND_MSG(pstModem1Info);

    return;
}
VOS_VOID MTC_ProcTlRfCtrl(CONST RRC_MTC_MS_BAND_INFO_STRU *pstSerCellBandInfo)
{
    /* 副卡关机状态下直接返回 */
    if (MTC_MODEM_POWER_OFF == MTC_GetModemPowerState(MODEM_ID_1))
    {
        return;
    }

    /* 存在B39频段信息, 通知DSP关闭TL射频的上行发射 */
    if (MTC_BAND_CHECK64(*((VOS_UINT64 *)&(pstSerCellBandInfo->aulBandInfo[0])), MTC_BAND_MASK_B39))
    {
        if (PS_FALSE == MTC_GetTlRfCtrlEnalbeFlag())
        {
            MTC_SetTlRfCtrlEnalbeFlag(PS_TRUE);
            MTC_SndI1GasRrcTdsLteRfCtrlInd(PS_TRUE);
        }
    }
    else
    {
        if (PS_TRUE== MTC_GetTlRfCtrlEnalbeFlag())
        {
            MTC_SetTlRfCtrlEnalbeFlag(PS_FALSE);
            MTC_SndI1GasRrcTdsLteRfCtrlInd(PS_FALSE);
        }
    }

    return;
}
VOS_VOID MTC_ProcCurrCampPlmnInfoForSvlte(VOS_VOID)
{
    MTC_MODEM_POWER_STATE_ENUM_UINT8    enModem1PowerState;
    MTC_MODEM_NETWORK_INFO_STRU        *pstModem0NetworkInfo = VOS_NULL_PTR;
    MTC_PS_TRANSFER_ENUM_UINT8          enPsTransferSolution;
    MTC_RATMODE_ENUM_UINT8              enModem0RateMode;

    VOS_UINT8                           ucUsimValidFlag;

    MTC_PS_TRANSFER_CTX_STRU           *pstPsTransferCtx    = VOS_NULL_PTR;
    pstPsTransferCtx                    = MTC_GetPsTransferCtxAddr();

    enModem1PowerState      = MTC_GetModemPowerState(MODEM_ID_1);
    pstModem0NetworkInfo    = MTC_GetModemNetworkInfoAddr(MODEM_ID_0);
    enPsTransferSolution    = MTC_GetPsTransferCfg();
    enModem0RateMode        = MTC_GetModemRatMode(MODEM_ID_0);



    /* Modem1关机,国外模式无需PS域迁移 */
    if (MTC_MODEM_POWER_OFF == enModem1PowerState)
    {
        return;
    }

    ucUsimValidFlag = MTC_GetModemUsimValidFlag(MODEM_ID_0);

    /* 1、modem1处于开机状态
       2、当前驻留网络接入技术为T/L(OscarTL通过主卡的G重选回T/L)
       3、当前驻留网络非禁止plmn
       4、单待模式modem0的ps是detach状态,上报PS域迁移指示 */
    if ( ( (MTC_RATMODE_LTE == enModem0RateMode)
        || (MTC_RATMODE_TDS == enModem0RateMode) )
      && (VOS_FALSE == pstModem0NetworkInfo->ucIsForbiddenPlmnFlag)
      && (VOS_TRUE == ucUsimValidFlag)
      && (VOS_FALSE == pstModem0NetworkInfo->stPsDomainInfo.ucPsAttachAllowFlg)
      && (VOS_TRUE == pstModem0NetworkInfo->stPsDomainInfo.ucPsSupportFlg) )
    {
        /* PS域迁移策略脱网重选,上报网络恢复指示AT命令 */
        if (MTC_PS_TRANSFER_LOST_AREA == enPsTransferSolution)
        {
            MTC_SndModem0MtaPsTransferInd(MTC_PS_TRANSFER_CAUSE_AREA_AVALIABLE);
            MTC_SndModem0MmaPsTransferInd(MTC_PS_TRANSFER_CAUSE_AREA_AVALIABLE);
        }

        /* PS域迁移策略离网重选,上报网络恢复指示AT命令 */
        if ((MTC_PS_TRANSFER_OFF_AREA == enPsTransferSolution)
         && (MTC_PS_TRANSFER_CAUSE_AREA_AVALIABLE == pstPsTransferCtx->enRrcCause))
        {
            MTC_SndModem0MtaPsTransferInd(MTC_PS_TRANSFER_CAUSE_AREA_AVALIABLE);
            MTC_SndModem0MmaPsTransferInd(MTC_PS_TRANSFER_CAUSE_AREA_AVALIABLE);
        }
        //MTC_SndModem0MmaPsTransferInd(MTC_PS_TRANSFER_CAUSE_AREA_AVALIABLE);

    }

    return;
}
VOS_VOID MTC_ProcNotchStrategy(VOS_VOID)
{
    MTC_MODEM_POWER_STATE_ENUM_UINT8        enModem0PowerState;
    MTC_MODEM_POWER_STATE_ENUM_UINT8        enModem1PowerState;
    MTC_INTRUSION_GSM_BAND_STATE_ENUM_UINT8 enGsmBandState;
    MTC_INTRUSION_TL_BAND_STATE_ENUM_UINT8  enTLBandState;
    PS_BOOL_ENUM_UINT8                      enWithB3Flag;
    PS_BOOL_ENUM_UINT8                      enWithB34B39Flag;

    /* 获取Modem0与Modem1的开机状态 */
    enModem0PowerState  = MTC_GetModemPowerState(MODEM_ID_0);
    enModem1PowerState  = MTC_GetModemPowerState(MODEM_ID_1);
    if ( (MTC_MODEM_POWER_ON != enModem0PowerState)
      || (MTC_MODEM_POWER_ON != enModem1PowerState) )
    {
        /* 两个Modem未同时开机时需要复位Notch功能 */
        MTC_ChangeNotchState(PS_FALSE);
        return;
    }

    /* 两个Modem同时开机,但其中一个或两个Modem不存在任何频段,需要使能Notch */
    enGsmBandState  = MTC_GetModem1GsmBandState();
    enTLBandState   = MTC_GetModem0TLBandState();
    if ( (MTC_INTRUSION_GSM_BAND_NONE == enGsmBandState)
      || (MTC_INTRUSION_TL_BAND_NONE == enTLBandState) )
    {
        MTC_ChangeNotchState(PS_TRUE);
        return;
    }

    enWithB3Flag     = MTC_CheckGsmWithB3(MTC_GetModemCurBandInfo(MODEM_ID_1));
    enWithB34B39Flag = MTC_CheckTLWithB34B39(MTC_GetModemCurBandInfo(MODEM_ID_0));

    /* GSM B3和TL B34/B39同时存在时需要使能Notch,否则复位Notch */
    if (PS_TRUE == (enWithB3Flag & enWithB34B39Flag))
    {
        MTC_ChangeNotchState(PS_TRUE);
    }
    else
    {
        MTC_ChangeNotchState(PS_FALSE);
    }

    return;
}
VOS_VOID MTC_ProcNarrowDcsStrategy(VOS_VOID)
{
    MTC_MODEM_POWER_STATE_ENUM_UINT8        enGModemPowerState;
#if 0
    MTC_INTRUSION_GSM_BAND_STATE_ENUM_UINT8 enGsmBandState;
    PS_BOOL_ENUM_UINT8                      enWithB31Flag;
    PS_BOOL_ENUM_UINT8                      enWithB32Flag;
#endif
    enGModemPowerState  = MTC_GetModemPowerState(MODEM_ID_1);

    /* G modem未开机时 */
    if (MTC_MODEM_POWER_ON != enGModemPowerState)
    {
        /* 去使能Narrow band dcs */
        MTC_ChangeNarrowBandDcsState(PS_FALSE);
        return;
    }
    else
    {
        MTC_ChangeNarrowBandDcsState(PS_TRUE);
        return;
    }
#if 0
    /* 获取G modem的频段状态 */
    enGsmBandState      = MTC_GetModem1GsmBandState();

    /* 不存在任何频段 */
    if (MTC_INTRUSION_GSM_BAND_NONE == enGsmBandState)
    {
        /* 去使能Narrow band dcs */
        MTC_ChangeNarrowBandDcsState(PS_FALSE);
        return;
    }

    /* 1. 仅存在频段B31,需要Narrow Band Dcs
       2. 存在频段B31以及其他频段,需要Narrow Band Dcs
     */
    enWithB31Flag = MTC_CheckGsmWithB31(MTC_GetModemCurBandInfo(MODEM_ID_1));
    enWithB32Flag = MTC_CheckGsmWithB32(MTC_GetModemCurBandInfo(MODEM_ID_1));

    /* 存在B31且不存在B32的场景下,需要Narrow Band Dcs */
    if ((PS_TRUE  == enWithB31Flag)
     && (PS_FALSE == enWithB32Flag))
    {
        /* 使能Narrow band dcs */
        MTC_ChangeNarrowBandDcsState(PS_TRUE);
    }
    else
    {
        /* 去使能Narrow band dcs */
        MTC_ChangeNarrowBandDcsState(PS_FALSE);
    }
    return;
#endif
}
VOS_VOID MTC_ChangeNotchState(
    PS_BOOL_ENUM_UINT8                  enEnableFlag
)
{
    /* 如果与当前状态一致则直接返回 */
    if (MTC_GetNotchEnalbeFlag() == enEnableFlag)
    {
        return;
    }

    /* 只有在该Modem开机时才下发裁决指示 */
    if (MTC_MODEM_POWER_ON == MTC_GetModemPowerState(MODEM_ID_1))
    {
        /* 给副卡GAS下发NOTCH裁决 */
        MTC_SndRrcNotchChannelInd(I1_UEPS_PID_GAS, enEnableFlag);
    }

    if (MTC_MODEM_POWER_ON == MTC_GetModemPowerState(MODEM_ID_0))
    {
#if (FEATURE_ON == FEATURE_UE_MODE_TDS)
        /* 判断当前接入技术是否支持TDS */
        if (VOS_TRUE == MTC_IsSupportRatType(MODEM_ID_0, MTC_RATMODE_TDS))
        {
            /* 如果支持TDS模式,给主卡TDS RRC下发NOTCH裁决 */
            MTC_SndRrcNotchChannelInd(TPS_PID_RRC, enEnableFlag);
        }
#endif
#if (FEATURE_ON == FEATURE_LTE)
        /* 判断当前接入技术是否支持LTE */
        if (VOS_TRUE == MTC_IsSupportRatType(MODEM_ID_0, MTC_RATMODE_LTE))
        {
            /* 如果支持LTE模式,给主卡LTE RRC下发NOTCH裁决 */
            MTC_SndRrcNotchChannelInd(PS_PID_ERRC, enEnableFlag);
        }
#endif
    }

    /* 记录Notch标志 */
    MTC_SetNotchEnalbeFlag(enEnableFlag);

    return;
}
VOS_VOID MTC_SndRrcIntrusionBandSetReq(
    VOS_UINT32                          ulRecvPid,
    RRC_MTC_MS_BAND_INFO_STRU          *pstForbiddenBandInfo
)
{
    VOS_UINT16                              ulLenth;
    MODEM_ID_ENUM_UINT16                    enModemId;
    MTC_RRC_INTRUSION_BAND_SET_REQ_STRU    *pstBandSetReq = VOS_NULL_PTR;

    enModemId = VOS_GetModemIDFromPid(ulRecvPid);
    if (enModemId >= MODEM_ID_BUTT)
    {
        return;
    }

    /* 如果当前已经关机,则停止发送信息 */
    if (MTC_MODEM_POWER_OFF == MTC_GetModemPowerState(enModemId))
    {
        return;
    }

    /* 分配消息空间 */
    ulLenth         = sizeof(MTC_RRC_INTRUSION_BAND_SET_REQ_STRU);
    pstBandSetReq   = (MTC_RRC_INTRUSION_BAND_SET_REQ_STRU *)PS_ALLOC_MSG_WITH_HEADER_LEN(
                                                                UEPS_PID_MTC,
                                                                ulLenth);

    if (VOS_NULL_PTR == pstBandSetReq)
    {
        MTC_ERROR_LOG("MTC_SndRrcIntrusionActionSetReq: Alloc Msg Fail!");
        return;
    }

    /* 填充消息 */
    pstBandSetReq->stMsgHeader.ulReceiverPid    = ulRecvPid;
    pstBandSetReq->stMsgHeader.ulMsgName        = ID_MTC_RRC_INTRUSION_BAND_SET_REQ;

    PS_MEM_CPY(&pstBandSetReq->stForbiddenBandInfo,
               pstForbiddenBandInfo,
               sizeof(RRC_MTC_MS_BAND_INFO_STRU));

    /* 发送消息 */
    if (VOS_OK != PS_SEND_MSG(UEPS_PID_MTC, pstBandSetReq))
    {
        MTC_ERROR1_LOG("MTC_SndRrcIntrusionActionSetReq: Snd Msg Err. ReceiverPid: ", ulRecvPid);
        return;
    }

    /* 记录可维可测 */
    MTC_DEBUG_IntrusionSendSetBandReq(ulRecvPid);

    return;

}
VOS_VOID MTC_RcvGsmCellInfoInd(VOS_VOID *pMsg)
{
    RRC_MTC_GSM_CELL_INFO_IND_STRU     *pstGsmInfoInd  = VOS_NULL_PTR;
    MTC_RRC_GSM_CELL_INFO_IND_STRU     *pstGsmCellInfo = VOS_NULL_PTR;
    VOS_UINT32                          ulReceiverPid;

    /* 如果当前已经关机,则停止发送信息 */
    if (MTC_MODEM_POWER_OFF == MTC_GetModemPowerState(MODEM_ID_0))
    {
        return;
    }

    /* 判断当前主模状态, 为TDS/LTE时发送 */
    if (MTC_RATMODE_TDS == MTC_GetModemRatMode(MODEM_ID_0))
    {
        ulReceiverPid = TPS_PID_RRC;
    }
    else if (MTC_RATMODE_LTE== MTC_GetModemRatMode(MODEM_ID_0))
    {
        ulReceiverPid = PS_PID_ERRC;
    }
    else
    {
        return;
    }

    /* 分配消息空间 */
    pstGsmCellInfo  = (MTC_RRC_GSM_CELL_INFO_IND_STRU *)PS_ALLOC_MSG_WITH_HEADER_LEN(
                                                                UEPS_PID_MTC,
                                                                sizeof(MTC_RRC_GSM_CELL_INFO_IND_STRU));

    if (VOS_NULL_PTR == pstGsmCellInfo)
    {
        MTC_ERROR_LOG("MTC_RcvGsmCellInfoInd: Alloc Msg Fail!");
        return;
    }

    pstGsmCellInfo->stMsgHeader.ulReceiverPid = ulReceiverPid;
    pstGsmCellInfo->stMsgHeader.ulMsgName     = ID_MTC_RRC_GSM_CELL_INFO_IND;

    pstGsmInfoInd                             = (RRC_MTC_GSM_CELL_INFO_IND_STRU *)pMsg;
    PS_MEM_CPY(&pstGsmCellInfo->stGsmCellInfo,
               &pstGsmInfoInd->stGsmCellInfo,
               sizeof(RRC_MTC_GSM_CELL_INFO_STRU));

    /* 发送消息 */
    if (VOS_OK != PS_SEND_MSG(UEPS_PID_MTC, pstGsmCellInfo))
    {
        MTC_ERROR_LOG("MTC_RcvGsmCellInfoInd: Snd Msg Err!");
    }

    return;

}
VOS_VOID MTC_ProcRseStrategy(VOS_VOID)
{
    PS_BOOL_ENUM_UINT8                  enRseOnFlag;
    MTC_MODEM_POWER_STATE_ENUM_UINT8    enModem0PowerState;
    MTC_MODEM_POWER_STATE_ENUM_UINT8    enModem1PowerState;

    /* 判断当前是否支持RSE功能 */
    if (MTC_CFG_DISABLE == MTC_GetRseSupportCfg())
    {
        return;
    }

    /* 判断是否是测试卡 */
    if (VOS_FALSE == USIMM_IsTestCard_Instance(MODEM_ID_1))
    {
        return;
    }

    /* 初始化 */
    enRseOnFlag        = PS_FALSE;
    enModem0PowerState = MTC_GetModemPowerState(MODEM_ID_0);
    enModem1PowerState = MTC_GetModemPowerState(MODEM_ID_1);

    /* 若modem0关机 modem1开机,则需要RSE ON */
    if ((MTC_MODEM_POWER_OFF == enModem0PowerState )
      &&(MTC_MODEM_POWER_ON  == enModem1PowerState))
    {
        enRseOnFlag = PS_TRUE;
    }

    /* 若与之前的值相同,则不再下发消息 */
    if (enRseOnFlag == MTC_GetRseCfgValue())
    {
        return ;
    }

    /* 给modem1发送RSE配置消息 */
    MTC_SndRrcRseCfgInd(I1_UEPS_PID_GAS, enRseOnFlag);

}
예제 #13
0
VOS_VOID MTC_SndRcmModemStateInd(VOS_VOID)
{
    MTC_RCM_MODEM_STATE_NOTIFY_STRU    *pstModemState;
    MODEM_ID_ENUM_UINT16                enModemId;

    /* 申请消息包 */
    pstModemState = (MTC_RCM_MODEM_STATE_NOTIFY_STRU *)MTC_ALLOC_MSG_WITH_HDR(sizeof(MTC_RCM_MODEM_STATE_NOTIFY_STRU));
    if (VOS_NULL_PTR == pstModemState)
    {
        MTC_ERROR_LOG("MTC_SndRcmModemStateInd: Alloc Msg Fail!");
        return;
    }

    PS_MEM_SET(((VOS_UINT8*)pstModemState) + VOS_MSG_HEAD_LENGTH, 0, sizeof(MTC_RCM_MODEM_STATE_NOTIFY_STRU) - VOS_MSG_HEAD_LENGTH);

    /* 填充消息头 */
    MTC_CFG_RCM_MSG_HDR(&pstModemState->stMsgHeader, ID_MTC_RCM_MODEM_STATUS_NOTIFY);

    /* 填写modem0和modem1的状态信息 */
    for (enModemId = 0; enModemId < MODEM_ID_BUTT ; enModemId++)
    {
        pstModemState->astModemState[enModemId].enCsSrvConnState        = MTC_GetCsConnStateInfo(enModemId);
        pstModemState->astModemState[enModemId].enPsSrvConnState        = MTC_GetRcmPsConnStateInfo(enModemId);
        pstModemState->astModemState[enModemId].enModemPowerState       = MTC_GetModemPowerState(enModemId);
        pstModemState->astModemState[enModemId].enUsimmCardState        = MTC_GetUsimmStateInfo(enModemId);
        pstModemState->astModemState[enModemId].enModemType             = MTC_RCM_MODEM_0 + enModemId;
    }

    /* 填写CDMA状态信息 */
    pstModemState->astModemState[MTC_RCM_MODEM_CDMA].enCsSrvConnState   = MTC_GetOutSideCsConnStateInfo(MTC_OUTSIDE_MODEM_CDMA);
    pstModemState->astModemState[MTC_RCM_MODEM_CDMA].enPsSrvConnState   = MTC_GetOutSidePsConnStateInfo(MTC_OUTSIDE_MODEM_CDMA);
    pstModemState->astModemState[MTC_RCM_MODEM_CDMA].enModemPowerState  = MTC_GetOutSideModemPowerState(MTC_OUTSIDE_MODEM_CDMA);
    pstModemState->astModemState[MTC_RCM_MODEM_CDMA].enUsimmCardState   = MTC_GetOutSideModemUsimmState(MTC_OUTSIDE_MODEM_CDMA);
    pstModemState->astModemState[MTC_RCM_MODEM_CDMA].enModemType        = MTC_RCM_MODEM_CDMA;

    /* 发送消息 */
    MTC_SEND_MSG(pstModemState);

    return;
}
PS_BOOL_ENUM_UINT8 MTC_ProcB39B32IntrusionStrategy(VOS_VOID)
{
    RRC_MTC_MS_BAND_INFO_STRU          *pstSerCellBandInfo = VOS_NULL_PTR;
    VOS_UINT32                          ulB39Ret;
    MTC_MODEM_POWER_STATE_ENUM_UINT8    enModem1PowerState;
    TAF_MTC_SRV_CONN_STATE_ENUM_UINT8   enModem0PsState;
    TAF_MTC_SRV_CONN_STATE_ENUM_UINT8   enModem1PsState;
    TAF_MTC_SRV_CONN_STATE_ENUM_UINT8   enModem1CsState;
    TAF_MTC_SRV_CONN_STATE_ENUM_UINT8   enModem0CsState;

    /* 初始化 */
    enModem0PsState     = TAF_MTC_SRV_CONN_STATE_BUTT;
    enModem0CsState     = TAF_MTC_SRV_CONN_STATE_BUTT;
    enModem1PsState     = TAF_MTC_SRV_CONN_STATE_BUTT;
    enModem1CsState     = TAF_MTC_SRV_CONN_STATE_BUTT;
    ulB39Ret            = PS_FALSE;
    enModem1PowerState  = MTC_MODEM_POWER_STATE_BUTT;

    /* 判断modem1是否开机 */
    enModem1PowerState =  MTC_GetModemPowerState(MODEM_ID_1);
    if (MTC_MODEM_POWER_OFF == enModem1PowerState)
    {
        /* 打孔方案不生效 */
        return PS_FALSE;
    }

    /* 判断主卡是否存在B39 */
    pstSerCellBandInfo = MTC_GetModemSerCellBandInfo(MODEM_ID_0);
    ulB39Ret = MTC_BAND_CHECK64(*((VOS_UINT64 *)&(pstSerCellBandInfo->aulBandInfo[0])), MTC_BAND_MASK_B39);
    if (VOS_FALSE == ulB39Ret)
    {
        /* 打孔方案不生效 */
        return PS_FALSE;
    }

    /* 判断主副卡的业务状态 */
    enModem0PsState = MTC_GetPsConnStateInfo(MODEM_ID_0);
    enModem0CsState = MTC_GetCsConnStateInfo(MODEM_ID_0);
    enModem1PsState = MTC_GetPsConnStateInfo(MODEM_ID_1);
    enModem1CsState = MTC_GetCsConnStateInfo(MODEM_ID_1);

    /* 主卡存在CS,则打孔方案不生效 */
    if (TAF_MTC_SRV_EXIST == enModem0CsState)
    {
        return PS_FALSE;
    }

    /* 副卡CS, 则打孔方案生效 */
    if (TAF_MTC_SRV_EXIST == enModem1CsState)
    {
        return PS_TRUE;
    }

    /* 主卡PS,副卡IDLE, 则打孔方案生效 */
    if ( (TAF_MTC_SRV_EXIST == enModem0PsState)
      && ( (TAF_MTC_SRV_EXIST != enModem1CsState)
         && (TAF_MTC_SRV_EXIST != enModem1PsState) ) )
    {
        return PS_TRUE;
    }

    /* 其它情况打孔方案不生效 */
    return PS_FALSE;
}
VOS_VOID MTC_RcvRrcAreaLostInd(VOS_VOID * pMsg)
{
    MODEM_ID_ENUM_UINT16                enModemId;
    RRC_MTC_AREA_LOST_IND_STRU         *pstAreaLostInd = VOS_NULL_PTR;
    MTC_MODEM_POWER_STATE_ENUM_UINT8    enModem1PowerState;
    MTC_OPERATOR_CUST_SOLUTION_ENUM_UINT8   enOperatorCustSolution;
    VOS_BOOL                            enTestCardFlg;

    MTC_PS_TRANSFER_CTX_STRU           *pstPsTransferCtx    = VOS_NULL_PTR;
    pstPsTransferCtx                    = MTC_GetPsTransferCtxAddr();

    /* GCF测试时不需要启动PSTRANSFER流程,否则导致GCF测试部不通过 */
    enTestCardFlg = USIMM_IsTestCard();
    if (VOS_TRUE == enTestCardFlg)
    {
        return;
    }

    pstAreaLostInd      = (RRC_MTC_AREA_LOST_IND_STRU*)pMsg;
    enModemId           = VOS_GetModemIDFromPid(pstAreaLostInd->stMsgHeader.ulSenderPid);

    /* 仅处理Modem0发送的丢网指示 */
    if (enModemId != MODEM_ID_0)
    {
        MTC_ERROR1_LOG("MTC_RcvRrcAreaLostInd: Err ModemId ", enModemId);
        return;
    }

    /* 未开启PS域迁移策略,只记录次数 */
    if (MTC_PS_TRANSFER_NONE == MTC_GetPsTransferCfg())
    {
        /* 可维可测: 记录接收到丢网指示的次数 */
        MTC_DEBUG_RcvRrcAreaLostInd(pstAreaLostInd->stMsgHeader.ulSenderPid);
        return;
    }

    /* 运营商定制方案SVLTE或C+L时需要上报AT丢网指示 */
    enOperatorCustSolution  = MTC_GetOperatorCustSolution();
    enModem1PowerState      = MTC_GetModemPowerState(MODEM_ID_1);

    /* 当接入层在业务态或idle态丢网且Modem1开机且卡有效时,上报PS域迁移指示 */
    if ((VOS_TRUE == MTC_GetModemUsimValidFlag(enModemId))
     && (((MTC_OPERATOR_CUST_CMCC_SVLTE == enOperatorCustSolution)
       && (MTC_MODEM_POWER_ON == enModem1PowerState))
      || (MTC_OPERATOR_CUST_CT_LC == enOperatorCustSolution) ))
    {
        if (MTC_PS_TRANSFER_CAUSE_AREA_LOST != pstPsTransferCtx->enReportCause)
        {
            MTC_SndModem0MtaPsTransferInd(MTC_PS_TRANSFER_CAUSE_AREA_LOST);

            /* 通知modem0 gmm丢网,gmm记录全局变量后续detach只做一次减少detach时间 */
            MTC_SndModem0GmmRrcAreaLostInd();
        }
    }

    pstPsTransferCtx->enRrcCause = MTC_PS_TRANSFER_CAUSE_AREA_LOST;

    /* 可维可测: 记录接收到丢网指示的次数 */
    MTC_DEBUG_RcvRrcAreaLostInd(pstAreaLostInd->stMsgHeader.ulSenderPid);

    return;
}
VOS_VOID MTC_DEBUG_TraceAllModemConnStateInfo(VOS_VOID)
{
    MTC_DEBUG_ALL_MODEM_STATE_INFO      stAllModemState;
    MODEM_ID_ENUM_UINT16                enModemID;
    TAF_MTC_SRV_CONN_STATE_ENUM_UINT8   enCsSrvStatus;
    TAF_MTC_SRV_CONN_STATE_ENUM_UINT8   enPsSrvStatus;

    enPsSrvStatus                       = TAF_MTC_SRV_CONN_STATE_BUTT;

    /* 初始化 */
    PS_MEM_SET(&stAllModemState, 0x0, sizeof(MTC_DEBUG_ALL_MODEM_STATE_INFO));

    /*  填写消息头 */
    MTC_DEBUG_CFG_MSG_HDR(&stAllModemState.stMsgHeader,
                            UEPS_PID_MTC, UEPS_PID_MTC,
                            sizeof(MTC_DEBUG_ALL_MODEM_STATE_INFO) - VOS_MSG_HEAD_LENGTH);

    stAllModemState.stMsgHeader.ulMsgName = ID_DEBUG_MTC_ALL_MODEM_STATE_INFO;

    /* 各Modem状态信息 */
    for (enModemID = 0; enModemID < MODEM_ID_BUTT; enModemID++)
    {
        stAllModemState.stModemStateInfo[enModemID].enPowerState        = MTC_GetModemPowerState(enModemID);

        stAllModemState.stModemStateInfo[enModemID].ulCsSessionValue    = MTC_GetCsSessionInfo(enModemID);
        stAllModemState.stModemStateInfo[enModemID].ulPsSessionValue    = MTC_GetPsSessionInfo(enModemID);
        stAllModemState.stModemStateInfo[enModemID].ucPsConnInfo        = MTC_GetPsTypeInfo(enModemID);
        enPsSrvStatus            = MTC_GetPsSrvState(enModemID);
        if ((PS_TRUE            == MTC_IsPsSessionInfoExit(enModemID))
         || (TAF_MTC_SRV_EXIST  == enPsSrvStatus))
        {
            stAllModemState.stModemStateInfo[enModemID].enIsPsSrvConnExist = TAF_MTC_SRV_EXIST;
        }
        else
        {
            stAllModemState.stModemStateInfo[enModemID].enIsPsSrvConnExist = TAF_MTC_SRV_NO_EXIST;
        }

        stAllModemState.stModemStateInfo[enModemID].ucCsConnInfo        = MTC_GetCsTypeInfo(enModemID);
        enCsSrvStatus                                                   = MTC_GetCsSrvState(enModemID);
        stAllModemState.stModemStateInfo[enModemID].enModemRatCfg       = MTC_ConvertToRcmRatCfg(MTC_GetUsimStateInfo(enModemID),
                                                                                                 MTC_GetRatCfgByModemId(enModemID));
#if (FEATURE_ON == FEATURE_UE_MODE_CDMA)
        if ((MTC_RCM_MODEM_RAT_CFG_CL == stAllModemState.stModemStateInfo[enModemID].enModemRatCfg)
         || (MTC_RCM_MODEM_RAT_CFG_C  == stAllModemState.stModemStateInfo[enModemID].enModemRatCfg))
        {
            stAllModemState.stModemStateInfo[enModemID].enUsimmState    = MTC_GetCsimStateInfo(enModemID);
        }
        else
#endif
        {
            stAllModemState.stModemStateInfo[enModemID].enUsimmState    = MTC_GetUsimStateInfo(enModemID);
        }

        if ( (PS_TRUE           == MTC_IsCsSessionInfoExit(enModemID))
          || (TAF_MTC_SRV_EXIST == enCsSrvStatus) )
        {
            stAllModemState.stModemStateInfo[enModemID].enIsCsSrvConnExist = TAF_MTC_SRV_EXIST;
        }
        else
        {
            stAllModemState.stModemStateInfo[enModemID].enIsCsSrvConnExist = TAF_MTC_SRV_NO_EXIST;
        }
    }

    /* 外置modem状态信息 */
    stAllModemState.stModemStateInfo[MTC_RCM_MODEM_OTHER].enIsCsSrvConnExist  = MTC_GetOutSideCsConnStateInfo(MTC_OUTSIDE_MODEM_CDMA);
    stAllModemState.stModemStateInfo[MTC_RCM_MODEM_OTHER].enIsPsSrvConnExist  = MTC_GetOutSidePsConnStateInfo(MTC_OUTSIDE_MODEM_CDMA);
    stAllModemState.stModemStateInfo[MTC_RCM_MODEM_OTHER].enPowerState        = MTC_GetOutSideModemPowerState(MTC_OUTSIDE_MODEM_CDMA);
    stAllModemState.stModemStateInfo[MTC_RCM_MODEM_OTHER].enUsimmState        = MTC_GetOutSideModemUsimmState(MTC_OUTSIDE_MODEM_CDMA);
    stAllModemState.stModemStateInfo[MTC_RCM_MODEM_OTHER].enModemRatCfg       = MTC_RCM_MODEM_RAT_CFG_C;

    /* 发送消息 */
    MTC_DEBUG_TraceEvent(&stAllModemState);

    return;
}