blob: 3f36f94ff7ea5955fa03c29736d8d44eab11b97b [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2016
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS (""MEDIATEK SOFTWARE"")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN ""AS-IS"" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35/*************************************************************
36*
37* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.
38*
39* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
40*
41* Copyright (c) 2006-2010 VIA Telecom, Inc. All rights reserved.
42*
43*************************************************************/
44#ifndef _CLCIDP_H_
45#define _CLCIDP_H_ 1
46/*****************************************************************************
47*
48* FILE NAME : clcidp.h
49*
50* DESCRIPTION : This file includes the definition of IDP
51*
52* HISTORY :
53* See Log at end of file
54*
55*****************************************************************************/
56
57/*----------------------------------------------------------------------------
58 Include Files
59----------------------------------------------------------------------------*/
60#include "do_clcapi.h"
61#include "do_rupapi.h"
62#include "do_idpapi.h"
63#include "do_dsaapi.h"
64#include "rmcsch.h"
65#include "slc_nvram.h"
66
67/*----------------------------------------------------------------------------
68 Global Defines and Macros
69----------------------------------------------------------------------------*/
70#define IDP_ATTRIB_PCCC_BIT 0x01
71#define IDP_ATTRIB_SM_BIT 0x02
72#define IDP_ATTRIB_PM_BIT 0x04
73#define IDP_ATTRIB_AHCM_BIT 0x08
74#define IDP_ATTRIB_SSCA_BIT 0x10
75
76#define IDP_PAGINGMASK_1X_BIT 0x01
77#define IDP_PAGINGMASK_WIFI_BIT 0x02
78
79#define IDP_DEFAULT_PERIOD_SLOTS 3072
80
81#ifdef MTK_DEV_C2K_IRAT
82#define MAX_PNLIST_REC_NUM 16
83#endif /* MTK_DEV_C2K_IRAT */
84
85/*----------------------------------------------------------------------------
86 Global Typedefs
87----------------------------------------------------------------------------*/
88typedef enum
89{
90 IDP_INACTIVE_ST,
91 IDP_MONITOR_ST,
92 IDP_SLEEP_ST,
93 IDP_CONN_SETUP_ST,
94 IDP_FREEZE_PENDING_ST,
95 IDP_FREEZE_ST,
96 IDP_CONN_FROZEN_ST,
97 IDP_STATE_MAX
98} IdpStateT;
99
100typedef enum
101{
102 IDP_DEFAULT,
103 IDP_ENHANCED,
104 IDP_MAX_PROT
105} IdpSubTypeT;
106
107typedef enum
108{
109 IDP_INCONFIG,
110 IDP_INUSE,
111 IDP_MAX_INSTANCE
112} IdpInstanceT;
113
114typedef enum
115{
116 IDP_PAGE_MESSAGE,
117 IDP_CONNECTION_REQUEST_MESSAGE,
118 IDP_CONNECTION_DENY_MESSAGE,
119 IDP_CONFIG_REQUEST_MESSAGE = 0x50,
120 IDP_CONFIG_RESPONSE_MESSAGE,
121 IDP_ATTRIB_UPDATE_REQUEST_MESSAGE,
122 IDP_ATTRIB_UPDATE_ACCEPT_MESSAGE,
123 IDP_ATTRIB_UPDATE_REJECT_MESSAGE,
124 IDP_MAX_MESSAGE_ID
125} IdpMessageTypeT;
126
127typedef enum
128{
129 REQ_REASON_AT_INITIATED,
130 REQ_REASON_AN_INITIATED,
131 REQ_REASON_INVALID
132} IdpRequestReasonT;
133
134typedef enum
135{
136 DENY_REASON_GENERAL,
137 DENY_REASON_NETWORK_BUSY,
138 DENY_REASON_AUTH_OR_BILL_FAILURE,
139 DENY_CONN_REQ_INPROGRESS_FAILURE,
140 DENY_CONN_SETUP_TIMER_EXPIRED,
141 DENY_REASON_RESERVED
142} IdpConnDenyReasonT;
143
144typedef struct
145{
146 kal_uint8 MaskMap;
147 MaskRecordT Mask[MAX_MASKCOUNT];
148} PagingMaskPrefT;
149
150typedef enum
151{
152 IDP_ATTRIB_PCCC, /*Preferred Control Channel Cycle Attribute ID, 0x00*/
153 IDP_ATTRIB_SM, /*SlottedMode Attribute ID, 0x01 */
154 IDP_ATTRIB_PM, /* Paging MaskAttribute ID, 0x02 */
155 IDP_ATTRIB_AHCM = 0xfe, /*AccessHashingClassMask Attribute Id, 0xfe */
156 IDP_ATTRIB_SSCA /*Small Slot Cycle Allowed Attribute Id, 0xff */
157} IdpAttribIdT;
158
159typedef enum
160{
161 IHO_WAKE_REDUCTION_STATE_INACTIVE,
162 IHO_WAKE_REDUCTION_STATE_ACTIVE,
163 IHO_WAKE_REDUCTION_STATE_MINIACQ,
164 IHO_WAKE_REDUCTION_STATE_WAKEUP,
165 IHO_WAKE_REDUCTION_STATE_MONITOR,
166 IHO_WAKE_REDUCTION_STATE_SEARCHDONE,
167 IHO_WAKE_REDUCTION_STATE_COMPLETE
168} IHOWakeReductionStateT;
169
170#ifdef MTK_DEV_C2K_IRAT
171#if 0
172/* under construction !*/
173/* under construction !*/
174/* under construction !*/
175/* under construction !*/
176/* under construction !*/
177/* under construction !*/
178/* under construction !*/
179/* under construction !*/
180/* under construction !*/
181/* under construction !*/
182/* under construction !*/
183/* under construction !*/
184/* under construction !*/
185/* under construction !*/
186/* under construction !*/
187/* under construction !*/
188#endif
189
190typedef enum
191{
192 IDP_RSVAS_OCCUPY_STATUS_NULL,
193 IDP_RSVAS_OCCUPY_STATUS_WAIT_CNF,
194 IDP_RSVAS_OCCUPY_STATUS_WAIT_CNF_FOR_FAST_CONN,
195 IDP_RSVAS_OCCUPY_STATUS_WAIT_IND,
196 IDP_RSVAS_OCCUPY_STATUS_WAIT_IND_FOR_FAST_CONN,
197 IDP_RSVAS_OCCUPY_STATUS_COMPLETE
198} IdpRsvasOccupyStatusT;
199#endif /* MTK_DEV_C2K_IRAT */
200
201typedef struct
202{
203 IdpSubTypeT IdpSubType;
204 IdpStateT curIdpState;
205 kal_bool bInUseInitialized;
206 kal_bool bSlottedModeEnabled;
207 kal_bool bConnectionReqInProgress;
208 kal_bool bDsarAccessInProgress;
209 kal_bool bSessionCloseInprogress;
210 kal_bool bSessionIsActive;
211 kal_bool bSubnetChangedOrCommittingIndication;
212 kal_bool bConnectionReqPending;
213 IdpAlmpOpenConnMsgT IdpAlmpOpenConnMsgPended;
214 kal_uint8 nAcmacTxStartedCount;
215 kal_bool bSleepCapsuleDoneRcvd;
216 kal_bool bSectorParmsUpdated;
217 kal_bool bSuspendPeriodInActive;
218 kal_bool bOMPUPdatedMsgPended;
219 kal_bool bChannelSelectPended;
220 kal_bool bPagePended;
221 kal_bool bProhibitEnterSleepForPageRcvd;
222 kal_bool bSessionSeedPended;
223 kal_uint8 ChannelCount;
224 ChanRecGT Channel[64];
225 kal_uint8 RUPSupportedChannelCount;
226 ChanRecGT RUPSupportedChannel[64];
227 kal_uint8 nSyncCapsuleOffset;
228 kal_bool bSessionSeedValid;
229 kal_uint32 nSessionSeed;
230 kal_uint32 nATI;
231 IdpAttribRecT attribIdp[IDP_MAX_INSTANCE];
232 IdpAttribRecT attribFallback;
233 kal_uint32 nPeriod1;
234 kal_uint32 nPeriod2;
235 kal_uint32 nPeriod3;
236 kal_uint32 nT12;
237 kal_uint32 nT23;
238 PagingMaskPrefT PagingMaskPref;
239 kal_uint16 TDualIdleForDefaultType;
240 kal_uint16 TDualIdle;
241 kal_uint16 THRPDExtendedSC;
242 kal_bool bImdWakeup;
243 kal_bool bSrchDone;
244#ifdef MTK_DEV_C2K_IRAT
245 kal_bool bOtherRATAvailable;
246 kal_uint8 OtherRATSlotCycle;
247 kal_bool bOtherRATUpdated;
248#endif /* MTK_DEV_C2K_IRAT */
249 kal_bool bIdpIHOWakeReductionEnable;
250 kal_uint32 nLongPeriod;
251 kal_uint32 curPeriod;
252 kal_bool bByPassSessionStatusForSleep;
253 kal_uint8 numHashCh;
254 kal_uint8 curHashIdx;
255 kal_bool bNeedSpecialSessionSeed;
256 kal_uint8 nNetworkLostCout;
257 kal_bool bWakeupInd;
258 kal_uint16 T_Dfs_TimerMSC;
259 kal_uint16 T_Dfs_NumChan;
260} IdpInfoT;
261
262/* IDP ConnectionDeny Message*/
263typedef struct {
264 kal_uint8 nTransactionID;
265 kal_uint8 nDenyReason;
266 kal_uint8 nReserved;
267} IdpConnectionDenyT;
268
269typedef struct
270{
271 kal_bool bSloteMode;
272 kal_uint16 ChannelNum;
273 kal_uint8 FrameUpper6;
274 kal_uint32 FrameLow32;
275} EtsGetDoSysStatusRspT;
276/*----------------------------------------------------------------------------
277 Global Data
278----------------------------------------------------------------------------*/
279extern RmcSchDataCtxT RmcSchDataCtx;
280
281/*----------------------------------------------------------------------------
282 Global Function Prototypes
283----------------------------------------------------------------------------*/
284void IdpInit(void);
285void IdpInitialize(void);
286void IdpCalcT12AndT23Value(void);
287void RunIdpStateMachine(kal_uint32 MsgId, void *MsgDataP);
288void ProcessIdpAlmpActivateMsg(IdpAlmpActiveMsgT *MsgDataP);
289void ProcessIdpAlmpDeactivateMsg(IdpAlmpDeactiveMsgT *MsgDataP);
290void ProcessIdpAlmpOpenConnMsg(IdpAlmpOpenConnMsgT *MsgDataP);
291void ProcessIdpAlmpCloseMsg(void);
292void ProcessIdpRupConnectionInitiatedMsg(void);
293void ProcessIdpRupConnectionOpenedMsg(void);
294void ProcessIdpRupIHOResultMsg(IdpRupIHOResultMsg* MsgDataP);
295void ProcessIdpHscFreezeMsg(void);
296void ProcessIdpHscThawMsg(void);
297void ProcessIdpHscResyncIndMsg(void);
298void ProcessIdpHscResyncDeniedMsg(IdpHscResyncDeniedMsgT *MsgDataP);
299void ProcessIdpHscWakeupIndMsg(IdpHscWakeupIndMsgT *MsgDataP);
300void ProcessIdpAcmTxStartedMsg(void);
301void ProcessIdpAcmTxEndedMsg(IdpAcmTxEndedMsgT *MsgDataP);
302void ProcessIdpCcmSleepCapsuleDoneMsg(void);
303void ProcessIdpDsaFwdMsg(DsaFwdMsgT *MsgDataP);
304void ProcessIdpDsaTxStatusMsg(DsarTxStatusMsgT *MsgDataP);
305void ProcessIdpSmpSessionOpenedMsg(void);
306void ProcessIdpSmpSessionClosedMsg(IdpSmpSessionClosedMsgT *MsgDataP);
307void ProcessIdpSmpSessionStatusMsg(IdpSmpSessionStatusMsgT *MsgDataP);
308void ProcessIdpOmpUpdatedMsg(IdpOmpUpdatedMsgT *MsgDataP);
309void ProcessIdpCspSuspenPeriodTimeMsg(IdpCspSuspendPeriodTimeMsgT *MsgDataP);
310void ProcessIdpCspConnectionClosedMsg(void);
311void ProcessIdpAmpSessionSeedMsg(IdpAmpSessionSeedMsgT *MsgDataP);
312void ProcessIdpCcmOffsetMsg(IdpCcmOffsetMsgT *MsgDataP);
313void ProcessIdp1XPsPagingMaskSetMsg(Idp1XPsPagingMaskSetMsgT *MsgDataP);
314void ProcessIdpEltSlottedModeSetMsg(IdpSlottedModeSetMsgT *MsgDataP);
315void ProcessIdpScpReconfiguredMsg(void);
316void ProcessIdpScpCommittedMsg(void);
317void IdpInitStructures( kal_uint8 SubType, kal_bool InUse);
318void ProcessIdpConnectionSetupTmrExpired(void);
319void ProcessIdpPagePendingTmrExpired(void);
320void ProcessIdpSuspendPeriodTmrExpired(void);
321void ProcessIdpNoSrchDoneWakeUpTmrExpired(void);
322void ProcessIdpDfsTmrExpired(void);
323void ProcessIdpEltHardoffTestMsg(IdpEltHandoffMsgT *HandoffMsg);
324kal_bool IdpCheckSubTypeInUseAndInConfigProtocol(void);
325void ProcessIdpAlmpSysInfoUpdateMsg(IdpAlmpSysInfoUpdateMsgT *MsgDataP);
326void ProcessIdpEltGetDoSysStatusMsg(ExeRspMsgT* pMsg);
327void ProcessIdpDsarAccessStartMsg(void);
328void ProcessIdpDsarAccessStopMsg(IdpDsarAccessEndedMsgT *MsgDataP);
329void ProcessIdpPrefCCCycleMsg(DoPrefCCModeSetMsgT* MsgDataP);
330void ProcessIdpExtendedSlotCycleSetMsg(IdpExtendedSlotCycleSetMsgT *MsgDataP);
331void ProcessIdpRupChannelChangedIndMsg(IdpRupChannelChangedIndMsgT *MsgDataP);
332void ProcessIdpRupForceIHORspMsg(IdpRupForceIHORspMsgT* MsgDataP);
333void ProcessIdpBlockIHOWakeReductionExpired(void);
334void ProcessIdpRmcInterHoCnfMsg(void);
335void ProcessIdpRmcIhoWakeReductionStateCnfMsg(IdpRmcIHOWakeReductionStateCnfMsgT *MsgDataP);
336void ProcessIdpRmcIhoForceAcqOvhdIndMsg(IdpRmcForceAcqOvhdIndMsgT *MsgDataP);
337
338kal_bool IdpGetIdpFreezeState(void);
339void IdpGetCurChanInfo(ChanRecGT *pCurChanInfo);
340#ifdef MTK_DEV_C2K_IRAT
341void ProcessIdpOmpOtherRATUpdatedMsg(IdpOmpOtherRatUpdatedMsgT *MsgDataP);
342void ProcessIdpContinueRcvUatiAssignmentTmrExpired(void);
343void IdpProbeTxingProtectionDetermine(kal_bool bProtectStatus);
344void ProcessClcRmcIdleModeCfgCnfMsg(void);
345#endif /* MTK_DEV_C2K_IRAT */
346
347kal_bool IdpCheckReadyForPowerDown(void);
348
349kal_bool IdpNeedChanHash(IdpOmpUpdatedMsgT *MsgDataP);
350void ProcessIdpRupDfsEndMsg(IdpRupDfsEndMsgT *MsgDataP);
351void processIdpDfsTimerSetMsg(IdpDfsTimerSetMsgT *MsgDataP);
352void ProcessIdpHscTxAvailableInd(void);
353
354#ifdef __EVL3_EM_MODE__
355IdpInfoT* IdpShareIDPInfo(void);
356#endif
357
358void IdpSignalInteractiveProtectDetermine (kal_uint16 protocolType, kal_uint32 msgId, ConfirmResponseE Status);
359void ProcessIdpWfrRmcInterHoCnfExpired(void);
360IdpStateT IdpStateGet(void);
361
362#ifdef MTK_DEV_C2K_IRAT
363void ProcessIdpWfrRsvasOccupyIndTimerExpired (void);
364#endif
365
366void ProcessIdpGuardNonSlottedModeExpired(void);
367
368/*****************************************************************************
369* $Log: clcidp.h $
370*****************************************************************************/
371
372/*****************************************************************************
373* End of File
374*****************************************************************************/
375#endif /*_CLCIDP_H_*/
376
377
378/**Log information: \main\CBP80\cbp80_jzwang_scbp10066\1 2012-07-19 04:50:08 GMT jzwang
379** Made the change to handle the DO Long sleep command from IRAT when DO in sleep state**/
380/**Log information: \main\Trophy\Trophy_ylxiao_href22158\1 2013-04-19 09:40:29 GMT ylxiao
381** HREF#22158, remove compile warnings, fix bug**/
382/**Log information: \main\Trophy\1 2013-04-22 01:48:23 GMT zlin
383** HREF#22158. merge code.**/
384/**Log information: \main\Trophy\Trophy_yzhang_href22247\1 2013-07-30 06:34:55 GMT yzhang
385** HREF#22274=>fix concurrent UATIRequest and connectionrequest**/
386/**Log information: \main\Trophy\2 2013-07-30 07:08:05 GMT jzwang
387** href#22247**/