blob: 9318790d623c6c39fa090e5038cdb2e2cd7e9ce7 [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) 2007
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 * mrs_utility.h
40 *
41 * Project:
42 * --------------------------------------------------------
43 * Multimode
44 *
45 * Description:
46 * --------------------------------------------------------
47 * Declaration of funcitons of the utilities in MRS.
48 *
49 * Author:
50 * --------------------------------------------------------
51 * -------
52 *
53 * --------------------------------------------------------
54 * $Log$
55 *
rjw2b1408e2022-12-19 11:19:29 +080056 * 11 03 2022 yanfeng.xu
57 * [MOLY00729994] [KPI: EPSFB AFR Lattency][RDIT][ZTE ngRAN][Gemini Benchmark][Case NR_GEMINI_14222_EPSFB_Call_MO_Ping_Idle][Good_Point] Check larger EPSFB AFR Latency
58 *
59 * 09 22 2022 ot_kiran.gunturu
60 * [MOLY00855742] [Moto][Tesla][GCF/PTCRB][ 31.121] [TC10.1.5]
61 *
rjw6c1fd8f2022-11-30 14:33:01 +080062 * 01 28 2022 ot_krishna.charan
63 * [MOLY00685488] cloned from ALPS05677217 [B210622-876][?????]UE CSFB CALL MT???RR???????????????????????????
64 *
65 * 01 18 2022 tom.wu
66 * [MOLY00735828] SBP_MRS_AFR_TO_5G_CONTROL return error
67 *
68 * .
69 *
70 * 10 07 2020 tero.miettinen
71 * [MOLY00570382] [Gen97]Apply BW customization setting from NVRAM to report capability
72 * [MRS] Update in BW setting list handling.
73 *
74 * 10 07 2020 bo-yao.tsai
75 * [MOLY00565738] [MODEM][Assert] Assert fail: errc_cel_cscom.c 6572 - ERRC
76 * - Channel protection fixing
77 *
78 * 10 01 2020 tero.miettinen
79 * [MOLY00560032] ????SA???
80 * MRS - PLMN based 5G band disabling.
81 *
82 * 09 22 2020 vend_mtb_aritha031
83 * [MOLY00561862] [Gen97][MP7][VzW][AFR] feature check-in, (check-in approved: item_344)
84 *
85 * 09 22 2020 vend_mtb_aritha031
86 * [MOLY00561862] [Gen97][MP7][VzW][AFR] feature check-in, (check-in approved: item_344)
87 *
88 * 09 18 2020 vend_mtb_aritha031
89 * [MOLY00561862] [Gen97][MP7][VzW][AFR] feature check-in, (check-in approved: item_344)
90 *
91 * 09 18 2020 tom.wu
92 * [MOLY00554348] [Colgin] cell measure and white cell lock feature development
93 *
94 * .
95 *
96 * 06 29 2020 vend_mtb_aritha002
97 * [MOLY00536615] [MCF] user flow enhancement
98 *
99 * .
100 *
101 * 06 12 2020 vend_mtb_mobiveil015
102 * [MOLY00528344] [URGENT][SSI][MT6885][Petrus][Q0][MP2][AT&T][10776v20_1][R3MP][PTN][simulation][inhouse][RnS][ATTACH/RESTART][LTE-BTR-1-8220]Test case failed due to ## LTE ## RRCConnectionRequest TimeOut
103 *
104 * [MOLY00535086] ?DM?34G??
105 *
106 * .
107 *
108 * 04 04 2020 farming.tseng
109 * [MOLY00509534] [MT6875][Margaux][Q0][MP3][SQC]][Internal][China][Shenzhen][MDST][SWIFT][CU+CT][ErrorTimes:1][ASSERT] file:mcu/l1/nl1/internal/md97/src/rx/nr_rx_scheduler_rtb.c line:6045
110 *
111 * .
112 *
113 * 03 24 2020 farming.tseng
114 * [MOLY00506815] [MT6875][Margaux][Q0][SQC][MP3][Gemini][N+L][NTC_SA_Gemini_0022]Margaux doesn't support SA+L DSDA.
115 *
116 * 01 06 2020 harish.reddy
117 * [MOLY00469528] [Gen97][VMOLY][SA][hVolte] hVolte revise for SA
118 *
119 * 12 09 2019 kun-lin.wu
120 * [MOLY00464345] [Gen97] Gemini MP2/MP3 features phase-in
121 *
122 * 12 09 2019 jutta.liuska
123 * [MOLY00448654] [6297][NRRC] Implementation for VoNR capabilities and enhancements
124 * [MRS] VoNR enhancements
125 *
126 * 12 09 2019 elle.sun
127 * [MOLY00464443] [ERRC][MRS][NL1MOB] move operator table to mrs
128 *
129 * [ERRC/MRS] move oprator table.
130 *
131 * 12 09 2019 vend_mtb_aritha002
132 * [MOLY00458503] [CODE SYNC][MH4P-POS] patch request about ALPS04309026
133 *
134 * Band Configuration to VMOLY
135 *
136 * 12 02 2019 vinayak.bandagi
137 * [MOLY00459945] [Gen97][AFR][RDIT] NAS-SV reset MRS AFR CNTX
138 *
139 * 10 14 2019 prime.xiao
140 * [MOLY00447831] [Rose][Petrus]BSP+][Q0]The ECC call calling 3 mintues and not connected.
141 *
142 * .
143 *
144 * 09 26 2019 kun-lin.wu
145 * [MOLY00443062] [Gemini] SA+L DR-DSDS/DSDA
146 *
147 * 07 18 2019 emily.lu
148 * [MOLY00422928] [Gen97 Patch back][ERRC_CEL] Code Sync to VMOLY
149 *
150 * .merge CL#7709556 (MRS)
151 *
152 * 07 01 2019 jiawei.he
153 * [MOLY00415509] [CODE SYNC][VMOLY][MOLY00370411][MOLY00377605][MOLY00394234][MOLY00397043][MOLY00398281]eCSFB related patch-back from Gen93
154 *
155 * .
156 *
157 * 05 30 2019 kun-lin.wu
158 * [MOLY00402003] [VMOLY] GEMINI N+L DSDS
159 *
160 * 04 30 2019 muneeswaraiah.dama
161 * [MOLY00402590] [Gen97] reset AFR target rat and ongoing status by service
162 * .
163 *
164 * 04 17 2019 puneet.t
165 * [MOLY00399390] [CODE SYNC] [VMOLY][Eiger RD IT][GEMINI & AFR]LAU request has been rejected with cause AS_IN_SUSPEND_MODE and it never camped on 2G.
166 *
167 * GEMINI RDIT code changes in VMOLY TRUNK
168 *
169 * 04 16 2019 otto.liu
170 * [MOLY00399190] [GEN97] GEN95 to GEN97 sync patch
171 *
172 * .
173 *
174 * 02 18 2019 muneeswaraiah.dama
175 * [MOLY00384995] [VMOLY] GEMINI 3.0, AFR, Unify Frequency scan, BGSEARCH
176 * .
177 *
178 * 10 03 2018 muneeswaraiah.dama
179 * [MOLY00356286] [Gen97] background search feature
180 * .
181 *
182 * 05 25 2018 otto.liu
183 * [MOLY00325228] [UMOLYE] Remove NVRAM group header file
184 *
185 * .
186 *
187 * 05 09 2018 amit.sharma
188 * [MOLY00325096] [Gen95][GAS]FAST_IRCR and LG+WG CMCC feature change for I-RAT RESEL to be merged and replaced by STORED SI.
189 * .
190 *
191 * 04 18 2018 morton.lin
192 * [MOLY00320662] [Gen93][P40][UMOLYE] Gionee blacklist feature - MRS
193 * [MRS] Gionee Blacklist feature phase-in
194 *
195 * 01 23 2018 muneeswaraiah.dama
196 * [MOLY00302582] [Gen93][Huawei][CHR] Index 8, Index 9 - header/ interface files
197 * .
198 *
199 * 10 31 2017 amit.sharma
200 * [MOLY00285547] [P170518-04585]airplane mode search network times fail
201 * .
202 *
203 * 07 06 2017 morton.lin
204 * [MOLY00261305] [Gen93] B71 development
205 * MRS and NVRAM phase in
206 *
207 * 04 26 2017 rujing.zhao
208 * [MOLY00243767] [TDD GAS]RACH fail bar cell feature patch back UMOLYA
209 * .
210 *
211 * 04 25 2017 mu.ding
212 * [MOLY00244356] [6293][Gemini][T+W] Phase 2: T+W Changes Check in
213 *
214 * .
215 *
216 * 11 10 2016 vend_mtb_aricent_05
217 * [MOLY00212319] [MT6293] Channel Lock feature porting and enhancement -MRS
218 *
219 * .
220 *
221 * 10 24 2016 menghau.wu
222 * [MOLY00208768] [MT6293] [B66] Band66 porting (ERRC part)
223 * complement of CL 3008555
224 *
225 * 06 24 2016 cookie.chen
226 * [MOLY00185901] UMOLYA errc relevant latest code sync from UMOLY
227 * .
228 *
229 * 12 10 2015 tim.huang
230 * [MOLY00150157] VZ_REQ_LTEDATA_38498 (MT6291 Verizon Jun-2015 baseline)
231 * .
232 *
233 * 10 07 2015 titi.wu
234 * [MOLY00141786] [MT6755][SRLTE][L+C] Support connectivity of C2K on dual SIM
235 * .
236 *
237 * 09 18 2015 ming.lee
238 * [MOLY00140707] [GAS][PLMN search enhancement II] Search info reuse
239 * .
240 *
241 * 08 06 2015 claud.li
242 * [MOLY00125612] [PS1][91plus] core change modification
243 * 1. from l1core_is_test_sim to is_test_sim.
244 * 2. from l1core_query_ps_sim_type to sim_query_type
245 * 3. remove shared variable "l1core_sim_type_info" and "l1core_is_test_sim_info_ready"
246 * 4. remove mrs_update_l1core_SIM_type
247 * 5. from l1core_is_ps_conf_xta_mode() to is_ps_conf_test_xta_mode()
248 * 6. from l1core_query_ps_conf_test_mode() to query_ps_conf_test_mode()
249 * 7. from l1core_query_ps_conf_test_profile_setting() to query_ps_conf_test_profile_setting()
250 * 8. remove shared variable: "l1core_ps_conf_test_xta_mode", "l1core_is_test_mode_info_ready", "l1core_ps_conf_test_profile_setting", "l1core_ps_conf_test_mode"
251 * 9. remove mrs_update_l1core_test_mode()
252 * 10. remove l1core_is_mmdc_mode()
253 *
254 * 08 06 2015 claud.li
255 * [MOLY00125612] [PS1][91plus] core change modification
256 * 1. remove l1core_is_vsim() : could use L4/sim's API: is_vsim_on()
257 * 2. remove l1core_test_mode_consider_sim() : could use L4/sim's API: test_mode_consider_sim()
258 *
259 * 07 14 2015 bruce.li
260 * [MOLY00128246] [eCSFB]LU Reduction Enhancement
261 * Implemented 2 enhancements:
262 * 1. If there is successful call on the black cell, add it to bleach list;
263 * the priority order is: white list > bleach list > gray list > black list;
264 * 2. If the decoded BSIC of white cell or bleach cell does not match the stored,
265 * add it to retry list; the retry list would be tried after white list and
266 * bleach list have been done.
267 *
268 * 06 21 2015 alan.peng
269 * [MOLY00122048] [6795] Request new feature to improve registration time of roaming case
270 * _MRS part.
271 *
272 * 05 29 2015 shin.chen
273 * [MOLY00115617] [6291] Dynamic SIM switch without modem reset
274 * .
275 *
276 * 05 14 2015 henry.lai
277 * [MOLY00113630] [MT6291] Add IS_TEST_SIM and IS_VSIM for l1core
278 * .
279 *
280 * 04 20 2015 shin.chen
281 * [MOLY00087882] [Universal Bin] MRS general developement
282 * .Remove tabs
283 *
284 * 02 16 2015 doug.shih
285 * [MOLY00091463] [MT6291] ERRC RCM/MRS development
286 * MOLY CR Code Sync to UMOLY (OA domain):
287 * [MOLY00079131] AT&T requirement connection reject
288 * [MOLY00083427] [ERRC][MOB] UMTS proximity indication
289 * [MOLY00084324] [ROHC] Modem load with configurable compile options: profile support and context number
290 * [MOLY00084416] [eCSFB]LU Reduction feature
291 * [MOLY00091967] Merge C2K IRAT code (CT specific UE cap SBP setting).
292 *
293 * 01 20 2015 henry.lai
294 * [MOLY00087668] [MT6291][UBIN] Check in ERRC/CEL modifications
295 * .
296 *
297 * 12 15 2014 henry.lai
298 * [MOLY00087668] [MT6291][UBIN] Check in ERRC/CEL modifications
299 * .
300 *
301 * 11 17 2014 shin.chen
302 * [MOLY00081154] [ATT_TMO_DEV] AT&T requirement merge back
303 * .
304 *
305 * 11 14 2014 henry.lai
306 * [MOLY00079072] [MT6291] Change EARFCN from kal_uint16 to kal_uint32 for CEL part
307 * .
308 *
309 * 11 12 2014 cooper.lin
310 * [MOLY00068710] [MT6291_DEV] Sync MOLY to MT6291_DEV
311 * Merge MT6291_DEV code to UMOLY trunk.
312 *
313 * 11 12 2014 henry.lai
314 * [MOLY00079071] [MT6291][U4G] Low Power Modification for CEL Paging
315 * .
316 *
317 * 05 23 2014 adeline.chang
318 * [MOLY00066214] [SBP] 4G background search
319 * .
320 *
321 * 10 29 2013 adeline.chang
322 * [MOLY00042471] [MT6290] CSFB_enhancements inject message extension
323 * .
324 *
325 * 10 21 2013 adeline.chang
326 * [MOLY00042471] [MT6290] CSFB_enhancements inject message extension
327 * .
328 *
329 * 10 18 2013 peng.pan
330 * [MOLY00041595] [MT6290E1][MMDS_DC] MMDC feature patch back to MOLY trunk
331 * MRS support MMDC.
332 *
333 * 08 30 2013 adeline.chang
334 * [MOLY00030187] [MT6290] CSFB Enhancement Implementation for Autonomous Fast Return
335 * [MT6290] CSFB Enhancement Implementation for Autonomous Fast Return - add new MRS API.
336 *
337 * 08 26 2013 adeline.chang
338 * [MOLY00030187] [MT6290] CSFB Enhancement Implementation for Autonomous Fast Return
339 * [MT6290] CSFB Enhancement Implementation for Autonomous Fast Return - add SIM index.
340 *
341 * 07 17 2013 adeline.chang
342 * [MOLY00030187] [MT6290] CSFB Enhancement Implementation for Autonomous Fast Return
343 * .
344 *
345 * 07 17 2013 adeline.chang
346 * [MOLY00030187] [MT6290] CSFB Enhancement Implementation for Autonomous Fast Return
347 * .
348 *
349 * 03 18 2013 justin.li
350 * [MOLY00009222] [GAS][Multi-Mode Development] Merge GAS multi-mode development to MOLY
351 * .
352 *
353 * 02 05 2013 yenchih.yang
354 * [MOLY00009186] [SIBE/USIME/DBME] Multi-Mode CBr merge to MOLY
355 * .
356 *
357 * 01 22 2013 david.niu
358 * [MOLY00009205] [MRS] Code checked-in for MOLY branch
359 * .
360 *
361 *****************************************************************************/
362
363#ifndef _MRS_UTILITY_H
364#define _MRS_UTILITY_H
365
366#include "mrs_as_enums.h"
367#include "mrs_as_struct.h"
368#include "nvram_editor_data_item.h"
369#include "kal_general_types.h"
370#include "ps_em_enum.h"
371#include "sim_common_enums.h"
372#include "global_type.h"
373#include "bitstream.h"
374#include "mrs_as_inter_core_struct.h"
375#include "errc_nvram_editor.h"
376#include "asband_nvram_editor.h"
377#include "ps_inter_core_public.h"
378
379#ifdef __CHR_AB_INFO__
380#include "nbr_public_struct.h"
381#endif /* __CHR_AB_INFO__ */
382
383
384/* GLOBAL VARIABLE DECLARATIONS *********************************************/
385#ifdef UNIT_TEST
386extern kal_bool modis_IT_mode;
387#endif
388
389/* Type Definitions */
390
391#define MD3_INVALID 0x00
392#define SIM1_MD3_VALID 0x01
393#define SIM2_MD3_VALID 0x02
394#define SIM3_MD3_VALID 0x04
395#define SIM4_MD3_VALID 0x08
396#define INVALID_PS_IDX 0xFF
397
398#define SBP_DATA_AFR_TO_4G_FOLLOW_NVRAM 0x01
399#define SBP_DATA_AFR_TO_4G_ENFORCE_ON 0x02
400#define SBP_DATA_AFR_TO_4G_ENFORCE_OFF 0x04
401
402#define SBP_DATA_AFR_TO_5G_FOLLOW_NVRAM 0x01
403#define SBP_DATA_AFR_TO_5G_ENFORCE_ON 0x02
404#define SBP_DATA_AFR_TO_5G_ENFORCE_OFF 0x04
405
406/* PUBLIC FUNCTION PROTOTYPES ***********************************************/
407extern void mrs_send_msg(kal_uint32 dest_mod_id, sap_type sap_id, msg_type msg_id, local_para_struct *local_para_ptr, peer_buff_struct *peer_buff_ptr);
408
409#if defined(__3G_CSG_SUPPORT__) || defined(__LTE_RAT__)
410extern void NPSI_newAcsglFromUSIM(MRS_SIM_INDEX sim_index, kal_uint8 acsglRecNum, kal_uint16 acsglSizePerRec
rjw2b1408e2022-12-19 11:19:29 +0800411 , kal_uint8* acsglData, csg_white_list_update_cause update_cause, kal_bool is_valid, mrs_csg_imsi_info csg_imsi_info);
rjw6c1fd8f2022-11-30 14:33:01 +0800412
413extern void NPSI_newOcsglFromUSIM(MRS_SIM_INDEX sim_index, kal_uint8 ocsglRecNum, kal_uint16 ocsgalSizePerRec
414 , kal_uint8* ocsglData, csg_white_list_update_cause update_cause, kal_bool is_valid);
415
416extern white_list_update_type NPSI_updateCsgWhiteList(MRS_SIM_INDEX sim_index,
417 MRS_RAT_MODE_TYPE rat,
418 csg_update_type_enum csg_update_type,
419 mrs_plmn_id* plmn_id,
420 kal_uint32 csg_id);
421
422extern kal_uint8* NPSI_getEncodedAllowedCsgList(MRS_SIM_INDEX sim_index,
423 kal_uint8* recNum,
424 kal_uint16 *sizePerRec);
425
426extern void NPSI_deleteCSGList(MRS_SIM_INDEX sim_index);
427
428extern kal_uint8 NPSI_getValidCsgPlmn(MRS_SIM_INDEX sim_index,
429 mrs_plmn_id** plmns);
430
431extern csg_type_enum NPSI_checkCsgType(MRS_SIM_INDEX sim_index,
432 mrs_plmn_id *plmn_id,
433 kal_uint32 csg_id);
434
435kal_bool NPSI_isCsgListEmpty(MRS_SIM_INDEX sim_index);
436
437kal_uint16 NPSI_checkCsgNumberPerPlmn(MRS_SIM_INDEX sim_index, mrs_plmn_id *plmn_id);
438
439extern kal_bool mrs_write_next_csg_record_to_USIM(MRS_SIM_INDEX sim_index);
440
441extern void mrs_write_ue_based_csg_to_nvram(MRS_SIM_INDEX sim_index);
442
443
444extern kal_bool mrs_write_csg_to_USIM(MRS_SIM_INDEX sim_index);
445
446extern void mrs_read_ue_based_nv(MRS_SIM_INDEX sim_index);
447
448extern void mrs_csg_read_nvram_cnf_handler(kal_uint8* data, kal_uint16 len);
449
450
451#endif /* #if defined(__CSG_SUPPORT__) || defined(__LTE_RAT__) */
452
453extern kal_bool MRS_occupy_lla(MRS_SIM_INDEX sim_index,
454 MRS_RAT_MODE_TYPE rat,
455 MRS_OCCUPY_PROCEDURE procedure);
456
457extern void MRS_release_lla(MRS_SIM_INDEX sim_index,
458 MRS_RAT_MODE_TYPE rat);
459
460extern kal_bool MRS_test_occupy_lla(MRS_SIM_INDEX sim_index,
461 MRS_OCCUPY_PROCEDURE procedure);
462
463extern MRS_RAT_MODE_TYPE MRS_get_lla_occupy_rat(MRS_SIM_INDEX sim_index);
464
465extern MRS_SIM_INDEX mrs_get_current_sim_index(void);
466
467extern void mrs_afr_reset_afr_list(MRS_SIM_INDEX sim_index);
468
469extern void mrs_afr_insert_freq(MRS_SIM_INDEX sim_index, EARFCN earfcn);
470
471extern void mrs_afr_get_afr_list(MRS_SIM_INDEX sim_index, mrs_afr_main_struct *afr_list_ptr);
472
473void mrs_set_csfb_enhancement_status(MRS_SIM_INDEX sim_index, csfb_enhancement_enum enhancement_item, kal_bool activate);
474
475void mrs_set_csfb_enhancement_status_in_test_mode(MRS_SIM_INDEX sim_index, csfb_enhancement_enum enhancement_item, kal_bool activate);
476
477kal_bool mrs_get_csfb_enhancement_status(MRS_SIM_INDEX sim_index, csfb_enhancement_enum enhancement_item);
478
479extern void mrs_afr_set_csfb_status(MRS_SIM_INDEX sim_index, kal_bool csfb_ongoing);
480
481extern kal_bool mrs_afr_get_csfb_status(MRS_SIM_INDEX sim_index);
482
483extern void mrs_set_background_search_status_in_test_mode(MRS_SIM_INDEX sim_index, background_search_enum background_search_type, kal_bool activate);
484
485extern void mrs_set_latest_camp_on_rat(MRS_SIM_INDEX sim_index, MRS_RAT_MODE_TYPE rat);
486
487extern void mrs_clear_latest_camp_on_rat(MRS_SIM_INDEX sim_index, kal_uint32 rat_bmp);
488
489extern MRS_RAT_MODE_TYPE mrs_get_latest_camp_on_rat(MRS_SIM_INDEX sim_index, kal_uint32 rat_type_bitmask);
490
491extern kal_bool mrs_get_background_search_status(MRS_SIM_INDEX sim_index, background_search_enum background_search_type);
492
493extern void mrs_ecsfb_add_2g_association(MRS_SIM_INDEX sim_index, kal_uint32 eas_cell_id, mrs_gas_cell_inf_struct *p_gas_cell_inf);
494
495extern void mrs_ecsfb_set_2g_association_call_flag(MRS_SIM_INDEX sim_index, kal_uint32 eas_cell_id, mrs_gas_cell_inf_struct *p_gas_cell_inf);
496
497extern kal_uint8 mrs_ecsfb_get_2g_lai(MRS_SIM_INDEX sim_index, kal_uint32 eas_cell_id, mrs_gas_cell_inf_struct *p_gas_cell_inf);
498
499extern kal_uint8 mrs_ecsfb_get_same_lai_2g(MRS_SIM_INDEX sim_index, mrs_lai_struct *lai, kal_uint32 valid_duration, mrs_gas_cell_inf_struct *p_gas_cell);
500
501extern void mrs_ecsfb_reset_association_info(MRS_SIM_INDEX sim_index);
502
503extern void mrs_fast_roaming_set_mcc(MRS_SIM_INDEX sim_index, mrs_nas_mcc_struct *mrs_nas_mcc);
504
505extern void mrs_fast_roaming_get_mcc(MRS_SIM_INDEX sim_index, mrs_as_mcc_struct *mrs_as_mcc_ptr);
506/* used for setting and getting 4G cell id when CSFB to 2G by PLMN search scenario */
507extern void mrs_ecsfb_set_4g_cell_info(MRS_SIM_INDEX sim_index, kal_uint32 eas_cell_id);
508extern kal_uint32 mrs_ecsfb_get_4g_cell_info(MRS_SIM_INDEX sim_index);
509
510extern kal_uint8 mrs_ecsfb_get_cur_2g_cell_association(MRS_SIM_INDEX sim_index, kal_uint32 *eas_cell_id, mrs_gas_cell_inf_struct *gas_cell_inf);
511/* Fast mode switch. */
512extern void mrs_gas_fast_mode_switch_set_status(MRS_SIM_INDEX sim_index, mrs_gas_fast_mode_switch_status_enum status);
513extern kal_bool mrs_gas_fast_mode_switch_check_allowed(MRS_SIM_INDEX sim_index, const kal_uint32 num_plmn, plmn_id_struct* plmn_id_ptr);
514extern void mrs_gas_fast_mode_switch_set_plmn_id(MRS_SIM_INDEX sim_index, plmn_id_struct* plmn);
515extern void mrs_gas_fast_mode_switch_set_arfcn(MRS_SIM_INDEX sim_index, kal_uint16 arfcn);
516extern void mrs_gas_fast_mode_switch_set_bsic(MRS_SIM_INDEX sim_index, kal_uint8 bsic);
517extern kal_uint16 mrs_gas_fast_mode_switch_get_arfcn(MRS_SIM_INDEX sim_index);
518extern kal_uint8 mrs_gas_fast_mode_switch_get_bsic(MRS_SIM_INDEX sim_index);
519extern kal_uint8 mrs_gas_fast_mode_switch_get_si_bitmap(MRS_SIM_INDEX sim_index);
520extern kal_uint8* mrs_gas_fast_mode_switch_get_si_raw_data(MRS_SIM_INDEX sim_index, kal_uint8 si_type);
521extern void mrs_gas_fast_mode_switch_store_essential_si(MRS_SIM_INDEX sim_index, bit_stream* bit_stream_ptr, kal_uint8 si_bitmap_pos);
522extern void mrs_gas_fast_mode_switch_clean_stored_essential_si(MRS_SIM_INDEX sim_index, kal_uint8 si_bitmap_pos);
523/* Fast mode switch. */
524
525/* Support VzW: VZ_REQ_LTEDATA_38498 (MT6291 Verizon Jun-2015 baseline). */
526extern void mrs_nas_set_roaming_status(MRS_SIM_INDEX sim_index, kal_bool is_roaming);
527extern kal_bool mrs_nas_get_roaming_status(MRS_SIM_INDEX sim_index);
528/* Support VzW: VZ_REQ_LTEDATA_38498 (MT6291 Verizon Jun-2015 baseline). */
529
530//#ifdef __LTE_R11__
531void mrs_ltea_son_set_reest_proc_status(MRS_SIM_INDEX sim_index, kal_bool lte_reest_ir_search);
532void mrs_ltea_son_set_selected_cell(MRS_SIM_INDEX sim_index, kal_uint32 selected_arfcn, kal_uint16 selected_pci);
533void mrs_ltea_son_reset_selected_cell(MRS_SIM_INDEX sim_index);
534kal_bool mrs_ltea_son_get_selected_cell(MRS_SIM_INDEX sim_index, kal_uint32 *selected_arfcn_p, kal_uint16 *selected_pci_p);
535//#endif
536
537//L1 call back function
538extern kal_uint8 mrs_l1_query_ps_c2k_sim_config();
539
540/* Common TFO API functions for all RATs */
541void mrs_tfo_cell_list_clear(MRS_SIM_INDEX sim_index, MRS_RAT_MODE_TYPE rat_type);
542
543/* EAS specific TFO API functions */
544void mrs_tfo_cell_list_add_eas_cell(MRS_SIM_INDEX sim_index, EARFCN earfcn, kal_uint16 pci, kal_uint16 validity_time, kal_uint8 offset);
545kal_uint8 mrs_tfo_cell_list_eas_cell_offset_get(MRS_SIM_INDEX sim_index, EARFCN earfcn, kal_uint16 pci);
546
547#ifdef __CHANNEL_LOCK__
548/*******************************************************************************
549Description:
550 This function is used to write channel lock information to MRS.
551
552Parameters:
553 ch_lock_info: Pointer to channel lock information to be stored
554
555Return Value: None
556*******************************************************************************/
557kal_bool mrs_ch_lock_info_set( MRS_SIM_INDEX sim_index, const mrs_ch_lock_info_struct* p_ch_lock_info);
558
559/*******************************************************************************
560Description:
561 This function is used to read channel lock information from MRS.
562
563Parameters:
564 ch_lock_info: Pointer to where channel lock information shall be copied
565
566Return Value: None
567*******************************************************************************/
568void mrs_ch_lock_info_get( MRS_SIM_INDEX sim_index, mrs_ch_lock_info_struct* p_ch_lock_info );
569
570/*******************************************************************************
571Description:
572 This function is used to read channel lock state from MRS.
573
574Parameters: None
575
576Return Value: Channel lock state
577*******************************************************************************/
578MRS_CH_LOCK_STATE mrs_ch_lock_state_get(MRS_SIM_INDEX sim_index);
579
580/*******************************************************************************
581Description:
582 This function is used to read channel lock mode from MRS.
583
584Parameters: None
585
586Return Value: Channel lock mode
587*******************************************************************************/
588kal_uint8 mrs_ch_lock_mode_get(MRS_SIM_INDEX sim_index);
589
590
591#ifdef __WHITE_CELL_LOCK__
592/*******************************************************************************
593Description:
594 This function is used to write white cell lock information to MRS.
595
596Parameters:
597 ch_lock_info: Pointer to channel lock information to be stored
598
599Return Value: kal_bool
600*******************************************************************************/
601kal_bool mrs_wh_cell_lock_info_set(MRS_SIM_INDEX sim_index, const mrs_ch_lock_info_struct* p_ch_lock_info);
602
603/*******************************************************************************
604Description:
605 This function is used to read white cell lock state from MRS.
606
607Parameters: None
608
609Return Value: White cell lock state
610*******************************************************************************/
611kal_uint8 mrs_wh_cell_lock_state_get(MRS_SIM_INDEX sim_index);
612#endif /* __WHITE_CELL_LOCK__ */
613
rjw2b1408e2022-12-19 11:19:29 +0800614/*******************************************************************************
615Description:
616 This function is used to set channel lock scenario in MRS context.
617
618Parameters:
619 ch_lock_scenario: Channel lock scenario to be set in MRS context
620
621Return Value: None
622*******************************************************************************/
623void mrs_ch_lock_set_scenario(MRS_SIM_INDEX sim_index, MRS_CH_LOCK_SCENARIO ch_lock_scenario);
624
625/*******************************************************************************
626Description:
627 This function is used to get channel lock scenario in MRS context.
628
629Return Value: MRS_CH_LOCK_SCENARIO to be returned from MRS context
630*******************************************************************************/
631MRS_CH_LOCK_SCENARIO mrs_ch_lock_get_scenario(MRS_SIM_INDEX sim_index);
rjw6c1fd8f2022-11-30 14:33:01 +0800632#endif /* __CHANNEL_LOCK */
rjw2b1408e2022-12-19 11:19:29 +0800633
rjw6c1fd8f2022-11-30 14:33:01 +0800634/*the following 2 mrs functions are provided for T + W feature*/
635extern void mrs_update_gas_system_mode(MRS_SIM_INDEX sim_index,kal_uint8 system_mode);
636
637#ifdef __GAS_STORED_SI_FEAT__
638void mrs_gas_update_gsm_storedSI_list(MRS_SIM_INDEX sim_index, rrm_gsm_storedSI_struct *gas_candidate_list);
639void mrs_gas_read_gsm_storedSI_list(MRS_SIM_INDEX sim_index, rrm_gsm_storedSI_struct *gas_candidate_list);
640#endif
641extern kal_uint8 mrs_get_gas_system_mode(MRS_SIM_INDEX sim_index);
642
643#ifdef __CHR_AB_INFO__
644//Huawei Index8 requirement: Inidication of reason for Not moving to 4G.
645
646/*******************************************************************************
647Description:
648 This function NAS is used to set nas reason for not moving to LTE.
649
650Parameters: sim_index
651
652Return Value: none
653*******************************************************************************/
654void mrs_set_nas_reason_not_moving_to_lte(MRS_SIM_INDEX sim_index, nas_reason_not_moving_to_lte_enum nas_reason);
655
656/*******************************************************************************
657Description:
658 This function AS is used to set as reason for not moving to LTE.
659
660Parameters: sim_index
661
662Return Value: none
663*******************************************************************************/
664void mrs_set_as_reason_not_moving_to_lte(MRS_SIM_INDEX sim_index, as_reason_not_moving_to_lte_enum as_reason);
665
666
667/*******************************************************************************
668Description:
669 This function L4C is used to get both nas and as reason for not moving to LTE.
670
671Parameters: sim_index
672
673Return Value: If returns KAL_TRUE mean as reason is valid and L4C has to indicate info to AP.
674 If return KAL_FALSE mean CSFB call is ongoing and L4C no need to idicate info to AP.
675 ps_reason: contains both NAS and AS reason for not moving LTE
676*******************************************************************************/
677kal_bool mrs_get_ps_reason_not_moving_to_lte(MRS_SIM_INDEX sim_index, ps_reason_not_moving_to_lte_struct *ps_reason);
678#endif /* __CHR_AB_INFO__ */
679
680MRS_RAT_MODE_TYPE mrs_translate_nvram_rat_mode_to_mrs(const nvram_rat_enum nvm_rat);
681nvram_rat_enum mrs_translate_mrs_rat_mode_to_nvram(const MRS_RAT_MODE_TYPE mrs_rat);
682
683//--------------NR-AFR API's-------------------
684void mrs_afr_nr_init(MRS_SIM_INDEX sim_index);
685
686extern void mrs_afr_clear_all_afr_target_rat(MRS_SIM_INDEX sim_index);
687
688#ifdef __NR_RAT__
689extern void mrs_afr_reset_nr_priority_freq_list_from_lte(MRS_SIM_INDEX sim_index);
690
691extern void mrs_afr_insert_nr_priority_freq_list_from_lte(MRS_SIM_INDEX sim_index, mrs_afr_nr_freq_list_struct *afr_nr_freq_list);
692
693extern void mrs_afr_get_nr_priority_freq_list_from_lte(MRS_SIM_INDEX sim_index, mrs_afr_nr_freq_list_struct *afr_nr_freq_list);
694#endif /* __NR_RAT__ */
695
696extern void mrs_afr_reset_nr_freq_list(MRS_SIM_INDEX sim_index);
697
698extern void mrs_afr_insert_nr_freq_list(MRS_SIM_INDEX sim_index, mrs_afr_nr_freq_list_struct *afr_nr_freq_list);
699
700extern void mrs_afr_get_nr_freq_list(MRS_SIM_INDEX sim_index, mrs_afr_nr_freq_list_struct *afr_nr_freq_list);
701
702extern void mrs_afr_set_nr_serving_freq_info(MRS_SIM_INDEX sim_index, mrs_afr_nr_freq_info_struct nr_freq_info);
703
704extern void mrs_afr_get_nr_serving_freq_info(MRS_SIM_INDEX sim_index, mrs_afr_nr_freq_info_struct *p_nr_freq_info);
705
706void mrs_set_afr_enhancement_status(MRS_SIM_INDEX sim_index, afr_enhancement_enum enhancement_item, kal_bool activate);
707
708void mrs_set_afr_enhancement_status_in_test_mode(MRS_SIM_INDEX sim_index, afr_enhancement_enum enhancement_item, kal_bool activate);
709
710extern kal_bool mrs_get_afr_support_status(MRS_SIM_INDEX sim_index, kal_uint16 bitmask);
711
712kal_bool mrs_get_afr_enhancement_status(MRS_SIM_INDEX sim_index, afr_enhancement_enum enhancement_item);
713
714void mrs_afr_nas_update_service_table_start(MRS_SIM_INDEX sim_index, afr_service_enum service, MRS_RAT_MODE_TYPE target_rat);
715
716void mrs_afr_nas_update_service_table_end(MRS_SIM_INDEX sim_index, afr_service_enum service);
717
718void mrs_afr_reset_table_by_service(MRS_SIM_INDEX sim_index, afr_service_enum service);
719
720void mrs_afr_rat_fallback_triggerred(MRS_SIM_INDEX sim_index, afr_pre_cond_proc_enum procedure);
721
722void mrs_afr_update_by_high_rat(MRS_SIM_INDEX sim_index, MRS_RAT_MODE_TYPE rat);
723
724void mrs_afr_fail_update_by_low_rat(MRS_SIM_INDEX sim_index, MRS_RAT_MODE_TYPE rat);
725
rjw2b1408e2022-12-19 11:19:29 +0800726kal_uint32 mrs_fr_as_determine_fr_rat(MRS_SIM_INDEX sim_index, MRS_RAT_MODE_TYPE rat, kal_bool skip_voice_status);
rjw6c1fd8f2022-11-30 14:33:01 +0800727kal_uint32 mrs_afr_as_determine_afr_rat(MRS_SIM_INDEX sim_index, MRS_RAT_MODE_TYPE rat, kal_bool skip_voice_status);
728
729kal_uint32 mrs_afr_get_afr_to_4g_timer(MRS_SIM_INDEX sim_index);
730void mrs_afr_set_afr_to_4g_timer(MRS_SIM_INDEX sim_index, kal_uint32 afr_to_4g_timer_val);
731
732kal_uint32 mrs_afr_get_afr_to_5g_timer(MRS_SIM_INDEX sim_index);
733void mrs_afr_set_afr_to_5g_timer(MRS_SIM_INDEX sim_index, kal_uint32 afr_to_5g_timer_val);
734
735void mrs_afr_update_strict_constrain_triggered_by_high_rat(MRS_SIM_INDEX sim_index, MRS_RAT_MODE_TYPE high_rat);
736
737kal_bool mrs_afr_get_4g_csfb_status(MRS_SIM_INDEX sim_index);
738kal_bool mrs_afr_get_5g_epsfb_status(MRS_SIM_INDEX sim_index);
739//--------------NR-AFR-------------------
740
741/*******************************************************************************
742Description:
743 This function is used to count RAT change for IRAT PINGPONG detection.
744
745Parameters: sim_index, irat_type
746
747Return Value: none
748*******************************************************************************/
749extern void mrs_set_irat_pingpong_info(MRS_SIM_INDEX sim_index, mrs_irat_pingpong_type_enum irat_type);
750/*******************************************************************************
751Description:
752 This function is used to judge IRAT PINGPONG by count RAT change times during given period.
753
754Parameters: sim_index, irat_type, duration (unit: seconds), threshold (MAX: 8)
755
756Return Value:
757 TRUE: IRAT PINGPONG detected
758 FALSE: there's no PINGPONG or the corresponding SBP is not ON
759*******************************************************************************/
760extern kal_bool mrs_query_irat_pingpong_status(MRS_SIM_INDEX sim_index, mrs_irat_pingpong_type_enum irat_type,kal_uint32 duration, kal_uint8 pingpong_thres);
761
762
763// DR-DSDS/DSDA APIs
764/**
765* @brief This function is used by each RRC to check if the indicated frequency could be searched without gap with peer SIM connection ongoing.
766* @param[in] sim_index
767* @param[in] rat
768* @param[in] band
769* @param[in] arfcn: For RAT_NR, it means NRARFCN. For LTE, it means EARFCN
770* @return KAL_TRUE: if search w/o GAP is supported. KAL_FALSE: if search w/o GAP is not supported
771*/
772kal_bool mrs_is_freq_search_allowed_with_peer_sim_connection (
773 MRS_SIM_INDEX sim_index,
774 MRS_RAT_MODE_TYPE rat,
775 kal_uint16 band,
776 kal_uint32 arfcn
777);
778
779/**
780* @brief This function is if there are more than one SIM card are inserted.
781* @param[in] none
782* @return KAL_TRUE: if more than one SIM card are inserted. KAL_FALSE: if no or only one SIM card is inserted.
783*/
784kal_bool mrs_is_multi_sim_inserted(void);
785
786/**
787* @brief This function is to check whether DSDA is supported.
788* @param[in] p_cell_cc_info: check DSDA support status by p_cell_cc_info and stored peer SIM cell cc info. If p_cell_cc_info is NULL, check DSDA status by all stored cell cc info.
789* @param[in] is_test_rfdb_query: If current SIM need to check gemini_mode by using mrs_gemini_ie_check_cell_cc_config_db
790* @param[in] ps_id: current sim_index. MRS only use this parameter when is_test_rfdb_query is TRUE.
791* @return mrs_gemini_mode_enum: If DSDA support is returned, DR-DSDS is also supported. If DR-DSDS is returned, DSDA is not supported.
792*/
793mrs_gemini_mode_enum mrs_query_support_gemini_mode(mrs_cell_cc_info_struct *p_cell_cc_info, kal_bool is_test_rfdb_query, protocol_id_enum ps_id);
794
795void mrs_set_test_rfdb_to_config_rfdb(protocol_id_enum sim_index);
796
797rat_enum mrs_get_active_rat_for_dr_dsds_dsda(protocol_id_enum ps_id);
798
799protocol_id_enum mrs_get_peer_sim_index_for_dr_dsds_dsda(protocol_id_enum ps_id);
800
801kal_bool mrs_take_channel_protect_sem(protocol_id_enum ps_id, rat_enum rat);
802
803void mrs_give_channel_protect_sem(protocol_id_enum ps_id, rat_enum rat);
804
805/*******************************************************************************
806Description:
807 This function is used to query if a specific feature is turned on.
808 For inter-RAT or cross module features that needs to be triggered by the other modules, this API could be applied.
809
810Parameters:
811 [sim_index] SIM index
812 [feature_enum] The enum value of the querying feature
813
814Return Value:
815 TRUE: feature ON
816 FALSE: feature OFF
817*******************************************************************************/
818kal_bool mrs_get_feature_status_by_sim(MRS_SIM_INDEX sim_index, mrs_feature_enum feature_enum);
819
820/*******************************************************************************
821Description:
822 This function is used to set if a specific feature is turned on.
823 For inter-RAT or cross module features that needs to be executed by the other modules, this API could be applied.
824
825Parameters:
826 [sim_index] SIM index
827 [feature_enum] The enum value of the querying feature
828 [value] The staus we're going to set for this feature (TRUE: ON / FALSE: OFF)
829
830Return Value: void
831*******************************************************************************/
832void mrs_set_feature_status_by_sim(MRS_SIM_INDEX sim_index, mrs_feature_enum feature_enum, kal_bool status);
833
834kal_bool mrs_check_disable_fast_plmn_list(MRS_SIM_INDEX sim_index);
835
836void mrs_l4c_send_capability_update_ind(MRS_SIM_INDEX sim_index);
837void mrs_save_previous_region_to_nvram(void);
838kal_bool mrs_umts_update_detected_band_for_plmn_region(mrs_plmn_id plmn_id, kal_uint32 bandIDBmp);
839kal_bool mrs_gsm_update_detected_band_for_plmn_region(mrs_plmn_id plmn_id, kal_uint8 bandIDBmp);
840kal_bool mrs_lte_update_detected_band_for_plmn_region( mrs_plmn_id plmn_id, kal_uint8 *bandID);
841kal_bool mrs_get_all_the_lte_supported_bands_per_region(mrs_plmn_id plmn_id, kal_uint8 *bandID);
842void mrs_copy_mrs_context_to_nvram(nvram_ef_band_setting_per_region_info_record_struct *pnvram_band);
843kal_bool mrs_get_mcc_region_umts_bands(mrs_plmn_id plmn_id, kal_uint32 *UBandBitmask_FDD);
844kal_bool mrs_get_mcc_region_gsm_bands(mrs_plmn_id plmn_id, kal_uint8 *gsmBandBitmask);
845void mrs_as_band_setting_update_by_plmn( MRS_SIM_INDEX sim_index, function_caller_id_enum caller_id, mrs_plmn_id* hplmn, mrs_plmn_id_list* cplmn);
846
847/*******************************************************************************
848Description:
849 This function is used to get operator ID for the PLMN.
850
851Parameters:
852 [operator_enum] operator id (input)
853 [p_plmn] Pointer to PLMN code (input)
854
855Return Value:
856 TRUE: plmn match operator id
857 FALSE: plmn does not belong to this operator
858
859*******************************************************************************/
860kal_bool mrs_check_if_plmn_match_operator_id(operator_id_enum operator_enum, const plmn_id_struct *p_plmn);
861
862/*******************************************************************************
863Description:
864 This function is used to get operator ID for the PLMN.
865
866Parameters:
867 [p_plmn] Pointer to PLMN code
868
869Return Value: Operator ID
870*******************************************************************************/
871operator_id_enum mrs_get_operator_id_of_plmn(const plmn_id_struct *p_plmn);
872
873/*******************************************************************************
874Description:
875 This function is called during MRS task init, to check for OTA Update
876
877Parameters:
878 None
879
880Return Value: void
881*******************************************************************************/
882extern void mrs_set_ota_update_during_init();
883
884/*******************************************************************************
885Description:
886 This function is used to reset the NVRAM values to through OTA during Init.
887
888Parameters:
889 LID Name and SIZE
890
891Return Value: void
892*******************************************************************************/
893void mrs_update_nvram_with_ota_values(kal_uint16 nvram_id, kal_uint32 size);
894
895/*******************************************************************************
896Description:
897 This function is used to check SBP bit state.
898
899Parameters:
900 [feature] Feature whose SBP bit is checked
901 [sim_index] MRS SIM index
902
903Return Value:
904 KAL_TRUE: if feature is turned on
905 KAL_FALSE: if feature is turned off
906*******************************************************************************/
907kal_bool mrs_sbp_query_md_feature_by_ps(sbp_md_feature_enum feature, MRS_SIM_INDEX sim_index);
908
909/*******************************************************************************
910Description:
911 This function compares two PLMNs.
912
913Parameters:
914 [ms_plmn_id] PLMN ID
915 [bcch_plmn_id] PLMN ID
916
917Return Value:
918 KAL_TRUE: PLMNs are the same
919 KAL_FALSE: PLMNs are different
920*******************************************************************************/
921kal_bool mrs_is_plmn_id_match_with_bcch_plmn_id(const plmn_id_struct *ms_plmn_id, const plmn_id_struct *bcch_plmn_id);
922
923#endif /* _MRS_UTILITY_H */