blob: 6653e8c9085105978814f5d105cc0ef8b0e6880a [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) 1999-2010 VIA Telecom, Inc. All rights reserved.
42*
43*************************************************************/
44/****************************************************************************
45 *
46 * Filename: identity.h
47 *
48 * Purpose: Define externally available (global) mobile station identity
49 * elements.
50 *
51 ****************************************************************************
52 *
53 * PVCS Header Information
54 *
55 * $Revision: 1.5 $
56 * $Author: hans $
57 *
58 * $Log: identity.h $
59 *
60 * 07 06 2017 sue.zhong
61 * [MOLY00259241] [6293][C2K]Replace with KAL data type
62 * Correct copyright file header
63 *
64 * 05 17 2017 peijun.zheng
65 * [MOLY00249027] [BIACNO][MT6763][New feature]C2K code release code modification
66 *
67 * C2k code release.
68 * Revision 1.5 2005/10/06 17:34:53 hans
69 * Merged the appropriate changes from the CBP4.05 CP SW baseline to address CR6049,CR7031,CR7032,CR7033,CR7034
70 * Revision 1.4 2005/03/18 10:24:52 bcolford
71 * CBP4.05 [4.21] to CBP6.1 [2.9.0] CP Software Merge.
72 * Revision 1.2 2004/08/13 10:03:29 agontar
73 * Removed T53 flag; added support for BC3; cleaned up logs
74 * Revision 1.3 2004/04/06 14:02:10 dstecker
75 * CBP6.1 release 1
76 * Revision 1.2 2004/03/25 12:09:34 fpeng
77 * Updated from 6.0 CP 2.5.0
78 * Revision 1.2 2003/08/28 11:18:15 bcolford
79 * Update for merge.
80 * Revision 1.11 2003/05/21 17:11:22 byang
81 * CR#570: Replace compiler flag with IS2000A with IS2000_REV_0.
82 * Revision 1.10 2002/12/04 14:43:55 hans
83 * CR1648: OP mode setting i retrieved direct from ms cap db.
84 * Revision 1.9 2002/09/30 15:15:26 mshaver
85 * Changes to support the single NAM data structure type
86 * definition PswIs95NamT, of type packed.
87 * Revision 1.8 2002/06/06 13:12:53 chinh
88 * Changed and Added Copyright
89 * Revision 1.7 2002/01/17 17:18:36 akayvan
90 * Implemented Slotted Mode mods.
91 * Revision 1.6 2001/11/20 12:26:30 mclee
92 * include pswnam.h
93 * Revision 1.5 2001/11/13 15:37:30 byang
94 * Add function prototype declaration for cpValidatePRev().
95 * Revision 1.4 2001/07/27 16:33:09 mclee
96 * Nam Consolidation fix port from 3.0 to 4.0
97 * Revision 1.3 2001/07/26 14:35:11 bcolford
98 * Add reference for Nam which is used throughout the AMPS
99 * PE software
100 * Revision 1.1 2001/01/17 10:58:50 plabarbe
101 * Initial revision
102 * Revision 1.4 2000/12/22 11:45:44 byang
103 * Consolidate IS2000 global variables into the global structure
104 * IS2000_NETWORK_PARAMETERS.
105 * Revision 1.3 2000/12/05 17:45:11 byang
106 * Idle mode - IS2000A Addendum modifications.
107 * Revision 1.2 2000/11/13 14:25:59 byang
108 * IS-2000A Idle Mode and LAC intergration - Initial Release.
109 * Revision 1.1 2000/10/24 21:11:17Z fpeng
110 * Initial revision
111 * Revision 1.3 2000/08/23 22:09:05Z RSATTARI
112 * Isotel release 2.8 plus LSI applicable IS-95B changes.
113 * Revision 1.14 2000/01/17 22:27:19 scotvold
114 * TC Backward Compatibility changes.
115 *
116 * Revision 1.13 1999/05/19 16:28:08 mhayduk
117 * Added support for setting and retrieving value for T53 MSD
118 * P_REV 3+ setting.
119 *
120 * Revision 1.12 1999/04/12 13:31:46 scotvold
121 * Added T53 HSPD support.
122 * Added 95B SCAM support.
123 * Added 95B GHDM support and consolidated with EHDM.
124 *
125 * Revision 1.11 1999/02/20 00:39:52 scotvold
126 * Added message encryption support.
127 *
128 * Revision 1.10 1999/02/08 22:53:10 scotvold
129 * Lint fixes.
130 *
131 * Revision 1.9 1999/01/09 00:33:45 scotvold
132 * Added SSDUpdateInProgress flag interface.
133 *
134 * Revision 1.8 1998/11/20 16:21:21 mhayduk
135 * Moved opmode definitions into header file.
136 *
137 * Revision 1.7 1998/11/02 22:06:40 scotvold
138 * Compile switch for OP_MODEs and P_REV_IN_USEs.
139 *
140 * Revision 1.6 1998/10/20 23:58:23 mhayduk
141 * Added T53 support.
142 *
143 * Revision 1.5 1998/07/31 16:08:50 scotvold
144 * Wrapped Call History Parameter.
145 *
146 * Revision 1.4 1998/06/08 21:48:25 scotvold
147 * Updated for Release 0.06.
148 *
149 * Revision 1.3 1998/03/30 23:26:03 mhayduk
150 * Release 0.03.
151 *
152 * Revision 1.1 1997/11/06 17:49:24 mhayduk
153 * Initial revision
154 *
155 *
156 ****************************************************************************
157 ****************************************************************************/
158
159
160#ifndef _IDENTITY_H_
161
162#define _IDENTITY_H_ 1
163
164/*****************************************************************************
165 * Includes
166 ****************************************************************************/
167#include "pch_msg.h"
168#include "channel.h"
169#include "systime.h"
170#include "pswapi.h"
171
172/**********************************************************************
173 * Defines
174 **********************************************************************/
175#define CP_HASH_CDMA_CH 0
176#define CP_HASH_PAGE_CH 1
177#define CP_HASH_PAGE_SLOT 2
178#define CP_HASH_ACCESS_CH_PN 3
179#define CP_HASH_BCCH 4
180#define CP_HASH_FCCCH 5
181#define CP_HASH_QPCH 6
182#define CP_HASH_PI_R1 7
183#define CP_HASH_PI_R2 8
184
185/* Define table for mapping op modes by index - Table 7.7.2.3.2.15-3 */
186#define CP_OP_MODE_CDMA_PCS 0
187#define CP_OP_MODE_CDMA_CELLULAR 1
188#define CP_OP_MODE_ANALOG 2
189
190/* type of IMSI_O */
191typedef enum
192{
193 IMSI_O_TYPE_M = 0,
194 IMSI_O_TYPE_T = 1
195} IMSI_O_TYPE;
196
197#define MEID_SIZE 7
198
199typedef struct
200{
201 kal_uint16 type;
202 kal_uint8 meid[MEID_SIZE + 1];
203 kal_uint32 esn;
204} MsidInUseT;
205
206extern PswFTDParaT FTDPara;
207
208static const kal_uint16 CP_INVALID_PN = 0xFFFF;
209
210/**********************************************************************
211 * Global declarations associated with Mobile's identity and shared
212 * amongst files.
213 **********************************************************************/
214
215 /* NAM */
216 /* Consolidate PE and PSW NAM */
217extern PswIs95NamT Nam; /* NAM data */
218extern SecureDataStructT Sdata; /* Secure data */
219extern MsidInUseT _msidInUse; /* MEID/Pseudo ESN or ESN used by CP */
220/* IMSI */
221extern IMSIType IMSI_O; /* operational IMSI */
222extern kal_uint16 MCCs;
223extern kal_uint8 IMSI_11_12s;
224extern IMSI_O_TYPE IMSI_O_Type;
225
226#ifdef MTK_DEV_C2K_IRAT
227extern kal_uint16 MCC_1xOTA;
228#endif /* MTK_DEV_C2K_IRAT */
229
230/* System Parameters for control channels (globally viewed) */
231extern SysBandChannelT CDMA_CHs; /* contains CDMABANDs and CDMACHs */
232extern kal_uint16 PILOT_PNs;
233extern kal_uint8 interCorrSrchCountThresh;
234extern kal_uint8 interCorrectionCorrection;
235extern kal_uint8 achSleepSearchCount;
236
237 /* Begin: added systerm identity parameters from IS-2000A */
238
239typedef struct
240{
241 /* Forward Common Control Channel Parameters */
242 kal_uint8 FCCCHs;
243 FccchRate FCCCH_RATEs;
244 kal_uint8 FCCCH_CODE_RATEs;
245 kal_uint8 FCCCH_CODE_CHANs;
246 kal_uint8 FCCCH_IDs;
247 kal_uint8 NUM_FCCCHs;
248 kal_uint8 FCCCH_CODE_CHAN[ CP_MAX_FCCCH_CODE_CHAN ];
249
250 /* SR1 Parameters */
251 kal_uint8 BCNs;
252 BcchRate BRATs;
253 kal_uint8 BCCH_CODE_RATEs;
254 kal_uint8 BCCHs;
255 kal_bool SR1_BCCH_SUPPORTEDs;
256 Sr1TdModes SR1_TD_MODEs;
257 Sr1TdPowerLevel SR1_TD_POWER_LEVELs;
258 BcchRate SR1_BRAT_TDs;
259 kal_uint8 SR1_CRAT_TDs;
260 BcchRate SR1_BRAT_NON_TDs;
261 kal_uint8 SR1_CRAT_NON_TDs;
262 kal_uint8 BCCH_CODE_CHAN_TDs;
263 kal_uint8 BCCH_CODE_CHAN_NON_TDs;
264
265 /* SR3 Parameters */
266 kal_bool SR3_INCLs;
267 kal_uint8 SR3_PRIMARY_PILOTs;
268 kal_uint8 SR3_PILOT_POWER1s;
269 kal_uint8 SR3_PILOT_POWER2s;
270
271 /* BCast Parameters */
272 kal_uint8 NUM_BCCH_BCASTs;
273 BcchBcast BCCH_BCAST[ MAX_NUM_BCCH_BCAST ];
274
275 /* Quick Paging Channel Parameters */
276 kal_bool QPCH_SUPPORTEDs;
277 kal_uint8 NUM_QPCHs;
278 kal_uint8 QPAGECHs;
279 kal_uint8 ASSIGNED_QPAGECHs;
280 QpchRate QPCH_RATEs;
281 QpchTransPwr QPCH_POWER_LEVEL_PAGEs;
282 kal_bool QPCH_CCI_SUPPORTEDs;
283 QpchTransPwr QPCH_POWER_LEVEL_CONFIGs;
284 kal_bool QPCH_BI_SUPPORTEDs;
285 QpchTransPwr QPCH_POWER_LEVEL_BCASTs;
286
287 /* Network Feature Parameters */
288 kal_bool CS_SUPPORTEDs;
289 kal_bool SDB_SUPPORTEDs;
290} IS2000NetworkParameters;
291
292extern IS2000NetworkParameters IS2000_NETWORK_PARAMETERS;
293
294/* End: added systerm identity parameters from IS-2000A */
295
296extern kal_uint8 P_REVs;
297extern kal_uint8 MIN_P_REVs;
298extern kal_uint8 P_REV_IN_USEs;
299
300/* this group may only be local to eng_init.c */
301extern kal_uint8 SERVSYSs;
302
303/* Scratch Buffer */
304extern kal_uint8 scratch_[];
305
306/* Rx Msg Static Union */
307extern RxMsg rxMsg_;
308
309/**********************************************************************
310 * Prototypes of utilities used in setting/retrieving identity information.
311 **********************************************************************/
312
313void initializeIdentity( void );
314kal_bool retrieveRedirectionChannel( SysBandChannelT *channel);
315kal_bool cpIsOpModeSupported(kal_uint8 opMode);
316kal_uint32 divideIntegers(kal_uint32 div,kal_uint32 base,kal_uint32 upper,kal_uint32 *rem);
317kal_uint16 hash(kal_uint16 range,kal_uint8 application);
318void randomNumberSetSeed(kal_uint32 time);
319kal_uint32 randomInteger(kal_uint32 range);
320kal_uint16 TenBitsToDigital(kal_uint16 n);
321kal_bool cpAccessPsistDelay(kal_uint8 psist, kal_uint8 psist_emg,kal_uint8 accolc,kal_bool secondTerm,
322 kal_uint8 typePsist,kal_bool *fail);
323void cpInitializeCallHistoryParm (kal_uint8 count);
324kal_uint8 cpGetCallHistoryParm (void);
325void cpIncrementCallHistoryParm (void);
326
327void setSSDUpdateInProgress (kal_bool ssdUpdateState);
328kal_bool ssdUpdateInProgress (void);
329
330kal_bool iAm95 (void);
331kal_bool iAm95A (void);
332kal_bool iAmTSB74 (void);
333kal_bool iAmJSTD008 (void);
334kal_bool iAmT53Stream (void);
335kal_bool iAmT53Plus (void);
336kal_bool cpValidatePRev( const kal_uint8 pRev );
337
338#endif /* _IDENTITY_H_ */
339/**Log information: \main\CBP80\cbp80_cshen_scbp10098\1 2012-07-26 06:27:57 GMT cshen
340** cbp80_cshen_scbp10098**/
341