[Feature][Modem]Update MTK MODEM V1.6 baseline version: MOLY.NR15.R3.MD700.IVT.MP1MR3.MP.V1.6
MTK modem version: MT2735_IVT_MOLY.NR15.R3.MD700.IVT.MP1MR3.MP.V1.6.tar.gz
RF modem version: NA
Change-Id: I45a4c2752fa9d1a618beacd5d40737fb39ab64fb
diff --git a/mcu/interface/service/mcf/mcf_enum.h b/mcu/interface/service/mcf/mcf_enum.h
new file mode 100644
index 0000000..5ff521e
--- /dev/null
+++ b/mcu/interface/service/mcf/mcf_enum.h
@@ -0,0 +1,243 @@
+/*****************************************************************************
+* 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) 2018
+*
+* 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:
+ * ---------
+ * mcf_enum.h
+ *
+ * Project:
+ * --------
+ * UMOLYA
+ *
+ * Description:
+ * ------------
+ * MD Configuration Framework enumeration definition.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *==============================================================================
+ * HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+#ifndef __MCF_ENUM_H
+#define __MCF_ENUM_H
+
+/* Tag type */
+#define MCF_TLVOTA_TAG_OTHER 0
+#define MCF_TLVOTA_TAG_SBPID 1
+#define MCF_TLVOTA_TAG_ICCID 2
+
+/* MCF Tool version, related to file structure */
+typedef enum {
+ MCF_TOOL_VERSION = 3,
+} mcf_tool_version_info;
+
+/* MCF API return code */
+typedef enum _mcf_ota_result_e {
+ MCF_OTA_R_SUCCESS = 0,
+ MCF_OTA_R_MCF_NOT_SUPPORT = 1,
+ MCF_OTA_R_VERSION_NOT_MATCH = 2,
+ MCF_OTA_R_WRONG_BUFFER_SIZE = 3,
+ MCF_OTA_R_INVALID_PARAMETER = 4,
+ MCF_OTA_R_READ_NVRAM_FAIL = 5,
+ MCF_OTA_R_WRITE_NVRAM_FAIL = 6,
+ MCF_OTA_R_READ_OTA_FILE_FAIL = 7,
+ MCF_OTA_R_INVALID_SBP_TAG = 8,
+ MCF_OTA_R_INVALID_FILE = 9,
+ MCF_OTA_R_INVALID_ATTR = 10,
+ MCF_OTA_R_TAKE_READ_LOCK_FAIL = 11,
+ MCF_OTA_R_ALLOCATE_BUFFER_FAIL = 12,
+ MCF_OTA_R_ENCRYPTION_FAIL = 13,
+ MCF_OTA_R_DECRYPTION_FAIL = 14,
+ MCF_OTA_R_CHECKSUM_ERROR = 15,
+ MCF_OTA_R_WRITE_DISK_FAIL = 16,
+ MCF_OTA_R_READ_INI_FILE_FAIL = 17,
+ MCF_OTA_R_INVALID_INI_ITEM = 18,
+ MCF_OTA_R_WRITE_INI_FILE_FAIL = 19,
+ MCF_OTA_R_FILE_NOT_CHANGE = 20,
+ MCF_OTA_R_DIGEST_FAIL = 21,
+
+ MCF_OTA_R_DSBP_FAIL = 50,
+ MCF_OTA_R_FAIL_MCF_DSBP_ONGOING = 51,
+ MCF_OTA_R_MAX,
+} mcf_ota_result_e;
+
+/* MCF report URC type */
+typedef enum _mcf_l4c_report_type_e {
+ MCF_L4C_REPORT_DSBP_RESULT_OF_MCF_DSBP_ACTIVE_MODE = 0,
+ MCF_L4C_REPORT_MCF_DUMP_RESULT = 1,
+ MCF_L4C_REPORT_MCF_DUMP_RESULT_OF_AUTO_SELECT_BIN = 2,
+ MCF_L4C_REPORT_UPDATE_FILE_RESULT = 3,
+ MCF_L4C_REPORT_MAX,
+} mcf_l4c_report_type_e;
+
+/* MCF trigger DSBP return code */
+typedef enum _mcf_trigger_dsbp_result_e {
+ MCF_TRIGGER_DSBP_R_SUCCESS = 0,
+ MCF_TRIGGER_DSBP_R_FAIL_MCF_DSBP_ONGOING = 1,
+ MCF_TRIGGER_DSBP_R_FAIL_SIM_SWITCH_ONGOING = 2,
+ MCF_TRIGGER_DSBP_R_FAIL_ONGOING_CALL_OR_ECBM = 3,
+ MCF_TRIGGER_DSBP_R_FAIL_NO_SIM = 4,
+ MCF_TRIGGER_DSBP_R_FAIL_NOT_MODE2 = 5,
+ MCF_TRIGGER_DSBP_R_FAIL_SIM_ERROR = 6,
+ MCF_TRIGGER_DSBP_R_FAIL_UNKNOWN = 7,
+ MCF_TRIGGER_DSBP_R_FAIL_MAX_DATA_RETRY_TIME = 8,
+ MCF_TRIGGER_DSBP_R_MAX,
+} mcf_trigger_dsbp_result_e;
+
+/* MCF dump related definition */
+#define MCF_DUMP_NTFY_TYPE_OTA 1<<0
+#define MCF_DUMP_NTFY_TYPE_OTA_BY_OP 1<<1
+
+typedef enum _mcf_ota_type_enum {
+ MCF_TYPE_OTA = 0,
+ MCF_TYPE_OTA_BY_OP = 1,
+} mcf_ota_type_enum;
+
+typedef enum _mcf_l4c_report_result_e {
+ MCF_L4C_REPORT_R_SUCCESS = 0,
+ MCF_L4C_REPORT_R_RESET_MD = 1,
+ MCF_L4C_REPORT_R_AP_RETRY = 2,
+ MCF_L4C_REPORT_R_MAX,
+} mcf_l4c_report_result_e ;
+
+typedef enum {
+ MCF_TYPE_INTEGER, // int8/16/32, char
+ MCF_TYPE_STRING, // char *
+ MCF_TYPE_MAX = 0x7FFFFFFF,
+}MCF_TYPE_ENUM;
+
+typedef enum _mcf_utfwk_ota_type_enum {
+ MCF_UTFWK_ATTR_OTA = 0,
+ MCF_UTFWK_ATTR_OTA_BY_OP = 1,
+} mcf_ota_utfwk_type_enum;
+
+typedef enum _mcf_utfwk_ota_input_op_enum {
+ MCF_UTFWK_OTA_FILE_PATH = 0,
+ MCF_UTFWK_OTA_VARIABLE_CONFIG = 1,
+} mcf_utfwk_ota_input_op_enum;
+
+typedef enum _mcf_utfwk_dump_type_enum {
+ MCF_UTFWK_DUMP_LID = 0,
+ MCF_UTFWK_DUMP_ONE_VARIABLE = 1,
+} mcf_utfwk_dump_type_enum;
+
+#endif /* __MCF_ENUM_H */
+
diff --git a/mcu/interface/service/mcf/mcf_if.h b/mcu/interface/service/mcf/mcf_if.h
new file mode 100644
index 0000000..38a38bc
--- /dev/null
+++ b/mcu/interface/service/mcf/mcf_if.h
@@ -0,0 +1,513 @@
+/*****************************************************************************
+* 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) 2018
+*
+* 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:
+ * ---------
+ * mcf_if.h
+ *
+ * Project:
+ * --------
+ * UMOLYA
+ *
+ * Description:
+ * ------------
+ * MD Configuration Framework public interface implementation.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *==============================================================================
+ * HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+#ifndef __MCF_IF_H
+#define __MCF_IF_H
+
+#include "ps_public_struct.h"
+#include "nvram_defs.h"
+#include "nvram_enums.h"
+
+#include "mcf_enum.h"
+#include "mcf_struct.h"
+
+#ifndef GEN_FOR_PC
+
+#ifndef __MCF_SUPPORT__
+#define mcf_on_ilm mcf_dummy_on_ilm
+#define mcf_do_ota_full mcf_dummy_do_ota_full
+#define mcf_do_ota_by_lid mcf_dummy_do_ota_by_lid
+#define mcf_read_ota_buffer mcf_dummy_read_ota_buffer
+#define mcf_read_tlvota_buffer mcf_dummy_read_tlvota_buffer
+#define mcf_read_tlvota_buffer_sbp_tag mcf_dummy_read_tlvota_buffer_sbp_tag
+#define mcf_read_nvram_and_tlvota_buffer_sbp_tag mcf_dummy_read_nvram_and_tlvota_buffer_sbp_tag
+#define mcf_check_lid_need_reset mcf_dummy_check_lid_need_reset
+#define mcf_check_ota_need_reset mcf_dummy_check_ota_need_update
+#define mcf_check_lid_need_reset_by_psid mcf_dummy_check_lid_need_reset_by_psid
+#define mcf_check_reset_and_tlvota_buffer_sbp_tag mcf_dummy_check_reset_and_tlvota_buffer_sbp_tag
+#define mcf_get_tlvota_file_result mcf_dummy_get_tlvota_file_result
+
+static __inline void mcf_dummy_on_ilm(ilm_struct *ilm)
+{
+ return;
+}
+
+static __inline mcf_ota_result_e mcf_dummy_do_ota_full(void)
+{
+ return MCF_OTA_R_MCF_NOT_SUPPORT;
+}
+
+static __inline mcf_ota_result_e mcf_dummy_do_ota_by_lid(nvram_lid_enum lid, kal_uint16 record_idx, kal_uint16 record_amount, nvram_ltable_entry_struct *lid_info)
+{
+ return MCF_OTA_R_MCF_NOT_SUPPORT;
+}
+
+static __inline mcf_ota_result_e mcf_dummy_read_ota_buffer(nvram_lid_enum lid, kal_uint16 record_idx, kal_uint8 *buffer, kal_uint32 size)
+{
+ return MCF_OTA_R_MCF_NOT_SUPPORT;
+}
+
+static __inline mcf_ota_result_e mcf_dummy_read_tlvota_buffer(kal_uint8 ps_id, mcf_tlvota_tag_t tag, nvram_lid_enum lid, kal_uint8 *buffer, kal_uint32 size)
+{
+ return MCF_OTA_R_MCF_NOT_SUPPORT;
+}
+
+static __inline mcf_ota_result_e mcf_dummy_read_tlvota_buffer_sbp_tag(kal_uint8 ps_id, mcf_tlvota_sbp_tag_t sbp_tag, nvram_lid_enum lid, kal_uint8 *buffer, kal_uint32 size)
+{
+ return MCF_OTA_R_MCF_NOT_SUPPORT;
+}
+
+static __inline mcf_ota_result_e mcf_dummy_read_nvram_and_tlvota_buffer_sbp_tag(kal_uint8 ps_id, mcf_tlvota_sbp_tag_t sbp_tag, nvram_lid_enum lid, kal_uint16 record_idx, kal_uint8 *buffer, kal_uint32 size)
+{
+ return MCF_OTA_R_MCF_NOT_SUPPORT;
+}
+
+static __inline kal_bool mcf_dummy_check_lid_need_reset(nvram_lid_enum lid)
+{
+ return KAL_FALSE;
+}
+
+static __inline kal_bool mcf_dummy_check_ota_need_update(protocol_id_enum ps_id, mcf_tlvota_sbp_tag_t sbp_tag, kal_uint8* iccid)
+{
+ return KAL_FALSE;
+}
+
+static __inline kal_bool mcf_dummy_check_lid_need_reset_by_psid(nvram_lid_enum lid, kal_uint8 ps_id)
+{
+ return KAL_FALSE;
+}
+
+static __inline mcf_ota_result_e mcf_dummy_check_reset_and_tlvota_buffer_sbp_tag(kal_uint8 ps_id, mcf_tlvota_sbp_tag_t sbp_tag, nvram_lid_enum lid , kal_uint8 *buffer, kal_uint32 size, kal_uint16 record_idx)
+{
+ return MCF_OTA_R_MCF_NOT_SUPPORT;
+}
+
+static __inline mcf_ota_result_e mcf_dummy_get_tlvota_file_result(protocol_id_enum ps_id)
+{
+ return MCF_OTA_R_MCF_NOT_SUPPORT;
+}
+#else
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_on_ilm
+ * DESCRIPTION
+ * This function is used to process ilm.
+ * PARAMETERS
+ * ilm_struct [IN] ilm structure
+ *****************************************************************************/
+void mcf_on_ilm(ilm_struct *ilm);
+
+/*----------------------------------------------------------------------------------------
+ * OTA fucntions.
+ *--------------------------------------------------------------------------------------*/
+/*****************************************************************************
+ * FUNCTION
+ * mcf_do_ota_full
+ * DESCRIPTION
+ * This function is used to do NVRAM OTA according to whole OTA file.
+ * PARAMETERS
+ *
+ * RETURNS
+ * MCF_OTA_R_SUCCESS : process successfully
+ * MCF_OTA_R_MCF_NOT_SUPPORT : MCF is not supported
+ * MCF_OTA_R_VERSION_NOT_MATCH : LID version of OTA file is different from LID version in device
+ * MCF_OTA_R_WRONG_BUFFER_SIZE : given buffer size is different from LID record size
+ * MCF_OTA_R_INVALID_PARAMETER : invalid parameter
+ * MCF_OTA_R_READ_NVRAM_FAIL : fail to read NVRAM
+ * MCF_OTA_R_WRITE_NVRAM_FAIL : fail to write NVRAM
+ * MCF_OTA_R_READ_OTA_FILE_FAIL : fail to read OTA/TLV_OTA file
+ * MCF_OTA_R_INVALID_SBP_TAG : invalid SBP tag
+ * MCF_OTA_R_INVALID_FILE : invalid OTA/TLV-OTA file
+ * MCF_OTA_R_INVALID_ATTR : invalid NVRAM attribute
+ * MCF_OTA_R_TAKE_READ_LOCK_FAIL : fail to take read lock for OTA/TLV-OTA file
+ *****************************************************************************/
+mcf_ota_result_e mcf_do_ota_full(void);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_do_ota_by_lid
+ * DESCRIPTION
+ * This function is used to do NVRAM OTA according to OTA file and specific LID.
+ * PARAMETERS
+ * lid [IN] NVRAM LID
+ * record_idx [IN] Start record index
+ * record_amount [IN] Record amount
+ * lid_info [IN] LID information
+ *
+ * RETURNS
+ * MCF_OTA_R_SUCCESS : process successfully
+ * MCF_OTA_R_MCF_NOT_SUPPORT : MCF is not supported
+ * MCF_OTA_R_VERSION_NOT_MATCH : LID version of OTA file is different from LID version in device
+ * MCF_OTA_R_WRONG_BUFFER_SIZE : given buffer size is different from LID record size
+ * MCF_OTA_R_INVALID_PARAMETER : invalid parameter
+ * MCF_OTA_R_READ_NVRAM_FAIL : fail to read NVRAM
+ * MCF_OTA_R_WRITE_NVRAM_FAIL : fail to write NVRAM
+ * MCF_OTA_R_READ_OTA_FILE_FAIL : fail to read OTA/TLV_OTA file
+ * MCF_OTA_R_INVALID_SBP_TAG : invalid SBP tag
+ * MCF_OTA_R_INVALID_FILE : invalid OTA/TLV-OTA file
+ * MCF_OTA_R_INVALID_ATTR : invalid NVRAM attribute
+ * MCF_OTA_R_TAKE_READ_LOCK_FAIL : fail to take read lock for OTA/TLV-OTA file
+ *****************************************************************************/
+mcf_ota_result_e mcf_do_ota_by_lid(nvram_lid_enum lid, kal_uint16 record_idx, kal_uint16 record_amount, nvram_ltable_entry_struct *lid_info);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_read_ota_buffer
+ * DESCRIPTION
+ * This function is used to query OTA file and get all data items with given LID.
+ * PARAMETERS
+ * lid [IN] NVRAM LID
+ * record_idx [IN] NVRAM LID record index
+ * buffer [IN] destination buffer
+ * size [IN] buffer size
+ *
+ * RETURNS
+ * MCF_OTA_R_SUCCESS : process successfully
+ * MCF_OTA_R_MCF_NOT_SUPPORT : MCF is not supported
+ * MCF_OTA_R_VERSION_NOT_MATCH : LID version of OTA file is different from LID version in device
+ * MCF_OTA_R_WRONG_BUFFER_SIZE : given buffer size is different from LID record size
+ * MCF_OTA_R_INVALID_PARAMETER : invalid parameter
+ * MCF_OTA_R_READ_NVRAM_FAIL : fail to read NVRAM
+ * MCF_OTA_R_WRITE_NVRAM_FAIL : fail to write NVRAM
+ * MCF_OTA_R_READ_OTA_FILE_FAIL : fail to read OTA/TLV_OTA file
+ * MCF_OTA_R_INVALID_SBP_TAG : invalid SBP tag
+ * MCF_OTA_R_INVALID_FILE : invalid OTA/TLV-OTA file
+ * MCF_OTA_R_INVALID_ATTR : invalid NVRAM attribute
+ * MCF_OTA_R_TAKE_READ_LOCK_FAIL : fail to take read lock for OTA/TLV-OTA file
+ *****************************************************************************/
+mcf_ota_result_e mcf_read_ota_buffer(nvram_lid_enum lid, kal_uint16 record_idx, kal_uint8 *buffer, kal_uint32 size);
+
+/*----------------------------------------------------------------------------------------
+ * OTA by operator (TLV-OTA) fucntions.
+ *--------------------------------------------------------------------------------------*/
+/*****************************************************************************
+ * FUNCTION
+ * mcf_read_tlvota_buffer
+ * DESCRIPTION
+ * This function is used to query TLV-OTA file and get all data items with given LID and tag.
+ * PARAMETERS
+ * tag [IN] ps_id
+ * tag [IN] TLV-OTA tag
+ * lid [IN] NVRAM LID
+ * buffer [IN] destination buffer
+ * size [IN] buffer size
+ *
+ * RETURNS
+ * MCF_OTA_R_SUCCESS : process successfully
+ * MCF_OTA_R_MCF_NOT_SUPPORT : MCF is not supported
+ * MCF_OTA_R_VERSION_NOT_MATCH : LID version of OTA file is different from LID version in device
+ * MCF_OTA_R_WRONG_BUFFER_SIZE : given buffer size is different from LID record size
+ * MCF_OTA_R_INVALID_PARAMETER : invalid parameter
+ * MCF_OTA_R_READ_NVRAM_FAIL : fail to read NVRAM
+ * MCF_OTA_R_WRITE_NVRAM_FAIL : fail to write NVRAM
+ * MCF_OTA_R_READ_OTA_FILE_FAIL : fail to read OTA/TLV_OTA file
+ * MCF_OTA_R_INVALID_SBP_TAG : invalid SBP tag
+ * MCF_OTA_R_INVALID_FILE : invalid OTA/TLV-OTA file
+ * MCF_OTA_R_INVALID_ATTR : invalid NVRAM attribute
+ * MCF_OTA_R_TAKE_READ_LOCK_FAIL : fail to take read lock for OTA/TLV-OTA file
+ *****************************************************************************/
+mcf_ota_result_e mcf_read_tlvota_buffer(kal_uint8 ps_id, mcf_tlvota_tag_t tag, nvram_lid_enum lid, kal_uint8 *buffer, kal_uint32 size);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_read_tlvota_buffer_sbp_tag
+ * DESCRIPTION
+ * This function is used to query TLV-OTA file and get all data items with given LID and SBP tag.
+ * PARAMETERS
+ * tag [IN] ps_id
+ * sbp_tag [IN] SBP information
+ * lid [IN] NVRAM LID
+ * buffer [IN] destination buffer
+ * size [IN] buffer size
+ *
+ * RETURNS
+ * MCF_OTA_R_SUCCESS : process successfully
+ * MCF_OTA_R_MCF_NOT_SUPPORT : MCF is not supported
+ * MCF_OTA_R_VERSION_NOT_MATCH : LID version of OTA file is different from LID version in device
+ * MCF_OTA_R_WRONG_BUFFER_SIZE : given buffer size is different from LID record size
+ * MCF_OTA_R_INVALID_PARAMETER : invalid parameter
+ * MCF_OTA_R_READ_NVRAM_FAIL : fail to read NVRAM
+ * MCF_OTA_R_WRITE_NVRAM_FAIL : fail to write NVRAM
+ * MCF_OTA_R_READ_OTA_FILE_FAIL : fail to read OTA/TLV_OTA file
+ * MCF_OTA_R_INVALID_SBP_TAG : invalid SBP tag
+ * MCF_OTA_R_INVALID_FILE : invalid OTA/TLV-OTA file
+ * MCF_OTA_R_INVALID_ATTR : invalid NVRAM attribute
+ * MCF_OTA_R_TAKE_READ_LOCK_FAIL : fail to take read lock for OTA/TLV-OTA file
+ *****************************************************************************/
+mcf_ota_result_e mcf_read_tlvota_buffer_sbp_tag(kal_uint8 ps_id, mcf_tlvota_sbp_tag_t sbp_tag, nvram_lid_enum lid, kal_uint8 *buffer, kal_uint32 size);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_read_nvram_and_tlvota_buffer_sbp_tag
+ * DESCRIPTION
+ * This function is used to read NVRAM LID, query TLV-OTA file and get all data items with given LID and SBP tag.
+ * PARAMETERS
+ * tag [IN] ps_id
+ * sbp_tag [IN] SBP information
+ * lid [IN] NVRAM LID
+ * record_idx [IN] NVRAM LID record index
+ * buffer [IN] destination buffer
+ * size [IN] buffer size
+ *
+ * RETURNS
+ * MCF_OTA_R_SUCCESS : process successfully
+ * MCF_OTA_R_MCF_NOT_SUPPORT : MCF is not supported
+ * MCF_OTA_R_VERSION_NOT_MATCH : LID version of OTA file is different from LID version in device
+ * MCF_OTA_R_WRONG_BUFFER_SIZE : given buffer size is different from LID record size
+ * MCF_OTA_R_INVALID_PARAMETER : invalid parameter
+ * MCF_OTA_R_READ_NVRAM_FAIL : fail to read NVRAM
+ * MCF_OTA_R_WRITE_NVRAM_FAIL : fail to write NVRAM
+ * MCF_OTA_R_READ_OTA_FILE_FAIL : fail to read OTA/TLV_OTA file
+ * MCF_OTA_R_INVALID_SBP_TAG : invalid SBP tag
+ * MCF_OTA_R_INVALID_FILE : invalid OTA/TLV-OTA file
+ * MCF_OTA_R_INVALID_ATTR : invalid NVRAM attribute
+ * MCF_OTA_R_TAKE_READ_LOCK_FAIL : fail to take read lock for OTA/TLV-OTA file
+ *****************************************************************************/
+mcf_ota_result_e mcf_read_nvram_and_tlvota_buffer_sbp_tag(kal_uint8 ps_id, mcf_tlvota_sbp_tag_t sbp_tag, nvram_lid_enum lid, kal_uint16 record_idx, kal_uint8 *buffer, kal_uint32 size);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_auto_select_tlvota_file
+ * DESCRIPTION
+ * This function is used to read TLV-OTA file according to given sbp information.
+ * PARAMETERS
+ * param_ptr [IN] sbp parameter
+ *
+ * RETURNS
+ * KAL_TRUE : Success
+ * KAL_FALSE : Fail
+ *****************************************************************************/
+kal_bool mcf_auto_select_tlvota_file(sbp_reconfig_custom_param_struct *param_ptr);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_check_lid_need_reset
+ * DESCRIPTION
+ * This function is used to query if LID is needed to be reset. If LID attribute is set to (NVRAM_ATTR_MCF_OTA or NVRAM_ATTR_MCF_OTA_FOR_QUERY)
+ * with NVRAM_ATTR_OTA_RESET and OTA file is updated, it will be stored in modified LID list.
+ * PARAMETERS
+ * param_ptr [IN] lid
+ *
+ * RETURNS
+ * KAL_TRUE : Success
+ * KAL_FALSE : Fail
+ *****************************************************************************/
+kal_bool mcf_check_lid_need_reset(nvram_lid_enum lid);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_check_ota_need_update
+ * DESCRIPTION
+ * This function is used to check OTA file need update when same SIM insert. This detemine whether trigger dsbp.
+ * PARAMETERS
+ * ps_id [IN] protocol ID
+ * sbp_tag [IN] sbp parameter
+ * iccid [IN] iccid
+ *
+ * RETURNS
+ * KAL_TRUE : Success
+ * KAL_FALSE : Fail
+ *****************************************************************************/
+kal_bool mcf_check_ota_need_update(protocol_id_enum ps_id, mcf_tlvota_sbp_tag_t sbp_tag, kal_uint8* iccid);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_set_config_after_dsbp
+ * DESCRIPTION
+ * This is called after dsbp user callback. This function is used to store mcf info into NVRAM.
+ * PARAMETERS
+ * ps_id [IN] protocol ID
+ *
+ *
+ * RETURNS
+ * KAL_TRUE : Success
+ * KAL_FALSE : Fail
+ *****************************************************************************/
+kal_bool mcf_set_config_after_dsbp(protocol_id_enum ps_id);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_check_lid_need_reset_by_psid
+ * DESCRIPTION
+ * This function is used to query if LID is needed to be reset. If LID attribute is set to NVRAM_ATTR_MCF_OTA_BY_OP
+ * with NVRAM_ATTR_OTA_RESET and TLVOTA file is updated, it will be stored in modified LID list.
+ * PARAMETERS
+ * lid [IN] lid
+ * ps_id [IN] protocol id
+ *
+ * RETURNS
+ * KAL_TRUE : Success
+ * KAL_FALSE : Fail
+ *****************************************************************************/
+kal_bool mcf_check_lid_need_reset_by_psid (nvram_lid_enum lid, kal_uint8 ps_id);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_check_reset_and_tlvota_buffer_sbp_tag
+ * DESCRIPTION
+ * This function is used to check LID needed to be reset, and query TLV-OTA file and get all data items with given LID and SBP tag.
+ * PARAMETERS
+ * ps_id [IN] ps_id
+ * sbp_tag [IN] SBP information
+ * lid [IN] NVRAM LID
+ * record_idx [IN] NVRAM LID record index
+ * buffer [IN] destination buffer
+ * size [IN] buffer size
+ * record_idx [IN] NVRAM LID record index
+ *
+ * RETURNS
+ * MCF_OTA_R_SUCCESS : process successfully
+ * MCF_OTA_R_MCF_NOT_SUPPORT : MCF is not supported
+ * MCF_OTA_R_VERSION_NOT_MATCH : LID version of OTA file is different from LID version in device
+ * MCF_OTA_R_WRONG_BUFFER_SIZE : given buffer size is different from LID record size
+ * MCF_OTA_R_INVALID_PARAMETER : invalid parameter
+ * MCF_OTA_R_READ_NVRAM_FAIL : fail to read NVRAM
+ * MCF_OTA_R_WRITE_NVRAM_FAIL : fail to write NVRAM
+ * MCF_OTA_R_READ_OTA_FILE_FAIL : fail to read OTA/TLV_OTA file
+ * MCF_OTA_R_INVALID_SBP_TAG : invalid SBP tag
+ * MCF_OTA_R_INVALID_FILE : invalid OTA/TLV-OTA file
+ * MCF_OTA_R_INVALID_ATTR : invalid NVRAM attribute
+ * MCF_OTA_R_TAKE_READ_LOCK_FAIL : fail to take read lock for OTA/TLV-OTA file
+ *****************************************************************************/
+mcf_ota_result_e mcf_check_reset_and_tlvota_buffer_sbp_tag (kal_uint8 ps_id, mcf_tlvota_sbp_tag_t sbp_tag, nvram_lid_enum lid , kal_uint8 *buffer, kal_uint32 size, kal_uint16 record_idx);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_get_tlvota_file_result
+ * DESCRIPTION
+ * This function is used to check OTA file need update when same SIM insert. This detemine whether trigger dsbp.
+ * PARAMETERS
+ * ps_id [IN] protocol ID
+ *
+ * RETURNS
+ * MCF_OTA_R_SUCCESS : process successfully
+ * MCF_OTA_R_MCF_NOT_SUPPORT : MCF is not supported
+ * MCF_OTA_R_VERSION_NOT_MATCH : LID version of OTA file is different from LID version in device
+ * MCF_OTA_R_WRONG_BUFFER_SIZE : given buffer size is different from LID record size
+ * MCF_OTA_R_INVALID_PARAMETER : invalid parameter
+ * MCF_OTA_R_READ_NVRAM_FAIL : fail to read NVRAM
+ * MCF_OTA_R_WRITE_NVRAM_FAIL : fail to write NVRAM
+ * MCF_OTA_R_READ_OTA_FILE_FAIL : fail to read OTA/TLV_OTA file
+ * MCF_OTA_R_INVALID_SBP_TAG : invalid SBP tag
+ * MCF_OTA_R_INVALID_FILE : invalid OTA/TLV-OTA file
+ * MCF_OTA_R_INVALID_ATTR : invalid NVRAM attribute
+ * MCF_OTA_R_TAKE_READ_LOCK_FAIL : fail to take read lock for OTA/TLV-OTA file
+ *****************************************************************************/
+mcf_ota_result_e mcf_get_tlvota_file_result(protocol_id_enum ps_id);
+
+#endif /* __MCF_SUPPORT__ */
+#endif /* !GEN_FOR_PC */
+#endif /* !__MCF_IF_H */
+
diff --git a/mcu/interface/service/mcf/mcf_struct.h b/mcu/interface/service/mcf/mcf_struct.h
new file mode 100644
index 0000000..7c34eb1
--- /dev/null
+++ b/mcu/interface/service/mcf/mcf_struct.h
@@ -0,0 +1,593 @@
+/*****************************************************************************
+* 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) 2018
+*
+* 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:
+ * ---------
+ * mcf_struct.h
+ *
+ * Project:
+ * --------
+ * UMOLYA
+ *
+ * Description:
+ * ------------
+ * MD Configuration Framework structure definition.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *==============================================================================
+ * HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+#ifndef __MCF_STRUCT_H
+#define __MCF_STRUCT_H
+
+#include "kal_public_defs.h"
+#include "ps_public_enum.h"
+
+#include "mcf_enum.h"
+#include "ps_public_struct.h"
+
+/*------------------------------------------------------------------------------
+ * Constant definition.
+ *----------------------------------------------------------------------------*/
+#define MCF_MAX_OTA_FILE_SIZE (128 * 1024)
+#define MCF_MAX_TLVOTA_FILE_SIZE (192 * 1024)
+#define MCF_MAX_INI_FILE_SIZE (16 * 1024)
+#define MCF_MAX_FILE_SIZE ((MCF_MAX_TLVOTA_FILE_SIZE > MCF_MAX_OTA_FILE_SIZE) ? MCF_MAX_TLVOTA_FILE_SIZE : MCF_MAX_OTA_FILE_SIZE)
+
+#define MCF_MAX_DHL_LOGGING_NUM 1000
+#define MCF_MAX_DHL_LOGGING_LEN 120
+
+#define MCF_FILE_MAX_MD_PATH_LEN 64
+#define MCF_FILE_MAX_AP_PATH_LEN 128
+#define MCF_FILE_MAX_NAME_LEN 128
+#define MCF_FILE_MAX_SW_VERSION_LEN 128
+#define MCF_FILE_MAX_GEN_TIME_LEN 64
+#define MCF_FILE_MAX_TAG_NAME_NUM 128
+#define MCF_FILE_MAX_TOOL_VERSION_LEN 32
+
+#define MCF_SW_VERNO_LEN 128
+#define MCF_SW_BUILD_TIME_LEN 64
+
+#define MCF_MAX_TAG_NUM 50
+#define MCF_MAX_INI_ITEM_LEN 32
+#define MCF_MAX_INI_ITEM_VALUE_LEN 64
+
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+ #define MCF_MAX_MEM_MALLOC_SIZE (2 * MCF_MAX_FILE_SIZE)
+#else
+ #define MCF_MAX_MEM_MALLOC_SIZE 1024
+#endif
+
+#define MCF_BOOT_TRACE_BUFFER_SIZE (1024 * 36) / 4
+
+/* MCF File operation bit mask */
+#define MCF_FILE_OP_NONE 0
+#define MCF_FILE_OP_CHECKSUM 1<<0
+#define MCF_FILE_OP_AES_128 1<<1
+#define MCF_FILE_OP_NOT_RESET_LID 1<<2
+#define MCF_FILE_OP_AES_256 1<<3
+#define MCF_FILE_OP_SHA256_RSA2048 1<<4
+#define MCF_FILE_OP_SHA384_RSA3072 1<<5
+
+/*------------------------------------------------------------------------------
+ * Data structure defintion.
+ *----------------------------------------------------------------------------*/
+#define MCF_DECLARE_OBJECT \
+ kal_int32 ref_count; \
+ kal_int32 reader_cnt; \
+ kal_int32 writer_cnt;
+
+typedef struct _mcf_file_info_t {
+ kal_uint8 path_type;
+ kal_char name[MCF_FILE_MAX_NAME_LEN];
+ kal_char sw_version[MCF_FILE_MAX_SW_VERSION_LEN];
+ kal_uint8 sw_version_len;
+ kal_char gen_time[MCF_FILE_MAX_GEN_TIME_LEN];
+ kal_uint8 gen_time_len;
+ kal_uint64 last_mod_time;
+ kal_uint32 checksum;
+} mcf_file_info_t;
+
+typedef struct _mcf_tlvota_file_t {
+ MCF_DECLARE_OBJECT
+
+ kal_uint8 path_type;
+ kal_uint8 reserved[3];
+ kal_char relative_path_name[MCF_FILE_MAX_NAME_LEN];
+ kal_uint8 buff[MCF_MAX_TLVOTA_FILE_SIZE];
+ kal_uint32 sbp_id;
+ protocol_id_enum ps_id;
+ kal_uint8 mcc[MAX_MCC_STR_LEN];
+ kal_uint8 mnc[MAX_MNC_STR_LEN];
+ kal_uint8 iccid[21];
+ kal_uint64 last_mod_time;
+ mcf_file_info_t last_file;
+ mcf_file_info_t temp_file;
+} mcf_tlvota_file_t;
+
+typedef struct _mcf_ota_file_t {
+ MCF_DECLARE_OBJECT
+
+ kal_uint8 path_type;
+ kal_uint8 reserved[3];
+ kal_char relative_path_name[MCF_FILE_MAX_NAME_LEN];
+ kal_uint8 buff[MCF_MAX_OTA_FILE_SIZE];
+ kal_uint64 last_mod_time;
+} mcf_ota_file_t;
+
+typedef struct _mcf_ini_file_t {
+
+ kal_uint8 path_type;
+ kal_uint8 reserved[3];
+ kal_char relative_path_name[MCF_FILE_MAX_NAME_LEN];
+ kal_uint8 buff[MCF_MAX_INI_FILE_SIZE];
+ kal_uint8 tmp_buff[MCF_MAX_INI_FILE_SIZE];
+ kal_uint64 last_mod_time;
+} mcf_ini_file_t;
+
+typedef struct _mcf_t {
+ kal_uint8 reserved[2];
+ kal_bool is_ignore_dsbp[MAX_SIM_NUM];
+ mcf_tlvota_file_t tlvota_file[MAX_SIM_NUM];
+ mcf_ota_file_t ota_file;
+ mcf_tlvota_file_t general_tlvota_file;
+ mcf_ini_file_t ini_file;
+ kal_int32 dsbp_cnf_cnt;
+ kal_int32 dsbp_ind_cnt;
+ kal_bool dsbp_cnf_ret;
+ kal_bool dsbp_ind_ret;
+ kal_bool is_critical;
+ kal_bool is_dsbp_ongoing[MAX_SIM_NUM];
+ kal_bool general_is_ignore_dsbp;
+} mcf_t;
+
+typedef struct _mcf_common_t {
+ kal_uint32 boot_trace_flag;
+ kal_uint8 reserved[2];
+ kal_uint32 boot_trace_buff[MCF_BOOT_TRACE_BUFFER_SIZE];
+ kal_uint32 *boot_trace_buff_ptr;
+ kal_bool boot_trace_full;
+ kal_bool is_em_on;
+ kal_bool update_tlvota[MAX_SIM_NUM];
+ kal_bool update_general_tlvota[MAX_SIM_NUM];
+ kal_bool is_iccid;
+ kal_uint32 ota_api_duration;
+ mcf_ota_result_e tlvota_result[MAX_SIM_NUM];
+} mcf_common_t;
+
+/*
+ * OTA file of tool related structure
+ */
+typedef struct _mcf_tool_file_info_t {
+ kal_uint16 file_version;
+ kal_uint16 total_len;
+ kal_char file_type[8];
+ kal_uint32 operation_mask;
+ kal_uint16 item_num;
+ kal_uint8 sw_version_len;
+ kal_uint8 gen_time_len;
+ kal_uint32 file_size;
+ kal_uint8 tool_version_len;
+ kal_uint8 reserved[11];
+ kal_uint32 checksum;
+ kal_char buff_start;
+ kal_uint8 reserved_2[3];
+} mcf_tool_file_info_t;
+
+typedef struct _mcf_tool_ota_file_item_t {
+ kal_uint16 total_len;
+ kal_uint16 lid;
+ kal_char lid_version[4];
+ kal_uint16 record_idx;
+ kal_uint16 item_tag_len;
+ kal_uint8 is_bit_op;
+ kal_uint8 reserved[3];
+ union {
+ struct {
+ kal_uint8 len;
+ kal_uint8 value_len;
+ kal_uint8 reserved[2];
+ } bit;
+ struct {
+ kal_uint16 value_len;
+ kal_uint8 reserved[2];
+ } byte;
+ } op;
+ kal_char buff_start;
+ kal_uint8 reserved_2[3];
+} mcf_tool_ota_file_item_t;
+
+typedef struct _mcf_tool_tlvota_file_item_t {
+ kal_uint16 total_len;
+ kal_uint16 lid;
+ kal_char lid_version[4];
+ kal_uint8 tag_type;
+ kal_uint8 tag_len;
+ kal_uint16 item_tag_len;
+ kal_uint8 is_bit_op;
+ kal_uint8 reserved[3];
+ union {
+ struct {
+ kal_uint8 len;
+ kal_uint8 value_len;
+ kal_uint8 reserved[2];
+ } bit;
+ struct {
+ kal_uint16 value_len;
+ kal_uint8 reserved[2];
+ } byte;
+ } op;
+ kal_char buff_start;
+ kal_uint8 reserved_2[3];
+} mcf_tool_tlvota_file_item_t;
+
+/* MCF2.0 file Item*/
+
+typedef struct {
+ kal_uint16 total_len;
+ kal_uint8 reserved[2];
+ kal_uint32 global_id;
+ kal_uint16 record_idx;
+ kal_uint8 reserved_2[2];
+ kal_uint16 array_index_len;
+ kal_uint16 value_len;
+ kal_char buff_start;
+} mcf_tool_gid_ota_file_item_t;
+
+typedef struct {
+ kal_uint16 total_len;
+ kal_uint8 reserved[2];
+ kal_uint32 global_id;
+ kal_uint8 tag_type;
+ kal_uint8 tag_len;
+ kal_uint8 reserved_2[2];
+ kal_uint16 array_index_len;
+ kal_uint16 value_len;
+ kal_char buff_start;
+} mcf_tool_gid_tlvota_file_item_t;
+
+/*
+ * SBP related structure
+ */
+typedef struct _mcf_tlvota_tag_t {
+ kal_uint16 tag_type;
+ kal_uint16 tag_len;
+ kal_char *tag;
+ kal_uint8 reserved[3];
+} mcf_tlvota_tag_t;
+
+typedef struct _mcf_tlvota_sbp_tag_t {
+ kal_uint32 sbp_id;
+ kal_uint8 mcc[MAX_MCC_STR_LEN];
+ kal_uint8 mnc[MAX_MNC_STR_LEN];
+} mcf_tlvota_sbp_tag_t;
+
+/*
+ * Local parameter structure for ILM
+ */
+typedef struct _mcf_l4c_report_state_ind_struct {
+ LOCAL_PARA_HDR
+
+ mcf_l4c_report_type_e type;
+ kal_uint32 result;
+} mcf_l4c_report_state_ind_struct;
+
+typedef struct {
+ LOCAL_PARA_HDR
+
+ kal_uint8 src_id;
+ module_type src_mod_id;
+ kal_uint8 reserved[3];
+ kal_uint32 config_op;
+ kal_bool is_dsbp_retry;
+} mcf_l4bsbp_trigger_dsbp_ind_struct;
+
+typedef struct {
+ LOCAL_PARA_HDR
+
+ kal_uint8 src_id;
+ module_type src_mod_id;
+ kal_uint8 ps_id;
+ kal_uint8 reserved[2];
+ mcf_trigger_dsbp_result_e result;
+ kal_uint32 config_op;
+ kal_bool is_dsbp_retry;
+} mcf_l4bsbp_trigger_dsbp_cnf_struct;
+
+typedef struct {
+ LOCAL_PARA_HDR
+
+ module_type src_mod_id;
+ kal_uint8 ps_id;
+ kal_uint8 reserved[3];
+ mcf_trigger_dsbp_result_e result;
+ kal_uint32 config_op;
+ kal_bool is_dsbp_retry;
+} mcf_l4bsbp_trigger_dsbp_result_ind_struct;
+
+/*
+ * MCF dump related structure
+ */
+typedef struct _mcf_dump_lid_header_struct {
+ kal_char sync_token[8];
+ kal_uint8 header_version;
+ kal_uint8 content_type;
+ kal_uint8 operation_mask;
+ kal_uint8 reserved;
+ kal_uint32 content_len;
+ kal_uint16 lid;
+ kal_uint16 record_idx;
+ kal_char lid_version[4];
+ kal_uint32 checksum;
+ kal_uint8 buff_start[0];
+} mcf_dump_lid_header_struct;
+
+typedef struct _mcf_custom_dump_param_struct {
+ kal_uint16 lid;
+ mcf_ota_type_enum type;
+ protocol_id_enum ps_id;
+ kal_uint32 sbp_id;
+ kal_uint8 mcc[MAX_MCC_STR_LEN];
+ kal_uint8 mnc[MAX_MNC_STR_LEN];
+ kal_uint8 iccid[21];
+ kal_uint16 record_idx;
+ kal_uint8 *buffer;
+ kal_uint32 *size;
+} mcf_custom_dump_param_struct;
+
+typedef kal_bool (*MCF_DUMP_FUNC)(mcf_custom_dump_param_struct *param_ptr);
+
+typedef struct _mcf_dump_param_struct {
+ kal_uint16 lid;
+ kal_uint32 ntfy_type;
+ MCF_DUMP_FUNC dump_func_ptr;
+} mcf_dump_param_struct;
+
+typedef struct _mcf_boot_trace_value_struct {
+ kal_uint32 size;
+ MCF_TYPE_ENUM type;
+ union {
+ kal_uint32 integer;
+ kal_uint32 string;
+ kal_uint32 value;
+ } type_u;
+} mcf_boot_trace_value_struct;
+
+typedef struct _mcf_boot_trace_struct {
+ kal_uint32 guard_pattern;
+ kal_uint32 trace_enum;
+ kal_uint32 total_num;
+ mcf_boot_trace_value_struct value_ptr;
+} mcf_boot_trace_struct;
+
+typedef struct _mcf_tag_info_struct {
+ kal_bool is_bit;
+ kal_int32 array_size[5];
+ kal_uint8 arr_cnt;
+ kal_uint16 upper_vsize;
+} mcf_tag_info_struct;
+
+typedef struct _mcf_merge_link_list_struct {
+ struct _mcf_merge_link_list_struct *pre_node;
+ void *data;
+ struct _mcf_merge_link_list_struct *next_node;
+} mcf_merge_link_list_struct;
+
+typedef struct _mcf_digest {
+ kal_uint32 sequence;
+ kal_uint32 digest_len;
+ kal_uint8 digest_value[384]; // max sha 384
+} mcf_digest;
+
+#endif /* __MCF_STRUCT_H */
+
diff --git a/mcu/interface/service/mcf/mcf_utfwk.h b/mcu/interface/service/mcf/mcf_utfwk.h
new file mode 100644
index 0000000..dfb434d
--- /dev/null
+++ b/mcu/interface/service/mcf/mcf_utfwk.h
@@ -0,0 +1,210 @@
+#ifndef __INC_MCF_UTFWK_H
+#define __INC_MCF_UTFKW_H
+
+#include "ps_public_struct.h"
+#include "mcf_enum.h"
+#include "mcf_utfwk_struct.h"
+#include "mcf_if.h"
+
+#ifndef __MCF_UT_FRAMEWORK_SUPPORT__
+ #define _STATIC static
+ #define MCF_UT_DUMMY_ASSERT ASSERT
+ #define mcf_utfwk_printf(...)
+#else
+ #define MCF_UT_SW_VERNO "LR12A.R3.MP.W18.20.LTE.P1"
+ #define MCF_UT_GEN_TIME "2018/06/06 16:09"
+ #define SBP_NULL_TAG "NA_NA_NA"
+ #define SBP_PARTIAL_TAG "12_NA_NA"
+ #define SBP_PARTIAL_TAG_WITH_MCC "12_33_NA"
+ #define SBP_PARTIAL_TAG_NO_SBPID "NA_33_21"
+ #define SBP_FULL_TAG "12_33_21"
+ #define SBP_TAG_SBPID 12
+ #define SBP_TAG_MCC "33"
+ #define SBP_TAG_MNC "21"
+#if defined(__MD93__)
+ #define MCF_UT_DB_FOLDER_PATH "common\\service\\mcf\\mcf_modis_db"
+#else
+ #define MCF_UT_DB_FOLDER_PATH "service\\mcf\\mcf_modis_db"
+#endif
+
+ #define _STATIC
+ #define MCF_UT_DUMMY_ASSERT(...)
+ #define FS_CreateDir(...) 0
+ #define FS_GetAttributes(...) 0
+ #define FS_GetFileDetail(...) 0
+
+ #define MCF_UT_FAKE_PRINT 0
+ #define MCF_UTFWK_INPUT_VAR static
+ #define MCF_UTFWK_DUMP_VAR static
+
+#if MCF_UT_FAKE_PRINT == 1
+ extern int fake_print(const char *fmt, ...);
+ #define _mcf_utfwk_printf fake_print
+#elif MCF_UT_FAKE_PRINT == 2
+ #define _mcf_utfwk_printf printf
+#else
+ #define _mcf_utfwk_printf(...)
+#endif
+
+#define mcf_utfwk_printf(_fmts, ...) \
+ _mcf_utfwk_printf("%s():%d: " _fmts, __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#define mcf_utfwk_format_err_str(_fmts, ...) \
+ kal_sprintf(p_ret_err_str, "%s():%d: " _fmts, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+ mcf_utfwk_printf("[FAILED] %s():%d: " _fmts, __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+/*----------------------------------------------------------------------------------------
+ * MCF UTFWK fucntions.
+ *--------------------------------------------------------------------------------------*/
+
+ /*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_is_working_status
+ * DESCRIPTION
+ * This function is used to get ut fwk status.
+ * To check whether use WIN_FS_CMP_READ to read OTA file.
+ * PARAMETERS
+ * RETURNS
+ * KAL_TRUE : is running
+ * KAL_FALSE : not running
+ *****************************************************************************/
+kal_bool mcf_utfwk_is_working_status();
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_ilm_initial_env
+ * DESCRIPTION
+ * This function is used to do initialization for MCF UTFWK when received ILM.
+ * PARAMETERS
+ * local_para_ptr [IN] local parameter from ilm
+ * RETURNS
+ *****************************************************************************/
+void mcf_utfwk_ilm_initial_env(ilm_struct *ilm);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_ilm_initial_ota_callback
+ * DESCRIPTION
+ * This function is used to register OTA callback function for MCF UTFWK when received ILM.
+ * PARAMETERS
+ * local_para_ptr [IN] local parameter from ilm
+ * RETURNS
+ *****************************************************************************/
+void mcf_utfwk_ilm_initial_ota_callback(ilm_struct *ilm);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_ilm_initial_dsbp_callback
+ * DESCRIPTION
+ * This function is used to register DSBP callback function for MCF UTFWK when received ILM.
+ * PARAMETERS
+ * local_para_ptr [IN] local parameter from ilm
+ * RETURNS
+ *****************************************************************************/
+void mcf_utfwk_ilm_initial_dsbp_callback(ilm_struct *ilm);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_ilm_execute
+ * DESCRIPTION
+ * This function is used to apply OTA for MCF UTFWK when received ILM.
+ * PARAMETERS
+ * local_para_ptr [IN] local parameter from ilm
+ * RETURNS
+ *****************************************************************************/
+void mcf_utfwk_ilm_execute(ilm_struct *ilm);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_ilm_dump_result
+ * DESCRIPTION
+ * This function is used to dump LID results for MCF UTFWK when received ILM.
+ * PARAMETERS
+ * local_para_ptr [IN] local parameter from ilm
+ * RETURNS
+ *****************************************************************************/
+void mcf_utfwk_ilm_dump_result(ilm_struct *ilm);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_ilm_reset
+ * DESCRIPTION
+ * This function is used to reset environment for MCF UTFWK when received ILM.
+ * PARAMETERS
+ * local_para_ptr [IN] local parameter from ilm
+ * RETURNS
+ *****************************************************************************/
+void mcf_utfwk_ilm_reset(ilm_struct *ilm);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_initial_env
+ * DESCRIPTION
+ * This function is used to do initialization for MCF UTFWK.
+ * PARAMETERS
+ * ota_input [IN] OTA input (OTA information)
+ * RETURNS
+ * -1 : Fail
+ * >0 : Success, ID Number
+ *****************************************************************************/
+kal_bool mcf_utfwk_initial_env (mcf_utfwk_ota_input_struct ota_input);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_initial_dsbp_callback
+ * DESCRIPTION
+ * This function is used to register DSBP callback function.
+ * PARAMETERS
+ * dsbp_func_ptr [IN] DSBP callback function
+ * RETURNS
+ *
+ *****************************************************************************/
+void mcf_utfwk_initial_dsbp_callback(MCF_UTFWK_DSBP_FUNC dsbp_func_ptr);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_execute
+ * DESCRIPTION
+ * This function is used to apply OTA for MCF UTFWK.
+ * PARAMETERS
+ * RETURNS
+ *
+ *****************************************************************************/
+void mcf_utfwk_execute();
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_ut_fwk_dump_result
+ * DESCRIPTION
+ * This function is used to dump LID results for MCF UTFWK.
+ * PARAMETERS
+ * lid [IN] LID number
+ * rec_id [IN] Record ID of LID
+ * dump_type [IN] Dump type (LID/parameters)
+ * dump_buffer [IN] destination buffer
+ * size [IN] buffer size
+ * gid [IN] variable global id
+ * array_index [IN] variable array index string
+ * RETURNS
+ * KAL_TRUE : Success
+ * KAL_FALSE : Fail
+ *****************************************************************************/
+kal_bool mcf_utfwk_dump_result(kal_uint16 lid, kal_uint16 rec_id, mcf_utfwk_dump_type_enum dump_type, void *dump_buffer, kal_uint32 size, kal_uint16 gid, kal_char* array_index);
+
+/*****************************************************************************
+ * FUNCTION
+ * mcf_utfwk_reset
+ * DESCRIPTION
+ * This function is used to reset environment for MCF UTFWK.
+ * PARAMETERS
+ * RETURNS
+ *
+ *****************************************************************************/
+void mcf_utfwk_reset();
+
+kal_bool mcf_utfwk_generate_gid_ota_file(kal_uint8 *buff, mcf_utfwk_ota_input_struct ota_input, kal_bool *is_general, kal_uint16 *buff_size);
+
+#endif /* MCF_UT_FRAMEWORK_SUPPORT */
+
+#endif /* __INC_MCF_UT_H */
+
diff --git a/mcu/interface/service/mcf/mcf_utfwk_struct.h b/mcu/interface/service/mcf/mcf_utfwk_struct.h
new file mode 100644
index 0000000..2cce3e7
--- /dev/null
+++ b/mcu/interface/service/mcf/mcf_utfwk_struct.h
@@ -0,0 +1,91 @@
+#ifndef __MCF_UTFWK_STRUCT_H
+#define __MCF_UTFWK_STRUCT_H
+
+#include "kal_public_defs.h"
+#include "ps_public_enum.h"
+
+#include "mcf_enum.h"
+#include "ps_public_struct.h"
+#include "mcf_struct.h"
+
+/*------------------------------------------------------------------------------
+ * Data structure defintion.
+ *----------------------------------------------------------------------------*/
+typedef struct _mcf_utfwk_config_variable_struct {
+ kal_uint16 gid;
+ kal_char array_index[256];
+ kal_uint16 rec_id;
+ void *value;
+ kal_uint32 value_len;
+}mcf_utfwk_config_variable_struct;
+
+typedef struct _mcf_utfwk_config_variable_info_struct {
+ mcf_utfwk_config_variable_struct *var;
+ kal_uint32 var_cnt;
+ kal_uint32 operation_mask;
+ kal_uint8 tag_type;
+}mcf_utfwk_config_variable_info_struct;
+
+typedef struct _mcf_utfwk_ota_input_struct{
+ kal_uint16 lid[64];
+ kal_uint32 lid_cnt;
+ mcf_ota_utfwk_type_enum ota_type;
+ sim_interface_enum sim_id;
+ kal_uint32 sbp_id;
+ kal_uint8 mcc[MAX_MCC_STR_LEN];
+ kal_uint8 mnc[MAX_MNC_STR_LEN];
+ kal_uint8 iccid[21];
+ mcf_utfwk_ota_input_op_enum input_op;
+ union {
+ kal_uint8 file_path_name[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+ mcf_utfwk_config_variable_info_struct var_info;
+ } input_mode;
+} mcf_utfwk_ota_input_struct;
+
+typedef kal_bool (*MCF_UTFWK_DSBP_FUNC)(sbp_reconfig_custom_param_struct *param_ptr);
+
+typedef struct _mcf_utfwk_common_t {
+ kal_bool initial_ret;
+ kal_bool is_general;
+ mcf_utfwk_ota_input_struct ota_input;
+ MCF_UTFWK_DSBP_FUNC utfwk_dsbp_func_ptr;
+}mcf_utfwk_common_t;
+
+typedef struct {
+ LOCAL_PARA_HDR
+
+ mcf_utfwk_ota_input_struct ota_input;
+} mcf_utfwk_initial_env_req_struct;
+
+typedef struct {
+ LOCAL_PARA_HDR
+
+ kal_bool result;
+} mcf_utfwk_initial_env_resp_struct;
+
+typedef struct {
+ LOCAL_PARA_HDR
+
+ MCF_UTFWK_DSBP_FUNC utfwk_dsbp_func_ptr;
+} mcf_utfwk_initial_dsbp_callback_req_struct;
+
+typedef struct {
+ LOCAL_PARA_HDR
+
+ kal_uint16 lid;
+ kal_uint16 rec_id;
+ mcf_utfwk_dump_type_enum dump_type;
+ void *buffer;
+ kal_uint32 size;
+ kal_uint16 gid;
+ kal_char* array_index;
+} mcf_utfwk_dump_result_req_struct;
+
+typedef struct {
+ LOCAL_PARA_HDR
+
+ kal_bool result;
+} mcf_utfwk_dump_result_resp_struct;
+
+#endif /* __MCF_UTFWK_STRUCT_H */
+