[Feature]Upload Modem source code
Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/interface/protocol/as_c2k/evdo/clcidp.h b/mcu/interface/protocol/as_c2k/evdo/clcidp.h
new file mode 100644
index 0000000..3f36f94
--- /dev/null
+++ b/mcu/interface/protocol/as_c2k/evdo/clcidp.h
@@ -0,0 +1,387 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of MediaTek Inc. (C) 2016
+*
+* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS (""MEDIATEK SOFTWARE"")
+* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+* AN ""AS-IS"" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+/*************************************************************
+*
+* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.
+*
+* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
+*
+* Copyright (c) 2006-2010 VIA Telecom, Inc. All rights reserved.
+*
+*************************************************************/
+#ifndef _CLCIDP_H_
+#define _CLCIDP_H_ 1
+/*****************************************************************************
+*
+* FILE NAME : clcidp.h
+*
+* DESCRIPTION : This file includes the definition of IDP
+*
+* HISTORY :
+* See Log at end of file
+*
+*****************************************************************************/
+
+/*----------------------------------------------------------------------------
+ Include Files
+----------------------------------------------------------------------------*/
+#include "do_clcapi.h"
+#include "do_rupapi.h"
+#include "do_idpapi.h"
+#include "do_dsaapi.h"
+#include "rmcsch.h"
+#include "slc_nvram.h"
+
+/*----------------------------------------------------------------------------
+ Global Defines and Macros
+----------------------------------------------------------------------------*/
+#define IDP_ATTRIB_PCCC_BIT 0x01
+#define IDP_ATTRIB_SM_BIT 0x02
+#define IDP_ATTRIB_PM_BIT 0x04
+#define IDP_ATTRIB_AHCM_BIT 0x08
+#define IDP_ATTRIB_SSCA_BIT 0x10
+
+#define IDP_PAGINGMASK_1X_BIT 0x01
+#define IDP_PAGINGMASK_WIFI_BIT 0x02
+
+#define IDP_DEFAULT_PERIOD_SLOTS 3072
+
+#ifdef MTK_DEV_C2K_IRAT
+#define MAX_PNLIST_REC_NUM 16
+#endif /* MTK_DEV_C2K_IRAT */
+
+/*----------------------------------------------------------------------------
+ Global Typedefs
+----------------------------------------------------------------------------*/
+typedef enum
+{
+ IDP_INACTIVE_ST,
+ IDP_MONITOR_ST,
+ IDP_SLEEP_ST,
+ IDP_CONN_SETUP_ST,
+ IDP_FREEZE_PENDING_ST,
+ IDP_FREEZE_ST,
+ IDP_CONN_FROZEN_ST,
+ IDP_STATE_MAX
+} IdpStateT;
+
+typedef enum
+{
+ IDP_DEFAULT,
+ IDP_ENHANCED,
+ IDP_MAX_PROT
+} IdpSubTypeT;
+
+typedef enum
+{
+ IDP_INCONFIG,
+ IDP_INUSE,
+ IDP_MAX_INSTANCE
+} IdpInstanceT;
+
+typedef enum
+{
+ IDP_PAGE_MESSAGE,
+ IDP_CONNECTION_REQUEST_MESSAGE,
+ IDP_CONNECTION_DENY_MESSAGE,
+ IDP_CONFIG_REQUEST_MESSAGE = 0x50,
+ IDP_CONFIG_RESPONSE_MESSAGE,
+ IDP_ATTRIB_UPDATE_REQUEST_MESSAGE,
+ IDP_ATTRIB_UPDATE_ACCEPT_MESSAGE,
+ IDP_ATTRIB_UPDATE_REJECT_MESSAGE,
+ IDP_MAX_MESSAGE_ID
+} IdpMessageTypeT;
+
+typedef enum
+{
+ REQ_REASON_AT_INITIATED,
+ REQ_REASON_AN_INITIATED,
+ REQ_REASON_INVALID
+} IdpRequestReasonT;
+
+typedef enum
+{
+ DENY_REASON_GENERAL,
+ DENY_REASON_NETWORK_BUSY,
+ DENY_REASON_AUTH_OR_BILL_FAILURE,
+ DENY_CONN_REQ_INPROGRESS_FAILURE,
+ DENY_CONN_SETUP_TIMER_EXPIRED,
+ DENY_REASON_RESERVED
+} IdpConnDenyReasonT;
+
+typedef struct
+{
+ kal_uint8 MaskMap;
+ MaskRecordT Mask[MAX_MASKCOUNT];
+} PagingMaskPrefT;
+
+typedef enum
+{
+ IDP_ATTRIB_PCCC, /*Preferred Control Channel Cycle Attribute ID, 0x00*/
+ IDP_ATTRIB_SM, /*SlottedMode Attribute ID, 0x01 */
+ IDP_ATTRIB_PM, /* Paging MaskAttribute ID, 0x02 */
+ IDP_ATTRIB_AHCM = 0xfe, /*AccessHashingClassMask Attribute Id, 0xfe */
+ IDP_ATTRIB_SSCA /*Small Slot Cycle Allowed Attribute Id, 0xff */
+} IdpAttribIdT;
+
+typedef enum
+{
+ IHO_WAKE_REDUCTION_STATE_INACTIVE,
+ IHO_WAKE_REDUCTION_STATE_ACTIVE,
+ IHO_WAKE_REDUCTION_STATE_MINIACQ,
+ IHO_WAKE_REDUCTION_STATE_WAKEUP,
+ IHO_WAKE_REDUCTION_STATE_MONITOR,
+ IHO_WAKE_REDUCTION_STATE_SEARCHDONE,
+ IHO_WAKE_REDUCTION_STATE_COMPLETE
+} IHOWakeReductionStateT;
+
+#ifdef MTK_DEV_C2K_IRAT
+#if 0
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+
+typedef enum
+{
+ IDP_RSVAS_OCCUPY_STATUS_NULL,
+ IDP_RSVAS_OCCUPY_STATUS_WAIT_CNF,
+ IDP_RSVAS_OCCUPY_STATUS_WAIT_CNF_FOR_FAST_CONN,
+ IDP_RSVAS_OCCUPY_STATUS_WAIT_IND,
+ IDP_RSVAS_OCCUPY_STATUS_WAIT_IND_FOR_FAST_CONN,
+ IDP_RSVAS_OCCUPY_STATUS_COMPLETE
+} IdpRsvasOccupyStatusT;
+#endif /* MTK_DEV_C2K_IRAT */
+
+typedef struct
+{
+ IdpSubTypeT IdpSubType;
+ IdpStateT curIdpState;
+ kal_bool bInUseInitialized;
+ kal_bool bSlottedModeEnabled;
+ kal_bool bConnectionReqInProgress;
+ kal_bool bDsarAccessInProgress;
+ kal_bool bSessionCloseInprogress;
+ kal_bool bSessionIsActive;
+ kal_bool bSubnetChangedOrCommittingIndication;
+ kal_bool bConnectionReqPending;
+ IdpAlmpOpenConnMsgT IdpAlmpOpenConnMsgPended;
+ kal_uint8 nAcmacTxStartedCount;
+ kal_bool bSleepCapsuleDoneRcvd;
+ kal_bool bSectorParmsUpdated;
+ kal_bool bSuspendPeriodInActive;
+ kal_bool bOMPUPdatedMsgPended;
+ kal_bool bChannelSelectPended;
+ kal_bool bPagePended;
+ kal_bool bProhibitEnterSleepForPageRcvd;
+ kal_bool bSessionSeedPended;
+ kal_uint8 ChannelCount;
+ ChanRecGT Channel[64];
+ kal_uint8 RUPSupportedChannelCount;
+ ChanRecGT RUPSupportedChannel[64];
+ kal_uint8 nSyncCapsuleOffset;
+ kal_bool bSessionSeedValid;
+ kal_uint32 nSessionSeed;
+ kal_uint32 nATI;
+ IdpAttribRecT attribIdp[IDP_MAX_INSTANCE];
+ IdpAttribRecT attribFallback;
+ kal_uint32 nPeriod1;
+ kal_uint32 nPeriod2;
+ kal_uint32 nPeriod3;
+ kal_uint32 nT12;
+ kal_uint32 nT23;
+ PagingMaskPrefT PagingMaskPref;
+ kal_uint16 TDualIdleForDefaultType;
+ kal_uint16 TDualIdle;
+ kal_uint16 THRPDExtendedSC;
+ kal_bool bImdWakeup;
+ kal_bool bSrchDone;
+#ifdef MTK_DEV_C2K_IRAT
+ kal_bool bOtherRATAvailable;
+ kal_uint8 OtherRATSlotCycle;
+ kal_bool bOtherRATUpdated;
+#endif /* MTK_DEV_C2K_IRAT */
+ kal_bool bIdpIHOWakeReductionEnable;
+ kal_uint32 nLongPeriod;
+ kal_uint32 curPeriod;
+ kal_bool bByPassSessionStatusForSleep;
+ kal_uint8 numHashCh;
+ kal_uint8 curHashIdx;
+ kal_bool bNeedSpecialSessionSeed;
+ kal_uint8 nNetworkLostCout;
+ kal_bool bWakeupInd;
+ kal_uint16 T_Dfs_TimerMSC;
+ kal_uint16 T_Dfs_NumChan;
+} IdpInfoT;
+
+/* IDP ConnectionDeny Message*/
+typedef struct {
+ kal_uint8 nTransactionID;
+ kal_uint8 nDenyReason;
+ kal_uint8 nReserved;
+} IdpConnectionDenyT;
+
+typedef struct
+{
+ kal_bool bSloteMode;
+ kal_uint16 ChannelNum;
+ kal_uint8 FrameUpper6;
+ kal_uint32 FrameLow32;
+} EtsGetDoSysStatusRspT;
+/*----------------------------------------------------------------------------
+ Global Data
+----------------------------------------------------------------------------*/
+extern RmcSchDataCtxT RmcSchDataCtx;
+
+/*----------------------------------------------------------------------------
+ Global Function Prototypes
+----------------------------------------------------------------------------*/
+void IdpInit(void);
+void IdpInitialize(void);
+void IdpCalcT12AndT23Value(void);
+void RunIdpStateMachine(kal_uint32 MsgId, void *MsgDataP);
+void ProcessIdpAlmpActivateMsg(IdpAlmpActiveMsgT *MsgDataP);
+void ProcessIdpAlmpDeactivateMsg(IdpAlmpDeactiveMsgT *MsgDataP);
+void ProcessIdpAlmpOpenConnMsg(IdpAlmpOpenConnMsgT *MsgDataP);
+void ProcessIdpAlmpCloseMsg(void);
+void ProcessIdpRupConnectionInitiatedMsg(void);
+void ProcessIdpRupConnectionOpenedMsg(void);
+void ProcessIdpRupIHOResultMsg(IdpRupIHOResultMsg* MsgDataP);
+void ProcessIdpHscFreezeMsg(void);
+void ProcessIdpHscThawMsg(void);
+void ProcessIdpHscResyncIndMsg(void);
+void ProcessIdpHscResyncDeniedMsg(IdpHscResyncDeniedMsgT *MsgDataP);
+void ProcessIdpHscWakeupIndMsg(IdpHscWakeupIndMsgT *MsgDataP);
+void ProcessIdpAcmTxStartedMsg(void);
+void ProcessIdpAcmTxEndedMsg(IdpAcmTxEndedMsgT *MsgDataP);
+void ProcessIdpCcmSleepCapsuleDoneMsg(void);
+void ProcessIdpDsaFwdMsg(DsaFwdMsgT *MsgDataP);
+void ProcessIdpDsaTxStatusMsg(DsarTxStatusMsgT *MsgDataP);
+void ProcessIdpSmpSessionOpenedMsg(void);
+void ProcessIdpSmpSessionClosedMsg(IdpSmpSessionClosedMsgT *MsgDataP);
+void ProcessIdpSmpSessionStatusMsg(IdpSmpSessionStatusMsgT *MsgDataP);
+void ProcessIdpOmpUpdatedMsg(IdpOmpUpdatedMsgT *MsgDataP);
+void ProcessIdpCspSuspenPeriodTimeMsg(IdpCspSuspendPeriodTimeMsgT *MsgDataP);
+void ProcessIdpCspConnectionClosedMsg(void);
+void ProcessIdpAmpSessionSeedMsg(IdpAmpSessionSeedMsgT *MsgDataP);
+void ProcessIdpCcmOffsetMsg(IdpCcmOffsetMsgT *MsgDataP);
+void ProcessIdp1XPsPagingMaskSetMsg(Idp1XPsPagingMaskSetMsgT *MsgDataP);
+void ProcessIdpEltSlottedModeSetMsg(IdpSlottedModeSetMsgT *MsgDataP);
+void ProcessIdpScpReconfiguredMsg(void);
+void ProcessIdpScpCommittedMsg(void);
+void IdpInitStructures( kal_uint8 SubType, kal_bool InUse);
+void ProcessIdpConnectionSetupTmrExpired(void);
+void ProcessIdpPagePendingTmrExpired(void);
+void ProcessIdpSuspendPeriodTmrExpired(void);
+void ProcessIdpNoSrchDoneWakeUpTmrExpired(void);
+void ProcessIdpDfsTmrExpired(void);
+void ProcessIdpEltHardoffTestMsg(IdpEltHandoffMsgT *HandoffMsg);
+kal_bool IdpCheckSubTypeInUseAndInConfigProtocol(void);
+void ProcessIdpAlmpSysInfoUpdateMsg(IdpAlmpSysInfoUpdateMsgT *MsgDataP);
+void ProcessIdpEltGetDoSysStatusMsg(ExeRspMsgT* pMsg);
+void ProcessIdpDsarAccessStartMsg(void);
+void ProcessIdpDsarAccessStopMsg(IdpDsarAccessEndedMsgT *MsgDataP);
+void ProcessIdpPrefCCCycleMsg(DoPrefCCModeSetMsgT* MsgDataP);
+void ProcessIdpExtendedSlotCycleSetMsg(IdpExtendedSlotCycleSetMsgT *MsgDataP);
+void ProcessIdpRupChannelChangedIndMsg(IdpRupChannelChangedIndMsgT *MsgDataP);
+void ProcessIdpRupForceIHORspMsg(IdpRupForceIHORspMsgT* MsgDataP);
+void ProcessIdpBlockIHOWakeReductionExpired(void);
+void ProcessIdpRmcInterHoCnfMsg(void);
+void ProcessIdpRmcIhoWakeReductionStateCnfMsg(IdpRmcIHOWakeReductionStateCnfMsgT *MsgDataP);
+void ProcessIdpRmcIhoForceAcqOvhdIndMsg(IdpRmcForceAcqOvhdIndMsgT *MsgDataP);
+
+kal_bool IdpGetIdpFreezeState(void);
+void IdpGetCurChanInfo(ChanRecGT *pCurChanInfo);
+#ifdef MTK_DEV_C2K_IRAT
+void ProcessIdpOmpOtherRATUpdatedMsg(IdpOmpOtherRatUpdatedMsgT *MsgDataP);
+void ProcessIdpContinueRcvUatiAssignmentTmrExpired(void);
+void IdpProbeTxingProtectionDetermine(kal_bool bProtectStatus);
+void ProcessClcRmcIdleModeCfgCnfMsg(void);
+#endif /* MTK_DEV_C2K_IRAT */
+
+kal_bool IdpCheckReadyForPowerDown(void);
+
+kal_bool IdpNeedChanHash(IdpOmpUpdatedMsgT *MsgDataP);
+void ProcessIdpRupDfsEndMsg(IdpRupDfsEndMsgT *MsgDataP);
+void processIdpDfsTimerSetMsg(IdpDfsTimerSetMsgT *MsgDataP);
+void ProcessIdpHscTxAvailableInd(void);
+
+#ifdef __EVL3_EM_MODE__
+IdpInfoT* IdpShareIDPInfo(void);
+#endif
+
+void IdpSignalInteractiveProtectDetermine (kal_uint16 protocolType, kal_uint32 msgId, ConfirmResponseE Status);
+void ProcessIdpWfrRmcInterHoCnfExpired(void);
+IdpStateT IdpStateGet(void);
+
+#ifdef MTK_DEV_C2K_IRAT
+void ProcessIdpWfrRsvasOccupyIndTimerExpired (void);
+#endif
+
+void ProcessIdpGuardNonSlottedModeExpired(void);
+
+/*****************************************************************************
+* $Log: clcidp.h $
+*****************************************************************************/
+
+/*****************************************************************************
+* End of File
+*****************************************************************************/
+#endif /*_CLCIDP_H_*/
+
+
+/**Log information: \main\CBP80\cbp80_jzwang_scbp10066\1 2012-07-19 04:50:08 GMT jzwang
+** Made the change to handle the DO Long sleep command from IRAT when DO in sleep state**/
+/**Log information: \main\Trophy\Trophy_ylxiao_href22158\1 2013-04-19 09:40:29 GMT ylxiao
+** HREF#22158, remove compile warnings, fix bug**/
+/**Log information: \main\Trophy\1 2013-04-22 01:48:23 GMT zlin
+** HREF#22158. merge code.**/
+/**Log information: \main\Trophy\Trophy_yzhang_href22247\1 2013-07-30 06:34:55 GMT yzhang
+** HREF#22274=>fix concurrent UATIRequest and connectionrequest**/
+/**Log information: \main\Trophy\2 2013-07-30 07:08:05 GMT jzwang
+** href#22247**/