yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | /***************************************************************************** |
| 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 | #ifndef _CPH1XFLRAKE_H_ |
| 36 | #define _CPH1XFLRAKE_H_ |
| 37 | |
| 38 | #include "cl1common.h" |
| 39 | #include "kal_general_types.h" |
| 40 | |
| 41 | #define D2BIF_WORK_AROUND_MORE_ANT 1 |
| 42 | |
| 43 | //#define D2BIF_WORK_AROUND_T2_DISD2BIF 1 |
| 44 | |
| 45 | |
| 46 | #define SECTOR_NUM_1X 6 |
| 47 | #define FINGER_NUM_1X 8 |
| 48 | |
| 49 | #define SPEED_UPPERROUND 0xff |
| 50 | |
| 51 | #define DEFAULT_T1_PCG (0) |
| 52 | #define DEFAULT_T6_PCG (0) |
| 53 | #define DEFAULT_T7_PCG (15) |
| 54 | #if defined(__MD93__)||defined(__MD95__) |
| 55 | #define BIGRAM_BASE_ADDR_L1 0xa9000000 |
| 56 | #endif |
| 57 | |
| 58 | #ifdef __MD97__ |
| 59 | #define BIGRAM_BASE_ADDR_L1 0xab000000 |
| 60 | #endif |
| 61 | /*Rake Bootup*/ |
| 62 | typedef enum |
| 63 | { |
| 64 | BOOT_UP_WCDMA_MODE = 0, |
| 65 | BOOT_UP_C2K_MODE |
| 66 | } CphBootUpMode; |
| 67 | |
| 68 | |
| 69 | /*Rake Generate*/ |
| 70 | typedef enum |
| 71 | { |
| 72 | B2R_MODE_WCDMA, |
| 73 | B2R_MODE_C1X, |
| 74 | B2R_MODE_CDO, |
| 75 | B2R_MODE_SHDR |
| 76 | } Cph1xB2RifMode; |
| 77 | |
| 78 | typedef enum |
| 79 | { |
| 80 | D2B_MODE_WCDMA, |
| 81 | D2B_MODE_C1X, |
| 82 | D2B_MODE_CDO, |
| 83 | D2B_MODE_QLIC |
| 84 | } Cph1xD2BifMode; |
| 85 | |
| 86 | |
| 87 | /*Rake Generate*/ |
| 88 | typedef enum |
| 89 | { |
| 90 | CPH_NULL_STATE = 0, |
| 91 | CPH_SYNC_STATE = 1, |
| 92 | CPH_IDLE_STATE = 2, |
| 93 | CPH_CONNECTED_STATE = 4 |
| 94 | } Cph1xL1dState; |
| 95 | |
| 96 | typedef enum |
| 97 | { |
| 98 | DISABLE_MODE, |
| 99 | RTT_MODE, |
| 100 | EVDO_MODE, |
| 101 | SHDR_STATE |
| 102 | } CphL1dMode; |
| 103 | |
| 104 | typedef enum |
| 105 | { |
| 106 | ANT_MAIN_ONLY, |
| 107 | ANT_DIV_ONLY, |
| 108 | ANT_DIVERSITY, |
| 109 | ANT_SHDR, |
| 110 | ANT_DISABLE |
| 111 | } CphAntMod; |
| 112 | |
| 113 | |
| 114 | typedef enum |
| 115 | { |
| 116 | CH_NULL = 0, |
| 117 | CH_PCH = 3, |
| 118 | CH_FCH = 3, |
| 119 | CH_SCH = 4, |
| 120 | CH_SYNC = 5 |
| 121 | } Cph1xCHType; |
| 122 | |
| 123 | typedef enum |
| 124 | { |
| 125 | SF4 = 0, |
| 126 | SF8, |
| 127 | SF16, |
| 128 | SF32, |
| 129 | SF64, |
| 130 | SF128, |
| 131 | SF256 |
| 132 | } Cph1xSFType; |
| 133 | |
| 134 | |
| 135 | typedef enum |
| 136 | { |
| 137 | FNG_RELEASED = 0, |
| 138 | FNG_ACTIVATED, |
| 139 | FNG_OBSERVED |
| 140 | } Cph1xFngStatus; |
| 141 | |
| 142 | typedef struct |
| 143 | { |
| 144 | kal_bool QlicEn; |
| 145 | kal_uint32 T7Timing; |
| 146 | }Cph1xFlRakeQlicCfgT; |
| 147 | |
| 148 | |
| 149 | typedef struct |
| 150 | { |
| 151 | /*For normal init*/ |
| 152 | kal_uint32 T3Time; /*Uint is 1/8 chip*/ |
| 153 | kal_uint32 T2Time; /*Uint is 1/8 chip*/ |
| 154 | kal_uint16 T3Dist; /*Uint is 1/8 chip, last 7 bit not valid*/ |
| 155 | /*from Rfc state*/ |
| 156 | CphAntMod AntMode; |
| 157 | /*For shdr init*/ |
| 158 | kal_uint16 PagingOffset; |
| 159 | kal_uint32 GsrSlotIndx; |
| 160 | kal_uint32 T3GsrAddr; |
| 161 | |
| 162 | /*For all init*/ |
| 163 | kal_uint8 T7SlotIdx; |
| 164 | /*uint is 100kHz*/ |
| 165 | kal_uint16 DlCarrierFreq; |
| 166 | Cph1xL1dState L1dState1x; |
| 167 | kal_bool QlicEn; |
| 168 | kal_uint16 QlicDelay; /*EChip*/ |
| 169 | kal_uint32 T7Timing; |
| 170 | kal_uint32 LcMask[2]; |
| 171 | kal_uint32 LcState[2]; |
| 172 | /*LcState timing*/ |
| 173 | kal_uint32 LcFrame; |
| 174 | kal_uint8 LcPcg; |
| 175 | kal_uint8 Pich1xrttRshBit; |
| 176 | kal_uint8 FchRshBit; |
| 177 | /*Pilot on evdo chip*/ |
| 178 | kal_uint32 PichOnDoChip; |
| 179 | } Cph1xFlRakeInitT; |
| 180 | |
| 181 | |
| 182 | |
| 183 | typedef struct |
| 184 | { |
| 185 | kal_uint8 T6SlotIdx; |
| 186 | kal_bool IsShdr; |
| 187 | } Cph1xFlRakeDeactiveT; |
| 188 | |
| 189 | typedef struct |
| 190 | { |
| 191 | kal_bool ChChange; |
| 192 | kal_bool ChEn; |
| 193 | Cph1xCHType Type;/*CH_TYPE: 1 PCH 2 SYNC 3 FCH */ |
| 194 | kal_uint8 ForRc; |
| 195 | kal_uint8 RevRc; |
| 196 | kal_uint32 RshBit; |
| 197 | kal_uint16 PnOffset[SECTOR_NUM_1X]; |
| 198 | kal_uint16 WalshCode[SECTOR_NUM_1X]; |
| 199 | kal_uint8 QofCode[SECTOR_NUM_1X]; |
| 200 | kal_uint8 PwrSecSetId[SECTOR_NUM_1X]; |
| 201 | kal_uint8 Sf;/*0 SF4 1 SF8 ....6 SF 256*/ |
| 202 | kal_uint16 CfgChangeBit; |
| 203 | kal_uint8 ValidBit; |
| 204 | kal_uint8 FrameOffset; |
| 205 | kal_uint8 Phch0RshBit; |
| 206 | kal_uint8 Phch2RshBit; |
| 207 | } Cph1xFlRakeCh0T; |
| 208 | |
| 209 | typedef struct |
| 210 | { |
| 211 | kal_bool ChChange; |
| 212 | kal_bool ChEn; |
| 213 | kal_uint8 ForRc; |
| 214 | kal_uint16 RshBit; |
| 215 | kal_uint16 WalshCode[SECTOR_NUM_1X]; |
| 216 | kal_uint8 QofCode[SECTOR_NUM_1X]; |
| 217 | kal_uint8 Sf; /*0 SF4 1 SF8 ....6 SF 256*/ |
| 218 | kal_uint8 CfgChangeBit; |
| 219 | kal_uint8 ValidBit; |
| 220 | kal_uint8 FrameOffset; |
| 221 | kal_uint8 Phch1RshBit; |
| 222 | } Cph1xFlRakeCh1T; |
| 223 | |
| 224 | |
| 225 | typedef struct |
| 226 | { |
| 227 | Cph1xFlRakeCh0T RakeCh0Cfg; |
| 228 | Cph1xFlRakeCh1T RakeCh1Cfg; |
| 229 | } Cph1xFlRakeChCfgT; |
| 230 | |
| 231 | |
| 232 | |
| 233 | typedef struct |
| 234 | { |
| 235 | CphAntMod AntMode; |
| 236 | kal_uint32 RefTimeEChip; |
| 237 | kal_uint32 RefGsrHChip; |
| 238 | kal_bool RefGsrSyncReadState; |
| 239 | kal_bool RefGsrTimingReadState; |
| 240 | } Cph1xFlRakeGsrT; |
| 241 | |
| 242 | |
| 243 | typedef struct |
| 244 | { |
| 245 | kal_bool FngEnFlag; |
| 246 | kal_uint8 FngIdx; |
| 247 | |
| 248 | kal_uint8 SecId; |
| 249 | kal_bool FngReassignFlag; |
| 250 | Cph1xFngStatus FngStatus; |
| 251 | kal_uint32 FngAddr; |
| 252 | kal_uint32 FngSymIdx; |
| 253 | kal_uint32 FngInitPower; |
| 254 | |
| 255 | kal_int16 FngAccuDrift; |
| 256 | } Cph1xFlRakeFingerCfgT; |
| 257 | |
| 258 | typedef struct |
| 259 | { |
| 260 | kal_uint16 PwrTshdA2OH; |
| 261 | kal_uint16 PwrTshdO2AH; |
| 262 | } Cph1xFlRakeTrackerTshdCfgT; |
| 263 | |
| 264 | |
| 265 | typedef struct |
| 266 | { |
| 267 | kal_uint8 FngIdx; |
| 268 | kal_uint8 FngAccuDrift; |
| 269 | } Cph1xFlRakeTrackerDriftCfgT; |
| 270 | |
| 271 | typedef struct |
| 272 | { |
| 273 | kal_bool RssiStableFlag; |
| 274 | kal_uint16 PreviousSpeedResult; |
| 275 | } Cph1xFlRakeSpestT; |
| 276 | |
| 277 | |
| 278 | typedef struct |
| 279 | { |
| 280 | kal_uint8 FngIdx; |
| 281 | kal_int8 FngAccuDrift; |
| 282 | kal_uint32 FngMicPower; |
| 283 | kal_uint8 FngStatus; |
| 284 | } Cph1xFlRakeTrackerReadT; |
| 285 | |
| 286 | |
| 287 | typedef struct |
| 288 | { |
| 289 | kal_uint8 currSpeed; |
| 290 | |
| 291 | } Cph1xFlRakeCurrSpeedT; |
| 292 | |
| 293 | |
| 294 | |
| 295 | typedef struct |
| 296 | { |
| 297 | kal_bool RxDFlag; |
| 298 | } Cph1xFlRakeRxdT; |
| 299 | |
| 300 | |
| 301 | |
| 302 | typedef struct |
| 303 | { |
| 304 | kal_bool OcEn; |
| 305 | kal_bool OcSelEn; |
| 306 | kal_uint16 OcSelSlotIdx; |
| 307 | kal_uint16 OcSelSymIdx; |
| 308 | kal_uint16 OcSelLength; |
| 309 | }Cph1xFlRakeOcCfgT; |
| 310 | |
| 311 | |
| 312 | |
| 313 | typedef struct |
| 314 | { |
| 315 | kal_uint8 FngIdx; |
| 316 | kal_bool Enable; |
| 317 | kal_int32 FngPos[8]; // finger number |
| 318 | }Cph1xFlRakeQlicFingerCfgT; |
| 319 | |
| 320 | |
| 321 | typedef struct |
| 322 | { |
| 323 | kal_bool Enable; |
| 324 | kal_uint32 ChEnState; |
| 325 | kal_uint32 ActionTimeChip; |
| 326 | kal_uint16 ValidBitFch; |
| 327 | kal_uint16 ValidBitSch; |
| 328 | }Cph1xFlRakeCfsCfgT; |
| 329 | |
| 330 | |
| 331 | typedef struct |
| 332 | { |
| 333 | kal_bool FpcEnable; |
| 334 | kal_uint16 FpcMode; |
| 335 | kal_uint16 FwdRc; /*FWD RC:Rc1 1,RC2 2,...RC11 6, RC12 7*/ |
| 336 | kal_uint16 RpcMode; |
| 337 | kal_uint16 RevRc; |
| 338 | |
| 339 | kal_int32 FpcSubChanGain; |
| 340 | kal_bool FchSetPtIncl; |
| 341 | kal_int32 FchCurrSetPt; |
| 342 | kal_bool SchSetPtIncl; |
| 343 | kal_int32 SchCurrSetPt; |
| 344 | |
| 345 | }Cph1xFlRakePcModeCfgT; |
| 346 | |
| 347 | typedef struct |
| 348 | { |
| 349 | kal_bool FchSetPtIncl; |
| 350 | kal_int32 FchCurrSetPt; |
| 351 | kal_bool SchSetPtIncl; |
| 352 | kal_uint32 SchCurrSetPt; |
| 353 | }Cph1xFlRakePcSetPtCfgT; |
| 354 | |
| 355 | |
| 356 | typedef struct |
| 357 | { |
| 358 | kal_bool FchFpcValid; |
| 359 | kal_uint16 FchFpcDecision; |
| 360 | kal_int32 FchEbNt; /*PCG level*/ |
| 361 | |
| 362 | kal_bool SchFpcValid; |
| 363 | kal_uint16 SchFpcDecision; |
| 364 | kal_int32 SchEbNt; /*PCG level*/ |
| 365 | }Cph1xFlRakeFpcBitT; |
| 366 | |
| 367 | |
| 368 | typedef struct |
| 369 | { |
| 370 | kal_bool RpcValid; |
| 371 | kal_uint16 RpcDecision; |
| 372 | kal_uint16 Index; |
| 373 | }Cph1xFlRakeRpcBitT; |
| 374 | |
| 375 | |
| 376 | typedef struct |
| 377 | { |
| 378 | kal_bool ChChange; |
| 379 | kal_uint16 FchAckMask; |
| 380 | kal_uint16 RevFchAckMask; |
| 381 | kal_uint32 RxSrpAckTsh; |
| 382 | }Cph1xFlRakeAckCfgT; |
| 383 | |
| 384 | |
| 385 | typedef struct |
| 386 | { |
| 387 | kal_bool FoeReady; |
| 388 | kal_int32 FineFoe; |
| 389 | kal_uint32 SqPwr; |
| 390 | |
| 391 | }Cph1xFlRakeFoeReadT; |
| 392 | |
| 393 | typedef struct |
| 394 | { |
| 395 | kal_uint32 IirPilotPwr; |
| 396 | kal_uint32 IirNoisePwr; |
| 397 | kal_uint32 IirPcbPwr; |
| 398 | kal_uint32 IirFschPwr; |
| 399 | }Cph1xFlRakeSrpAlphaT; |
| 400 | |
| 401 | typedef struct |
| 402 | { |
| 403 | kal_uint32 FchDecodeOK; |
| 404 | kal_uint32 FchDecodeUpdate; |
| 405 | kal_uint32 FschDecodeOK; |
| 406 | kal_uint32 FschDecodeUpdate; |
| 407 | }Cph1xFlRakeSrpEibT; |
| 408 | |
| 409 | extern void Cph1xFlRakeInit(Cph1xFlRakeInitT *adsPtr); |
| 410 | extern void Cph1xFlRakeShdrInit(Cph1xFlRakeInitT *adsPtr); |
| 411 | extern kal_bool Cph1xFlRakeSleepIndRead(); |
| 412 | extern kal_bool Cph1xFlRakeStatusRead(); |
| 413 | extern void Cph1xFlRakeChannelDisable(); |
| 414 | extern void Cph1xRlRakeDeactive(Cph1xFlRakeDeactiveT *adsPtr); |
| 415 | extern void Cph1xFlRakeDisableLoad(); |
| 416 | extern void Cph1xFlRakeDisableD2bifB2rif(); |
| 417 | extern void Cph1xFlRakeDisableA1C1(void); |
| 418 | extern void Cph1xFlRakeCh0Config(Cph1xFlRakeCh0T *adsPtr); |
| 419 | extern void Cph1xFlRakeCh1Config(Cph1xFlRakeCh1T *adsPtr); |
| 420 | extern void Cph1xFlRakeCh2Config(Cph1xFlRakeCh0T *adsPtr); |
| 421 | extern void Cph1xFlRakeGsrRead(Cph1xFlRakeGsrT *adsPtr); |
| 422 | extern void Cph1xFlRakeT6Config(kal_uint8 T6SlotIdx); |
| 423 | extern void Cph1xFlRakeT7Config(kal_uint8 T7SlotIdx); |
| 424 | extern void Cph1xFlRakeFingerConfig(Cph1xFlRakeFingerCfgT *adsPtr); |
| 425 | extern void Cph1xFlRakeTrackerRead(Cph1xFlRakeTrackerReadT *adsPtr); |
| 426 | extern void Cph1xFlRakeTrackerInfo(); |
| 427 | extern void Cph1xFlRakeTrackerTshConfig(Cph1xFlRakeTrackerTshdCfgT *adsPtr); |
| 428 | extern void Cph1xFlRakeTrackerConfig(Cph1xFlRakeTrackerDriftCfgT *adsPtr); |
| 429 | extern void Cph1xFlRakeOcConfig(Cph1xFlRakeOcCfgT *adsPtr); |
| 430 | extern void Cph1xFlRakeOCResultConfig(kal_bool OcSelEn); |
| 431 | extern void Cph1xFlRakeSpestConfig(Cph1xFlRakeSpestT *adsPtr); |
| 432 | extern void Cph1xFlRakeSpestForceConfig(kal_uint32 SpeedEstFinal); |
| 433 | extern void Cph1xFlRakeSpestRead(Cph1xFlRakeCurrSpeedT *adsPtr); |
| 434 | extern void Cph1xFlRakeRxdConfig(kal_bool Enable); |
| 435 | extern kal_bool Cph1xFlRakeRxdCheck(); |
| 436 | extern void Cph1xFlRakeQlicConfig(kal_bool QlicEn, kal_uint32 T7Timing); |
| 437 | extern void Cph1xFlRakeQlicFingerConfig(Cph1xFlRakeQlicFingerCfgT *adsPtr); |
| 438 | extern void Cph1xFlRakeCfsConfig(Cph1xFlRakeCfsCfgT *adsPtr); |
| 439 | extern void Cph1xFlRakeFpcModeConfig(Cph1xFlRakePcModeCfgT *adsPtr); |
| 440 | extern void Cph1xFlRakeFpcSetPtConfig(Cph1xFlRakePcModeCfgT *adsPtr); |
| 441 | extern void Cph1xFlRakeFpcBitRead(Cph1xFlRakeFpcBitT *adsPtr); |
| 442 | extern kal_int32 Cph1xFlRakeSyncPchEbNtRead(); |
| 443 | extern void Cph1xFlRakeRpcBitRead(Cph1xFlRakeRpcBitT *adsPtr); |
| 444 | extern void Cph1xFlRakeAckConfig(Cph1xFlRakeAckCfgT *adsPtr); |
| 445 | extern kal_bool Cph1xFlRakeAckRead(); |
| 446 | extern void Cph1xFlRakeAckClr(); |
| 447 | extern void Cph1xFlRakeLongCodeMaskConfig(kal_uint32 *adsPtr); |
| 448 | extern void Cph1xFlRakeLongCodeStateConfig(kal_uint32 *adsPtr); |
| 449 | extern void Cph1xFlRakeLongCodeStateRead(kal_uint32 *adsPtr); |
| 450 | extern void Cph1xFlRakeAfcRst(); |
| 451 | extern void Cph1xFlRakeAfcRead(Cph1xFlRakeFoeReadT *adsPtr); |
| 452 | extern kal_uint32 Cph1xFlRakePilotEbNtRead(); |
| 453 | extern void Cph1xFlRakeSrpAlphaCfg(Cph1xFlRakeSrpAlphaT *adsPtr); |
| 454 | extern void Cph1xFlRakeEibCfg(Cph1xFlRakeSrpEibT *adsPtr); |
| 455 | extern kal_bool Cph1xFlRakeC1A1EnCheck(); |
| 456 | extern kal_bool Cph1xFlRakeC0A0EnCheck(void); |
| 457 | extern void Cph1xFlRakeTrkInitCfg(); |
| 458 | extern void Cph1xFlRakeOcInitCfg(); |
| 459 | extern void Cph1xFlRakeTrkConfThCfg(kal_uint32 PwrTshdO2AH); |
| 460 | extern void Cph1xFlRakeBigramDumpAccessEnable(); |
| 461 | extern kal_uint32 Cph1xFlRakeBigramIqAddress(CphAntMod AntMode); |
| 462 | extern void Cph1xFlRakeShdrGsrRead(Cph1xFlRakeGsrT *adsPtr); |
| 463 | #endif |