[Feature]Upload Modem source code
Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/protocol/interface/errc/errc_mrs_interface.h b/mcu/protocol/interface/errc/errc_mrs_interface.h
new file mode 100644
index 0000000..baac78e
--- /dev/null
+++ b/mcu/protocol/interface/errc/errc_mrs_interface.h
@@ -0,0 +1,542 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of MediaTek Inc. (C) 2012
+*
+* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+
+/****************************************************************************
+ * Filename:
+ * ---------
+ * errc_mrs_interface.h
+ *
+ * Project:
+ * --------
+ * UMOLY
+ *
+ * Description:
+ * ------------
+ * ERRC MRS interface functions
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ * ==========================================================================
+ * $Log$
+ *
+ * 05 13 2021 mandy.zheng
+ * [MOLY00627894] [Blocking][MT6885][Petrus][TMO-US][MP7 Excluded][q0][Lab IOT][Ericsson-Nokia][VoNR]VoNR PSHO to LTE failed because no B2 MR from UE
+ * R3-interface.
+ *
+ * 07 27 2020 po-yu.huang
+ * [MOLY00545809] [Colgin] Global SKU CA band customization feature - ERRC
+ *
+ * .
+ *
+ * 06 01 2020 yi-han.chung
+ * [MOLY00527121] LGE/FCC requirement for Band 41 AMPR
+ *
+ * ERRC/MRS
+ *
+ * 04 29 2020 plum.tseng
+ * [MOLY00515893] [HCR][MT6875][Margaux][Q0][MP5][R3][SQC][HQ][MTBF][Lab][Ericsson][ErrorTimes:4][ASSERT] file:mcu/protocol/lte_sec/errc/common/src/errc_asn1_wrapper.c line:159
+ *
+ * [VMOLY_R3] UE capability restriction. (and recover enter connected mode)
+ *
+ * 02 07 2020 plum.tseng
+ * [MOLY00496701] [VMOLY][ERRC&NRRC][Capability] Gemini status sync between ERRC&NRRC
+ *
+ * 12 02 2019 yung-chun.chang
+ * [MOLY00462472] [Gen97][95.OPPO patch back to VMOLY]�i�G?�e?���ѡjFast return to 4G should be disabled on UE
+ *
+ * .
+ *
+ * 09 25 2019 mandy.zheng
+ * [MOLY00443402] [Gen97]2019 Jun CR - Clarification on SA fallback BC support
+ *
+ * -[ERRC]LTE SA band combination derived from ENDC support check API.
+ *
+ * 09 23 2019 yung-chun.chang
+ * [MOLY00440687] VMOLY code sync CR
+ *
+ * 1. CA TBL V2 main part
+ * 2. fix rf_param_v1390 not reset problem
+ *
+ * 06 13 2019 plum.tseng
+ * [MOLY00413522] [VMOLY][Code Sync][ERRC][RCM] CA HPUE class B/C clarify
+ *
+ * 04 10 2019 plum.tseng
+ * [MOLY00395173] [Gen97][ERRC][MRA_EAS] Assertion removal
+ *
+ * and remove some internal info from interface file.
+ *
+ * 03 28 2019 morton.lin
+ * [MOLY00393767] [MT6297] TS 36.331 2018 December baseline migration
+ * [ERRC][RCM] 2018DEC version upgrading (MPD)
+ *
+ * 03 14 2019 plum.tseng
+ * [MOLY00391178] [MCF][VMOLY][ERRC] custom disable band feature with MCF
+ *
+ * [MCF][COSTOM_DISABLE_BAND][RCM & MRS].
+ *
+ * 12 27 2018 morton.lin
+ * [MOLY00375221] [Gen97][NSA] UE Capability development - Feature Set
+ * [ERRC][RCM] EUTRA Feature Set development
+ *
+ * 12 10 2018 morton.lin
+ * [MOLY00371624] [VMOLY][ERRC] provide API for NRRC to calculate P_compensation for LTE neighbor cells
+ * [ERRC][RCM][MRS] Pcompensation retrieval interface for 5G4 IRCR development
+ *
+ * 08 20 2018 plum.tseng
+ * [MOLY00346737] [ERRC][RCM] B41C HPUE
+ *
+ * [VMOLY] (OA)
+ *
+ * 07 03 2018 yung-chun.chang
+ * [MOLY00334670] [CV5a] block specific LTE bands for particular roaming plmns
+ * rcm/mrs part.
+ *
+ * 03 09 2018 morton.lin
+ * [MOLY00309570] [Gen93/95][UMOLYE][ERRC][RCM] WWLTEDB table movement for better customization
+ * 1. LTEBand and CAComb table movement
+ * 2. Introduce LTEBandExcl
+ * 3. Add new DL only bands: B75 & B76
+ *
+ * 12 11 2017 morton.lin
+ * [MOLY00295077] [Gen93][ERRC][RCM] LTE support band and CA combination customization re-arch
+ * Common IF and MRS part (LR12A.R3.MP) (Not in V-List)
+ *
+ * 11 29 2017 yung-chun.chang
+ * [MOLY00292082]
+ * rcm oa part
+ *
+ * 01 25 2017 menghau.wu
+ * [MOLY00217129] [MT6293] code sync from UMOLY (Phase4)
+ * UMOLY CR : [MOLY00223173] [6292][Gemini][L+L][Merge LR12]
+ * UMOLY CL : 3370203
+ *
+ * 03 09 2016 sabrina.hsu
+ * [MOLY00156230] [6292] ERRC code sync LR11 to UMOLY
+ * merge LR11 CL 1801342 [MOLY00148166]
+ *
+ * 02 17 2016 sabrina.hsu
+ * [MOLY00156230] [6292] ERRC code sync LR11 to UMOLY
+ * mrs/nvram/sbp merge
+ *
+ *
+ ****************************************************************************/
+
+#ifndef _ERRC_MRS_INTERFACE_H_
+#define _ERRC_MRS_INTERFACE_H_
+
+#include "kal_general_types.h"
+#include "mrs_as_enums.h"
+#include "mrs_as_struct.h"
+#include "el1d_rf_public.h"
+#include "custom_eas_config.h"
+#include "errc_nvram_editor.h"
+#include "mrs_eas_capability.h"
+#include "mcd_l3_inc_struct.h" //plmn_id_struct
+
+/****************************************************************************
+ * FUNCTION
+ * errc_ue_eutra_capability_get
+ *
+ * DESCRIPTION
+ * Get the encoded UE-EUTRA-Capability IE as defined in 36.311
+ *
+ * PARAMETERS
+ * @param
+ * MRS_SIM_INDEX sim_index:
+ * SIM Index.
+ * @param
+ * kal_uint8 **pp_ue_eutra_capa:
+ * Address of pointer to the encoded UE-EUTRA-Capability IE.
+ * Function allocates memory for the encoded IE and sets the
+ * pointer (*pp_ue_eutra_capa) to point to it.
+ * Caller is responsible for releasing the memory.
+ * @param
+ * mrs_plmn_id_list *p_plmn_id_list
+ * The list of PLMN Id on which UE camped.
+ * NOTE: The mnc3 should be set to 0x00 or 0x0F if it's not
+ * being used. (i.e. 5 digits PLMN Id)
+ * @param
+ * kal_bool is_disable_gsm
+ * Flag used by other RATs to tell if 2G is disabled or not.
+ *
+ * RETURNS
+ * @return
+ * kal_uint32: Length of the encoded UE-EUTRA-Capability IE in bytes.
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+
+kal_uint32 errc_ue_eutra_capability_get(
+ MRS_SIM_INDEX sim_index, kal_uint8 **pp_ue_eutra_capa, mrs_plmn_id_list *p_plmn_id_list, kal_bool is_disable_gsm);
+
+
+#if (CUR_GEN >= MD_GEN97)
+/**
+ * @brief Function to get UE-EUTRA-Capability for NRRC.
+ * @param[in] SIM index
+ * @param[in] The list of PLMN id of serving cell (on which UE camped). Use NULL
+ * pointer if caller didn't have such a list but bear in mind the
+ * PLMN-specific filtering is not applied then.
+ * @param[in] Indicates that if GSM RAT is disabled or not (by operator requirement)
+ * @param[in] String data of the IE "capabilityRequestFilter" from TS 38.331.
+ * @param[out] The address of the encoded data of UE-EUTRA-Capability, callers
+ * shall release this control buffer by themselves.
+ * @return The data length of encoded UE-EUTRA-Capability.
+ */
+kal_uint32 errc_ue_eutra_capability_get_for_nr(
+ MRS_SIM_INDEX sim_index,
+ mrs_plmn_id_list *p_plmn_id_list,
+ kal_bool is_disable_gsm,
+ mrs_nras_octet_string_struct cap_request_filter,
+ kal_uint8 **pp_ue_eutra_capa,
+ mrs_gemini_status_enum gemini_status,
+ kal_bool is_restriction_size_valid,
+ kal_uint32 restriction_size);
+
+/*****************************************************************************
+ * FUNCTION
+ * errc_is_mrdc_lte_standalone_band_combination_supported
+ *
+ * DESCRIPTION
+ * This function is used to check whether the LTE standalone band-combination
+ * derived from a given MR-DC band combination is supported.
+ *
+ * PARAMETERS
+ * @param
+ * MRS_SIM_INDEX sim_index:
+ * SIM index if Gemini applied.
+ *
+ * mrs_plmn_id_list *p_plmn_id_list:
+ * The list of PLMN id of serving cell (on which UE camped). Use NULL
+ * pointer if caller didn't have such a list but bear in mind the
+ * PLMN-specific filtering is not applied then.
+ * NOTE: The mnc3 should be set to 0x00 or 0x0F if it's not being used.
+ * (i.e. 5 digits PLMN Id)
+ *
+ * mrs_eas_mrdc_lte_standalone_bc_list *p_band_comb_list:
+ * User should send the LTE SA band combination part, and function will fill
+ * the support status of the band combination.
+ *
+ *
+ *
+ *****************************************************************************/
+void errc_is_mrdc_lte_standalone_band_combination_supported(
+ MRS_SIM_INDEX sim_index,
+ mrs_plmn_id_list *p_plmn_id_list,
+ mrs_eas_mrdc_lte_standalone_bc_list *p_band_comb_list);
+
+#endif /* (CUR_GEN >= MD_GEN97) */
+
+
+/****************************************************************************
+ * FUNCTION
+ * errc_rcm_any_get_ue_category
+ *
+ * DESCRIPTION
+ * Get the LTE UE category
+ *
+ * PARAMETERS
+ * @param
+ * void
+ * RETURNS
+ * @return
+ * kal_uint8: LTE UE categoty defined by ERRC RCM
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+kal_uint8 errc_rcm_any_get_ue_category(void);
+
+
+/****************************************************************************
+ * FUNCTION
+ * errc_rcm_get_lte_support_band_from_table
+ *
+ * DESCRIPTION
+ * Get the LTE Support Band from table
+ *
+ * PARAMETERS
+ * @param
+ * [in] SIM index
+ * [in] PLMN Id (MNC part will be skipped)
+ * [out] Pointer to an array which can hold 32 elements each contains
+ * kal_uint8 bitmask. The LSB in byte 0 is the Band 1.
+ * Bit '1': supported ; Bit '0': not supported
+ * [in] which table: can choose Capability size table/CA selection table
+ * [in] plmn num for source table
+ * RETURNS
+ * @return
+ * kal_bool: TRUE if valid support band bitmask got successfully, and
+ * the content of p_lte_band_bitmask is the result.
+ * FALSE if no valid support band information got.
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+
+kal_bool errc_rcm_get_lte_support_band_from_table(
+ const MRS_SIM_INDEX sim_idx,
+ const mrs_plmn_id *p_plmn_id,
+ kal_uint8 *p_lte_band_bitmask,
+ const eas_global_support_band_struct *src_table,
+ kal_uint32 src_table_plmn_num);
+
+/****************************************************************************
+ * FUNCTION
+ * errc_rcm_get_lte_support_band_for_plmn_list
+ *
+ * DESCRIPTION
+ * Get the World Wide LTE Support Band by Public Land Mobile Network
+ * Identity list
+ *
+ * PARAMETERS
+ * @param
+ * [in] SIM index
+ * [in] PLMN Id List
+ * [out] Pointer to an array which can hold 32 elements each contains
+ * kal_uint8 bitmask. The LSB in byte 0 is the Band 1.
+ * Bit '1': supported ; Bit '0': not supported
+ * [in] whether support requestFrequencyband(NW+UE)
+ * RETURNS
+ * @return
+ * kal_bool: TRUE if valid support band bitmask got successfully, and
+ * the content of p_lte_band_bitmask is the result.
+ * FALSE if no valid support band information got.
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+kal_bool errc_rcm_get_lte_support_band_for_plmn_list(
+ const MRS_SIM_INDEX sim_idx,
+ const mrs_plmn_id_list *p_plmn_id_list,
+ kal_uint8 *p_lte_band_bitmask,
+ kal_bool is_requestfreband);
+
+/****************************************************************************
+ * FUNCTION
+ * errc_rcm_get_custom_disable_band_list
+ *
+ * DESCRIPTION
+ * Get the custom disable band list setting by nvram
+ *
+ * PARAMETERS
+ * @param
+ * [in] SIM index
+ * [out] p_positive_disable_band_list
+ * [out] p_inverted_disable_band_list
+ * RETURNS
+ * @return
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+void errc_rcm_get_custom_disable_band_list(
+ const MRS_SIM_INDEX sim_idx,
+ nvram_errc_custom_disable_band_positive_struct *p_positive_disable_band_list,
+ nvram_errc_custom_disable_band_inverted_struct *p_inverted_disable_band_list);
+
+/****************************************************************************
+ * FUNCTION
+ * errc_rcm_check_special_plmn_excluded
+ *
+ * DESCRIPTION
+ * Check if the input PLMN List contains any special PLMN which is set to
+ * be excluded from being filtered by global LTE support band table.
+ *
+ * PARAMETERS
+ * @param
+ * [in] SIM index
+ * [in] PLMN Id List
+ *
+ * RETURNS
+ * @return
+ * kal_bool: TRUE if the input PLMN list contains one or more special
+ * PLMN identities.
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+kal_bool errc_rcm_check_special_plmn_excluded(
+ const MRS_SIM_INDEX sim_idx,
+ const mrs_plmn_id_list *p_plmn_id_list);
+
+
+#if defined(__GEMINI_LTE__) && defined(UNIT_TEST) //Gemini Multi LTE UT
+/****************************************************************************
+ * FUNCTION
+ * errc_ut_duplicate_nvram_for_multiSIM
+ *
+ * DESCRIPTION
+ * Function called by MRS_EAS to get ERRC MoDIS ut_duplicate_nvram_multiSIM setting
+ *
+ * PARAMETERS
+ * @param
+ * void
+ * RETURNS
+ * @return
+ * 0: default duplicate NVRAM fro other SIM; 1: no duplicating, setting nvram is invoked by MSC
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+kal_uint8 errc_ut_duplicate_nvram_for_multiSIM(void);
+#endif // defined(__GEMINI_LTE__) && defined(UNIT_TEST)
+
+/****************************************************************************
+ * FUNCTION
+ * errc_is_any_lte_band_exist
+ *
+ * DESCRIPTION
+ *
+ *
+ * PARAMETERS
+ * @param
+ * void
+ * RETURNS
+ *
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+
+kal_bool errc_is_any_lte_band_exist(MRS_SIM_INDEX sim_index, mrs_plmn_id_list *p_plmn_list);
+
+/****************************************************************************
+ * FUNCTION
+ * errc_com_get_hplmn
+ *
+ * DESCRIPTION
+ * To get hplmn
+ *
+ * PARAMETERS
+ * @param
+ * void
+ * RETURNS
+ * whether get hplmn successfully
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+
+kal_bool errc_com_get_hplmn(plmn_id_struct *plmn_id, MRS_SIM_INDEX sim_idx);
+
+/****************************************************************************
+ * FUNCTION
+ * errc_com_get_splmn
+ *
+ * DESCRIPTION
+ * To get splmn
+ *
+ * PARAMETERS
+ * @param
+ * void
+ * RETURNS
+ * whether get splmn successfully
+ *
+ * GLOBALS AFFECTED
+ ****************************************************************************/
+
+kal_bool errc_com_get_splmn(plmn_id_struct *plmn_id, MRS_SIM_INDEX sim_idx);
+
+#ifdef __NR_RAT__
+/****************************************************************************
+ * FUNCTION
+ * errc_calculate_p_compensation
+ *
+ * DESCRIPTION
+ * calculate p_compensation for NRRC
+ *
+ * PARAMETERS
+ * @param
+ * sim_idx
+ * target_earfcn
+ * p_max
+ * *p_multi_band_list
+ * RETURNS
+ * @return
+ * Pcompensation
+ ****************************************************************************/
+kal_int8 errc_calculate_p_compensation(
+ MRS_SIM_INDEX sim_idx,
+ EARFCN target_earfcn,
+ kal_int8 p_max,
+ eutra_multibandinfo_list_struct *p_multi_band_list,
+ const plmn_id_struct *p_plmn_id);
+#endif /* __NR_RAT__ */
+
+#ifdef __NVM_GLOBAL_CABC__
+/****************************************************************************
+ * FUNCTION
+ * errc_rcm_chk_nvram_global_band_ca_custom
+ *
+ * DESCRIPTION
+ * API for checking if Global Band CA custom actiavted
+ *
+ * PARAMETERS
+ * @param
+ * [in] p_plmn_id_list
+ * RETURNS
+ * @return
+ * TRUE means Global Band CA Custom actiavted
+ ****************************************************************************/
+kal_bool errc_rcm_chk_is_global_band_ca_custom(const mrs_plmn_id_list *p_plmn_id_list);
+/****************************************************************************
+ * FUNCTION
+ * errc_rcm_get_lte_band_from_nvram_global
+ *
+ * DESCRIPTION
+ * API for geting LTE support band by filtering of Global Band CA Custom
+ *
+ * PARAMETERS
+ * @param
+ * [in] p_plmn_id_list
+ * [out] p_lte_band_bitmask
+ * RETURNS
+ * @return
+ * void
+ ****************************************************************************/
+void errc_rcm_get_lte_band_from_nvram_global(mrs_plmn_id_list *p_plmn_id_list, kal_uint8 *p_lte_band_bitmask);
+#endif
+
+/****************************************************************************
+ * FUNCTION
+ * errc_check_eutra_capability_supported
+ *
+ * DESCRIPTION
+ * API for checking eutra capability support status
+ *
+ * PARAMETERS
+ * @param
+ * [in] eutra feature
+ * RETURNS
+ * @return
+ * TRUE means the feature is supported
+ ****************************************************************************/
+kal_bool errc_check_eutra_capability_supported(eas_cap_feature_enum feature);
+#endif /* _ERRC_MRS_INTERFACE_H_ */