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 | |
| 36 | #ifndef _CL1_RC_REQ_H_ |
| 37 | #define _CL1_RC_REQ_H_ |
| 38 | |
| 39 | /*********************************************************************************** |
| 40 | * |
| 41 | * FILE NAME : cl1rcreq.h |
| 42 | * |
| 43 | * DESCRIPTION : This file contains data type definitions about RC Req |
| 44 | * |
| 45 | * |
| 46 | ************************************************************************************/ |
| 47 | |
| 48 | /*Essential Definitions*/ |
| 49 | #include "sysdefs.h" |
| 50 | #include "sysapi.h" |
| 51 | #include "sysfrc.h" |
| 52 | #include "cl1fr.h" |
| 53 | #include "cl1fhrtbadefs.h" |
| 54 | #include "cl1fhrtbaconstant.h" |
| 55 | #include "hscapi.h" |
| 56 | |
| 57 | #if defined(MTK_DEV_93M_PREIT) && defined(MTK_PLT_ON_PC) && defined(MTK_PLT_ON_PC_IT) && defined(MTK_DEV_93M_C2K_L1_UT) |
| 58 | #define CL1_RC_UNIT_TEST |
| 59 | #endif |
| 60 | |
| 61 | #ifdef CL1_RC_UNIT_TEST |
| 62 | #define M_CL1_RC_UT_LOG(a,b) Cl1RcUtLoggingBitmap(a,b) |
| 63 | #else |
| 64 | #define M_CL1_RC_UT_LOG(a,b) |
| 65 | #endif |
| 66 | |
| 67 | |
| 68 | |
| 69 | /******************************** FEATURES MACROS ********************************/ |
| 70 | |
| 71 | /*Define this macro to enable flow only, no rcd function invoked*/ |
| 72 | /*#define CL1_RC_REQ_SEQ_FLOW_ONLY (0)*/ |
| 73 | |
| 74 | /*Define this macro to enable power control, but real api will be redefined as dummy function*/ |
| 75 | /*#define CL1_RC_DRV_PWR_CTRL_FLOW_ONLY (1)*/ |
| 76 | |
| 77 | /*Define this macro to enable clock control, but no real hw will be accessed if this is macro defined*/ |
| 78 | /*#define CL1_RC_DRV_CLK_CTRL_FLOW_ONLY (2)*/ |
| 79 | |
| 80 | /*Define this macro to enable sram control, but no real hw will be accessed if this is macro defined*/ |
| 81 | /*#define CL1_RC_DRV_SRAM_CTRL_FLOW_ONLY (3)*/ |
| 82 | |
| 83 | /*Define this macro to enable modem dvfs, should be compatible with the flow only option enabled in dvfs driver*/ |
| 84 | /*#define CL1_RC_DRV_MODEM_DVFS_FLOW_ONLY (4)*/ |
| 85 | |
| 86 | /*Define this macro to enable dsp sleep flow control, but real api will be redefined as dummy function*/ |
| 87 | /* #define CL1_RC_DRV_DSP_SLEEP_FLOW_ONLY (5) */ |
| 88 | |
| 89 | /*Define this macro to enable dsp sleep flow control, but real api will be redefined as dummy function*/ |
| 90 | /* #define CL1_RC_DRV_DSP_DDL_FLOW_ONLY (6) */ |
| 91 | |
| 92 | /******************************** Local Const Definitions ********************************/ |
| 93 | |
| 94 | #define CL1_RC_PCG_DURATION (1536 << 3) |
| 95 | #define CL1_RC_SLOT_DURATION (2048 << 3) |
| 96 | |
| 97 | #define CL1_RC_SFRAME_PCG_NUM (64) |
| 98 | #define CL1_RC_SFRAME_SLOT_NUM (48) |
| 99 | |
| 100 | /*DDL duration in 1/8 chip unit*/ |
| 101 | #define CL1_RC_FEC_RX_DDL_DURATION (8356) /*unit is 1/8 chip*/ |
| 102 | #define CL1_RC_FEC_TRX_DDL_DURATION (9339) /*unit is 1/8 chip*/ |
| 103 | #define CL1_RC_RAKE_MD32_DDL_DURATION (47262) /*unit is 1/8 chip*/ |
| 104 | |
| 105 | /*Different period to return to Arbiter to help decide how many TSs to protect*/ |
| 106 | #define CL1_RC_REQ_TXON_PERIOD (3) |
| 107 | |
| 108 | /* This macro used for RC internal Tx off flow schedule, value 3 is to guarantee that turn off Tx RC HW after Tx path off */ |
| 109 | #define CL1_RC_REQ_TXOFF_DELAY_PERIOD (3) /* 3 lots */ |
| 110 | |
| 111 | #define CL1_RC_REQ_EVDO_TXOFF_DELAY_DURATION (CL1_RC_REQ_TXOFF_DELAY_PERIOD*1666) /* 3*1666=4998us, EVDO slot:1666us */ |
| 112 | #define CL1_RC_REQ_1XRTT_TXOFF_DELAY_DURATION (CL1_RC_REQ_TXOFF_DELAY_PERIOD*1250) /* 3*1250=3750us, 1xRTT slot:1250us */ |
| 113 | |
| 114 | #if (CL1_RC_REQ_EVDO_TXOFF_DELAY_DURATION) > (CL1_IF_EVDO_RC_REQ_TXOFF_DELAY*1000) |
| 115 | #error ("CL1_RC_REQ_EVDO_TXOFF_DELAY_DURATION) > (CL1_IF_EVDO_RC_REQ_TXOFF_DELAY*1000") |
| 116 | #endif |
| 117 | |
| 118 | #if (CL1_RC_REQ_1XRTT_TXOFF_DELAY_DURATION) > (CL1_IF_1XRTT_RC_REQ_TXOFF_DELAY*1000) |
| 119 | #error ("CL1_RC_REQ_1XRTT_TXOFF_DELAY_DURATION) > (CL1_IF_1XRTT_RC_REQ_TXOFF_DELAY*1000") |
| 120 | #endif |
| 121 | |
| 122 | /*The maximum length of the request queue*/ |
| 123 | #define CL1_RC_REQ_QDEPTH (2) |
| 124 | |
| 125 | /*If the ongoing is 0xFF, the queue is empty*/ |
| 126 | #define CL1_RC_REQ_QEMPTY (0xFF) |
| 127 | |
| 128 | /*Magic number for optimize div3*/ |
| 129 | #define CL1_RC_DIV3_MAGIC_NUM (0xAAAAAAAB) |
| 130 | |
| 131 | #define CL1_RC_DIV3(Num) ((kal_uint32)((((kal_uint64)(Num))*CL1_RC_DIV3_MAGIC_NUM) >> 33)) |
| 132 | |
| 133 | #define Cl1RcReqEchipOffset2TsNum(Mode, EchipOffset) (SysFrameSizeIs26ms(Mode)? ((EchipOffset) >> 14):(CL1_RC_DIV3(EchipOffset >> 12))) |
| 134 | |
| 135 | #define Cl1RcReqGetTsLength(Mode) (SysFrameSizeIs26ms(Mode)? CL1_RC_SLOT_DURATION : CL1_RC_PCG_DURATION) |
| 136 | |
| 137 | #define CL1_RC_REQ_FEC_HRT_MARGIN 1966 /*(200*6144/625)*/ |
| 138 | /******************************** Local Enumerations ********************************/ |
| 139 | |
| 140 | typedef enum |
| 141 | { |
| 142 | CL1_RC_SEQ_GROUP_TYPE_RX, |
| 143 | CL1_RC_SEQ_GROUP_TYPE_TX, |
| 144 | CL1_RC_SEQ_GROUP_TYPE_NUM |
| 145 | }Cl1RcSeqGrpTypeT; |
| 146 | |
| 147 | /*Different type will lead to different RX ON RCsequence*/ |
| 148 | typedef enum |
| 149 | { |
| 150 | CL1_RC_REQ_RXON_SCHONLY, |
| 151 | CL1_RC_REQ_RXON_CHANNELRX, |
| 152 | CL1_RC_REQ_RXON_STDBYMEAS, |
| 153 | CL1_RC_REQ_RXON_TYPENUM |
| 154 | }Cl1RcReqRxOnTypeT; |
| 155 | |
| 156 | /*Different type means different resource to OFF*/ |
| 157 | typedef enum |
| 158 | { |
| 159 | CL1_RC_REQ_RXOFF_SCHONLY, |
| 160 | CL1_RC_REQ_RXOFF_CHANNELRX, |
| 161 | CL1_RC_REQ_RXOFF_TYPENUM |
| 162 | }Cl1RcReqRxOffTypeT; |
| 163 | |
| 164 | /*Different enum means different receiver of RC OFF COMPLETE EVENT*/ |
| 165 | typedef enum |
| 166 | { |
| 167 | CL1_RC_REQ_OFF_COMPLETE_NOIND = 0, /*No need to send indication after RC OFF complete*/ |
| 168 | CL1_RC_REQ_OFF_COMPLETE_2RI, /*Send indication to sleep RI after RC OFF complete*/ |
| 169 | CL1_RC_REQ_OFF_COMPLETE_2NORMAL, /*Send indication to FT after RC OFF complete*/ |
| 170 | CL1_RC_REQ_OFF_COMPELTE_TYPE_NUM |
| 171 | }Cl1RcReqEndIndT; |
| 172 | |
| 173 | typedef enum |
| 174 | { |
| 175 | CL1_RC_REQ_PARALLEL, |
| 176 | CL1_RC_REQ_CANCEL_ONGOING, |
| 177 | CL1_RC_REQ_PEND, |
| 178 | CL1_RC_REQ_INVALID, |
| 179 | CL1_RC_REQ_MERGE, |
| 180 | CL1_RC_REQ_ARB_NUM |
| 181 | }Cl1RcReqArbT; |
| 182 | |
| 183 | typedef enum |
| 184 | { |
| 185 | CL1_RC_REQ_RXON, |
| 186 | CL1_RC_REQ_RXOFF, |
| 187 | CL1_RC_REQ_TXON, |
| 188 | CL1_RC_REQ_TXOFF, |
| 189 | CL1_RC_REQ_SCHOFF, |
| 190 | CL1_RC_REQ_TYPENUM |
| 191 | }Cl1RcReqTypeT; |
| 192 | |
| 193 | typedef enum |
| 194 | { |
| 195 | CL1_RC_REQ_MODEM_DVFS_SET_RC, |
| 196 | CL1_RC_REQ_MODEM_DVFS_SET_HL, |
| 197 | CL1_RC_REQ_MODEM_DVFS_SET_NUM, |
| 198 | }Cl1RcReqModemDvfsUsrT; |
| 199 | |
| 200 | typedef enum |
| 201 | { |
| 202 | CL1_RCD_DVFS_SCEN_DEFAULT, |
| 203 | CL1_RCD_DVFS_SCEN_CHANNELTX, |
| 204 | CL1_RCD_DVFS_SCEN_CHANNELRX, |
| 205 | CL1_RCD_DVFS_SCEN_SCHONLY, |
| 206 | CL1_RCD_DVFS_SCEN_NUM |
| 207 | }Cl1RcdDvfsScenT; |
| 208 | |
| 209 | /******************************** Local Structures ********************************/ |
| 210 | |
| 211 | /*Define the RX ON request*/ |
| 212 | typedef struct |
| 213 | { |
| 214 | RtbaRcTimingTypeT RtbTiming; |
| 215 | kal_bool RakeDdlInd; /*False: Need not to do Rake DDL; True: Need to do Rake DDL*/ |
| 216 | kal_bool RcCotnrol; /*False: RF operation only; TRUE: RF operation with RC operation;*/ |
| 217 | SysAirInterfaceT Mode; |
| 218 | }Cl1RcReqRxOnT; |
| 219 | |
| 220 | /*Define the RX OFF request*/ |
| 221 | typedef struct |
| 222 | { |
| 223 | SysSFrameTimeT EventTime; |
| 224 | Cl1RcReqEndIndT EndIndication; |
| 225 | SysAirInterfaceT Mode; |
| 226 | }Cl1RcReqRxOffT; |
| 227 | |
| 228 | /*Define the TX ON/OFF request*/ |
| 229 | typedef struct |
| 230 | { |
| 231 | SysSFrameTimeT EventTime; |
| 232 | kal_bool TxForAccess; |
| 233 | SysAirInterfaceT Mode; |
| 234 | }Cl1RcReqTxOnOffT; |
| 235 | |
| 236 | /*A func ptr which should pooint to the function by which we can judge whether SCH post process is ongoing*/ |
| 237 | typedef kal_bool (*Cl1RcSchPostProcStatusFuncPtr)(void); |
| 238 | |
| 239 | /*Define the SCH OFF request*/ |
| 240 | typedef struct |
| 241 | { |
| 242 | SysAirInterfaceT Mode; |
| 243 | }Cl1RcReqSchOffT; |
| 244 | |
| 245 | /* RX/TX Req Data Stored */ |
| 246 | |
| 247 | /*Define this union to merge the two kinds of request to simplify data manage and save memory*/ |
| 248 | typedef union |
| 249 | { |
| 250 | Cl1RcReqRxOnT RxOnReq; |
| 251 | Cl1RcReqRxOffT RxOffReq; |
| 252 | }Cl1RcReqRxOnOffT; |
| 253 | |
| 254 | typedef struct |
| 255 | { |
| 256 | Cl1RcReqTypeT RcReqType; |
| 257 | Cl1RcReqRxOnOffT RcReqInfo; |
| 258 | }Cl1RcReqRxOnOffInfoT; |
| 259 | |
| 260 | |
| 261 | typedef struct |
| 262 | { |
| 263 | Cl1RcReqRxOnOffInfoT Cl1RcReqRxQ[CL1_RC_REQ_QDEPTH]; |
| 264 | kal_uint8 Ongoing; |
| 265 | kal_bool Pending; |
| 266 | }Cl1RcReqRxOnOffInfoQueT; |
| 267 | |
| 268 | |
| 269 | typedef struct |
| 270 | { |
| 271 | Cl1RcReqTypeT RcReqType; |
| 272 | Cl1RcReqTxOnOffT RcReqInfo; |
| 273 | }Cl1RcReqTxOnOffInfoT; |
| 274 | |
| 275 | |
| 276 | typedef struct |
| 277 | { |
| 278 | Cl1RcReqTxOnOffInfoT Cl1RcReqTxQ[CL1_RC_REQ_QDEPTH]; |
| 279 | kal_uint8 Ongoing; |
| 280 | kal_bool Pending; |
| 281 | }Cl1RcReqTxOnOffInfoQueT; |
| 282 | |
| 283 | |
| 284 | /*********************************** RcReq internal functions ***********************************/ |
| 285 | void Cl1RcReqInit(void); |
| 286 | void Cl1RcTestDDLStart(void); |
| 287 | |
| 288 | //void Cl1RcReqRxOnParse(Cl1RcReqRxOnT *RxOn, Cl1RcSeqRxParaT *RcSeq); |
| 289 | |
| 290 | //void Cl1RcReqRxOffParse(Cl1RcReqRxOffT *RxOff, Cl1RcSeqRxParaT *RcSeq); |
| 291 | |
| 292 | kal_bool Cl1RcReqRxEnque(Cl1RcReqRxOnOffInfoQueT *InfoQ, Cl1RcReqTypeT RcReqType, Cl1RcReqRxOnOffT *ReqInfo); |
| 293 | |
| 294 | void Cl1RcReqModemDvfsScenSet(SysAirInterfaceT Mode, Cl1RcReqModemDvfsUsrT Usr, Cl1RcdDvfsScenT Scen); |
| 295 | |
| 296 | void Cl1RcReqModemDvfsScenCancel(SysAirInterfaceT Mode, Cl1RcReqModemDvfsUsrT Usr); |
| 297 | |
| 298 | #endif |
| 299 | |