rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [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) 2005 |
| 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 | * Filename: |
| 38 | * -------------------------------------------------------- |
| 39 | * ratdm_shaq_api.h |
| 40 | * |
| 41 | * Project: |
| 42 | * -------------------------------------------------------- |
| 43 | * |
| 44 | * |
| 45 | * Description: |
| 46 | * -------------------------------------------------------- |
| 47 | * |
| 48 | * |
| 49 | * Author: |
| 50 | * -------------------------------------------------------- |
| 51 | * ------- |
| 52 | * |
| 53 | * -------------------------------------------------------- |
| 54 | * $Log$ |
| 55 | * |
| 56 | * 12 21 2020 vend_mtb_aricent019 |
| 57 | * [MOLY00535131] [MP3 Excluded][Gen97][MT6885][Petrus][TMO-US][F4L][Seattle][3G][NSN][3G_DP] DUT 3G AVG HTTP MS/SS DL worse than REF GS9 in Moderate Location (CN Phone) |
| 58 | * |
| 59 | * 07 22 2020 vend_mtb_mobiveil024 |
| 60 | * [MOLY00535131] [MP3 Excluded][Gen97][MT6885][Petrus][TMO-US][F4L][Seattle][3G][NSN][3G_DP] DUT 3G AVG HTTP MS/SS DL worse than REF GS9 in Moderate Location (CN Phone) |
| 61 | * |
| 62 | * . |
| 63 | * |
| 64 | * 04 27 2017 xiaokai.liu |
| 65 | * [MOLY00244013] [Gen93][TDD 3G] RATDM Code SMP |
| 66 | * odify SMP fucntion SHAQ_rlcQueryNormalQueueLeftBits for FDD not ready SMP.. |
| 67 | * |
| 68 | * 04 26 2017 xiaokai.liu |
| 69 | * [MOLY00244013] [Gen93][TDD 3G] RATDM Code SMP |
| 70 | * . |
| 71 | * |
| 72 | * 03 30 2017 ravitej.ballakur |
| 73 | * [MOLY00238716] [Gen93] 6M RATDM Multiple PS feature sync |
| 74 | * M-PS changes for UMOLYA. |
| 75 | * |
| 76 | * 11 15 2016 ravitej.ballakur |
| 77 | * [MOLY00195360] [3G][RATDM][PDCP] - Gen93 3G RATDM and PDCP code modification for new HW and MCU Archi |
| 78 | * Fix for 14_6_6a,14_6_6b UESIM. |
| 79 | * |
| 80 | * 09 26 2016 ravitej.ballakur |
| 81 | * [MOLY00195360] [3G][RATDM][PDCP] - Gen93 3G RATDM and PDCP code modification for new HW and MCU Archi |
| 82 | * Merging 2G and WCDMA RATDM and PDCP changes from merge_CBr. |
| 83 | * |
| 84 | * 08 03 2016 ravitej.ballakur |
| 85 | * [MOLY00195360] [3G][RATDM][PDCP] - Gen93 3G RATDM and PDCP code modification for new HW and MCU Archi |
| 86 | * 3G RATDM and PDCP changes. |
| 87 | * |
| 88 | * 09 01 2015 head.hsu |
| 89 | * [MOLY00136551] [LR11 UT] RATDM UT code refine |
| 90 | * |
| 91 | * 05 20 2015 head.hsu |
| 92 | * [MOLY00089131] [MT6291 Gemini] L+W+W+W code revision check in |
| 93 | * ;RATDM/RABM/PDCP/CSR part check-in |
| 94 | * |
| 95 | * 05 30 2014 yungfu.chen |
| 96 | * [MOLY00067307] [RATDM][SHAQ] API refine for RAB remapping |
| 97 | * |
| 98 | * 05 29 2014 yungfu.chen |
| 99 | * [MOLY00067176] SERVICE REQUEST change design |
| 100 | * |
| 101 | * 04 09 2014 yungfu.chen |
| 102 | * [MOLY00061711] [K2 MD2] Call for Checkin |
| 103 | * |
| 104 | * 01 05 2014 johnson.liu |
| 105 | * [MOLY00052503] [MT6290E2][SGLTE][82LTEv2] [T+G] After a while, Can't ping on the 3G after PS switch back to 3G |
| 106 | * . |
| 107 | * |
| 108 | * 09 26 2013 yungfu.chen |
| 109 | * [MOLY00038877] remove MAX_EXT_PDP_CONTEXT/MAX_INT_PDP_CONTEXT usage of RATDM code |
| 110 | * . |
| 111 | * |
| 112 | * 09 12 2013 andrew.wu |
| 113 | * [MOLY00037580] [RATDM/PDCP]__NDIS_SUPPORT__ related code removal |
| 114 | * __NDIS_SUPPORT__ related code removal |
| 115 | * |
| 116 | * 04 24 2013 johnson.liu |
| 117 | * [MOLY00020653] [TDD][RATDM][PDCP]UT Code Integration and VC Build Warning Remove |
| 118 | * . |
| 119 | * |
| 120 | * 01 23 2013 andrew.wu |
| 121 | * [MOLY00004240] [RABM/PDCP]LTE multimode modification |
| 122 | * Integration change. |
| 123 | * |
| 124 | * 12 07 2012 andrew.wu |
| 125 | * [MOLY00007098] LOCAL_PARA_HDR/PEER_BUF_HDR modification |
| 126 | * LOCAL_PARA_HDR/PEER_BUF_HDR modification |
| 127 | * |
| 128 | * 10 01 2012 andrew.wu |
| 129 | * [MOLY00004236] [interface][service][kal]remove stack_ltlcom.h |
| 130 | * |
| 131 | * Remove stack_ltlcom.h |
| 132 | * |
| 133 | * 08 22 2012 andrew.wu |
| 134 | * [MOLY00002319] [MSBB] Remove Invalid Inter-Category Including. |
| 135 | * modem related option move to modem internal |
| 136 | * |
| 137 | * 08 07 2012 andrew.wu |
| 138 | * [MOLY00001588] [MT6575_ADAPT][LTE-BTR-1-7302] Bad audio qualilty in 12.2Kbps Uplink |
| 139 | * [uas]URLC TM queue switchable modification |
| 140 | * |
| 141 | * 07 05 2012 jl.hsiao |
| 142 | * [MOLY00000288] [RATDM] Removal of kal_internal_api.h |
| 143 | * . |
| 144 | * |
| 145 | * 06 20 2012 carlson.lin |
| 146 | * removed! |
| 147 | * <saved by Perforce> |
| 148 | * |
| 149 | * 06 20 2012 carlson.lin |
| 150 | * removed! |
| 151 | * <saved by Perforce> |
| 152 | * |
| 153 | * 06 19 2012 carlson.lin |
| 154 | * removed! |
| 155 | * decide not to use mutex, decide to use lock IRQ to replace change_priority |
| 156 | * |
| 157 | * |
| 158 | * 06 11 2012 carlson.lin |
| 159 | * removed! |
| 160 | * <saved by Perforce> |
| 161 | * |
| 162 | * 04 24 2012 wcpuser_integrator |
| 163 | * removed! |
| 164 | * . |
| 165 | * |
| 166 | * 03 16 2012 carlson.lin |
| 167 | * removed! |
| 168 | * <saved by Perforce> |
| 169 | * |
| 170 | * 02 01 2012 carlson.lin |
| 171 | * removed! |
| 172 | * <saved by Perforce> |
| 173 | * |
| 174 | * 01 13 2012 carlson.lin |
| 175 | * removed! |
| 176 | * <saved by Perforce> |
| 177 | * |
| 178 | * 01 11 2012 carlson.lin |
| 179 | * removed! |
| 180 | * <saved by Perforce> |
| 181 | * |
| 182 | * 08 12 2011 carlson.lin |
| 183 | * removed! |
| 184 | * <saved by Perforce> |
| 185 | * |
| 186 | * 04 25 2011 carlson.lin |
| 187 | * removed! |
| 188 | * <saved by Perforce> |
| 189 | * |
| 190 | * |
| 191 | ******************************************************************************/ |
| 192 | #ifndef _RATDM_SHAQ_API_H |
| 193 | #define _RATDM_SHAQ_API_H |
| 194 | |
| 195 | #include "ratdm_shaq_application_api.h" |
| 196 | |
| 197 | #ifdef __RATDM_UL_SHAQ__ |
| 198 | #include "kal_general_types.h" |
| 199 | #include "kal_public_defs.h" |
| 200 | #include "mcd_l3_inc_gprs_struct.h" |
| 201 | #include "l3_inc_local.h" |
| 202 | #include "mmi_l3_enums.h" |
| 203 | #include "kal_public_api.h" |
| 204 | #include "ps_ratdm_struct.h" |
| 205 | #include "global_def.h" |
| 206 | #include "flc2_ent_functions.h" |
| 207 | #include "l3_inc_enums.h" |
| 208 | #include "mcd_l3_inc_struct.h" |
| 209 | |
| 210 | #ifdef __GEMINI__ |
| 211 | #include "sim_common_enums.h" |
| 212 | #endif |
| 213 | |
| 214 | #ifdef __DIALUP_GPRS_COUNTER_SUPPORT__ |
| 215 | #include "l4c_ratdm_struct.h" |
| 216 | #endif |
| 217 | |
| 218 | #ifdef __UMTS_RAT__ |
| 219 | #include "uas_common_enums.h" |
| 220 | #endif |
| 221 | |
| 222 | /* MACRO DEFINITION */ |
| 223 | #ifndef __UMTS_RAT__ |
| 224 | #define LAST_EXTENDED_RB_ID (32) //refer to uas_common_enums.h |
| 225 | #endif // ~ #ifndef __UMTS_RAT__ |
| 226 | |
| 227 | //#define __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ // can be turn off |
| 228 | //#define __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ // can be turn off |
| 229 | |
| 230 | #if defined (__SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__) || defined (__SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__) |
| 231 | #define __SHAQ_GUARD_PATTERN_CHECK__ |
| 232 | #endif // ~ #if defined (__SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__) || defined (__SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__) |
| 233 | |
| 234 | #define SHAQ_32BIT_GUARD_PATTERN (0x7D7E7D7E) |
| 235 | #define SHAQ_16BIT_GUARD_PATTERN (0x7D7E) |
| 236 | #define SHAQ_8BIT_GUARD_PATTERN (0x7D) |
| 237 | #define SHAQ_REASONABLE_MAXIMUM_SDU_SIZE MAX_VAL((MAX_L2_EXTERNAL_SDU_SIZE), 1520) |
| 238 | |
| 239 | /* |
| 240 | 3 ways to protest the queue |
| 241 | 1. lock interrupt |
| 242 | kal_uint32 savedIRQMask; |
| 243 | savedIRQMask = SaveAndSetIRQMask(); |
| 244 | RestoreIRQMask(savedIRQMask); |
| 245 | 2. Disable scheduler |
| 246 | 3. change priority to equal to UL2 task |
| 247 | */ |
| 248 | #define M_SHAQ_IN_CRITICAL_ZONE(taskid,orig_prio) |
| 249 | #define M_SHAQ_OUT_CRITICAL_ZONE(taskid,orig_pri) |
| 250 | |
| 251 | |
| 252 | #if 0 |
| 253 | /* under construction !*/ |
| 254 | /* under construction !*/ |
| 255 | /* under construction !*/ |
| 256 | /* under construction !*/ |
| 257 | /* under construction !*/ |
| 258 | /* under construction !*/ |
| 259 | /* under construction !*/ |
| 260 | /* under construction !*/ |
| 261 | #endif // ~ #if 0 |
| 262 | |
| 263 | #if 0 |
| 264 | /* under construction !*/ |
| 265 | /* under construction !*/ |
| 266 | /* under construction !*/ |
| 267 | /* under construction !*/ |
| 268 | /* under construction !*/ |
| 269 | /* under construction !*/ |
| 270 | /* under construction !*/ |
| 271 | #endif // ~ #if 0 |
| 272 | |
| 273 | #define M_SHAQ_IN_CRITICAL_ZONE_USING_LOCK_IRQ() |
| 274 | #define M_SHAQ_OUT_CRITICAL_ZONE_USING_LOCK_IRQ() |
| 275 | |
| 276 | #define M_SHAQ_LOGGER(p) |
| 277 | // TODO: implement |
| 278 | #define M_SHAQ_PRINT(X) |
| 279 | // TODO: implement |
| 280 | #define M_SHAQ_SAP NULL |
| 281 | // TODO: implement? |
| 282 | |
| 283 | #define MAX_CS_TM_Q_NUM (3) |
| 284 | #define MAX_CS_UM_Q_NUM (1) |
| 285 | |
| 286 | #define M_SHAQ_ASSERT(X) ASSERT(X) |
| 287 | #define M_SHAQ_DEBUG_ASSERT(X) ASSERT(X) // TODO: this configuration can be turned off |
| 288 | #define M_SHAQ_MAX_Q_SIZE ((PS_TOT_NSAPI_NUM)+((MAX_CS_TM_Q_NUM)+(MAX_CS_UM_Q_NUM))+(1)) |
| 289 | #define M_SHAQ_MINIMUM_CONTEXT_ID (1) |
| 290 | #define M_SHAQ_MAXIMUM_CONTEXT_ID ((PS_TOT_NSAPI_NUM)+((MAX_CS_TM_Q_NUM)+(MAX_CS_UM_Q_NUM))) |
| 291 | |
| 292 | #define M_MIN_PS_SHAQ_NUMBER (M_SHAQ_MINIMUM_CONTEXT_ID) |
| 293 | #define M_MAX_PS_SHAQ_NUMBER (PS_TOT_NSAPI_NUM) |
| 294 | #define M_MIN_CS_SHAQ_NUMBER ((M_MAX_PS_SHAQ_NUMBER)+(1)) |
| 295 | #define M_MAX_CS_SHAQ_NUMBER (M_SHAQ_MAXIMUM_CONTEXT_ID) |
| 296 | |
| 297 | #define M_MIN_PS_CONTEXT_ID (M_MIN_PS_SHAQ_NUMBER) |
| 298 | #define M_MAX_PS_CONTEXT_ID (M_MAX_PS_SHAQ_NUMBER) |
| 299 | #define M_MIN_CS_CONTEXT_ID (M_MIN_CS_SHAQ_NUMBER) |
| 300 | #define M_MAX_CS_CONTEXT_ID (M_MAX_CS_SHAQ_NUMBER) |
| 301 | |
| 302 | #define M_SHAQ_CS_TM_Q_NUM_1 (M_MIN_CS_CONTEXT_ID) |
| 303 | #define M_SHAQ_CS_TM_Q_NUM_2 ((M_MIN_CS_CONTEXT_ID)+(1)) |
| 304 | #define M_SHAQ_CS_TM_Q_NUM_3 ((M_MIN_CS_CONTEXT_ID)+(2)) |
| 305 | #define M_SHAQ_CS_UM_Q_NUM (M_MAX_CS_CONTEXT_ID) |
| 306 | |
| 307 | #define M_SHAQ_MAX_NUM (MAX_SIM_NUM) |
| 308 | #define GET_SHAQ_IDX(sim) ((sim >= M_SHAQ_MAX_NUM)?0:sim) |
| 309 | |
| 310 | #define M_SHAQ_MAX_NSAPI (15) |
| 311 | #define M_SHAQ_SOCKET_NSAPI_ARRAY_SIZE ((M_SHAQ_MAX_NSAPI)+((MAX_CS_TM_Q_NUM)+(MAX_CS_UM_Q_NUM))+(1)) |
| 312 | #define M_SHAQ_SOCKET_CID_ARRAY_SIZE ((M_SHAQ_MAXIMUM_CONTEXT_ID)+(1)) |
| 313 | #define M_SHAQ_SOCKET_RBID_ARRAY_SIZE ((LAST_EXTENDED_RB_ID)+(1)) |
| 314 | |
| 315 | #define M_SHAQ_FIND_Q_USING_CID(qPtr, cid, shaq_idx) qPtr = &(RATDM_SHAQ[shaq_idx][cid]); |
| 316 | |
| 317 | #define M_SHAQ_PRINT_SHAQ_CONTENT(ap_Queue) SHAQ_int_print_queue(ap_Queue) |
| 318 | #define M_SHAQ_RECORD_SHAQ_IMPORTANT_CONTENT(ap_Queue) SHAQ_int_record_important_queue(ap_Queue) |
| 319 | #define M_SHAQ_PRINT_SHAQ_IMPORTANT_CONTENT(ap_Queue,queue_idx,cid_for_logging) SHAQ_int_print_important_queue(ap_Queue,queue_idx,cid_for_logging) |
| 320 | #if defined (__SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__) || defined (__SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__) |
| 321 | #define M_SHAQ_INIT_Q_GUARD_PATTERN(ap_Queue) SHAQ_int_init_q_guard_pattern(ap_Queue) |
| 322 | #define M_SHAQ_CHECK_Q_GUARD_PATTERN(ap_Queue) SHAQ_int_check_q_guard_pattern(ap_Queue) |
| 323 | #define M_SHAQ_INIT_SOCKET_GUARD_PATTERN() SHAQ_int_init_socket_guard_pattern() |
| 324 | #define M_SHAQ_CHECK_SOCKET_GUARD_PATTERN(sim_interface) SHAQ_int_check_socket_guard_pattern(sim_interface) |
| 325 | #define M_SHAQ_DOUBLE_CHECK_QUEUE_ELEMENT_NUMBERS_CONSISTENCY(ap_Queue) SHAQ_int_double_check_queue_element_numbers_consistency(ap_Queue) |
| 326 | #else |
| 327 | #define M_SHAQ_INIT_Q_GUARD_PATTERN(ap_Queue) |
| 328 | #define M_SHAQ_CHECK_Q_GUARD_PATTERN(ap_Queue) |
| 329 | #define M_SHAQ_INIT_SOCKET_GUARD_PATTERN() |
| 330 | #define M_SHAQ_CHECK_SOCKET_GUARD_PATTERN(sim_interface) |
| 331 | #define M_SHAQ_DOUBLE_CHECK_QUEUE_ELEMENT_NUMBERS_CONSISTENCY(ap_Queue) |
| 332 | #endif // ~ #if defined (__SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__) || defined (__SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__) |
| 333 | |
| 334 | #define SHAQ_psProcessOneCTrackPkt(X,Y) |
| 335 | |
| 336 | #ifdef __RATDM_UT__ |
| 337 | /*#define RATDM_SHAQ_CALL_FLC_FREE(X,Y) kal_brief_trace(TRACE_GROUP_1, RATDM_SHAQ_FAKE_FLC_FREE_IN_UT, X, Y)*/ |
| 338 | #else // #ifdef __RATDM_UT__ |
| 339 | /*#define RATDM_SHAQ_CALL_FLC_FREE(X,Y) flc2_free_peer_buff(X,Y)*/ |
| 340 | #endif // ~ #ifdef __RATDM_UT__ |
| 341 | |
| 342 | #ifdef __MTK_TARGET__ |
| 343 | #define RATDM_GET_BITS(_uc, _s, _w) GET_BITS(_uc, _s, _w) |
| 344 | #else |
| 345 | #define RATDM_GET_BITS(_uc, _s, _w) get_bits(_uc, _s, _w) |
| 346 | #endif |
| 347 | |
| 348 | /* |
| 349 | #define M_SHAQ_ELMT_HEADER \ |
| 350 | PEER_BUFF_HDR \ |
| 351 | SHAQ_qElmtHeader* next_shaqElmt; |
| 352 | */ |
| 353 | |
| 354 | /* memory free function */ |
| 355 | typedef void (*pShaqFuncFree) (kal_uint8*); |
| 356 | |
| 357 | #if 0 |
| 358 | /* under construction !*/ |
| 359 | /* under construction !*/ |
| 360 | /* under construction !*/ |
| 361 | /* under construction !*/ |
| 362 | /* under construction !*/ |
| 363 | /* under construction !*/ |
| 364 | /* under construction !*/ |
| 365 | /* under construction !*/ |
| 366 | /* under construction !*/ |
| 367 | /* under construction !*/ |
| 368 | #endif |
| 369 | |
| 370 | #ifdef __UMTS_RAT__ |
| 371 | /* for CS only */ |
| 372 | typedef struct |
| 373 | { |
| 374 | /* Dont touch this part */ |
| 375 | //M_SHAQ_ELMT_HEADER |
| 376 | PEER_BUFF_HDR |
| 377 | struct SHAQ_qElmtHeader *next_shaqElmt; |
| 378 | |
| 379 | /* Hands off please */ |
| 380 | |
| 381 | kal_uint16 bitLength; |
| 382 | kal_uint16 frame_index; |
| 383 | |
| 384 | ExtendedRbId RBId; |
| 385 | kal_bool queued_enabled; |
| 386 | kal_uint16 dummy; |
| 387 | |
| 388 | } SHAQ_csr_data_req_struct; |
| 389 | #endif //~#ifdef __UMTS_RAT__ |
| 390 | |
| 391 | typedef struct |
| 392 | { |
| 393 | #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 394 | kal_uint32 shareQMinLvlGuardPattern1; |
| 395 | #endif // ~ #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 396 | |
| 397 | /* Main Queue */ |
| 398 | kal_uint32 m_qCount; |
| 399 | kal_uint32 m_qDataQuantity; /* In BITs */ |
| 400 | #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 401 | kal_uint32 shareQMaxLvlGuardPattern1; |
| 402 | #endif // ~ #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 403 | struct SHAQ_qElmtHeader *mp_tail; |
| 404 | #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 405 | kal_uint32 shareQMaxLvlGuardPattern2; |
| 406 | #endif // ~ #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 407 | struct SHAQ_qElmtHeader m_sentinel; |
| 408 | #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 409 | kal_uint32 shareQMaxLvlGuardPattern3; |
| 410 | #endif // ~ #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 411 | |
| 412 | } SHAQ_linkListQEntity; |
| 413 | |
| 414 | #ifdef __RATDM_SHAQ_HAS_PRIORITY_QUEUE__ |
| 415 | typedef enum |
| 416 | { |
| 417 | SHAQ_PRIORITY_QUEUE, |
| 418 | SHAQ_NORMAL_QUEUE, |
| 419 | SHAQ_NUMBER_OF_LINKED_LIST_QUEUE_FOR_A_RB |
| 420 | } SHAQ_LLQUEUE_IDX; |
| 421 | #else // #ifdef __RATDM_SHAQ_HAS_PRIORITY_QUEUE__ |
| 422 | typedef enum |
| 423 | { |
| 424 | SHAQ_NORMAL_QUEUE, |
| 425 | SHAQ_PRIORITY_QUEUE = SHAQ_NORMAL_QUEUE, |
| 426 | SHAQ_NUMBER_OF_LINKED_LIST_QUEUE_FOR_A_RB |
| 427 | } SHAQ_LLQUEUE_IDX; |
| 428 | #endif // ~ #ifdef __RATDM_SHAQ_HAS_PRIORITY_QUEUE__ |
| 429 | |
| 430 | typedef struct |
| 431 | { |
| 432 | SHAQ_linkListQEntity ll_queue[SHAQ_NUMBER_OF_LINKED_LIST_QUEUE_FOR_A_RB]; |
| 433 | pShaqFuncFree mpf_free; /* free function */ |
| 434 | #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 435 | kal_uint32 shareQMaxLvlGuardPattern4; |
| 436 | #endif // ~ #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 437 | |
| 438 | //kal_uint16 m_cTrackCount; /* the count of current cTrack data (inc: PPP) (dec: PDCP) */ |
| 439 | // #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 440 | // kal_uint16 shareQMaxLvlGuardPattern5; |
| 441 | // #endif // ~ #ifdef __SHAQ_MAXIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 442 | |
| 443 | kal_bool m_isShaqInitiated; /* Used to identify if Q is ready, for RLC to know if it need to check this Q or not */ |
| 444 | |
| 445 | #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 446 | kal_uint8 shareQMinLvlGuardPattern2; |
| 447 | #endif // ~ #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 448 | |
| 449 | } SHAQ_qEntity; |
| 450 | |
| 451 | typedef struct rb_nsapi_cid_mapping_arrays_struct |
| 452 | { |
| 453 | #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 454 | kal_uint8 socketMinLvlGuardPattern11; |
| 455 | #endif // ~ #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 456 | kal_uint8 CID_nsapi_map[M_SHAQ_SOCKET_CID_ARRAY_SIZE]; |
| 457 | #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 458 | kal_uint8 socketMinLvlGuardPattern12; |
| 459 | #endif // ~ #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 460 | kal_uint8 nsapi_CID_map[M_SHAQ_SOCKET_NSAPI_ARRAY_SIZE]; |
| 461 | #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 462 | kal_uint8 socketMinLvlGuardPattern13; |
| 463 | #endif // ~ #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 464 | kal_uint8 RBId_nsapi_map[M_SHAQ_SOCKET_RBID_ARRAY_SIZE]; |
| 465 | #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 466 | kal_uint8 socketMinLvlGuardPattern14; |
| 467 | #endif // ~ #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 468 | kal_uint8 nsapi_RBId_map[M_SHAQ_SOCKET_NSAPI_ARRAY_SIZE]; |
| 469 | #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 470 | kal_uint8 socketMinLvlGuardPattern15; |
| 471 | #endif // ~ #ifdef __SHAQ_MINIMUM_LEVEL_GUARD_PATTERN_CHECK__ |
| 472 | kal_bool RBId_already_occupied_by_lbm[M_SHAQ_SOCKET_RBID_ARRAY_SIZE]; // this is to remember if certain RB is occupied by LBM |
| 473 | kal_uint8 RBId_RabId_lbm[M_SHAQ_SOCKET_RBID_ARRAY_SIZE]; //used for getting the SIT index |
| 474 | #ifdef __MTK_TARGET__ |
| 475 | kal_bool nsapi_RBId_plmn_map[M_SHAQ_SOCKET_NSAPI_ARRAY_SIZE]; |
| 476 | #endif |
| 477 | } rb_nsapi_cid_mapping_arrays_struct; |
| 478 | |
| 479 | typedef struct ratdm_shaq_trace_data_for_a_llq{ |
| 480 | kal_uint32 m_qCount; |
| 481 | kal_uint32 m_qDataQuantity; /* In BITs */ |
| 482 | } ratdm_shaq_trace_data_for_a_llq; |
| 483 | |
| 484 | typedef struct ratdm_shaq_trace_data_temp_buffer{ |
| 485 | SHAQ_qEntity *ap_Queue; |
| 486 | SHAQ_qElmtHeader *ap_qElmt; |
| 487 | ratdm_shaq_trace_data_for_a_llq llq_trace_info[SHAQ_NUMBER_OF_LINKED_LIST_QUEUE_FOR_A_RB]; |
| 488 | kal_uint16 ip_id; |
| 489 | SHAQ_LLQUEUE_IDX queue_idx; |
| 490 | } ratdm_shaq_trace_data_temp_buffer; |
| 491 | |
| 492 | typedef struct ratdm_shaq_print_ps_q_element_struct |
| 493 | { |
| 494 | LOCAL_PARA_HDR |
| 495 | |
| 496 | ratdm_ps_data_req_struct ps_data_req; |
| 497 | } ratdm_shaq_print_ps_q_element_struct; |
| 498 | |
| 499 | #ifdef __UMTS_RAT__ |
| 500 | typedef struct { |
| 501 | LOCAL_PARA_HDR |
| 502 | |
| 503 | SHAQ_csr_data_req_struct csr_data_req; |
| 504 | } ratdm_shaq_print_cs_q_element_struct; |
| 505 | #endif // ~ #ifdef __UMTS_RAT__ |
| 506 | |
| 507 | /* Structure */ |
| 508 | // IPv4 Header |
| 509 | #define RATDM_IPV4_UPPER_LAYER_PROTOCOL_OFFSET (9) |
| 510 | #define RATDM_IPV4_UPPER_LAYER_PROTOCOL_TCP (6) |
| 511 | #define RATDM_IPV4_UPPER_LAYER_PROTOCOL_UDP (17) |
| 512 | #define RATDM_TCP_ACK_POSITION_OFFSET (13) |
| 513 | // IPv6 Header |
| 514 | #define RATDM_IPV6_FIRST_NEXT_HEADER_OFFSET (6) |
| 515 | #define RATDM_IPV6_NEXT_HEADER_TCP (6) |
| 516 | #define RATDM_IPV6_NO_EXT_HDR_HEADER_LENGTH (40) |
| 517 | // Judge TCP ACK |
| 518 | #define REASONABLE_TCP_ACK_PKT_SIZE (60) |
| 519 | |
| 520 | #ifdef __RATDM_UT__ |
| 521 | #define NEED_TO_BE_CHECKED_PKT_SIZE (99) |
| 522 | #else // #ifdef __RATDM_UT__ |
| 523 | #define NEED_TO_BE_CHECKED_PKT_SIZE ((REASONABLE_TCP_ACK_PKT_SIZE)+(16)) // 16 is a RD decided buffer value and can be adjusted based on observed TCP ACK size distributions |
| 524 | #endif // ~ #ifdef __RATDM_UT__ |
| 525 | |
| 526 | #define SHAQ_psFillRBIdRABIdMapping SHAQ_psFillRBIdNsapiMapping |
| 527 | #define SHAQ_psEraseRBIdRABIdMapping SHAQ_psEraseRBIdNsapiMapping |
| 528 | |
| 529 | #ifdef __UMTS_RAT__ |
| 530 | #ifdef UNIT_TEST |
| 531 | #define SHAQ_RLC_UT_CreateRB SHAQ_LBM_CreateRB |
| 532 | #define SHAQ_RLC_UT_ReleaseRB SHAQ_LBM_ReleaseRB |
| 533 | #endif |
| 534 | #endif // ~ #ifdef __UMTS_RAT__ |
| 535 | |
| 536 | #define SHAQ_dequeue_normal_queue(RB, LEFT_BITS, sim_interface) SHAQ_dequeue_diff_priority_queue(RB, LEFT_BITS, SHAQ_NORMAL_QUEUE, sim_interface) |
| 537 | |
| 538 | #ifdef __RATDM_SHAQ_HAS_PRIORITY_QUEUE__ |
| 539 | #define SHAQ_dequeue_priority_queue(RB, LEFT_BITS, sim_interface) SHAQ_dequeue_diff_priority_queue(RB, LEFT_BITS, SHAQ_PRIORITY_QUEUE, sim_interface) |
| 540 | #endif |
| 541 | |
| 542 | #ifdef UNIT_TEST |
| 543 | #define SHAQ_pdcp_ut_check_queue_context(RBId, ut_module, sim_interface) SHAQ_pdcp_ut_check_queue_context_with_priority_info(RBId, ut_module, SHAQ_NORMAL_QUEUE, sim_interface) |
| 544 | #endif |
| 545 | |
| 546 | /* EXPORT FUNCTIONS */ |
| 547 | extern void SHAQ_bootup(void); |
| 548 | extern void SHAQ_psFillCidNsapiMapping(kal_uint8 CID, kal_uint8 nsapi, kal_uint8 sim_interface); |
| 549 | extern void SHAQ_psEraseCidNsapiMapping(kal_uint8 nsapi, kal_uint8 sim_interface); |
| 550 | extern void SHAQ_psFillRBIdNsapiMapping(kal_uint8 RBId, kal_uint8 nsapi, kal_uint8 sim_interface); |
| 551 | extern void SHAQ_psEraseRBIdNsapiMapping(kal_uint8 RBId, kal_uint8 sim_interface); |
| 552 | extern void SHAQ_change_turn_off_priority_queue_setting(kal_bool new_setting, kal_uint8 sim_interface); |
| 553 | |
| 554 | #ifdef __UMTS_RAT__ |
| 555 | extern void SHAQ_mountFreeFunc(kal_uint8 a_cid, pShaqFuncFree apf_free, kal_uint8 sim_interface); |
| 556 | extern pShaqFuncFree SHAQ_queryFreeFunc(ExtendedRbId RbId, kal_uint8 sim_interface); |
| 557 | extern kal_uint8 SHAQ_getCidFromRbid(ExtendedRbId RbId, kal_taskid taskid, kal_uint8 sim_interface); |
| 558 | extern kal_uint8 SHAQ_rlcGetCidFromRbid(ExtendedRbId RbId, kal_uint8 sim_interface); |
| 559 | extern kal_uint32 SHAQ_rlcQueryNormalQueueLeftBits_wt_lock(ExtendedRbId RbId, kal_uint8 sim_interface); |
| 560 | extern kal_uint32 SHAQ_rlcQueryNormalQueueLeftBits(ExtendedRbId RbId, kal_uint8 sim_interface); |
| 561 | extern SHAQ_qEntity *SHAQ_rlcFindQFromCid(kal_uint8 cid, kal_uint8 sim_interface); |
| 562 | extern SHAQ_qElmtHeader *SHAQ_dequeue_diff_priority_queue(kal_uint8 a_txRbId, kal_uint32 *queue_left_bits, SHAQ_LLQUEUE_IDX priority, kal_uint8 sim_interface); |
| 563 | extern SHAQ_retCode SHAQ_psPdcpEnqueue(ExtendedRbId RbId, SHAQ_qElmtHeader *pPeer, kal_taskid taskid, kal_uint8 sim_interface); |
| 564 | extern SHAQ_retCode SHAQ_csCsrEnqueue(kal_uint8 a_cid, SHAQ_qElmtHeader *ap_data, kal_uint8 sim_interface); |
| 565 | extern void SHAQ_csRBestablished(kal_uint8 CID, kal_uint8 RBId, kal_uint8 sim_interface); |
| 566 | extern void SHAQ_csRBreleased(kal_uint8 RBId, kal_uint8 sim_interface); |
| 567 | extern kal_uint8 SHAQ_LBM_CreateRB(kal_uint8 RBId, kal_uint8 sim_interface); |
| 568 | extern kal_bool SHAQ_LBM_ReleaseRB(kal_uint8 RBId, kal_uint8 sim_interface); |
| 569 | extern kal_uint16 SHAQ_get_activated_RAB_status(kal_uint8 sim_interface); |
| 570 | extern void SHAQ_clearPsKickUL2(ExtendedRbId RbId, kal_uint8 sim_interface); |
| 571 | extern void SHAQ_csKickUL2(module_type source_module, kal_uint8 sim_interface); |
| 572 | extern void SHAQ_psKickUL2(module_type source_module, ExtendedRbId RbId, kal_uint8 sim_interface); |
| 573 | |
| 574 | #ifdef __RATDM_SHAQ_HAS_PRIORITY_QUEUE__ |
| 575 | extern kal_uint32 SHAQ_rlcQueryPriorityQueueLeftBits_wt_lock(ExtendedRbId RbId, kal_uint8 sim_interface); |
| 576 | extern kal_uint32 SHAQ_rlcQueryPriorityQueueLeftBits(ExtendedRbId RbId, kal_uint8 sim_interface); |
| 577 | #endif |
| 578 | |
| 579 | #ifdef UNIT_TEST |
| 580 | extern void SHAQ_RLC_UT_enqueue(SHAQ_qEntity *ap_Queue, struct SHAQ_qElmtHeader *ap_qElmt, SHAQ_LLQUEUE_IDX queue_idx); |
| 581 | extern struct SHAQ_qElmtHeader *SHAQ_RLC_UT_dequeue(SHAQ_qEntity *ap_queue, SHAQ_LLQUEUE_IDX queue_idx); |
| 582 | extern struct SHAQ_qElmtHeader *SHAQ_RLC_UT_dequeue_normal_queue(ExtendedRbId RbId, kal_uint32 *queue_left_bits, kal_uint8 sim_interface); |
| 583 | extern void SHAQ_csr_ut_check_queue_context(kal_uint8 a_cid, module_type ut_module, kal_uint8 sim_interface); |
| 584 | extern void SHAQ_pdcp_ut_check_queue_context_with_priority_info(ExtendedRbId RbId, module_type ut_module, SHAQ_LLQUEUE_IDX priority, kal_uint8 sim_interface); |
| 585 | |
| 586 | #ifdef __RATDM_SHAQ_HAS_PRIORITY_QUEUE__ |
| 587 | extern struct SHAQ_qElmtHeader *SHAQ_RLC_UT_dequeue_priority_queue(ExtendedRbId RbId, kal_uint32 *queue_left_bits, kal_uint8 sim_interface); |
| 588 | #endif // ~ #ifdef __RATDM_SHAQ_HAS_PRIORITY_QUEUE__ |
| 589 | #endif // ~ #ifdef UNIT_TEST |
| 590 | |
| 591 | #ifdef __RATDM_UT__ |
| 592 | extern void SHAQ_fake_free_buff_func(kal_uint8 *pBuffer); |
| 593 | extern void SHAQ_test1(void); |
| 594 | extern void SHAQ_test2(void); |
| 595 | extern void SHAQ_test3(void); |
| 596 | #endif // ~ #ifdef __RATDM_UT__ |
| 597 | #endif // ~ #ifdef __UMTS_RAT__ |
| 598 | #endif // ~ #ifdef __RATDM_UL_SHAQ__ |
| 599 | |
| 600 | #endif /* _RATDM_SHAQ_API_H */ |