[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/service/mcf/include/mcf_boot_trace.h b/mcu/service/mcf/include/mcf_boot_trace.h
new file mode 100644
index 0000000..2598fd5
--- /dev/null
+++ b/mcu/service/mcf/include/mcf_boot_trace.h
@@ -0,0 +1,108 @@
+BOOT_TRC_MSG(MCF_BOOT_TRACE_TEST1, "[MCF] integer(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TRACE_TEST2, "[MCF] null")
+BOOT_TRC_MSG(MCF_BOOT_TRACE_TEST3, "[MCF] string(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TRACE_TEST4, "[MCF] integer(%d) string(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TRACE_TEST5, "[MCF] integer(%s) string(%s) integer(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_STRING, "%s")
+BOOT_TRC_MSG(MCF_BOOT_TR_CREATE_CUSTOM_FOLDER_FAIL, "[BOOT] mcf_create_custom_folder(): Create custom folder(%s) FAIL!! ret(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_FILE_COMPARE_FAIL, "[BOOT] mcf_read_ota_file(): Compare modified time of OTA file FAIL!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_FILE_FAIL, "[BOOT] mcf_read_ota_file(): Read OTA file FAIL!! path(%d), ret(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_FILE_OVERSIZE, "[BOOT] mcf_read_ota_file(): OTA file size(%d) is larger than allocated buffer size(%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_FILE_DIGEST_FAIL, "[BOOT] mcf_read_ota_file(): OTA file(%s) digest FAIL!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_FILE_DECRYPTION_FAIL, "[BOOT] mcf_read_ota_file(): OTA file(%s) decryption FAIL!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_FILE_CHECKSUM_ERROR, "[BOOT] mcf_read_ota_file(): OTA file(%s) checksum ERROR!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_FILE_INVALID_FILE_VERSION, "[BOOT] mcf_read_ota_file(): OTA file version(%d) is INVALID!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_FILE_TAKE_WRITE_LOCK_FAIL, "[BOOT] mcf_read_ota_file(): Take write lock FAIL!! file(%s), path(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_FILE_OPERATION_MASK_FAIL, "[BOOT] mcf_read_ota_file(): OTA file(%s) operation mask(%d) is not set (%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_FILE_FAIL, "[BOOT] mcf_read_tlvota_file(): Read TLV-OTA file FAIL!! path(%d), sim_id(%d), ret(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_FILE_COMPARE_FAIL, "[BOOT] mcf_read_tlvota_file(): Compare modified time of OP-OTA file FAIL!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_FILE_OVERSIZE, "[BOOT] mcf_read_tlvota_file(): TLV-OTA file size(%d) is larger than allocated buffer size(%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_FILE_DIGEST_FAIL, "[BOOT] mcf_read_tlvota_file(): TLV-OTA file(%s) digest FAIL!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_FILE_DECRYPTION_FAIL, "[BOOT] mcf_read_tlvota_file(): TLV-OTA file(%s) decryption FAIL!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_FILE_CHECKSUM_ERROR, "[BOOT] mcf_read_tlvota_file(): TLV-OTA file(%s) checksum ERROR!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_FILE_INVALID_FILE_VERSION, "[BOOT] mcf_read_tlvota_file(): TLV-OTA file version(%d) is INVALID!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL, "[BOOT] mcf_read_tlvota_file(): Take write lock FAIL!! file(%s), path(%d), sim_id(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_FILE_OPERATION_MASK_FAIL, "[BOOT] mcf_read_tlvota_file(): TLV-OTA file(%s) operation mask(%d) is not set (%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_COMPARE_FAIL, "[BOOT] mcf_read_general_tlvota_file(): Compare modified time of general OP-OTA file FAIL!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_FAIL, "[BOOT] mcf_read_general_tlvota_file(): Read general TLV-OTA file FAIL!! path(%d), ret(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_OVERSIZE, "[BOOT] mcf_read_general_tlvota_file(): TLV-OTA file size(%d) is larger than allocated buffer size(%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_DIGEST_FAIL, "[BOOT] mcf_read_general_tlvota_file(): general TLV-OTA file(%s) digest FAIL!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_DECRYPTION_FAIL, "[BOOT] mcf_read_general_tlvota_file(): General TLV-OTA file(%s) decryption FAIL!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_CHECKSUM_ERROR, "[BOOT] mcf_read_general_tlvota_file(): General TLV-OTA file(%s) checksum ERROR!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_INVALID_FILE_VERSION, "[BOOT] mcf_read_general_tlvota_file(): General TLV-OTA file version(%d) is INVALID!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL, "[BOOT] mcf_read_general_tlvota_file(): Take write lock FAIL!! file(%s), path(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_OPERATION_MASK_FAIL, "[BOOT] mcf_read_general_tlvota_file(): General TLV-OTA file(%s) operation mask(%d) is not set (%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DATA_DUMP_TRACE, "[BOOT] mcf_dump_data(): %d: %x")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_READ_LID_FAIL, "[BOOT] mcf_do_ota_full(): Fail to read MCF LID(%d)!! record_idx(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_READ_OTA_FILE_INFO, "[BOOT] mcf_do_ota_full(): Read OTA file. path(%d), name(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_READ_OTA_FILE_FAIL, "[BOOT] mcf_do_ota_full(): Fail to read OTA file, cannot do full OTA!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_READ_TLVOTA_FILE_INFO, "[BOOT] mcf_do_ota_full(): Read TLVOTA file. sim_id(%d), path(%d), name(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_READ_GENERAL_TLVOTA_FILE_INFO, "[BOOT] mcf_do_ota_full(): Read General-TLVOTA file. path(%d), name(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_FILE, "[BOOT] mcf_do_ota_full(): Invalid file type(%s)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_NO_NEED1, "[BOOT] mcf_do_ota_full(): MD version is not changed, no need to do full OTA!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_NO_NEED2, "[BOOT] File: sw_version(%s), gen_time(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_NO_NEED3, "[BOOT] MD: sw_version(%s), build_time(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_GET_LID_INFO_FAIL, "[BOOT] mcf_do_ota_full(): Fail to get LID information!! lid(%d), nvram_ret(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR, "[BOOT] mcf_do_ota_full(): OTA attribute is not set, do not write to NVRAM. lid(%d), attribute(%x)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_FAIL, "[BOOT] mcf_do_ota_full(): Fail to write item LID(%d), record(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_SUCCESS, "[BOOT] mcf_do_ota_full(): Success to write item LID(%d), record(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_QUERY_ATTR_SET, "[BOOT] mcf_do_ota_full(): OTA query attribute is set, do not write to NVRAM. lid(%d), attribute(%x)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR2, "[BOOT] mcf_do_ota_full(): ERROR!! Both OTA normal and query attribute are set! lid(%d), attribute(%x)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR3, "[BOOT] mcf_do_ota_full(): ERROR!! Both OTA normal and query attribute are not set! lid(%d), attribute(%x)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_RESET_LID_FAIL, "[BOOT] mcf_do_ota_full(): Reset LID(%d) FAIL!!, total_record(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_RESET_ATTR_NOT_SET, "[BOOT] mcf_do_ota_full(): OTA reset attribute is not set!! lid(%d), attribute(%x)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_READ_ITEM_LID_FAIL, "[BOOT] mcf_do_ota_full(): Fail to read item LID(%d), record(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_TAG_LEN, "[BOOT] mcf_do_ota_full(): Invalid item_tag_len(%d)!! max item_tag_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_ITEM_TAG, "[BOOT] %s")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_LARGE_VAL_LEN, "[BOOT] mcf_do_ota_full(): Invalid value len(%d)!! larger than current item len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_BYTE_UPDATE, "[BOOT] mcf_do_ota_full(): Update LID(%d) item. item_offset(%d), value_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_BIT_LEN, "[BOOT] mcf_do_ota_full(): Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_BIT_OFFSET, "[BOOT] mcf_do_ota_full(): Invalid item_bit_offset(%d)!! current item len(%d), bit_value_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_BIT_UPDATE, "[BOOT] mcf_do_ota_full(): Update LID(%d) item. item_offset(%d), bit_offset(%d), bit_len(%d), value(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_VERSION, "[BOOT] mcf_do_ota_full(): Invalid OTA file SW version!! file_version_len(%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_GEN_TIME, "[BOOT] mcf_do_ota_full(): Invalid OTA file SW gen time!! file_gen_time_len(%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_WRITE_LID_FAIL, "[BOOT] mcf_do_ota_full(): Fail to write MCF LID(%d)!! record_idx(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_TAKE_READ_LOCK_FAIL, "[BOOT] mcf_do_ota_full(): Read OTA, Fail to take read lock!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_READ_GENERAL_TLVOTA_FILE_TAKE_READ_LOCK_FAIL, "[BOOT] mcf_do_ota_full(): Read General-TLVOTA, Fail to take read lock!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_READ_TLVOTA_FILE_TAKE_READ_LOCK_FAIL, "[BOOT] mcf_do_ota_full(): Read TLVOTA, Fail to take read lock!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_GET_ALL_LID_INFO_FAIL, "[BOOT] mcf_do_ota_full(): is_reset_all(%d). Fail to get all LID information!! lid(%d), nvram_ret(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_ALL_RESET_LID_FAIL, "[BOOT] mcf_do_ota_full(): is_reset_all(%d). Reset All LID(%d) FAIL!!, total_record(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_ALL_RESET_ATTR_NOT_SET, "[BOOT] mcf_do_ota_full(): is_reset_all(%d). OTA all reset LID attribute is not set!! lid(%d), attribute(%x)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID, "[BOOT] mcf_do_ota_full(): Save Last modified LID(%d), pos(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_ALL_RESET_LID, "[BOOT] mcf_do_ota_full(): is_reset_all(%d). Reset LID(%d) to default value")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_RESET_TIME, "[BOOT] mcf_do_ota_full(): Reset LID to default value duration(%ul)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_SEARCH_STORE_LID, "[BOOT] mcf_do_ota_full(): Search last modified LID LID(%d) pos(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ARRAY_INDEX_LEN, "[BOOT] mcf_do_ota_full(): Invalid array_index_len(%d)!! max array_index_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_GID_ARRAY_INDEX, "[BOOT] %d, %s")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_PARA, "[BOOT] mcf_read_ota_buffer(): Invalid parameters!! LID(%d), buffer(%x), size(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_START, "[BOOT] mcf_read_ota_buffer(): START! LID(%d), record(%d), buffer(%x), size(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_FILE, "[BOOT] mcf_read_ota_buffer(): Invalid file type(%s)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_GET_LID_INFO_FAIL, "[BOOT] mcf_read_ota_buffer(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_SIZE, "[BOOT] mcf_read_ota_buffer(): Invalid buffer_size(%d)!! record_size(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_ATTR, "[BOOT] mcf_read_ota_buffer(): ERROR!! OTA query attribute is not set! LID(%d), attribute(%x)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_ARRAY_INDEX_LEN, "[BOOT] mcf_read_ota_buffer(): Invalid array_index_len(%d)!! max array_index_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_LARGE_VAL_LEN, "[BOOT] mcf_read_ota_buffer(): Invalid value len(%d)!! larger than current item len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_FILE_SW_VERSION, "[BOOT] mcf_do_ota_full(): OTA file sw version(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_FILE_GEN_TIME, "[BOOT] mcf_do_ota_full(): OTA file gen time(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_FILE_TOOL_VERSION, "[BOOT] mcf_do_ota_full(): OTA file tool version(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_FILE_INVALID_TOOL_VERSION, "[BOOT] mcf_do_ota_full(): Invalid OTA file tool version!! file_tool_version_len(%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_NOT_RESET, "[BOOT] mcf_do_ota_full(): Not reset(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_TOTAL_RESET_TIME, "[BOOT] mcf_do_ota_full(): total duration(%ul)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_BYTE_UPDATE, "[BOOT] mcf_read_ota_buffer(): Update LID(%d) item. item_offset(%d), value_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_BIT_LEN, "[BOOT] mcf_read_ota_buffer(): Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_BIT_UPDATE, "[BOOT] mcf_read_ota_buffer(): Update LID(%d) item. item_offset(%d), bit_offset(%d), bit_len(%d), value(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_OTA_BUFFER_TAKE_READ_LOCK_FAIL, "[BOOT] mcf_read_ota_buffer(): Fail to take read lock!! LID(%d)!!")
+BOOT_TRC_MSG(MCF_BOOT_TR_FIND_TAG_ERROR_CAN_NOT_FIND_TAG, "[BOOT] mcf_find_tag_offset(): can not find this tag")
+BOOT_TRC_MSG(MCF_BOOT_TR_FIND_GID_ERROR_CAN_NOT_FIND_GID, "[BOOT] mcf_find_gid_offset(): can not find this gid(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_FIND_GID_ERROR_FORMULA_OUT_OF_BOUND, "[BOOT] mcf_find_gid_offset(): array formula out of bound(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_FIND_GID_ERROR_CAN_NOT_FIND_FORMULA, "[BOOT] mcf_find_gid_offset(): can not find this gid formula(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_FIND_GID_RETURN_LID_NUM_ERROR_CAN_NOT_FIND_GID, "[BOOT] mcf_find_gid_return_lid_num(): can not find this gid(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID_FAIL, "[BOOT] mcf_do_ota_full(): Save Last modified LID fail!!! LID buffer is full(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_DO_OTA_FULL_GET_DEFAULT_OTA_FILE_NAME_FROM_INI, "[BOOT] mcf_do_ota_full(): Get default OTA name from INI (%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_ALLOC_MEM_ERROR, "[BOOT] mcf_malloc() : Alloc memory error")
+BOOT_TRC_MSG(MCF_BOOT_TR_TASK_MAIN_OTA_DURATION, "[BOOT] mcf_task_main() : mcf_read_ota_buffer total duration(%ul)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_BUFFER_SBP_START, "[BOOT] mcf_read_tlvota_buffer_sbp_tag(): START! ps_id(%d), LID(%d), buffer(%x), size(%d), sbp_id(%d), mcc(%s), mnc(%s)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BYTE_UPDATE, "[BOOT] mcf_read_tlvota_buffer_multi_tag(): Update LID(%d) item with tag(%s). item_offset(%d), value_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BIT_UPDATE, "[BOOT] mcf_read_tlvota_buffer_multi_tag(): Update LID(%d) item with tag(%s). item_offset(%d), bit_offset(%d), bit_len(%d), value_len(%d), value(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_BYTE_UPDATE, "[BOOT] mcf_read_tlvota_buffer_sbp_multi_tag(): Update LID(%d) item with tag(%s). item_offset(%d), value_len(%d)")
+BOOT_TRC_MSG(MCF_BOOT_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_BIT_UPDATE, "[BOOT] mcf_read_tlvota_buffer_sbp_multi_tag(): Update LID(%d) item with tag(%s). item_offset(%d), bit_offset(%d), bit_len(%d), value_len(%d), value(%d)")
\ No newline at end of file
diff --git a/mcu/service/mcf/include/mcf_debug.h b/mcu/service/mcf/include/mcf_debug.h
new file mode 100644
index 0000000..2233f3f
--- /dev/null
+++ b/mcu/service/mcf/include/mcf_debug.h
@@ -0,0 +1,75 @@
+#ifndef _MCF_DEBUG_H
+#define _MCF_DEBUG_H
+
+#include "TrcMod.h"
+#include "mcf_trace.h"
+#include "dhl_trace.h"
+#include <ex_public.h>
+
+/*
+ * Use DHL logging.
+ */
+/*#define mcf_trace_error(...)                                         \
+    do{                                                               \
+        if(INT_QueryExceptionStatus() == KAL_FALSE)                   \
+        {                                                             \
+            dhl_trace(TRACE_ERROR, DHL_USER_FLAG_NONE, __VA_ARGS__);  \
+        }                                                             \
+    }while(0)*/
+
+/*#define mcf_trace_warn(...)                                           \
+    do{                                                                \
+        if(INT_QueryExceptionStatus() == KAL_FALSE)                    \
+        {                                                              \
+            dhl_trace(TRACE_ERROR, DHL_USER_FLAG_NONE, __VA_ARGS__);   \
+        }                                                              \
+    }while(0)*/
+
+/*#define mcf_trace_info(...)                                          \
+    do{                                                               \
+        if(INT_QueryExceptionStatus() == KAL_FALSE)                   \
+        {                                                             \
+            dhl_trace(TRACE_INFO, DHL_USER_FLAG_NONE, __VA_ARGS__);   \
+        }                                                             \
+    }while(0)*/
+
+/*#define mcf_trace_func(...)                                          \
+    do{                                                               \
+        if(INT_QueryExceptionStatus() == KAL_FALSE)                   \
+        {                                                             \
+            dhl_trace(TRACE_FUNC, DHL_USER_FLAG_NONE, __VA_ARGS__);   \
+        }                                                             \
+    }while(0)*/
+
+typedef struct {
+    char log_format[200];
+} MCF_BOOT_LOG;
+
+#undef BOOT_TRC_MSG
+#define BOOT_TRC_MSG(_name,_format) _name,
+typedef enum _mcf_boot_trace_enum{
+    #include "mcf_boot_trace.h"
+} mcf_boot_trace_enum;
+        
+#define END_PATTERN 0xDEADDEAD
+// trace_enum, MCF_TYPE_ENUM, value, MCF_TYPE_ENUM, value, MCF_TYPE_ENUM, value, ...
+#define MCF_BOOT_TRACE(_trace_enum, ...) \
+    do{                                                                \
+        if (kal_query_systemInit() == KAL_TRUE)                                                          \
+        {                                                              \
+            mcf_write_boot_trace(_trace_enum, ##__VA_ARGS__, END_PATTERN); \
+        }                                                              \
+    }while(0)
+
+#if defined(ATEST_SYS_MCF) && !defined(__MTK_TARGET__)
+	#ifndef __SE7_SD8_AUTO_UT__ 
+        #define MCF_BOOT_PRINT(...) printf(__VA_ARGS__);
+    #else
+        #define MCF_BOOT_PRINT(...)
+    #endif
+#else 
+	#define MCF_BOOT_PRINT(...) dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, __VA_ARGS__); 
+#endif
+
+#endif  /* _MCF_DEBUG_H */
+
diff --git a/mcu/service/mcf/include/mcf_defs.h b/mcu/service/mcf/include/mcf_defs.h
new file mode 100644
index 0000000..40e482a
--- /dev/null
+++ b/mcu/service/mcf/include/mcf_defs.h
@@ -0,0 +1,277 @@
+/*****************************************************************************
+*  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_defs.h
+ *
+ * Project:
+ * --------
+ *   UMOLYA
+ *
+ * Description:
+ * ------------
+ *   MD Configuration Framework internal configuration and data 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
+ *==============================================================================
+ *******************************************************************************/
+#ifndef __INC_MCF_DEFS_H
+#define __INC_MCF_DEFS_H
+
+#include "kal_public_api.h"
+
+#include "mcf_ut.h"
+#include "mcf_utfwk.h"
+
+/*------------------------------------------------------------------------------
+ * Configuration.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Helper Macro.
+ *----------------------------------------------------------------------------*/
+
+
+/*------------------------------------------------------------------------------
+ * Constant definition.
+ *----------------------------------------------------------------------------*/
+#define MCF_MAX_TAG_LEN 32
+
+/* OTA/TLV-OTA file related definition */
+#define MCF_FILE_TYPE_OTA       "OTA"
+#define MCF_FILE_TYPE_TLVOTA    "TLV-OTA"
+#define MCF_FILE_TYPE_INI       "INI"
+#define MCF_FILE_MAX_TAG_LEN    256
+#define MCF_FILE_MAX_ARRAY_TAG_LEN    64
+
+/* CCCIFS related definition */
+#if defined(__MTK_TARGET__)
+    #define MCF_FS_DEFAULT_FOLDER_PATH      "T:" // AP: "/vendor/etc/mdota"
+#else
+    #define MCF_FS_DEFAULT_FOLDER_PATH      "..\\..\\WIN32FS\\mdota" // MoDIS: "WIN32FS\\mdota"
+#endif
+#define MCF_FS_DEFAULT_OTA_FILE_NAME    "MTK_OTA.mcfota"
+#define MCF_FS_DEFAULT_TLVOTA_FILE_NAME "MTK_OPOTA.mcfopota"
+#define MCF_FS_CUSTOM_FOLDER_PATH       "S:\\mdota" // AP: "/vendor/nvcfg/mdota"
+#define MCF_FS_GENERAL_TLVOTA_FILE_NAME "MTK_OPOTA_GENERAL.mcfopota"
+#define MCF_FS_TLVOTA_FILE_PREFIX       "MTK_OPOTA_SBPID"
+#define MCF_FS_DEFAULT_INI_FILE_NAME    "MTK_MD_OTA_CONFIG.ini"
+#define MCF_FS_DEFAULT_DUMP_FOLDER_NAME "MTK_LAST_DUMP_FOLDER_NAME.txt"
+#define MCF_FS_DEFAULT_AT_CMD_RESULT    "MTK_READ_WRITE_RESULT.txt"
+#define MCF_FS_DEFAULT_OTA_MERGED_FILE_NAME    "MTK_OTA_MERGED.mcfota"
+#define MCF_FS_DEFAULT_TLVOTA_MERGED_FILE_NAME "MTK_OPOTA_MERGED.mcfopota"
+#define MCF_FS_GENERAL_TLVOTA_MERGED_FILE_NAME "MTK_OPOTA_GENERAL_MERGED.mcfopota"
+#define MCF_FS_DEFAULT_TLVOTA_MERGED_FILE_PREFIX "MTK_OPOTA_MERGED"
+
+/* MCF_BOOT_TRACE_F_XXXX is used in init stage trace */
+#define MCF_BOOT_TRACE_F_FULL_OTA_SUCCESS             0x00000001UL
+#define MCF_BOOT_TRACE_F_FULL_OTA_FAIL                0x00000002UL
+#define MCF_BOOT_TRACE_F_CUSTOM_FOLDER_EXIST          0x00000004UL
+#define MCF_BOOT_TRACE_F_CREATE_CUSTOM_FOLDER_FAIL    0x00000008UL
+#define MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL           0x00000010UL
+#define MCF_BOOT_TRACE_F_OTA_FILE_OVERSIZE            0x00000020UL
+#define MCF_BOOT_TRACE_F_READ_TLVOTA_FILE_FAIL        0x00000040UL
+#define MCF_BOOT_TRACE_F_TLVOTA_FILE_OVERSIZE         0x00000080UL
+#define MCF_BOOT_TRACE_F_READ_FILE_LID_FAIL           0x00000100UL
+#define MCF_BOOT_TRACE_F_WRITE_FILE_LID_FAIL          0x00000200UL
+#define MCF_BOOT_TRACE_F_READ_ITEM_LID_FAIL           0x00000400UL
+#define MCF_BOOT_TRACE_F_WRITE_ITEM_LID_FAIL          0x00000800UL
+#define MCF_BOOT_TRACE_F_READ_SW_INFO_LID_FAIL        0x00001000UL
+#define MCF_BOOT_TRACE_F_WRITE_SW_INFO_LID_FAIL       0x00002000UL
+#define MCF_BOOT_TRACE_F_NO_NEED                      0x00004000UL
+#define MCF_BOOT_TRACE_F_INVALID_FILE                 0x00008000UL
+#define MCF_BOOT_TRACE_F_TAKE_READ_LOCK_FAIL          0x00010000UL
+#define MCF_BOOT_TRACE_F_TAKE_WRITE_LOCK_FAIL         0x00020000UL
+#define MCF_BOOT_TRACE_F_DECRYPTION_FAIL              0x00040000UL
+#define MCF_BOOT_TRACE_F_DIGEST_FAIL				  0x00400000UL
+#define MCF_BOOT_TRACE_F_CHECKSUM_ERROR               0x00080000UL
+#define MCF_BOOT_TRACE_F_READ_INT_INFO_LID_FAIL       0x00100000UL
+#define MCF_BOOT_TRACE_F_WRITE_INT_INFO_LID_FAIL      0x00200000UL
+#define MCF_BOOT_TRACE_F_OPERATION_MASK_FAIL          0x00800000UL
+
+/* MCF object related definition */
+#define MCF_W_LOCK_OBJECT_SLEEP_TICKS   KAL_TICKS_10_MSEC_REAL
+#define MCF_DEL_OBJECT_SLEEP_TICKS      KAL_TICKS_10_MSEC_REAL
+#define MCF_LOCK_NAME                   "MCF_LOCK"
+#define MCF_UTFWK_LOCK_NAME             "MCF_UTFWK_LOCK"
+
+/* MCF dump related definition */
+#define MCF_DUMP_FOLDER_PREFIX          "MCF_DUMP"
+#define MCF_DUMP_FILE_PREFIX            "MCF_DUMP_LID"
+#define MCF_DUMP_FILE_POSTFIX           ".dump"
+#define MCF_DUMP_LID_HEADER_SIZE        32 // MUST lager than sizeof(mcf_dump_lid_header_struct)
+#define MCF_DUMP_LID_SYNC_TOKEN         "NV_RAW"
+#define MCF_DUMP_LID_HEADER_VERSION     2
+
+/*------------------------------------------------------------------------------
+ * Internal data structure defintion.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Global variables.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Internal function prototype.
+ *----------------------------------------------------------------------------*/
+
+#endif /* __INC_MCF_DEFS_H */
+
diff --git a/mcu/service/mcf/include/mcf_object.h b/mcu/service/mcf/include/mcf_object.h
new file mode 100644
index 0000000..d7eeea0
--- /dev/null
+++ b/mcu/service/mcf/include/mcf_object.h
@@ -0,0 +1,221 @@
+/*****************************************************************************
+*  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_object.h
+ *
+ * Project:
+ * --------
+ *   UMOLYA
+ *
+ * Description:
+ * ------------
+ *   Helper for object management and synchronization.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *==============================================================================
+ *                 HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
+ *==============================================================================
+ *******************************************************************************/
+
+#ifndef __INC_MCF_OBJECT_H
+#define __INC_MCF_OBJECT_H
+
+#include "kal_public_api.h"
+
+#include "mcf_struct.h"
+
+struct _mcf_object_template;
+extern kal_enhmutexid mcf_enhmutex_g;
+static INLINE kal_bool mcf_is_object_valid(struct _mcf_object_template *object);
+
+/*------------------------------------------------------------------------------
+ * Data structure defintion.
+ *----------------------------------------------------------------------------*/
+#define MCF_MUTEX_LOCK(_lock) \
+        if (kal_query_systemInit() == KAL_FALSE) { \
+            kal_take_enh_mutex(_lock); \
+        }
+#define MCF_MUTEX_UNLOCK(_lock) \
+        if (kal_query_systemInit() == KAL_FALSE) { \
+            kal_give_enh_mutex(_lock); \
+        }
+
+#define MCF_IS_VALID_OBJECT_WO_LOCK(_object) \
+            ((_object) != NULL && (_object)->ref_count == 2)
+
+#define MCF_IS_VALID_OBJECT(_object) \
+            mcf_is_object_valid((struct _mcf_object_template *)_object)
+
+#define MCF_R_LOCK_OBJECT(_object, _lock) \
+            MCF_MUTEX_LOCK(_lock); \
+            if (MCF_IS_VALID_OBJECT_WO_LOCK(_object) && ((_object)->writer_cnt == 0)) { \
+                ++((_object)->reader_cnt); \
+            } else { \
+                (_object) = NULL; \
+            } \
+            MCF_MUTEX_UNLOCK(_lock)
+
+#define MCF_R_UNLOCK_OBJECT(_object, _lock) \
+            ASSERT((_object)); \
+            MCF_MUTEX_LOCK(_lock); \
+            ASSERT((_object)->reader_cnt > 0); \
+            --((_object)->reader_cnt); \
+            MCF_MUTEX_UNLOCK(_lock)
+
+#define MCF_INIT_OBJECT_BEGIN(_object, _lock) \
+            ASSERT(_object); \
+            MCF_MUTEX_LOCK(_lock); \
+            ASSERT((_object)->ref_count == 0); \
+            (_object)->ref_count = 1; \
+            MCF_MUTEX_UNLOCK(_lock)
+
+#define MCF_INIT_OBJECT_END(_object, _lock) \
+            ASSERT(_object); \
+            MCF_MUTEX_LOCK(_lock); \
+            ASSERT(_object->ref_count == 1); \
+            (_object)->ref_count = 2; \
+            (_object)->reader_cnt = 0; \
+            (_object)->writer_cnt = 0; \
+            MCF_MUTEX_UNLOCK(_lock)
+
+#define MCF_DEINIT_OBJECT_BEGIN(_object, _lock) \
+            MCF_MUTEX_LOCK(_lock); \
+            if (MCF_IS_VALID_OBJECT_WO_LOCK(_object)) { \
+                --((_object)->ref_count); \
+                while ((_object)->reader_cnt != 0 || (_object)->writer_cnt != 0) { \
+                    MCF_MUTEX_UNLOCK(_lock); \
+                    kal_sleep_task(MCF_DEL_OBJECT_SLEEP_TICKS); \
+                    MCF_MUTEX_LOCK(_lock); \
+                } \
+                ASSERT((_object)->ref_count == 1); \
+            } else { \
+                (_object) = NULL; \
+            } \
+            MCF_MUTEX_UNLOCK(_lock)
+
+#define MCF_DEINIT_OBJECT_END(_object, _lock) \
+            MCF_MUTEX_LOCK(_lock); \
+            ASSERT((_object)->ref_count == 1); \
+            ASSERT((_object)->reader_cnt == 0); \
+            ASSERT((_object)->writer_cnt == 0); \
+            (_object)->ref_count = 0; \
+            MCF_MUTEX_UNLOCK(_lock)
+
+#define MCF_W_LOCK_OBJECT(_object, _lock) \
+            MCF_MUTEX_LOCK(_lock); \
+            if (MCF_IS_VALID_OBJECT_WO_LOCK(_object)) { \
+                while ((_object)->reader_cnt != 0 || (_object)->writer_cnt != 0) { \
+                    MCF_MUTEX_UNLOCK(_lock); \
+                    kal_sleep_task(MCF_W_LOCK_OBJECT_SLEEP_TICKS); \
+                    MCF_MUTEX_LOCK(_lock); \
+                } \
+                if (MCF_IS_VALID_OBJECT_WO_LOCK(_object)) { \
+                    ++((_object)->writer_cnt); \
+                } else { \
+                    (_object) = NULL; \
+                    MCF_MUTEX_UNLOCK(_lock); \
+                } \
+            } else { \
+                (_object) = NULL; \
+                MCF_MUTEX_UNLOCK(_lock); \
+            }
+
+#define MCF_W_UNLOCK_OBJECT(_object, _lock) \
+            ASSERT((_object)); \
+            ASSERT((_object)->writer_cnt == 1); \
+            --((_object)->writer_cnt); \
+            MCF_MUTEX_UNLOCK(_lock)
+
+/* Safely convert between Read & Write lock at the same time. */
+#define MCF_R_TO_W_LOCK_OBJECT(_object, _lock) \
+            MCF_MUTEX_LOCK(_lock); \
+            if (MCF_IS_VALID_OBJECT_WO_LOCK(_object)) { \
+                ASSERT((_object)->reader_cnt > 0); \
+                --((_object)->reader_cnt); \
+                while ((_object)->reader_cnt != 0 || (_object)->writer_cnt != 0) { \
+                    MCF_MUTEX_UNLOCK(_lock); \
+                    kal_sleep_task(MCF_W_LOCK_OBJECT_SLEEP_TICKS); \
+                    MCF_MUTEX_LOCK(_lock); \
+                } \
+                if (MCF_IS_VALID_OBJECT_WO_LOCK(_object)) { \
+                    ++((_object)->writer_cnt); \
+                } else { \
+                    (_object) = NULL; \
+                    MCF_MUTEX_UNLOCK(_lock); \
+                } \
+            } else { \
+                (_object) = NULL; \
+                MCF_MUTEX_UNLOCK(_lock); \
+            }
+
+#define MCF_W_TO_R_LOCK_OBJECT(_object, _lock) \
+            ASSERT((_object)); \
+            ASSERT((_object)->reader_cnt == 0); \
+            ASSERT((_object)->writer_cnt == 1); \
+            --((_object)->writer_cnt); \
+            ++((_object)->reader_cnt); \
+            MCF_MUTEX_UNLOCK(_lock)
+
+/*------------------------------------------------------------------------------
+ * Functions for Synchronization
+ *----------------------------------------------------------------------------*/
+struct _mcf_object_template {
+    MCF_DECLARE_OBJECT
+};
+
+static INLINE kal_bool mcf_is_object_valid(struct _mcf_object_template *object)
+{
+    kal_bool ret;
+
+    MCF_MUTEX_LOCK(mcf_enhmutex_g);
+    ret = MCF_IS_VALID_OBJECT_WO_LOCK(object)? KAL_TRUE:KAL_FALSE;
+    MCF_MUTEX_UNLOCK(mcf_enhmutex_g);
+
+    return ret;
+}
+
+#endif /* __INC_MCF_OBJECT_H */
diff --git a/mcu/service/mcf/include/mcf_trace.h b/mcu/service/mcf/include/mcf_trace.h
new file mode 100644
index 0000000..fe0589e
--- /dev/null
+++ b/mcu/service/mcf/include/mcf_trace.h
@@ -0,0 +1,18 @@
+#ifndef __INC_MCF_TRACE_H
+#define __INC_MCF_TRACE_H
+
+#ifndef GEN_FOR_PC
+ #include "kal_public_defs.h"
+#endif /* GEN_FOR_PC */
+
+#include "dhl_trace.h"
+#include "dhl_def.h"
+
+#if !defined(GEN_FOR_PC)
+#if defined(__DHL_MODULE__) || defined(__CUSTOM_RELEASE__)
+#endif /* TST Trace Defintion */
+#endif
+#if !defined(GEN_FOR_PC)
+#include "mcf_trace_mod_mcf_utmd.h"
+#endif
+#endif /* __INC_MCF_TRACE_H */
diff --git a/mcu/service/mcf/include/mcf_trace_mod_mcf_utmd.json b/mcu/service/mcf/include/mcf_trace_mod_mcf_utmd.json
new file mode 100644
index 0000000..5df99c4
--- /dev/null
+++ b/mcu/service/mcf/include/mcf_trace_mod_mcf_utmd.json
@@ -0,0 +1,3706 @@
+{
+  "legacyParameters": {}, 
+  "module": "MOD_MCF", 
+  "startGen": "Legacy",
+  "endGen": "-",
+  "traceClassDefs": [
+    {
+      "TRACE_GROUP_1": {
+        "debugLevel": "Low", 
+        "tag": [
+          "Baseline", 
+          "TRACE_GROUP_1"
+        ], 
+        "traceType": "InternalDesign"
+      }
+    }, 
+    {
+      "TRACE_DEBUG": {
+        "debugLevel": "Low", 
+        "tag": [
+          "Baseline", 
+          "TRACE_DEBUG"
+        ], 
+        "traceType": "InternalDesign"
+      }
+    }, 
+    {
+      "TRACE_INFO": {
+        "debugLevel": "Medium", 
+        "tag": [
+          "Baseline", 
+          "TRACE_INFO"
+        ], 
+        "traceType": "InternalDesign"
+      }
+    }, 
+    {
+      "TRACE_WARNING": {
+        "debugLevel": "High", 
+        "tag": [
+          "Baseline", 
+          "TRACE_WARNING"
+        ], 
+        "traceType": "InternalDesign"
+      }
+    }, 
+    {
+      "TRACE_ERROR": {
+        "debugLevel": "Ultra-High", 
+        "tag": [
+          "Baseline", 
+          "TRACE_ERROR"
+        ], 
+        "traceType": "DesignInfo"
+      }
+    },
+    {
+      "TRACE_SENSITIVE_USIR": {
+        "debugLevel": "Medium", 
+        "tag": [
+          "Baseline",
+          "USIR"
+        ], 
+        "traceType": "DesignInfo"
+      }
+    },
+    {
+      "TRACE_INFO_ULTRA_HIGH": {
+        "debugLevel": "Ultra-High", 
+        "tag": [
+          "Baseline", 
+          "TRACE_INFO"
+        ], 
+        "traceType": "DesignInfo"
+      }
+    }
+  ], 
+  "traceDefs": [
+    {
+      "MCF_TR_READ_OTA_FILE_INVALID_PATH_TYPE": {
+        "format": "[MCF] mcf_read_ota_file(): Invalid path_type(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_FILE_INVALID_PATH": {
+        "format": "[MCF] mcf_read_ota_file(): Invalid path(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },     
+    {
+      "MCF_TR_READ_OTA_FILE_FAIL": {
+        "format": "[MCF] mcf_read_ota_file(): Read OTA file FAIL!! path(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_FILE_MODIFIED_TIME": {
+        "format": "[MCF] mcf_read_ota_file(): Modified time of OTA file. path_type(%d), ret(%d), time(0x%x 0x%x)", 
+        "traceClass": "TRACE_GROUP_1"
+      }
+    }, 
+    {
+      "MCF_TR_READ_OTA_FILE_COMPARE_FAIL": {
+        "format": "[MCF] mcf_read_ota_file(): Compare modified time of OTA file FAIL!!", 
+        "traceClass": "TRACE_WARNING"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_FILE_DECRYPTION_FAIL": {
+        "format": "[MCF] mcf_read_ota_file(): OTA file(%s) decryption FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_FILE_DIGEST_FAIL": {
+        "format": "[MCF] mcf_read_ota_file(): OTA file(%s) digest FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_FILE_INVALID_FILE_VERSION": {
+        "format": "[MCF] mcf_read_ota_file(): OTA file version(%d) is INVALID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_FILE_CHECKSUM_ERROR": {
+        "format": "[MCF] mcf_read_ota_file(): OTA file(%s) checksum ERROR!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_READ_OTA_FILE_OVERSIZE": {
+        "format": "[MCF] mcf_read_ota_file(): OTA file size(%d) is larger than allocated buffer size(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_FILE_TAKE_WRITE_LOCK_FAIL": {
+        "format": "[MCF] mcf_read_ota_file(): Take write lock FAIL!! file(%s), path(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_READ_OTA_FILE_READ_INI_FILE_FAIL": {
+        "format": "[MCF] mcf_read_ota_file(): Read ini file FAIL! path_type(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_FILE_OPERATION_MASK_FAIL": {
+        "format": "[MCF] mcf_read_ota_file(): OTA file(%s) operation_mask(%d) is not set (%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_FILE_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_file(): Read TLV-OTA file FAIL!! path(%d), sim_id(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_FILE_MODIFIED_TIME": {
+        "format": "[MCF] mcf_read_tlvota_file(): Modified time of TLV-OTA file. path_type(%d), ret(%d), time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_FILE_INVALID_PATH": {
+        "format": "[MCF] mcf_read_tlvota_file(): Invalid path(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_FILE_COMPARE_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_file(): Compare modified time of OP-OTA file FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_FILE_DECRYPTION_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_file(): TLV-OTA file(%s) decryption FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_READ_TLVOTA_FILE_DIGEST_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_file(): TLV-OTA file(%s) digest FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_READ_TLVOTA_FILE_INVALID_FILE_VERSION": {
+        "format": "[MCF] mcf_read_tlvota_file(): TLV-OTA file version(%d) is INVALID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_FILE_CHECKSUM_ERROR": {
+        "format": "[MCF] mcf_read_tlvota_file(): TLV-OTA file(%s) checksum ERROR!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_FILE_OVERSIZE": {
+        "format": "[MCF] mcf_read_tlvota_file(): TLV-OTA file size(%d) is larger than allocated buffer size(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_file(): Take write lock FAIL!! file(%s), path(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_FILE_OPERATION_MASK_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_file(): TLV-OTA file(%s) operation_mask(%d) is not set (%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_FAIL": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): Read general TLV-OTA file FAIL!! path(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_MODIFIED_TIME": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): Modified time of general TLV-OTA file. path_type(%d), ret(%d), time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_COMPARE_FAIL": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): Compare modified time of general OP-OTA file FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_INVALID_PATH": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): Invalid path(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_DECRYPTION_FAIL": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): General TLV-OTA file(%s) decryption FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_DIGEST_FAIL": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): General TLV-OTA file(%s) digest FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_INVALID_FILE_VERSION": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): General TLV-OTA file version(%d) is INVALID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_CHECKSUM_ERROR": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): General TLV-OTA file(%s) checksum ERROR!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_OVERSIZE": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): General TLV-OTA file size(%d) is larger than allocated buffer size(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): Take write lock FAIL!! file(%s), path(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_TAG_TYPE": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): General TLV-OTA file tag type (%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_READ_GENERAL_TLVOTA_FILE_OPERATION_MASK_FAIL": {
+        "format": "[MCF] mcf_read_general_tlvota_file(): General TLV-OTA file(%s) operation_mask(%d) is not set (%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_INI_FILE_INVALID_PATH_TYPE": {
+        "format": "[MCF] mcf_read_ini_file(): Invalid path_type(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_INI_FILE_FAIL": {
+        "format": "[MCF] mcf_read_ini_file(): Read INI file FAIL!! path(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_INI_FILE_DECRYPTION_FAIL": {
+        "format": "[MCF] mcf_read_ini_file(): INI file(%s) decryption FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_INI_FILE_INVALID_FILE_VERSION": {
+        "format": "[MCF] mcf_read_ini_file(): INI file version(%d) is INVALID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_INI_FILE_CHECKSUM_ERROR": {
+        "format": "[MCF] mcf_read_ini_file(): INI file(%s) checksum ERROR!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_INI_FILE_OVERSIZE": {
+        "format": "[MCF] mcf_read_ini_file(): INI file size(%d) is larger than allocated buffer size(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_INI_FILE_TAKE_WRITE_LOCK_FAIL": {
+        "format": "[MCF] mcf_read_ini_file(): Take write lock FAIL!! file(%s), path(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_L4_UPDATE_OPOTA_FILE_UNKNOWN_OP": {
+        "format": "[MCF] mcf_l4_update_ota(): Unknown operation(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_START": {
+        "format": "[MCF] mcf_update_ota_file(): START!!", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_END": {
+        "format": "[MCF] mcf_update_ota_file(): END!!", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_OTA_FILE_FAIL": {
+        "format": "[MCF] mcf_update_ota_file(): Read OTA file FAIL! path_type(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FILENAME_ERROR": {
+        "format": "[MCF] mcf_update_ota_file(): Read TLVOTA file. Filename error! sbp_id(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL": {
+        "format": "[MCF] mcf_update_ota_file(): Read TLVOTA file FAIL! path_type(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL": {
+        "format": "[MCF] mcf_update_ota_file(): Read General TLVOTA file FAIL! path_type(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_INI_FILE_FAIL": {
+        "format": "[MCF] mcf_update_ota_file(): Read ini file FAIL! path_type(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_OTA_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_update_ota_file(): Take OTA write lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_TLVOTA_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_update_ota_file(): Take TLVOTA write lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_TLVOTA_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_update_ota_file(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_update_ota_file(): Take general TLVOTA write lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_RESET_MD": {
+        "format": "[MCF] mcf_update_ota_file(): Reset MD! path_type(%d), path type time(0x%x 0x%x),time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_NO_UPDATE_OTA": {
+        "format": "[MCF] mcf_update_ota_file(): No update OTA!!", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_NO_READ_INI": {
+        "format": "[MCF] mcf_update_ota_file(): No need to read ini case!!", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_INI": {
+        "format": "[MCF] mcf_update_ota_file(): Read ini case!!", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_TRIGGER_DSBP": {
+        "format": "[MCF] mcf_update_ota_file(): Trigger DSBP! path_type(%d), path type time(0x%x 0x%x),time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_GENERAL_TLVOTA_TRIGGER_DSBP": {
+        "format": "[MCF] mcf_update_ota_file(): General TLV Trigger DSBP! path_type(%d), path type time(0x%x 0x%x),time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_TLVOTA_TRIGGER_DSBP": {
+        "format": "[MCF] mcf_update_ota_file(): TLV OTA Trigger DSBP! path_type(%d), path type time(0x%x 0x%x),time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_CRITICAL_TLVOTA_TRIGGER_DSBP": {
+        "format": "[MCF] mcf_update_ota_file(): Critical TLV OTA Trigger DSBP! path_name (%s), path_type(%d), path type time(0x%x 0x%x),time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_CRITICAL_GTLVOTA_TRIGGER_DSBP": {
+        "format": "[MCF] mcf_update_ota_file(): Critical general TLV OTA Trigger DSBP! path_type (%d), path type time(0x%x 0x%x),time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_READ_INI_FAIL": {
+        "format": "[MCF] mcf_update_ota_file(): Read ini file fail", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_RETURN_VALUE": {
+        "format": "[MCF] mcf_update_ota_file(): Return Num of trigger DSBP(%d)!", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_OTA_LAST_MOD_TIME": {
+        "format": "[MCF] mcf_update_ota_file(): OTA  OTA time(0x%x), Runtime time(0x%x), Last read time(0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_GTLVOTA_LAST_MOD_TIME": {
+        "format": "[MCF] mcf_update_ota_file(): general TLV  OTA time(0x%x), Runtime time(0x%x), Last read time(0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_CGTLVOTA_LAST_MOD_TIME": {
+        "format": "[MCF] mcf_update_ota_file(): Critical general TLV  OTA time(0x%x, Runtime time(0x%x), Last read time(0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_TLVOTA_LAST_MOD_TIME": {
+        "format": "[MCF] mcf_update_ota_file(): TLV OTA time(0x%x), Runtime time(0x%x), Last read time(0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_INI_LAST_MOD_TIME": {
+        "format": "[MCF] mcf_update_ota_file(): INI OTA time(0x%x), Runtime time(0x%x), Last read time(0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_TLVOTA_PATH_NAME": {
+        "format": "[MCF] mcf_update_ota_file(): TLV OTA name(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_TLVOTA_PS_ID": {
+        "format": "[MCF] mcf_update_ota_file(): TLV OTA ps id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_TLVOTA_SBP_ID": {
+        "format": "[MCF] mcf_update_ota_file(): TLV OTA sbp id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_UPDATE_GENERAL_TLVOTA": {
+        "format": "[MCF] mcf_update_ota_file(): General TLV OTA have updated", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_NO_UPDATE_GENERAL_TLVOTA": {
+        "format": "[MCF] mcf_update_ota_file(): General TLV OTA have not updated", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_NO_CRITICAL_CASE": {
+        "format": "[MCF] mcf_update_ota_file(): Update TLV OTA no critical case", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_FIND_INI_TAGNAME": {
+        "format": "[MCF] mcf_update_ota_file(): find ini tag name (%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_FIND_INI_TAGNAME_NULL": {
+        "format": "[MCF] mcf_update_ota_file(): find ini tag name null", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_UPDATE_OTA_INI_READ": {
+        "format": "[MCF] mcf_update_ota_file(): read ini path(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_L4_UPDATE_OTA_DSBP_IS_ONGOING": {
+        "format": "[MCF] mcf_l4_update_ota(): Num of DSBP(%d) is on going!", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_L4_UPDATE_OPOTA_FILE_UPDATE_OTA": {
+        "format": "[MCF] mcf_l4_update_ota(): Call mcf_update_ota_file START!", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_L4_SET_CONFIG_CMD_RESULT": {
+        "format": "[MCF] mcf_l4_set_config(): Write AT cmd result(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_L4_SET_CONFIG_DELETE_FILE_FAIL": {
+        "format": "[MCF] mcf_l4_set_config(): Delete file FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_L4_SET_CONFIG_DSBP_ONGOING": {
+        "format": "[MCF] mcf_l4_set_config(): Ignore AT command due to MCF DSBP is on-going. ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_L4_SET_CONFIG_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_l4_set_config(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_L4_DUMP_DATA_CMD_RESULT": {
+        "format": "[MCF] mcf_l4_dump_data(): Write AT cmd result(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_L4_DUMP_DATA_DELETE_FILE_FAIL": {
+        "format": "[MCF] mcf_l4_dump_data(): Delete file FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_L4_CONFIG_UNKNOWN_OP": {
+        "format": "[MCF] mcf_l4_config(): Unknown operation(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_FILE_PATH_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_set_file_path(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_set_file_path(): Fail to read MCF file LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_set_file_path(): Fail to write MCF file LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_OTA_FILE_PATH_AP": {
+        "format": "[MCF] mcf_set_file_path(): AP set OTA file path(%s), name(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_SET_OTA_FILE_PATH_MD": {
+        "format": "[MCF] mcf_set_file_path(): MD set OTA file path(%s), name(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_SET_TLVOTA_FILE_PATH_AP": {
+        "format": "[MCF] mcf_set_file_path(): AP set TLV-OTA file path(%s), name(%s), ps_id(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_SET_TLVOTA_FILE_PATH_MD": {
+        "format": "[MCF] mcf_set_file_path(): MD set TLV-OTA file path(%s), name(%s), sim_id(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_INVALID_PATH_TYPE": {
+        "format": "[MCF] mcf_set_file_path(): Invalid path_type(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_FILE_MODIFIED_TIME": {
+        "format": "[MCF] mcf_set_file_path(): Modified time of OTA file. path_type(%d), ret(%d), time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_FILE_COMPARE_OTA_FILE_FAIL": {
+        "format": "[MCF] mcf_set_file_path(): Compare modified time of OTA file FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_FILE_NOT_EXIST": {
+        "format": "[MCF] mcf_set_file_path(): File is not existed(%s\\%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_FILE_NOT_CHANGE": {
+        "format": "[MCF] mcf_set_file_path(): TLV-OTA file is not changed. Do not trigger DSBP!! is_deactivated(%d), path_type(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_INVALID_SW_VERSION": {
+        "format": "[MCF] mcf_set_file_path(): Invalid OTA file SW version!! file_version_len(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_INVALID_SW_GEN_TIME": {
+        "format": "[MCF] mcf_set_file_path(): Invalid OTA file SW gen time!! file_gen_time_len(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_READ_FILE_FAIL": {
+        "format": "[MCF] mcf_set_file_path(): Read file to buffer FAIL!! config_type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_RESET_BUFFER_FAIL": {
+        "format": "[MCF] mcf_set_file_path(): Deactivate operator setting, reset buffer FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_TAKE_WRITE_LOCK_FAIL": {
+        "format": "[MCF] mcf_set_file_path(): Take TLVOTA write lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_INVALID_CONFIG_TYPE": {
+        "format": "[MCF] mcf_set_file_path(): Invalid config_type(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_FILE_PATH_INVALID_FILE": {
+        "format": "[MCF] mcf_set_file_path(): Invalid TLVOTA file type!! file_type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_L4_SET_CONFIG_UNKNOWN_OP": {
+        "format": "[MCF] mcf_l4_set_config(): Unknown operation(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_GET_APPLIED_FILE_PATH": {
+        "format": "[MCF] mcf_get_applied_file_path(): Get applied file result(%d), ps_id(%d), sim_id(%d), config_type(%d), path_type(%d), file(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_GET_APPLIED_FILE_PATH_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_get_applied_file_path(): Take read lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_GET_APPLIED_FILE_PATH_UNSUPPORTED_CONFIG_TYPE": {
+        "format": "[MCF] mcf_get_applied_file_path(): Unsupported config_type(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_L4_GET_CONFIG_UNKNOWN_OP": {
+        "format": "[MCF] mcf_l4_get_config(): Unknown operation(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_START": {
+        "format": "[MCF] mcf_do_ota_by_lid(): START! LID(%d), record(%d), record_amount(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_LID_INVALID_PARA": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Invalid parameters!!, LID(%d), lid_info_addr(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_LID_INVALID_FILE": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Invalid file type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_INVALID_ATTR": {
+        "format": "[MCF] mcf_do_ota_by_lid(): ERROR!! OTA attribute is not set! LID(%d), attribute(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_SUCCESS": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Success to write item LID(%d), record_idx(%d)!!", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_FAIL": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Fail to write item LID(%d), record_idx(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Fail to take read lock!! LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_DOUBLE_ATTR": {
+        "format": "[MCF] mcf_do_ota_by_lid(): ERROR!! Both OTA normal and query attribute are set! LID(%d), attribute(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_READ_ITEM_NVRAM_FAIL": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Fail to read item LID(%d), record_idx(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_INVALID_BIT_LEN": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_INVALID_BIT_OFFSET": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Invalid item_bit_offset(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_INVALID_TAG_LEN": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Invalid item_tag_len(%d)!! max item_tag_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_LARGE_VAL_LEN": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Invalid value len(%d)!! larger than current item len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_BYTE_UPDATE": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Update LID(%d) item. item_offset(%d), value_len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_BIT_UPDATE": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Update LID(%d) item. item_offset(%d), bit_offset(%d), bit_len(%d), value(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_LID_OTA_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF] mcf_do_ota_by_lid(): Invalid array_index_len(%d)!! max array_index_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_START": {
+        "format": "[MCF] mcf_read_ota_buffer(): START! LID(%d), record(%d), buffer(%x), size(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_INVALID_PARA": {
+        "format": "[MCF] mcf_read_ota_buffer(): Invalid parameters!! LID(%d), buffer(%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_INVALID_FILE": {
+        "format": "[MCF] mcf_read_ota_buffer(): Invalid file type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_read_ota_buffer(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_INVALID_SIZE": {
+        "format": "[MCF] mcf_read_ota_buffer(): Invalid buffer_size(%d)!! record_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_INVALID_ATTR": {
+        "format": "[MCF] mcf_read_ota_buffer(): ERROR!! OTA query attribute is not set! LID(%d), attribute(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_INVALID_TAG_LEN": {
+        "format": "[MCF] mcf_read_ota_buffer(): Invalid item_tag_len(%d)!! max item_tag_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_LARGE_VAL_LEN": {
+        "format": "[MCF] mcf_read_ota_buffer(): Invalid value len(%d)!! larger than current item len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_BYTE_UPDATE": {
+        "format": "[MCF] mcf_read_ota_buffer(): Update LID(%d) item. item_offset(%d), value_len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_BIT_UPDATE": {
+        "format": "[MCF] mcf_read_ota_buffer(): Update LID(%d) item. item_offset(%d), bit_offset(%d), bit_len(%d), value(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_INVALID_BIT_LEN": {
+        "format": "[MCF] mcf_read_ota_buffer(): Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_INVALID_BIT_OFFSET": {
+        "format": "[MCF] mcf_read_ota_buffer(): Invalid item_bit_offset(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_read_ota_buffer(): Fail to take read lock!! LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF] mcf_read_ota_buffer(): Invalid array_index_len(%d)!! max array_index_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_OTA_BUFFER_DURATION": {
+        "format": "[MCF] mcf_read_ota_buffer(): lid(%d), record_id(%d), duration(%ul)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_START_USIR": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): START! ps_id(%d), sim_id(%d), LID(%d), buffer(%x), size(%d), tag(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_INVALID_PARA": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Invalid parameters!! ps_id(%d), LID(%d), buffer(%x), size(%d), tag_addr(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_INVALID_FILE": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Invalid file type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_INVALID_SIZE": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Invalid buffer_size(%d)!! LID(%d), record_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_ATTR_NOT_SET": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): ERROR!! OTA by op attribute is not set! LID(%d), attribute(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_INVALID_BIT_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_INVALID_BIT_OFFSET": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Invalid item_bit_offset(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Fail to take read lock!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_INVALID_TAG_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Invalid item_tag_len(%d)!! max item_tag_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_LARGE_VAL_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Invalid value len(%d)!! larger than current item len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_BYTE_UPDATE_USIR": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Update LID(%d) item with tag(%S). item_offset(%d), value_len(%d)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_BIT_UPDATE_USIR": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Update LID(%d) item with tag(%S). item_offset(%d), bit_offset(%d), bit_len(%d), value(%d)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer(): Invalid array_index_len(%d)!! max array_index_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_START": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): ps_id(%d), sim_id(%d), tag_num(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_FILE": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Invalid file type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_SIZE": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Invalid buffer_size(%d)!! LID(%d), record_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_ATTR_NOT_SET": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): ERROR!! OTA by op attribute is not set! LID(%d), attribute(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_BIT_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_BIT_OFFSET": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Invalid item_bit_offset(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Fail to take read lock!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_TAG_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Invalid item_tag_len(%d)!! max item_tag_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_LARGE_VAL_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Invalid value len(%d)!! larger than current item len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BYTE_UPDATE": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Update LID(%d) item with tag(%s). item_offset(%d), value_len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BIT_UPDATE": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Update LID(%d) item with tag(%s). item_offset(%d), bit_offset(%d), bit_len(%d), value_len(%d), value(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer_multi_tag(): Invalid array_index_len(%d)!! max array_index_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_START": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): ps_id(%d), sim_id(%d), tag_num(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_FILE": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Invalid file type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_SIZE": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Invalid buffer_size(%d)!! LID(%d), record_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_ATTR_NOT_SET": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): ERROR!! OTA by op attribute is not set! LID(%d), attribute(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_BIT_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_BIT_OFFSET": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Invalid item_bit_offset(%d)!! current item len(%d), bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Fail to take read lock!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_TAG_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Invalid item_tag_len(%d)!! max item_tag_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_LARGE_VAL_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Invalid value len(%d)!! larger than current item len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_BYTE_UPDATE": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Update LID(%d) item with tag(%s). item_offset(%d), value_len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_BIT_UPDATE": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Update LID(%d) item with tag(%s). item_offset(%d), bit_offset(%d), bit_len(%d), value_len(%d), value(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Invalid array_index_len(%d)!! max array_index_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_multi_tag(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_START": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_tag(): START! ps_id(%d), LID(%d), buffer(%x), size(%d), sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_tag(): Invalid tag_name! tag_name(%s), sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_INVALID_PARA": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_tag(): Invalid parameters!! ps_id(%d), LID(%d), buffer(%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_INVALID_SBP_TAG": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_tag(): Invalid SBP tag!! sbp_id(%d), mcc(%s), mnc(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_tag(): Take read lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_READ_TLVOTA_BUFFER_SBP_DURATION": {
+        "format": "[MCF] mcf_read_tlvota_buffer_sbp_tag(): lid(%d), ps_id(%d), duration(%ul)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_READ_NVRAM_TLVOTA_BUFFER_SBP_START": {
+        "format": "[MCF] mcf_read_nvram_and_tlvota_buffer_sbp_tag(): START! ps_id(%d), LID(%d), record(%d), buffer(%x), size(%d), sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_READ_NVRAM_TLVOTA_BUFFER_SBP_INVALID_PARA": {
+        "format": "[MCF] mcf_read_nvram_and_tlvota_buffer_sbp_tag(): Invalid parameters!! ps_id(%d), LID(%d), buffer(%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_CHECK_FILE_FAIL": {
+        "format": "[MCF] mcf_check_file_exist(): Open file(%s\\%s) FAIL!! fs_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_DSBP_MODE_READ_NVRAM_FAIL": {
+        "format": "[MCF] mcf_set_dsbp_mode(): Fail to read SW info LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_DSBP_MODE_WRITE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_set_dsbp_mode(): Fail to write SW info LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_DSBP_MODE_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_set_dsbp_mode(): Invalid SIM ID!! sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_DSBP_MODE_START": {
+        "format": "[MCF] mcf_set_dsbp_mode(): Start to set dsbp mode. is_ignore_dsbp(%d), is_general(%d), sim_id(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_SET_NOT_RESET_READ_NVRAM_FAIL": {
+        "format": "[MCF] mcf_set_not_reset(): Fail to read SW info LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_NOT_RESET_WRITE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_set_not_reset(): Fail to write SW info LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_NOT_RESET_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_set_not_reset(): Invalid SIM ID!! sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_NOT_RESET_INVALID_CONFIG_TYPE": {
+        "format": "[MCF] mcf_set_not_reset(): Invalid config type (%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DATA_DUMP_TRACE": {
+        "format": "[MCF] mcf_dump_data(): %d: 0x%x", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_DUMP_BOOT_TRACE": {
+        "format": "[MCF Boot] %s", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_RESPOND_DSBP_ERROR": {
+        "format": "[MCF] mcf_respond_dsbp_result(): DSBP result FAIL!!(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_RESPOND_DSBP_INVALID_FILE_PATH": {
+        "format": "[MCF] mcf_respond_dsbp_result(): DSBP result(%d) FAIL!! Invalid path_type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_RESPOND_DSBP_READ_FILE_FAIL": {
+        "format": "[MCF] mcf_respond_dsbp_result(): DSBP result(%d) FAIL!! Read MCF file result(%d) FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_RESPOND_DSBP_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_respond_dsbp_result(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_REPORT_STATE_INVALID_OP": {
+        "format": "[MCF] mcf_report_dsbp_result(): Invalid operation(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_REPORT_STATE_CMD_RESULT": {
+        "format": "[MCF] mcf_report_dsbp_result(): Write URC result(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_REPORT_STATE_INVALID_FILE_PATH": {
+        "format": "[MCF] mcf_report_dsbp_result(): DSBP result(%d) FAIL!! Invalid path_type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_REPORT_STATE_READ_FILE_FAIL": {
+        "format": "[MCF] mcf_report_dsbp_result(): DSBP result(%d) FAIL!! Read MCF file result(%d) FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_REPORT_STATE_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_report_dsbp_result(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_ILM_UNKNOWN_MSG": {
+        "format": "[MCF] mcf_on_ilm(): Receive unknown ilm msg_id(%x)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_TAG_ERROR_INPUT_NULL": {
+        "format": "[MCF] mcf_find_tag_offset(): input ptr is NULL", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_TAG_ERROR_CAN_NOT_FIND_LID_NUM": {
+        "format": "[MCF] mcf_find_tag_offset(): can not find this lid num(%d) struct_idx(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_TAG_ERROR_CAN_NOT_FIND_TAG": {
+        "format": "[MCF] mcf_find_tag_offset(): can not find this tag", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_TAG_RETURN_VALUE": {
+        "format": "[MCF] mcf_find_tag_offset(): lid_num(%d), byte_offset(%d), bit_offset(%d), size(%d), duration(%ul)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_FIND_TAG_ERROR_OVER_SIZE": {
+        "format": "[MCF] mcf_find_tag_offset(): can not find this tag due to oversize tag_size(%d) variable_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_GID_ERROR_INPUT_NULL": {
+        "format": "[MCF] mcf_find_gid_offset(): input ptr is NULL", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_GID_ERROR_CAN_NOT_FIND_GID": {
+        "format": "[MCF] mcf_find_gid_offset(): can not find this gid(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_GID_ERROR_FORMULA_OUT_OF_BOUND": {
+        "format": "[MCF] mcf_find_gid_offset(): array formula out of bound(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_GID_ERROR_CAN_NOT_FIND_FORMULA": {
+        "format": "[MCF] mcf_find_gid_offset(): can not find this gid formula(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_GID_START": {
+        "format": "[MCF] mcf_find_gid_offset(): start to find gid(%d), array_idx(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_FIND_GID_RETURN_VALUE": {
+        "format": "[MCF] mcf_find_gid_offset(): lid_num(%d), byte_offset(%d), bit_offset(%d), size(%d), is_bit(%d), duration(%ul)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_FIND_GID_RETURN_LID_NUM_ERROR_CAN_NOT_FIND_GID": {
+        "format": "[MCF] mcf_find_gid_return_lid_num(): can not find this gid(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_ENCRYPT": {
+        "format": "[MCF] mcf_encrypt(): encrypt successfully duration(%ul)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_DECRYPT": {
+        "format": "[MCF] mcf_decrypt(): decrypt successfully duration(%ul)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CHECKSUM_ERROR": {
+        "format": "[MCF] mcf_check_check_sum(): check_sum(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_EM_UPDATE_INVALID_INFO": {
+        "format": "[MCF] mcf_em_update_req_hdlr(): EM update info(%d) is invalid!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_EM_UPDATE_INVALID_SOURCE": {
+        "format": "[MCF] mcf_em_update_req_hdlr(): EM update source(%d) is invalid!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_START": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Start to dump LID. folder(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Get LID information FAIL!! lid(%d), nvram_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_SIZE_NOT_ALIGNMENT": {
+        "format": "[MCF] mcf_dump_all_lid_data(): LID(%d) structure size(%d) is not 4-byte alignment!! padding(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_OTA_CALLBACK": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Dumping OTA. LID(%d), type(%d), record_idx(%d), buffer(0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_OTA_DUMP_FAIL": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_READ_NVRAM_FAIL": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Read NVRAM LID(%d) FAIL!! record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_DUMP_DEFAULT_FILENAME_ERROR": {
+        "format": "[MCF] mcf_dump_all_lid_data(): dump default filename error!! lid(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_DUMP_SIM_FILENAME_ERROR": {
+        "format": "[MCF] mcf_dump_all_lid_data(): dump sim filename error!! lid(%d), sim_id(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_NULL_MCC_MNC": {
+        "format": "[MCF] mcf_dump_all_lid_data(): MCC(%s) or MNC(%s) is NULL!!", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_OTA_BY_OP_CALLBACK_1_USIR": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Dumping OP-OTA. ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_OTA_BY_OP_CALLBACK_2": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Dumping OP-OTA. LID(%d), type(%d), record_idx(%d), buffer(0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_OTA_BY_OP_DUMP_FAIL": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_NUMBER": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Dump number of LID(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_DUMP_FOLDER_NAME": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Last dump folder name(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_CANNOT_FIND_LID": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Can not find LID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_SNPRINTF_DUMP_FOLDER": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Dump folder name unknown error. ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_ALL_LID_DELETE_FILE_FAIL": {
+        "format": "[MCF] mcf_dump_all_lid_data(): Delete file FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_L4_DUMP_DATA_UNKNOWN_OP": {
+        "format": "[MCF] mcf_l4_dump_data(): Unknown operation(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_WRITE_BUFFER_STRING": {
+        "format": "[MCF] mcf_write_dump_buffer(): (%d), (%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_DUMP_MCF_LID_FAIL": {
+        "format": "[MCF] mcf_custom_dump_mcf_data(): Dump MCF LID(%d) FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_MCF_LID_INVALID_TYPE": {
+        "format": "[MCF] mcf_custom_dump_mcf_data(): Dump MCF LID(%d) with invalid type(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_MCF_LID_READ_NVRAM_FAIL": {
+        "format": "[MCF] mcf_custom_dump_mcf_data(): Read NVRAM LID(%d) FAIL!! record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_MCF_LID_QUERY_MCF_FAIL": {
+        "format": "[MCF] mcf_custom_dump_mcf_data(): Query LID(%d) FAIL!! record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_MCF_LID_UNKNOWN_LID": {
+        "format": "[MCF] mcf_custom_dump_mcf_data(): UNKNOWN LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_WRITE_BUFFER_START": {
+        "format": "[MCF] mcf_write_buffer(): Start to write buffer!! file(%s), folder_path(%s), size(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_WRITE_BUFFER_FAIL": {
+        "format": "[MCF] mcf_write_buffer(): FS write data FAIL!! file_handle(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_START": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Start to auto select TLV-OTA file. ps_id(%d), sim_id(%d), sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_FILE_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_FILE_NO_NEED": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): is_ignore_dsbp(%d) is set. No need to auto select TLV-OTA file", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_GENERAL_TLVOTA_FILE_NO_NEED": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): is_ignore_dsbp(%d) is set. No need to auto select General TLV-OTA file", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_READ_TLVOTA_FILE_FILENAME_ERROR": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Read TLVOTA file. Filename error! sbp_id(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_READ_FILE_MODIFIED_TIME": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Modified time of TLV-OTA file. sbp_id(%d), path_type(%d), ret(%d), time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_READ_FILE_COMPARE_FAIL": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Compare modified time of TLV-OTA file FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_READ_FILE_FAIL": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Read TLV-OTA file FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_INVALID_SW_VERSION": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Invalid TLVOTA file SW version!! file_version_len(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_INVALID_GEN_TIME": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Invalid TLVOTA file SW gen time!! file_gen_time_len(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_AUTO_SELECT_BIN_INVALID_TOOL_VERSION": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Invalid TLVOTA file tool version!! tool_version_len(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_INVALID_FILE": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Invalid TLVOTA file type!! file_type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_AUTO_SELECT_BIN_FILE_SW_VERSION": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): TLVOTA file sw version(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_FILE_GEN_TIME": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): TLVOTA file gen time(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_AUTO_SELECT_BIN_FILE_TOOL_VERSION": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): TLVOTA file tool version(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_READ_TLVOTA_FILE_NOT_CHANGE": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Modified time of TLV-OTA file does not change. path_type(%d), need_update(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_NOT_CHANGE": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Modified time of general TLV-OTA file does not change. No need to read again. path_type(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_MODIFIED_TIME": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Modified time of general TLV-OTA file. path_type(%d), ret(%d), time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_COMPARE_FAIL": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Compare modified time of general TLV-OTA file FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_FAIL": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Read general TLV-OTA file FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_AUTO_SELECT_BIN_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Take write lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_AUTO_SELECT_BIN_READ_LID_FAIL": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): Fail to read MCF LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_AUTO_SELECT_BIN_DURATION": {
+        "format": "[MCF] mcf_auto_select_tlvota_file(): duration(%ul)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_SET_CONFIG_AFTER_DSBP_START": {
+        "format": "[MCF] mcf_set_config_after_dsbp(): Start to store config. ps_id(%d), update(%d)!!", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+	{
+      "MCF_TR_SET_CONFIG_AFTER_DSBP_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_set_config_after_dsbp(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_CONFIG_AFTER_DSBP_READ_LID_FAIL": {
+        "format": "[MCF] mcf_set_config_after_dsbp(): Fail to read MCF LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_CONFIG_AFTER_DSBP_WRITE_LID_FAIL": {
+        "format": "[MCF] mcf_set_config_after_dsbp(): Fail to write MCF LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_CONFIG_AFTER_DSBP_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_set_config_after_dsbp(): Fail to take read lock!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_CONFIG_AFTER_DSBP_DURATION": {
+        "format": "[MCF] mcf_set_config_after_dsbp(): duration(%ul)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_ITEM_START": {
+        "format": "[MCF] mcf_find_ini_item(): Start to find ini item! item(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_ITEM_ERROR_INPUT_NULL": {
+        "format": "[MCF] mcf_find_ini_item(): input ptr is NULL", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_ITEM_ERROR_ITEM_LENGTH": {
+        "format": "[MCF] mcf_find_ini_item(): find wrong item length", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_ITEM_ERROR_CAN_NOT_FIND_ITEM": {
+        "format": "[MCF] mcf_find_ini_item(): can not find this item", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_ITEM_RETURN_VALUE": {
+        "format": "[MCF] mcf_find_ini_item(): Return value: item(%s), value(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_SBP_ID_START": {
+        "format": "[MCF] mcf_find_ini_sbp_id(): tag string(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_SBP_ID_RETURN_NUM": {
+        "format": "[MCF] mcf_find_ini_sbp_id(): sbp_id_num(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_SBP_ID_ERROR_INPUT_NULL": {
+        "format": "[MCF] mcf_find_ini_sbp_id(): input ptr is NULL", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_SBP_ID_ERROR_CAN_NOT_FIND_ITEM": {
+        "format": "[MCF] mcf_find_ini_sbp_id(): can not find this item", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_SBP_ID_ICCID_USIR": {
+        "format": "[MCF] mcf_find_ini_sbp_id(): ICCID(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_FIND_INI_SBP_ID_NA": {
+        "format": "[MCF] mcf_find_ini_sbp_id(): find general OP-OTA case-NA, ret(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_COMPOSE_INI_ITEM_ERROR_ITEM_LENGTH": {
+        "format": "[MCF] mcf_compose_ini_item(): find wrong item length", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_COMPOSE_INI_ITEM_INVALID_BUFF": {
+        "format": "[MCF] mcf_compose_ini_item(): invalid buffer size", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_COMPOSE_INI_ITEM_INVALID_ORIGINAL_VALUE": {
+        "format": "[MCF] mcf_compose_ini_item(): invalid original value(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_COMPOSE_INI_ITEM_INVALID_BUFF_LENGTH": {
+        "format": "[MCF] mcf_compose_ini_item(): invalid buffer length", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_COMPOSE_INI_ITEM_START": {
+        "format": "[MCF] mcf_compose_ini_item(): Start! item(%s) value(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_GET_FILE_LAST_MOD_TIME_START": {
+        "format": "[MCF] mcf_get_file_last_mod_time(): Start! Name(%s) Apply path type (%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_GET_FILE_LAST_MOD_TIME": {
+        "format": "[MCF] mcf_get_file_last_mod_time(): Modified time path_type(%d), ret(%d), time(0x%x 0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_GET_FILE_LAST_MOD_TIME_INVALID_PATH_TYPE": {
+        "format": "[MCF] mcf_get_file_last_mod_time(): Invalid path_type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_GET_FILE_LAST_MOD_TIME_FAIL": {
+        "format": "[MCF] mcf_get_file_last_mod_time(): Can not get time. path_type(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_RESPOND_DSBP_RESULT_IND_CNT": {
+        "format": "[MCF] mcf_respond_dsbp_result()  Num of DSBP result ind (%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_RESPOND_DSBP_RESULT_IND_NO_SIM": {
+        "format": "[MCF] mcf_respond_dsbp_result()  NO SIM!! ps_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_RESPOND_DSBP_CMD_RESULT": {
+        "format": "[MCF] mcf_respond_dsbp_result(): Write AT cmd response(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CONFIG_INI_READ_INI_FAIL": {
+        "format": "[MCF] mcf_config_ini_info(): Read ini file FAIL! path_type(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_CONFIG_INI_LAST_MOD_TIME": {
+        "format": "[MCF] mcf_config_ini_info(): INI OTA time(0x%x), Runtime time(0x%x), Last read time(0x%x)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CONFIG_INI_READ": {
+        "format": "[MCF] mcf_config_ini_info(): read ini path(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CHECK_LID_NEED_RESET_START": {
+        "format": "[MCF] mcf_check_lid_need_reset(): Start to check if LID(%d) is in last modified LID list.", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CHECK_LID_NEED_RESET_NOT_FOUND": {
+        "format": "[MCF] mcf_check_lid_need_reset(): LID(%d) is not found in last modified LID list. last_pos(%d), curr_pos(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CHECK_LID_NEED_RESET_FOUND": {
+        "format": "[MCF] mcf_check_lid_need_reset(): LID(%d) is found in last modified LID list. last_pos(%d), curr_pos(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+	{
+      "MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_START": {
+        "format": "[MCF] mcf_check_lid_need_reset_by_psid(): Start to check if LID(%d) is in last modified LID list. ps_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_NOT_FOUND": {
+        "format": "[MCF] mcf_check_lid_need_reset_by_psid(): LID(%d) is not found in last modified LID list.", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_TLVOTA_FOUND": {
+        "format": "[MCF] mcf_check_lid_need_reset_by_psid(): LID(%d) is found in tlvota last modified LID list.", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_GENERAL_TLVOTA_FOUND": {
+        "format": "[MCF] mcf_check_lid_need_reset_by_psid(): LID(%d) is found in general tlvota last modified LID list.", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+	{
+      "MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_check_lid_need_reset_by_psid(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_CHECK_RESET_AND_TLVOTA_BUFFER_SBP_TAG_INVALID_PARA": {
+        "format": "[MCF] mcf_check_reset_and_tlvota_buffer_sbp_tag(): Invalid parameters!! ps_id(%d), LID(%d), buffer(%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_CHECK_RESET_AND_TLVOTA_BUFFER_SBP_TAG_GET_DEFAULT_VALUE_FAIL": {
+        "format": "[MCF] mcf_check_reset_and_tlvota_buffer_sbp_tag(): Get default value FAIL! LID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_L4_QUERY_LID_UNKNOWN_OP": {
+        "format": "[MCF] mcf_l4_variable_operation(): Unknown operation(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_L4_VARIABLE_OPERATION_UNKNOWN_OP": {
+        "format": "[MCF] mcf_l4_variable_operation(): Unknown operation(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_L4_VARIABLE_OPERATION_UNKOWN_ACTION": {
+        "format": "[MCF] mcf_l4_variable_operation(): Unknown action(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_L4_ASSIGN_COMBINED_FILE_PATH_UNKNOWN_OP": {
+        "format": "[MCF] mcf_l4_assign_combined_file_path(): Unknown operation(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_START": {
+        "format": "[MCF] mcf_config_LID_variable(): Start to Config LID variable. lid(%d), rec_id(%d), tag_name(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_config_LID_variable(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_config_LID_variable(): Get LID information FAIL!! lid(%d), nvram_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_INVALID_REC_ID": {
+        "format": "[MCF] mcf_config_LID_variable(): Invalid record ID. record id(%d), total record id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_CALLBACK": {
+        "format": "[MCF] mcf_config_LID_variable(): Read default OTA by callback. LID(%d), type(%d), record_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_DUMP_ERROR": {
+        "format": "[MCF] mcf_config_LID_variable(): Read OTA dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_NVRAM": {
+        "format": "[MCF] mcf_config_LID_variable(): Read default OTA by NVRAM. LID(%d), type(%d), record_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_NVRAM_FAIL": {
+        "format": "[MCF] mcf_config_LID_variable(): Read default OTA by NVRAM FAIL!! LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_NVRAM_NOT_CALLBACK": {
+        "format": "[MCF] mcf_config_LID_variable(): Read default OTA by NVRAM (non-register callback). LID(%d), record_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_NVRAM_FAIL_NOT_CALLBACK": {
+        "format": "[MCF] mcf_config_LID_variable(): Read default OTA by NVRAM FAIL (non-register callback)!!. LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_USIR": {
+        "format": "[MCF] mcf_config_LID_variable(): Read OP OTA. LID(%d), record_id(%d), ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_CALLBACK_USIR": {
+        "format": "[MCF] mcf_config_LID_variable(): Read OP OTA by callback. LID(%d), type(%d), record_id(%d), sbp_id(%d), mnc(%s), mcc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_DUMP_FAIL": {
+        "format": "[MCF] mcf_config_LID_variable(): Read OP OTA dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_NVRAM": {
+        "format": "[MCF] mcf_config_LID_variable(): Read OP OTA by NVRAM. LID(%d), type(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_NVRAM_FAIL": {
+        "format": "[MCF] mcf_config_LID_variable(): Read OP OTA by NVRAM FAIL!! LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_NVRAM_NOT_CALLBACK_USIR": {
+        "format": "[MCF] mcf_config_LID_variable(): Read OP OTA by NVRAM (non-register callback). LID(%d) ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_NVRAM_FAIL_NOT_CALLBACK": {
+        "format": "[MCF] mcf_config_LID_variable(): Read OP OTA by NVRAM FAIL (non-register callback)!! LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_FIND_TAG_FAIL": {
+        "format": "[MCF] mcf_config_LID_variable(): Cannot find the tag!! LID(%d), tag_name(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_LENGTH": {
+        "format": "[MCF] mcf_config_LID_variable(): Read length of tag. read length(%d), variable size(%d), total size(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_TOTAL_ARRAY_SIZE": {
+        "format": "[MCF] mcf_config_LID_variable(): Read variable by byte. Total array size(%d), variable size(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BYTE": {
+        "format": "[MCF] mcf_config_LID_variable(): Read variable by byte. value(%s), len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT_WHOLE": {
+        "format": "[MCF] mcf_config_LID_variable(): Read whole variable by bit. value(%s), len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT": {
+        "format": "[MCF] mcf_config_LID_variable(): Read variable by bit. value(%d), len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_INVALID_ARR_SIZE": {
+        "format": "[MCF] mcf_config_LID_variable(): Invalid array size. variable array size(%d), tag name array size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT_INVALID_BIT_LEN": {
+        "format": "[MCF] mcf_config_LID_variable(): Read variable by bit. Invalid bit len!! variable size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT_SIZE": {
+        "format": "[MCF] mcf_config_LID_variable(): Read variable by bit. upper variable size(%d) read length(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CHECK_OTA_NEED_UPDATE_START": {
+        "format": "[MCF] mcf_check_ota_need_update(): Start to check ota need update. ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_CHECK_OTA_NEED_UPDATE_FAIL": {
+        "format": "[MCF] mcf_check_ota_need_update(): Fail to auto select file. ps_id(%d), ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_CHECK_OTA_NEED_UPDATE_RESULT": {
+        "format": "[MCF] mcf_check_ota_need_update(): OTA need update result. ps_id(%d), ret(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+	{
+      "MCF_TR_CHECK_OTA_NEED_UPDATE_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_check_ota_need_update(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_TASK_CLEAN_TAKE_WRITE_LOCK_FAIL": {
+        "format": "[MCF] mcf_task_clean(): Fail to take write lock!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_START": {
+        "format": "[MCF] mcf_query_variable_value(): Start to query variable. format(%d), ota(%d), number(%d), rec_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_query_variable_value(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_GET_LID_NUM_FAIL": {
+        "format": "[MCF] mcf_query_variable_value(): Get LID number FAIL!! gid(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_query_variable_value(): Get LID information FAIL!! lid(%d), nvram_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_INVALID_REC_ID": {
+        "format": "[MCF] mcf_query_variable_value(): Invalid record ID. record id(%d), total record id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_CALLBACK": {
+        "format": "[MCF] mcf_query_variable_value(): Read default OTA by callback. LID(%d), type(%d), record_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_DUMP_ERROR": {
+        "format": "[MCF] mcf_query_variable_value(): Read OTA dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_NVRAM": {
+        "format": "[MCF] mcf_query_variable_value(): Read default OTA by NVRAM. LID(%d), type(%d), record_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_NVRAM_FAIL": {
+        "format": "[MCF] mcf_query_variable_value(): Read default OTA by NVRAM FAIL!! LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_NVRAM_NOT_CALLBACK": {
+        "format": "[MCF] mcf_query_variable_value(): Read default OTA by NVRAM (non-register callback). LID(%d), record_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_NVRAM_FAIL_NOT_CALLBACK": {
+        "format": "[MCF] mcf_query_variable_value(): Read default OTA by NVRAM FAIL (non-register callback)!!. LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_USIR": {
+        "format": "[MCF] mcf_query_variable_value(): Read OP OTA. LID(%d), record_id(%d), ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_CALLBACK_USIR": {
+        "format": "[MCF] mcf_query_variable_value(): Read OP OTA by callback. LID(%d), type(%d), record_id(%d), sbp_id(%d), mnc(%s), mcc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_DUMP_FAIL": {
+        "format": "[MCF] mcf_query_variable_value(): Read OP OTA dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_NVRAM": {
+        "format": "[MCF] mcf_query_variable_value(): Read OP OTA by NVRAM. LID(%d), type(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_NVRAM_FAIL": {
+        "format": "[MCF] mcf_query_variable_value(): Read OP OTA by NVRAM FAIL!! LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_NVRAM_NOT_CALLBACK_USIR": {
+        "format": "[MCF] mcf_query_variable_value(): Read OP OTA by NVRAM (non-register callback). LID(%d) ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_NVRAM_FAIL_NOT_CALLBACK": {
+        "format": "[MCF] mcf_query_variable_value(): Read OP OTA by NVRAM FAIL (non-register callback)!! LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_TAG": {
+        "format": "[MCF] mcf_query_variable_value(): tag_name(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_FIND_TAG_FAIL": {
+        "format": "[MCF] mcf_query_variable_value(): Cannot find the tag!! LID(%d), tag_name(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_LENGTH": {
+        "format": "[MCF] mcf_query_variable_value(): Read length of tag. read length(%d), variable size(%d), total size(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_TOTAL_ARRAY_SIZE": {
+        "format": "[MCF] mcf_query_variable_value(): Read variable by byte. Total array size(%d), variable size(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BYTE": {
+        "format": "[MCF] mcf_query_variable_value(): Read variable by byte. value(%s), len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT_WHOLE": {
+        "format": "[MCF] mcf_query_variable_value(): Read whole variable by bit. value(%s), len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT": {
+        "format": "[MCF] mcf_query_variable_value(): Read variable by bit. value(%d), len(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_INVALID_ARR_SIZE": {
+        "format": "[MCF] mcf_query_variable_value(): Invalid array size. variable array size(%d), tag name array size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT_INVALID_BIT_LEN": {
+        "format": "[MCF] mcf_query_variable_value(): Read variable by bit. Invalid bit len!! variable size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    }, 
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT_SIZE": {
+        "format": "[MCF] mcf_query_variable_value(): Read variable by bit. upper variable size(%d) read length(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF] mcf_query_variable_value(): Invalid array index length. max array idx len(%d), req array idex(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_ARRAY_INDEX": {
+        "format": "[MCF] mcf_query_variable_value(): gid(%d) array_idx(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+    {
+      "MCF_TR_QUERY_VARIABLE_VALUE_FIND_GID_FAIL": {
+        "format": "[MCF] mcf_query_variable_value(): find gid FAIL!! gid(%d) array_idx(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_START": {
+        "format": "[MCF] mcf_set_variable_value(): Start to set variable. format(%d), ota(%d), number(%d), rec_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_READ_FILE_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Fail to read file(%s\\%s), ret(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF] mcf_set_variable_value(): Invalid array index length. max array idx len(%d), req array idex(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_ARRAY_INDEX": {
+        "format": "[MCF] mcf_set_variable_value(): gid(%d) array_idx(%s)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_INVALID_VALUE": {
+        "format": "[MCF] mcf_set_variable_value(): Invalid hex value(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Fail to get LID information!! lid(%d), nvram_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_DELETE_FILE_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Delete file FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_INVALID_FILE_SIZE": {
+        "format": "[MCF] mcf_set_variable_value(): Invalid File Size(%d), max file size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_SET_VARIABLE_VALUE_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_set_variable_value(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_FIND_GID_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): find gid FAIL!! gid(%d) array_idx(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_INVALID_VAL_LEN": {
+        "format": "[MCF] mcf_set_variable_value(): Invalid value length! value_len(%d), variable_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_INVALID_VALUE_LEN": {
+        "format": "[MCF] mcf_set_variable_value(): Invalid value length! value_len(%d) cannot be odd", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_READ_NVRAM_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Fail to read LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_MERGE_GID_TO_FILE_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Merge GID to OTA file FAIL!!file_type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_MERGE_FILE": {
+        "format": "[MCF] mcf_set_variable_value(): Copy OTA file!!", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_MERGE_OTA_FILE_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Merge OTA file FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Take OTA read lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_WRITE_FILE_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Write file FAIL!! path(%s), name(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_WRITE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Fail to write LID(%d)!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_SET_VARIABLE_VALUE_TLVOTA_SBPID": {
+        "format": "[MCF] mcf_set_variable_value(): Get TLVOTA file. sbp_id(%d), mcc(%s), mnc(%s)!", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_SET_VARIABLE_VALUE_TAG_SNPRINTF_FAIL": {
+        "format": "[MCF] mcf_set_variable_value(): Invalid tag_name! tag_name(%s), sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_PATH_TYPE": {
+        "format": "[MCF] mcf_assign_combined_file_path(): Invalid path_type(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_FILE_TYPE": {
+        "format": "[MCF] mcf_assign_combined_file_path(): Invalid file type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_ASSIGN_COMBINED_FILE_PATH_READ_FILE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_assign_combined_file_path(): Fail to read MCF file LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_ASSIGN_COMBINED_FILE_PATH_WRITE_FILE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_assign_combined_file_path(): Fail to write MCF file LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_CONFIG_TYPE": {
+        "format": "[MCF] mcf_assign_combined_file_path(): Invalid config_type(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_assign_combined_file_path(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_INVALID_FILE_TYPE": {
+        "format": "[MCF] mcf_combined_ota_file(): Invalid file type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_FILE_NOT_EXIST": {
+        "format": "[MCF] mcf_combined_ota_file(): File is not existed(%s\\%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_READ_FILE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Fail to read MCF file LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Fail to read file(%s\\%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_INVALID_FILE": {
+        "format": "[MCF] mcf_combined_ota_file(): Invalid file type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF] mcf_combined_ota_file(): Invalid array_index_len(%d)!! max array_index_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_SEARCH_STORE_LID": {
+        "format": "[MCF] mcf_combined_ota_file(): Search last modified LID LID(%d) pos(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_STORE_LID_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Save Last modified LID(%d) fail!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_STORE_LID": {
+        "format": "[MCF] mcf_combined_ota_file(): Save Last modified LID(%d), pos(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Fail to write MCF file LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_MERGE_OTA_FILE": {
+        "format": "[MCF] mcf_combined_ota_file(): Copy OTA file", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_MERGE_OTA_FILE_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Merge OTA file FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_INVALID_FILE_SIZE": {
+        "format": "[MCF] mcf_combined_ota_file(): Invalid file size(%d), max file size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Fail to write file(%s\\%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Fail to take read lock!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_STORE_LAST_LID_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Store TLVOTA last modified LID FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_TLVOTA_START": {
+        "format": "[MCF] mcf_combined_ota_file(): Start to combine TLVOTA file. sim_id(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_INVALID_CONFIG_TYPE": {
+        "format": "[MCF] mcf_combined_ota_file(): Invalid config_type(%d)!!", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_COMBINED_OTA_FILE_DELETE_FILE_FAIL": {
+        "format": "[MCF] mcf_combined_ota_file(): Delete file FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_COMBINED_OTA_FILE_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_combined_ota_file(): Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_CLEAR_LAST_MODIFIED_LID_INVALID_SIZE": {
+        "format": "[MCF] mcf_clear_last_modified_lid: Invalid lid count(%d),(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_FILL_TAG_ENTRY_INVALID_SBP_TAG": {
+        "format": "[MCF] mcf_fill_tag_entry(): Invalid SBP tag!! sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL": {
+        "format": "[MCF] mcf_fill_tag_entry(): Invalid tag_name! tag_name(%s), sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_START": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): START! sim_id(%d), sbp_id(%d), mcc(%s), mnc(%s), is_general(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Invalid SIM ID!! sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Fail to take read lock!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Invalid array_index_len(%d)!! max array_index_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_GET_LID_INFO_FAIL": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Search last modified LID. LID(%d) pos(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_STORE_LID": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Save last modified LID. LID(%d) pos(%d) sim_id(%d)", 
+        "traceClass": "TRACE_INFO_ULTRA_HIGH"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID_FAIL": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Save Last modified LID fail!!! LID buffer is full(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_INVALID_FILE_VERSION": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): OTA file version(%d) is INVALID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_INVALID_FILE": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Invalid file type(%s)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+	{
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_RESET_ATTR_NOT_SET": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Attribute is not set!! lid(%d), attribute(%x)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_STORE_TLVOTA_MODIFIED_LID_NOT_RESET": {
+        "format": "[MCF] mcf_store_tlvota_modified_lid(): Not reset(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MCF_SNPRINTF_FAIL": {
+        "format": "[MCF] mcf_snprintf(): FAIL. num(%d), ret(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Start! OTA type(%d), Operation(%d), SIM(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_INVALID_SIM_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Invalid Parameters! SIM(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_ALLOCATE_MEMORY_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Error!! Unable to allocate required memory", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_RESET_OTA_FILE_LID_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_RESET_TLVOTA_FILE_LID_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to reset NVRAM_EF_MCF_TLVOTA_FILE_LID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_RESET_TEST_OTA_LID_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_RESET_TEST_OTA_QUERY_LID_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to reset NVRAM_EF_MCF_TEST_OTA_QUERY_LID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_RESET_SW_INFO_LID_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_RESET_INTERNAL_INFO_LID_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to reset NVRAM_EF_MCF_INTERNAL_INFO_LID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_OPEN_OTA_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Open OTA test data(%s) FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_OTA_LID_INVALID": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): LID(%d) in OTA file is not match given LID", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_TAKE_OTA_READ_LOCK_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Read OTA test data FAIL!! Fail to take read lock!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_TAKE_TLV_OTA_READ_LOCK_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Read OP-OTA test data FAIL!! Fail to take read lock!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_OPEN_TLVOTA_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Open OP-OTA test data(%s) FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_TLVOTA_LID_INVALID": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): LID(%d) in OP-OTA file is not match given LID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_GET_LID_INFO_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_RESET_LID": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Reset LID!! LID(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_RESET_LID_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to reset LID!! LID(%d), total_record(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_INVALID_REC_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Invalid record ID!! LID(%d), record(%d), total_record(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_WRITE_OTA_INFO_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to write MCF OTA file info to NVRAM!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_WRITE_TLVOTA_INFO_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Fail to write MCF TLV-OTA file info to NVRAM!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_FILE_OVERSIZE": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): file size(%d) is larger than allocated buffer size(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_FILE_DECRYPTION_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): file(%s) decryption FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_FILE_CHECKSUM_ERROR": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): file(%s) checksum ERROR!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_FILE_INVALID_FILE_VERSION": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): file version(%d) is INVALID!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_INVALID_OTA_TYPE": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Invalid OTA type!! LID(%d), LID attribute(%x), ota_type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_INVALID_TLVOTA_TYPE": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Invalid OP-OTA type!! LID(%d), LID attribute(%x), ota_type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_INVALID_SBP_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Invalid SBP ID! SBP_ID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_TAG_IS_NOT_MATCH": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Tag(%d_%s_%s) in OP-OTA file is not match given tag(%d_%s_%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_ENV_TAG_INVALID_ARRAY_INDEX_LEN": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_env(): Invalid item_tag_len(%d)!! max item_tag_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_CHECK_TAG_ENTRY_INVALID_SBP_TAG": {
+        "format": "[MCF UTFWK] mcf_utfwk_check_tag_entry(): Invalid SBP tag!! sbp_id(%d), mcc(%s), mnc(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_OTA_CALLBACK_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_ota_callback(): Start!! ID(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_OTA_CALLBACK_INVALID_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_ota_callback(): Invalid ID! ID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_DSBP_CALLBACK_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_dsbp_callback(): Start!!", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_INITIAL_DSBP_CALLBACK_INVALID_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_initial_dsbp_callback(): Invalid ID! ID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Start! OTA type(%d), SIM(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_INITIAL_ENV_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Initial env is fail, ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_INVALID_SIM_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Invalid Parameters! ID(%d), SIM(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_GET_LID_INFO_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_UPDATE_DEFAULT_OTA_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Update default OTA FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_UPDATE_OTA_FOR_QUERY_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Update OTA for Query file FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_UPDATE_OP_OTA": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Update OP-OTA sim_id(%d), sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_UPDATE_OP_OTA_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Update OP-OTA FAIL!! ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_INVALID_OTA_TYPE": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Invalid OTA type!! LID attribute(%x), ota_type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_INVALID_TLVOTA_TYPE": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Invalid OP-OTA type!! LID attribute(%x), ota_type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_NOT_REGISTER_OTA_CALLBACK": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Not register OTA callback function!!!", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_NOT_REGISTER_DSBP_CALLBACK": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Not register DSBP callback function!!!", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_EXECUTE_INVALID_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_execute(): Invalid ID! ID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_INVALID_PARA": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Invalid parameters!! LID(%d), buffer(%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Start! ID(%d), dump type(%d), OTA type(%d), LID(%d), Record(%d), SIM(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_GET_LID_INFO_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Get LID information FAIL!! lid(%d), nvram_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_INVALID_REC_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Invalid record ID. record id(%d), total record id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_INVALID_LID": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): LID(%d) of GID(%d) item is not match given LID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_CALLBACK": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read default OTA by callback. LID(%d), type(%d), record_id(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_DUMP_ERROR": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read OTA dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_NVRAM": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read default OTA by NVRAM. LID(%d), type(%d), record_id(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_NVRAM_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read default OTA by NVRAM FAIL!! LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_USIR": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read OP OTA. LID(%d), record_id(%d), ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_CALLBACK_USIR": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read OP OTA by callback. LID(%d), type(%d), record_id(%d), sbp_id(%d), mnc(%s), mcc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_DUMP_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read OP OTA dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+       }
+     },
+     {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_NVRAM": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read OP OTA by NVRAM. LID(%d), type(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_NVRAM_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read OP OTA by NVRAM FAIL!! LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_NVRAM_NOT_CALLBACK": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read default OTA by NVRAM (non-register callback). LID(%d), record_id(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_NVRAM_NOT_CALLBACK_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read default OTA by NVRAM FAIL (non-register callback)!!. LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_NVRAM_NOT_CALLBACK_USIR": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read OP OTA by NVRAM (non-register callback). LID(%d) ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s), iccid(%S)", 
+        "traceClass": "TRACE_SENSITIVE_USIR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_NVRAM_NOT_CALLBACK_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read OP OTA by NVRAM FAIL (non-register callback)!! LID(%d), record_idx(%d), buffer(0x%x), size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_INVALID_SIZE": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Invalid buffer_size(%d)!! record_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_INVALID_BUFF_SIZE": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Invalid buffer_size(%d)!! item_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_TAG_INFO": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): tag_name(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_INVALID_GID": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Dump one variable, Invalid GID(%d)!!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_DUMP_ONE_VARIABLE_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): GID(%d), array index(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_FIND_TAG_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Cannot find the tag!! LID(%d), tag_name(%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_TAG_LENGTH": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read length of tag. read length(%d), variable size(%d), total size(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_INVALID_ARR_SIZE": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Invalid array size. variable array size(%d), tag name array size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_TOTAL_ARRAY_SIZE": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read variable by byte. Total array size(%d), variable size(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_VARIABLE_BYTE": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read variable by byte. value(%s), len(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_VARIABLE_BIT_WHOLE": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read whole variable by bit. value(%s), len(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_READ_VARIABLE_BIT": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Read variable by bit. value(%d), len(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_DUMP_RESULT_INVALID_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_dump_result(): Invalid ID!! ID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_RESET_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_reset(): Reset Start!!", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_RESET_GET_LID_INFO_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_reset(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_RESET_RESET_LID": {
+        "format": "[MCF UTFWK] mcf_utfwk_reset(): Reset LID!! LID(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_RESET_RESET_LID_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_reset(): Fail to reset LID!! LID(%d), total_record(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_RESET_INVALID_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_reset(): Invalid ID!! ID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_RESET_TAKE_WRITE_LOCK_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_reset(): Take write lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Start! OTA type(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_GET_LID_INFO_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Fail to get LID information!! LID(%d), nvram_api_ret(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_GEN_OTA_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Start to generate OTA file. number of variable(%d), operation_mask(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_INVALID_VAL_LEN": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Invalid value length! value_len(%d), variable_size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_INVALID_LID": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): LID(%d) in OTA file is not match given LID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_INVALID_BIT_LEN": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Invalid bit_len(%d)!! current bit_value_len(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_UNKNOWN_OTA_TYPE": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Unknown ota type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_TAKE_WRITE_LOCK_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Take write lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Take read lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_TAKE_TLV_OTA_READ_LOCK_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Take OP-OTA read lock FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_LID_OTA_INVALID_ATTR": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): ERROR!! OTA attribute is wrong! LID(%d), attribute(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_CAN_NOT_FIND_TAG": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Can not find this tag! (%s)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_INVALID_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Invalid ID! ID(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_FILE_OVERSIZE": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): file size(%d) is larger than allocated buffer size(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_ENCRYPTION_FAIL": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): OTA file encryption FAIL!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_GEN_TLVOTA_START": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Start to generate OP-OTA file. number of variable(%d), operation_mask(%d), tag type(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_GEN_TLVOTA_SBP_INFO": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Start to generate OP-OTA file. sbp_id(%d), mcc(%s), mnc(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_GENERATE_OTA_FILE_GEN_TLVOTA_INVALID_TAG_TYPE": {
+        "format": "[MCF UTFWK] mcf_utfwk_generate_gid_ota_file(): Invalid tag type(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_SPILT_TAG_UNKNOWN_SBP_ID": {
+        "format": "[MCF UTFWK] mcf_utfwk_spilt_tag(): Unknown sbp_id!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_CHECK_TAG_ENTRY_INVALID_PARA": {
+        "format": "[MCF UTFWK] mcf_utfwk_check_tag_entry(): Invalid parameters!! pItem(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_FREE_BUFFER_INVALID_PARA": {
+        "format": "[MCF UTFWK] mcf_utfwk_free_buffer(): Invalid parameters!! pMcf(%x), id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_UTFWK_FREE_BUFFER_WITH_LOCK_INVALID_PARA": {
+        "format": "[MCF UTFWK] mcf_utfwk_free_buffer_with_lock(): Invalid parameters!! pMcf(%x), id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_START": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: Start", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_MCF_CORE": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: MCF is running on Core(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_LOCK_CORE": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: Lock the Core(%d), current Core(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: Unlock the Core(%d), current Core(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_INPUT_PARAM_ERROR": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: input param error ! first(%x), second(%x), output(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_ALLOCATE_HEAD_TAIL": {
+        "format": "[MCF MERGE] allocate head(%x), tail(%x)", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_ALLOCATE": {
+        "format": "[MCF MERGE] allocate(%x)", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_FREE": {
+        "format": "[MCF MERGE] free(%x)", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_FIRST_BUFFER_TYPE": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: first buffer type(%d)", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_SECOND_BUFFER_TYPE": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: second buffer type(%d)", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_OUTPUT_GID": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: gid(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_OUTPUT_BUFFER_OUT_OF_SIZE": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: output buffer out of size error ! filesize(%d), output buffer size(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_MERGE_OTA_BUFFER_END": {
+        "format": "[MCF MERGE] mcf_merge_ota_buffer: END", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_ONE_GID_START": {
+        "format": "[MCF MERGE] mcf_merge_one_gid: Start", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_ONE_GID_INPUT_PARAM_ERROR": {
+        "format": "[MCF MERGE] mcf_merge_one_gid: input param error ! gid buffer(%x), output(%x)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_MERG_ONE_GID_END": {
+        "format": "[MCF MERGE] mcf_merge_one_gid: END", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_MAKE_OTA_FILE_HEADER_START": {
+        "format": "[MCF MERGE] mcf_merge_make_ota_file_header: Start", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_MAKE_OTA_FILE_HEADER_END": {
+        "format": "[MCF MERGE] mcf_merge_make_ota_file_header: End", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_READ_BUFFER_TO_LINKLIST_TOTAL_ITEM": {
+        "format": "[MCF MERGE] mcf_merge_read_buffer_to_linklist: total item(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_READ_BUFFER_TO_LINKLIST_ITEM_INFO": {
+        "format": "[MCF MERGE] mcf_merge_read_buffer_to_linklist: item_num(%d) gid(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MERGE_LINK_LIST_INSERT_DATA_START": {
+        "format": "[MCF MERGE] mcf_merge_link_list_insert: start insert gid (%d)", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_LINK_LIST_INSERT_CMP_RESULT": {
+        "format": "[MCF MERGE] mcf_merge_link_list_insert: compare result(%d)", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_LINK_LIST_INSERT_DATA_END": {
+        "format": "[MCF MERGE] mcf_merge_link_list_insert: end insert gid", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_LINK_LIST_INSERT_NODE_INFO": {
+        "format": "[MCF MERGE] mcf_merge_insert_node: pre_node->next_node(%x), next_node->pre_node(%x), insert_node->pre_node(%x), insert_node->next_node(%x))", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_LINK_LIST_USE_CURRENT_AS_START": {
+        "format": "[MCF MERGE] mcf_merge_link_list_insert: Use current as start", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_LINK_LIST_USE_HEAD_AS_START": {
+        "format": "[MCF MERGE] mcf_merge_link_list_insert: Use head as start", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_CMP_OTA_DATA_INFO": {
+        "format": "[MCF MERGE] mcf_merge_compare_ota_data: item1: [lid(%d), rid/tag_type(%d), gid(%d)] <=> item2: [lid(%d), rid/tag_type(%d), gid(%d)]", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_MERGE_CMP_OTA_DATA_ARRAY_INFO": {
+        "format": "[MCF MERGE] mcf_merge_compare_ota_data: array compare result(%d)", 
+        "traceClass": "TRACE_DEBUG"
+      }
+    },
+    {
+      "MCF_TR_ALLOC_MEM_ERROR": {
+        "format": "[MCF] mcf_malloc() : Alloc memory error", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_DUMP_IMPORTANT_INFO_OTA_FILE": {
+        "format": "[MCF] mcf_dump_important_info() : OTA file info. path_type(%d), filename(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_DUMP_IMPORTANT_INFO_TLVOTA_FILE": {
+        "format": "[MCF] mcf_dump_important_info() : TLVOTA file info. sim_id(%d), path_type(%d), filename(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_DUMP_IMPORTANT_INFO_GENERAL_TLVOTA_FILE": {
+        "format": "[MCF] mcf_dump_important_info() : General TLVOTA file info. path_type(%d), filename(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_DUMP_IMPORTANT_INFO_TAKE_READ_LOCK_FAIL": {
+        "format": "[MCF] mcf_dump_important_info() : Fail to take read lock!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_GET_TLVOTA_FILE_RESULT_START": {
+        "format": "[MCF] mcf_get_tlvota_file_result() : Start to get TLVOTA file result. ps_id(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_GET_TLVOTA_FILE_RESULT_INVALID_SIM_ID": {
+        "format": "[MCF] mcf_get_tlvota_file_result() : Invalid SIM ID!! ps_id(%d), sim_id(%d)", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_GET_TLVOTA_FILE_RESULT_RETURN_RESULT": {
+        "format": "[MCF] mcf_get_tlvota_file_result() : Get TLVOTA file result. ps_id(%d), ret(%d)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_MAKE_FILE_INFO_START": {
+        "format": "[MCF] mcf_make_file_info() : Start to make file info. path_type(%d), last_mod_time(0x%x), checksum(0x%x)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_COMPARE_FILE_INFO_START": {
+        "format": "[MCF] mcf_compare_file_info() : Start to compare file info.", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_COMPARE_FILE_INFO_READ_FILE_NVRAM_FAIL": {
+        "format": "[MCF] mcf_compare_file_info() : Fail to read MCF file LID(%d)!!", 
+        "traceClass": "TRACE_ERROR"
+      }
+    },
+    {
+      "MCF_TR_COMPARE_FILE_INFO_OLD_FILE_INFO": {
+        "format": "[MCF] mcf_compare_file_info() : old file: sw_version(%s), gen_time(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_COMPARE_FILE_INFO_NEW_FILE_INFO": {
+        "format": "[MCF] mcf_compare_file_info() : new file: sw_version(%s), gen_time(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_COMPARE_FILE_INFO_MD_INFO": {
+        "format": "[MCF] mcf_compare_file_info() : The same. MD: sw_version(%s), gen_time(%s)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_COMPARE_FILE_INFO_FILE_CHECKSUM": {
+        "format": "[MCF] mcf_compare_file_info() : old file checksum(0x%x), new file checksum(0x%x)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_COMPARE_FILE_INFO_FILE_LAST_MOD_TIME": {
+        "format": "[MCF] mcf_compare_file_info() : old file last_mod_time(0x%x), new file last_mod_time(0x%x)", 
+        "traceClass": "TRACE_INFO"
+      }
+    },
+    {
+      "MCF_TR_COMPARE_FILE_INFO_FILE_NOT_THE_SAME": {
+        "format": "[MCF] mcf_compare_file_info() : File is not the same, need to update", 
+        "traceClass": "TRACE_INFO"
+      }
+    }
+  ], 
+  "traceFamily": "PS", 
+  "userModule": "MOD_MCF"
+}
\ No newline at end of file
diff --git a/mcu/service/mcf/include/mcf_ut.h b/mcu/service/mcf/include/mcf_ut.h
new file mode 100644
index 0000000..b06a669
--- /dev/null
+++ b/mcu/service/mcf/include/mcf_ut.h
@@ -0,0 +1,144 @@
+/*****************************************************************************
+*  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_ut.h
+ *
+ * Project:
+ * --------
+ *   UMOLYA
+ *
+ * Description:
+ * ------------
+ *   MD Configuration Framework unit test defines and helper macros.
+ *
+ * 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
+ *==============================================================================
+ *******************************************************************************/
+#ifndef __INC_MCF_UT_H
+#define __INC_MCF_UT_H
+
+#if !defined(ATEST_SYS_MCF) && !defined(__MCF_UT_FRAMEWORK_SUPPORT__)
+    #define _STATIC static
+    #define MCF_UT_DUMMY_ASSERT ASSERT
+#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 FS_Delete(...) 0
+#endif /* ATEST_SYS_MCF */
+
+#endif /* __INC_MCF_UT_H */
+
diff --git a/mcu/service/mcf/include/mcf_util.h b/mcu/service/mcf/include/mcf_util.h
new file mode 100644
index 0000000..8cb3d08
--- /dev/null
+++ b/mcu/service/mcf/include/mcf_util.h
@@ -0,0 +1,302 @@
+/*****************************************************************************
+*  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_defs.h
+ *
+ * Project:
+ * --------
+ *   UMOLYA
+ *
+ * Description:
+ * ------------
+ *   MD Configuration Framework internal configuration and data 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
+ *==============================================================================
+ *******************************************************************************/
+#ifndef __INC_MCF_UTIL_H
+#define __INC_MCF_UTIL_H
+
+#include "kal_public_api.h"
+#include "em_l4_common_public_struct.h"
+#include "mcf_nvram_editor.h"
+#include "us_timer.h"
+#include "mcf_db.h"
+
+/*------------------------------------------------------------------------------
+ * Configuration.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Helper Macro.
+ *----------------------------------------------------------------------------*/
+#define mcf_get_instance() &mcf_inst_g
+#define MCF_GEN_BIT_MASK(_len) (pow(2, _len) - 1)
+
+/* Define time function */
+#if defined(__MTK_TARGET__)
+    #define GET_CURRENT_TIME ust_get_current_time
+    #define CALCULATE_LETENCY_DURATION ust_us_duration
+#else // MODIS
+    #define GET_CURRENT_TIME(...) 0
+    #define CALCULATE_LETENCY_DURATION(...) 0
+#endif
+
+#define MCF_ADDR_LINE_SIZE_MASK 0x00000003
+#define MCF_READ_ADDR_GET_ALIGN(_o, _alo) \
+{                                                 \
+    _alo   = (kal_uint32)(_o);                    \
+    if(_alo&MCF_ADDR_LINE_SIZE_MASK) {           \
+        _alo = (kal_uint32)(_o)&~MCF_ADDR_LINE_SIZE_MASK;    \
+    }                                             \
+} 
+
+/*------------------------------------------------------------------------------
+ * Constant definition.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Internal data structure defintion.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Global variables.
+ *----------------------------------------------------------------------------*/
+extern mcf_t            mcf_inst_g;
+extern event_scheduler *mcf_timer_es_g;
+extern eventid          mcf_timer_eventid_g;
+extern mcf_t           *mcf_utfwk_inst_g;
+extern mcf_common_t     com_Mcf;
+extern kal_enhmutexid   mcf_utfwk_enhmutex_g;
+extern mcf_file_info_t     new_file_info;
+extern mcf_file_info_t     old_file_info;
+/*------------------------------------------------------------------------------
+ * Function prototype.
+ *----------------------------------------------------------------------------*/
+#if !defined(__HIF_CCCI_SUPPORT__) || !defined(__MTK_TARGET__)
+    #if !defined(ATEST_SYS_MCF)
+        #define MCF_FS_CMPT_Read MCF_Win_FS_CMPT_Read
+    #else
+        #define MCF_FS_CMPT_Read MCF_dummy_FS_CMPT_Read
+    #endif
+#else
+    #define MCF_FS_CMPT_Read FS_CMPT_Read
+#endif
+
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+    #define MCF_LAST_MODIFIED_LID nv_int_info.last_mod_lid.lid[i]
+#else
+    #define MCF_LAST_MODIFIED_LID nv_int_info.last_mod_lid.lid_conf[i].lid
+#endif
+
+void mcf_create_custom_folder(mcf_t *pMcf);
+mcf_ota_result_e mcf_read_ota_file(kal_bool is_booting, kal_char *req_fs_root_path, kal_char *req_file_path_name, l4c_mcf_path_type_enum *apply_path_type, kal_char *apply_filename, mcf_t *pMcf);
+mcf_ota_result_e mcf_read_tlvota_file(kal_bool is_booting, kal_uint8 sim_id, kal_char *req_fs_root_path, kal_char *req_file_path_name, l4c_mcf_path_type_enum *apply_path_type, kal_char *apply_filename, mcf_t *pMcf);
+mcf_ota_result_e mcf_read_general_tlvota_file(kal_bool is_booting, kal_char *req_fs_root_path, kal_char *req_file_path_name, l4c_mcf_path_type_enum *apply_path_type, kal_char *apply_filename, mcf_t *pMcf);
+mcf_ota_result_e mcf_read_ini_file(kal_char *req_fs_root_path, kal_char *req_file_path_name, l4c_mcf_path_type_enum *apply_path_type, kal_char *apply_filename, mcf_t *pMcf);
+kal_bool mcf_find_ini_item(kal_char *buff, kal_char *item, kal_char *value, mcf_t *pMcf);
+kal_bool mcf_find_ini_sbp_id(kal_char *tag_str, kal_uint32 *sbp_id, kal_uint16 *sbp_id_num, kal_bool *general);
+kal_bool mcf_compose_ini_item(kal_char *orig_buff, kal_char *new_buff, kal_char *item, kal_char *orig_value, kal_char *value);
+void mcf_dump_data(kal_bool is_booting, void *p_data, kal_uint32 len);
+void mcf_write_boot_trace(kal_uint32 trace_enum, ...);
+void mcf_dump_boot_trace(void);
+mcf_ota_result_e mcf_write_buffer(kal_char *folder_path, kal_char *file_name, kal_uint8 *buffer, kal_uint32 total_size);
+mcf_ota_result_e mcf_get_file_last_mod_time(kal_char *apply_filename, l4c_mcf_path_type_enum apply_path_type, kal_uint64 *last_mod_time);
+kal_bool mcf_find_tag_offset(kal_uint32 lid_num, char *tag_name, kal_uint16 *byte_offset, kal_uint16 *bit_offset, kal_uint32 *size, MCF_DB_STRUCT_VARIABLE const **var_ptr, mcf_tag_info_struct *tag_ptr);
+kal_bool mcf_find_gid_offset(kal_uint32 gid, char *array_idx_string, kal_uint16 *lid_num, kal_uint16 *byte_offset, kal_uint16 *bit_offset, kal_uint32 *size, kal_bool *is_bit);
+kal_uint16 mcf_find_gid_return_lid_num(kal_uint32 gid);
+kal_uint32 mcf_calc_check_sum(kal_uint32 *ptr, kal_uint32 len);
+kal_uint32 mcf_check_check_sum(kal_uint32 *ptr, kal_uint32 len);
+kal_bool mcf_encrypt_128bit(char *password, char *content, kal_uint32 content_length);
+kal_bool mcf_decrypt_128bit(char *password, char *content, kal_uint32 content_length);
+kal_bool mcf_encrypt_256bit(char *password, char *content, kal_uint32 content_length);
+kal_bool mcf_decrypt_256bit(char *password, char *content, kal_uint32 content_length);
+void mcf_remove_spaces_and_carrier_return(kal_char* src);
+void mcf_toupper(kal_char* src);
+kal_int32 mcf_atoi(const void *src);
+ 
+kal_int16 mcf_binary_search_lid(kal_uint16 find_lid, kal_uint16 *lid_arr, kal_uint16 lid_size, kal_uint16 *new_pos);
+kal_bool mcf_insert_lid(kal_uint16 new_lid, kal_uint16 *lid_arr, kal_uint16 lid_size, kal_uint16 new_pos);
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+kal_int16 mcf_binary_search_lid_struct(kal_uint16 find_lid, nvram_mcf_lid_config_struct *lid_conf, kal_uint16 lid_size, kal_uint16 *new_pos);
+kal_bool mcf_insert_lid_struct(kal_uint16 new_lid, nvram_mcf_lid_config_struct *lid_conf, kal_uint16 lid_size, kal_uint16 new_pos, kal_bool not_reset, kal_bool set_combined);
+kal_bool mcf_clear_last_modified_lid(nvram_mcf_lid_config_struct *lid_conf, kal_uint16 *lid_size);
+#endif
+kal_int8* mcf_bytes_to_hex(const void *bytes, kal_int32 length, kal_bool upperCase, void *hex);
+kal_int8* mcf_hex_to_bytes(const void *hex, kal_int32 *length, void *bytes);
+kal_bool mcf_hex_str_reverse(kal_char *str, kal_uint32 length);
+void mcf_replace_char(kal_char* src, kal_char old_ch, kal_char new_ch);
+kal_bool mcf_merge_ota_buffer(void *first_buffer, void *second_buffer, void *output_buffer, kal_uint32 output_buffer_size);
+kal_bool mcf_merge_one_gid(void *new_gid, mcf_ota_type_enum type, void *output_buffer, kal_uint32 output_buffer_size, kal_uint32 operation_mask);
+void mcf_mem_init(void);
+void *mcf_malloc(unsigned int size);
+void mcf_free(void *ptr);
+kal_bool mcf_verify_digest(kal_uint32 digest_tag, mcf_tool_file_info_t *ota_file, mcf_digest *sign);
+void mcf_dump_important_info(void);
+void mcf_snprintf(kal_char * str, size_t num, const char * fmt, ...);
+void mcf_make_file_info(mcf_file_info_t *file_info, kal_uint8 path_type, kal_char *name, kal_char *sw_version, kal_uint8 sw_version_len, kal_char *gen_time, kal_uint8 gen_time_len, kal_uint64 last_mod_time, kal_uint32 checksum);
+kal_bool mcf_compare_file_info(mcf_file_info_t *old_file, mcf_file_info_t *new_file);
+
+#endif /* __INC_MCF_DEFS_H */
+
diff --git a/mcu/service/mcf/src/mcf_if.c b/mcu/service/mcf/src/mcf_if.c
new file mode 100644
index 0000000..068c57a
--- /dev/null
+++ b/mcu/service/mcf/src/mcf_if.c
@@ -0,0 +1,11901 @@
+/*****************************************************************************
+*  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.c
+ *
+ * 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!
+ * 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!
+ *
+ * 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!!
+ *==============================================================================
+ *******************************************************************************/
+
+#include "kal_public_api.h"
+#include "fs_general_api.h"
+#include <math.h>
+
+#include "md_sap.h"
+#include "md_svc_sap.h"
+#include "em_msgid.h"
+#include "em_l4_common_public_struct.h"
+#include "em_mcf_public_struct.h"
+#include "nvram_interface.h"
+
+#include "mcf_nvram_editor.h"
+#include "mcf_msgid.h"
+#include "mcf_custom.h"
+#include "mcf_defs.h"
+#include "mcf_if.h"
+#include "mcf_debug.h"
+#include "mcf_util.h"
+#include "mcf_object.h"
+#include "mcf_utfwk.h"
+
+/*------------------------------------------------------------------------------
+ * Global variables.
+ *----------------------------------------------------------------------------*/
+extern MCF_DB_LID_MAPPING mcf_db_lid_mapping_tbl[];
+extern mcf_dump_param_struct mcf_dump_param_tbl[];
+extern kal_uint32 mcf_dump_param_tbl_num;
+
+kal_uint8 mcf_dump_buffer[MCF_MAX_DUMP_SIZE + MCF_MAX_RECORD_CNT * MCF_DUMP_LID_HEADER_SIZE];
+nvram_mcf_lid_info_struct   mcf_last_mod_lid_g = {0};
+nvram_mcf_lid_info_struct   mcf_curr_mod_lid_g = {0};
+nvram_mcf_lid_info_struct   mcf_tlvota_last_mod_lid_g[MAX_SIM_NUM] = {0};
+nvram_mcf_lid_info_struct   mcf_tlvota_curr_mod_lid_g[MAX_SIM_NUM] = {0};
+nvram_mcf_lid_info_struct   mcf_general_tlvota_last_mod_lid_g[MAX_SIM_NUM] = {0};
+nvram_mcf_lid_info_struct   mcf_general_tlvota_curr_mod_lid_g[MAX_SIM_NUM] = {0};
+kal_char    txt_buff[64];
+kal_bool    is_read_tlvota[MAX_SIM_NUM] = {0};
+kal_bool    is_read_general_tlvota[MAX_SIM_NUM] = {0};
+kal_bool    is_update_tlvota[MAX_SIM_NUM];
+nvram_ef_mcf_internal_info_struct nv_int_info;
+kal_char   mcf_gid_buff[256];
+mcf_ota_result_e set_op_read_ret[MAX_SIM_NUM];
+
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+kal_uint8 mcf_merge_buffer[MCF_MAX_FILE_SIZE];
+kal_uint8 mcf_file_buffer[MCF_MAX_FILE_SIZE];
+kal_wchar merge_ota_name[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+#endif
+
+kal_uint8 dsbp_ret = 0;
+
+/*------------------------------------------------------------------------------
+ * Helper macro.
+ *----------------------------------------------------------------------------*/
+ 
+ 
+/*------------------------------------------------------------------------------
+ * Private data structure.
+ *----------------------------------------------------------------------------*/
+typedef struct tm MCF_TIME_STRUCT;
+
+/*------------------------------------------------------------------------------
+ * Private variables.
+  *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Extern fucntions.
+ *----------------------------------------------------------------------------*/
+extern kal_char* release_verno(void);
+extern kal_char* build_date_time(void);
+extern sim_interface_enum l4c_gemini_get_actual_sim_id(sim_interface_enum simId);
+extern sim_interface_enum l4c_gemini_get_switched_sim_id(sim_interface_enum simId);
+extern void mcf_merge_make_ota_file_header(mcf_tool_file_info_t *output_header, mcf_tool_file_info_t *copy_header);
+
+/*------------------------------------------------------------------------------
+ * Private fucntions.
+ *----------------------------------------------------------------------------*/
+_STATIC kal_bool mcf_check_tag_match(
+    mcf_tool_tlvota_file_item_t *pItem,
+    mcf_tlvota_tag_t *tag_entry,
+    kal_uint32 tag_num,
+    kal_uint32 *match_idx)
+{
+    kal_uint32  tag_cnt = 0;
+
+    ASSERT(pItem);
+    ASSERT(tag_entry);
+    ASSERT(tag_num >= 0);
+
+    while(tag_cnt < tag_num) {
+        if ( (pItem->tag_type == tag_entry[tag_cnt].tag_type) && (strncmp(&(pItem->buff_start), tag_entry[tag_cnt].tag, pItem->tag_len) == 0) ) {
+            *match_idx = tag_cnt;
+
+            return KAL_TRUE;
+        }
+
+        tag_cnt++;
+    }
+
+    return KAL_FALSE;
+}
+
+_STATIC kal_bool mcf_v2_check_tag_match(
+    mcf_tool_gid_tlvota_file_item_t *pItem,
+    mcf_tlvota_tag_t *tag_entry,
+    kal_uint32 tag_num,
+    kal_uint32 *match_idx)
+{
+    kal_uint32  tag_cnt = 0;
+
+    ASSERT(pItem);
+    ASSERT(tag_entry);
+    ASSERT(tag_num >= 0);
+
+    while(tag_cnt < tag_num) {
+        if ( (pItem->tag_type == tag_entry[tag_cnt].tag_type) && (strncmp(&(pItem->buff_start), tag_entry[tag_cnt].tag, pItem->tag_len) == 0) ) {
+            *match_idx = tag_cnt;
+
+            return KAL_TRUE;
+        }
+
+        tag_cnt++;
+    }
+
+    return KAL_FALSE;
+}
+
+_STATIC mcf_ota_result_e mcf_fill_tag_entry(mcf_tlvota_sbp_tag_t sbp_tag, kal_bool is_general, mcf_tlvota_tag_t *tag_entry, kal_uint32 *tag_num)
+{
+    mcf_ota_result_e                    ret = MCF_OTA_R_SUCCESS;
+    static kal_char                     tag[4][MCF_MAX_TAG_LEN];
+	kal_int32                           ret_snprintf;
+
+    kal_mem_set(tag, 0, sizeof(kal_char) * 4 * MCF_MAX_TAG_LEN);
+    *tag_num = 0;
+    /* Fill tag entry */
+    if (sbp_tag.sbp_id != SBP_ID_INVALID) {
+        if (strcmp((kal_char *)sbp_tag.mcc, "") != 0) {
+            if (strcmp((kal_char *)sbp_tag.mnc, "") != 0) { // sbpid_mcc_mnc case
+                /* NA_mcc_NA and NA_mcc_mnc case should be updated first */
+                if (is_general == KAL_TRUE){
+                    /* NA_mcc_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+
+                    /* NA_mcc_mnc */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_%s_%s", (kal_char *)sbp_tag.mcc, (kal_char *)sbp_tag.mnc);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_mcc_mnc", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+                }else{
+                    /* Reuse tag_entry */
+                    *tag_num = 0;
+                    /* NA_NA_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+
+                    /* sbpid_NA_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "%d_NA_NA", sbp_tag.sbp_id);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "SBP_NA_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+
+                    /* sbpid_mcc_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "%d_%s_NA", sbp_tag.sbp_id, sbp_tag.mcc);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "SBP_mcc_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+
+                    /* sbpid_mcc_mnc */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "%d_%s_%s", sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "SBP_mcc_mnc", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+                }
+            } else { // sbpid_mcc_NA case
+                /* NA_mcc_NA case should be updated first */
+                if (is_general == KAL_TRUE){
+                    /* NA_mcc_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+                }else{
+                    /* Reuse tag_entry */
+                    *tag_num = 0;
+                    /* NA_NA_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+
+                    /* sbpid_NA_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "%d_NA_NA", sbp_tag.sbp_id);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "SBP_NA_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+
+                    /* sbpid_mcc_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "%d_%s_NA", sbp_tag.sbp_id, sbp_tag.mcc);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "SBP_mcc_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+                }
+            }
+        } else {
+            if (strcmp((kal_char *)sbp_tag.mnc, "") == 0) { // sbpid_NA_NA case
+                if (is_general == KAL_FALSE){
+                    /* NA_NA_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+
+                    /* sbpid_NA_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "%d_NA_NA", sbp_tag.sbp_id);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "SBP_NA_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+                }
+            } else { // sbpid_NA_mnc case is not allowed!!
+                MD_TRC_MCF_TR_FILL_TAG_ENTRY_INVALID_SBP_TAG(sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                ret = MCF_OTA_R_INVALID_SBP_TAG;
+
+                return ret;
+            }
+        }
+    } else {
+        if (strcmp((kal_char *)sbp_tag.mcc, "") != 0) {
+            if (strcmp((kal_char *)sbp_tag.mnc, "") != 0) { // NA_mcc_mnc case
+                /* NA_mcc_NA and NA_mcc_mnc case should be updated first */
+                if (is_general == KAL_TRUE){
+                    /* NA_mcc_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+
+                    /* NA_mcc_mnc */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_%s_%s", (kal_char *)sbp_tag.mcc, (kal_char *)sbp_tag.mnc);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_mcc_mnc", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+                }else{
+                    /* Reuse tag_entry */
+                    *tag_num = 0;
+                    /* NA_NA_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+                }
+            } else { // NA_mcc_NA case
+                /* NA_mcc_NA and NA_mcc_mnc case should be updated first */
+                if (is_general == KAL_TRUE){
+                    /* NA_mcc_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+
+                }else{
+                    /* Reuse tag_entry */
+                    *tag_num = 0;
+                    /* NA_NA_NA */
+                    tag_entry[*tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                    ret_snprintf = kal_snprintf(tag[*tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+					if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+						strncpy(tag[*tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+						MD_TRC_MCF_TR_FILL_TAG_ENTRY_SNPRINTF_FAIL(tag[*tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+					}
+                    tag_entry[*tag_num].tag_len = strlen(tag[*tag_num]);
+                    tag_entry[*tag_num].tag = tag[*tag_num];
+                    *tag_num = *tag_num +1;
+                }
+            }
+        } else { // NA_NA_mnc cases is not allowed!!
+            MD_TRC_MCF_TR_FILL_TAG_ENTRY_INVALID_SBP_TAG(sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+            ret = MCF_OTA_R_INVALID_SBP_TAG;
+
+            return ret;
+        }
+    }
+    return ret;
+}
+_STATIC void mcf_v1_read_tlvota_buffer_tag_update_flow(mcf_tlvota_file_t *tlvota_file, mcf_tlvota_tag_t *tag_entry, kal_uint32 tag_num, nvram_lid_enum lid, kal_uint8 *buffer)
+{
+    mcf_tool_file_info_t           *pFile;
+    mcf_tool_tlvota_file_item_t    *pItem;
+    kal_uint16                      item_cnt = 0;
+    kal_uint16                      item_byte_offset;
+    kal_uint16                      item_bit_offset;
+    kal_uint32                      item_size;
+    kal_uint32                      match_idx;
+    kal_char                        item_tag[MCF_FILE_MAX_TAG_LEN] = {0};
+    mcf_tag_info_struct             unuse = {0};
+    MCF_DB_STRUCT_VARIABLE          const *unuse_db_ptr = NULL;
+    
+    pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+    pItem = (mcf_tool_tlvota_file_item_t *)(tlvota_file->buff + pFile->total_len);
+    /* Read changed items from TLV-OTA file */
+    while (item_cnt < pFile->item_num) {
+        /* Check if LID and tag match */       
+        if ( (pItem->lid != lid) || (mcf_check_tag_match(pItem, tag_entry, tag_num, &match_idx) == KAL_FALSE) ) {
+            goto next;
+        }
+
+        /* Check if item_tag_len is valid */
+        if ( (pItem->item_tag_len <= 0) || (pItem->item_tag_len >= MCF_FILE_MAX_TAG_LEN-1) ) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_TAG_LEN(pItem->item_tag_len, MCF_FILE_MAX_TAG_LEN);
+            mcf_utfwk_printf("Invalid item_tag_len(%d)!! max item_tag_len(%d) \r\n", pItem->item_tag_len, MCF_FILE_MAX_TAG_LEN);
+            goto next;
+        }
+
+        /* Update LID item */
+        if (pItem->is_bit_op == 0) {
+            strncpy(item_tag, &(pItem->buff_start) + pItem->tag_len, pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            if (mcf_find_tag_offset(lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if (pItem->op.byte.value_len > item_size) {
+                MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_LARGE_VAL_LEN(pItem->op.byte.value_len, item_size);
+                mcf_utfwk_printf("Invalid value len(%d)!! larger than current item len(%d) \r\n", pItem->op.byte.value_len, item_size);
+
+                goto next;
+            }
+
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BYTE_UPDATE(lid, tag_entry[match_idx].tag, item_byte_offset, pItem->op.byte.value_len);
+            mcf_dump_data(KAL_FALSE, &(pItem->buff_start) + pItem->tag_len + pItem->item_tag_len, pItem->op.byte.value_len);
+
+            kal_mem_cpy( (buffer + item_byte_offset), &(pItem->buff_start) + pItem->tag_len + pItem->item_tag_len, pItem->op.byte.value_len);
+        } else {
+            kal_uint32 bit_value = 0;
+            kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(pItem->op.bit.len);
+
+            kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->tag_len + pItem->item_tag_len, pItem->op.bit.value_len);
+
+            strncpy(item_tag, &(pItem->buff_start) + pItem->tag_len, pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            if (mcf_find_tag_offset(lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if ( (pItem->op.bit.value_len > 4) || (pItem->op.bit.len > item_size) ) {
+                MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_BIT_LEN(pItem->op.bit.len, item_size, pItem->op.bit.value_len);
+
+                goto next;
+            }
+
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BIT_UPDATE(lid, tag_entry[match_idx].tag, item_byte_offset, item_bit_offset, pItem->op.bit.len, pItem->op.bit.value_len, bit_value);
+
+            if (pItem->op.bit.value_len == 1) {
+                kal_uint8 *val_tmp = (kal_uint8 *)(buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 2) {
+                kal_uint16 *val_tmp = (kal_uint16 *)(buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 4) {
+                kal_uint32 *val_tmp = (kal_uint32 *)(buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            }
+        }
+
+next:
+        pItem = (mcf_tool_tlvota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+        item_cnt++;
+    }
+    MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+}
+
+_STATIC mcf_ota_result_e mcf_read_tlvota_buffer_multi_tag(
+    kal_uint8 ps_id,
+    mcf_tlvota_tag_t *tag_entry,
+    kal_uint32 tag_num,
+    nvram_lid_enum lid,
+    kal_uint8 *buffer,
+    kal_uint32 size)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t               *pFile;
+    mcf_tool_gid_tlvota_file_item_t    *pItem;
+    sim_interface_enum                  sim_id = l4c_gemini_get_actual_sim_id(ps_id);
+    mcf_tlvota_file_t                  *tlvota_file = &(pMcf->general_tlvota_file);
+    nvram_ltable_entry_struct           lid_info;
+    kal_uint16                          item_cnt = 0;
+    kal_uint32                          match_idx;
+    nvram_errno_enum                    nvram_api_ret;
+    mcf_ota_result_e                    ret = MCF_OTA_R_SUCCESS;
+    kal_uint16                          item_byte_offset;
+    kal_uint16                          item_bit_offset;
+    kal_uint32                          item_size;
+    kal_char                            array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_bool                            item_is_bit = KAL_FALSE;
+    kal_uint16                          item_lid;
+
+    ASSERT(buffer);
+    ASSERT(size > 0);
+    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_START(ps_id, sim_id, tag_num);
+
+    MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+
+        /* Check if file type is TLV-OTA file */
+        if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+            kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+
+            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_FILE(str_tmp);
+            ret = MCF_OTA_R_INVALID_FILE;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        nvram_api_ret = nvram_external_get_lid_info(lid, &lid_info);
+        if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_GET_LID_INFO_FAIL(lid, nvram_api_ret);
+            mcf_utfwk_printf("Fail to get LID information!! LID(%d), nvram_api_ret(%d) \r\n", lid, nvram_api_ret);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        if (size != lid_info.size) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_SIZE(size, lid, lid_info.size);
+            mcf_utfwk_printf("Invalid buffer_size(%d)!! LID(%d), record_size(%d) \r\n", size, lid, lid_info.size);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        if ( (lid_info.attr & NVRAM_ATTR_MCF_OTA_BY_OP) == 0 ) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_ATTR_NOT_SET(lid, lid_info.attr);
+            mcf_utfwk_printf("ERROR!! OTA by op attribute is not set! LID(%d), attribute(%x) \r\n", lid, lid_info.attr);
+            ret = MCF_OTA_R_INVALID_ATTR;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+        if (pFile->file_version == 2){
+            mcf_v1_read_tlvota_buffer_tag_update_flow(tlvota_file, tag_entry, tag_num, lid, buffer);
+        }else if (pFile->file_version == 3){
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + pFile->total_len);
+            /* Read changed items from TLV-OTA file */
+            while (item_cnt < pFile->item_num) {
+                /* Check if array_index_len is valid */
+                if ( (pItem->array_index_len < 0) || (pItem->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_ARRAY_INDEX_LEN(pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    mcf_utfwk_printf("Invalid array_index_len(%d)!! max array_index_len(%d) \r\n", pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    goto next;
+                }
+                strncpy(array_tag, &(pItem->buff_start)+pItem->tag_len, pItem->array_index_len);
+                array_tag[pItem->array_index_len] = '\0';
+
+                /* Find GID corresponding LID */
+                item_lid = mcf_find_gid_return_lid_num(pItem->global_id);
+                if (item_lid == 65535){
+                    //-1(65535) means not found
+                    goto next;
+                }
+                
+                /* Check if LID and tag match */
+                if ( (item_lid != lid) || (mcf_v2_check_tag_match(pItem, tag_entry, tag_num, &match_idx) == KAL_FALSE) ) {
+                    goto next;
+                }
+
+
+                if(mcf_find_gid_offset(pItem->global_id, array_tag, &item_lid, &item_byte_offset, &item_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                    goto next;
+                }
+
+                /* Update LID item */
+                if (item_is_bit == 0) {
+                    if (pItem->value_len > item_size) {
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_LARGE_VAL_LEN(pItem->value_len, item_size);
+                        mcf_utfwk_printf("Invalid value len(%d)!! larger than current item len(%d) \r\n", pItem->value_len, item_size);
+
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BYTE_UPDATE(lid, tag_entry[match_idx].tag, item_byte_offset, pItem->value_len);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BYTE_UPDATE, lid, tag_entry[match_idx].tag, item_byte_offset, pItem->value_len);
+                    mcf_dump_data(KAL_TRUE, &(pItem->buff_start) + pItem->tag_len + pItem->array_index_len, pItem->value_len);
+
+                    kal_mem_cpy( (buffer + item_byte_offset), &(pItem->buff_start) + pItem->tag_len + pItem->array_index_len, pItem->value_len);
+					nv_int_info.update_general_tlvota_result = KAL_TRUE;
+                } else {
+                    kal_uint32 bit_value = 0;
+                    kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(item_size);
+					kal_uint32 offset = 0;
+					kal_uint32 var_size = 1;
+					kal_uint32 val_tmp = 0;
+
+                    kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->tag_len + pItem->array_index_len, pItem->value_len);
+
+                    if (pItem->value_len > 4) {
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_BIT_LEN(pItem->value_len, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BIT_UPDATE(lid, tag_entry[match_idx].tag, item_byte_offset, item_bit_offset, item_size, pItem->value_len, bit_value);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_BUFFER_MULTI_TAG_BIT_UPDATE, lid, tag_entry[match_idx].tag, item_byte_offset, item_bit_offset, item_size, pItem->value_len, bit_value);
+                    
+                    if (item_size > 8 && item_size <= 16) {
+                        var_size = 2;
+                    }else if (item_size > 16 && item_size <= 24) {
+                        var_size = 3;
+                    }else if (item_size > 24 && item_size <= 32) {
+                        var_size = 4;
+                    }
+
+                    if (item_bit_offset > 0 && item_bit_offset < 8) {
+                        offset = 0;
+                    }else if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        offset = 1;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        offset = 2;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        offset = 3;
+                    }else if (item_bit_offset >= 32){
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_BIT_OFFSET(item_bit_offset, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    if (item_bit_offset > 0) {
+                        if ((item_bit_offset) / 8 != (item_size + item_bit_offset) / 8) {
+                            var_size += ((item_size + item_bit_offset) / 8 - item_bit_offset / 8);
+                        }
+                    }
+                    if(var_size > 4){
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_INVALID_BIT_LEN(var_size, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        item_bit_offset -= 8;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        item_bit_offset -= 16;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        item_bit_offset -= 24;
+                    }
+
+
+                    kal_mem_cpy(&val_tmp, buffer + item_byte_offset + offset, var_size);
+                    val_tmp &= ~(bit_mask << item_bit_offset);
+                    val_tmp |= (bit_value << item_bit_offset);
+
+                    kal_mem_cpy(buffer + item_byte_offset + offset, &val_tmp, var_size);
+					nv_int_info.update_general_tlvota_result = KAL_TRUE;
+                }
+
+        next:
+                pItem = (mcf_tool_gid_tlvota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+                item_cnt++;
+            }
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }
+    } else {
+        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_MULTI_TAG_TAKE_READ_LOCK_FAIL();
+        mcf_utfwk_printf("Fail to take read lock!! \r\n");
+        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+    }
+
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_read_tlvota_buffer_sbp_multi_tag(
+    kal_uint8 ps_id,
+    mcf_tlvota_tag_t *tag_entry,
+    kal_uint32 tag_num,
+    nvram_lid_enum lid,
+    kal_uint8 *buffer,
+    kal_uint32 size)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t               *pFile;
+    mcf_tool_gid_tlvota_file_item_t    *pItem;
+    sim_interface_enum                  sim_id = l4c_gemini_get_actual_sim_id(ps_id);
+    mcf_tlvota_file_t                  *tlvota_file;
+    nvram_ltable_entry_struct           lid_info;
+    kal_uint16                          item_cnt = 0;
+    kal_uint32                          match_idx;
+    nvram_errno_enum                    nvram_api_ret;
+    mcf_ota_result_e                    ret = MCF_OTA_R_SUCCESS;
+    kal_uint16                          item_byte_offset;
+    kal_uint16                          item_bit_offset;
+    kal_uint32                          item_size;
+    kal_char                            array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_bool                            item_is_bit = KAL_FALSE;
+    kal_uint16                          item_lid;
+
+    ASSERT(buffer);
+    ASSERT(size > 0);
+    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_START(ps_id, sim_id, tag_num);
+    
+    if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+		MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_SIM_ID(ps_id, sim_id);
+		ret = MCF_OTA_R_INVALID_PARAMETER;
+
+		return ret;
+	}
+    tlvota_file = &(pMcf->tlvota_file[sim_id]);
+
+    MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+
+        /* Check if file type is TLV-OTA file */
+        if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+            kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+
+            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_FILE(str_tmp);
+            ret = MCF_OTA_R_INVALID_FILE;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        nvram_api_ret = nvram_external_get_lid_info(lid, &lid_info);
+        if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_GET_LID_INFO_FAIL(lid, nvram_api_ret);
+            mcf_utfwk_printf("Fail to get LID information!! LID(%d), nvram_api_ret(%d) \r\n", lid, nvram_api_ret);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        if (size != lid_info.size) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_SIZE(size, lid, lid_info.size);
+            mcf_utfwk_printf("Invalid buffer_size(%d)!! LID(%d), record_size(%d) \r\n", size, lid, lid_info.size);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        if ( (lid_info.attr & NVRAM_ATTR_MCF_OTA_BY_OP) == 0 ) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_ATTR_NOT_SET(lid, lid_info.attr);
+            mcf_utfwk_printf("ERROR!! OTA by op attribute is not set! LID(%d), attribute(%x) \r\n", lid, lid_info.attr);
+            ret = MCF_OTA_R_INVALID_ATTR;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+        if (pFile->file_version == 2){
+            mcf_v1_read_tlvota_buffer_tag_update_flow(tlvota_file, tag_entry, tag_num, lid, buffer);
+        }else if (pFile->file_version == 3){
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + pFile->total_len);
+            /* Read changed items from TLV-OTA file */
+            while (item_cnt < pFile->item_num) {
+                /* Check if array_index_len is valid */
+                if ( (pItem->array_index_len < 0) || (pItem->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_ARRAY_INDEX_LEN(pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    goto next;
+                }
+                strncpy(array_tag, &(pItem->buff_start)+pItem->tag_len, pItem->array_index_len);
+                array_tag[pItem->array_index_len] = '\0';
+                
+                /* Find GID corresponding LID */
+                item_lid = mcf_find_gid_return_lid_num(pItem->global_id);
+                if (item_lid == 65535){
+                    //-1(65535) means not found
+                    goto next;
+                }
+
+                /* Check if LID and tag match */
+                if ( (item_lid != lid) || (mcf_v2_check_tag_match(pItem, tag_entry, tag_num, &match_idx) == KAL_FALSE) ) {
+                    goto next;
+                }
+                
+                if(mcf_find_gid_offset(pItem->global_id, array_tag, &item_lid, &item_byte_offset, &item_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                    goto next;
+                }
+
+                /* Update LID item */
+                if (item_is_bit == 0) {
+                    if (pItem->value_len > item_size) {
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_LARGE_VAL_LEN(pItem->value_len, item_size);
+                        mcf_utfwk_printf("Invalid value len(%d)!! larger than current item len(%d) \r\n", pItem->value_len, item_size);
+
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_BYTE_UPDATE(lid, tag_entry[match_idx].tag, item_byte_offset, pItem->value_len);
+                    mcf_dump_data(KAL_FALSE, &(pItem->buff_start) + pItem->tag_len + pItem->array_index_len, pItem->value_len);
+
+                    kal_mem_cpy( (buffer + item_byte_offset), &(pItem->buff_start) + pItem->tag_len + pItem->array_index_len, pItem->value_len);
+					nv_int_info.update_tlvota_result[sim_id] = KAL_TRUE;
+                } else {
+                    kal_uint32 bit_value = 0;
+                    kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(item_size);
+					kal_uint32 offset = 0;
+					kal_uint32 var_size = 1;
+					kal_uint32 val_tmp = 0;
+
+                    kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->tag_len + pItem->array_index_len, pItem->value_len);
+
+                    if (pItem->value_len > 4) {
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_BIT_LEN(pItem->value_len, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_BIT_UPDATE(lid, tag_entry[match_idx].tag, item_byte_offset, item_bit_offset, item_size, pItem->value_len, bit_value);
+
+                    if (item_size > 8 && item_size <= 16) {
+                        var_size = 2;
+                    }else if (item_size > 16 && item_size <= 24) {
+                        var_size = 3;
+                    }else if (item_size > 24 && item_size <= 32) {
+                        var_size = 4;
+                    }
+
+                    if (item_bit_offset > 0 && item_bit_offset < 8) {
+                        offset = 0;
+                    }else if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        offset = 1;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        offset = 2;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        offset = 3;
+                    }else if (item_bit_offset >= 32){
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_BIT_OFFSET(item_bit_offset, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    if (item_bit_offset > 0) {
+                        if ((item_bit_offset) / 8 != (item_size + item_bit_offset) / 8) {
+                            var_size += ((item_size + item_bit_offset) / 8 - item_bit_offset / 8);
+                        }
+                    }
+                    if(var_size > 4){
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_INVALID_BIT_LEN(var_size, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        item_bit_offset -= 8;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        item_bit_offset -= 16;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        item_bit_offset -= 24;
+                    }
+
+
+                    kal_mem_cpy(&val_tmp, buffer + item_byte_offset + offset, var_size);
+                    val_tmp &= ~(bit_mask << item_bit_offset);
+                    val_tmp |= (bit_value << item_bit_offset);
+
+                    kal_mem_cpy(buffer + item_byte_offset + offset, &val_tmp, var_size);
+					nv_int_info.update_tlvota_result[sim_id] = KAL_TRUE;
+                }
+
+        next:
+                pItem = (mcf_tool_gid_tlvota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+                item_cnt++;
+            }
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }
+    } else {
+        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_MULTI_TAG_TAKE_READ_LOCK_FAIL();
+        mcf_utfwk_printf("Fail to take read lock!! \r\n");
+        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+    }
+
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_set_dsbp_mode(kal_bool is_ignore_dsbp, kal_bool is_general, sim_interface_enum sim_id)
+{
+    mcf_ota_result_e            ret = MCF_OTA_R_SUCCESS;
+	
+	MD_TRC_MCF_TR_SET_DSBP_MODE_START(is_ignore_dsbp, is_general, sim_id);
+    
+    if(sim_id < 0 || sim_id >= MAX_SIM_NUM){
+        MD_TRC_MCF_TR_SET_DSBP_MODE_INVALID_SIM_ID(sim_id);
+    }
+    
+    kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+    /* Read MCF SW information in NVRAM */
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+        MD_TRC_MCF_TR_SET_DSBP_MODE_READ_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+        ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+        return ret;
+    }
+    
+    if (is_general == KAL_FALSE){
+        if(sim_id >= 0 && sim_id < MAX_SIM_NUM){
+            nv_int_info.tlvota_is_ignore_dsbp[sim_id] = is_ignore_dsbp;
+        }
+    }else{
+        nv_int_info.general_is_ignore_dsbp = is_ignore_dsbp;
+    }
+
+    /* Write MCF SW information in NVRAM */
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+        MD_TRC_MCF_TR_SET_DSBP_MODE_WRITE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+        ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+        return ret;
+    }
+
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_set_not_reset(kal_bool not_reset, l4c_mcf_config_type_enum config_type, sim_interface_enum sim_id)
+{
+    mcf_ota_result_e            ret = MCF_OTA_R_SUCCESS;
+	
+	if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+        MD_TRC_MCF_TR_SET_NOT_RESET_INVALID_SIM_ID(sim_id);
+        ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return ret;
+    }
+    
+    kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+    /* Read MCF SW information in NVRAM */
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+        MD_TRC_MCF_TR_SET_NOT_RESET_READ_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+        ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+        return ret;
+    }
+
+    switch (config_type)
+    {
+        case L4C_MCF_CONFIG_TYPE_DEFAULT_BIN:
+            nv_int_info.not_reset_ota = not_reset;
+            break;
+        case L4C_MCF_CONFIG_TYPE_CARRIER_BIN:
+            nv_int_info.not_reset_tlvota[sim_id] = not_reset;
+            break;
+        case L4C_MCF_CONFIG_TYPE_GENERAL_CARRIER_BIN:
+            nv_int_info.not_reset_general_tlvota = not_reset;
+            break;
+        default:
+            MD_TRC_MCF_TR_SET_NOT_RESET_INVALID_CONFIG_TYPE(config_type);
+            ret = KAL_FALSE;
+            break;
+    }
+
+    /* Write MCF SW information in NVRAM */
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+        MD_TRC_MCF_TR_SET_NOT_RESET_WRITE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+        ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+        return ret;
+    }
+
+    return ret;
+}
+
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+_STATIC mcf_ota_result_e mcf_store_tlvota_modified_lid(sim_interface_enum sim_id, mcf_tlvota_sbp_tag_t sbp_tag, kal_bool is_general)
+#else
+_STATIC mcf_ota_result_e mcf_store_tlvota_modified_lid(sim_interface_enum sim_id, mcf_tlvota_sbp_tag_t sbp_tag, kal_bool is_general, kal_bool not_reset, kal_bool set_combined)
+#endif
+{
+    mcf_t                                  *pMcf = mcf_get_instance();
+    mcf_ota_result_e                        ret = MCF_OTA_R_SUCCESS;
+    mcf_tlvota_tag_t                        tag_entry[4];
+    kal_uint32                              tag_num = 0;
+    kal_uint16                              pre_LID = 0;
+    kal_int16                               pos = -1;
+    kal_uint16                              in_pos = 0;
+    mcf_tool_file_info_t                   *pFile;
+    mcf_tool_gid_tlvota_file_item_t        *pItem;
+    nvram_ltable_entry_struct               lid_info;
+    kal_uint16                              item_cnt = 0;
+    kal_uint32                              match_idx;
+    nvram_errno_enum                        nvram_api_ret;
+    kal_uint16                              dummy_byte_offset;
+    kal_uint16                              dummy_bit_offset;
+    kal_uint32                              dummy_size;
+    kal_bool                                dummy_is_bit;
+    kal_char                                array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_uint16                              item_lid = 65535;
+    mcf_tlvota_file_t                      *tlvota_file;
+	mcf_tlvota_tag_t                        iccid_tag;
+	kal_char                                iccid[21];
+
+    MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_START(sim_id, sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc, is_general);
+
+    #if defined(__MCF_COMBINE_FILE_SUPPORT__)
+    MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_NOT_RESET(not_reset);
+#endif
+
+	if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+		MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_INVALID_SIM_ID(sim_id);
+		ret = MCF_OTA_R_INVALID_PARAMETER;
+
+		return ret;
+	}
+    
+    kal_mem_set(tag_entry, 0, sizeof(mcf_tlvota_tag_t) * 4);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g[sim_id], 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    kal_mem_set(&mcf_general_tlvota_curr_mod_lid_g[sim_id], 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    kal_mem_set(&iccid_tag, 0, sizeof(mcf_tlvota_tag_t));
+    
+    ret = mcf_fill_tag_entry(sbp_tag, is_general, tag_entry, &tag_num);
+    if (ret != MCF_OTA_R_SUCCESS){
+        return ret;
+    }
+	tlvota_file = &(pMcf->tlvota_file[sim_id]);
+    if (is_general == KAL_TRUE){
+		if (com_Mcf.is_iccid == KAL_TRUE){
+			kal_mem_set(&iccid_tag, 0, sizeof(mcf_tlvota_tag_t));
+			iccid_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+			
+			MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			if (tlvota_file){
+				kal_mem_cpy(&iccid, tlvota_file->iccid, 21);
+				iccid_tag.tag = iccid;
+				iccid_tag.tag_len = strlen((kal_char *)tlvota_file->iccid);
+				
+				MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			}else {
+				MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_TAKE_READ_LOCK_FAIL();
+				ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+				return ret;
+			}
+		}
+		
+		tlvota_file = &(pMcf->general_tlvota_file);
+    }
+    
+    MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+
+        /* Check if file type is TLV-OTA file */
+        if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+            kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+
+            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+            MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_INVALID_FILE(str_tmp);
+            ret = MCF_OTA_R_INVALID_FILE;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }else{
+			if (pFile->file_version == 3){
+				pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + pFile->total_len);
+				/* Read changed LID from TLV-OTA file */
+				while (item_cnt < pFile->item_num) {
+					/* Check if array_index_len is valid */
+					if ( (pItem->array_index_len < 0) || (pItem->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+						MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_INVALID_ARRAY_INDEX_LEN(pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+						goto next;
+					}
+					strncpy(array_tag, &(pItem->buff_start)+pItem->tag_len, pItem->array_index_len);
+					array_tag[pItem->array_index_len] = '\0';
+					
+					/* Find GID corresponding LID */
+					item_lid = mcf_find_gid_return_lid_num(pItem->global_id);
+					if (item_lid == 65535){
+						//-1(65535) means not found
+						goto next;
+					}
+					
+					if ( (item_lid == pre_LID)){
+						goto next;
+					}
+
+					/* Check if LID and tag match */
+					if ((mcf_v2_check_tag_match(pItem, tag_entry, tag_num, &match_idx) == KAL_FALSE) ) {
+						if (com_Mcf.is_iccid == KAL_TRUE){
+							if ((pItem->tag_type != iccid_tag.tag_type) || (strncmp(&(pItem->buff_start), iccid_tag.tag, pItem->tag_len) != 0) ) {
+								goto next;
+							}
+						}else{
+							goto next;
+						}
+					}
+
+					if(mcf_find_gid_offset(pItem->global_id, array_tag, &item_lid, &dummy_byte_offset, &dummy_bit_offset, &dummy_size, &dummy_is_bit) == KAL_FALSE){
+						goto next;
+					}
+					
+					/* Store last time modified LID */
+					nvram_api_ret = nvram_external_get_lid_info(item_lid, &lid_info);
+					if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+						MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_GET_LID_INFO_FAIL(item_lid, nvram_api_ret);
+						ret = KAL_FALSE;
+						goto next;
+					}
+					if ( ((lid_info.attr & NVRAM_ATTR_MCF_OTA_BY_OP) != 0)) {
+						if (((lid_info.attr & NVRAM_ATTR_OTA_RESET) == 0)){
+							MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_RESET_ATTR_NOT_SET(item_lid, lid_info.attr);
+						}
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+						if (is_general == KAL_FALSE){
+							if (mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+								pos = mcf_binary_search_lid(item_lid, mcf_tlvota_curr_mod_lid_g[sim_id].lid, mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt, &in_pos);
+								MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID(item_lid, pos);
+								if (pos == -1) {
+									if(mcf_insert_lid(item_lid, mcf_tlvota_curr_mod_lid_g[sim_id].lid, mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt, in_pos) != KAL_TRUE){
+										MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID_FAIL(item_lid);
+									}else{
+										MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_STORE_LID(item_lid, in_pos, sim_id);
+									}
+									mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt++;
+								}
+							}
+						}else{
+							if (mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+								pos = mcf_binary_search_lid(item_lid, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt, &in_pos);
+								MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID(item_lid, pos);
+								if (pos == -1) {
+									if(mcf_insert_lid(item_lid, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt, in_pos) != KAL_TRUE){
+										MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID_FAIL(item_lid);
+									}else{
+										MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_STORE_LID(item_lid, in_pos, sim_id);
+									}
+									mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt++;
+								}
+							}
+						}
+#else
+						if (is_general == KAL_FALSE){
+							if (mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+								pos = mcf_binary_search_lid_struct(item_lid, mcf_tlvota_curr_mod_lid_g[sim_id].lid_conf, mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt, &in_pos);
+								MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID(item_lid, pos);
+								if (pos == -1) {
+									if(mcf_insert_lid_struct(item_lid, mcf_tlvota_curr_mod_lid_g[sim_id].lid_conf, mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt, in_pos, not_reset, set_combined) != KAL_TRUE){
+										MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID_FAIL(item_lid);
+									}else{
+										MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_STORE_LID(item_lid, in_pos, sim_id);
+									}
+									mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt++;
+								}
+							}
+						}else{
+							if (mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+								pos = mcf_binary_search_lid_struct(item_lid, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_conf, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt, &in_pos);
+								MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID(item_lid, pos);
+								if (pos == -1) {
+									if(mcf_insert_lid_struct(item_lid, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_conf, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt, in_pos, not_reset, set_combined) != KAL_TRUE){
+										MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_SEARCH_STORE_LID_FAIL(item_lid);
+									}else{
+										MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_STORE_LID(item_lid, in_pos, sim_id);
+									}
+									mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt++;
+								}
+							}
+						}
+#endif
+						
+					}
+
+			next:
+					pre_LID = item_lid;
+					pItem = (mcf_tool_gid_tlvota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+					item_cnt++;
+				}
+				
+			}else{
+				//File version is not 3
+				MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_INVALID_FILE_VERSION(pFile->file_version);
+			}
+			MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		}
+    } else {
+        MD_TRC_MCF_TR_STORE_TLVOTA_MODIFIED_LID_TAKE_READ_LOCK_FAIL();
+        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+		MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    }
+
+
+    return ret;
+}
+
+_STATIC void mcf_em_send_ota_file_info(em_mcf_read_ota_file_info_struct *read_file_info)
+{
+    ilm_struct                          ilm;
+    em_mcf_ota_file_info_ind_struct    *em_para_ptr = NULL;
+
+    if (com_Mcf.is_em_on == KAL_TRUE) {
+        em_para_ptr = (em_mcf_ota_file_info_ind_struct *)construct_local_para(sizeof(em_mcf_ota_file_info_ind_struct), TD_RESET);
+
+        em_para_ptr->em_info = MCF_EM_OTA_FILE_INFO;
+        kal_mem_cpy(&(em_para_ptr->read_file_info), read_file_info, sizeof(em_mcf_read_ota_file_info_struct));
+
+        ilm.src_mod_id      = MOD_MCF;
+        ilm.dest_mod_id     = MOD_DHL;
+        ilm.msg_id          = MSG_ID_EM_MCF_OTA_FILE_INFO_IND;
+        ilm.sap_id          = EM_PS_SAP;
+        ilm.local_para_ptr  = (local_para_struct *)em_para_ptr;
+        ilm.peer_buff_ptr   = NULL;
+
+        dhl_EM_logger(&ilm);
+        destroy_ilm(&ilm);
+    } else {
+#ifdef __MT_FRAMEWORK_SUPPORT__
+        if (kal_query_systemInit() == KAL_TRUE) {
+            /* EM switch may not be ON in init stage */
+            em_para_ptr = (em_mcf_ota_file_info_ind_struct *)construct_local_para(sizeof(em_mcf_ota_file_info_ind_struct), TD_RESET);
+
+            em_para_ptr->em_info = MCF_EM_OTA_FILE_INFO;
+            kal_mem_cpy(&(em_para_ptr->read_file_info), read_file_info, sizeof(em_mcf_read_ota_file_info_struct));
+
+            msg_send6(MOD_MCF, /* src_mod_id */
+                    MOD_MT, /* dest_mod_id */
+                    MCF_SAP, /* sap_id */
+                    MSG_ID_EM_MCF_OTA_FILE_INFO_IND, /* msg_id */
+                    (local_para_struct*)em_para_ptr, /* local_para_ptr */
+                    NULL); /* peer_buff_ptr */
+        }
+#endif
+    }
+}
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+_STATIC mcf_ota_result_e mcf_combined_ota_file(l4c_mcf_set_config_req_struct *req)
+{
+	mcf_t                                         *pMcf = mcf_get_instance();
+	mcf_ota_result_e                               ret = MCF_OTA_R_SUCCESS;
+	kal_uint32                                     i;
+	sim_interface_enum                             sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+	mcf_tool_file_info_t                          *pFile;
+	kal_int32                                      fs_ret = FS_NO_ERROR;
+    static nvram_ef_mcf_ota_file_info_struct       nv_ota_file;
+    static nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+	static kal_char                                fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+	static kal_char                                curr_filename[MCF_FILE_MAX_NAME_LEN];
+	static kal_wchar                               filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+    kal_int32                                      fs_api_ret;
+    static kal_char                                apply_filename[MCF_FILE_MAX_NAME_LEN];
+	l4c_mcf_path_type_enum                         apply_path_type;
+    em_mcf_read_ota_file_info_struct               read_file_info;
+    kal_bool                                       read_file_fail = KAL_FALSE;
+	
+	kal_mem_set(mcf_file_buffer, 0, MCF_MAX_FILE_SIZE);
+	kal_mem_set(mcf_merge_buffer, 0, MCF_MAX_FILE_SIZE);
+    kal_mem_set(curr_filename, 0, MCF_FILE_MAX_NAME_LEN);
+    kal_mem_set(fs_root_path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+
+	switch (req->config_type)
+	{
+		case L4C_MCF_CONFIG_TYPE_DEFAULT_BIN:
+		{
+			mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+			kal_uint16                          pre_LID = 0;
+			kal_int16                           pos = -1;
+			kal_uint16                          in_pos = 0;
+			mcf_tool_gid_ota_file_item_t       *pItem;
+			nvram_ltable_entry_struct           lid_info;
+			kal_uint16                          item_cnt = 0;
+			nvram_errno_enum                    nvram_api_ret;
+			kal_uint16                          dummy_byte_offset;
+			kal_uint16                          dummy_bit_offset;
+			kal_uint32                          dummy_size;
+			kal_bool                            dummy_is_bit;
+			kal_char                            array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+			kal_uint16                          item_lid;
+			
+			if (strcmp((kal_char *)req->config1, "") != 0) {
+				if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+					strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				} else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+					strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				} else {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE_TYPE(req->path_type);
+					ret = MCF_OTA_R_INVALID_PARAMETER;
+
+					return ret;
+				}
+				strncpy(curr_filename, (kal_char *)req->config1, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				
+				/* Check if file is existed */
+				kal_wsprintf(filename, "%s\\%s\0", fs_root_path, curr_filename);
+
+				fs_api_ret = FS_GetAttributes(filename);
+				if (fs_api_ret < FS_NO_ERROR) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_FILE_NOT_EXIST(fs_root_path, curr_filename);
+					ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+					return ret;
+				}
+				
+				/* Read MCF Internal information in NVRAM */
+				if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+					ret = MCF_OTA_R_READ_NVRAM_FAIL;
+				}
+				
+				/* Write MCF OTA file information to NVRAM */
+				if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+					ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+					return ret;
+				}
+				
+				if(req->reset == KAL_TRUE){
+					//Need to reset LID
+                    nv_int_info.not_reset_ota = KAL_FALSE;
+                    
+                    //Clear LIDs which is add due to combine
+					if(mcf_clear_last_modified_lid(nv_int_info.last_mod_lid.lid_conf, &nv_int_info.last_mod_lid.lid_cnt) != KAL_TRUE){
+						ret = MCF_OTA_R_INVALID_PARAMETER;
+						return ret;
+					}
+                    
+                    /* Combine OTA file - Only apply one OTA file */	
+					ret = mcf_read_ota_file(KAL_FALSE, fs_root_path, curr_filename, &apply_path_type, apply_filename, pMcf);
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(fs_root_path, curr_filename);
+						return ret;
+					}
+					
+					/*Store LID which need to reset into last modified buffer*/
+					MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+					if (ota_file) {
+						pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+
+						/* Check if file type is OTA file */
+						if (strcmp(pFile->file_type, MCF_FILE_TYPE_OTA) != 0) {
+							kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+
+							mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+							MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE(str_tmp);
+							ret = MCF_OTA_R_INVALID_FILE;
+							MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+							return ret;
+						}
+
+						if (pFile->file_version == 3){
+							pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+							pItem = (mcf_tool_gid_ota_file_item_t *)(ota_file->buff + pFile->total_len);
+							/* Read changed items from OTA file */
+							while (item_cnt < pFile->item_num) {
+								if ( (pItem->array_index_len < 0) || (pItem->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+									MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_ARRAY_INDEX_LEN(pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+									goto next;
+								}
+								strncpy(array_tag, &(pItem->buff_start), pItem->array_index_len);
+								array_tag[pItem->array_index_len] = '\0';
+								
+								/* Find GID corresponding LID */
+								item_lid = mcf_find_gid_return_lid_num(pItem->global_id);
+								if (item_lid == 65535){
+									//-1(65535) means not found
+									goto next;
+								}
+								
+								if ( (item_lid == pre_LID)){
+									goto next;
+								}
+								
+								if(mcf_find_gid_offset(pItem->global_id, array_tag, &item_lid, &dummy_byte_offset, &dummy_bit_offset, &dummy_size, &dummy_is_bit) == KAL_FALSE){
+									goto next;
+								}
+								
+								/* Store last time modified LID */
+								nvram_api_ret = nvram_external_get_lid_info(item_lid, &lid_info);
+								if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+									MD_TRC_MCF_TR_COMBINED_OTA_FILE_GET_LID_INFO_FAIL(item_lid, nvram_api_ret);
+									ret = MCF_OTA_R_INVALID_PARAMETER;
+									goto next;
+								}
+								/* Store reset LIDs into last time modified LID */
+								if ( ((lid_info.attr & NVRAM_ATTR_OTA_RESET) != 0)
+										&& (((lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) || ((lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0)) ) {
+									if (nv_int_info.last_mod_lid.lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+										pos = mcf_binary_search_lid_struct(item_lid, nv_int_info.last_mod_lid.lid_conf, nv_int_info.last_mod_lid.lid_cnt, &in_pos);
+                                        MD_TRC_MCF_TR_COMBINED_OTA_FILE_SEARCH_STORE_LID(item_lid, pos);
+										if (pos == -1) {
+											if(mcf_insert_lid_struct(item_lid, nv_int_info.last_mod_lid.lid_conf, nv_int_info.last_mod_lid.lid_cnt, in_pos, KAL_FALSE, KAL_TRUE) != KAL_TRUE){
+												MD_TRC_MCF_TR_COMBINED_OTA_FILE_STORE_LID_FAIL(item_lid);
+											}else{
+												MD_TRC_MCF_TR_COMBINED_OTA_FILE_STORE_LID(item_lid, in_pos);
+											}
+											nv_int_info.last_mod_lid.lid_cnt++;
+										}
+									}
+								}
+
+						next:
+								pre_LID = item_lid;
+								pItem = (mcf_tool_gid_ota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+								item_cnt++;
+								
+							}
+						}
+						MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+						
+						if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+							MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+							ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+							return ret;
+						}
+					}
+
+				}else{
+					//Do not Need to reset LID
+                    nv_int_info.not_reset_ota = KAL_TRUE;
+                    
+                    /* Combine OTA file - Append OTA file*/
+					for(i = 0; i < nv_int_info.last_mod_lid.lid_cnt; i++){
+						if(nv_int_info.last_mod_lid.lid_conf[i].not_reset == KAL_FALSE && nv_int_info.last_mod_lid.lid_conf[i].set_combined == KAL_FALSE){
+							nv_int_info.last_mod_lid.lid_conf[i].not_reset = KAL_TRUE;
+						}
+					}
+                    ret = mcf_read_ota_file(KAL_FALSE, nv_ota_file.path, nv_ota_file.name, &apply_path_type, apply_filename, pMcf);
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(nv_ota_file.path, nv_ota_file.name);
+                        read_file_fail = KAL_TRUE;
+					}
+					MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+					if (ota_file) {
+						pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+
+						/* Check if file type is OTA file */ //If not OTA file, Construct empty file header
+						if (read_file_fail == KAL_TRUE || strcmp(pFile->file_type, MCF_FILE_TYPE_OTA) != 0) {
+							mcf_tool_file_info_t copy_header = {0};
+                            mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)mcf_file_buffer;
+                            
+							MD_TRC_MCF_TR_COMBINED_OTA_FILE_MERGE_OTA_FILE();
+                            
+                            kal_mem_set(mcf_file_buffer, 0, MCF_MAX_FILE_SIZE);
+                            copy_header.file_version = 3;
+                            copy_header.operation_mask = 0;
+                            mcf_merge_make_ota_file_header(output_header, &copy_header); // copy first header to output header
+                            kal_mem_set(output_header->file_type, 0, 8);
+                            strncpy(output_header->file_type, MCF_FILE_TYPE_OTA, 7);
+                            output_header->item_num = 0;
+                            output_header->file_size = (kal_uint32)((kal_uint8 *)mcf_file_buffer + output_header->total_len - (kal_uint8 *)output_header);
+                            
+						}else{
+							kal_mem_cpy(mcf_file_buffer, ota_file->buff, MCF_MAX_OTA_FILE_SIZE);
+						}
+						MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+					}
+					ret = mcf_read_ota_file(KAL_FALSE, fs_root_path, curr_filename, &apply_path_type, apply_filename, pMcf);
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(fs_root_path, curr_filename);
+						return ret;
+					}
+					MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+					if (ota_file) {
+						pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+
+						/* Check if file type is OTA file */
+						if (strcmp(pFile->file_type, MCF_FILE_TYPE_OTA) != 0) {
+							kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+							mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+							MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE(str_tmp);
+							ret = MCF_OTA_R_INVALID_FILE;
+							MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+							return ret;
+						}
+						
+                        if(mcf_merge_ota_buffer(mcf_file_buffer, ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE) != KAL_TRUE){
+                            MD_TRC_MCF_TR_COMBINED_OTA_FILE_MERGE_OTA_FILE_FAIL();
+                            ret = MCF_OTA_R_INVALID_PARAMETER;
+                            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                            return ret;
+                        }
+						
+						MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+					}
+					strncpy(fs_root_path, nv_ota_file.merged_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+					strncpy(curr_filename, nv_ota_file.merged_name, MCF_FILE_MAX_NAME_LEN - 1);
+					
+					/* Before create merged OTA file, need to delete last time merged OTA file */
+					kal_wsprintf(merge_ota_name, "%s\\%s\0", fs_root_path, curr_filename);
+					fs_ret = FS_Delete(merge_ota_name);
+					
+					if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_DELETE_FILE_FAIL(fs_ret);
+						ret = MCF_OTA_R_WRITE_DISK_FAIL;
+						return ret;
+					}
+					pFile = (mcf_tool_file_info_t *)(mcf_merge_buffer);
+					if(pFile->file_size > MCF_MAX_OTA_FILE_SIZE){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE_SIZE(pFile->file_size, MCF_MAX_OTA_FILE_SIZE);
+						ret = MCF_OTA_R_INVALID_PARAMETER;
+						return ret;
+					}
+					ret = mcf_write_buffer(fs_root_path, curr_filename, (kal_uint8 *)mcf_merge_buffer, pFile->file_size);
+					if (ret != MCF_OTA_R_SUCCESS) {
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_FAIL(fs_root_path, curr_filename);
+						return ret;
+					}
+                    
+                    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+                        MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+                        ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                        return ret;
+                    }
+					
+				}
+				strncpy(nv_ota_file.path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				strncpy(nv_ota_file.name, curr_filename, MCF_FILE_MAX_NAME_LEN - 1);
+			}else{
+				/*Deactivate Combine OTA setting */
+
+				kal_mem_set(fs_root_path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+				kal_mem_set(curr_filename, 0, MCF_FILE_MAX_NAME_LEN);
+				kal_mem_set(nv_ota_file.path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+				kal_mem_set(nv_ota_file.name, 0, MCF_FILE_MAX_NAME_LEN);
+				
+				kal_mem_set(nv_ota_file.merged_path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+				kal_mem_set(nv_ota_file.merged_name, 0, MCF_FILE_MAX_NAME_LEN);
+				
+				nv_int_info.is_combined_ota = KAL_FALSE;
+                
+                //Need to reset LID
+                nv_int_info.not_reset_ota = KAL_FALSE;
+				
+				for(i = 0; i < nv_int_info.last_mod_lid.lid_cnt; i++){
+                    if(nv_int_info.last_mod_lid.lid_conf[i].not_reset == KAL_TRUE){
+						nv_int_info.last_mod_lid.lid_conf[i].not_reset = KAL_FALSE;
+                    }
+                }
+				
+				if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+					ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+					return ret;
+				}
+
+			}
+
+
+			if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+				MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+				ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+				return ret;
+			}
+		
+			break;
+		}
+
+		case L4C_MCF_CONFIG_TYPE_CARRIER_BIN:
+		{
+			mcf_tlvota_file_t                      *tlvota_file;
+			mcf_tlvota_sbp_tag_t                    sbp_tag;
+			
+			MD_TRC_MCF_TR_COMBINED_OTA_FILE_TLVOTA_START(sim_id);
+            
+            if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+                MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_SIM_ID(req->ps_id, sim_id);
+                ret = MCF_OTA_R_INVALID_PARAMETER;
+                return ret;
+            }
+            
+            tlvota_file = &(pMcf->tlvota_file[sim_id]);
+			
+			if (strcmp((kal_char *)req->config1, "") != 0) {
+				if (pMcf->is_ignore_dsbp[sim_id] == KAL_FALSE) {
+					/* If MCF is in DSBP passive mode, change to DSBP active mode */
+					ret = mcf_set_dsbp_mode(KAL_TRUE, KAL_FALSE, sim_id);
+					if (ret != MCF_OTA_R_SUCCESS) {
+						return ret;
+					}
+					pMcf->is_ignore_dsbp[sim_id] = KAL_TRUE;
+				}
+				if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+					strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				} else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+					strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				} else {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE(req->path_type);
+					ret = MCF_OTA_R_INVALID_PARAMETER;
+
+					return ret;
+				}
+				strncpy(curr_filename, (kal_char *)req->config1, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				
+				/* Check if file is existed */
+				kal_wsprintf(filename, "%s\\%s\0", fs_root_path, curr_filename);
+
+				fs_api_ret = FS_GetAttributes(filename);
+				if (fs_api_ret < FS_NO_ERROR) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_FILE_NOT_EXIST(fs_root_path, curr_filename);
+					ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+					return ret;
+				}
+				
+				/* Read MCF Internal information in NVRAM */
+				if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+					ret = MCF_OTA_R_READ_NVRAM_FAIL;
+				}
+				
+				/* Read MCF TLV-OTA file information in NVRAM */
+				if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+					ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+					return ret;
+				}
+				
+				if(req->reset == KAL_TRUE){
+					//Need to reset LID
+                    nv_int_info.not_reset_tlvota[sim_id] = KAL_FALSE;
+                    
+                    //Clear LIDs which is add due to combine
+                    if(mcf_clear_last_modified_lid(nv_int_info.tlvota_last_mod_lid[sim_id].lid_conf, &nv_int_info.tlvota_last_mod_lid[sim_id].lid_cnt) != KAL_TRUE){
+						ret = MCF_OTA_R_INVALID_PARAMETER;
+						return ret;
+					}
+                    
+                    /* Combine OTA file - Only apply one OTA file */
+					ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, fs_root_path, curr_filename, &apply_path_type, apply_filename, pMcf);
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(fs_root_path, curr_filename);
+						return ret;
+					}
+					
+					MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					if (tlvota_file){
+						sbp_tag.sbp_id = tlvota_file->sbp_id;
+						kal_mem_cpy(sbp_tag.mcc, tlvota_file->mcc, MAX_MCC_STR_LEN);
+						kal_mem_cpy(sbp_tag.mnc, tlvota_file->mnc, MAX_MNC_STR_LEN);
+						
+						MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+					}else {
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_TAKE_READ_LOCK_FAIL();
+						MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					}
+					
+					ret = mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_FALSE, KAL_FALSE, KAL_TRUE);
+					
+					kal_mem_cpy(&mcf_tlvota_last_mod_lid_g[sim_id], &nv_int_info.tlvota_last_mod_lid[sim_id], sizeof(nvram_mcf_lid_info_struct));
+					
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_STORE_LAST_LID_FAIL();
+						return ret;
+					}
+					
+					if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+						ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+						return ret;
+					}
+
+				}else{
+					//Do not need to reset LID
+                    nv_int_info.not_reset_tlvota[sim_id] = KAL_TRUE;
+                    
+                    /* Combine OTA file - Append OTA file*/
+					for(i = 0; i < nv_int_info.tlvota_last_mod_lid[sim_id].lid_cnt; i++){
+						if(nv_int_info.tlvota_last_mod_lid[sim_id].lid_conf[i].not_reset == KAL_FALSE && nv_int_info.tlvota_last_mod_lid[sim_id].lid_conf[i].set_combined == KAL_FALSE){
+							nv_int_info.tlvota_last_mod_lid[sim_id].lid_conf[i].not_reset = KAL_TRUE;
+						}
+					}
+                    ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, nv_tlvota_file.path, nv_tlvota_file.name, &apply_path_type, apply_filename, pMcf);
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(nv_tlvota_file.path, nv_tlvota_file.name);
+                        read_file_fail = KAL_TRUE;
+					}
+					MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					if (tlvota_file) {
+						pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+						/* Check if file type is TLV-OTA file */ //If not TLVOTA file, Construct empty file header
+						if (read_file_fail == KAL_TRUE || strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+							mcf_tool_file_info_t copy_header = {0};
+                            mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)mcf_file_buffer;
+                            
+							MD_TRC_MCF_TR_COMBINED_OTA_FILE_MERGE_OTA_FILE();
+                            
+                            kal_mem_set(mcf_file_buffer, 0, MCF_MAX_FILE_SIZE);
+                            copy_header.file_version = 3;
+                            copy_header.operation_mask = 0;
+                            mcf_merge_make_ota_file_header(output_header, &copy_header); // copy first header to output header
+                            kal_mem_set(output_header->file_type, 0, 8);
+                            strncpy(output_header->file_type, MCF_FILE_TYPE_TLVOTA, 7);
+                            output_header->item_num = 0;
+                            output_header->file_size = (kal_uint32)((kal_uint8 *)mcf_file_buffer + output_header->total_len - (kal_uint8 *)output_header);
+
+						}else{
+							kal_mem_cpy(mcf_file_buffer, tlvota_file->buff, MCF_MAX_TLVOTA_FILE_SIZE);
+						}
+						MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					}
+					ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, fs_root_path, curr_filename, &apply_path_type, apply_filename, pMcf);
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(fs_root_path, curr_filename);
+						return ret;
+					}
+					MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					if (tlvota_file) {
+						pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+						/* Check if file type is TLV-OTA file */ 
+						if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+							kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+                            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+							MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE(str_tmp);
+							ret = MCF_OTA_R_INVALID_FILE;
+							MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+							return ret;
+						}
+						
+                        if(mcf_merge_ota_buffer(mcf_file_buffer, tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE) != KAL_TRUE){
+                            MD_TRC_MCF_TR_COMBINED_OTA_FILE_MERGE_OTA_FILE_FAIL();
+                            ret = MCF_OTA_R_INVALID_PARAMETER;
+                            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                            return ret;
+                        }
+						
+						MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					}
+					strncpy(fs_root_path, nv_tlvota_file.merged_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+					strncpy(curr_filename, nv_tlvota_file.merged_name, MCF_FILE_MAX_NAME_LEN - 1);
+
+					/* Before create merged OTA file, need to delete last time merged OTA file */
+					kal_wsprintf(merge_ota_name, "%s\\%s\0", fs_root_path, curr_filename);
+					fs_ret = FS_Delete(merge_ota_name);
+					
+					if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_DELETE_FILE_FAIL(fs_ret);
+						ret = MCF_OTA_R_WRITE_DISK_FAIL;
+						return ret;
+					}
+					
+					pFile = (mcf_tool_file_info_t *)(mcf_merge_buffer);
+					if(pFile->file_size > MCF_MAX_TLVOTA_FILE_SIZE){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE_SIZE(pFile->file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+						ret = MCF_OTA_R_INVALID_PARAMETER;
+						return ret;
+					}
+					
+					ret = mcf_write_buffer(fs_root_path, curr_filename, (kal_uint8 *)mcf_merge_buffer, pFile->file_size);
+					if (ret != MCF_OTA_R_SUCCESS) {
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_FAIL(fs_root_path, curr_filename);
+						return ret;
+					}
+                    
+                    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+                        MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+                        ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                        return ret;
+                    }
+					
+				}
+				
+				if (req->trigger_dsbp == 1) {
+					/* Read TLV-OTA file */
+					kal_mem_set(&read_file_info, 0, sizeof(em_mcf_read_ota_file_info_struct));
+					read_file_info.trigger_type = EM_MCF_TRIGGER_TYPE_BY_AP;
+					read_file_info.config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+					read_file_info.ps_id = req->ps_id;
+					read_file_info.start_time = kal_get_systicks();
+
+					ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, fs_root_path, curr_filename, &apply_path_type, apply_filename, pMcf);
+                    // Store Read TLV-OTA file result for dsbp urc use
+                    set_op_read_ret[sim_id] = ret;
+					if (ret == MCF_OTA_R_SUCCESS) {
+						MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        if (tlvota_file) {
+                            read_file_info.path_type = tlvota_file->path_type;
+                            strncpy(read_file_info.file_name, (kal_char *)&(tlvota_file->relative_path_name), MCF_FILE_MAX_NAME_LEN - 1);
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        }
+                        is_read_tlvota[sim_id] = KAL_TRUE;
+					} else {
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(fs_root_path, curr_filename);
+					}
+
+					read_file_info.result = ret;
+					read_file_info.end_time = kal_get_systicks();
+
+					mcf_em_send_ota_file_info(&read_file_info);
+				}
+				
+				strncpy(nv_tlvota_file.path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				strncpy(nv_tlvota_file.name, curr_filename, MCF_FILE_MAX_NAME_LEN - 1);
+				
+			}else{
+				/*Deactivate Combine OTA setting */
+				if (pMcf->is_ignore_dsbp[sim_id] == KAL_TRUE) {
+					/* If MCF is in DSBP passive mode, change to DSBP active mode */
+					ret = mcf_set_dsbp_mode(KAL_FALSE, KAL_FALSE, sim_id);
+					if (ret != MCF_OTA_R_SUCCESS) {
+						return ret;
+					}
+					pMcf->is_ignore_dsbp[sim_id] = KAL_FALSE;
+				}
+				
+				kal_mem_set(fs_root_path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+				kal_mem_set(curr_filename, 0, MCF_FILE_MAX_NAME_LEN);
+				kal_mem_set(nv_tlvota_file.path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+				kal_mem_set(nv_tlvota_file.name, 0, MCF_FILE_MAX_NAME_LEN);
+
+				/* Deactivate TLV-OTA setting, reset combined setting */
+				nv_int_info.is_combined_tlvota[sim_id] = KAL_FALSE;
+				kal_mem_set(nv_tlvota_file.merged_path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+				kal_mem_set(nv_tlvota_file.merged_name, 0, MCF_FILE_MAX_NAME_LEN);
+                
+                //Need to reset LID
+                nv_int_info.not_reset_tlvota[sim_id] = KAL_FALSE;
+				
+				for(i = 0; i < nv_int_info.tlvota_last_mod_lid[sim_id].lid_cnt; i++){
+                    if(nv_int_info.tlvota_last_mod_lid[sim_id].lid_conf[i].not_reset == KAL_TRUE){
+						nv_int_info.tlvota_last_mod_lid[sim_id].lid_conf[i].not_reset = KAL_FALSE;
+                    }
+                }
+				
+				if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+					ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+					return ret;
+				}
+				
+				if (req->trigger_dsbp == 1) {
+					/* Deactivate TLV-OTA setting, reset TLV-OTA buffer */
+					MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					if (tlvota_file) {
+						kal_mem_set(tlvota_file->buff, 0, sizeof(kal_uint8) * MCF_MAX_TLVOTA_FILE_SIZE);
+						tlvota_file->path_type = req->path_type;
+						strncpy(tlvota_file->relative_path_name, "", MCF_FILE_MAX_NAME_LEN - 1);
+						kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+						MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					} else {
+						MD_TRC_MCF_TR_SET_FILE_PATH_RESET_BUFFER_FAIL();
+					}
+					is_read_tlvota[sim_id] = KAL_TRUE;
+				}
+
+			}
+
+
+			/* Write MCF TLV-OTA file information in NVRAM */
+			if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+				MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+				ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+				return ret;
+			}
+			
+			break;
+		}
+		case L4C_MCF_CONFIG_TYPE_GENERAL_CARRIER_BIN:
+		{
+			mcf_tlvota_file_t                      *tlvota_file = &(pMcf->general_tlvota_file);
+			mcf_tlvota_sbp_tag_t                    sbp_tag;
+			
+			if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+                MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_SIM_ID(req->ps_id, sim_id);
+                ret = MCF_OTA_R_INVALID_PARAMETER;
+                return ret;
+            }
+            
+            if (strcmp((kal_char *)req->config1, "") != 0) {
+				if (pMcf->general_is_ignore_dsbp == KAL_FALSE) {
+					/* If MCF is in DSBP passive mode, change to DSBP active mode */
+					ret = mcf_set_dsbp_mode(KAL_TRUE, KAL_TRUE, sim_id);
+					if (ret != MCF_OTA_R_SUCCESS) {
+						return ret;
+					}
+					pMcf->general_is_ignore_dsbp = KAL_TRUE;
+				}
+				if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+					strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				} else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+					strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				} else {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE_TYPE(req->path_type);
+					ret = MCF_OTA_R_INVALID_PARAMETER;
+
+					return ret;
+				}
+				strncpy(curr_filename, (kal_char *)req->config1, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				
+				/* Check if file is existed */
+				kal_wsprintf(filename, "%s\\%s\0", fs_root_path, curr_filename);
+
+				fs_api_ret = FS_GetAttributes(filename);
+				if (fs_api_ret < FS_NO_ERROR) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_FILE_NOT_EXIST(fs_root_path, curr_filename);
+					ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+					return ret;
+				}
+				
+				/* Read MCF Internal information in NVRAM */
+				if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+					ret = MCF_OTA_R_READ_NVRAM_FAIL;
+				}
+				
+				/* Read MCF TLV-OTA file information in NVRAM */
+				if ( !nvram_external_read_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+					ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+					return ret;
+				}
+				
+				if(req->reset == KAL_TRUE){
+                    //Need to reset LID
+                    nv_int_info.not_reset_general_tlvota = KAL_FALSE;
+                    
+					//Clear LIDs which is add due to combine
+					if(mcf_clear_last_modified_lid(nv_int_info.general_tlvota_last_mod_lid[sim_id].lid_conf, &nv_int_info.general_tlvota_last_mod_lid[sim_id].lid_cnt) != KAL_TRUE){
+						ret = MCF_OTA_R_INVALID_PARAMETER;
+						return ret;
+					}
+                    
+                    /* Combine OTA file - Only apply one OTA file */
+					ret = mcf_read_general_tlvota_file(KAL_FALSE, fs_root_path, curr_filename, &apply_path_type, apply_filename, pMcf);
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(fs_root_path, curr_filename);
+						return ret;
+					}
+					tlvota_file = &(pMcf->tlvota_file[sim_id]);
+					MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					if (tlvota_file){
+						sbp_tag.sbp_id = tlvota_file->sbp_id;
+						kal_mem_cpy(sbp_tag.mcc, tlvota_file->mcc, MAX_MCC_STR_LEN);
+						kal_mem_cpy(sbp_tag.mnc, tlvota_file->mnc, MAX_MNC_STR_LEN);
+						
+						MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+					}else {
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_TAKE_READ_LOCK_FAIL();
+						MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					}
+					tlvota_file = &(pMcf->general_tlvota_file);
+					ret = mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_TRUE, KAL_FALSE, KAL_TRUE);
+					
+					kal_mem_cpy(&mcf_general_tlvota_last_mod_lid_g[sim_id], &nv_int_info.general_tlvota_last_mod_lid[sim_id], sizeof(nvram_mcf_lid_info_struct));
+					
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_STORE_LAST_LID_FAIL();
+						return ret;
+					}
+					
+					if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+						ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+						return ret;
+					}
+					
+
+				}else{
+					//Do not need to reset LID
+                    nv_int_info.not_reset_general_tlvota = KAL_TRUE;
+                    
+                    /* Combine OTA file - Append OTA file*/
+					for(i = 0; i < nv_int_info.general_tlvota_last_mod_lid[sim_id].lid_cnt; i++){
+						if(nv_int_info.general_tlvota_last_mod_lid[sim_id].lid_conf[i].not_reset == KAL_FALSE && nv_int_info.general_tlvota_last_mod_lid[sim_id].lid_conf[i].set_combined == KAL_FALSE){
+							nv_int_info.general_tlvota_last_mod_lid[sim_id].lid_conf[i].not_reset = KAL_TRUE;
+						}
+					}
+                    ret = mcf_read_general_tlvota_file(KAL_FALSE, nv_tlvota_file.path, nv_tlvota_file.name, &apply_path_type, apply_filename, pMcf);
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(nv_tlvota_file.path, nv_tlvota_file.name);
+                        read_file_fail = KAL_TRUE;
+					}
+					MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					if (tlvota_file) {
+						pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+						/* Check if file type is TLV-OTA file */ //If not TLVOTA file, Construct empty file header
+						if (read_file_fail == KAL_TRUE || strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+							mcf_tool_file_info_t copy_header = {0};
+                            mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)mcf_file_buffer;
+                           
+                            MD_TRC_MCF_TR_COMBINED_OTA_FILE_MERGE_OTA_FILE();
+                            
+                            kal_mem_set(mcf_file_buffer, 0, MCF_MAX_FILE_SIZE);
+                            copy_header.file_version = 3;
+                            copy_header.operation_mask = 0;
+                            mcf_merge_make_ota_file_header(output_header, &copy_header); // copy first header to output header
+                            kal_mem_set(output_header->file_type, 0, 8);
+                            strncpy(output_header->file_type, MCF_FILE_TYPE_TLVOTA, 7);
+                            output_header->item_num = 0;
+                            output_header->file_size = (kal_uint32)((kal_uint8 *)mcf_file_buffer + output_header->total_len - (kal_uint8 *)output_header);
+
+						}else{
+							kal_mem_cpy(mcf_file_buffer, tlvota_file->buff, MCF_MAX_TLVOTA_FILE_SIZE);
+						}
+						
+						MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					}
+					ret = mcf_read_general_tlvota_file(KAL_FALSE, fs_root_path, curr_filename, &apply_path_type, apply_filename, pMcf);
+					if(ret != MCF_OTA_R_SUCCESS){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(fs_root_path, curr_filename);
+						return ret;
+					}
+					MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					if (tlvota_file) {
+						pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+						/* Check if file type is TLV-OTA file */
+						if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+							kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+							mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+							MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE(str_tmp);
+							ret = MCF_OTA_R_INVALID_FILE;
+							MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+							return ret;
+						}
+						
+                        if(mcf_merge_ota_buffer(mcf_file_buffer, tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE) != KAL_TRUE){
+                            MD_TRC_MCF_TR_COMBINED_OTA_FILE_MERGE_OTA_FILE_FAIL();
+                            ret = MCF_OTA_R_INVALID_PARAMETER;
+                            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                            return ret;
+                        }
+						
+						MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					}
+					strncpy(fs_root_path, nv_tlvota_file.merged_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+					strncpy(curr_filename, nv_tlvota_file.merged_name, MCF_FILE_MAX_NAME_LEN - 1);
+					
+					/* Before create merged OTA file, need to delete last time merged OTA file */
+					kal_wsprintf(merge_ota_name, "%s\\%s\0", fs_root_path, curr_filename);
+					fs_ret = FS_Delete(merge_ota_name);
+					
+					if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_DELETE_FILE_FAIL(fs_ret);
+						ret = MCF_OTA_R_WRITE_DISK_FAIL;
+						return ret;
+					}
+					
+					pFile = (mcf_tool_file_info_t *)(mcf_merge_buffer);
+					if(pFile->file_size > MCF_MAX_TLVOTA_FILE_SIZE){
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_FILE_SIZE(pFile->file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+						ret = MCF_OTA_R_INVALID_PARAMETER;
+						return ret;
+					}
+
+					ret = mcf_write_buffer(fs_root_path, curr_filename, (kal_uint8 *)mcf_merge_buffer, pFile->file_size);
+					if (ret != MCF_OTA_R_SUCCESS) {
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_FAIL(fs_root_path, curr_filename);
+						return ret;
+					}
+                    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+                        MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+                        ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                        return ret;
+                    }
+					
+				}
+				
+				if (req->trigger_dsbp == 1) {
+					/* Read general TLV-OTA file */
+					kal_mem_set(&read_file_info, 0, sizeof(em_mcf_read_ota_file_info_struct));
+					read_file_info.trigger_type = EM_MCF_TRIGGER_TYPE_BY_AP;
+					read_file_info.config_type = L4C_MCF_CONFIG_TYPE_GENERAL_CARRIER_BIN;
+					read_file_info.ps_id = req->ps_id;
+					read_file_info.start_time = kal_get_systicks();
+
+					ret = mcf_read_general_tlvota_file(KAL_FALSE, fs_root_path, curr_filename, &apply_path_type, apply_filename, pMcf);
+					if (ret == MCF_OTA_R_SUCCESS) {
+						MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        if (tlvota_file) {
+                            read_file_info.path_type = tlvota_file->path_type;
+                            strncpy(read_file_info.file_name, (kal_char *)&(tlvota_file->relative_path_name), MCF_FILE_MAX_NAME_LEN - 1);
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        }
+						for(i = 0; i < MAX_SIM_NUM; i++){
+							is_read_general_tlvota[i] = KAL_TRUE;
+						}
+					} else {
+						MD_TRC_MCF_TR_COMBINED_OTA_FILE_READ_FILE_FAIL(fs_root_path, curr_filename);
+					}
+
+					read_file_info.result = ret;
+					read_file_info.end_time = kal_get_systicks();
+
+					mcf_em_send_ota_file_info(&read_file_info);
+				}
+				
+				strncpy(nv_tlvota_file.path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				strncpy(nv_tlvota_file.name, curr_filename, MCF_FILE_MAX_NAME_LEN - 1);
+				
+			}else{
+				/*Deactivate Combine OTA setting */
+				if (pMcf->general_is_ignore_dsbp == KAL_TRUE) {
+					/* If MCF is in DSBP active mode, change to DSBP passive mode */
+					ret = mcf_set_dsbp_mode(KAL_FALSE, KAL_TRUE, sim_id);
+					if (ret != MCF_OTA_R_SUCCESS) {
+						return ret;
+					}
+					pMcf->general_is_ignore_dsbp = KAL_FALSE;
+				}
+				
+				kal_mem_set(fs_root_path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+				kal_mem_set(curr_filename, 0, MCF_FILE_MAX_NAME_LEN);
+				kal_mem_set(nv_tlvota_file.path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+				kal_mem_set(nv_tlvota_file.name, 0, MCF_FILE_MAX_NAME_LEN);
+
+				/* Deactivate TLV-OTA setting, reset combined setting */
+				nv_int_info.is_combined_general_tlvota = KAL_FALSE;
+				kal_mem_set(nv_tlvota_file.merged_path, 0, MCF_FILE_MAX_MD_PATH_LEN);
+				kal_mem_set(nv_tlvota_file.merged_name, 0, MCF_FILE_MAX_NAME_LEN);
+                
+                //Need to reset LID
+                nv_int_info.not_reset_general_tlvota = KAL_FALSE;
+				
+				for(i = 0; i < nv_int_info.general_tlvota_last_mod_lid[sim_id].lid_cnt; i++){
+                    if(nv_int_info.general_tlvota_last_mod_lid[sim_id].lid_conf[i].not_reset == KAL_TRUE){
+						nv_int_info.general_tlvota_last_mod_lid[sim_id].lid_conf[i].not_reset = KAL_FALSE;
+                    }
+                }
+				
+				if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+					MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+					ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+					return ret;
+				}
+				
+				if (req->trigger_dsbp == 1) {
+					/* Deactivate general TLV-OTA setting, reset general TLV-OTA buffer */
+					MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					if (tlvota_file) {
+						kal_mem_set(tlvota_file->buff, 0, sizeof(kal_uint8) * MCF_MAX_TLVOTA_FILE_SIZE);
+						tlvota_file->path_type = req->path_type;
+						strncpy(tlvota_file->relative_path_name, "", MCF_FILE_MAX_NAME_LEN - 1);
+                        tlvota_file->last_mod_time = 0;
+						kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+						MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+					} else {
+						MD_TRC_MCF_TR_SET_FILE_PATH_RESET_BUFFER_FAIL();
+					}
+					for(i = 0; i < MAX_SIM_NUM; i++){
+						is_read_general_tlvota[i] = KAL_TRUE;
+					}
+				}
+
+			}
+			
+			/* Write MCF TLV-OTA file information in NVRAM */
+			if ( !nvram_external_write_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+				MD_TRC_MCF_TR_COMBINED_OTA_FILE_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+				ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+				return ret;
+			}
+			break;
+		}
+		
+		default:
+		{
+			MD_TRC_MCF_TR_COMBINED_OTA_FILE_INVALID_CONFIG_TYPE(req->config_type);
+			ret = MCF_OTA_R_INVALID_PARAMETER;
+			break;
+        }
+
+	}
+	
+	
+	return ret;
+}
+#endif
+_STATIC mcf_ota_result_e mcf_set_file_path(l4c_mcf_set_config_req_struct *req)
+{
+    mcf_t                                  *pMcf = mcf_get_instance();
+    sim_interface_enum                      sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+    mcf_ota_result_e                        ret = MCF_OTA_R_SUCCESS;
+	mcf_tool_file_info_t                   *pFile;
+	kal_uint32                              i = 0;
+    
+    if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+        MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_SIM_ID(req->ps_id, sim_id);
+        ret = MCF_OTA_R_INVALID_PARAMETER;
+        return ret;
+    }
+
+    switch (req->op)
+    {
+        case L4C_MCF_CONFIG_SET_OTA_AND_OPOTA_FILE_PATH:
+        {
+            nvram_ef_mcf_ota_file_info_struct       nv_ota_file;
+            nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+
+            if (pMcf->is_ignore_dsbp[sim_id] == KAL_TRUE) {
+                /* If MCF is in DSBP active mode, change to DSBP passive mode */
+                ret = mcf_set_dsbp_mode(KAL_FALSE, KAL_FALSE, sim_id);
+                if (ret != MCF_OTA_R_SUCCESS) {
+                    return ret;
+                }
+                pMcf->is_ignore_dsbp[sim_id] = KAL_FALSE;
+            }
+
+            /* Read MCF OTA file information in NVRAM */
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+                MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+                return ret;
+            }
+
+            MD_TRC_MCF_TR_SET_OTA_FILE_PATH_AP((kal_char *)req->config1, (kal_char *)req->config2);
+            if (strcmp((kal_char *)req->config1, "") != 0) {
+                strncpy(nv_ota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                strncpy(nv_ota_file.name, (kal_char *)req->config2, MCF_FILE_MAX_NAME_LEN - 1);
+            } else {
+                strncpy(nv_ota_file.path, "", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                strncpy(nv_ota_file.name, "", MCF_FILE_MAX_NAME_LEN - 1);
+            }
+            MD_TRC_MCF_TR_SET_OTA_FILE_PATH_MD((kal_char *)nv_ota_file.path, (kal_char *)nv_ota_file.name);
+
+            /* Write MCF OTA file information in NVRAM */
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+                MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                return ret;
+            }
+
+            /* Read MCF TLV-OTA file information in NVRAM */
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+                MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                ret = KAL_FALSE;
+
+                return MCF_OTA_R_READ_NVRAM_FAIL;
+            }
+
+            MD_TRC_MCF_TR_SET_TLVOTA_FILE_PATH_AP((kal_char *)req->config3, (kal_char *)req->config4, req->ps_id);
+            if (strcmp((kal_char *)req->config3, "") != 0) {
+                strncpy(nv_tlvota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                strncpy(nv_tlvota_file.name, (kal_char *)req->config4, MCF_FILE_MAX_NAME_LEN - 1);
+            } else {
+                strncpy(nv_tlvota_file.path, "", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                strncpy(nv_tlvota_file.name, "", MCF_FILE_MAX_NAME_LEN - 1);
+            }
+            MD_TRC_MCF_TR_SET_TLVOTA_FILE_PATH_MD((kal_char *)nv_tlvota_file.path, (kal_char *)nv_tlvota_file.name, sim_id);
+
+            /* Write MCF TLV-OTA file information in NVRAM */
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+                MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                return ret;
+            }
+
+            break;
+        }
+
+        case L4C_MCF_CONFIG_SET_OTA_FILE_PATH:
+        {
+            nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+
+            if (pMcf->is_ignore_dsbp[sim_id] == KAL_TRUE) {
+                /* If MCF is in DSBP active mode, change to DSBP passive mode */
+                ret = mcf_set_dsbp_mode(KAL_FALSE, KAL_FALSE, sim_id);
+                if (ret != MCF_OTA_R_SUCCESS) {
+                    return ret;
+                }
+                pMcf->is_ignore_dsbp[sim_id] = KAL_FALSE;
+            }
+
+            /* Read MCF OTA file information in NVRAM */
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+                MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+                return ret;
+            }
+
+            MD_TRC_MCF_TR_SET_OTA_FILE_PATH_AP((kal_char *)req->config1, (kal_char *)req->config2);
+            if (strcmp((kal_char *)req->config1, "") != 0) {
+                strncpy(nv_ota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                strncpy(nv_ota_file.name, (kal_char *)req->config2, MCF_FILE_MAX_NAME_LEN - 1);
+            } else {
+                strncpy(nv_ota_file.path, "", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                strncpy(nv_ota_file.name, "", MCF_FILE_MAX_NAME_LEN - 1);
+            }
+            MD_TRC_MCF_TR_SET_OTA_FILE_PATH_MD((kal_char *)nv_ota_file.path, (kal_char *)nv_ota_file.name);
+
+            /* Write MCF OTA file information in NVRAM */
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+                MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                return ret;
+            }
+
+            break;
+        }
+
+        case L4C_MCF_CONFIG_SET_OPOTA_FILE_PATH:
+        {
+            nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+
+            if (pMcf->is_ignore_dsbp[sim_id] == KAL_TRUE) {
+                /* If MCF is in DSBP active mode, change to DSBP passive mode */
+                ret = mcf_set_dsbp_mode(KAL_FALSE, KAL_FALSE, sim_id);
+                if (ret != MCF_OTA_R_SUCCESS) {
+                    return ret;
+                }
+                pMcf->is_ignore_dsbp[sim_id] = KAL_FALSE;
+            }
+
+            /* Read MCF TLV-OTA file information in NVRAM */
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+                MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+                return ret;
+            }
+
+            MD_TRC_MCF_TR_SET_TLVOTA_FILE_PATH_AP((kal_char *)req->config1, (kal_char *)req->config2, req->ps_id);
+            if (strcmp((kal_char *)req->config1, "") != 0) {
+                strncpy(nv_tlvota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                strncpy(nv_tlvota_file.name, (kal_char *)req->config2, MCF_FILE_MAX_NAME_LEN - 1);
+            } else {
+                strncpy(nv_tlvota_file.path, "", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                strncpy(nv_tlvota_file.name, "", MCF_FILE_MAX_NAME_LEN - 1);
+            }
+            MD_TRC_MCF_TR_SET_TLVOTA_FILE_PATH_MD((kal_char *)nv_tlvota_file.path, (kal_char *)nv_tlvota_file.name, sim_id);
+
+            /* Write MCF TLV-OTA file information in NVRAM */
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+                MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                return ret;
+            }
+
+            break;
+        }
+
+        case L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE:
+        {
+            if (pMcf->is_ignore_dsbp[sim_id] == KAL_FALSE) {
+                /* If MCF is in DSBP passive mode, change to DSBP active mode */
+                ret = mcf_set_dsbp_mode(KAL_TRUE, KAL_FALSE, sim_id);
+                if (ret != MCF_OTA_R_SUCCESS) {
+                    return ret;
+                }
+                pMcf->is_ignore_dsbp[sim_id] = KAL_TRUE;
+            }
+            pMcf->dsbp_cnf_ret = KAL_TRUE;
+            pMcf->dsbp_ind_ret = KAL_TRUE;
+
+            switch (req->config_type)
+            {
+                case L4C_MCF_CONFIG_TYPE_DEFAULT_BIN:
+                {
+                    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+                    kal_char                            fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+                    kal_char                            curr_filename[MCF_FILE_MAX_NAME_LEN];
+                    kal_wchar                           filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+                    kal_bool                            is_get_custom_filename = KAL_FALSE;
+                    kal_int32                           fs_api_ret;
+                    kal_uint8                           path_type;
+
+                    if (nv_int_info.not_reset_ota == KAL_TRUE) {
+                        /* If MCF is in not reset mode, change to reset mode */
+                        ret = mcf_set_not_reset(KAL_FALSE, req->config_type, 0);
+                        if (ret != MCF_OTA_R_SUCCESS) {
+                            return ret;
+                        }
+                        nv_int_info.not_reset_ota = KAL_FALSE;
+                    }
+                    
+                    if (strcmp((kal_char *)req->config1, "") != 0) {
+                        if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+                            strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                        } else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                            strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                        } else {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_PATH_TYPE(req->path_type);
+                            ret = MCF_OTA_R_INVALID_PARAMETER;
+
+                            return ret;
+                        }
+                        strncpy(curr_filename, (kal_char *)req->config1, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                    } else {
+                        is_get_custom_filename = mcf_get_custom_file_path_name(&path_type, curr_filename);
+                        if (is_get_custom_filename == KAL_TRUE) {
+                            if (path_type >= L4C_MCF_PATH_TYPE_MAX) {
+                                MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_PATH_TYPE(req->path_type);
+                                ret = MCF_OTA_R_INVALID_PARAMETER;
+
+                                return ret;
+                            }
+
+                            if (path_type == L4C_MCF_PATH_TYPE_OTA) {
+                                strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                            } else if (path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                                strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                            }
+                        } else {
+                            strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                            strncpy(curr_filename, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                        }
+                    }
+
+                    /* Check if file is existed */
+                    kal_wsprintf(filename, "%s\\%s\0", fs_root_path, curr_filename);
+
+                    fs_api_ret = FS_GetAttributes(filename);
+                    if (fs_api_ret < FS_NO_ERROR) {
+                        MD_TRC_MCF_TR_SET_FILE_PATH_FILE_NOT_EXIST(fs_root_path, curr_filename);
+                        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                        return ret;
+                    }
+
+                    /* Write MCF OTA file information to NVRAM */
+                    if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+                        MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                        ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+                        return ret;
+                    }
+
+                    strncpy(nv_ota_file.path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                    strncpy(nv_ota_file.name, curr_filename, MCF_FILE_MAX_NAME_LEN - 1);
+
+                    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+                        MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                        ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                        return ret;
+                    }
+
+                    break;
+                }
+
+                case L4C_MCF_CONFIG_TYPE_CARRIER_BIN:
+                {
+                    mcf_tlvota_file_t                      *tlvota_file;
+                    mcf_tool_file_info_t                   *pFile;
+                    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+                    em_mcf_read_ota_file_info_struct        read_file_info;
+                    kal_char                                fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+                    kal_wchar                               filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+                    kal_char                                apply_filename[MCF_FILE_MAX_NAME_LEN];
+                    l4c_mcf_path_type_enum                  apply_path_type;
+                    kal_int32                               fs_api_ret;
+                    
+                    if (nv_int_info.not_reset_tlvota[sim_id] == KAL_TRUE) {
+                        /* If MCF is in DSBP active mode, change to DSBP passive mode */
+                        ret = mcf_set_not_reset(KAL_FALSE, req->config_type, sim_id);
+                        if (ret != MCF_OTA_R_SUCCESS) {
+                            return ret;
+                        }
+                        nv_int_info.not_reset_tlvota[sim_id] = KAL_FALSE;
+                    }
+
+					tlvota_file = &(pMcf->tlvota_file[sim_id]);
+					
+					if (strcmp((kal_char *)req->config1, "") != 0) {
+                        /* Check if file is existed */
+                        if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+                            kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, req->config1);
+                            strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                        } else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                            kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, req->config1);
+                            strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                        } else {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_PATH_TYPE(req->path_type);
+                            ret = MCF_OTA_R_INVALID_PARAMETER;
+
+                            return ret;
+                        }
+
+                        fs_api_ret = FS_GetAttributes(filename);
+                        if (fs_api_ret < FS_NO_ERROR) {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_FILE_NOT_EXIST(fs_root_path, req->config1);
+                            ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                            return ret;
+                        }
+
+                        /* Read MCF TLV-OTA file information in NVRAM */
+                        if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                            ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+                            return ret;
+                        }
+
+                        strncpy(nv_tlvota_file.path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                        strncpy(nv_tlvota_file.name, (kal_char *)req->config1, MCF_FILE_MAX_NAME_LEN - 1);
+
+                        /* Write MCF TLV-OTA file information in NVRAM */
+                        if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                            ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                            return ret;
+                        }
+
+                        kal_mem_set(&read_file_info, 0, sizeof(em_mcf_read_ota_file_info_struct));
+                        read_file_info.trigger_type = EM_MCF_TRIGGER_TYPE_BY_AP;
+                        read_file_info.config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+                        read_file_info.ps_id = req->ps_id;
+                        read_file_info.start_time = kal_get_systicks();
+
+                        /* Read TLV-OTA file */
+                        ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, fs_root_path, (kal_char *)req->config1, &apply_path_type, apply_filename, pMcf);
+                        // Store Read TLV-OTA file result for dsbp urc use
+                        set_op_read_ret[sim_id] = ret;
+                        if (ret == MCF_OTA_R_SUCCESS) {
+                            MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                            if (tlvota_file) {
+                                pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+
+                                /* Do not trigger DSBP if the same file as last one */
+                                if ( (tlvota_file->last_file.path_type == apply_path_type) &&
+                                     (strncmp(tlvota_file->last_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN) == 0) &&
+                                     (strncmp(tlvota_file->last_file.sw_version, &(pFile->buff_start), pFile->sw_version_len) == 0) &&
+                                     (strncmp(tlvota_file->last_file.gen_time, &(pFile->buff_start) + pFile->sw_version_len, pFile->gen_time_len) == 0) ) {
+                                    MD_TRC_MCF_TR_SET_FILE_PATH_FILE_NOT_CHANGE(0, tlvota_file->last_file.path_type);
+									dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, tlvota_file->last_file.name);
+                                    dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, tlvota_file->last_file.sw_version);
+                                    dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, tlvota_file->last_file.gen_time);
+                                    ret = MCF_OTA_R_FILE_NOT_CHANGE;
+                                } else {
+                                    /* Store temp updated file informantion */
+									kal_mem_set(&(tlvota_file->temp_file), 0, sizeof(mcf_file_info_t));
+									tlvota_file->temp_file.path_type = apply_path_type;
+									strncpy(tlvota_file->temp_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+                                    if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+                                        strncpy(tlvota_file->temp_file.sw_version, &(pFile->buff_start), pFile->sw_version_len);
+										tlvota_file->temp_file.sw_version[pFile->sw_version_len] = '\0';
+                                    } else {
+                                        MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_SW_VERSION(pFile->sw_version_len);
+                                    }
+                                    if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+                                        strncpy(tlvota_file->temp_file.gen_time, &(pFile->buff_start) + pFile->sw_version_len, pFile->gen_time_len);
+										tlvota_file->temp_file.gen_time[pFile->gen_time_len] = '\0';
+                                    } else {
+                                        MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_SW_GEN_TIME(pFile->gen_time_len);
+                                    }
+
+                                    read_file_info.path_type = tlvota_file->path_type;
+                                    strncpy(read_file_info.file_name, (kal_char *)&(tlvota_file->relative_path_name), MCF_FILE_MAX_NAME_LEN - 1);
+                                }
+                                /* Check if file type is TLV-OTA file */
+                                if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+                                    kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+                                    mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+                                    MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_FILE(str_tmp);
+                                    com_Mcf.tlvota_result[sim_id] = MCF_OTA_R_INVALID_FILE;
+                                }
+                                MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                            }else{
+                                MD_TRC_MCF_TR_SET_FILE_PATH_TAKE_WRITE_LOCK_FAIL();
+                                ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                                return ret;
+                            }
+                            is_read_tlvota[sim_id] = KAL_TRUE;
+                        } else {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_FAIL(req->config_type);
+                        }
+
+                        read_file_info.result = ret;
+                        read_file_info.end_time = kal_get_systicks();
+
+                        mcf_em_send_ota_file_info(&read_file_info);
+                    } else {
+                        /* Read MCF TLV-OTA file information in NVRAM */
+                        if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                            ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+                            return ret;
+                        }
+
+                        strncpy(nv_tlvota_file.path, "", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                        strncpy(nv_tlvota_file.name, "", MCF_FILE_MAX_NAME_LEN - 1);
+
+                        /* Write MCF TLV-OTA file information in NVRAM */
+                        if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                            ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                            return ret;
+                        }
+
+                        /* Deactivate TLV-OTA setting, reset TLV-OTA buffer */
+                        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        if (tlvota_file) {
+                            kal_mem_set(tlvota_file->buff, 0, sizeof(kal_uint8) * MCF_MAX_TLVOTA_FILE_SIZE);
+                            tlvota_file->path_type = req->path_type;
+                            strncpy(tlvota_file->relative_path_name, "", MCF_FILE_MAX_NAME_LEN - 1);
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        } else {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_RESET_BUFFER_FAIL();
+                        }
+                        
+                         /* Do not trigger DSBP if no last file */
+                        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        if (tlvota_file) {
+                            if (strncmp(tlvota_file->last_file.name, "", MCF_FILE_MAX_NAME_LEN) == 0) {
+                                MD_TRC_MCF_TR_SET_FILE_PATH_FILE_NOT_CHANGE(1, tlvota_file->last_file.path_type);
+                                ret = MCF_OTA_R_FILE_NOT_CHANGE;
+                            } else {
+                                /* Clear last updated file informantion */
+                                kal_mem_set(&(tlvota_file->temp_file), 0, sizeof(mcf_file_info_t));
+                            }
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        } else {
+                            MD_TRC_MCF_TR_SET_FILE_PATH_TAKE_WRITE_LOCK_FAIL();
+                        }
+                        is_read_tlvota[sim_id] = KAL_TRUE;
+                    }
+
+                    break;
+                }
+
+                default:
+                    MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_CONFIG_TYPE(req->config_type);
+                    ret = MCF_OTA_R_INVALID_PARAMETER;
+                    break;
+            }
+
+            break;
+        }
+
+        case L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN:
+        {
+            kal_bool is_combine = KAL_FALSE;
+			
+			/* Read MCF Internal information in NVRAM */
+			if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+				MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+				ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+				return ret;
+			}
+            pMcf->dsbp_cnf_ret = KAL_TRUE;
+            pMcf->dsbp_ind_ret = KAL_TRUE;
+            
+            switch (req->config_type)
+            {
+                case L4C_MCF_CONFIG_TYPE_DEFAULT_BIN:
+                {
+                    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+                    kal_char                            fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+                    kal_char                            curr_filename[MCF_FILE_MAX_NAME_LEN];
+                    kal_wchar                           filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+                    kal_int32                           fs_api_ret;
+
+                    is_combine = nv_int_info.is_combined_ota;
+					
+					if(is_combine == KAL_FALSE){
+                        if (nv_int_info.not_reset_ota == KAL_TRUE) {
+                            /* If MCF is in DSBP active mode, change to DSBP passive mode */
+                            ret = mcf_set_not_reset(KAL_FALSE, req->config_type, 0);
+                            if (ret != MCF_OTA_R_SUCCESS) {
+                                return ret;
+                            }
+                            nv_int_info.not_reset_ota = KAL_FALSE;
+                        }
+						if (strcmp((kal_char *)req->config1, "") != 0) {
+							if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+								strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+							} else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+								strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+							} else {
+								MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_PATH_TYPE(req->path_type);
+								ret = MCF_OTA_R_INVALID_PARAMETER;
+
+								return ret;
+							}
+							strncpy(curr_filename, (kal_char *)req->config1, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                            /* Check if file is existed */
+                            kal_wsprintf(filename, "%s\\%s\0", fs_root_path, curr_filename);
+
+                            fs_api_ret = FS_GetAttributes(filename);
+                            if (fs_api_ret < FS_NO_ERROR) {
+                                MD_TRC_MCF_TR_SET_FILE_PATH_FILE_NOT_EXIST(fs_root_path, curr_filename);
+                                ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                                return ret;
+                            }
+
+                            /* Write MCF OTA file information to NVRAM */
+                            if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+                                MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                                ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+                                return ret;
+                            }
+
+                            strncpy(nv_ota_file.path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                            strncpy(nv_ota_file.name, curr_filename, MCF_FILE_MAX_NAME_LEN - 1);
+
+                            if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+                                MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                                ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                                return ret;
+                            }
+                        } else {
+                            /* Write MCF OTA file information to NVRAM */
+                            if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+                                MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                                ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+                                return ret;
+                            }
+
+                            kal_mem_set(nv_ota_file.path, 0, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                            kal_mem_set(nv_ota_file.name, 0, MCF_FILE_MAX_NAME_LEN - 1);
+
+                            if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+                                MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                                ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                                return ret;
+                            }
+                        }
+					}else{
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+						ret = mcf_combined_ota_file(req);
+						if(ret != MCF_OTA_R_SUCCESS){
+							return ret;
+						}
+#else
+                        ret = MCF_OTA_R_MCF_NOT_SUPPORT;
+                        return ret;
+#endif
+					}
+
+                    break;
+                }
+
+                case L4C_MCF_CONFIG_TYPE_CARRIER_BIN:
+                {
+                    mcf_tlvota_file_t                      *tlvota_file;
+                    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+                    em_mcf_read_ota_file_info_struct        read_file_info;
+                    kal_char                                fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+                    kal_wchar                               filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+                    kal_char                                apply_filename[MCF_FILE_MAX_NAME_LEN];
+                    l4c_mcf_path_type_enum                  apply_path_type;
+                    kal_int32                               fs_api_ret;
+					
+					if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+						MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_SIM_ID(req->ps_id, sim_id);
+						ret = MCF_OTA_R_INVALID_PARAMETER;
+
+						return ret;
+					}
+					
+					tlvota_file = &(pMcf->tlvota_file[sim_id]);
+
+                    is_combine = nv_int_info.is_combined_tlvota[sim_id];
+					if(is_combine == KAL_FALSE){
+						if (nv_int_info.not_reset_tlvota[sim_id] == KAL_TRUE) {
+                            /* If MCF is in DSBP active mode, change to DSBP passive mode */
+                            ret = mcf_set_not_reset(KAL_FALSE, req->config_type, sim_id);
+                            if (ret != MCF_OTA_R_SUCCESS) {
+                                return ret;
+                            }
+                            nv_int_info.not_reset_tlvota[sim_id] = KAL_FALSE;
+                        }
+                        if (strcmp((kal_char *)req->config1, "") != 0) {
+							if (pMcf->is_ignore_dsbp[sim_id] == KAL_FALSE) {
+								/* If MCF is in DSBP passive mode, change to DSBP active mode */
+								ret = mcf_set_dsbp_mode(KAL_TRUE, KAL_FALSE, sim_id);
+								if (ret != MCF_OTA_R_SUCCESS) {
+									return ret;
+								}
+								pMcf->is_ignore_dsbp[sim_id] = KAL_TRUE;
+							}
+
+							/* Check if file is existed */
+							if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+								kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, req->config1);
+								strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+							} else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+								kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, req->config1);
+								strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+							} else {
+								MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_PATH_TYPE(req->path_type);
+								ret = MCF_OTA_R_INVALID_PARAMETER;
+
+								return ret;
+							}
+
+							fs_api_ret = FS_GetAttributes(filename);
+							if (fs_api_ret < FS_NO_ERROR) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_FILE_NOT_EXIST(fs_root_path, req->config1);
+								ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+								return ret;
+							}
+
+							/* Read MCF TLV-OTA file information in NVRAM */
+							if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+								ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+								return ret;
+							}
+
+							strncpy(nv_tlvota_file.path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+							strncpy(nv_tlvota_file.name, (kal_char *)req->config1, MCF_FILE_MAX_NAME_LEN - 1);
+
+							/* Write MCF TLV-OTA file information in NVRAM */
+							if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+								ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+								return ret;
+							}
+
+							if (req->trigger_dsbp == 1) {
+								/* Read TLV-OTA file */
+								kal_mem_set(&read_file_info, 0, sizeof(em_mcf_read_ota_file_info_struct));
+								read_file_info.trigger_type = EM_MCF_TRIGGER_TYPE_BY_AP;
+								read_file_info.config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+								read_file_info.ps_id = req->ps_id;
+								read_file_info.start_time = kal_get_systicks();
+
+								ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, fs_root_path, (kal_char *)req->config1, &apply_path_type, apply_filename, pMcf);
+                                // Store Read TLV-OTA file result for dsbp urc use
+                                set_op_read_ret[sim_id] = ret;
+								if (ret == MCF_OTA_R_SUCCESS) {
+									MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+									if (tlvota_file) {
+										pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+
+										/* Store last updated file informantion */
+										tlvota_file->last_file.path_type = apply_path_type;
+										strncpy(tlvota_file->last_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+										if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+											strncpy(tlvota_file->last_file.sw_version, &(pFile->buff_start), pFile->sw_version_len);
+											tlvota_file->last_file.sw_version[pFile->sw_version_len] = '\0';
+										} else {
+											MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_SW_VERSION(pFile->sw_version_len);
+										}
+										if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+											strncpy(tlvota_file->last_file.gen_time, &(pFile->buff_start) + pFile->sw_version_len, pFile->gen_time_len);
+											tlvota_file->last_file.gen_time[pFile->gen_time_len] = '\0';
+										} else {
+											MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_SW_GEN_TIME(pFile->gen_time_len);
+										}
+                                        /* Check if file type is TLV-OTA file */
+                                        if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+                                            kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+                                            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+                                            MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_FILE(str_tmp);
+                                            com_Mcf.tlvota_result[sim_id] = MCF_OTA_R_INVALID_FILE;
+                                        }
+										MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+									}else{
+										MD_TRC_MCF_TR_SET_FILE_PATH_TAKE_WRITE_LOCK_FAIL();
+										ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+										return ret;
+									}
+									read_file_info.path_type = tlvota_file->path_type;
+									strncpy(read_file_info.file_name, (kal_char *)&(tlvota_file->relative_path_name), MCF_FILE_MAX_NAME_LEN - 1);
+									is_read_tlvota[sim_id] = KAL_TRUE;
+								} else {
+									MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_FAIL(req->config_type);
+								}
+
+								read_file_info.result = ret;
+								read_file_info.end_time = kal_get_systicks();
+
+								mcf_em_send_ota_file_info(&read_file_info);
+								
+							}
+						} else {
+							if (pMcf->is_ignore_dsbp[sim_id] == KAL_TRUE) {
+								/* If MCF is in DSBP active mode, change to DSBP passive mode */
+								ret = mcf_set_dsbp_mode(KAL_FALSE, KAL_FALSE, sim_id);
+								if (ret != MCF_OTA_R_SUCCESS) {
+									return ret;
+								}
+								pMcf->is_ignore_dsbp[sim_id] = KAL_FALSE;
+							}
+
+							/* Read MCF TLV-OTA file information in NVRAM */
+							if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+								ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+								return ret;
+							}
+
+							strncpy(nv_tlvota_file.path, "", MCF_FILE_MAX_MD_PATH_LEN - 1);
+							strncpy(nv_tlvota_file.name, "", MCF_FILE_MAX_NAME_LEN - 1);
+
+							/* Write MCF TLV-OTA file information in NVRAM */
+							if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+								ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+								return ret;
+							}
+
+							if (req->trigger_dsbp == 1) {
+								/* Deactivate TLV-OTA setting, reset TLV-OTA buffer */
+								MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+								if (tlvota_file) {
+									kal_mem_set(tlvota_file->buff, 0, sizeof(kal_uint8) * MCF_MAX_TLVOTA_FILE_SIZE);
+									tlvota_file->path_type = req->path_type;
+									strncpy(tlvota_file->relative_path_name, "", MCF_FILE_MAX_NAME_LEN - 1);
+                                    tlvota_file->last_mod_time = 0;
+									/* Clear last updated file informantion */
+									kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+									MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+								} else {
+									MD_TRC_MCF_TR_SET_FILE_PATH_RESET_BUFFER_FAIL();
+								}
+								is_read_tlvota[sim_id] = KAL_TRUE;
+							}
+						}
+					}else{
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+						ret = mcf_combined_ota_file(req);
+						if(ret != MCF_OTA_R_SUCCESS){
+							return ret;
+                        }
+#else
+                        ret = MCF_OTA_R_MCF_NOT_SUPPORT;
+                        return ret;
+#endif
+					}
+
+                    break;
+                }
+
+                case L4C_MCF_CONFIG_TYPE_GENERAL_CARRIER_BIN:
+                {
+                    mcf_tlvota_file_t                      *tlvota_file = &(pMcf->general_tlvota_file);
+                    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+                    em_mcf_read_ota_file_info_struct        read_file_info;
+                    kal_char                                fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+                    kal_wchar                               filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+                    kal_char                                apply_filename[MCF_FILE_MAX_NAME_LEN];
+                    l4c_mcf_path_type_enum                  apply_path_type;
+                    kal_int32                               fs_api_ret;
+
+                    is_combine = nv_int_info.is_combined_general_tlvota;
+					if(is_combine == KAL_FALSE){
+						if (nv_int_info.not_reset_general_tlvota == KAL_TRUE) {
+                            /* If MCF is in DSBP active mode, change to DSBP passive mode */
+                            ret = mcf_set_not_reset(KAL_FALSE, req->config_type, 0);
+                            if (ret != MCF_OTA_R_SUCCESS) {
+                                return ret;
+                            }
+                            nv_int_info.not_reset_general_tlvota = KAL_FALSE;
+                        }
+                        if (strcmp((kal_char *)req->config1, "") != 0) {
+							if (pMcf->general_is_ignore_dsbp == KAL_FALSE) {
+								/* If MCF is in DSBP passive mode, change to DSBP active mode */
+								ret = mcf_set_dsbp_mode(KAL_TRUE, KAL_TRUE, sim_id);
+								if (ret != MCF_OTA_R_SUCCESS) {
+									return ret;
+								}
+								pMcf->general_is_ignore_dsbp = KAL_TRUE;
+							}
+                            /* Check if file is existed */
+							if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+								kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, req->config1);
+								strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+							} else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+								kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, req->config1);
+								strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+							} else {
+								MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_PATH_TYPE(req->path_type);
+								ret = MCF_OTA_R_INVALID_PARAMETER;
+
+								return ret;
+							}
+
+							fs_api_ret = FS_GetAttributes(filename);
+							if (fs_api_ret < FS_NO_ERROR) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_FILE_NOT_EXIST(fs_root_path, req->config1);
+								ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+								return ret;
+							}
+
+							/* Read MCF general TLV-OTA file information in NVRAM */
+							if ( !nvram_external_read_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+								ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+								return ret;
+							}
+
+							strncpy(nv_tlvota_file.path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+							strncpy(nv_tlvota_file.name, (kal_char *)req->config1, MCF_FILE_MAX_NAME_LEN - 1);
+
+							/* Write MCF general TLV-OTA file information in NVRAM */
+							if ( !nvram_external_write_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+								ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+								return ret;
+							}
+
+							if (req->trigger_dsbp == 1) {
+								/* Read general TLV-OTA file */
+								kal_mem_set(&read_file_info, 0, sizeof(em_mcf_read_ota_file_info_struct));
+								read_file_info.trigger_type = EM_MCF_TRIGGER_TYPE_BY_AP;
+								read_file_info.config_type = L4C_MCF_CONFIG_TYPE_GENERAL_CARRIER_BIN;
+								read_file_info.ps_id = req->ps_id;
+								read_file_info.start_time = kal_get_systicks();
+
+								ret = mcf_read_general_tlvota_file(KAL_FALSE, fs_root_path, (kal_char *)req->config1, &apply_path_type, apply_filename, pMcf);
+								if (ret == MCF_OTA_R_SUCCESS) {
+									MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+									if (tlvota_file) {
+										pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+
+										/* Store last updated file informantion */
+										tlvota_file->last_file.path_type = apply_path_type;
+										strncpy(tlvota_file->last_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+										if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+											strncpy(tlvota_file->last_file.sw_version, &(pFile->buff_start), pFile->sw_version_len);
+											tlvota_file->last_file.sw_version[pFile->sw_version_len] = '\0';
+										} else {
+											MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_VERSION, pFile->sw_version_len);
+										}
+										if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+											strncpy(tlvota_file->last_file.gen_time, &(pFile->buff_start) + pFile->sw_version_len, pFile->gen_time_len);
+											tlvota_file->last_file.gen_time[pFile->gen_time_len] = '\0';
+										} else {
+											MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_GEN_TIME, pFile->gen_time_len);
+										}
+                                        /* Check if file type is TLV-OTA file */
+                                        if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+                                            kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+                                            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+                                            MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_FILE(str_tmp);
+                                        }
+										MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+									}else{
+										MD_TRC_MCF_TR_SET_FILE_PATH_TAKE_WRITE_LOCK_FAIL();
+										ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+										return ret;
+									}
+									read_file_info.path_type = tlvota_file->path_type;
+									strncpy(read_file_info.file_name, (kal_char *)&(tlvota_file->relative_path_name), MCF_FILE_MAX_NAME_LEN - 1);
+									for(i = 0; i < MAX_SIM_NUM; i++){
+										is_read_general_tlvota[i] = KAL_TRUE;
+									}
+								} else {
+									MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_FAIL(req->config_type);
+								}
+
+								read_file_info.result = ret;
+								read_file_info.end_time = kal_get_systicks();
+
+								mcf_em_send_ota_file_info(&read_file_info);
+							}
+						} else {
+                            if (pMcf->general_is_ignore_dsbp == KAL_TRUE) {
+								/* If MCF is in DSBP passive mode, change to DSBP active mode */
+								ret = mcf_set_dsbp_mode(KAL_FALSE, KAL_TRUE, sim_id);
+								if (ret != MCF_OTA_R_SUCCESS) {
+									return ret;
+								}
+								pMcf->general_is_ignore_dsbp = KAL_FALSE;
+							}
+							/* Read MCF general TLV-OTA file information in NVRAM */
+							if ( !nvram_external_read_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+								ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+								return ret;
+							}
+
+							strncpy(nv_tlvota_file.path, "", MCF_FILE_MAX_MD_PATH_LEN - 1);
+							strncpy(nv_tlvota_file.name, "", MCF_FILE_MAX_NAME_LEN - 1);
+
+							/* Write MCF general TLV-OTA file information in NVRAM */
+							if ( !nvram_external_write_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+								MD_TRC_MCF_TR_SET_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+								ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+								return ret;
+							}
+
+							if (req->trigger_dsbp == 1) {
+								/* Deactivate general TLV-OTA setting, reset general TLV-OTA buffer */
+								MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+								if (tlvota_file) {
+									kal_mem_set(tlvota_file->buff, 0, sizeof(kal_uint8) * MCF_MAX_TLVOTA_FILE_SIZE);
+									tlvota_file->path_type = req->path_type;
+									strncpy(tlvota_file->relative_path_name, "", MCF_FILE_MAX_NAME_LEN - 1);
+                                    tlvota_file->last_mod_time = 0;
+									/* Clear last updated file informantion */
+									kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+									MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+								} else {
+									MD_TRC_MCF_TR_SET_FILE_PATH_RESET_BUFFER_FAIL();
+								}
+								for(i = 0; i < MAX_SIM_NUM; i++){
+									is_read_general_tlvota[i] = KAL_TRUE;
+								}
+							}
+						}
+					}else{
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+						ret = mcf_combined_ota_file(req);
+						if(ret != MCF_OTA_R_SUCCESS){
+							return ret;
+                        }
+#else
+                        ret = MCF_OTA_R_MCF_NOT_SUPPORT;
+                        return ret;
+#endif
+					}
+
+                    break;
+                }
+
+                default:
+                    MD_TRC_MCF_TR_SET_FILE_PATH_INVALID_CONFIG_TYPE(req->config_type);
+                    ret = MCF_OTA_R_INVALID_PARAMETER;
+                    break;
+            }
+
+            break;
+        }
+
+        default:
+            ASSERT(0);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+    }
+
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_get_applied_file_path(
+    l4c_mcf_get_config_req_struct *req,
+    l4c_mcf_get_config_cnf_struct *resp)
+{
+    mcf_t              *pMcf = mcf_get_instance();
+    sim_interface_enum  sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+    mcf_ota_result_e    ret = MCF_OTA_R_SUCCESS;
+
+    switch (req->op)
+    {
+        case L4C_MCF_CONFIG_GET_APPLIED_FILE_PATH:
+            switch (req->config_type)
+            {
+                case L4C_MCF_CONFIG_TYPE_DEFAULT_BIN:
+                {
+                    mcf_ota_file_t *ota_file = &(pMcf->ota_file);
+
+                    resp->config_type = req->config_type;
+
+                    MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                    if (ota_file) {
+                        resp->path_type = ota_file->path_type;
+                        strncpy((kal_char *)resp->config1, ota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+                        MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                    } else {
+                        MD_TRC_MCF_TR_GET_APPLIED_FILE_PATH_TAKE_READ_LOCK_FAIL();
+                        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                    }
+                    break;
+                }
+
+                case L4C_MCF_CONFIG_TYPE_CARRIER_BIN:
+                {
+                    mcf_tlvota_file_t  *tlvota_file = &(pMcf->tlvota_file[sim_id]);
+
+                    resp->config_type = req->config_type;
+
+                    MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (tlvota_file) {
+                        resp->path_type = tlvota_file->path_type;
+                        strncpy((kal_char *)resp->config1, tlvota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+                        MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    } else {
+                        MD_TRC_MCF_TR_GET_APPLIED_FILE_PATH_TAKE_READ_LOCK_FAIL();
+                        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                    }
+                    break;
+                }
+
+                case L4C_MCF_CONFIG_TYPE_GENERAL_CARRIER_BIN:
+                {
+                    mcf_tlvota_file_t  *tlvota_file = &(pMcf->general_tlvota_file);
+
+                    resp->config_type = req->config_type;
+
+                    MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (tlvota_file) {
+                        resp->path_type = tlvota_file->path_type;
+                        strncpy((kal_char *)resp->config1, tlvota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+                        MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    } else {
+                        MD_TRC_MCF_TR_GET_APPLIED_FILE_PATH_TAKE_READ_LOCK_FAIL();
+                        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                    }
+                    break;
+                }
+
+                default:
+                    MD_TRC_MCF_TR_GET_APPLIED_FILE_PATH_UNSUPPORTED_CONFIG_TYPE(req->config_type);
+                    ret = MCF_OTA_R_INVALID_PARAMETER;
+                    break;
+            }
+            MD_TRC_MCF_TR_GET_APPLIED_FILE_PATH(ret, req->ps_id, sim_id, req->config_type, resp->path_type, resp->config1);
+            break;
+
+        default:
+            ASSERT(0);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+    }
+
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_dump_all_lid_data(l4c_mcf_dump_data_req_struct *req_ptr)
+{
+    mcf_t                          *pMcf = mcf_get_instance();
+    mcf_custom_dump_param_struct    dump_para[MAX_SIM_NUM];
+    mcf_dump_lid_header_struct      dump_lid_header;
+    mcf_dump_lid_header_struct     *dump_header_ptr = NULL;
+    nvram_ltable_entry_struct       lid_info = {0};
+    time_t                          time_sec;
+    MCF_TIME_STRUCT                 curr_time;
+    kal_wchar                       foldername[MCF_FILE_MAX_MD_PATH_LEN];
+    kal_char                        folder_path[MCF_FILE_MAX_MD_PATH_LEN];
+    kal_char                        file_name[MCF_FILE_MAX_MD_PATH_LEN];
+    kal_uint32                      total_size;
+    kal_uint32                      lid_size;
+    kal_uint32                      padding;
+    kal_uint32                      i, j, k;
+    kal_bool                        is_found = KAL_FALSE;
+    kal_bool                        ret;
+    nvram_errno_enum                nvram_api_ret;
+    mcf_ota_result_e                mcf_ret = MCF_OTA_R_SUCCESS;
+    kal_uint32                      dump_lid_cnt = 0;
+    kal_uint32                      m;
+    kal_char                        last_dump_folder_name[MCF_FILE_MAX_MD_PATH_LEN];
+    kal_int32                       fs_ret = FS_NO_ERROR;
+    kal_wchar                       pathname[MCF_FILE_MAX_MD_PATH_LEN];
+    kal_int32                       ret_snprintf;
+    kal_int32                       ret_sprintf;
+    time_t                          time_ret;
+
+    /* Create dump folder */
+    time_ret = time(&time_sec);
+    if (time_ret == (time_t)(-1)){
+        time_sec = 0;
+    }
+#if __MTK_TARGET__
+    localtime_r(&time_sec, &curr_time);
+#else
+    curr_time.tm_year = 12;
+    curr_time.tm_mon = 3;
+    curr_time.tm_mday = 4;
+    curr_time.tm_hour = 5;
+    curr_time.tm_min = 6;
+    curr_time.tm_sec = 7;
+#endif
+    mcf_snprintf(folder_path, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s\\%s_%.4d%.2d%.2d_%.2d%.2d%.2d%c", MCF_FS_CUSTOM_FOLDER_PATH, MCF_DUMP_FOLDER_PREFIX, curr_time.tm_year + 1900, curr_time.tm_mon + 1, curr_time.tm_mday, curr_time.tm_hour, curr_time.tm_min, curr_time.tm_sec, '\0');
+
+    kal_wsprintf(foldername, "%s\0", folder_path);
+    FS_CreateDir(foldername);
+    
+    /* Support MCF Tool Read/Write - Delete txt */
+
+    kal_wsprintf(pathname, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_DUMP_FOLDER_NAME);
+    fs_ret = FS_Delete(pathname);
+    
+    if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+        MD_TRC_MCF_TR_DUMP_ALL_LID_DELETE_FILE_FAIL(fs_ret);
+        mcf_ret = MCF_OTA_R_WRITE_DISK_FAIL;
+        return mcf_ret;
+    }
+
+    MD_TRC_MCF_TR_DUMP_ALL_LID_START(folder_path);
+
+    kal_mem_set(dump_para, 0, sizeof(mcf_custom_dump_param_struct) * MAX_SIM_NUM);
+    for (k = 0; k < MAX_SIM_NUM; k++) {
+        dump_para[k].ps_id = l4c_gemini_get_switched_sim_id(k);
+        dump_para[k].sbp_id = pMcf->tlvota_file[k].sbp_id;
+        kal_mem_cpy(&(dump_para[k].mcc), &(pMcf->tlvota_file[k].mcc), MAX_MCC_STR_LEN);
+        kal_mem_cpy(&(dump_para[k].mnc), &(pMcf->tlvota_file[k].mnc), MAX_MNC_STR_LEN);
+        kal_mem_cpy(&(dump_para[k].iccid), &(pMcf->tlvota_file[k].iccid), 21);
+        dump_para[k].size = &lid_size;
+    }
+    
+    dump_lid_cnt = req_ptr->lid_cnt;
+    MD_TRC_MCF_TR_DUMP_ALL_LID_NUMBER(dump_lid_cnt);
+
+    /* Dump all LIDs */
+    if(dump_lid_cnt == 0){
+        for (i = 0; i < MCF_LID_MAPPING_TBL_SIZE; i++) {
+            is_found = KAL_FALSE;
+
+            nvram_api_ret = nvram_external_get_lid_info(mcf_db_lid_mapping_tbl[i].lid_num, &lid_info);
+            if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+                MD_TRC_MCF_TR_DUMP_ALL_LID_GET_LID_INFO_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, nvram_api_ret);
+                continue;
+            }
+
+            if ((lid_info.size % 4) == 0) {
+                padding = 0;
+            } else {
+                padding = 4 - (lid_info.size % 4);
+                MD_TRC_MCF_TR_DUMP_ALL_LID_SIZE_NOT_ALIGNMENT(lid_info.LID, lid_info.size, padding);
+            }
+
+            for (j = 0; j < mcf_dump_param_tbl_num; j++) {
+                if ( (mcf_dump_param_tbl[j].lid == mcf_db_lid_mapping_tbl[i].lid_num) ) {
+                    is_found = KAL_TRUE;
+
+                    if (mcf_db_lid_mapping_tbl[i].is_ota == KAL_TRUE) {
+                        total_size = 0;
+
+                        if ((mcf_dump_param_tbl[j].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA) != 0) {
+                            for (k = 0; k < lid_info.total_records; k++) {
+                                dump_header_ptr = (mcf_dump_lid_header_struct *)(mcf_dump_buffer + (sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding) * k);
+                                kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                dump_para[0].lid = mcf_dump_param_tbl[j].lid;
+                                dump_para[0].type = MCF_TYPE_OTA;
+                                dump_para[0].record_idx = k + 1;
+                                dump_para[0].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+                                *(dump_para[0].size) = 0;
+
+                                MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_CALLBACK(dump_para[0].lid, dump_para[0].type, dump_para[0].record_idx, dump_para[0].buffer);
+
+                                ret = mcf_dump_param_tbl[j].dump_func_ptr(&dump_para[0]);
+                                if ( (ret == KAL_FALSE) || (*(dump_para[0].size) != lid_info.size) ) {
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_DUMP_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, ret, lid_info.size, *(dump_para[0].size));
+                                    break;
+                                }
+
+                                /* Add header */
+                                kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                dump_lid_header.content_type = MCF_TYPE_OTA;
+                                dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                dump_lid_header.content_len = lid_info.size;
+                                dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                dump_lid_header.record_idx = k + 1;
+                                strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                dump_lid_header.checksum = 0; /* unused */
+                                kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+                            }
+                        } else {
+                            /* If not register callback */
+                            for (k = 0; k < lid_info.total_records; k++) {
+                                dump_header_ptr = (mcf_dump_lid_header_struct *)(mcf_dump_buffer + (sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding) * k);
+                                kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                dump_para[0].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+
+                                if ( !nvram_external_read_data(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, dump_para[0].buffer, lid_info.size) ) {
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_READ_NVRAM_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, dump_para[0].buffer, lid_info.size);
+                                    break;
+                                }
+
+                                /* Add header */
+                                kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                dump_lid_header.content_type = MCF_TYPE_OTA;
+                                dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                dump_lid_header.content_len = lid_info.size;
+                                dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                dump_lid_header.record_idx = k + 1;
+                                strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                dump_lid_header.checksum = 0; /* unused */
+                                kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+                            }
+                        }
+
+                        ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_default%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, MCF_DUMP_FILE_POSTFIX, '\0');
+                        if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                            strncpy(file_name, "default_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                            MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_DEFAULT_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, ret_snprintf);
+                        }
+                        mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                            return mcf_ret;
+                        }
+                    }
+
+                    if (mcf_db_lid_mapping_tbl[i].is_ota_by_op == KAL_TRUE) {
+                        if ((mcf_dump_param_tbl[j].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA_BY_OP) != 0) {
+                            for (k = 0; k < MAX_SIM_NUM; k++) {
+                                if ( (strncmp((kal_char *)(dump_para[k].mcc), "", MAX_MCC_STR_LEN) == 0) || (strncmp((kal_char *)(dump_para[k].mnc), "", MAX_MNC_STR_LEN) == 0) ) {
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_NULL_MCC_MNC((kal_char *)(dump_para[k].mcc), (kal_char *)(dump_para[k].mnc));
+                                    continue;
+                                }
+
+                                total_size = 0;
+
+                                dump_header_ptr = (mcf_dump_lid_header_struct *)mcf_dump_buffer;
+                                kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                dump_para[k].lid = mcf_dump_param_tbl[j].lid;
+                                dump_para[k].type = MCF_TYPE_OTA_BY_OP;
+                                dump_para[k].record_idx = 1;
+                                dump_para[k].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+                                *(dump_para[k].size) = 0;
+
+                                MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_BY_OP_CALLBACK_1_USIR(dump_para[k].ps_id, dump_para[k].sbp_id, dump_para[k].mcc, dump_para[k].mnc, dump_para[k].iccid);
+                                MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_BY_OP_CALLBACK_2(dump_para[k].lid, dump_para[k].type, dump_para[k].record_idx, dump_para[k].buffer);
+
+                                ret = mcf_dump_param_tbl[j].dump_func_ptr(&dump_para[k]);
+                                if ( (ret == KAL_FALSE) || (*(dump_para[k].size) != lid_info.size) ) {
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_BY_OP_DUMP_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, ret, lid_info.size, *(dump_para[k].size));
+                                    break;
+                                }
+
+                                /* Add header */
+                                kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                dump_lid_header.content_type = MCF_TYPE_OTA_BY_OP;
+                                dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                dump_lid_header.content_len = lid_info.size;
+                                dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                dump_lid_header.record_idx = 1;
+                                strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                dump_lid_header.checksum = 0; /* unused */
+                                kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+
+                                ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_SIM%d%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, k + 1, MCF_DUMP_FILE_POSTFIX, '\0');
+                                if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                                    strncpy(file_name, "SIM_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_SIM_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, ret_snprintf);
+                                }
+                                mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                                if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                                    return mcf_ret;
+                                }
+                            }
+                        } else {
+                            /* If not register callback */
+                            for (k = 0; k < MAX_SIM_NUM; k++) {
+                                if ( (strncmp((kal_char *)(dump_para[k].mcc), "", MAX_MCC_STR_LEN) == 0) || (strncmp((kal_char *)(dump_para[k].mnc), "", MAX_MNC_STR_LEN) == 0) ) {
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_NULL_MCC_MNC((kal_char *)(dump_para[k].mcc), (kal_char *)(dump_para[k].mnc));
+                                    continue;
+                                }
+
+                                total_size = 0;
+
+                                dump_header_ptr = (mcf_dump_lid_header_struct *)mcf_dump_buffer;
+                                kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                dump_para[k].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+
+                                if ( !nvram_external_read_data(mcf_db_lid_mapping_tbl[i].lid_num, dump_para[k].ps_id + 1, dump_para[k].buffer, lid_info.size) ) {
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_READ_NVRAM_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, dump_para[k].ps_id + 1, dump_para[k].buffer, lid_info.size);
+                                    break;
+                                }
+
+                                /* Add header */
+                                kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                dump_lid_header.content_type = MCF_TYPE_OTA_BY_OP;
+                                dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                dump_lid_header.content_len = lid_info.size;
+                                dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                dump_lid_header.record_idx = 1;
+                                strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                dump_lid_header.checksum = 0; /* unused */
+                                kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+
+                                ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_SIM%d%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, k + 1, MCF_DUMP_FILE_POSTFIX, '\0');
+                                if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                                    strncpy(file_name, "SIM_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_SIM_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, ret_snprintf);
+                                }
+                                mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                                if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                                    return mcf_ret;
+                                }
+                            }
+                        }
+                    }
+
+                    break;
+                }
+            }
+
+            /* If not register callback */
+            if (is_found == KAL_FALSE) {
+                if (mcf_db_lid_mapping_tbl[i].is_ota == KAL_TRUE) {
+                    total_size = 0;
+
+                    for (k = 0; k < lid_info.total_records; k++) {
+                        dump_header_ptr = (mcf_dump_lid_header_struct *)(mcf_dump_buffer + (sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding) * k);
+                        kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                        dump_para[0].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+
+                        if ( !nvram_external_read_data(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, dump_para[0].buffer, lid_info.size) ) {
+                            MD_TRC_MCF_TR_DUMP_ALL_LID_READ_NVRAM_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, dump_para[0].buffer, lid_info.size);
+                            break;
+                        }
+
+                        /* Add header */
+                        kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                        strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                        dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                        dump_lid_header.content_type = MCF_TYPE_OTA;
+                        dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                        dump_lid_header.content_len = lid_info.size;
+                        dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                        dump_lid_header.record_idx = k + 1;
+                        strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                        dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                        dump_lid_header.checksum = 0; /* unused */
+                        kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                        total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+                    }
+
+                    ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_default%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, MCF_DUMP_FILE_POSTFIX, '\0');
+                    if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                        strncpy(file_name, "default_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                        MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_DEFAULT_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, ret_snprintf);
+                    }
+                    mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                        return mcf_ret;
+                    }
+                }
+
+                if (mcf_db_lid_mapping_tbl[i].is_ota_by_op == KAL_TRUE) {
+                    for (k = 0; k < MAX_SIM_NUM; k++) {
+                        if ( (strncmp((kal_char *)(dump_para[k].mcc), "", MAX_MCC_STR_LEN) == 0) || (strncmp((kal_char *)(dump_para[k].mnc), "", MAX_MNC_STR_LEN) == 0) ) {
+                            MD_TRC_MCF_TR_DUMP_ALL_LID_NULL_MCC_MNC((kal_char *)(dump_para[k].mcc), (kal_char *)(dump_para[k].mnc));
+                            continue;
+                        }
+
+                        total_size = 0;
+
+                        dump_header_ptr = (mcf_dump_lid_header_struct *)mcf_dump_buffer;
+                        kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                        dump_para[k].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+
+                        if ( !nvram_external_read_data(mcf_db_lid_mapping_tbl[i].lid_num, dump_para[k].ps_id + 1, dump_para[k].buffer, lid_info.size) ) {
+                            MD_TRC_MCF_TR_DUMP_ALL_LID_READ_NVRAM_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, dump_para[k].ps_id + 1, dump_para[k].buffer, lid_info.size);
+                            break;
+                        }
+
+                        /* Add header */
+                        kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                        strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                        dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                        dump_lid_header.content_type = MCF_TYPE_OTA_BY_OP;
+                        dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                        dump_lid_header.content_len = lid_info.size;
+                        dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                        dump_lid_header.record_idx = 1;
+                        strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                        dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                        dump_lid_header.checksum = 0; /* unused */
+                        kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                        total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+
+                        ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_SIM%d%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, k + 1, MCF_DUMP_FILE_POSTFIX, '\0');
+                        if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                            strncpy(file_name, "SIM_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                            MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_SIM_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, ret_snprintf);
+                        }
+                        mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                            return mcf_ret;
+                        }
+                    }
+                }
+            }
+        }
+    }else if (dump_lid_cnt > 0)
+    {
+        /* Only dump dump_lid_cnt LIDs */
+        for(m = 0; m < dump_lid_cnt; m++){
+            is_found = KAL_FALSE;
+            for (i = 0; i < MCF_LID_MAPPING_TBL_SIZE; i++) {
+                if (req_ptr->lid[m] == mcf_db_lid_mapping_tbl[i].lid_num){
+                    is_found = KAL_TRUE;
+                }
+                    
+            }
+            if (is_found == KAL_FALSE)
+            {
+                MD_TRC_MCF_TR_DUMP_ALL_LID_CANNOT_FIND_LID(req_ptr->lid[m]);
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                return mcf_ret;
+            }
+        }
+
+        for(m = 0; m < dump_lid_cnt; m++){
+            is_found = KAL_FALSE;
+            for (i = 0; i < MCF_LID_MAPPING_TBL_SIZE; i++) {
+                if (req_ptr->lid[m] == mcf_db_lid_mapping_tbl[i].lid_num){
+                    is_found = KAL_FALSE;
+
+                    nvram_api_ret = nvram_external_get_lid_info(mcf_db_lid_mapping_tbl[i].lid_num, &lid_info);
+                    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+                        MD_TRC_MCF_TR_DUMP_ALL_LID_GET_LID_INFO_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, nvram_api_ret);
+                        continue;
+                    }
+
+                    if ((lid_info.size % 4) == 0) {
+                        padding = 0;
+                    } else {
+                        padding = 4 - (lid_info.size % 4);
+                        MD_TRC_MCF_TR_DUMP_ALL_LID_SIZE_NOT_ALIGNMENT(lid_info.LID, lid_info.size, padding);
+                    }
+
+                    for (j = 0; j < mcf_dump_param_tbl_num; j++) {
+                        if ( (mcf_dump_param_tbl[j].lid == mcf_db_lid_mapping_tbl[i].lid_num) ) {
+                            is_found = KAL_TRUE;
+
+                            if (mcf_db_lid_mapping_tbl[i].is_ota == KAL_TRUE) {
+                                total_size = 0;
+
+                                if ((mcf_dump_param_tbl[j].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA) != 0) {
+                                    for (k = 0; k < lid_info.total_records; k++) {
+                                        dump_header_ptr = (mcf_dump_lid_header_struct *)(mcf_dump_buffer + (sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding) * k);
+                                        kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                        dump_para[0].lid = mcf_dump_param_tbl[j].lid;
+                                        dump_para[0].type = MCF_TYPE_OTA;
+                                        dump_para[0].record_idx = k + 1;
+                                        dump_para[0].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+                                        *(dump_para[0].size) = 0;
+
+                                        MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_CALLBACK(dump_para[0].lid, dump_para[0].type, dump_para[0].record_idx, dump_para[0].buffer);
+
+                                        ret = mcf_dump_param_tbl[j].dump_func_ptr(&dump_para[0]);
+                                        if ( (ret == KAL_FALSE) || (*(dump_para[0].size) != lid_info.size) ) {
+                                            MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_DUMP_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, ret, lid_info.size, *(dump_para[0].size));
+                                            break;
+                                        }
+
+                                        /* Add header */
+                                        kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                        strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                        dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                        dump_lid_header.content_type = MCF_TYPE_OTA;
+                                        dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                        dump_lid_header.content_len = lid_info.size;
+                                        dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                        dump_lid_header.record_idx = k + 1;
+                                        strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                        dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                        dump_lid_header.checksum = 0; /* unused */
+                                        kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                        total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+                                    }
+                                } else {
+                                    /* If not register callback */
+                                    for (k = 0; k < lid_info.total_records; k++) {
+                                        dump_header_ptr = (mcf_dump_lid_header_struct *)(mcf_dump_buffer + (sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding) * k);
+                                        kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                        dump_para[0].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+
+                                        if ( !nvram_external_read_data(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, dump_para[0].buffer, lid_info.size) ) {
+                                            MD_TRC_MCF_TR_DUMP_ALL_LID_READ_NVRAM_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, dump_para[0].buffer, lid_info.size);
+                                            break;
+                                        }
+
+                                        /* Add header */
+                                        kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                        strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                        dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                        dump_lid_header.content_type = MCF_TYPE_OTA;
+                                        dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                        dump_lid_header.content_len = lid_info.size;
+                                        dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                        dump_lid_header.record_idx = k + 1;
+                                        strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                        dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                        dump_lid_header.checksum = 0; /* unused */
+                                        kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                        total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+                                    }
+                                }
+
+                                ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_default%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, MCF_DUMP_FILE_POSTFIX, '\0');
+                                if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                                    strncpy(file_name, "default_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_DEFAULT_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, ret_snprintf);
+                                }
+                                mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                                if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                                    return mcf_ret;
+                                }
+                            }
+
+                            if (mcf_db_lid_mapping_tbl[i].is_ota_by_op == KAL_TRUE) {
+                                if ((mcf_dump_param_tbl[j].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA_BY_OP) != 0) {
+                                    for (k = 0; k < MAX_SIM_NUM; k++) {
+                                        if ( (strncmp((kal_char *)(dump_para[k].mcc), "", MAX_MCC_STR_LEN) == 0) || (strncmp((kal_char *)(dump_para[k].mnc), "", MAX_MNC_STR_LEN) == 0) ) {
+                                            MD_TRC_MCF_TR_DUMP_ALL_LID_NULL_MCC_MNC((kal_char *)(dump_para[k].mcc), (kal_char *)(dump_para[k].mnc));
+                                            continue;
+                                        }
+
+                                        total_size = 0;
+
+                                        dump_header_ptr = (mcf_dump_lid_header_struct *)mcf_dump_buffer;
+                                        kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                        dump_para[k].lid = mcf_dump_param_tbl[j].lid;
+                                        dump_para[k].type = MCF_TYPE_OTA_BY_OP;
+                                        dump_para[k].record_idx = 1;
+                                        dump_para[k].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+                                        *(dump_para[k].size) = 0;
+
+                                        MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_BY_OP_CALLBACK_1_USIR(dump_para[k].ps_id, dump_para[k].sbp_id, dump_para[k].mcc, dump_para[k].mnc, dump_para[k].iccid);
+                                        MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_BY_OP_CALLBACK_2(dump_para[k].lid, dump_para[k].type, dump_para[k].record_idx, dump_para[k].buffer);
+
+                                        ret = mcf_dump_param_tbl[j].dump_func_ptr(&dump_para[k]);
+                                        if ( (ret == KAL_FALSE) || (*(dump_para[k].size) != lid_info.size) ) {
+                                            MD_TRC_MCF_TR_DUMP_ALL_LID_OTA_BY_OP_DUMP_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, ret, lid_info.size, *(dump_para[k].size));
+                                            break;
+                                        }
+
+                                        /* Add header */
+                                        kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                        strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                        dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                        dump_lid_header.content_type = MCF_TYPE_OTA_BY_OP;
+                                        dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                        dump_lid_header.content_len = lid_info.size;
+                                        dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                        dump_lid_header.record_idx = 1;
+                                        strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                        dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                        dump_lid_header.checksum = 0; /* unused */
+                                        kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                        total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+
+                                        ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_SIM%d%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, k + 1, MCF_DUMP_FILE_POSTFIX, '\0');
+                                        if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                                            strncpy(file_name, "SIM_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                                            MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_SIM_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, ret_snprintf);
+                                        }
+                                        mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                                        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                                            return mcf_ret;
+                                        }
+                                    }
+                                } else {
+                                    /* If not register callback */
+                                    for (k = 0; k < MAX_SIM_NUM; k++) {
+                                        if ( (strncmp((kal_char *)(dump_para[k].mcc), "", MAX_MCC_STR_LEN) == 0) || (strncmp((kal_char *)(dump_para[k].mnc), "", MAX_MNC_STR_LEN) == 0) ) {
+                                            MD_TRC_MCF_TR_DUMP_ALL_LID_NULL_MCC_MNC((kal_char *)(dump_para[k].mcc), (kal_char *)(dump_para[k].mnc));
+                                            continue;
+                                        }
+
+                                        total_size = 0;
+
+                                        dump_header_ptr = (mcf_dump_lid_header_struct *)mcf_dump_buffer;
+                                        kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                        dump_para[k].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+
+                                        if ( !nvram_external_read_data(mcf_db_lid_mapping_tbl[i].lid_num, dump_para[k].ps_id + 1, dump_para[k].buffer, lid_info.size) ) {
+                                            MD_TRC_MCF_TR_DUMP_ALL_LID_READ_NVRAM_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, dump_para[k].ps_id + 1, dump_para[k].buffer, lid_info.size);
+                                            break;
+                                        }
+
+                                        /* Add header */
+                                        kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                        strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                        dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                        dump_lid_header.content_type = MCF_TYPE_OTA_BY_OP;
+                                        dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                        dump_lid_header.content_len = lid_info.size;
+                                        dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                        dump_lid_header.record_idx = 1;
+                                        strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                        dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                        dump_lid_header.checksum = 0; /* unused */
+                                        kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                        total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+
+                                        ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_SIM%d%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, k + 1, MCF_DUMP_FILE_POSTFIX, '\0');
+                                        if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                                            strncpy(file_name, "SIM_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                                            MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_SIM_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, ret_snprintf);
+                                        }
+                                        mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                                        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                                            return mcf_ret;
+                                        }
+                                    }
+                                }
+                            }
+
+                            break;
+                        }
+                    }
+
+                    /* If not register callback */
+                    if (is_found == KAL_FALSE) {
+                        if (mcf_db_lid_mapping_tbl[i].is_ota == KAL_TRUE) {
+                            total_size = 0;
+
+                            for (k = 0; k < lid_info.total_records; k++) {
+                                dump_header_ptr = (mcf_dump_lid_header_struct *)(mcf_dump_buffer + (sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding) * k);
+                                kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                dump_para[0].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+
+                                if ( !nvram_external_read_data(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, dump_para[0].buffer, lid_info.size) ) {
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_READ_NVRAM_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, dump_para[0].buffer, lid_info.size);
+                                    break;
+                                }
+
+                                /* Add header */
+                                kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                dump_lid_header.content_type = MCF_TYPE_OTA;
+                                dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                dump_lid_header.content_len = lid_info.size;
+                                dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                dump_lid_header.record_idx = k + 1;
+                                strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                dump_lid_header.checksum = 0; /* unused */
+                                kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+                            }
+
+                            ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_default%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, MCF_DUMP_FILE_POSTFIX, '\0');
+                            if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                                strncpy(file_name, "default_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                                MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_DEFAULT_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, ret_snprintf);
+                            }
+                            mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                            if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                                return mcf_ret;
+                            }
+                        }
+
+                        if (mcf_db_lid_mapping_tbl[i].is_ota_by_op == KAL_TRUE) {
+                            for (k = 0; k < MAX_SIM_NUM; k++) {
+                                if ( (strncmp((kal_char *)(dump_para[k].mcc), "", MAX_MCC_STR_LEN) == 0) || (strncmp((kal_char *)(dump_para[k].mnc), "", MAX_MNC_STR_LEN) == 0) ) {
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_NULL_MCC_MNC((kal_char *)(dump_para[k].mcc), (kal_char *)(dump_para[k].mnc));
+                                    continue;
+                                }
+
+                                total_size = 0;
+
+                                dump_header_ptr = (mcf_dump_lid_header_struct *)mcf_dump_buffer;
+                                kal_mem_set(dump_header_ptr, 0, sizeof(mcf_dump_lid_header_struct) + lid_info.size + padding);
+
+                                dump_para[k].buffer = (kal_uint8 *)dump_header_ptr + sizeof(mcf_dump_lid_header_struct);
+
+                                if ( !nvram_external_read_data(mcf_db_lid_mapping_tbl[i].lid_num, dump_para[k].ps_id + 1, dump_para[k].buffer, lid_info.size) ) {
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_READ_NVRAM_FAIL(mcf_db_lid_mapping_tbl[i].lid_num, dump_para[k].ps_id + 1, dump_para[k].buffer, lid_info.size);
+                                    break;
+                                }
+
+                                /* Add header */
+                                kal_mem_set(&dump_lid_header, 0, sizeof(mcf_dump_lid_header_struct));
+                                strncpy(dump_lid_header.sync_token, MCF_DUMP_LID_SYNC_TOKEN, 7);
+                                dump_lid_header.header_version = MCF_DUMP_LID_HEADER_VERSION;
+                                dump_lid_header.content_type = MCF_TYPE_OTA_BY_OP;
+                                dump_lid_header.operation_mask = MCF_FILE_OP_NONE;
+                                dump_lid_header.content_len = lid_info.size;
+                                dump_lid_header.lid = mcf_db_lid_mapping_tbl[i].lid_num;
+                                dump_lid_header.record_idx = 1;
+                                strncpy(dump_lid_header.lid_version, lid_info.fileverno, FILE_VERNO_LEN);
+                                dump_lid_header.lid_version[FILE_VERNO_LEN] = '\0';
+                                dump_lid_header.checksum = 0; /* unused */
+                                kal_mem_cpy(dump_header_ptr, &dump_lid_header, sizeof(mcf_dump_lid_header_struct));
+
+                                total_size += sizeof(mcf_dump_lid_header_struct) + dump_lid_header.content_len + padding;
+
+                                ret_snprintf = kal_snprintf(file_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%d_SIM%d%s%c", MCF_DUMP_FILE_PREFIX, mcf_db_lid_mapping_tbl[i].lid_num, k + 1, MCF_DUMP_FILE_POSTFIX, '\0');
+                                if (ret_snprintf < 0 || ret_snprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                                    strncpy(file_name, "SIM_error.dump", MCF_FILE_MAX_MD_PATH_LEN - 1);
+                                    MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_SIM_FILENAME_ERROR(mcf_db_lid_mapping_tbl[i].lid_num, k + 1, ret_snprintf);
+                                }
+                                mcf_ret = mcf_write_buffer(folder_path, file_name, mcf_dump_buffer, total_size);
+                                if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                                    return mcf_ret;
+                                }
+                            }
+                        }
+                    }
+                
+                }
+            }
+        }
+    }
+    
+    /* Support MCF Tool Read/Write - Write dump folder name into txt */
+    kal_mem_set(last_dump_folder_name, 0, MCF_FILE_MAX_MD_PATH_LEN);
+    ret_sprintf = kal_snprintf(last_dump_folder_name, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s_%.4d%.2d%.2d_%.2d%.2d%.2d%c", MCF_DUMP_FOLDER_PREFIX, curr_time.tm_year + 1900, curr_time.tm_mon + 1, curr_time.tm_mday, curr_time.tm_hour, curr_time.tm_min, curr_time.tm_sec, '\0');
+    if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_MD_PATH_LEN){
+        strncpy(last_dump_folder_name, "unknown_error", MCF_FILE_MAX_MD_PATH_LEN - 1);
+    }
+    MD_TRC_MCF_TR_DUMP_ALL_LID_DUMP_FOLDER_NAME(last_dump_folder_name);
+    if(mcf_ret == MCF_OTA_R_SUCCESS){
+        mcf_ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_DUMP_FOLDER_NAME, (kal_uint8 *)last_dump_folder_name, sizeof(kal_char) * strlen(last_dump_folder_name));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            return mcf_ret;
+        }
+    }
+
+    return mcf_ret;
+}
+
+_STATIC mcf_ota_result_e mcf_config_ini_info(
+    l4c_mcf_config_req_struct *req,
+    l4c_mcf_config_cnf_struct *resp)
+{
+    mcf_t                                   *pMcf = mcf_get_instance();
+    kal_char                                apply_filename[MCF_FILE_MAX_NAME_LEN];
+    l4c_mcf_path_type_enum                  apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+    mcf_ota_result_e                        mcf_ret = MCF_OTA_R_SUCCESS;
+    mcf_ini_file_t                          *ini_file = &(pMcf->ini_file);
+    kal_char                                *buffer = (kal_char *)ini_file->tmp_buff;
+    kal_char                                orign_value[MCF_MAX_INI_ITEM_VALUE_LEN];
+    kal_uint64                              ini_path_ota_file_last_mod_time = 0;
+    kal_uint64                              ini_path_runtime_file_last_mod_time = 0;
+    kal_uint64                              ini_last_read_mod_time = 0;
+    kal_char                                ini_root_path[20];
+    
+    if(strcmp((kal_char *)req->item,"") == 0){
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+        return mcf_ret;
+    }
+    if(strlen((kal_char *)req->item) > 63){
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+        return mcf_ret;
+    }
+    
+    kal_mem_set((kal_char *)resp->item,0,MCF_MAX_INI_ITEM_LEN);
+    kal_mem_set((kal_char *)resp->value,0,MCF_MAX_INI_ITEM_VALUE_LEN);
+    strncpy((kal_char *)resp->item, (kal_char *)req->item, MCF_MAX_INI_ITEM_LEN-1);
+    
+    switch (req->mode)
+    {
+        case L4C_MCF_CONFIG_MODE_READ:
+            
+            ini_last_read_mod_time = ini_file->last_mod_time;
+            
+            if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ini_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                ini_path_ota_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_CONFIG_INI_READ_INI_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if (mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ini_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    ini_path_runtime_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_CONFIG_INI_READ_INI_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    mcf_ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+                    return mcf_ret;
+                }    
+            }
+            
+            
+            if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ini_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                ini_path_runtime_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_CONFIG_INI_READ_INI_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ini_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    ini_path_ota_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_CONFIG_INI_READ_INI_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    mcf_ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+                    return mcf_ret;
+                }
+            }
+            
+            MD_TRC_MCF_TR_CONFIG_INI_LAST_MOD_TIME(ini_path_ota_file_last_mod_time, ini_path_runtime_file_last_mod_time, ini_last_read_mod_time);
+            kal_mem_set(ini_root_path,0,20);
+            if (ini_path_ota_file_last_mod_time > ini_path_runtime_file_last_mod_time){
+                strncpy(ini_root_path,MCF_FS_DEFAULT_FOLDER_PATH, 19);
+            }else{
+               strncpy(ini_root_path,MCF_FS_CUSTOM_FOLDER_PATH, 19);
+            }
+            
+            MD_TRC_MCF_TR_CONFIG_INI_READ(ini_root_path);
+            if (mcf_read_ini_file(ini_root_path, MCF_FS_DEFAULT_INI_FILE_NAME, &apply_path_type, apply_filename, pMcf) == MCF_OTA_R_SUCCESS) {
+                
+            } else {
+               /* Cannot do OTA if fail to read ini file */
+                mcf_ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+                return mcf_ret;
+            }
+            
+            if (mcf_find_ini_item((kal_char *)ini_file->buff, (kal_char *)resp->item, (kal_char *)resp->value, pMcf) == KAL_TRUE) {
+                
+                
+                
+            } else {
+                /* Cannot do OTA if fail to read ini file */
+                mcf_ret = MCF_OTA_R_INVALID_INI_ITEM;
+                return mcf_ret;
+            }
+                
+            
+            break;
+        
+        case L4C_MCF_CONFIG_MODE_WRITE:
+        
+            strncpy((kal_char *)resp->value, (kal_char *)req->value, MCF_MAX_INI_ITEM_VALUE_LEN-1);
+            
+
+            ini_last_read_mod_time = ini_file->last_mod_time;
+            
+            
+            if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ini_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                ini_path_ota_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_CONFIG_INI_READ_INI_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if (mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ini_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    ini_path_runtime_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_CONFIG_INI_READ_INI_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    mcf_ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+                    return mcf_ret;
+                }    
+            }
+            
+            
+            if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ini_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                ini_path_runtime_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_CONFIG_INI_READ_INI_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ini_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    ini_path_ota_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_CONFIG_INI_READ_INI_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    mcf_ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+                    return mcf_ret;
+                }
+            }
+            
+            MD_TRC_MCF_TR_CONFIG_INI_LAST_MOD_TIME(ini_path_ota_file_last_mod_time, ini_path_runtime_file_last_mod_time, ini_last_read_mod_time);
+            kal_mem_set(ini_root_path,0,20);
+            if (ini_path_ota_file_last_mod_time > ini_path_runtime_file_last_mod_time){
+                strncpy(ini_root_path,MCF_FS_DEFAULT_FOLDER_PATH, 19);
+            }else{
+               strncpy(ini_root_path,MCF_FS_CUSTOM_FOLDER_PATH, 19);
+            }
+            
+            
+            MD_TRC_MCF_TR_CONFIG_INI_READ(ini_root_path);
+            if (mcf_read_ini_file(ini_root_path, MCF_FS_DEFAULT_INI_FILE_NAME, &apply_path_type, apply_filename, pMcf) == MCF_OTA_R_SUCCESS) {
+                
+            } else {
+               /* Cannot do OTA if fail to read ini file */                
+                mcf_ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+                return mcf_ret;
+            }
+            kal_mem_set(orign_value, 0, MCF_MAX_INI_ITEM_VALUE_LEN);
+            kal_mem_set((kal_char *)resp->value, 0, MCF_MAX_INI_ITEM_VALUE_LEN);
+            mcf_find_ini_item((kal_char *)ini_file->buff, (kal_char *)resp->item, orign_value, pMcf);
+            
+            kal_mem_set(buffer,0,MCF_MAX_INI_FILE_SIZE);        
+            if (mcf_compose_ini_item((kal_char *)ini_file->buff, buffer, (kal_char *)resp->item, orign_value, (kal_char *)resp->value) == KAL_TRUE) {
+                mcf_ret = mcf_write_buffer(ini_root_path, MCF_FS_DEFAULT_INI_FILE_NAME, (kal_uint8 *)buffer, strlen(buffer));
+                if (mcf_ret != MCF_OTA_R_SUCCESS){
+                    return mcf_ret;
+                }
+                
+            } else {
+               /* Cannot do OTA if fail to read ini file */    
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                return mcf_ret;
+            }
+            
+            break;
+        
+        default:
+             ASSERT(0);
+             mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                    
+    }
+    
+
+    return mcf_ret;
+}
+
+_STATIC mcf_ota_result_e mcf_update_ota_file(
+    l4c_mcf_update_ota_file_req_struct *req,
+    l4c_mcf_update_ota_file_cnf_struct *resp,
+    module_type src_mod_id,
+    kal_bool *reset_MD)
+{
+    mcf_t                                   *pMcf = mcf_get_instance();
+    //sim_interface_enum                      sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+    //nvram_ef_mcf_ini_file_info_struct       ini_file;
+    kal_char                                apply_filename[MCF_FILE_MAX_NAME_LEN];
+    l4c_mcf_path_type_enum                  apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+    mcf_ota_result_e                        mcf_ret = MCF_OTA_R_SUCCESS;
+    mcf_ini_file_t                          *ini_file = &(pMcf->ini_file);
+    kal_uint32                              sbp_id_arr[MCF_MAX_TAG_NUM];
+    kal_char                                tag_str[MCF_MAX_INI_ITEM_VALUE_LEN];
+    kal_uint16                              sbp_id_num = 0;
+    mcf_ota_file_t                          *ota_file = &(pMcf->ota_file);
+    mcf_tlvota_file_t                       *tlvota_file;
+    kal_int32                               i = 0;
+    kal_int32                               j = 0;
+    kal_char                                ota_path_name[MCF_FILE_MAX_NAME_LEN];
+    kal_uint64                              ota_last_read_mod_time = 0;
+    kal_uint64                              ota_path_ota_file_last_mod_time = 0;
+    kal_uint64                              ota_path_runtime_file_last_mod_time = 0;
+    kal_uint32                              sbp_id = SBP_ID_INVALID;
+    protocol_id_enum                        ps_id = 0;
+    kal_char                                tlvota_path_name[MCF_FILE_MAX_NAME_LEN];
+    kal_uint64                              tlvota_last_read_mod_time = 0;
+    kal_uint64                              tlvota_path_ota_file_last_mod_time = 0;
+    kal_uint64                              tlvota_path_runtime_file_last_mod_time = 0;
+    mcf_l4bsbp_trigger_dsbp_ind_struct      *ind_ptr = NULL;
+    kal_bool                                apply_general_tlv;
+    kal_char                                tag_name[10];
+    kal_bool                                trigger_ps_id[MAX_SIM_NUM];
+    kal_uint64                              ini_last_read_mod_time = 0;
+    kal_uint64                              ini_path_ota_file_last_mod_time = 0;
+    kal_uint64                              ini_path_runtime_file_last_mod_time = 0;
+    kal_char                                ini_root_path[20];
+    kal_uint32                              ret_sprintf;
+    
+    
+    MD_TRC_MCF_TR_UPDATE_OTA_START();
+    
+    
+    pMcf->dsbp_cnf_ret = KAL_TRUE;
+    pMcf->dsbp_ind_ret = KAL_TRUE;
+    apply_general_tlv = KAL_FALSE;
+    kal_mem_set(trigger_ps_id,0,MAX_SIM_NUM);
+    /* Compare modified time of OTA file to know whether update OTA file */
+            
+    MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_set(ota_path_name,0,MCF_FILE_MAX_NAME_LEN);
+        strncpy(ota_path_name, ota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        ota_last_read_mod_time = ota_file->last_mod_time;
+        MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        MD_TRC_MCF_TR_UPDATE_OTA_READ_OTA_TAKE_READ_LOCK_FAIL();
+        mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+        return mcf_ret;
+    }
+    
+    
+    
+    if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_OTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+        ota_path_ota_file_last_mod_time = 0;
+        MD_TRC_MCF_TR_UPDATE_OTA_READ_OTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+        
+        if (mcf_get_file_last_mod_time (MCF_FS_DEFAULT_OTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+            ota_path_runtime_file_last_mod_time = 0;
+            MD_TRC_MCF_TR_UPDATE_OTA_READ_OTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+            mcf_ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+            //return mcf_ret;
+        }    
+    }
+    
+    
+    if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_OTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+        ota_path_runtime_file_last_mod_time = 0;
+        MD_TRC_MCF_TR_UPDATE_OTA_READ_OTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+        
+        if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_OTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+            ota_path_ota_file_last_mod_time = 0;
+            MD_TRC_MCF_TR_UPDATE_OTA_READ_OTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+            mcf_ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+            //return mcf_ret;
+        }
+    }
+    
+    MD_TRC_MCF_TR_UPDATE_OTA_OTA_LAST_MOD_TIME(ota_path_ota_file_last_mod_time, ota_path_runtime_file_last_mod_time, ota_last_read_mod_time);
+    
+    if (ota_path_ota_file_last_mod_time > ota_path_runtime_file_last_mod_time){
+        if(ota_path_ota_file_last_mod_time > ota_last_read_mod_time){
+            /* If OTA file is updated, need to reset MD to apply OTA */
+            MD_TRC_MCF_TR_UPDATE_OTA_RESET_MD(L4C_MCF_PATH_TYPE_OTA, (kal_uint32)((ota_path_ota_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(ota_path_ota_file_last_mod_time & 0xFFFFFFFF), 
+                                               (kal_uint32)((ota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(ota_last_read_mod_time & 0xFFFFFFFF));
+            mcf_ret = MCF_OTA_R_SUCCESS;
+            *reset_MD = KAL_TRUE;
+            
+            return mcf_ret;
+        }
+    }else{
+        if(ota_path_runtime_file_last_mod_time > ota_last_read_mod_time){
+            /* If OTA file is updated, need to reset MD to apply OTA */
+            MD_TRC_MCF_TR_UPDATE_OTA_RESET_MD(L4C_MCF_PATH_TYPE_RUNTIME, (kal_uint32)((ota_path_runtime_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(ota_path_runtime_file_last_mod_time & 0xFFFFFFFF), 
+                                               (kal_uint32)((ota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(ota_last_read_mod_time & 0xFFFFFFFF));
+            mcf_ret = MCF_OTA_R_SUCCESS;
+            *reset_MD = KAL_TRUE;
+            return mcf_ret;
+        }
+    }
+    
+    MD_TRC_MCF_TR_UPDATE_OTA_NO_UPDATE_OTA();
+    
+    switch (req->action)
+    {
+        case L4C_MCF_CONFIG_ACT_NO_READ_INI:
+        /* Update OTA file without reading ini file */    
+            MD_TRC_MCF_TR_UPDATE_OTA_NO_READ_INI();
+            
+            /* If general_tlvota_file update, every sim card should apply */
+            tlvota_file = &(pMcf->general_tlvota_file);
+            MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (tlvota_file){
+                tlvota_last_read_mod_time = tlvota_file->last_mod_time;
+                MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            }else {
+                MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_TAKE_READ_LOCK_FAIL();
+                mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                return mcf_ret;
+            }
+            
+            if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                tlvota_path_ota_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if (mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    tlvota_path_runtime_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    //return mcf_ret;
+                }
+                    
+            }
+            
+            
+            if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                tlvota_path_runtime_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    tlvota_path_ota_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    //return mcf_ret;
+                }
+            }
+                
+            MD_TRC_MCF_TR_UPDATE_OTA_GTLVOTA_LAST_MOD_TIME(tlvota_path_ota_file_last_mod_time, tlvota_path_runtime_file_last_mod_time, tlvota_last_read_mod_time);
+            if (tlvota_path_ota_file_last_mod_time > tlvota_last_read_mod_time || tlvota_path_runtime_file_last_mod_time > tlvota_last_read_mod_time){
+                
+                /* If TLV OTA file is updated, trigger DSBP with retry */
+                if (tlvota_path_ota_file_last_mod_time > tlvota_path_runtime_file_last_mod_time){
+                    MD_TRC_MCF_TR_UPDATE_GENERAL_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_OTA, (kal_uint32)((tlvota_path_ota_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_ota_file_last_mod_time & 0xFFFFFFFF), 
+                                                                     (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                }else{
+                    MD_TRC_MCF_TR_UPDATE_GENERAL_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_RUNTIME, (kal_uint32)((tlvota_path_runtime_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_runtime_file_last_mod_time & 0xFFFFFFFF), 
+                                                                     (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                }
+                
+                
+                /* 
+                 *  Trigger DSBP and do not respond to AP immediately.
+                 *  Wait DSBP response, and then respond to AP.
+                 */
+                
+                for (i = 0; i < MAX_SIM_NUM; i++){
+                    ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                    if (!ind_ptr) {
+                        ASSERT(0);
+                        mcf_ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                        return mcf_ret;
+                    }
+                    
+                    ind_ptr->src_id = req->src_id;
+                    ind_ptr->src_mod_id = src_mod_id;
+                    ind_ptr->config_op = L4C_MCF_CONFIG_UPDATE_OPOTA_FILE;
+                    ind_ptr->is_dsbp_retry = 1;
+
+                    msg_send6(MOD_MCF, /* src_mod_id */
+                            MOD_L4BSBP + i, /* dest_mod_id */
+                            MCF_SAP, /* sap_id */
+                            MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                            (local_para_struct*)ind_ptr, /* local_para_ptr */
+                            NULL); /* peer_buff_ptr */
+                    pMcf->dsbp_cnf_cnt ++;
+                    pMcf->dsbp_ind_cnt ++;
+                    mcf_ret = MCF_OTA_R_SUCCESS;
+                }
+                
+                MD_TRC_MCF_TR_UPDATE_OTA_UPDATE_GENERAL_TLVOTA();
+                apply_general_tlv = KAL_TRUE;
+                return mcf_ret;    
+                
+            }
+            
+            MD_TRC_MCF_TR_UPDATE_OTA_NO_UPDATE_GENERAL_TLVOTA();
+    
+            tlvota_path_ota_file_last_mod_time = 0;
+            tlvota_path_runtime_file_last_mod_time = 0;
+            tlvota_last_read_mod_time = 0;
+            
+            /* Compare modified time of TLV OTA file to know whether update TLV OTA file */
+            
+            for (i = 0; i < MAX_SIM_NUM; i++){
+                tlvota_file = &(pMcf->tlvota_file[i]);
+                MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                if (tlvota_file){
+                    sbp_id = tlvota_file->sbp_id;
+                    ps_id = tlvota_file->ps_id;
+                    tlvota_last_read_mod_time = tlvota_file->last_mod_time;
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                }else {
+                    MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_TAKE_READ_LOCK_FAIL();
+                    mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                    return mcf_ret;
+                }
+                tlvota_path_ota_file_last_mod_time = 0;
+                tlvota_path_runtime_file_last_mod_time = 0;
+                
+                if (ps_id < 0 || ps_id >= MAX_SIM_NUM){
+                    MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_INVALID_SIM_ID(ps_id, i);
+                    mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                    return mcf_ret;
+                }
+                
+                MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_PS_ID(ps_id);
+                MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_SBP_ID(sbp_id);
+
+                /* If have not read tlv ota file, trigger DSBP */
+                if(sbp_id == SBP_ID_INVALID){
+                    mcf_ret = MCF_OTA_R_SUCCESS;
+                }else{
+                    kal_mem_set(tlvota_path_name,0,MCF_FILE_MAX_NAME_LEN);
+                    ret_sprintf = kal_snprintf(tlvota_path_name, MCF_FILE_MAX_NAME_LEN - 1, "%s_%d.mcfopota%c", MCF_FS_TLVOTA_FILE_PREFIX, sbp_id, '\0');
+                    if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_NAME_LEN){
+                        MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FILENAME_ERROR(sbp_id, ret_sprintf);
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        return mcf_ret;
+                    }
+                    
+                    MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_PATH_NAME(tlvota_path_name);
+                
+                    if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                        tlvota_path_runtime_file_last_mod_time = 0;
+                        MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                        
+                        if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                            tlvota_path_ota_file_last_mod_time = 0;
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                            //return mcf_ret;
+                        }
+                    }
+                    
+                    if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                        tlvota_path_ota_file_last_mod_time = 0;
+                        MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                        
+                        if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                            tlvota_path_runtime_file_last_mod_time = 0;
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                            //return mcf_ret;
+                        }
+                    }
+                    
+                                    
+                    MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_LAST_MOD_TIME(tlvota_path_ota_file_last_mod_time, tlvota_path_runtime_file_last_mod_time, tlvota_last_read_mod_time);
+                    
+                    if (tlvota_path_ota_file_last_mod_time > tlvota_last_read_mod_time || tlvota_path_runtime_file_last_mod_time > tlvota_last_read_mod_time){
+                        
+                        /* If TLV OTA file is updated, trigger DSBP with retry */
+                        if (tlvota_path_ota_file_last_mod_time > tlvota_path_runtime_file_last_mod_time){
+                            MD_TRC_MCF_TR_UPDATE_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_OTA, (kal_uint32)((tlvota_path_ota_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_ota_file_last_mod_time & 0xFFFFFFFF),
+                                                                         (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                        }else{
+                            MD_TRC_MCF_TR_UPDATE_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_RUNTIME, (kal_uint32)((tlvota_path_runtime_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_runtime_file_last_mod_time & 0xFFFFFFFF),
+                                                                         (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                        }
+                        
+                        /* 
+                         *  Trigger DSBP and do not respond to AP immediately.
+                         *  Wait DSBP response, and then respond to AP.
+                         */
+                        ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                        if (!ind_ptr) {
+                            ASSERT(0);
+                            mcf_ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                            return mcf_ret;
+                        }
+
+                        ind_ptr->src_id = req->src_id;
+                        ind_ptr->src_mod_id = src_mod_id;
+                        ind_ptr->config_op = L4C_MCF_CONFIG_UPDATE_OPOTA_FILE;
+                        ind_ptr->is_dsbp_retry = 1;
+
+                        msg_send6(MOD_MCF, /* src_mod_id */
+                                MOD_L4BSBP + ps_id, /* dest_mod_id */
+                                MCF_SAP, /* sap_id */
+                                MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                                (local_para_struct*)ind_ptr, /* local_para_ptr */
+                                NULL); /* peer_buff_ptr */
+                        pMcf->dsbp_cnf_cnt ++;
+                        pMcf->dsbp_ind_cnt ++;
+                        mcf_ret = MCF_OTA_R_SUCCESS;
+                        
+                            
+                        
+                    }
+                
+                }
+            }
+            
+            
+            break;
+        
+        case L4C_MCF_CONFIG_ACT_READ_INI:
+            MD_TRC_MCF_TR_UPDATE_OTA_READ_INI();
+            /* Update OTA file with reading ini file */        
+            ini_last_read_mod_time = ini_file->last_mod_time;
+            if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ini_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                ini_path_ota_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_UPDATE_OTA_READ_INI_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if (mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ini_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    ini_path_runtime_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_UPDATE_OTA_READ_INI_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    mcf_ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+                    return mcf_ret;
+                }    
+            }
+            
+            
+            if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ini_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                ini_path_runtime_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_UPDATE_OTA_READ_INI_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ini_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    ini_path_ota_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_UPDATE_OTA_READ_INI_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    mcf_ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+                    return mcf_ret;
+                }
+            }
+            
+            MD_TRC_MCF_TR_UPDATE_OTA_INI_LAST_MOD_TIME(ini_path_ota_file_last_mod_time, ini_path_runtime_file_last_mod_time, ini_last_read_mod_time);
+            kal_mem_set(ini_root_path,0,20);
+            if (ini_path_ota_file_last_mod_time > ini_path_runtime_file_last_mod_time){
+                strncpy(ini_root_path,MCF_FS_DEFAULT_FOLDER_PATH, 19);
+            }else{
+               strncpy(ini_root_path,MCF_FS_CUSTOM_FOLDER_PATH, 19);
+            }
+            
+            
+            MD_TRC_MCF_TR_UPDATE_OTA_INI_READ(ini_root_path);
+            if (mcf_read_ini_file(ini_root_path, MCF_FS_DEFAULT_INI_FILE_NAME, &apply_path_type, apply_filename, pMcf) != MCF_OTA_R_SUCCESS) {
+                mcf_ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+                return mcf_ret;
+            }
+            
+            kal_mem_set(tag_name,0,10);
+            strncpy(tag_name,"TagName", 9);
+            mcf_find_ini_item((kal_char *)ini_file->buff, tag_name, tag_str, pMcf);
+            if(strcmp(tag_str,"") == 0){
+                /* Normal TLV OTA apply */
+                /* Compare modified time of TLV OTA file to know whether update TLV OTA file */
+                MD_TRC_MCF_TR_UPDATE_OTA_FIND_INI_TAGNAME_NULL();
+                /* If general_tlvota_file update, every sim card should apply */
+                
+                tlvota_file = &(pMcf->general_tlvota_file);
+                MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                if (tlvota_file){
+                    tlvota_last_read_mod_time = tlvota_file->last_mod_time;
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                }else {
+                        MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_TAKE_READ_LOCK_FAIL();
+                        mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                        return mcf_ret;
+                }
+                
+                if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    tlvota_path_ota_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    
+                    if (mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                        tlvota_path_runtime_file_last_mod_time = 0;
+                        MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                        //return mcf_ret;
+                    }
+                        
+                }
+                
+                
+                if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    tlvota_path_runtime_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                    
+                    if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                        tlvota_path_ota_file_last_mod_time = 0;
+                        MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                        //return mcf_ret;
+                    }
+                }
+                    
+                MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_LAST_MOD_TIME(tlvota_path_ota_file_last_mod_time, tlvota_path_runtime_file_last_mod_time, tlvota_last_read_mod_time);
+                if (tlvota_path_ota_file_last_mod_time > tlvota_last_read_mod_time || tlvota_path_runtime_file_last_mod_time > tlvota_last_read_mod_time){
+                    
+                    /* If TLV OTA file is updated, trigger DSBP with retry */
+                    if (tlvota_path_ota_file_last_mod_time > tlvota_path_runtime_file_last_mod_time){
+                        MD_TRC_MCF_TR_UPDATE_GENERAL_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_OTA, (kal_uint32)((tlvota_path_ota_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_ota_file_last_mod_time & 0xFFFFFFFF), 
+                                                                     (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                    }else{
+                        MD_TRC_MCF_TR_UPDATE_GENERAL_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_RUNTIME, (kal_uint32)((tlvota_path_runtime_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_runtime_file_last_mod_time & 0xFFFFFFFF), 
+                                                                     (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                    }
+                    
+                    /* 
+                     *  Trigger DSBP and do not respond to AP immediately.
+                     *  Wait DSBP response, and then respond to AP.
+                     */
+                    
+                    for (i = 0; i < MAX_SIM_NUM; i++){
+                        ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                        if (!ind_ptr) {
+                            ASSERT(0);
+                            mcf_ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                            return mcf_ret;
+                        }
+                        
+                        ind_ptr->src_id = req->src_id;
+                        ind_ptr->src_mod_id = src_mod_id;
+                        ind_ptr->config_op = L4C_MCF_CONFIG_UPDATE_OPOTA_FILE;
+                        ind_ptr->is_dsbp_retry = 1;
+
+                        msg_send6(MOD_MCF, /* src_mod_id */
+                                MOD_L4BSBP + i, /* dest_mod_id */
+                                MCF_SAP, /* sap_id */
+                                MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                                (local_para_struct*)ind_ptr, /* local_para_ptr */
+                                NULL); /* peer_buff_ptr */
+                        pMcf->dsbp_cnf_cnt ++;
+                        pMcf->dsbp_ind_cnt ++;
+                        mcf_ret = MCF_OTA_R_SUCCESS;
+                    }
+                    MD_TRC_MCF_TR_UPDATE_OTA_UPDATE_GENERAL_TLVOTA();
+                    apply_general_tlv = KAL_TRUE;
+                    return mcf_ret;
+                        
+                    
+                }
+        
+                tlvota_path_ota_file_last_mod_time = 0;
+                tlvota_path_runtime_file_last_mod_time = 0;
+                tlvota_last_read_mod_time = 0;
+                
+                /* Compare modified time of TLV OTA file to know whether update TLV OTA file */
+                MD_TRC_MCF_TR_UPDATE_OTA_NO_UPDATE_GENERAL_TLVOTA();
+                for (i = 0; i < MAX_SIM_NUM; i++){
+                    tlvota_file = &(pMcf->tlvota_file[i]);
+                    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (tlvota_file){
+                        sbp_id = tlvota_file->sbp_id;
+                        ps_id = tlvota_file->ps_id;
+                        tlvota_last_read_mod_time = tlvota_file->last_mod_time;
+                        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    }else {
+                        MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_TAKE_READ_LOCK_FAIL();
+                        mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                        return mcf_ret;
+                    }
+                    if (ps_id < 0 || ps_id >= MAX_SIM_NUM){
+                        MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_INVALID_SIM_ID(ps_id, i);
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        return mcf_ret;
+                    }
+                    
+                    tlvota_path_ota_file_last_mod_time = 0;
+                    tlvota_path_runtime_file_last_mod_time = 0;
+                    
+                    MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_PATH_NAME(tlvota_path_name);
+                    MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_PS_ID(ps_id);
+                    MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_SBP_ID(sbp_id);
+                    /* If have not read tlv ota file, trigger DSBP */
+                    if(sbp_id == SBP_ID_INVALID){
+                        mcf_ret = MCF_OTA_R_SUCCESS;
+                    }else{
+                        kal_mem_set(tlvota_path_name,0,MCF_FILE_MAX_NAME_LEN);
+                        ret_sprintf = kal_snprintf(tlvota_path_name, MCF_FILE_MAX_NAME_LEN - 1, "%s_%d.mcfopota%c", MCF_FS_TLVOTA_FILE_PREFIX, sbp_id, '\0');
+                        if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_NAME_LEN){
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FILENAME_ERROR(sbp_id, ret_sprintf);
+                            mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                            return mcf_ret;
+                        }
+                    
+                        if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                            tlvota_path_runtime_file_last_mod_time = 0;
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                            
+                            if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                tlvota_path_ota_file_last_mod_time = 0;
+                                MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                //return mcf_ret;
+                            }
+                        }
+                        
+                        if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                            tlvota_path_ota_file_last_mod_time = 0;
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                            
+                            if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                tlvota_path_runtime_file_last_mod_time = 0;
+                                MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                //return mcf_ret;
+                            }
+                        }
+                        
+                        MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_LAST_MOD_TIME(tlvota_path_ota_file_last_mod_time, tlvota_path_runtime_file_last_mod_time, tlvota_last_read_mod_time);
+                        if (tlvota_path_ota_file_last_mod_time > tlvota_last_read_mod_time || tlvota_path_runtime_file_last_mod_time > tlvota_last_read_mod_time){
+                            
+                            /* If TLV OTA file is updated, trigger DSBP with retry */
+                            if (tlvota_path_ota_file_last_mod_time > tlvota_path_runtime_file_last_mod_time){
+                                MD_TRC_MCF_TR_UPDATE_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_OTA, (kal_uint32)((tlvota_path_ota_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_ota_file_last_mod_time & 0xFFFFFFFF),
+                                                                         (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                            }else{
+                                MD_TRC_MCF_TR_UPDATE_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_RUNTIME, (kal_uint32)((tlvota_path_runtime_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_runtime_file_last_mod_time & 0xFFFFFFFF),
+                                                                         (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                            }
+                            
+                            /* 
+                             *  Trigger DSBP and do not respond to AP immediately.
+                             *  Wait DSBP response, and then respond to AP.
+                             */
+                            ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                            if (!ind_ptr) {
+                                ASSERT(0);
+                                mcf_ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                                return mcf_ret;
+                            }
+
+                            ind_ptr->src_id = req->src_id;
+                            ind_ptr->src_mod_id = src_mod_id;
+                            ind_ptr->config_op = L4C_MCF_CONFIG_UPDATE_OPOTA_FILE;
+                            ind_ptr->is_dsbp_retry = 1;
+
+                            msg_send6(MOD_MCF, /* src_mod_id */
+                                    MOD_L4BSBP + ps_id, /* dest_mod_id */
+                                    MCF_SAP, /* sap_id */
+                                    MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                                    (local_para_struct*)ind_ptr, /* local_para_ptr */
+                                    NULL); /* peer_buff_ptr */
+                            pMcf->dsbp_cnf_cnt ++;
+                            pMcf->dsbp_ind_cnt ++;
+                            mcf_ret = MCF_OTA_R_SUCCESS;
+                            
+                                
+                            
+                        }
+                    
+                    }
+                }
+            }else{
+                /* If critical tag is not null */
+                MD_TRC_MCF_TR_UPDATE_OTA_FIND_INI_TAGNAME(tag_str);
+                if(mcf_find_ini_sbp_id (tag_str,sbp_id_arr,&sbp_id_num,&apply_general_tlv) == KAL_TRUE){
+                    /*If general tlvota case is critical, every sim card need to apply general tlv ota */
+                    if (apply_general_tlv == KAL_TRUE){
+                        
+                        tlvota_file = &(pMcf->general_tlvota_file);
+                        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        if (tlvota_file){
+                            tlvota_last_read_mod_time = tlvota_file->last_mod_time;
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        }else {
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_TAKE_READ_LOCK_FAIL();
+                            mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                            return mcf_ret;
+                        }
+                        
+                        if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                            tlvota_path_ota_file_last_mod_time = 0;
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                            
+                            if (mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                tlvota_path_runtime_file_last_mod_time = 0;
+                                MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                //return mcf_ret;
+                            }
+                                
+                        }
+                        
+                        
+                        if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                            tlvota_path_runtime_file_last_mod_time = 0;
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                            
+                            if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                tlvota_path_ota_file_last_mod_time = 0;
+                                MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                //return mcf_ret;
+                            }
+                        }
+                            
+                        MD_TRC_MCF_TR_UPDATE_OTA_CGTLVOTA_LAST_MOD_TIME(tlvota_path_ota_file_last_mod_time, tlvota_path_runtime_file_last_mod_time, tlvota_last_read_mod_time);
+                        if(tlvota_path_ota_file_last_mod_time > tlvota_last_read_mod_time || tlvota_path_runtime_file_last_mod_time > tlvota_last_read_mod_time){
+                            
+                            /* If TLV OTA file is updated, trigger DSBP with retry */
+                            if (tlvota_path_ota_file_last_mod_time > tlvota_path_runtime_file_last_mod_time){
+                                MD_TRC_MCF_TR_UPDATE_CRITICAL_GTLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_OTA, (kal_uint32)((tlvota_path_ota_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_ota_file_last_mod_time & 0xFFFFFFFF),
+                                                                                   (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                            }else{
+                                MD_TRC_MCF_TR_UPDATE_CRITICAL_GTLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_RUNTIME, (kal_uint32)((tlvota_path_runtime_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_runtime_file_last_mod_time & 0xFFFFFFFF), 
+                                                                                    (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                            }
+ 
+                            /* 
+                             *  Trigger DSBP and do not respond to AP immediately.
+                             *  Wait DSBP response, and then respond to AP.
+                             */
+                            
+                            for (i = 0; i < MAX_SIM_NUM; i++){
+                                
+                                ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                                if (!ind_ptr) {
+                                    ASSERT(0);
+                                    mcf_ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                                    return mcf_ret;
+                                }
+                                
+                                ind_ptr->src_id = req->src_id;
+                                ind_ptr->src_mod_id = src_mod_id;
+                                ind_ptr->config_op = L4C_MCF_CONFIG_UPDATE_OPOTA_FILE;
+                                ind_ptr->is_dsbp_retry = 0;
+
+                                msg_send6(MOD_MCF, /* src_mod_id */
+                                        MOD_L4BSBP + i, /* dest_mod_id */
+                                        MCF_SAP, /* sap_id */
+                                        MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                                        (local_para_struct*)ind_ptr, /* local_para_ptr */
+                                        NULL); /* peer_buff_ptr */
+                                pMcf->dsbp_cnf_cnt ++;
+                                pMcf->dsbp_ind_cnt ++;
+                                mcf_ret = MCF_OTA_R_SUCCESS;
+                            }
+                            MD_TRC_MCF_TR_UPDATE_OTA_UPDATE_GENERAL_TLVOTA();
+                            return mcf_ret;
+                                
+                            
+                        }
+                
+                        tlvota_path_ota_file_last_mod_time = 0;
+                        tlvota_path_runtime_file_last_mod_time = 0;
+                        tlvota_last_read_mod_time = 0;
+                    }
+                
+                    MD_TRC_MCF_TR_UPDATE_OTA_NO_UPDATE_GENERAL_TLVOTA();
+                
+                    for (i = 0; i < MAX_SIM_NUM; i++){
+                        tlvota_file = &(pMcf->tlvota_file[i]);
+                        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        if (tlvota_file){
+                            sbp_id = tlvota_file->sbp_id;
+                            ps_id = tlvota_file->ps_id;
+                            tlvota_last_read_mod_time = tlvota_file->last_mod_time;
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        }else {
+                                MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_TAKE_READ_LOCK_FAIL();
+                                mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                                return mcf_ret;
+                        }
+                        if (ps_id < 0 || ps_id >= MAX_SIM_NUM){
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_INVALID_SIM_ID(ps_id, i);
+                            mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                            return mcf_ret;
+                        }
+                        tlvota_path_ota_file_last_mod_time = 0;
+                        tlvota_path_runtime_file_last_mod_time = 0;
+                        kal_mem_set(tlvota_path_name,0,MCF_FILE_MAX_NAME_LEN);
+                        ret_sprintf = kal_snprintf(tlvota_path_name, MCF_FILE_MAX_NAME_LEN - 1, "%s_%d.mcfopota%c", MCF_FS_TLVOTA_FILE_PREFIX, sbp_id, '\0');
+                        if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_NAME_LEN){
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FILENAME_ERROR(sbp_id, ret_sprintf);
+                            mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                            return mcf_ret;
+                        }
+                        MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_PATH_NAME(tlvota_path_name);
+                        for (j = 0; j < sbp_id_num; j++){
+                             if (sbp_id == sbp_id_arr[j]){
+                                
+                                if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                    tlvota_path_runtime_file_last_mod_time = 0;
+                                    MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                    
+                                    if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                        tlvota_path_ota_file_last_mod_time = 0;
+                                        MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                        //return mcf_ret;
+                                    }
+                                }
+                                
+                                if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                    tlvota_path_ota_file_last_mod_time = 0;
+                                    MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                    
+                                    if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                        tlvota_path_runtime_file_last_mod_time = 0;
+                                        MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                        //return mcf_ret;
+                                    }
+                                }
+                                
+                                MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_LAST_MOD_TIME(tlvota_path_ota_file_last_mod_time, tlvota_path_runtime_file_last_mod_time, tlvota_last_read_mod_time);
+                                if (tlvota_path_ota_file_last_mod_time > tlvota_last_read_mod_time || tlvota_path_runtime_file_last_mod_time > tlvota_last_read_mod_time){
+                                    
+                                        /* If TLV OTA file is updated, trigger DSBP without retry */
+                                        if (tlvota_path_ota_file_last_mod_time > tlvota_path_runtime_file_last_mod_time){
+                                            MD_TRC_MCF_TR_UPDATE_CRITICAL_TLVOTA_TRIGGER_DSBP(tlvota_path_name, L4C_MCF_PATH_TYPE_OTA, (kal_uint32)((tlvota_path_ota_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_ota_file_last_mod_time & 0xFFFFFFFF), 
+                                                                                               (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                                        }else{
+                                            MD_TRC_MCF_TR_UPDATE_CRITICAL_TLVOTA_TRIGGER_DSBP(tlvota_path_name, L4C_MCF_PATH_TYPE_RUNTIME, (kal_uint32)((tlvota_path_runtime_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_runtime_file_last_mod_time & 0xFFFFFFFF), 
+                                                                                               (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                                        }
+                                        
+                                        /* 
+                                         *  Trigger DSBP and do not respond to AP immediately.
+                                         *  Wait DSBP response, and then respond to AP.
+                                         */
+                                        ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                                        if (!ind_ptr) {
+                                            ASSERT(0);
+                                            mcf_ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+                                            
+
+                                            return mcf_ret;
+                                        }
+
+                                        ind_ptr->src_id = req->src_id;
+                                        ind_ptr->src_mod_id = src_mod_id;
+                                        ind_ptr->config_op = L4C_MCF_CONFIG_UPDATE_OPOTA_FILE;
+                                        ind_ptr->is_dsbp_retry = 0;
+                                        msg_send6(MOD_MCF, /* src_mod_id */
+                                                MOD_L4BSBP + ps_id, /* dest_mod_id */
+                                                MCF_SAP, /* sap_id */
+                                                MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                                                (local_para_struct*)ind_ptr, /* local_para_ptr */
+                                                NULL); /* peer_buff_ptr */
+                                        pMcf->dsbp_cnf_cnt ++;
+                                        pMcf->dsbp_ind_cnt ++;
+                                        mcf_ret = MCF_OTA_R_SUCCESS;
+                                        trigger_ps_id[ps_id] = KAL_TRUE;
+                                        
+                                    
+                                    
+                                }
+                            }
+                        }
+                        
+                    }
+                    
+                    /* If no critical OP OTA trigger DSBP, check if general OTA whether updated */
+                        
+                    if(pMcf->dsbp_cnf_cnt < MAX_SIM_NUM){
+                        
+                        MD_TRC_MCF_TR_UPDATE_OTA_NO_CRITICAL_CASE();
+                        
+                        /* If general_tlvota_file update, every sim card should apply */
+                        tlvota_file = &(pMcf->general_tlvota_file);
+                        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        if (tlvota_file){
+                            tlvota_last_read_mod_time = tlvota_file->last_mod_time;
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        }else {
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_TAKE_READ_LOCK_FAIL();
+                            mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                            return mcf_ret;
+                        }
+                        
+                        if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                            tlvota_path_ota_file_last_mod_time = 0;
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                            
+                            if (mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                tlvota_path_runtime_file_last_mod_time = 0;
+                                MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                //return mcf_ret;
+                            }
+                                
+                        }
+                        
+                        
+                        if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                            tlvota_path_runtime_file_last_mod_time = 0;
+                            MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                            
+                            if(mcf_get_file_last_mod_time (MCF_FS_GENERAL_TLVOTA_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                tlvota_path_ota_file_last_mod_time = 0;
+                                MD_TRC_MCF_TR_UPDATE_OTA_READ_GENERAL_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                //return mcf_ret;
+                            }
+                        }
+                            
+                        MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_LAST_MOD_TIME(tlvota_path_ota_file_last_mod_time, tlvota_path_runtime_file_last_mod_time, tlvota_last_read_mod_time);
+                        if (tlvota_path_ota_file_last_mod_time > tlvota_last_read_mod_time || tlvota_path_runtime_file_last_mod_time > tlvota_last_read_mod_time){
+                            
+                            /* If TLV OTA file is updated, trigger DSBP with retry */
+                            if (tlvota_path_ota_file_last_mod_time > tlvota_path_runtime_file_last_mod_time){
+                                MD_TRC_MCF_TR_UPDATE_GENERAL_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_OTA, (kal_uint32)((tlvota_path_ota_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_ota_file_last_mod_time & 0xFFFFFFFF), 
+                                                                     (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                            }else{
+                                MD_TRC_MCF_TR_UPDATE_GENERAL_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_RUNTIME, (kal_uint32)((tlvota_path_runtime_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_runtime_file_last_mod_time & 0xFFFFFFFF), 
+                                                                     (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                            }
+                            
+                            /* 
+                             *  Trigger DSBP and do not respond to AP immediately.
+                             *  Wait DSBP response, and then respond to AP.
+                             */
+                            
+                          
+                            
+                            for (i = 0; i < MAX_SIM_NUM; i++){
+                                
+                                if (trigger_ps_id[i] != KAL_TRUE){
+                                    ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                                    if (!ind_ptr) {
+                                        ASSERT(0);
+                                        mcf_ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                                        return mcf_ret;
+                                    }
+                                    
+                                    ind_ptr->src_id = req->src_id;
+                                    ind_ptr->src_mod_id = src_mod_id;
+                                    ind_ptr->config_op = L4C_MCF_CONFIG_UPDATE_OPOTA_FILE;
+                                    ind_ptr->is_dsbp_retry = 1;
+
+                                    msg_send6(MOD_MCF, /* src_mod_id */
+                                            MOD_L4BSBP + i, /* dest_mod_id */
+                                            MCF_SAP, /* sap_id */
+                                            MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                                            (local_para_struct*)ind_ptr, /* local_para_ptr */
+                                            NULL); /* peer_buff_ptr */
+                                    pMcf->dsbp_cnf_cnt ++;
+                                    pMcf->dsbp_ind_cnt ++;
+                                    mcf_ret = MCF_OTA_R_SUCCESS;
+                                }
+                                
+                            }
+                            apply_general_tlv = KAL_TRUE;
+                            MD_TRC_MCF_TR_UPDATE_OTA_UPDATE_GENERAL_TLVOTA();
+                            return mcf_ret;
+                                
+                            
+                        }
+                
+                        tlvota_path_ota_file_last_mod_time = 0;
+                        tlvota_path_runtime_file_last_mod_time = 0;
+                        tlvota_last_read_mod_time = 0;
+                        
+                        /* Compare modified time of TLV OTA file to know whether update TLV OTA file */
+                        MD_TRC_MCF_TR_UPDATE_OTA_NO_UPDATE_GENERAL_TLVOTA();
+                        for (i = 0; i < MAX_SIM_NUM; i++){
+                            tlvota_file = &(pMcf->tlvota_file[i]);
+                            MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                            if (tlvota_file){
+                                sbp_id = tlvota_file->sbp_id;
+                                ps_id = tlvota_file->ps_id;
+                                tlvota_last_read_mod_time = tlvota_file->last_mod_time;
+                                MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                            }else {
+                                MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_TAKE_READ_LOCK_FAIL();
+                                mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+                                return mcf_ret;
+                            }
+                            
+                            if (ps_id < 0 || ps_id >= MAX_SIM_NUM){
+                                MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_INVALID_SIM_ID(ps_id, i);
+                                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                                return mcf_ret;
+                            }
+                            
+                            tlvota_path_ota_file_last_mod_time = 0;
+                            tlvota_path_runtime_file_last_mod_time = 0;
+                            
+                            MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_PATH_NAME(tlvota_path_name);
+                            MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_PS_ID(ps_id);
+                            /* If have not read tlv ota file, trigger DSBP */
+                            if(sbp_id == SBP_ID_INVALID){
+                                mcf_ret = MCF_OTA_R_SUCCESS;
+                            }else{
+                                kal_mem_set(tlvota_path_name,0,MCF_FILE_MAX_NAME_LEN);
+                                ret_sprintf = kal_snprintf(tlvota_path_name, MCF_FILE_MAX_NAME_LEN - 1, "%s_%d.mcfopota%c", MCF_FS_TLVOTA_FILE_PREFIX, sbp_id, '\0');
+                                if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_NAME_LEN){
+                                    MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FILENAME_ERROR(sbp_id, ret_sprintf);
+                                    mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                                    return mcf_ret;
+                                }
+                            
+                                if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                    tlvota_path_runtime_file_last_mod_time = 0;
+                                    MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                    
+                                    if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                        tlvota_path_ota_file_last_mod_time = 0;
+                                        MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                        //return mcf_ret;
+                                    }
+                                }
+                                
+                                if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_OTA, &tlvota_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                    tlvota_path_ota_file_last_mod_time = 0;
+                                    MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                    
+                                    if(mcf_get_file_last_mod_time (tlvota_path_name, L4C_MCF_PATH_TYPE_RUNTIME, &tlvota_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                                        tlvota_path_runtime_file_last_mod_time = 0;
+                                        MD_TRC_MCF_TR_UPDATE_OTA_READ_TLVOTA_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                                        //return mcf_ret;
+                                    }
+                                }
+                                
+                                MD_TRC_MCF_TR_UPDATE_OTA_TLVOTA_LAST_MOD_TIME(tlvota_path_ota_file_last_mod_time, tlvota_path_runtime_file_last_mod_time, tlvota_last_read_mod_time);
+                                if (tlvota_path_ota_file_last_mod_time > tlvota_last_read_mod_time || tlvota_path_runtime_file_last_mod_time > tlvota_last_read_mod_time){
+                                    
+                                    /* If TLV OTA file is updated, trigger DSBP with retry */
+                                    if (tlvota_path_ota_file_last_mod_time > tlvota_path_runtime_file_last_mod_time){
+                                        MD_TRC_MCF_TR_UPDATE_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_OTA, (kal_uint32)((tlvota_path_ota_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_ota_file_last_mod_time & 0xFFFFFFFF),
+                                                                         (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                                    }else{
+                                        MD_TRC_MCF_TR_UPDATE_TLVOTA_TRIGGER_DSBP(L4C_MCF_PATH_TYPE_RUNTIME, (kal_uint32)((tlvota_path_runtime_file_last_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_path_runtime_file_last_mod_time & 0xFFFFFFFF),
+                                                                         (kal_uint32)((tlvota_last_read_mod_time >> 32) & 0xFFFFFFFF), (kal_uint32)(tlvota_last_read_mod_time & 0xFFFFFFFF));
+                                    }
+                                    
+                                    /* 
+                                     *  Trigger DSBP and do not respond to AP immediately.
+                                     *  Wait DSBP response, and then respond to AP.
+                                     */
+                                    if(trigger_ps_id[ps_id] != KAL_TRUE){
+                                     
+                                        ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                                        if (!ind_ptr) {
+                                            ASSERT(0);
+                                            mcf_ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                                            return mcf_ret;
+                                        }
+
+                                        ind_ptr->src_id = req->src_id;
+                                        ind_ptr->src_mod_id = src_mod_id;
+                                        ind_ptr->config_op = L4C_MCF_CONFIG_UPDATE_OPOTA_FILE;
+                                        ind_ptr->is_dsbp_retry = 1;
+
+                                        msg_send6(MOD_MCF, /* src_mod_id */
+                                                MOD_L4BSBP + ps_id, /* dest_mod_id */
+                                                MCF_SAP, /* sap_id */
+                                                MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                                                (local_para_struct*)ind_ptr, /* local_para_ptr */
+                                                NULL); /* peer_buff_ptr */
+                                        pMcf->dsbp_cnf_cnt ++;
+                                        pMcf->dsbp_ind_cnt ++;
+                                        mcf_ret = MCF_OTA_R_SUCCESS;
+                                    
+                                    }   
+                                    
+                                }
+                            
+                            }
+                        }
+                    }
+                }
+            }
+            
+            
+                
+            
+            break;
+        
+        default:
+             ASSERT(0);
+             mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                    
+    }
+    
+    MD_TRC_MCF_TR_UPDATE_OTA_RETURN_VALUE(pMcf->dsbp_cnf_cnt);
+    return mcf_ret;
+}
+
+_STATIC mcf_ota_result_e mcf_config_LID_variable(
+    l4c_mcf_config_lid_variable_operation_req_struct *req,
+    l4c_mcf_config_lid_variable_operation_cnf_struct *resp)
+{
+    mcf_ota_result_e                mcf_ret = MCF_OTA_R_SUCCESS;
+#ifdef __MCF_FIND_TAG_SUPPORT__  
+    mcf_t                          *pMcf = mcf_get_instance();
+    sim_interface_enum              sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+    kal_bool                        ret = KAL_TRUE;
+    nvram_ltable_entry_struct       lid_info = {0};
+    nvram_errno_enum                nvram_api_ret;
+    kal_uint16                      item_byte_offset;
+    kal_uint16                      item_bit_offset;
+    kal_uint32                      item_size;
+    mcf_custom_dump_param_struct    dump_para;
+    kal_uint32                      lid_size;
+    kal_uint32                      i;
+    mcf_tag_info_struct             query_tag = {0};
+    kal_uint8                       lid_value[512];
+    kal_uint32                      j = 0;
+    kal_uint32                      n = 1;
+    MCF_DB_STRUCT_VARIABLE          const *db_ptr = NULL;
+    kal_uint32                      read_len = 0;
+    kal_bool                        invalid_arr_size = KAL_FALSE;
+    kal_bool                        next_level_array = KAL_FALSE;
+    kal_bool                        is_found = KAL_FALSE;
+    kal_uint8                       hex_value[512];
+  
+    MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_START(req->lid_num, req->rec_id, req->tag_name);
+    kal_mem_set(&dump_para, 0, sizeof(mcf_custom_dump_param_struct));
+    kal_mem_set(hex_value, 0, 512);
+
+    resp->len = req->len;
+    
+    if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_INVALID_SIM_ID(req->ps_id, sim_id);
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return mcf_ret;
+    }
+    
+    nvram_api_ret = nvram_external_get_lid_info(req->lid_num, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_GET_LID_INFO_FAIL(req->lid_num, nvram_api_ret);
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return mcf_ret;
+    }
+    
+    
+    kal_mem_set(mcf_dump_buffer, 0, lid_info.size);
+    
+    if(req->rec_id > lid_info.total_records){
+        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_INVALID_REC_ID(req->rec_id, lid_info.total_records);
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return mcf_ret;
+    }else if (req->rec_id == 0){
+        req->rec_id = 1;
+    }
+
+    dump_para.ps_id = req->ps_id;
+    dump_para.sbp_id = pMcf->tlvota_file[sim_id].sbp_id;
+    kal_mem_cpy(&(dump_para.mcc), &(pMcf->tlvota_file[sim_id].mcc), MAX_MCC_STR_LEN);
+    kal_mem_cpy(&(dump_para.mnc), &(pMcf->tlvota_file[sim_id].mnc), MAX_MNC_STR_LEN);
+    kal_mem_cpy(&(dump_para.iccid), &(pMcf->tlvota_file[sim_id].iccid), 21);
+    dump_para.size = &lid_size;
+
+
+    
+    
+    for (i = 0; i < mcf_dump_param_tbl_num; i++) {
+        if ( (mcf_dump_param_tbl[i].lid == req->lid_num) ) {
+            is_found = KAL_TRUE;
+            if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA){
+
+                dump_para.type = MCF_TYPE_OTA;
+                dump_para.record_idx = req->rec_id;
+                
+                if ((mcf_dump_param_tbl[i].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA) != 0) {
+
+                    dump_para.lid = mcf_dump_param_tbl[i].lid; 
+                    dump_para.buffer = mcf_dump_buffer;
+                    *(dump_para.size) = 0;
+
+                    MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_CALLBACK(dump_para.lid, mcf_dump_param_tbl[i].ntfy_type, dump_para.record_idx);
+
+                    ret = mcf_dump_param_tbl[i].dump_func_ptr(&dump_para);
+                    if ( (ret == KAL_FALSE) || (*(dump_para.size) != lid_info.size) ) {
+                        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_DUMP_ERROR(mcf_dump_param_tbl[i].lid, ret, lid_info.size, *(dump_para.size));
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        break;
+                    }   
+                } else {
+                    /* If not register callback */
+                    MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_NVRAM(lid_info.LID, mcf_dump_param_tbl[i].ntfy_type, dump_para.record_idx);
+                    dump_para.buffer = mcf_dump_buffer;
+                    if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_NVRAM_FAIL(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        break;
+                    } 
+                }
+            }else if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA){
+                dump_para.type = MCF_TYPE_OTA_BY_OP;
+                dump_para.record_idx = 1;
+                
+                MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_USIR(dump_para.lid, dump_para.record_idx, dump_para.ps_id, dump_para.sbp_id, dump_para.mnc, dump_para.mcc, dump_para.iccid);
+
+                if ((mcf_dump_param_tbl[i].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA_BY_OP) != 0) {
+                    dump_para.lid = mcf_dump_param_tbl[i].lid;
+                    dump_para.buffer = mcf_dump_buffer;
+                    *(dump_para.size) = 0;
+
+                    MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_CALLBACK_USIR(dump_para.lid, dump_para.type, dump_para.record_idx, dump_para.sbp_id, dump_para.mnc, dump_para.mcc, dump_para.iccid);
+
+                    ret = mcf_dump_param_tbl[i].dump_func_ptr(&dump_para);
+                    if ( (ret == KAL_FALSE) || (*(dump_para.size) != lid_info.size) ) {
+                        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_DUMP_FAIL(mcf_dump_param_tbl[i].lid, ret, lid_info.size, *(dump_para.size));
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        break;
+                    }   
+                } else {
+                    /* If not register callback */
+                    MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_NVRAM(dump_para.lid, mcf_dump_param_tbl[i].ntfy_type);
+                    dump_para.buffer = mcf_dump_buffer;
+                    if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_NVRAM_FAIL(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        break;
+                    } 
+                }
+            }
+            break;
+        }
+    }
+
+     if (is_found == KAL_FALSE){
+        /* If not register callback */
+        if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA){
+
+            dump_para.type = MCF_TYPE_OTA;
+            dump_para.record_idx = req->rec_id;
+
+            MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_NVRAM_NOT_CALLBACK(req->lid_num, req->rec_id);
+            dump_para.buffer = mcf_dump_buffer;
+            if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OTA_NVRAM_FAIL_NOT_CALLBACK(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                return mcf_ret;
+            } 
+            
+        }else if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA){
+            dump_para.type = MCF_TYPE_OTA_BY_OP;
+            dump_para.record_idx = 1;
+            
+            MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_NVRAM_NOT_CALLBACK_USIR(req->lid_num, dump_para.ps_id, dump_para.sbp_id, dump_para.mcc, dump_para.mnc, dump_para.iccid);
+            dump_para.buffer = mcf_dump_buffer;
+            if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_OPOTA_NVRAM_FAIL_NOT_CALLBACK(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                return mcf_ret;
+            } 
+   
+        }
+            
+    }
+    
+    if (mcf_ret == MCF_OTA_R_INVALID_PARAMETER){
+        return mcf_ret;
+    }
+    
+    mcf_toupper((char *)req->tag_name);
+    if (mcf_find_tag_offset(req->lid_num, (char *)req->tag_name, &item_byte_offset, &item_bit_offset, &item_size, &db_ptr, &query_tag) == KAL_FALSE) {
+        //Cannot find the tag
+        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_FIND_TAG_FAIL(req->lid_num, req->tag_name);
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+        
+        return mcf_ret;
+        
+    }
+    
+    for(i = 0; i < query_tag.arr_cnt; i++){
+        if (db_ptr->array_size[i]-1 < query_tag.array_size[i])
+        {
+            invalid_arr_size = KAL_TRUE;
+            MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_INVALID_ARR_SIZE(db_ptr->array_size[i]-1, query_tag.array_size[i]);
+            break;
+        }
+    }
+    
+    if (invalid_arr_size == KAL_TRUE){
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+        return mcf_ret;
+    }
+    resp->len = req->len;
+    
+    read_len = req->len * db_ptr->variable_size;
+    
+    if (read_len == 0)
+    {
+        read_len = 1 * db_ptr->variable_size;
+    }
+
+    if (read_len > db_ptr->total_size){
+        read_len = db_ptr->total_size;
+    }
+    if (read_len > 255){
+        read_len = 255;
+    }
+    
+    MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_LENGTH(read_len, db_ptr->variable_size, db_ptr->total_size);
+    kal_mem_set(lid_value, 0, 512);
+    
+    if (query_tag.is_bit == KAL_FALSE){
+
+        j = query_tag.arr_cnt;
+        
+        while(db_ptr->array_size[j] != 0){
+            n *= (db_ptr->array_size[j]);
+            
+
+            j++;
+            next_level_array = KAL_TRUE;
+        }
+
+        if(req->len == 0)
+        {
+            read_len *= n;
+            MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_TOTAL_ARRAY_SIZE(n, db_ptr->variable_size);
+        }
+        
+        if(next_level_array == KAL_FALSE && read_len > item_size){
+            read_len = item_size;
+        }
+        if(next_level_array == KAL_TRUE && read_len > n*db_ptr->variable_size){
+            read_len = n*db_ptr->variable_size;
+        }
+        
+        
+        if (read_len > 255){
+            read_len = 255;
+        }
+
+        kal_mem_cpy(lid_value, (mcf_dump_buffer + item_byte_offset), read_len);
+        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BYTE(lid_value, read_len);
+        mcf_bytes_to_hex(lid_value, read_len, KAL_TRUE, hex_value);
+		strncpy((kal_char *)(resp->value), hex_value, 512);
+        if (db_ptr->variable_size <= read_len){
+            resp->len = read_len / db_ptr->variable_size;
+        }else{
+            resp->len = read_len;
+        }
+    }else{
+
+        if (query_tag.upper_vsize == 1){
+            resp->len = 1;
+        }else if(query_tag.upper_vsize == 2){
+            resp->len = 2;
+        }else if(query_tag.upper_vsize == 4){
+            resp->len = 4;
+        }else{
+            MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT_INVALID_BIT_LEN(query_tag.upper_vsize);
+            mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+            
+            return mcf_ret;
+        }
+        MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT_SIZE(query_tag.upper_vsize, resp->len);
+
+        if (db_ptr->is_bit == KAL_TRUE){
+
+            kal_mem_cpy(lid_value, (mcf_dump_buffer + item_byte_offset), resp->len);
+            MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT_WHOLE(lid_value, resp->len);
+            
+            mcf_bytes_to_hex(lid_value, resp->len, KAL_TRUE, hex_value);
+			strncpy((kal_char *)(resp->value), hex_value, 512);
+        }else{
+
+            if (query_tag.upper_vsize == 1){
+                kal_uint8 bit_value = *(mcf_dump_buffer + item_byte_offset);
+                kal_uint8 bit_mask = (kal_uint8)MCF_GEN_BIT_MASK(item_size);
+                bit_value &= (bit_mask << item_bit_offset);
+                bit_value = ((kal_uint8)bit_value >> item_bit_offset);
+
+                resp->len = item_size/8+1;
+
+                mcf_bytes_to_hex(&bit_value, resp->len, KAL_TRUE, hex_value);
+				strncpy((kal_char *)(resp->value), hex_value, 512);
+                MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT(bit_value, resp->len);
+            }else if(query_tag.upper_vsize == 2){
+                kal_uint16 bit_value = 0;
+                kal_uint16 bit_mask = (kal_uint16)MCF_GEN_BIT_MASK(item_size);
+                
+                kal_mem_cpy(&bit_value,(mcf_dump_buffer + item_byte_offset),2);
+                
+                bit_value &= (bit_mask << item_bit_offset);
+                bit_value = ((kal_uint16)bit_value >> item_bit_offset);
+
+                resp->len = item_size/8+1;
+
+                mcf_bytes_to_hex(&bit_value, resp->len, KAL_TRUE, hex_value);
+				strncpy((kal_char *)(resp->value), hex_value, 512);
+                MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT(bit_value, resp->len);
+            }else if(query_tag.upper_vsize == 4){
+                kal_uint32 bit_value = 0;
+                kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(item_size);
+                
+                kal_mem_cpy(&bit_value,(mcf_dump_buffer + item_byte_offset),4);
+                
+                bit_value &= (bit_mask << item_bit_offset);
+                bit_value = ((kal_uint32)bit_value >> item_bit_offset);
+
+                resp->len = item_size/8+1;
+
+                mcf_bytes_to_hex(&bit_value, resp->len, KAL_TRUE, hex_value);
+				strncpy((kal_char *)(resp->value), hex_value, 512);
+                MD_TRC_MCF_TR_CONFIG_LID_VARIABLE_READ_VARIABLE_BIT(bit_value, resp->len);
+            }
+
+        }
+    }
+    
+#else
+    resp->len = req->len;
+    mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+#endif
+         
+    return mcf_ret;
+
+}
+_STATIC mcf_ota_result_e mcf_query_variable_value(
+    l4c_mcf_variable_value_operation_req_struct *req,
+    l4c_mcf_variable_value_operation_cnf_struct *resp)
+{
+    mcf_t                          *pMcf = mcf_get_instance();
+    sim_interface_enum              sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+    mcf_ota_result_e                mcf_ret = MCF_OTA_R_SUCCESS;
+    kal_bool                        ret = KAL_TRUE;
+    nvram_ltable_entry_struct       lid_info = {0};
+    nvram_errno_enum                nvram_api_ret;
+    kal_uint16                      item_byte_offset;
+    kal_uint16                      item_bit_offset;
+    kal_uint32                      item_size;
+    mcf_custom_dump_param_struct    dump_para;
+    kal_uint32                      lid_size;
+    kal_uint32                      i;
+    kal_uint8                       lid_value[512];    
+    kal_uint32                      read_len = 0; 
+    kal_bool                        is_found = KAL_FALSE;
+    kal_uint16                      lid = 0;
+    kal_bool                        is_bit;
+    kal_char                        array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_char                        hex_value[512];
+#if defined(__MCF_FIND_TAG_SUPPORT__)    
+    kal_bool                        invalid_arr_size = KAL_FALSE;
+    kal_bool                        next_level_array = KAL_FALSE;
+    kal_uint32                      j = 0;
+    kal_uint32                      n = 1;
+    MCF_DB_STRUCT_VARIABLE          const *db_ptr = NULL;
+    mcf_tag_info_struct             query_tag = {0};
+#endif
+    
+    MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_START(req->format, req->action, req->num, req->rec_id);
+    kal_mem_set(&dump_para, 0, sizeof(mcf_custom_dump_param_struct));
+    
+    
+    resp->len = req->len;
+    
+    if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+        MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_INVALID_SIM_ID(req->ps_id, sim_id);
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return mcf_ret;
+    }
+    
+    if (req->format == L4C_MCF_QUERY_VARIABLE_FORM_PATH){
+        lid = req->num;
+    }else if(req->format == L4C_MCF_QUERY_VARIABLE_FORM_GID){
+        lid = mcf_find_gid_return_lid_num(req->num);
+        if (lid == 65535){
+            MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_GET_LID_NUM_FAIL(req->num);
+            mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+            return mcf_ret;
+        }
+    }
+    nvram_api_ret = nvram_external_get_lid_info(lid, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_GET_LID_INFO_FAIL(lid, nvram_api_ret);
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return mcf_ret;
+    }
+    
+    
+    kal_mem_set(mcf_dump_buffer, 0, lid_info.size);
+    
+    if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA){
+		if(req->rec_id > lid_info.total_records || req->rec_id == 0){
+			MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_INVALID_REC_ID(req->rec_id, lid_info.total_records);
+			mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+			return mcf_ret;
+		}
+	}
+
+    dump_para.ps_id = req->ps_id;
+    dump_para.sbp_id = pMcf->tlvota_file[sim_id].sbp_id;
+    kal_mem_cpy(&(dump_para.mcc), &(pMcf->tlvota_file[sim_id].mcc), MAX_MCC_STR_LEN);
+    kal_mem_cpy(&(dump_para.mnc), &(pMcf->tlvota_file[sim_id].mnc), MAX_MNC_STR_LEN);
+    kal_mem_cpy(&(dump_para.iccid), &(pMcf->tlvota_file[sim_id].iccid), 21);
+    dump_para.size = &lid_size;
+    
+    for (i = 0; i < mcf_dump_param_tbl_num; i++) {
+        if ( (mcf_dump_param_tbl[i].lid == lid) ) {
+            is_found = KAL_TRUE;
+            if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA){
+
+                dump_para.type = MCF_TYPE_OTA;
+                dump_para.record_idx = req->rec_id;
+                
+                if ((mcf_dump_param_tbl[i].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA) != 0) {
+
+                    dump_para.lid = mcf_dump_param_tbl[i].lid; 
+                    dump_para.buffer = mcf_dump_buffer;
+                    *(dump_para.size) = 0;
+
+                    MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_CALLBACK(dump_para.lid, mcf_dump_param_tbl[i].ntfy_type, dump_para.record_idx);
+
+                    ret = mcf_dump_param_tbl[i].dump_func_ptr(&dump_para);
+                    if ( (ret == KAL_FALSE) || (*(dump_para.size) != lid_info.size) ) {
+                        MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_DUMP_ERROR(mcf_dump_param_tbl[i].lid, ret, lid_info.size, *(dump_para.size));
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        break;
+                    }   
+                } else {
+                    /* If not register callback */
+                    MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_NVRAM(lid_info.LID, mcf_dump_param_tbl[i].ntfy_type, dump_para.record_idx);
+                    dump_para.buffer = mcf_dump_buffer;
+                    if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                        MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_NVRAM_FAIL(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        break;
+                    } 
+                }
+            }else if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA){
+                dump_para.type = MCF_TYPE_OTA_BY_OP;
+                dump_para.record_idx = 1;
+                
+                MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_USIR(dump_para.lid, dump_para.record_idx, dump_para.ps_id, dump_para.sbp_id, dump_para.mnc, dump_para.mcc, dump_para.iccid);
+
+                if ((mcf_dump_param_tbl[i].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA_BY_OP) != 0) {
+                    dump_para.lid = mcf_dump_param_tbl[i].lid;
+                    dump_para.buffer = mcf_dump_buffer;
+                    *(dump_para.size) = 0;
+
+                    MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_CALLBACK_USIR(dump_para.lid, dump_para.type, dump_para.record_idx, dump_para.sbp_id, dump_para.mnc, dump_para.mcc, dump_para.iccid);
+
+                    ret = mcf_dump_param_tbl[i].dump_func_ptr(&dump_para);
+                    if ( (ret == KAL_FALSE) || (*(dump_para.size) != lid_info.size) ) {
+                        MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_DUMP_FAIL(mcf_dump_param_tbl[i].lid, ret, lid_info.size, *(dump_para.size));
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        break;
+                    }   
+                } else {
+                    /* If not register callback */
+                    MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_NVRAM(dump_para.lid, mcf_dump_param_tbl[i].ntfy_type);
+                    dump_para.buffer = mcf_dump_buffer;
+                    if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                        MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_NVRAM_FAIL(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        break;
+                    } 
+                }
+            }
+            break;
+        }
+    }
+
+     if (is_found == KAL_FALSE){
+        /* If not register callback */
+        if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA){
+
+            dump_para.type = MCF_TYPE_OTA;
+            dump_para.record_idx = req->rec_id;
+
+            MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_NVRAM_NOT_CALLBACK(lid, req->rec_id);
+            dump_para.buffer = mcf_dump_buffer;
+            if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OTA_NVRAM_FAIL_NOT_CALLBACK(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                return mcf_ret;
+            } 
+            
+        }else if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA){
+            dump_para.type = MCF_TYPE_OTA_BY_OP;
+            dump_para.record_idx = 1;
+            
+            MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_NVRAM_NOT_CALLBACK_USIR(lid, dump_para.ps_id, dump_para.sbp_id, dump_para.mcc, dump_para.mnc, dump_para.iccid);
+            dump_para.buffer = mcf_dump_buffer;
+            if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_OPOTA_NVRAM_FAIL_NOT_CALLBACK(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                return mcf_ret;
+            } 
+   
+        }
+            
+    }
+    
+    if (mcf_ret == MCF_OTA_R_INVALID_PARAMETER){
+        return mcf_ret;
+    }
+    
+    if (req->format == L4C_MCF_QUERY_VARIABLE_FORM_PATH){
+#if defined(__MCF_FIND_TAG_SUPPORT__)
+        MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_TAG(req->config);
+        mcf_toupper((char *)req->config);
+        if (mcf_find_tag_offset(lid, (char *)req->config, &item_byte_offset, &item_bit_offset, &item_size, &db_ptr, &query_tag) == KAL_FALSE) {
+            //Cannot find the tag
+            MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_FIND_TAG_FAIL(lid, req->config);
+            mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+            
+            return mcf_ret;
+            
+        }
+        
+        for(i = 0; i < query_tag.arr_cnt; i++){
+            if (db_ptr->array_size[i]-1 < query_tag.array_size[i])
+            {
+                invalid_arr_size = KAL_TRUE;
+                MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_INVALID_ARR_SIZE(db_ptr->array_size[i]-1, query_tag.array_size[i]);
+                break;
+            }
+        }
+        
+        if (invalid_arr_size == KAL_TRUE){
+            mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+            return mcf_ret;
+        }
+        resp->len = req->len;
+        
+        read_len = req->len * db_ptr->variable_size;
+        
+        if (read_len == 0)
+        {
+            read_len = 1 * db_ptr->variable_size;
+        }
+
+        if (read_len > db_ptr->total_size){
+            read_len = db_ptr->total_size;
+        }
+        if (read_len > 255){
+            read_len = 255;
+        }
+        
+        MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_LENGTH(read_len, db_ptr->variable_size, db_ptr->total_size);
+        kal_mem_set(lid_value, 0, 512);
+        
+        if (query_tag.is_bit == KAL_FALSE){
+
+            j = query_tag.arr_cnt;
+            
+            while(db_ptr->array_size[j] != 0){
+                n *= (db_ptr->array_size[j]);
+                j++;
+                next_level_array = KAL_TRUE;
+            }
+
+            if(req->len == 0)
+            {
+                read_len *= n;
+                MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_TOTAL_ARRAY_SIZE(n, db_ptr->variable_size);
+            }
+            
+            if(next_level_array == KAL_FALSE && read_len > item_size){
+                read_len = item_size;
+            }
+            if(next_level_array == KAL_TRUE && read_len > n*db_ptr->variable_size){
+                read_len = n*db_ptr->variable_size;
+            }
+            
+            
+            if (read_len > 255){
+                read_len = 255;
+            }
+
+            kal_mem_cpy(lid_value, (mcf_dump_buffer + item_byte_offset), read_len);
+            MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BYTE(lid_value, read_len);
+            mcf_bytes_to_hex(lid_value, read_len, KAL_TRUE, hex_value);
+			strncpy((kal_char *)(resp->value), hex_value, 511);
+            if (db_ptr->variable_size <= read_len){
+                resp->len = read_len / db_ptr->variable_size;
+            }else{
+                resp->len = read_len;
+            }
+        }else{
+
+            if (query_tag.upper_vsize == 1){
+                resp->len = 1;
+            }else if(query_tag.upper_vsize == 2){
+                resp->len = 2;
+            }else if(query_tag.upper_vsize == 4){
+                resp->len = 4;
+            }else{
+                MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT_INVALID_BIT_LEN(query_tag.upper_vsize);
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                
+                return mcf_ret;
+            }
+            MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT_SIZE(query_tag.upper_vsize, resp->len);
+
+            if (db_ptr->is_bit == KAL_TRUE){
+
+                kal_mem_cpy(lid_value, (mcf_dump_buffer + item_byte_offset), resp->len);
+                MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT_WHOLE(lid_value, resp->len);
+                
+                mcf_bytes_to_hex(lid_value, resp->len, KAL_TRUE, hex_value);
+				strncpy((kal_char *)(resp->value), hex_value, 511);
+            }else{
+
+                if (query_tag.upper_vsize == 1){
+                    kal_uint8 bit_value = *(mcf_dump_buffer + item_byte_offset);
+                    kal_uint8 bit_mask = (kal_uint8)MCF_GEN_BIT_MASK(item_size);
+                    bit_value &= (bit_mask << item_bit_offset);
+                    bit_value = ((kal_uint8)bit_value >> item_bit_offset);
+
+                    resp->len = item_size/8+1;
+
+                    mcf_bytes_to_hex(&bit_value, resp->len, KAL_TRUE, hex_value);
+					strncpy((kal_char *)(resp->value), hex_value, 511);
+                    MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT(bit_value, resp->len);
+                }else if(query_tag.upper_vsize == 2){
+                    kal_uint16 bit_value = 0;
+                    kal_uint16 bit_mask = (kal_uint16)MCF_GEN_BIT_MASK(item_size);
+                    
+                    kal_mem_cpy(&bit_value,(mcf_dump_buffer + item_byte_offset),2);
+                    
+                    bit_value &= (bit_mask << item_bit_offset);
+                    bit_value = ((kal_uint16)bit_value >> item_bit_offset);
+
+                    resp->len = item_size/8+1;
+
+                    mcf_bytes_to_hex(&bit_value, resp->len, KAL_TRUE, hex_value);
+					strncpy((kal_char *)(resp->value), hex_value, 511);
+                    MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT(bit_value, resp->len);
+                }else if(query_tag.upper_vsize == 4){
+                    kal_uint32 bit_value = 0;
+                    kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(item_size);
+                    
+                    kal_mem_cpy(&bit_value,(mcf_dump_buffer + item_byte_offset),4);
+                    
+                    bit_value &= (bit_mask << item_bit_offset);
+                    bit_value = ((kal_uint32)bit_value >> item_bit_offset);
+
+                    resp->len = item_size/8+1;
+
+                    mcf_bytes_to_hex(&bit_value, resp->len, KAL_TRUE, hex_value);
+					strncpy((kal_char *)(kal_char *)(resp->value), hex_value, 511);
+                    MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT(bit_value, resp->len);
+                }
+
+            }
+        }
+#else
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+        return mcf_ret;
+#endif
+    }else if(req->format == L4C_MCF_QUERY_VARIABLE_FORM_GID){
+        
+        kal_mem_set(array_tag, 0, MCF_FILE_MAX_ARRAY_TAG_LEN);
+        if(strcmp((kal_char *)req->config, "") != 0){
+            strncpy(array_tag, (kal_char *)req->config, MCF_FILE_MAX_ARRAY_TAG_LEN-1);
+            array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN-1] = '\0';
+            if (strlen((kal_char *)req->config) >= MCF_FILE_MAX_ARRAY_TAG_LEN){
+                MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_INVALID_ARRAY_INDEX_LEN(MCF_FILE_MAX_ARRAY_TAG_LEN, strlen((kal_char *)req->config));
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                return mcf_ret;
+            }
+            mcf_replace_char(array_tag, ',', '$');
+            if (strlen(array_tag) != 0 && array_tag[strlen(array_tag)] != '$'){
+                array_tag[strlen(array_tag)] = '$';
+            }
+        }
+        MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_ARRAY_INDEX(req->num, array_tag);
+        if (mcf_find_gid_offset(req->num, array_tag, &lid, &item_byte_offset, &item_bit_offset, &item_size, &is_bit) == KAL_FALSE) {
+            //Cannot find the gid
+            MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_FIND_GID_FAIL(lid, req->config);
+            mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+            
+            return mcf_ret;
+            
+        }
+        if(req->len == 0){
+            read_len = item_size;
+        }else{
+            read_len = req->len;
+        }
+        if(read_len > (lid_info.size-item_byte_offset)){
+            read_len = lid_info.size-item_byte_offset;
+        }
+        if(read_len > 255){
+            read_len = 255;
+        }
+        
+        if (is_bit == KAL_FALSE){
+            kal_mem_cpy(lid_value, (mcf_dump_buffer + item_byte_offset), read_len);
+            MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BYTE(lid_value, read_len);
+            mcf_bytes_to_hex(lid_value, read_len, KAL_TRUE, hex_value);
+			strncpy((kal_char *)(resp->value), hex_value, 511);
+            resp->len = read_len;
+        }else{
+            kal_uint32 align_addr;
+            kal_uint32 bit_value;
+            kal_uint32 *ptr = 0;
+            kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(item_size);
+            MCF_READ_ADDR_GET_ALIGN((kal_uint32)(mcf_dump_buffer + item_byte_offset),align_addr);
+            ptr = (kal_uint32 *)align_addr;
+            bit_value = *(ptr);
+            bit_value = bit_value >> ((((kal_uint32)(mcf_dump_buffer + item_byte_offset))-align_addr)*8);
+            bit_value = (bit_value >> item_bit_offset);
+            bit_value &= bit_mask;                         
+            if (item_size <= 8){
+                resp->len = 1;    
+            }else if(item_size > 8 && item_size <= 16){
+                resp->len = 2;           
+            }else if(item_size > 16 && item_size <= 32){
+                if (item_size % 8 == 0){
+                    resp->len = item_size/8;
+                }else{
+                    resp->len = item_size/8+1;
+                }
+            }else if (item_size > 32){
+                MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT_INVALID_BIT_LEN(item_size);
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                return mcf_ret;
+            }
+            MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_READ_VARIABLE_BIT(bit_value, resp->len);
+            mcf_bytes_to_hex(&bit_value, resp->len, KAL_TRUE, hex_value);
+			strncpy((kal_char *)(resp->value), hex_value, 511);
+        }
+        
+    }
+         
+    return mcf_ret;
+
+}
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+_STATIC mcf_ota_result_e mcf_set_variable_value(
+    l4c_mcf_variable_value_operation_req_struct *req,
+    l4c_mcf_variable_value_operation_cnf_struct *resp)
+{
+    mcf_t                                 *pMcf = mcf_get_instance();
+    sim_interface_enum                     sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+    mcf_ota_result_e                       mcf_ret = MCF_OTA_R_SUCCESS;
+    kal_uint16                             item_byte_offset;
+    kal_uint16                             item_bit_offset;
+    kal_uint32                             item_size;
+	kal_uint16                             lid = 0;
+    static kal_char                        lid_value[512];
+    kal_bool                               is_bit;
+    kal_char                               array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+	kal_int32                              value_len;
+	kal_uint32                             operation_mask = 0;
+	mcf_tool_file_info_t                  *pFile;
+	kal_uint32                             align_len = 0;
+	kal_int32                              fs_ret = FS_NO_ERROR;
+	static kal_char                        hex_value[512];
+	nvram_ltable_entry_struct              lid_info = {0};
+    nvram_errno_enum                       nvram_api_ret;
+	static kal_char                        apply_filename[MCF_FILE_MAX_NAME_LEN];
+	l4c_mcf_path_type_enum                 apply_path_type;
+    kal_bool                               read_file_fail = KAL_FALSE;
+    kal_int32                              ret_snprintf;
+
+    MD_TRC_MCF_TR_SET_VARIABLE_VALUE_START(req->format, req->action, req->num, req->rec_id);
+
+    resp->len = req->len;
+    
+	if(req->format == L4C_MCF_QUERY_VARIABLE_FORM_GID){
+        
+        kal_mem_set(array_tag, 0, MCF_FILE_MAX_ARRAY_TAG_LEN);
+        if(strcmp((kal_char *)req->config, "") != 0){
+            strncpy(array_tag, (kal_char *)req->config, MCF_FILE_MAX_ARRAY_TAG_LEN-1);
+            array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN-1] = '\0';
+            if (strlen((kal_char *)req->config) >= MCF_FILE_MAX_ARRAY_TAG_LEN){
+                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_INVALID_ARRAY_INDEX_LEN(MCF_FILE_MAX_ARRAY_TAG_LEN, strlen((kal_char *)req->config));
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                return mcf_ret;
+            }
+            mcf_replace_char(array_tag, ',', '$');
+            if (strlen(array_tag) != 0 && array_tag[strlen(array_tag)] != '$'){
+                array_tag[strlen(array_tag)] = '$';
+            }
+        }
+        MD_TRC_MCF_TR_SET_VARIABLE_VALUE_ARRAY_INDEX(req->num, array_tag);
+        
+		
+		kal_mem_set(lid_value, 0, 512);
+		kal_mem_set(hex_value, 0, 512);
+		kal_mem_cpy(hex_value, req->value, 511);
+
+		/* If value length is odd, need to add '0'*/
+		kal_mem_cpy(hex_value, req->value, 511);
+		value_len = strlen(hex_value);
+		
+		if(strlen(hex_value) % 2 != 0){
+			MD_TRC_MCF_TR_SET_VARIABLE_VALUE_INVALID_VALUE_LEN(strlen(hex_value));
+			mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+            return mcf_ret;
+		}
+		
+		mcf_hex_to_bytes(hex_value, &value_len, lid_value);
+
+		
+		if(req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA){
+			mcf_tool_gid_ota_file_item_t        pItem;
+			mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+			nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+			
+			kal_mem_set(&pItem, 0, sizeof(mcf_tool_gid_ota_file_item_t));
+			
+			/*Compose a file content*/
+			pItem.global_id = req->num;
+			pItem.record_idx = req->rec_id;
+			pItem.array_index_len = strlen(array_tag);
+			
+			if (mcf_find_gid_offset(req->num, array_tag, &lid, &item_byte_offset, &item_bit_offset, &item_size, &is_bit) == KAL_FALSE) {
+				//Cannot find the gid
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_FIND_GID_FAIL(lid, req->config);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				
+				return mcf_ret;
+				
+			}
+			
+			nvram_api_ret = nvram_external_get_lid_info(lid, &lid_info);
+			if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_GET_LID_INFO_FAIL(lid, nvram_api_ret);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+				return mcf_ret;
+			}
+
+			if(req->rec_id > lid_info.total_records || req->rec_id == 0){
+				MD_TRC_MCF_TR_QUERY_VARIABLE_VALUE_INVALID_REC_ID(req->rec_id, lid_info.total_records);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+				return mcf_ret;
+			}
+			
+			if (pItem.array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_INVALID_ARRAY_INDEX_LEN(MCF_FILE_MAX_ARRAY_TAG_LEN, pItem.array_index_len);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				return mcf_ret;
+			}
+			if(value_len > item_size){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_INVALID_VAL_LEN(value_len, item_size);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				return mcf_ret;
+			}
+
+			pItem.total_len = 16;
+			
+			if(is_bit == KAL_TRUE){
+				pItem.value_len = item_size/8+1;
+                item_size = item_size/8+1;
+			}else{
+				pItem.value_len = item_size;
+			}
+			pItem.total_len += item_size;
+			pItem.total_len += pItem.array_index_len;
+			
+			if (pItem.total_len % 4 != 0){
+				align_len = (4-(pItem.total_len % 4));
+				pItem.total_len += align_len;
+			}
+			
+			resp->len = pItem.value_len;
+
+			if (pItem.array_index_len > 0){
+				strncpy(&(pItem.buff_start), array_tag, 1);
+			}else{
+				strncpy(&(pItem.buff_start), lid_value, 1);
+			}
+			
+			kal_mem_set(mcf_gid_buff, 0, 128);
+			kal_mem_cpy(mcf_gid_buff, &pItem, pItem.total_len);
+			strncpy(mcf_gid_buff+16, array_tag, strlen(array_tag));
+			kal_mem_cpy(mcf_gid_buff+16+strlen(array_tag), lid_value, value_len);
+			kal_mem_set(mcf_gid_buff+16+strlen(array_tag)+value_len, 0, item_size-value_len);
+			kal_mem_set(mcf_gid_buff+16+strlen(array_tag)+item_size, 0, align_len);
+			operation_mask |= MCF_FILE_OP_CHECKSUM;
+			
+			kal_mem_set(mcf_file_buffer, 0, MCF_MAX_FILE_SIZE);
+			
+			/* Read MCF OTA file information to NVRAM */
+			if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_READ_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+				mcf_ret = MCF_OTA_R_READ_NVRAM_FAIL;
+				return mcf_ret;
+			}
+			
+			if (strcmp(nv_ota_file.merged_path,"") == 0){
+				strncpy(nv_ota_file.merged_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			}
+			
+			if (strcmp(nv_ota_file.merged_name,"") == 0){
+				strncpy(nv_ota_file.merged_name, MCF_FS_DEFAULT_OTA_MERGED_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+			}
+			
+			if(mcf_merge_one_gid(mcf_gid_buff, MCF_TYPE_OTA, mcf_file_buffer, MCF_MAX_OTA_FILE_SIZE, operation_mask) != KAL_TRUE){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_MERGE_GID_TO_FILE_FAIL(MCF_TYPE_OTA);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				return mcf_ret;
+			}
+			
+			mcf_ret = mcf_read_ota_file(KAL_FALSE, nv_ota_file.path, nv_ota_file.name, &apply_path_type, apply_filename, pMcf);
+			//Read fail return fail
+            if(mcf_ret != MCF_OTA_R_SUCCESS){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_READ_FILE_FAIL(nv_ota_file.path, nv_ota_file.name, mcf_ret);
+                read_file_fail = KAL_TRUE;
+			}
+			MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+			if (ota_file) {
+				pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+				/* Check if file type is OTA file */
+				if (read_file_fail == KAL_TRUE || strcmp(pFile->file_type, MCF_FILE_TYPE_OTA) != 0) {
+
+                    MD_TRC_MCF_TR_SET_VARIABLE_VALUE_MERGE_FILE();
+                    kal_mem_cpy(mcf_merge_buffer, mcf_file_buffer, MCF_MAX_OTA_FILE_SIZE);
+				}else{
+                    if (mcf_merge_ota_buffer(ota_file->buff, mcf_file_buffer, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE) != KAL_TRUE){
+                        MD_TRC_MCF_TR_SET_VARIABLE_VALUE_MERGE_OTA_FILE_FAIL();
+                        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+                        return mcf_ret;
+                    }
+                }
+				
+				
+				MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+			}else{
+				mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAKE_READ_LOCK_FAIL();
+				MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+				return mcf_ret;
+			}
+			
+			/* Before create merged OTA file, need to delete last time merged OTA file */
+			kal_wsprintf(merge_ota_name, "%s\\%s\0", nv_ota_file.merged_path, nv_ota_file.merged_name);
+			fs_ret = FS_Delete(merge_ota_name);
+			
+			if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_DELETE_FILE_FAIL(fs_ret);
+				mcf_ret = MCF_OTA_R_WRITE_DISK_FAIL;
+				return mcf_ret;
+			}
+			
+			pFile = (mcf_tool_file_info_t *)mcf_merge_buffer;
+			
+			if(pFile->file_size > MCF_MAX_OTA_FILE_SIZE){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_INVALID_FILE_SIZE(pFile->file_size, MCF_MAX_OTA_FILE_SIZE);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				return mcf_ret;
+			}
+			/*Write Merged OTA file*/
+			mcf_ret = mcf_write_buffer(nv_ota_file.merged_path, nv_ota_file.merged_name, (kal_uint8 *)mcf_merge_buffer, pFile->file_size);
+			if (mcf_ret != MCF_OTA_R_SUCCESS) {
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_WRITE_FILE_FAIL(nv_ota_file.merged_path, nv_ota_file.merged_name);
+				return mcf_ret;
+			}
+
+			strncpy(nv_ota_file.path, nv_ota_file.merged_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			strncpy(nv_ota_file.name, nv_ota_file.merged_name, MCF_FILE_MAX_NAME_LEN - 1);
+
+			if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_WRITE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+				mcf_ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+				return mcf_ret;
+			}
+
+		}else if (req->action == L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA){
+			mcf_tool_gid_tlvota_file_item_t         pItem_op;
+			mcf_tlvota_file_t                      *tlvota_file;
+			kal_char                                tag[MCF_MAX_TAG_LEN];
+			kal_bool                                is_general = KAL_FALSE;
+			nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+			
+			if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_INVALID_SIM_ID(req->ps_id, sim_id);
+
+                return KAL_FALSE;
+            }
+            
+            tlvota_file = &(pMcf->tlvota_file[sim_id]);
+            /*Compose a file content*/
+			pItem_op.global_id = req->num;
+			pItem_op.array_index_len = strlen(array_tag);
+			
+			if (mcf_find_gid_offset(req->num, array_tag, &lid, &item_byte_offset, &item_bit_offset, &item_size, &is_bit) == KAL_FALSE) {
+				//Cannot find the gid
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_FIND_GID_FAIL(lid, req->config);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				
+				return mcf_ret;
+				
+			}
+			if (pItem_op.array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_INVALID_ARRAY_INDEX_LEN(MCF_FILE_MAX_ARRAY_TAG_LEN, pItem_op.array_index_len);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				return mcf_ret;
+			}
+			if(value_len > item_size){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_INVALID_VAL_LEN(value_len, item_size);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				return mcf_ret;
+			}
+			
+			pItem_op.tag_type = MCF_TLVOTA_TAG_SBPID;
+			MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			if (tlvota_file) {
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TLVOTA_SBPID(tlvota_file->sbp_id, tlvota_file->mcc, tlvota_file->mnc);
+				if (tlvota_file->sbp_id != SBP_ID_INVALID) {
+					is_general = KAL_FALSE;
+					if (strcmp((kal_char *)tlvota_file->mcc, "") != 0) {
+						if (strcmp((kal_char *)tlvota_file->mnc, "") != 0){
+							ret_snprintf = kal_snprintf(tag, MCF_MAX_TAG_LEN, "%d_%s_%s%c", tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc, '\0');
+                            if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                                strncpy(tag, "SBP_mcc_mnc", MCF_MAX_TAG_LEN - 1);
+                                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAG_SNPRINTF_FAIL(tag, tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc);
+                            }
+						}else{
+							ret_snprintf = kal_snprintf(tag, MCF_MAX_TAG_LEN, "%d_%s_NA%c", tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, '\0');
+                            if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                                strncpy(tag, "SBP_mcc_NA", MCF_MAX_TAG_LEN - 1);
+                                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAG_SNPRINTF_FAIL(tag, tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc);
+                            }
+						}
+					}else{
+						if (strcmp((kal_char *)tlvota_file->mnc, "") != 0){
+							ret_snprintf = kal_snprintf(tag, MCF_MAX_TAG_LEN, "%d_NA_%s%c", tlvota_file->sbp_id, (kal_char *)tlvota_file->mnc, '\0');
+                            if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                                strncpy(tag, "SBP_NA_mnc", MCF_MAX_TAG_LEN - 1);
+                                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAG_SNPRINTF_FAIL(tag, tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc);
+                            }
+						}else{
+							ret_snprintf = kal_snprintf(tag, MCF_MAX_TAG_LEN, "%d_NA_NA%c", tlvota_file->sbp_id, '\0');
+                            if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                                strncpy(tag, "SBP_NA_NA", MCF_MAX_TAG_LEN - 1);
+                                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAG_SNPRINTF_FAIL(tag, tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc);
+                            }
+						}
+					}
+				}else{
+					is_general = KAL_TRUE;
+					if (strcmp((kal_char *)tlvota_file->mcc, "") != 0) {
+						if (strcmp((kal_char *)tlvota_file->mnc, "") != 0){
+							ret_snprintf = kal_snprintf(tag, MCF_MAX_TAG_LEN, "NA_%s_%s%c", (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc, '\0');
+                            if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                                strncpy(tag, "NA_mcc_mnc", MCF_MAX_TAG_LEN - 1);
+                                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAG_SNPRINTF_FAIL(tag, tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc);
+                            }
+						}else{
+							ret_snprintf = kal_snprintf(tag, MCF_MAX_TAG_LEN, "NA_%s_NA%c", (kal_char *)tlvota_file->mcc, '\0');
+                            if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                                strncpy(tag, "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+                                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAG_SNPRINTF_FAIL(tag, tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc);
+                            }
+						}
+					}else{
+						if (strcmp((kal_char *)tlvota_file->mnc, "") != 0){
+							ret_snprintf = kal_snprintf(tag, MCF_MAX_TAG_LEN, "NA_NA_%s%c", (kal_char *)tlvota_file->mnc, '\0');
+                            if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                                strncpy(tag, "NA_NA_mnc", MCF_MAX_TAG_LEN - 1);
+                                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAG_SNPRINTF_FAIL(tag, tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc);
+                            }
+						}else{
+							is_general = KAL_FALSE;
+							ret_snprintf = kal_snprintf(tag, MCF_MAX_TAG_LEN, "NA_NA_NA%c", '\0');
+                            if (ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                                strncpy(tag, "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                                MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAG_SNPRINTF_FAIL(tag, tlvota_file->sbp_id, (kal_char *)tlvota_file->mcc, (kal_char *)tlvota_file->mnc);
+                            }
+						}
+					}
+				}
+				MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			}else{
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAKE_READ_LOCK_FAIL();
+				mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+				MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+				return mcf_ret;
+			}
+			
+			if(is_general == KAL_TRUE){
+				tlvota_file = &(pMcf->general_tlvota_file);
+			}
+			
+			pItem_op.tag_len = strlen(tag);
+
+			pItem_op.total_len = 16;
+			
+			if(is_bit == KAL_TRUE){
+				pItem_op.value_len = item_size/8+1;
+                item_size = item_size/8+1;
+			}else{
+				pItem_op.value_len = item_size;
+			}
+			pItem_op.total_len += pItem_op.value_len;
+			pItem_op.total_len += pItem_op.array_index_len;
+			pItem_op.total_len += pItem_op.tag_len;
+			if (pItem_op.total_len % 4 != 0){
+				align_len = (4-(pItem_op.total_len % 4));
+				pItem_op.total_len += align_len;
+			}
+			resp->len = pItem_op.value_len;
+                
+            strncpy(&(pItem_op.buff_start), tag, 1);
+
+			kal_mem_set(mcf_gid_buff, 0, 128);
+			kal_mem_cpy(mcf_gid_buff, &pItem_op, pItem_op.total_len);
+            strncpy(mcf_gid_buff+16, tag, strlen(tag));
+            strncpy(mcf_gid_buff+16+strlen(tag), array_tag, strlen(array_tag));
+            kal_mem_cpy(mcf_gid_buff+16+strlen(tag)+strlen(array_tag), lid_value, value_len);
+			kal_mem_set(mcf_gid_buff+16+strlen(tag)+strlen(array_tag)+value_len, 0, item_size-value_len);
+			kal_mem_set(mcf_gid_buff+16+strlen(tag)+strlen(array_tag)+item_size, 0, align_len);
+			
+			operation_mask |= MCF_FILE_OP_CHECKSUM;
+			
+			kal_mem_set(mcf_file_buffer, 0, MCF_MAX_FILE_SIZE);
+			
+			if(is_general == KAL_FALSE){
+			/* Read MCF TLV-OTA file information in NVRAM */
+				if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+					MD_TRC_MCF_TR_SET_VARIABLE_VALUE_READ_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+					mcf_ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+					return mcf_ret;
+				}
+				mcf_ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, nv_tlvota_file.path, nv_tlvota_file.name, &apply_path_type, apply_filename, pMcf);
+				if(mcf_ret != MCF_OTA_R_SUCCESS){
+					MD_TRC_MCF_TR_SET_VARIABLE_VALUE_READ_FILE_FAIL(nv_tlvota_file.path, nv_tlvota_file.name, mcf_ret);
+                    read_file_fail = KAL_TRUE;
+				}
+			}else{
+				/* Read MCF general TLV-OTA file into cache buffer */
+				if ( !nvram_external_read_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+					MD_TRC_MCF_TR_SET_VARIABLE_VALUE_READ_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+					mcf_ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+					return mcf_ret;
+				}
+				mcf_ret = mcf_read_general_tlvota_file(KAL_FALSE, nv_tlvota_file.path, nv_tlvota_file.name, &apply_path_type, apply_filename, pMcf);
+				if(mcf_ret != MCF_OTA_R_SUCCESS){
+					MD_TRC_MCF_TR_SET_VARIABLE_VALUE_READ_FILE_FAIL(nv_tlvota_file.path, nv_tlvota_file.name, mcf_ret);
+                    read_file_fail = KAL_TRUE;
+				}
+			}
+			
+			if (strcmp(nv_tlvota_file.merged_path,"") == 0){
+				strncpy(nv_tlvota_file.merged_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			}
+			
+			if (strcmp(nv_tlvota_file.merged_name,"") == 0){
+				if(is_general == KAL_FALSE){
+                    mcf_snprintf(nv_tlvota_file.merged_name, MCF_FILE_MAX_NAME_LEN, "%s_%d.mcfopota%c", MCF_FS_DEFAULT_TLVOTA_MERGED_FILE_PREFIX, sim_id, '\0');
+				}else{
+					strncpy(nv_tlvota_file.merged_name, MCF_FS_GENERAL_TLVOTA_MERGED_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+				}
+			}
+			
+			if(mcf_merge_one_gid(mcf_gid_buff, MCF_TYPE_OTA_BY_OP, mcf_file_buffer, MCF_MAX_TLVOTA_FILE_SIZE, operation_mask) != KAL_TRUE){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_MERGE_GID_TO_FILE_FAIL(MCF_TYPE_OTA_BY_OP);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				return mcf_ret;
+			}
+			
+			MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			if (tlvota_file) {
+				pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+				/* Check if file type is OTA file */
+				if (read_file_fail == KAL_TRUE || strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+					MD_TRC_MCF_TR_SET_VARIABLE_VALUE_MERGE_FILE();
+					kal_mem_cpy(mcf_merge_buffer, mcf_file_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+				}else{
+					if(mcf_merge_ota_buffer(tlvota_file->buff, mcf_file_buffer, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE) != KAL_TRUE){
+						MD_TRC_MCF_TR_SET_VARIABLE_VALUE_MERGE_OTA_FILE_FAIL();
+						mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+						return mcf_ret;
+					}
+				}
+				
+
+				MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			}else{
+				mcf_ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_TAKE_READ_LOCK_FAIL();
+				MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+				return mcf_ret;
+			}
+			
+			/* Before create merged OTA file, need to delete last time merged OTA file */
+			kal_wsprintf(merge_ota_name, "%s\\%s\0", nv_tlvota_file.merged_path, nv_tlvota_file.merged_name);
+			fs_ret = FS_Delete(merge_ota_name);
+			
+			if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_DELETE_FILE_FAIL(fs_ret);
+				mcf_ret = MCF_OTA_R_WRITE_DISK_FAIL;
+				return mcf_ret;
+			}
+			
+			pFile = (mcf_tool_file_info_t *)mcf_merge_buffer;
+			
+			if(pFile->file_size > MCF_MAX_TLVOTA_FILE_SIZE){
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_INVALID_FILE_SIZE(pFile->file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+				return mcf_ret;
+			}
+			
+            /*Write Merged OTA file*/
+            mcf_ret = mcf_write_buffer(nv_tlvota_file.merged_path, nv_tlvota_file.merged_name, (kal_uint8 *)mcf_merge_buffer, pFile->file_size);
+			if (mcf_ret != MCF_OTA_R_SUCCESS) {
+				MD_TRC_MCF_TR_SET_VARIABLE_VALUE_WRITE_FILE_FAIL(nv_tlvota_file.merged_path, nv_tlvota_file.merged_name);
+				return mcf_ret;
+			}
+
+			strncpy(nv_tlvota_file.path, nv_tlvota_file.merged_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			strncpy(nv_tlvota_file.name, nv_tlvota_file.merged_name, MCF_FILE_MAX_NAME_LEN - 1);
+			
+			if(is_general == KAL_FALSE){
+				/* Write MCF TLV-OTA file information in NVRAM */
+				if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+					MD_TRC_MCF_TR_SET_VARIABLE_VALUE_WRITE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+					mcf_ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+					return mcf_ret;
+				}
+			}else{
+				/* Write MCF TLV-OTA file information in NVRAM */
+				if ( !nvram_external_write_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+					MD_TRC_MCF_TR_SET_VARIABLE_VALUE_WRITE_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+					mcf_ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+					return mcf_ret;
+				}
+			}
+			
+			if (pMcf->is_ignore_dsbp[sim_id] == KAL_FALSE) {
+				/* If MCF is in DSBP passive mode, change to DSBP active mode */
+				mcf_ret = mcf_set_dsbp_mode(KAL_TRUE, KAL_FALSE, sim_id);
+				if (mcf_ret != MCF_OTA_R_SUCCESS) {
+					return mcf_ret;
+				}
+				pMcf->is_ignore_dsbp[sim_id] = KAL_TRUE;
+			}
+		}
+
+    }
+         
+    return mcf_ret;
+
+}
+#endif
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+_STATIC mcf_ota_result_e mcf_assign_combined_file_path(l4c_mcf_set_config_req_struct *req)
+{
+	mcf_ota_result_e                ret = MCF_OTA_R_SUCCESS;
+
+	switch (req->config_type)
+	{
+		case L4C_MCF_CONFIG_TYPE_DEFAULT_BIN:
+		{
+			kal_char                            fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+			kal_char                            curr_filename[MCF_FILE_MAX_NAME_LEN];
+			kal_char                           *file_extension1 = NULL;
+			kal_char                           *file_extension2 = NULL;
+			nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+			
+			if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+				strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			} else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+				strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			} else {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_PATH_TYPE(req->path_type);
+				ret = MCF_OTA_R_INVALID_PARAMETER;
+
+				return ret;
+			}
+			
+			if (strcmp((kal_char *)req->config1, "") != 0) {
+				file_extension1 = strstr((kal_char *)req->config1, ".mcfota");
+                if (file_extension1 == NULL){
+                    file_extension2 = strstr((kal_char *)req->config1, ".bin");
+                    if (file_extension2 == NULL) {
+                        MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_FILE_TYPE((kal_char *)req->config1);
+                        ret = MCF_OTA_R_INVALID_PARAMETER;
+                        return ret;
+                    }
+                }
+				strncpy(curr_filename, (kal_char *)req->config1, MCF_FILE_MAX_NAME_LEN - 1);
+			} else {
+				strncpy(curr_filename, MCF_FS_DEFAULT_OTA_MERGED_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+			}
+			
+			/* Read MCF OTA file information in NVRAM */
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+                MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+                return ret;
+            }
+			
+			/* Read MCF Internal information in NVRAM */
+			if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+				ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+				return ret;
+			}
+			
+			strncpy(nv_ota_file.merged_path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			strncpy(nv_ota_file.merged_name, curr_filename, MCF_FILE_MAX_NAME_LEN - 1);
+			nv_int_info.is_combined_ota = KAL_TRUE;
+
+			/* Write MCF OTA file information in NVRAM */
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+                MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_OTA_FILE_LID);
+                ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                return ret;
+            }
+			
+			if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+				ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+				return ret;
+			}
+			
+			break;
+		}
+
+		case L4C_MCF_CONFIG_TYPE_CARRIER_BIN:
+		{
+			kal_char                                fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+			kal_char                                curr_filename[MCF_FILE_MAX_NAME_LEN];
+			kal_char                               *file_extension1 = NULL;
+			kal_char                               *file_extension2 = NULL;
+			nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+			sim_interface_enum                      sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+            
+            if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+                MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_SIM_ID(req->ps_id, sim_id);
+                ret = MCF_OTA_R_INVALID_PARAMETER;
+
+                return ret;
+            }
+			
+			if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+				strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			} else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+				strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			} else {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_PATH_TYPE(req->path_type);
+				ret = MCF_OTA_R_INVALID_PARAMETER;
+
+				return ret;
+			}
+
+			if (strcmp((kal_char *)req->config1, "") != 0) {
+				file_extension1 = strstr((kal_char *)req->config1, ".mcfopota");
+                if (file_extension1 == NULL){
+                    file_extension2 = strstr((kal_char *)req->config1, ".bin");
+                    if (file_extension2 == NULL) {
+                        MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_FILE_TYPE((kal_char *)req->config1);
+                        ret = MCF_OTA_R_INVALID_PARAMETER;
+                        return ret;
+                    }
+                }
+				strncpy(curr_filename, (kal_char *)req->config1, MCF_FILE_MAX_NAME_LEN - 1);
+			} else {
+				strncpy(curr_filename, MCF_FS_DEFAULT_TLVOTA_MERGED_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+			}
+			
+			/* Read MCF Internal information in NVRAM */
+			if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+				ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+				return ret;
+			}
+			
+			/* Read MCF TLV-OTA file information in NVRAM */
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+                MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                ret = KAL_FALSE;
+
+                return MCF_OTA_R_READ_NVRAM_FAIL;
+            }
+			
+			strncpy(nv_tlvota_file.merged_path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			strncpy(nv_tlvota_file.merged_name, curr_filename, MCF_FILE_MAX_NAME_LEN - 1);
+			nv_int_info.is_combined_tlvota[sim_id] = KAL_TRUE;
+
+			if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+				ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+				return ret;
+			}
+			
+			/* Write MCF TLV-OTA file information in NVRAM */
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+                MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+                return ret;
+            }
+			
+			break;
+		}
+		case L4C_MCF_CONFIG_TYPE_GENERAL_CARRIER_BIN:
+		{
+			kal_char                                fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+			kal_char                                curr_filename[MCF_FILE_MAX_NAME_LEN];
+			kal_char                               *file_extension1 = NULL;
+			kal_char                               *file_extension2 = NULL;
+			nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+			
+			if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+				strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			} else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+				strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			} else {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_PATH_TYPE(req->path_type);
+				ret = MCF_OTA_R_INVALID_PARAMETER;
+
+				return ret;
+			}
+
+			if (strcmp((kal_char *)req->config1, "") != 0) {
+				file_extension1 = strstr((kal_char *)req->config1, ".mcfopota");
+				if (file_extension1 == NULL){
+                    file_extension2 = strstr((kal_char *)req->config1, ".bin");
+                    if (file_extension2 == NULL) {
+                        MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_FILE_TYPE((kal_char *)req->config1);
+                        ret = MCF_OTA_R_INVALID_PARAMETER;
+                        return ret;
+                    }
+                }
+				strncpy(curr_filename, (kal_char *)req->config1, MCF_FILE_MAX_NAME_LEN - 1);
+			} else {
+				strncpy(curr_filename, MCF_FS_GENERAL_TLVOTA_MERGED_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+			}
+			
+			/* Read MCF Internal information in NVRAM */
+			if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+				ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+				return ret;
+			}
+			
+			/* Read MCF general TLV-OTA file into cache buffer */
+			if ( !nvram_external_read_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+				ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+				return ret;
+			}
+			
+			strncpy(nv_tlvota_file.merged_path, fs_root_path, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			strncpy(nv_tlvota_file.merged_name, curr_filename, MCF_FILE_MAX_NAME_LEN - 1);
+			nv_int_info.is_combined_general_tlvota = KAL_TRUE;
+
+			if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+				ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+				return ret;
+			}
+			if ( !nvram_external_write_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+				MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_WRITE_FILE_NVRAM_FAIL(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID);
+				ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+				return ret;
+			}
+			
+			break;
+		}
+		
+		default:
+		{
+			MD_TRC_MCF_TR_ASSIGN_COMBINED_FILE_PATH_INVALID_CONFIG_TYPE(req->config_type);
+			ret = MCF_OTA_R_INVALID_PARAMETER;
+			break;
+        }
+
+	}
+	
+	
+	return ret;
+}
+#endif
+_STATIC mcf_ota_result_e mcf_l4_set_config(ilm_struct *ilm)
+{
+    l4c_mcf_set_config_req_struct  *req = (l4c_mcf_set_config_req_struct *)ilm->local_para_ptr;
+    l4c_mcf_set_config_cnf_struct  *local_para_ptr = NULL;
+    mcf_ota_result_e                ret = MCF_OTA_R_SUCCESS;
+    mcf_ota_result_e                write_ret;
+    kal_int32                       fs_ret = FS_NO_ERROR;
+    kal_wchar                       pathname[MCF_FILE_MAX_MD_PATH_LEN];
+    kal_uint32                      ret_sprintf;
+
+    switch (req->op)
+    {
+        case L4C_MCF_CONFIG_SET_OTA_AND_OPOTA_FILE_PATH:
+        case L4C_MCF_CONFIG_SET_OTA_FILE_PATH:
+        case L4C_MCF_CONFIG_SET_OPOTA_FILE_PATH:
+            ret = mcf_set_file_path(req);
+            break;
+
+        case L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE:
+        {
+            mcf_t                              *pMcf = mcf_get_instance();
+            sim_interface_enum                  sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+			mcf_l4bsbp_trigger_dsbp_ind_struct *ind_ptr = NULL;
+            
+            if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+                MD_TRC_MCF_TR_L4_SET_CONFIG_INVALID_SIM_ID(req->ps_id, sim_id);
+                ret = MCF_OTA_R_INVALID_PARAMETER;
+
+                return ret;
+            }
+
+            if (pMcf->is_dsbp_ongoing[sim_id] == KAL_TRUE) {
+                MD_TRC_MCF_TR_L4_SET_CONFIG_DSBP_ONGOING(req->ps_id, sim_id);
+
+                /* Send process result to ATCI */
+                local_para_ptr = (l4c_mcf_set_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_set_config_cnf_struct), TD_RESET);
+                if (!local_para_ptr) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                    return ret;
+                }
+                local_para_ptr->src_id = req->src_id;
+                local_para_ptr->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+                local_para_ptr->dsbp_result = MCF_TRIGGER_DSBP_R_FAIL_MCF_DSBP_ONGOING;
+
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_L4C_MCF_SET_CONFIG_CNF, /* msg_id */
+                        (local_para_struct*)local_para_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+
+                goto out;
+            }
+
+            ret = mcf_set_file_path(req);
+            if (ret == MCF_OTA_R_SUCCESS) {
+                /* 
+                 *  Trigger DSBP and do not respond to AP immediately.
+                 *  Wait DSBP response, and then respond to AP.
+                 */
+                ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                if (!ind_ptr) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                    return ret;
+                }
+
+                ind_ptr->src_id = req->src_id;
+                ind_ptr->config_op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+                ind_ptr->src_mod_id = ilm->src_mod_id;
+
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        MOD_L4BSBP + req->ps_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                        (local_para_struct*)ind_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+
+                pMcf->is_dsbp_ongoing[sim_id] = KAL_TRUE;
+				
+				/* Support MCF Tool Send AT cmd - delete txt */
+                kal_wsprintf(pathname, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT);
+                fs_ret = FS_Delete(pathname);
+                
+                if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+                    MD_TRC_MCF_TR_L4_SET_CONFIG_DELETE_FILE_FAIL(fs_ret);
+                    ret = MCF_OTA_R_WRITE_DISK_FAIL;
+                    return ret;
+                }
+                
+                /* Support MCF Tool Send AT cmd - Write AT cmd result in txt */
+                kal_mem_set(txt_buff, 0, 64);
+                ret_sprintf = kal_sprintf(txt_buff, "EMCFC=%d,%d,%d%c", L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE, 0, MCF_TRIGGER_DSBP_R_FAIL_MCF_DSBP_ONGOING, '\0');
+                if (ret_sprintf < 0 || ret_sprintf > 64){
+                    strncpy(txt_buff, "EMCFC unknown error", 63);
+                }
+                MD_TRC_MCF_TR_L4_SET_CONFIG_CMD_RESULT(txt_buff);
+                write_ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT, (kal_uint8 *)txt_buff, strlen(txt_buff));
+                if (write_ret != MCF_OTA_R_SUCCESS) {
+                    return write_ret;
+                }
+				
+				
+                goto out;
+            }else {
+                /* Send process result to ATCI */
+                local_para_ptr = (l4c_mcf_set_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_set_config_cnf_struct), TD_RESET);
+                if (!local_para_ptr) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                    return ret;
+                }
+                local_para_ptr->src_id = req->src_id;
+                local_para_ptr->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+                local_para_ptr->mcf_result = ret;
+
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_L4C_MCF_SET_CONFIG_CNF, /* msg_id */
+                        (local_para_struct*)local_para_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+
+                goto out;
+            }
+            break;
+        }
+
+        case L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN:
+        {
+            mcf_l4bsbp_trigger_dsbp_ind_struct *ind_ptr = NULL;
+            kal_uint32                          i = 0;
+            mcf_t                              *pMcf = mcf_get_instance();
+
+            ret = mcf_set_file_path(req);
+            if ( (req->trigger_dsbp == 1) && (ret == MCF_OTA_R_SUCCESS) ) {
+                /* 
+                 *  Trigger DSBP and do not respond to AP immediately.
+                 *  Wait DSBP response, and then respond to AP.
+                 */
+                 if (req->config_type == L4C_MCF_CONFIG_TYPE_GENERAL_CARRIER_BIN){
+                    //General OP-OTA need to trigger dsbp all sims
+                    dsbp_ret = 0;
+                    
+                    for (i = 0; i < MAX_SIM_NUM; i++){
+                        ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                        if (!ind_ptr) {
+                            ASSERT(0);
+                            ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                            return ret;
+                        }
+                        
+                        ind_ptr->src_id = req->src_id;
+                        ind_ptr->config_op = req->op;
+                        ind_ptr->src_mod_id = ilm->src_mod_id;
+
+                        msg_send6(MOD_MCF, /* src_mod_id */
+                                MOD_L4BSBP + i, /* dest_mod_id */
+                                MCF_SAP, /* sap_id */
+                                MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                                (local_para_struct*)ind_ptr, /* local_para_ptr */
+                                NULL); /* peer_buff_ptr */
+                        pMcf->dsbp_cnf_cnt ++;
+                        pMcf->dsbp_ind_cnt ++;
+                        pMcf->dsbp_cnf_ret = KAL_TRUE;
+                        ret = MCF_OTA_R_SUCCESS;
+                    }
+                    
+                }else{
+                    //OTA and OP-OTA only need to by sim trigger dsbp
+                    
+                    ind_ptr = (mcf_l4bsbp_trigger_dsbp_ind_struct *)construct_local_para(sizeof(mcf_l4bsbp_trigger_dsbp_ind_struct), TD_RESET);
+                    if (!ind_ptr) {
+                        ASSERT(0);
+                        ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                        return ret;
+                    }
+
+                    ind_ptr->src_id = req->src_id;
+                    ind_ptr->config_op = req->op;
+                    ind_ptr->src_mod_id = ilm->src_mod_id;
+
+                    msg_send6(MOD_MCF, /* src_mod_id */
+                            MOD_L4BSBP + req->ps_id, /* dest_mod_id */
+                            MCF_SAP, /* sap_id */
+                            MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_IND, /* msg_id */
+                            (local_para_struct*)ind_ptr, /* local_para_ptr */
+                            NULL); /* peer_buff_ptr */
+                        
+                }
+                        
+                /* Support MCF Tool Send AT cmd - delete txt */
+                kal_wsprintf(pathname, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT);
+                fs_ret = FS_Delete(pathname);
+                
+                if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+                    MD_TRC_MCF_TR_L4_SET_CONFIG_DELETE_FILE_FAIL(fs_ret);
+                    ret = MCF_OTA_R_WRITE_DISK_FAIL;
+                    return ret;
+                }
+                
+                /* Support MCF Tool Send AT cmd - Write AT cmd result in txt */
+                kal_mem_set(txt_buff, 0, 64);
+                ret_sprintf = kal_sprintf(txt_buff, "EMCFC=%d,%d,%d%c", L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN, 0, MCF_TRIGGER_DSBP_R_FAIL_MCF_DSBP_ONGOING, '\0');
+                if (ret_sprintf < 0 || ret_sprintf > 64){
+                    strncpy(txt_buff, "EMCFC unknown error", 63);
+                }
+                MD_TRC_MCF_TR_L4_SET_CONFIG_CMD_RESULT(txt_buff);
+                write_ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT, (kal_uint8 *)txt_buff, strlen(txt_buff));
+                if (write_ret != MCF_OTA_R_SUCCESS) {
+                    return write_ret;
+                }
+
+                goto out;
+            } else {
+                /* Send process result to ATCI */
+                local_para_ptr = (l4c_mcf_set_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_set_config_cnf_struct), TD_RESET);
+                if (!local_para_ptr) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                    return ret;
+                }
+                local_para_ptr->src_id = req->src_id;
+                local_para_ptr->op = req->op;
+                local_para_ptr->mcf_result = ret;
+                local_para_ptr->dsbp_result = 0;
+
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_L4C_MCF_SET_CONFIG_CNF, /* msg_id */
+                        (local_para_struct*)local_para_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                        
+                /* Support MCF Tool Send AT cmd - delete txt */
+                kal_wsprintf(pathname, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT);
+                fs_ret = FS_Delete(pathname);
+                
+                if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+                    MD_TRC_MCF_TR_L4_SET_CONFIG_DELETE_FILE_FAIL(fs_ret);
+                    ret = MCF_OTA_R_WRITE_DISK_FAIL;
+                    return ret;
+                }
+                
+                /* Support MCF Tool Send AT cmd - Write AT cmd result in txt */
+                kal_mem_set(txt_buff, 0, 64);
+                ret_sprintf = kal_sprintf(txt_buff, "EMCFC=%d,%d,%d%c", L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN, ret, 0, '\0');
+                if (ret_sprintf < 0 || ret_sprintf > 64){
+                    strncpy(txt_buff, "EMCFC unknown error", 63);
+                }
+                MD_TRC_MCF_TR_L4_SET_CONFIG_CMD_RESULT(txt_buff);
+                write_ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT, (kal_uint8 *)txt_buff, strlen(txt_buff));
+                if (write_ret != MCF_OTA_R_SUCCESS) {
+                    return write_ret;
+                }
+                
+                goto out;
+            }
+            break;
+        }
+
+        default:
+            MD_TRC_MCF_TR_L4_SET_CONFIG_UNKNOWN_OP(req->op);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            break;
+    }
+
+    /* Send process result to ATCI */
+    local_para_ptr = (l4c_mcf_set_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_set_config_cnf_struct), TD_RESET);
+    if (!local_para_ptr) {
+        ASSERT(0);
+        ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+        return ret;
+    }
+    local_para_ptr->src_id = req->src_id;
+    if (ret == MCF_OTA_R_SUCCESS) {
+        local_para_ptr->result = KAL_TRUE;
+    } else {
+        local_para_ptr->result = KAL_FALSE;
+    }
+
+    msg_send6(MOD_MCF, /* src_mod_id */
+            ilm->src_mod_id, /* dest_mod_id */
+            MCF_SAP, /* sap_id */
+            MSG_ID_L4C_MCF_SET_CONFIG_CNF, /* msg_id */
+            (local_para_struct*)local_para_ptr, /* local_para_ptr */
+            NULL); /* peer_buff_ptr */
+
+out:
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_l4_get_config(ilm_struct *ilm)
+{
+    l4c_mcf_get_config_req_struct  *req = (l4c_mcf_get_config_req_struct *)ilm->local_para_ptr;
+    l4c_mcf_get_config_cnf_struct  *local_para_ptr = NULL;
+    mcf_ota_result_e                ret;
+
+    local_para_ptr = (l4c_mcf_get_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_get_config_cnf_struct), TD_RESET);
+    if (!local_para_ptr) {
+        ASSERT(0);
+        ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+        return ret;
+    }
+
+    switch (req->op)
+    {
+        case L4C_MCF_CONFIG_GET_APPLIED_FILE_PATH:
+            ret = mcf_get_applied_file_path(req, local_para_ptr);
+            break;
+
+        default:
+            MD_TRC_MCF_TR_L4_GET_CONFIG_UNKNOWN_OP(req->op);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            break;
+    }
+    local_para_ptr->src_id = req->src_id;
+    if (ret == MCF_OTA_R_SUCCESS) {
+        local_para_ptr->result = KAL_TRUE;
+    } else {
+        local_para_ptr->result = KAL_FALSE;
+    }
+
+    /* Send process result to ATCI */
+    msg_send6(MOD_MCF, /* src_mod_id */
+            ilm->src_mod_id, /* dest_mod_id */
+            MCF_SAP, /* sap_id */
+            MSG_ID_L4C_MCF_GET_CONFIG_CNF, /* msg_id */
+            (local_para_struct*)local_para_ptr, /* local_para_ptr */
+            NULL); /* peer_buff_ptr */
+
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_l4_dump_data(ilm_struct *ilm)
+{
+    l4c_mcf_dump_data_req_struct       *req_ptr = (l4c_mcf_dump_data_req_struct *)ilm->local_para_ptr;
+    l4c_mcf_dump_data_cnf_struct       *cnf_ptr = NULL;
+    mcf_l4c_report_state_ind_struct    *ind_ptr = NULL;
+    mcf_ota_result_e                    ret = MCF_OTA_R_SUCCESS;
+    mcf_ota_result_e                    write_ret = MCF_OTA_R_SUCCESS;
+    kal_char                            urc_result[16];
+    kal_uint32                          at_len;
+    kal_int32                           fs_ret = FS_NO_ERROR;
+    kal_wchar                           pathname[MCF_FILE_MAX_MD_PATH_LEN];
+    kal_uint32                          ret_sprintf;
+
+    switch (req_ptr->op)
+    {
+        case L4C_MCF_CONFIG_DUMP_LID_DATA:
+            cnf_ptr = (l4c_mcf_dump_data_cnf_struct *)construct_local_para(sizeof(l4c_mcf_dump_data_cnf_struct), TD_RESET);
+            if (!cnf_ptr) {
+                ASSERT(0);
+                ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                return ret;
+            }
+
+            cnf_ptr->src_id = req_ptr->src_id;
+            cnf_ptr->op = req_ptr->op;
+            cnf_ptr->result = ret;
+
+            msg_send6(MOD_MCF, /* src_mod_id */
+                    ilm->src_mod_id, /* dest_mod_id */
+                    MCF_SAP, /* sap_id */
+                    MSG_ID_L4C_MCF_DUMP_DATA_CNF, /* msg_id */
+                    (local_para_struct*)cnf_ptr, /* local_para_ptr */
+                    NULL); /* peer_buff_ptr */
+            
+            /* Support MCF Tool Open Dump File - delete txt */
+            kal_wsprintf(pathname, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT);
+            fs_ret = FS_Delete(pathname);
+            
+            if(fs_ret != FS_NO_ERROR && fs_ret != FS_FILE_NOT_FOUND){
+                MD_TRC_MCF_TR_L4_DUMP_DATA_DELETE_FILE_FAIL(fs_ret);
+                ret = MCF_OTA_R_WRITE_DISK_FAIL;
+                return ret;
+            }
+            
+            
+            /* Support MCF Tool Open Dump File - Write AT cmd result in txt */
+            kal_mem_set(txt_buff, 0, 64);
+            ret_sprintf = kal_snprintf(txt_buff, 63, "EMCFC=%d,%d%c", req_ptr->op, ret, '\0');
+            if (ret_sprintf < 0 || ret_sprintf > 64){
+                strncpy(txt_buff, "EMCFC unknown error", 63);
+            }
+            MD_TRC_MCF_TR_L4_DUMP_DATA_CMD_RESULT(txt_buff);
+            write_ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT, (kal_uint8 *)txt_buff, strlen(txt_buff));
+            if (write_ret != MCF_OTA_R_SUCCESS) {
+                return write_ret;
+            }
+
+            ret = mcf_dump_all_lid_data(req_ptr);
+            break;
+
+        default:
+            MD_TRC_MCF_TR_L4_DUMP_DATA_UNKNOWN_OP(req_ptr->op);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            return ret;
+    }
+
+    ind_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+    if (!ind_ptr) {
+        ASSERT(0);
+        ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+        return ret;
+    }
+
+    ind_ptr->type = MCF_L4C_REPORT_MCF_DUMP_RESULT;
+    ind_ptr->result = ret;
+
+    msg_send6(MOD_MCF, /* src_mod_id */
+            ilm->src_mod_id, /* dest_mod_id */
+            MCF_SAP, /* sap_id */
+            MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+            (local_para_struct*)ind_ptr, /* local_para_ptr */
+            NULL); /* peer_buff_ptr */
+            
+    /* Support MCF Tool Open Dump File - Write Urc result in txt */
+    kal_mem_set(urc_result,0,16);
+    ret_sprintf = kal_snprintf(urc_result, 15, "%cEMCFRPT=%d,%d%c", '\n', ind_ptr->type, ret, '\0');
+    if (ret_sprintf < 0 || ret_sprintf > 16){
+        strncpy(urc_result, "EMCFRPT error", 15);
+    }
+    at_len = strlen(txt_buff);
+    strncat(txt_buff, urc_result, 15);
+    MD_TRC_MCF_TR_L4_DUMP_DATA_CMD_RESULT(txt_buff);
+    write_ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT, (kal_uint8 *)txt_buff, at_len+strlen(urc_result));
+    if (write_ret != MCF_OTA_R_SUCCESS) {
+        return write_ret;
+    }
+
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_l4_update_ota(ilm_struct *ilm)
+{
+    l4c_mcf_update_ota_file_req_struct  *req = (l4c_mcf_update_ota_file_req_struct *)ilm->local_para_ptr;
+    l4c_mcf_update_ota_file_cnf_struct  *local_para_ptr1 = NULL;
+    mcf_ota_result_e                    ret = MCF_OTA_R_SUCCESS;
+    mcf_l4c_report_state_ind_struct     *ind_ptr = NULL;
+    mcf_t                               *pMcf = mcf_get_instance();
+    module_type                         src_mod_id = ilm->src_mod_id;
+    kal_bool                            reset_MD = KAL_FALSE;
+    
+    
+    
+    
+    
+    switch (req->op)
+    {
+        case L4C_MCF_CONFIG_UPDATE_OPOTA_FILE:
+            
+            /* If DSBP is busy when receive AT cmd, send AT cmd to ask AP retry */
+            if (pMcf->dsbp_cnf_cnt != 0 || pMcf->dsbp_ind_cnt != 0){
+                MD_TRC_MCF_TR_L4_UPDATE_OTA_DSBP_IS_ONGOING(pMcf->dsbp_cnf_cnt);
+                MD_TRC_MCF_TR_L4_UPDATE_OTA_DSBP_IS_ONGOING(pMcf->dsbp_ind_cnt);
+                
+                local_para_ptr1 = (l4c_mcf_update_ota_file_cnf_struct *)construct_local_para(sizeof(l4c_mcf_update_ota_file_cnf_struct), TD_RESET);
+                if (!local_para_ptr1) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                    return ret;
+                }
+                
+                
+                /* Send AT cmd back & send URC to ask AP retry */
+                local_para_ptr1->src_id = req->src_id;
+                local_para_ptr1->op = req->op;
+                local_para_ptr1->mcf_result = MCF_OTA_R_FAIL_MCF_DSBP_ONGOING;
+                
+                
+
+                /* Send process result to ATCI */
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_L4C_MCF_UPDATE_OTA_FILE_CNF, /* msg_id */
+                        (local_para_struct*)local_para_ptr1, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                
+                ind_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+                if (!ind_ptr) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+                    return ret;
+                }
+
+                ind_ptr->type = MCF_L4C_REPORT_UPDATE_FILE_RESULT;
+                ind_ptr->result = MCF_L4C_REPORT_R_AP_RETRY;
+
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                        (local_para_struct*)ind_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                return ret;
+            }
+            
+            
+            MD_TRC_MCF_TR_L4_UPDATE_OPOTA_FILE_UPDATE_OTA();
+            ret = mcf_update_ota_file(req, local_para_ptr1, src_mod_id, &reset_MD);
+            
+            if (ret == MCF_OTA_R_ALLOCATE_BUFFER_FAIL){
+                return ret;
+            }else if(ret == MCF_OTA_R_READ_OTA_FILE_FAIL || ret == MCF_OTA_R_READ_INI_FILE_FAIL){
+                local_para_ptr1 = (l4c_mcf_update_ota_file_cnf_struct *)construct_local_para(sizeof(l4c_mcf_update_ota_file_cnf_struct), TD_RESET);
+                if (!local_para_ptr1) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                    return ret;
+                }
+                
+                
+                local_para_ptr1->src_id = req->src_id;
+                local_para_ptr1->op = req->op;
+                local_para_ptr1->mcf_result = ret;
+                
+                
+
+                /* Send process result to ATCI */
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_L4C_MCF_UPDATE_OTA_FILE_CNF, /* msg_id */
+                        (local_para_struct*)local_para_ptr1, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                
+                ind_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+                if (!ind_ptr) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+                    return ret;
+                }
+
+                ind_ptr->type = MCF_L4C_REPORT_UPDATE_FILE_RESULT;
+                ind_ptr->result = MCF_L4C_REPORT_R_AP_RETRY;
+
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                        (local_para_struct*)ind_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                        
+                return ret;
+            }
+            if(reset_MD == KAL_TRUE){
+                //ret = MCF_OTA_R_SUCCESS;
+
+                local_para_ptr1 = (l4c_mcf_update_ota_file_cnf_struct *)construct_local_para(sizeof(l4c_mcf_update_ota_file_cnf_struct), TD_RESET);
+                if (!local_para_ptr1) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                    return ret;
+                }
+                
+                
+                local_para_ptr1->src_id = req->src_id;
+                local_para_ptr1->op = req->op;
+                local_para_ptr1->mcf_result = ret;
+                
+                
+
+                /* Send process result to ATCI */
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_L4C_MCF_UPDATE_OTA_FILE_CNF, /* msg_id */
+                        (local_para_struct*)local_para_ptr1, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                
+                ind_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+                if (!ind_ptr) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+                    return ret;
+                }
+
+                ind_ptr->type = MCF_L4C_REPORT_UPDATE_FILE_RESULT;
+                ind_ptr->result = MCF_L4C_REPORT_R_RESET_MD;
+
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                        (local_para_struct*)ind_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                        
+                return ret;
+                        
+            }
+            
+            if (pMcf->dsbp_cnf_cnt == 0){
+                local_para_ptr1 = (l4c_mcf_update_ota_file_cnf_struct *)construct_local_para(sizeof(l4c_mcf_update_ota_file_cnf_struct), TD_RESET);
+                if (!local_para_ptr1) {
+                    ASSERT(0);
+                    ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                    return ret;
+                }
+                
+                
+                
+                local_para_ptr1->src_id = req->src_id;
+                local_para_ptr1->op = req->op;
+                local_para_ptr1->mcf_result = ret;
+                
+                
+
+                /* Send process result to ATCI */
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        ilm->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_L4C_MCF_UPDATE_OTA_FILE_CNF, /* msg_id */
+                        (local_para_struct*)local_para_ptr1, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                        
+                if (ret == MCF_OTA_R_SUCCESS){
+                
+                    ind_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+                    if (!ind_ptr) {
+                        ASSERT(0);
+                        ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+                        return ret;
+                    }
+
+                    ind_ptr->type = MCF_L4C_REPORT_UPDATE_FILE_RESULT;
+                    ind_ptr->result = MCF_L4C_REPORT_R_SUCCESS;
+
+                    msg_send6(MOD_MCF, /* src_mod_id */
+                            ilm->src_mod_id, /* dest_mod_id */
+                            MCF_SAP, /* sap_id */
+                            MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                            (local_para_struct*)ind_ptr, /* local_para_ptr */
+                            NULL); /* peer_buff_ptr */
+                }        
+                return ret;
+            }
+            
+            break;
+
+        default:
+            MD_TRC_MCF_TR_L4_UPDATE_OPOTA_FILE_UNKNOWN_OP(req->op);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            break;
+    }
+    
+            
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_l4_config(ilm_struct *ilm)
+{
+    l4c_mcf_config_req_struct  *req = (l4c_mcf_config_req_struct *)ilm->local_para_ptr;
+    l4c_mcf_config_cnf_struct  *local_para_ptr = NULL;
+    mcf_ota_result_e                    ret = MCF_OTA_R_SUCCESS;
+    
+    local_para_ptr = (l4c_mcf_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_cnf_struct), TD_RESET);
+    if (!local_para_ptr) {
+        ASSERT(0);
+        ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+        return ret;
+    }
+    
+    
+
+    switch (req->op)
+    {
+        case L4C_MCF_CONFIG_INI_OPERATION:
+            ret = mcf_config_ini_info(req, local_para_ptr);
+            break;
+
+        default:
+            MD_TRC_MCF_TR_L4_CONFIG_UNKNOWN_OP(req->op);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            break;
+    }
+    
+    
+    local_para_ptr->src_id = req->src_id;
+    local_para_ptr->op = req->op;
+    local_para_ptr->mcf_result = ret;
+    
+
+    /* Send process result to ATCI */
+    msg_send6(MOD_MCF, /* src_mod_id */
+            ilm->src_mod_id, /* dest_mod_id */
+            MCF_SAP, /* sap_id */
+            MSG_ID_L4C_MCF_CONFIG_CNF, /* msg_id */
+            (local_para_struct*)local_para_ptr, /* local_para_ptr */
+            NULL); /* peer_buff_ptr */
+    
+    return ret;
+}
+
+_STATIC mcf_ota_result_e mcf_l4_query_lid(ilm_struct *ilm)
+{
+    l4c_mcf_config_lid_variable_operation_req_struct       *req_ptr = (l4c_mcf_config_lid_variable_operation_req_struct *)ilm->local_para_ptr;
+    l4c_mcf_config_lid_variable_operation_cnf_struct       *cnf_ptr = NULL;
+    mcf_ota_result_e                                        ret = MCF_OTA_R_SUCCESS;
+
+    switch (req_ptr->op)
+    {
+        case L4C_MCF_CONFIG_LID_VARIABLE_OPERATION:
+            cnf_ptr = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+            if (!cnf_ptr) {
+                ASSERT(0);
+                ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                return ret;
+            }
+
+            ret = mcf_config_LID_variable(req_ptr, cnf_ptr);
+            
+            cnf_ptr->src_id = req_ptr->src_id;
+            cnf_ptr->op = req_ptr->op;
+            cnf_ptr->action = req_ptr->action;
+            cnf_ptr->mcf_result = ret;
+
+            msg_send6(MOD_MCF, /* src_mod_id */
+                    ilm->src_mod_id, /* dest_mod_id */
+                    MCF_SAP, /* sap_id */
+                    MSG_ID_L4C_MCF_CONFIG_LID_VARIABLE_OPERATION_CNF, /* msg_id */
+                    (local_para_struct*)cnf_ptr, /* local_para_ptr */
+                    NULL); /* peer_buff_ptr */
+
+            
+            break;
+
+        default:
+            MD_TRC_MCF_TR_L4_QUERY_LID_UNKNOWN_OP(req_ptr->op);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            return ret;
+    }
+
+    return ret;
+}
+_STATIC mcf_ota_result_e mcf_l4_variable_operation(ilm_struct *ilm)
+{
+    l4c_mcf_variable_value_operation_req_struct       *req_ptr = (l4c_mcf_variable_value_operation_req_struct *)ilm->local_para_ptr;
+    l4c_mcf_variable_value_operation_cnf_struct       *cnf_ptr = NULL;
+    mcf_ota_result_e                                   ret = MCF_OTA_R_SUCCESS;
+
+    switch (req_ptr->op)
+    {
+        case L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION:
+            cnf_ptr = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+            if (!cnf_ptr) {
+                ASSERT(0);
+                ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                return ret;
+            }
+			switch (req_ptr->action)
+			{
+				case L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA:
+				case L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA:
+					ret = mcf_query_variable_value(req_ptr, cnf_ptr);
+					break;
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+				case L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA:
+				case L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA:
+					ret = mcf_set_variable_value(req_ptr, cnf_ptr);
+					break;
+#endif
+				default:
+					MD_TRC_MCF_TR_L4_VARIABLE_OPERATION_UNKOWN_ACTION(req_ptr->action);
+					break;
+			}
+            
+            
+            cnf_ptr->src_id = req_ptr->src_id;
+            cnf_ptr->op = req_ptr->op;
+            cnf_ptr->format = req_ptr->format;
+            cnf_ptr->action = req_ptr->action;
+            cnf_ptr->mcf_result = ret;
+
+            msg_send6(MOD_MCF, /* src_mod_id */
+                    ilm->src_mod_id, /* dest_mod_id */
+                    MCF_SAP, /* sap_id */
+                    MSG_ID_L4C_MCF_VARIABLE_VALUE_OPERATION_CNF, /* msg_id */
+                    (local_para_struct*)cnf_ptr, /* local_para_ptr */
+                    NULL); /* peer_buff_ptr */
+
+            
+            break;
+
+        default:
+            MD_TRC_MCF_TR_L4_VARIABLE_OPERATION_UNKNOWN_OP(req_ptr->op);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            return ret;
+    }
+
+    return ret;
+}
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+_STATIC mcf_ota_result_e mcf_l4_assign_combined_file_path(ilm_struct *ilm)
+{
+    l4c_mcf_set_config_req_struct       *req_ptr = (l4c_mcf_set_config_req_struct *)ilm->local_para_ptr;
+    l4c_mcf_set_config_cnf_struct       *cnf_ptr = NULL;
+    mcf_ota_result_e                     ret = MCF_OTA_R_SUCCESS;
+
+    switch (req_ptr->op)
+    {
+        case L4C_MCF_CONFIG_ASSIGN_COMBINED_PATH:
+            cnf_ptr = (l4c_mcf_set_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_set_config_cnf_struct), TD_RESET);
+            if (!cnf_ptr) {
+                ASSERT(0);
+                ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+
+                return ret;
+            }
+
+            ret = mcf_assign_combined_file_path(req_ptr);
+            
+            cnf_ptr->src_id = req_ptr->src_id;
+            cnf_ptr->op = req_ptr->op;
+            cnf_ptr->mcf_result = ret;
+
+            msg_send6(MOD_MCF, /* src_mod_id */
+                    ilm->src_mod_id, /* dest_mod_id */
+                    MCF_SAP, /* sap_id */
+                    MSG_ID_L4C_MCF_ASSIGN_COMBINED_FILE_PATH_CNF, /* msg_id */
+                    (local_para_struct*)cnf_ptr, /* local_para_ptr */
+                    NULL); /* peer_buff_ptr */
+
+            
+            break;
+
+        default:
+            MD_TRC_MCF_TR_L4_ASSIGN_COMBINED_FILE_PATH_UNKNOWN_OP(req_ptr->op);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            return ret;
+    }
+
+    return ret;
+}
+#endif
+_STATIC void mcf_respond_dsbp_result(local_para_struct *local_para_ptr)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+	mcf_l4bsbp_trigger_dsbp_cnf_struct *cnf = (mcf_l4bsbp_trigger_dsbp_cnf_struct *)local_para_ptr;
+    l4c_mcf_set_config_cnf_struct      *cnf_local_para_ptr = NULL;
+    l4c_mcf_update_ota_file_cnf_struct *cnf_update_ota_local_para_ptr = NULL;
+    mcf_l4c_report_state_ind_struct    *ind_ptr = NULL;
+    mcf_ota_result_e                    write_ret = MCF_OTA_R_SUCCESS;
+    mcf_ota_result_e                    mcf_ret = MCF_OTA_R_SUCCESS;
+    kal_uint32                          ret_sprintf;
+	sim_interface_enum                  sim_id = l4c_gemini_get_actual_sim_id(cnf->ps_id);
+    mcf_tlvota_file_t                  *tlvota_file;
+    kal_char                            fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+    kal_char                            apply_filename[MCF_FILE_MAX_NAME_LEN];
+    l4c_mcf_path_type_enum              apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+
+    
+    if (cnf->config_op == L4C_MCF_CONFIG_UPDATE_OPOTA_FILE){
+        pMcf->dsbp_cnf_cnt--;
+        
+        if (cnf->result != MCF_TRIGGER_DSBP_R_SUCCESS && cnf->result != MCF_TRIGGER_DSBP_R_FAIL_NO_SIM){
+                pMcf->dsbp_ind_cnt--;
+                pMcf->dsbp_ind_ret = KAL_FALSE;
+                pMcf->dsbp_cnf_ret = KAL_FALSE;
+        }
+        if (cnf->result == MCF_TRIGGER_DSBP_R_FAIL_NO_SIM){
+            pMcf->dsbp_ind_cnt--;
+            MD_TRC_MCF_TR_RESPOND_DSBP_RESULT_IND_NO_SIM(cnf->ps_id);
+        }
+        
+        if (cnf->is_dsbp_retry == 0){
+            pMcf->is_critical = KAL_TRUE;
+        }
+        
+        
+        /* When critical OTA is fail to trigger DSBP, Send AT cmd response and send URC to reset MD */
+        if (pMcf->dsbp_cnf_cnt == 0)
+        {
+            if (pMcf->is_critical == KAL_TRUE){
+                cnf_update_ota_local_para_ptr = (l4c_mcf_update_ota_file_cnf_struct *)construct_local_para(sizeof(l4c_mcf_update_ota_file_cnf_struct), TD_RESET);
+                if (!cnf_update_ota_local_para_ptr) {
+                    ASSERT(0);
+
+                    return;
+                }
+
+                cnf_update_ota_local_para_ptr->src_id = cnf->src_id;
+                cnf_update_ota_local_para_ptr->op = cnf->config_op;
+                if (pMcf->dsbp_cnf_ret == KAL_TRUE){
+                    cnf_update_ota_local_para_ptr->mcf_result = MCF_OTA_R_SUCCESS;
+                }else{
+                    cnf_update_ota_local_para_ptr->mcf_result = MCF_OTA_R_DSBP_FAIL;
+                }
+                
+                
+                
+                /* Send process result to ATCI */
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        cnf->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_L4C_MCF_UPDATE_OTA_FILE_CNF, /* msg_id */
+                        (local_para_struct*)cnf_update_ota_local_para_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                        
+                
+                
+                MD_TRC_MCF_TR_RESPOND_DSBP_RESULT_IND_CNT(pMcf->dsbp_ind_cnt);
+                if(pMcf->dsbp_ind_cnt == 0 && pMcf->dsbp_cnf_ret == KAL_FALSE){
+                    ind_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+                    if (!ind_ptr) {
+                        ASSERT(0);
+                        return;
+                    }
+                    
+
+                    ind_ptr->type = MCF_L4C_REPORT_UPDATE_FILE_RESULT;
+                    ind_ptr->result = MCF_L4C_REPORT_R_RESET_MD;
+
+                    /* Send process result to ATCI */
+                    msg_send6(MOD_MCF, /* src_mod_id */
+                            cnf->src_mod_id, /* dest_mod_id */
+                            MCF_SAP, /* sap_id */
+                            MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                            (local_para_struct*)ind_ptr, /* local_para_ptr */
+                            NULL); /* peer_buff_ptr */
+                }
+            }else{
+                cnf_update_ota_local_para_ptr = (l4c_mcf_update_ota_file_cnf_struct *)construct_local_para(sizeof(l4c_mcf_update_ota_file_cnf_struct), TD_RESET);
+                if (!cnf_update_ota_local_para_ptr) {
+                    ASSERT(0);
+
+                    return;
+                }
+
+                cnf_update_ota_local_para_ptr->src_id = cnf->src_id;
+                cnf_update_ota_local_para_ptr->op = cnf->config_op;
+                if (pMcf->dsbp_cnf_ret == KAL_TRUE){
+                    cnf_update_ota_local_para_ptr->mcf_result = MCF_OTA_R_SUCCESS;
+                }else{
+                    cnf_update_ota_local_para_ptr->mcf_result = MCF_OTA_R_DSBP_FAIL;
+                }
+
+                /* Send process result to ATCI */
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        cnf->src_mod_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_L4C_MCF_UPDATE_OTA_FILE_CNF, /* msg_id */
+                        (local_para_struct*)cnf_update_ota_local_para_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                if(pMcf->dsbp_ind_cnt == 0 && pMcf->dsbp_ind_ret == KAL_FALSE){
+                    ind_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+                    if (!ind_ptr) {
+                        ASSERT(0);
+
+                        return;
+                    }
+
+                    ind_ptr->type = MCF_L4C_REPORT_UPDATE_FILE_RESULT;
+                    ind_ptr->result = MCF_L4C_REPORT_R_AP_RETRY;
+
+                    /* Send process result to ATCI */
+                    msg_send6(MOD_MCF, /* src_mod_id */
+                            cnf->src_mod_id, /* dest_mod_id */
+                            MCF_SAP, /* sap_id */
+                            MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                            (local_para_struct*)ind_ptr, /* local_para_ptr */
+                            NULL); /* peer_buff_ptr */
+                }
+            }
+            
+        }
+    }else{
+		
+		if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+            MD_TRC_MCF_TR_RESPOND_DSBP_INVALID_SIM_ID(cnf->ps_id, sim_id);
+            mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+            goto out;
+        }
+        
+        tlvota_file = &(pMcf->tlvota_file[sim_id]);
+        
+        if (cnf->result != MCF_TRIGGER_DSBP_R_SUCCESS) {
+			/* Read last updated file */
+			if (tlvota_file->last_file.path_type == L4C_MCF_PATH_TYPE_OTA) {
+				strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			} else if (tlvota_file->last_file.path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+				strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+			} else {
+				MD_TRC_MCF_TR_RESPOND_DSBP_INVALID_FILE_PATH(cnf->result, tlvota_file->last_file.path_type);
+				pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+				mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+				goto out;
+			}
+
+			mcf_ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, fs_root_path, tlvota_file->last_file.name, &apply_path_type, apply_filename, pMcf);
+
+			if (mcf_ret != MCF_OTA_R_SUCCESS) {
+				MD_TRC_MCF_TR_RESPOND_DSBP_READ_FILE_FAIL(cnf->result, mcf_ret);
+			}
+
+			pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+		}
+
+out:
+        if(pMcf->dsbp_cnf_cnt > 0){
+            pMcf->dsbp_cnf_cnt--;
+        }
+        
+        if (cnf->result != MCF_TRIGGER_DSBP_R_SUCCESS && cnf->result != MCF_TRIGGER_DSBP_R_FAIL_NO_SIM){
+            if(pMcf->dsbp_ind_cnt > 0){
+                pMcf->dsbp_ind_cnt--;
+            }
+            pMcf->dsbp_ind_ret = KAL_FALSE;
+            pMcf->dsbp_cnf_ret = KAL_FALSE;
+            dsbp_ret = cnf->result;
+        }
+        if (cnf->result == MCF_TRIGGER_DSBP_R_FAIL_NO_SIM){
+            if(pMcf->dsbp_ind_cnt > 0){
+                pMcf->dsbp_ind_cnt--;
+            }
+            MD_TRC_MCF_TR_RESPOND_DSBP_RESULT_IND_NO_SIM(cnf->ps_id);
+        }
+        
+        if (pMcf->dsbp_cnf_cnt == 0)
+        {
+            cnf_local_para_ptr = (l4c_mcf_set_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_set_config_cnf_struct), TD_RESET);
+            if (!cnf_local_para_ptr) {
+                ASSERT(0);
+
+                return;
+            }
+
+            if (pMcf->dsbp_cnf_ret != KAL_TRUE){
+                mcf_ret = MCF_OTA_R_DSBP_FAIL;
+            }
+            
+            cnf_local_para_ptr->src_id = cnf->src_id;
+            cnf_local_para_ptr->op = cnf->config_op;
+            cnf_local_para_ptr->mcf_result = mcf_ret;
+            cnf_local_para_ptr->dsbp_result = dsbp_ret;
+
+
+            /* Send process result to ATCI */
+            msg_send6(MOD_MCF, /* src_mod_id */
+                    cnf->src_mod_id, /* dest_mod_id */
+                    MCF_SAP, /* sap_id */
+                    MSG_ID_L4C_MCF_SET_CONFIG_CNF, /* msg_id */
+                    (local_para_struct*)cnf_local_para_ptr, /* local_para_ptr */
+                    NULL); /* peer_buff_ptr */
+                    
+            /* Support MCF Tool Send AT cmd - clear txt */
+            kal_mem_set(txt_buff, 0, 64);
+            write_ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT, (kal_uint8 *)txt_buff, 0);
+            if (write_ret != MCF_OTA_R_SUCCESS) {
+                return;
+            }
+            
+            /* Support MCF Tool Send AT cmd - Write AT cmd result in txt */
+            ret_sprintf = kal_sprintf(txt_buff, "EMCFC=%d,%d,%d%c", cnf->config_op, mcf_ret, dsbp_ret, '\0');
+            if (ret_sprintf < 0 || ret_sprintf > 64){
+                strncpy(txt_buff, "EMCFC unknown error", 63);
+            }
+            MD_TRC_MCF_TR_RESPOND_DSBP_CMD_RESULT(txt_buff);
+            write_ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT, (kal_uint8 *)txt_buff, strlen(txt_buff));
+            if (write_ret != MCF_OTA_R_SUCCESS) {
+                return;
+            }
+        }
+    }
+    return;
+}
+
+_STATIC kal_bool mcf_report_dsbp_result(local_para_struct *local_para_ptr)
+{
+    mcf_t                                        *pMcf = mcf_get_instance();
+	mcf_l4bsbp_trigger_dsbp_result_ind_struct    *ind = (mcf_l4bsbp_trigger_dsbp_result_ind_struct *)local_para_ptr;
+    kal_bool                                     ret = KAL_TRUE;
+    kal_char                                     urc_result[16];
+    kal_uint32                                   at_len;
+    kal_uint32                                   ret_sprintf;
+
+    switch (ind->config_op)
+    {
+        case L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE:
+        {
+            mcf_l4c_report_state_ind_struct            *ind_local_para_ptr = NULL;
+			sim_interface_enum                          sim_id = l4c_gemini_get_actual_sim_id(ind->ps_id);
+            mcf_tlvota_file_t                          *tlvota_file;
+            kal_char                                    fs_root_path[MCF_FILE_MAX_MD_PATH_LEN];
+            kal_char                                    apply_filename[MCF_FILE_MAX_NAME_LEN];
+            l4c_mcf_path_type_enum                      apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+            mcf_ota_result_e                            mcf_ret = MCF_OTA_R_SUCCESS;
+			
+			if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+                MD_TRC_MCF_TR_REPORT_STATE_INVALID_SIM_ID(ind->ps_id, sim_id);
+                mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+                goto out;
+            }
+            
+            tlvota_file = &(pMcf->tlvota_file[sim_id]);
+            
+            if (ind->result == MCF_TRIGGER_DSBP_R_SUCCESS) {
+                /* Store last updated file informantion */
+                kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+            } else {
+                /* Read last updated file */
+                if (tlvota_file->last_file.path_type == L4C_MCF_PATH_TYPE_OTA) {
+                    strncpy(fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                } else if (tlvota_file->last_file.path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                    strncpy(fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+                } else {
+                    MD_TRC_MCF_TR_REPORT_STATE_INVALID_FILE_PATH(ind->result, tlvota_file->last_file.path_type);
+                    mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+
+                    goto out;
+                }
+
+                /* Read last updated file */
+                mcf_ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, fs_root_path, tlvota_file->last_file.name, &apply_path_type, apply_filename, pMcf);
+
+                if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                    MD_TRC_MCF_TR_REPORT_STATE_READ_FILE_FAIL(ind->result, mcf_ret);
+                }
+            }
+
+out:
+            if (sim_id >= 0 && sim_id < MAX_SIM_NUM){
+                pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+            }
+
+            ind_local_para_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+            if (!ind_local_para_ptr) {
+                ASSERT(0);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+
+            ind_local_para_ptr->type = MCF_L4C_REPORT_DSBP_RESULT_OF_MCF_DSBP_ACTIVE_MODE;
+            ind_local_para_ptr->result = ind->result;
+
+            /* Send process result to ATCI */
+            msg_send6(MOD_MCF, /* src_mod_id */
+                    MOD_L4C + ind->ps_id, /* dest_mod_id */
+                    MCF_SAP, /* sap_id */
+                    MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                    (local_para_struct*)ind_local_para_ptr, /* local_para_ptr */
+                    NULL); /* peer_buff_ptr */
+                    
+            /* Support MCF Tool Send AT cmd - Write Urc result in txt */
+            kal_mem_set(urc_result,0,16);
+            ret_sprintf = kal_snprintf(urc_result, 15, "%cEMCFRPT=%d,%d%c", '\n', MCF_L4C_REPORT_DSBP_RESULT_OF_MCF_DSBP_ACTIVE_MODE, ind->result, '\0');
+            if (ret_sprintf < 0 || ret_sprintf > 16){
+                strncpy(urc_result, "EMCFRPT error", 15);
+            }
+            at_len = strlen(txt_buff);
+            strncat(txt_buff, urc_result, 15);
+            MD_TRC_MCF_TR_REPORT_STATE_CMD_RESULT(txt_buff);
+            ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT, (kal_uint8 *)txt_buff, at_len+strlen(urc_result));
+            if (ret != KAL_TRUE) {
+                return ret;
+            }
+
+
+            break;
+        }
+
+        case L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN:
+        {
+            mcf_l4c_report_state_ind_struct            *ind_local_para_ptr = NULL;
+
+            if (pMcf->dsbp_ind_cnt > 0){
+                pMcf->dsbp_ind_cnt --;
+            }
+            
+            if (ind->result != MCF_TRIGGER_DSBP_R_SUCCESS){
+                pMcf->dsbp_ind_ret = KAL_FALSE;
+            }
+            
+            
+            if(pMcf->dsbp_ind_cnt == 0){
+            
+                ind_local_para_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+                if (!ind_local_para_ptr) {
+                    ASSERT(0);
+                    ret = KAL_FALSE;
+
+                    return ret;
+                }
+
+                ind_local_para_ptr->type = MCF_L4C_REPORT_MCF_DUMP_RESULT_OF_AUTO_SELECT_BIN;
+                ind_local_para_ptr->result = ind->result;
+
+                /* Send process result to ATCI */
+                msg_send6(MOD_MCF, /* src_mod_id */
+                        MOD_L4C + ind->ps_id, /* dest_mod_id */
+                        MCF_SAP, /* sap_id */
+                        MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                        (local_para_struct*)ind_local_para_ptr, /* local_para_ptr */
+                        NULL); /* peer_buff_ptr */
+                        
+                /* Support MCF Tool Send AT cmd - Write Urc result in txt */
+                kal_mem_set(urc_result,0,16);
+                ret_sprintf = kal_snprintf(urc_result, 15, "%cEMCFRPT=%d,%d%c", '\n', MCF_L4C_REPORT_MCF_DUMP_RESULT_OF_AUTO_SELECT_BIN, ind->result, '\0');
+                if (ret_sprintf < 0 || ret_sprintf > 16){
+                    strncpy(urc_result, "EMCFRPT error", 15);
+                }
+                at_len = strlen(txt_buff);
+                strncat(txt_buff, urc_result, 15);
+                MD_TRC_MCF_TR_REPORT_STATE_CMD_RESULT(txt_buff);
+                ret = mcf_write_buffer(MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_AT_CMD_RESULT, (kal_uint8 *)txt_buff, at_len+strlen(urc_result));
+                if (ret != KAL_TRUE) {
+                    return ret;
+                }
+            }
+
+            break;
+        }
+        case L4C_MCF_CONFIG_UPDATE_OPOTA_FILE:
+        {
+            mcf_l4c_report_state_ind_struct            *ind_local_para_ptr = NULL;
+            mcf_t                                      *pMcf = mcf_get_instance();
+            
+            pMcf->dsbp_ind_cnt --;
+            
+            if (ind->result != MCF_TRIGGER_DSBP_R_SUCCESS){
+                pMcf->dsbp_ind_ret = KAL_FALSE;
+            }
+            
+            
+            if(pMcf->dsbp_ind_cnt == 0){
+                if (pMcf->is_critical == KAL_TRUE){
+                    pMcf->is_critical = KAL_FALSE;
+                    ind_local_para_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+                    if (!ind_local_para_ptr) {
+                        ASSERT(0);
+                        ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+                        return ret;
+                    }
+                    
+
+                    ind_local_para_ptr->type = MCF_L4C_REPORT_UPDATE_FILE_RESULT;
+                    
+                    if (pMcf->dsbp_ind_ret == KAL_TRUE){
+                        ind_local_para_ptr->result = MCF_L4C_REPORT_R_SUCCESS;
+                    }else{
+                        ind_local_para_ptr->result = MCF_L4C_REPORT_R_RESET_MD;
+                    }
+                    /* Send process result to ATCI */
+                    msg_send6(MOD_MCF, /* src_mod_id */
+                            ind->src_mod_id, /* dest_mod_id */
+                            MCF_SAP, /* sap_id */
+                            MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                            (local_para_struct*)ind_local_para_ptr, /* local_para_ptr */
+                            NULL); /* peer_buff_ptr */
+                }else{
+                    ind_local_para_ptr = (mcf_l4c_report_state_ind_struct *)construct_local_para(sizeof(mcf_l4c_report_state_ind_struct), TD_RESET);
+                    if (!ind_local_para_ptr) {
+                        ASSERT(0);
+                        ret = MCF_OTA_R_ALLOCATE_BUFFER_FAIL;
+                        return ret;
+                    }
+
+                    ind_local_para_ptr->type = MCF_L4C_REPORT_UPDATE_FILE_RESULT;
+                    
+                    if (pMcf->dsbp_ind_ret == KAL_TRUE){
+                        ind_local_para_ptr->result = MCF_L4C_REPORT_R_SUCCESS;
+                    }else{
+                        ind_local_para_ptr->result = MCF_L4C_REPORT_R_AP_RETRY;
+                    }
+                
+
+                    /* Send process result to ATCI */
+                    msg_send6(MOD_MCF, /* src_mod_id */
+                            ind->src_mod_id, /* dest_mod_id */
+                            MCF_SAP, /* sap_id */
+                            MSG_ID_MCF_L4C_REPORT_STATE_IND, /* msg_id */
+                            (local_para_struct*)ind_local_para_ptr, /* local_para_ptr */
+                            NULL); /* peer_buff_ptr */
+                }
+            }
+            
+            
+            break;
+        }
+
+        default:
+            MD_TRC_MCF_TR_REPORT_STATE_INVALID_OP(ind->config_op);
+            ret = KAL_FALSE;
+            break;
+    }
+
+    return ret;
+}
+
+_STATIC kal_bool mcf_em_update_req_hdlr(local_para_struct *local_para_ptr)
+{
+    l4cps_em_update_req_struct *req = (l4cps_em_update_req_struct *)local_para_ptr;
+    kal_bool                    ret = KAL_TRUE;
+
+    /*
+     * Only process Tool source, ignore AP.
+     */
+    if (req->em_src == EM_FROM_ELT) {
+        switch (req->info_request[MCF_EM_OTA_FILE_INFO]) {
+            case EM_ON:
+                com_Mcf.is_em_on = KAL_TRUE;
+                break;
+
+            case EM_OFF:
+                com_Mcf.is_em_on = KAL_FALSE;
+                break;
+
+            case EM_NC:
+                /* No change */
+                break;
+
+            default:
+                ret = KAL_FALSE;
+                MD_TRC_MCF_TR_EM_UPDATE_INVALID_INFO(req->info_request[MCF_EM_OTA_FILE_INFO]);
+                break;
+        }
+    } else {
+        ret = KAL_FALSE;
+        MD_TRC_MCF_TR_EM_UPDATE_INVALID_SOURCE(req->em_src);
+    }
+
+    return ret;
+}
+
+_STATIC void mcf_v1_do_ota_full(mcf_ota_file_t *ota_file)
+{
+    mcf_tool_file_info_t                   *pFile;
+    mcf_tool_ota_file_item_t               *pItem;
+    kal_uint16                              item_cnt = 0;
+    nvram_errno_enum                        nvram_api_ret;
+    kal_bool                                is_read_nvram = KAL_FALSE;
+    nvram_ltable_entry_struct               lid_info = {0};
+    kal_uint8                              *lid_buffer = NULL;
+    nvram_ltable_entry_struct               pre_lid_info = {0};
+    kal_uint16                              pre_record_idx = 0xFFFF;
+    kal_uint8                              *pre_lid_buffer = NULL;
+    kal_uint16                              item_byte_offset;
+    kal_uint16                              item_bit_offset;
+    kal_char                                item_tag[MCF_FILE_MAX_TAG_LEN] = {0};
+    kal_uint32                              item_size;
+    kal_int16                               pos = -1;
+    kal_uint16                              in_pos = 0;
+    mcf_tag_info_struct                     unuse = {0};
+    MCF_DB_STRUCT_VARIABLE                  const *unuse_db_ptr = NULL;
+    
+    pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    pItem = (mcf_tool_ota_file_item_t *)(ota_file->buff + pFile->total_len);
+
+    /* Read changed items from OTA file */
+    while (item_cnt < pFile->item_num) {
+        if ( (is_read_nvram == KAL_FALSE) || (pItem->lid != pre_lid_info.LID) || (pItem->record_idx != pre_record_idx) ) {
+            nvram_api_ret = nvram_external_get_lid_info(pItem->lid, &lid_info);
+            if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_GET_LID_INFO_FAIL, pItem->lid, nvram_api_ret);
+                mcf_utfwk_printf("Fail to get LID information!! lid(%d), nvram_ret(%d)", pItem->lid, nvram_api_ret);
+                goto next;
+            }
+
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+            /* Store last time modified LID */
+            if ( (pItem->lid != pre_lid_info.LID) && ((lid_info.attr & NVRAM_ATTR_OTA_RESET) != 0)
+                    && (((lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) || ((lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0)) ) {
+                if (nv_int_info.last_mod_lid.lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+                    pos = mcf_binary_search_lid(pItem->lid, nv_int_info.last_mod_lid.lid, nv_int_info.last_mod_lid.lid_cnt, &in_pos);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_SEARCH_STORE_LID, pItem->lid, pos);
+                    if (pos == -1) {
+                        if(mcf_insert_lid(pItem->lid, nv_int_info.last_mod_lid.lid, nv_int_info.last_mod_lid.lid_cnt, in_pos) != KAL_TRUE){
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID_FAIL, pItem->lid);
+                            mcf_utfwk_printf("Save Last modified LID fail!!! LID buffer is full(%d)", pItem->lid);
+                        }else{
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID, pItem->lid, in_pos);
+                        }
+                        nv_int_info.last_mod_lid.lid_cnt++;
+                    }
+                }
+            }
+#else
+		/* Store last time modified LID */
+            if ( (pItem->lid != pre_lid_info.LID) && ((lid_info.attr & NVRAM_ATTR_OTA_RESET) != 0)
+                    && (((lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) || ((lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0)) ) {
+				if (nv_int_info.last_mod_lid.lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+					pos = mcf_binary_search_lid_struct(pItem->lid, nv_int_info.last_mod_lid.lid_conf, nv_int_info.last_mod_lid.lid_cnt, &in_pos);
+					MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_SEARCH_STORE_LID, pItem->lid, pos);
+					if (pos == -1) {
+						if(mcf_insert_lid_struct(pItem->lid, nv_int_info.last_mod_lid.lid_conf, nv_int_info.last_mod_lid.lid_cnt, in_pos, nv_int_info.not_reset_ota, KAL_FALSE) != KAL_TRUE){
+							MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID_FAIL, pItem->lid);
+							mcf_utfwk_printf("Save Last modified LID fail!!! LID buffer is full(%d)", pItem->lid);
+						}else{
+							MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID, pItem->lid, in_pos);
+						}
+						nv_int_info.last_mod_lid.lid_cnt++;
+					}
+				}
+            }
+#endif
+
+            /* Do not update LID if OTA attribute is not set */
+            if ( (lid_info.attr & NVRAM_ATTR_MCF_OTA) == 0 ) {
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR, lid_info.LID, lid_info.attr);
+                mcf_utfwk_printf("OTA attribute is not set, do not write to NVRAM. lid(%d), attribute(%x)", lid_info.LID, lid_info.attr);
+                /* Write previous LID record */
+                if (is_read_nvram == KAL_TRUE && (pItem->lid != pre_lid_info.LID)) {
+                    if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0 ) {
+                        if ( !nvram_external_write_data(pre_lid_info.LID, pre_record_idx, pre_lid_buffer, pre_lid_info.size) ) {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_FAIL, pre_lid_info.LID, pre_record_idx);
+                            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_WRITE_ITEM_LID_FAIL;
+                            mcf_utfwk_printf("Fail to write item LID(%d), record(%d)\r\n", pre_lid_info.LID, pre_record_idx);
+                        } else {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_SUCCESS, pre_lid_info.LID, pre_record_idx);
+                        }
+                    } else if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0 ) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_QUERY_ATTR_SET, pre_lid_info.LID, pre_lid_info.attr);
+                    } else if ( ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) && ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0) ) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR2, pre_lid_info.LID, pre_lid_info.attr);
+                        mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are set! lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+                    } else {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR3, pre_lid_info.LID, pre_lid_info.attr);
+                        mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are not set! lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+                    }
+                    mcf_utfwk_printf("OTA query attribute is set, do not write to NVRAM. lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+
+                    free_ctrl_buffer_set_null(pre_lid_buffer);
+                }
+                
+                is_read_nvram = KAL_FALSE;
+                goto next;
+            }
+
+            /* Write previous LID record */
+            if (is_read_nvram == KAL_TRUE) {
+                if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0 ) {
+                    if ( !nvram_external_write_data(pre_lid_info.LID, pre_record_idx, pre_lid_buffer, pre_lid_info.size) ) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_FAIL, pre_lid_info.LID, pre_record_idx);
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_WRITE_ITEM_LID_FAIL;
+                        mcf_utfwk_printf("Fail to write item LID(%d), record(%d)", pre_lid_info.LID, pre_record_idx);
+                    } else {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_SUCCESS, pre_lid_info.LID, pre_record_idx);
+                    }
+                } else if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0 ) {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_QUERY_ATTR_SET, pre_lid_info.LID, pre_lid_info.attr);
+                } else if ( ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) && ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0) ) {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR2, pre_lid_info.LID, pre_lid_info.attr);
+                    mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are set! lid(%d), attribute(%x)", pre_lid_info.LID, pre_lid_info.attr);
+                } else {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR3, pre_lid_info.LID, pre_lid_info.attr);
+                    mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are not set! lid(%d), attribute(%x)", pre_lid_info.LID, pre_lid_info.attr);
+                }
+
+                free_ctrl_buffer_set_null(pre_lid_buffer);
+                is_read_nvram = KAL_FALSE;
+            }
+
+            /* Do not reset LID if same with previos one */
+            if (pItem->lid != pre_lid_info.LID) {
+                if ( (lid_info.attr & NVRAM_ATTR_OTA_RESET) != 0 ) {
+                    if ( !nvram_external_reset_data(pItem->lid, 1, lid_info.total_records) ) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_RESET_LID_FAIL, pItem->lid, lid_info.total_records);
+                        mcf_utfwk_printf("Reset LID(%d) FAIL!!, total_record(%d)", pItem->lid, lid_info.total_records);
+                    }
+                } else {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_RESET_ATTR_NOT_SET, lid_info.LID, lid_info.attr);
+                    mcf_utfwk_printf("OTA reset attribute is not set!! lid(%d), attribute(%x)", lid_info.LID, lid_info.attr);
+                }
+            }
+
+            lid_buffer = (kal_uint8 *)get_ctrl_buffer(lid_info.size);
+
+            /* Read NVRAM LID */
+            if ( !nvram_external_read_data(pItem->lid, pItem->record_idx, lid_buffer, lid_info.size) ) {
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_ITEM_LID_FAIL, pItem->lid, pItem->record_idx);
+                mcf_utfwk_printf("Fail to read item LID(%d), record(%d)", pItem->lid, pItem->record_idx);
+                is_read_nvram = KAL_FALSE;
+                free_ctrl_buffer_set_null(lid_buffer);
+
+                goto next;
+            } else {
+                is_read_nvram = KAL_TRUE;
+            }
+        }
+
+        /* Check if item_tag_len is valid */
+        if ( (pItem->item_tag_len <= 0) || (pItem->item_tag_len >= MCF_FILE_MAX_TAG_LEN-1) ) {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_TAG_LEN, pItem->item_tag_len, MCF_FILE_MAX_TAG_LEN);
+            mcf_utfwk_printf("Invalid item_tag_len(%d)!! max item_tag_len(%d)", pItem->item_tag_len, MCF_FILE_MAX_TAG_LEN);
+
+            goto next;
+        }
+
+        /* Update LID item */
+        if (pItem->is_bit_op == 0) {
+            strncpy(item_tag, &(pItem->buff_start), pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_ITEM_TAG, item_tag);
+            if (mcf_find_tag_offset(pItem->lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if (pItem->op.byte.value_len > item_size) {
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_LARGE_VAL_LEN, pItem->op.byte.value_len, item_size);
+                mcf_utfwk_printf("Invalid value len(%d)!! larger than current item len(%d)", pItem->op.byte.value_len, item_size);
+                goto next;
+            }
+
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_BYTE_UPDATE, pItem->lid, item_byte_offset, pItem->op.byte.value_len);
+            mcf_dump_data(KAL_TRUE, &(pItem->buff_start) + pItem->item_tag_len, pItem->op.byte.value_len);
+
+            kal_mem_cpy( (lid_buffer + item_byte_offset), &(pItem->buff_start) + pItem->item_tag_len, pItem->op.byte.value_len);
+        } else {
+            kal_uint32 bit_value = 0;
+            kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(pItem->op.bit.len);
+
+            kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->item_tag_len, pItem->op.bit.value_len);
+
+            strncpy(item_tag, &(pItem->buff_start), pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_ITEM_TAG, item_tag);
+            if (mcf_find_tag_offset(pItem->lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if ( (pItem->op.bit.value_len > 4) || (pItem->op.bit.len > item_size) ) {
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_BIT_LEN, pItem->op.bit.len, item_size, pItem->op.bit.value_len);
+                mcf_utfwk_printf("Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)", pItem->op.bit.len, item_size, pItem->op.bit.value_len);
+                goto next;
+            }
+
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_BIT_UPDATE, pItem->lid, item_byte_offset, item_bit_offset, pItem->op.bit.len, bit_value);
+
+            if (pItem->op.bit.value_len == 1) {
+                kal_uint8 *val_tmp = (kal_uint8 *)(lid_buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 2) {
+                kal_uint16 *val_tmp = (kal_uint16 *)(lid_buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 4) {
+                kal_uint32 *val_tmp = (kal_uint32 *)(lid_buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            }
+        }
+
+
+next:
+        pre_lid_info = lid_info;
+        pre_record_idx = pItem->record_idx;
+        pre_lid_buffer = lid_buffer;
+        pItem = (mcf_tool_ota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+        item_cnt++;
+    }
+    
+    if (item_cnt > 0) {
+        /* Write previous LID record */
+        if (is_read_nvram == KAL_TRUE) {
+            if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0 ) {
+                if ( !nvram_external_write_data(pre_lid_info.LID, pre_record_idx, pre_lid_buffer, pre_lid_info.size) ) {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_FAIL, pre_lid_info.LID, pre_record_idx);
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_WRITE_ITEM_LID_FAIL;
+                    mcf_utfwk_printf("Fail to write item LID(%d), record(%d)", pre_lid_info.LID, pre_record_idx);
+                } else {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_SUCCESS, pre_lid_info.LID, pre_record_idx);
+                }
+            } else if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0 ) {
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_QUERY_ATTR_SET, pre_lid_info.LID, pre_lid_info.attr);
+            } else if ( ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) && ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0) ) {
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR2, pre_lid_info.LID, pre_lid_info.attr);
+                mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are set! lid(%d), attribute(%x)", pre_lid_info.LID, pre_lid_info.attr);
+            } else {
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR3, pre_lid_info.LID, pre_lid_info.attr);
+                mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are not set! lid(%d), attribute(%x)", pre_lid_info.LID, pre_lid_info.attr);
+            }
+            free_ctrl_buffer_set_null(pre_lid_buffer);
+
+        }
+    }
+
+    
+    return;
+}
+_STATIC mcf_ota_result_e mcf_v1_do_ota_by_lid(mcf_ota_file_t *ota_file, nvram_lid_enum lid, kal_uint16 record_idx, kal_uint16 record_amount, nvram_ltable_entry_struct *lid_info)
+{
+    mcf_ota_result_e            ret = MCF_OTA_R_SUCCESS;
+    mcf_tool_file_info_t       *pFile;
+    mcf_tool_ota_file_item_t   *pItem;
+    kal_bool                    is_read_nvram = KAL_FALSE;
+    kal_uint16                  pre_record_idx = 0xFFFF;
+    kal_bool                    is_found_target = KAL_FALSE;
+    kal_uint8                  *pre_lid_buffer = NULL;
+    kal_uint8                  *lid_buffer = NULL;
+    kal_uint16                  item_cnt = 0;
+    kal_char                    item_tag[MCF_FILE_MAX_TAG_LEN] = {0};
+    kal_uint16                  item_byte_offset;
+    kal_uint16                  item_bit_offset;
+    kal_uint32                  item_size;
+    mcf_tag_info_struct         unuse = {0};
+    MCF_DB_STRUCT_VARIABLE      const *unuse_db_ptr = NULL;
+    
+    
+    pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    pItem = (mcf_tool_ota_file_item_t *)(ota_file->buff + pFile->total_len);
+    /* Read changed items from OTA file */
+    while (item_cnt < pFile->item_num) {
+        if ( (pItem->lid != lid) || (pItem->record_idx < record_idx) || (pItem->record_idx > (record_idx + record_amount - 1)) ) {
+            if (is_found_target == KAL_FALSE) {
+                goto next;
+            } else {
+                // Item in file has been sorted. If target has been found, stop searching while next item is not the one we are searching
+                break;
+            }
+        }
+
+        if ( (is_read_nvram == KAL_FALSE) || (pItem->record_idx != pre_record_idx) ) {
+            is_found_target = KAL_TRUE;
+
+            /* Write previous LID record */
+            if (is_read_nvram == KAL_TRUE) {
+                if ( !nvram_external_write_data(lid, pre_record_idx, pre_lid_buffer, lid_info->size) ) {
+                    MD_TRC_MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_FAIL(lid, pre_record_idx);
+                } else {
+                    MD_TRC_MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_SUCCESS(lid, pre_record_idx);
+                }
+
+                free_ctrl_buffer_set_null(pre_lid_buffer);
+                is_read_nvram = KAL_FALSE;
+            }
+
+            lid_buffer = (kal_uint8 *)get_ctrl_buffer(lid_info->size);
+
+            /* Read NVRAM LID */
+            if ( !nvram_external_read_data(pItem->lid, pItem->record_idx, lid_buffer, lid_info->size) ) {
+                MD_TRC_MCF_TR_LID_OTA_READ_ITEM_NVRAM_FAIL(lid, pItem->record_idx);
+                is_read_nvram = KAL_FALSE;
+                free_ctrl_buffer_set_null(lid_buffer);
+
+                goto next;
+            } else {
+                is_read_nvram = KAL_TRUE;
+            }
+        }
+
+        /* Check if item_tag_len is valid */
+        if ( (pItem->item_tag_len <= 0) || (pItem->item_tag_len >= MCF_FILE_MAX_TAG_LEN-1) ) {
+            MD_TRC_MCF_TR_LID_OTA_INVALID_TAG_LEN(pItem->item_tag_len, MCF_FILE_MAX_TAG_LEN);
+            goto next;
+        }
+
+        /* Update LID item */
+        if (pItem->is_bit_op == 0) {
+            strncpy(item_tag, &(pItem->buff_start), pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            if (mcf_find_tag_offset(lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if (pItem->op.byte.value_len > item_size) {
+                MD_TRC_MCF_TR_LID_OTA_LARGE_VAL_LEN(pItem->op.byte.value_len, item_size);
+                goto next;
+            }
+
+            MD_TRC_MCF_TR_LID_OTA_BYTE_UPDATE(lid, item_byte_offset, pItem->op.byte.value_len);
+            mcf_dump_data(KAL_FALSE, &(pItem->buff_start) + pItem->item_tag_len, pItem->op.byte.value_len);
+
+            kal_mem_cpy( (lid_buffer + item_byte_offset), &(pItem->buff_start) + pItem->item_tag_len, pItem->op.byte.value_len);
+        } else {
+            kal_uint32 bit_value = 0;
+            kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(pItem->op.bit.len);
+
+            kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->item_tag_len, pItem->op.bit.value_len);
+
+            strncpy(item_tag, &(pItem->buff_start), pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            if (mcf_find_tag_offset(lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if ( (pItem->op.bit.value_len > 4) || (pItem->op.bit.len > item_size) ) {
+                MD_TRC_MCF_TR_LID_OTA_INVALID_BIT_LEN(pItem->op.bit.len, item_size, pItem->op.bit.value_len);
+
+                goto next;
+            }
+
+            MD_TRC_MCF_TR_LID_OTA_BIT_UPDATE(lid, item_byte_offset, item_bit_offset, pItem->op.bit.len, bit_value);
+
+            if (pItem->op.bit.value_len == 1) {
+                kal_uint8 *val_tmp = (kal_uint8 *)(lid_buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 2) {
+                kal_uint16 *val_tmp = (kal_uint16 *)(lid_buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 4) {
+                kal_uint32 *val_tmp = (kal_uint32 *)(lid_buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            }
+        }
+
+next:
+        pre_record_idx = pItem->record_idx;
+        pre_lid_buffer = lid_buffer;
+        pItem = (mcf_tool_ota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+        item_cnt++;
+    }
+    if (item_cnt > 0) {
+        /* Write previous LID record */
+        if (is_read_nvram == KAL_TRUE) {
+            if ( !nvram_external_write_data(lid, pre_record_idx, pre_lid_buffer, lid_info->size) ) {
+                MD_TRC_MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_FAIL(lid, pre_record_idx);
+                ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+            } else {
+                MD_TRC_MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_SUCCESS(lid, pre_record_idx);
+            }
+
+            free_ctrl_buffer_set_null(pre_lid_buffer);
+        }
+    }
+    MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    
+    return ret;
+}
+_STATIC void mcf_v1_read_ota_buffer(mcf_ota_file_t *ota_file, nvram_lid_enum lid, kal_uint16 record_idx, kal_uint8 *buffer)
+{
+    mcf_tool_file_info_t       *pFile;
+    mcf_tool_ota_file_item_t   *pItem;
+    kal_uint16                  item_cnt = 0;
+    kal_bool                    is_found_target = KAL_FALSE;
+    kal_char                    item_tag[MCF_FILE_MAX_TAG_LEN] = {0};
+    kal_uint16                  item_byte_offset;
+    kal_uint16                  item_bit_offset;
+    kal_uint32                  item_size;
+    mcf_tag_info_struct         unuse = {0};
+    MCF_DB_STRUCT_VARIABLE      const *unuse_db_ptr = NULL;
+    
+    pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    pItem = (mcf_tool_ota_file_item_t *)(ota_file->buff + pFile->total_len);
+    /* Read changed items from OTA file */
+    while (item_cnt < pFile->item_num) {
+        if ( (pItem->lid != lid) || (pItem->record_idx != record_idx) ) {
+            if (is_found_target == KAL_FALSE) {
+                goto next;
+            } else {
+                // Item in file has been sorted. If target has been found, stop searching while next item is not the one we are searching
+                break;
+            }
+        }
+        is_found_target = KAL_TRUE;
+
+        /* Check if item_tag_len is valid */
+        if ( (pItem->item_tag_len <= 0) || (pItem->item_tag_len >= MCF_FILE_MAX_TAG_LEN-1) ) {
+            MD_TRC_MCF_TR_READ_OTA_BUFFER_INVALID_TAG_LEN(pItem->item_tag_len, MCF_FILE_MAX_TAG_LEN);
+            mcf_utfwk_printf("Invalid item_tag_len(%d)!! max item_tag_len(%d) \r\n",  pItem->item_tag_len, MCF_FILE_MAX_TAG_LEN);
+            goto next;
+        }
+
+        /* Update LID item */
+        if (pItem->is_bit_op == 0) {
+            strncpy(item_tag, &(pItem->buff_start), pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            if (mcf_find_tag_offset(lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if (pItem->op.byte.value_len > item_size) {
+                MD_TRC_MCF_TR_READ_OTA_BUFFER_LARGE_VAL_LEN(pItem->op.byte.value_len, item_size);
+                mcf_utfwk_printf("Invalid value len(%d)!! larger than current item len(%d) \r\n",  pItem->op.byte.value_len, item_size);
+
+                goto next;
+            }
+
+            MD_TRC_MCF_TR_READ_OTA_BUFFER_BYTE_UPDATE(lid, item_byte_offset, pItem->op.byte.value_len);
+            mcf_dump_data(KAL_FALSE, &(pItem->buff_start) + pItem->item_tag_len, pItem->op.byte.value_len);
+
+            kal_mem_cpy( (buffer + item_byte_offset), &(pItem->buff_start) + pItem->item_tag_len, pItem->op.byte.value_len);
+        } else {
+            kal_uint32 bit_value = 0;
+            kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(pItem->op.bit.len);
+
+            kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->item_tag_len, pItem->op.bit.value_len);
+
+            strncpy(item_tag, &(pItem->buff_start), pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            if (mcf_find_tag_offset(lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if ( (pItem->op.bit.value_len > 4) || (pItem->op.bit.len > item_size) ) {
+                MD_TRC_MCF_TR_READ_OTA_BUFFER_INVALID_BIT_LEN(pItem->op.bit.len, item_size, pItem->op.bit.value_len);
+                mcf_utfwk_printf("Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d) \r\n",  pItem->op.bit.len, item_size, pItem->op.bit.value_len);
+
+                goto next;
+            }
+
+            MD_TRC_MCF_TR_READ_OTA_BUFFER_BIT_UPDATE(lid, item_byte_offset, item_bit_offset, pItem->op.bit.len, bit_value);
+
+            if (pItem->op.bit.value_len == 1) {
+                kal_uint8 *val_tmp = (kal_uint8 *)(buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 2) {
+                kal_uint16 *val_tmp = (kal_uint16 *)(buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 4) {
+                kal_uint32 *val_tmp = (kal_uint32 *)(buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            }
+        }
+
+next:
+        pItem = (mcf_tool_ota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+        item_cnt++;
+    }
+    MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+}
+_STATIC void mcf_v1_read_tlvota_buffer(mcf_tlvota_file_t *tlvota_file, mcf_tlvota_tag_t tag, nvram_lid_enum lid, kal_uint8 *buffer)
+{
+    mcf_tool_file_info_t           *pFile;
+    mcf_tool_tlvota_file_item_t    *pItem;
+    kal_uint16                      item_cnt = 0;
+    kal_char                        item_tag[MCF_FILE_MAX_TAG_LEN] = {0};
+    kal_uint16                      item_byte_offset;
+    kal_uint16                      item_bit_offset;
+    kal_uint32                      item_size;
+    mcf_tag_info_struct             unuse = {0};
+    MCF_DB_STRUCT_VARIABLE          const *unuse_db_ptr = NULL;
+    
+    pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+    pItem = (mcf_tool_tlvota_file_item_t *)(tlvota_file->buff + pFile->total_len);
+    /* Read changed items from TLV-OTA file */
+    while (item_cnt < pFile->item_num) {
+        /* Check if LID and tag match */
+        if ( (pItem->lid != lid) || (pItem->tag_type != tag.tag_type) || (strncmp(&(pItem->buff_start), tag.tag, pItem->tag_len) != 0) ) {
+            goto next;
+        }
+        
+
+        /* Check if item_tag_len is valid */
+        if ( (pItem->item_tag_len <= 0) || (pItem->item_tag_len >= MCF_FILE_MAX_TAG_LEN-1) ) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_INVALID_TAG_LEN(pItem->item_tag_len, MCF_FILE_MAX_TAG_LEN);
+            goto next;
+        }
+
+        /* Update LID item */
+        if (pItem->is_bit_op == 0) {
+            strncpy(item_tag, &(pItem->buff_start) + pItem->tag_len, pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            if (mcf_find_tag_offset(lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if (pItem->op.byte.value_len > item_size) {
+                MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_LARGE_VAL_LEN(pItem->op.byte.value_len, item_size);
+
+                goto next;
+            }
+
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_BYTE_UPDATE_USIR(lid, tag.tag, item_byte_offset, pItem->op.byte.value_len);
+            mcf_dump_data(KAL_FALSE, &(pItem->buff_start) + pItem->tag_len + pItem->item_tag_len, pItem->op.byte.value_len);
+
+            kal_mem_cpy( (buffer + item_byte_offset), &(pItem->buff_start) + pItem->tag_len + pItem->item_tag_len, pItem->op.byte.value_len);
+        } else {
+            kal_uint32 bit_value = 0;
+            kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(pItem->op.bit.len);
+
+            kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->tag_len + pItem->item_tag_len, pItem->op.bit.value_len);
+
+            strncpy(item_tag, &(pItem->buff_start) + pItem->tag_len, pItem->item_tag_len);
+            item_tag[pItem->item_tag_len] = '\0';
+            if (mcf_find_tag_offset(lid, item_tag, &item_byte_offset, &item_bit_offset, &item_size, &unuse_db_ptr, &unuse) == KAL_FALSE) {
+                goto next;
+            }
+
+            if ( (pItem->op.bit.value_len > 4) || (pItem->op.bit.len > item_size) ) {
+                MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_INVALID_BIT_LEN(pItem->op.bit.len, item_size, pItem->op.bit.value_len);
+
+                goto next;
+            }
+
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_BIT_UPDATE_USIR(lid, tag.tag, item_byte_offset, item_bit_offset, pItem->op.bit.len, bit_value);
+
+            if (pItem->op.bit.value_len == 1) {
+                kal_uint8 *val_tmp = (kal_uint8 *)(buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 2) {
+                kal_uint16 *val_tmp = (kal_uint16 *)(buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            } else if (pItem->op.bit.value_len == 4) {
+                kal_uint32 *val_tmp = (kal_uint32 *)(buffer + item_byte_offset);
+
+                *val_tmp &= ~(bit_mask << item_bit_offset);
+                *val_tmp |= (bit_value << item_bit_offset);
+            }
+        }
+
+next:
+        pItem = (mcf_tool_tlvota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+        item_cnt++;
+    }
+    MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+}
+
+/*------------------------------------------------------------------------------
+ * Public fucntions.
+ *----------------------------------------------------------------------------*/
+void mcf_on_ilm(ilm_struct *ilm)
+{
+    switch (ilm->msg_id)
+    {
+        case MSG_ID_L4C_MCF_SET_CONFIG_REQ:
+            mcf_l4_set_config(ilm);
+            break;
+
+        case MSG_ID_L4C_MCF_GET_CONFIG_REQ:
+            mcf_l4_get_config(ilm);
+            break;
+
+        case MSG_ID_L4C_MCF_DUMP_DATA_REQ:
+            mcf_l4_dump_data(ilm);
+            break;
+
+        case MSG_ID_L4C_MCF_CONFIG_LID_VARIABLE_OPERATION_REQ:
+            mcf_l4_query_lid(ilm);
+            break;
+
+        case MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_CNF:
+            mcf_respond_dsbp_result(ilm->local_para_ptr);
+            break;
+
+        case MSG_ID_MCF_L4BSBP_TRIGGER_DSBP_RESULT_IND:
+            mcf_report_dsbp_result(ilm->local_para_ptr);
+            break;
+
+        case MSG_ID_L4CPS_EM_UPDATE_REQ:
+            mcf_em_update_req_hdlr(ilm->local_para_ptr);
+            break;
+
+        case MSG_ID_TIMER_EXPIRY:
+            evshed_timer_handler(mcf_timer_es_g);
+            break;
+
+        case MSG_ID_L4C_MCF_UPDATE_OTA_FILE_REQ:
+            mcf_l4_update_ota(ilm);
+            break;
+            
+        case MSG_ID_L4C_MCF_CONFIG_REQ:
+            mcf_l4_config(ilm);
+            break;
+            
+        case MSG_ID_L4C_MCF_VARIABLE_VALUE_OPERATION_REQ:
+            mcf_l4_variable_operation(ilm);
+            break;
+			
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+		case MSG_ID_L4C_MCF_ASSIGN_COMBINED_FILE_PATH_REQ:
+            mcf_l4_assign_combined_file_path(ilm);
+            break;
+#endif
+            
+#if defined(__MCF_UT_FRAMEWORK_SUPPORT__)
+        case MSG_ID_MCF_UTFWK_INITIAL_ENV_REQ:
+            mcf_utfwk_ilm_initial_env(ilm);
+            break;
+            
+        case MSG_ID_MCF_UTFWK_INITIAL_DSBP_CALLBACK_REQ:
+            mcf_utfwk_ilm_initial_dsbp_callback(ilm);
+            break;
+
+        case MSG_ID_MCF_UTFWK_EXECUTE_REQ:
+            mcf_utfwk_ilm_execute(ilm);
+            break;
+
+        case MSG_ID_MCF_UTFWK_DUMP_RESULT_REQ:
+            mcf_utfwk_ilm_dump_result(ilm);
+            break;
+
+        case MSG_ID_MCF_UTFWK_RESET_REQ:
+            mcf_utfwk_ilm_reset(ilm);
+            break;
+
+#endif
+            
+        default:
+            MD_TRC_MCF_TR_ILM_UNKNOWN_MSG(ilm->msg_id);
+            break;
+    }
+}
+
+mcf_ota_result_e mcf_do_ota_full(void)
+{
+    mcf_t                                  *pMcf = mcf_get_instance();
+    mcf_ota_result_e                        ret = MCF_OTA_R_SUCCESS;
+    mcf_tool_file_info_t                   *pFile;
+    mcf_tool_gid_ota_file_item_t           *pItem;
+    mcf_ota_file_t                         *ota_file = &(pMcf->ota_file);
+    mcf_tlvota_file_t                      *tlvota_file;
+    kal_uint16                              item_cnt = 0;
+    nvram_ef_mcf_ota_file_info_struct       nv_ota_file;
+    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+    nvram_ef_mcf_sw_info_struct             nv_sw_info;
+    nvram_ltable_entry_struct               lid_info = {0};
+    em_mcf_read_ota_file_info_struct        read_file_info;
+    kal_uint8                              *lid_buffer = NULL;
+    kal_char                                apply_filename[MCF_FILE_MAX_NAME_LEN];
+    l4c_mcf_path_type_enum                  apply_path_type;
+    kal_uint32                              i;
+    nvram_errno_enum                        nvram_api_ret;
+    kal_bool                                is_read_nvram = KAL_FALSE;
+    kal_uint32                              start_time;
+    kal_int16                               pos = -1;
+    kal_uint16                              in_pos = 0;
+    nvram_ltable_entry_struct               pre_lid_info = {0};
+    kal_uint16                              pre_record_idx = 0xFFFF;
+    kal_uint8                              *pre_lid_buffer = NULL;
+    kal_uint16                              item_byte_offset;
+    kal_uint16                              item_bit_offset;
+    kal_uint32                              item_size;
+    kal_char                                array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_bool                                item_is_bit = KAL_FALSE;
+    kal_uint16                              item_lid;
+    kal_char                                tool_version[MCF_FILE_MAX_TOOL_VERSION_LEN]={0};
+    kal_uint32                              total_start_time = GET_CURRENT_TIME();
+    mcf_ota_result_e                        tlvota_ret;
+
+    /* This API can only be used by NVRAM while init */
+    MCF_UT_DUMMY_ASSERT(kal_query_systemInit() == KAL_TRUE);
+
+    mcf_create_custom_folder(pMcf);
+	kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+
+    /* Read MCF SW information in NVRAM */
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_LID_FAIL, NVRAM_EF_MCF_SW_INFO_LID, 1);
+        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_SW_INFO_LID_FAIL;
+        mcf_utfwk_printf("Fail to read MCF LID(%d)!! record_idx(%d) \r\n", NVRAM_EF_MCF_SW_INFO_LID, 1);
+    }
+    /* Read MCF Internal information in NVRAM */
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_LID_FAIL, NVRAM_EF_MCF_INTERNAL_INFO_LID, 1);
+        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_INT_INFO_LID_FAIL;
+        mcf_utfwk_printf("Fail to read MCF LID(%d)!! record_idx(%d) \r\n", NVRAM_EF_MCF_INTERNAL_INFO_LID, 1);
+        ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+        return ret;
+    }
+    
+    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_NOT_RESET, nv_int_info.not_reset_ota);
+	kal_mem_cpy(&mcf_general_tlvota_last_mod_lid_g, &nv_int_info.general_tlvota_last_mod_lid, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+	kal_mem_cpy(&mcf_tlvota_last_mod_lid_g, &nv_int_info.tlvota_last_mod_lid, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        pMcf->is_ignore_dsbp[i] = nv_int_info.tlvota_is_ignore_dsbp[i];
+    }
+    pMcf->general_is_ignore_dsbp = nv_int_info.general_is_ignore_dsbp;
+    
+    /* Read general TLV-OTA file into cache buffer */
+    apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+    kal_mem_set(apply_filename, 0, MCF_FILE_MAX_NAME_LEN);
+
+    /* Read MCF general TLV-OTA file into cache buffer */
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_LID_FAIL, NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1);
+        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_FILE_LID_FAIL;
+        mcf_utfwk_printf("Fail to read MCF LID(%d)!! record_idx(%d) \r\n", NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1);
+    }
+	
+	ret = mcf_read_general_tlvota_file(KAL_TRUE, nv_tlvota_file.path, nv_tlvota_file.name, &apply_path_type, apply_filename, pMcf);
+    // Set General OPOTA - Get tlvota result
+    if (pMcf->general_is_ignore_dsbp == KAL_TRUE){
+        for(i = 0; i < MAX_SIM_NUM; i++){
+            com_Mcf.tlvota_result[i] = ret;
+        }
+        /* Check if file type is TLV-OTA file */
+        tlvota_file = &(pMcf->general_tlvota_file);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+                kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+                mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_FILE, str_tmp);
+                for(i = 0; i < MAX_SIM_NUM; i++){
+                    com_Mcf.tlvota_result[i] = MCF_OTA_R_INVALID_FILE;
+                }
+            }
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }else{
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_TLVOTA_FILE_TAKE_READ_LOCK_FAIL);
+        }
+    }
+	if (ret == MCF_OTA_R_SUCCESS) {
+		tlvota_file = &(pMcf->general_tlvota_file);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+
+			/* Store last updated file informantion */
+			tlvota_file->last_file.path_type = apply_path_type;
+			strncpy(tlvota_file->last_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+			if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+				strncpy(tlvota_file->last_file.sw_version, &(pFile->buff_start), pFile->sw_version_len);
+				tlvota_file->last_file.sw_version[pFile->sw_version_len] = '\0';
+			} else {
+				MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_VERSION, pFile->sw_version_len);
+			}
+			if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+				strncpy(tlvota_file->last_file.gen_time, &(pFile->buff_start) + pFile->sw_version_len, pFile->gen_time_len);
+				tlvota_file->last_file.gen_time[pFile->gen_time_len] = '\0';
+			} else {
+				MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_GEN_TIME, pFile->gen_time_len);
+			}
+			/*
+			 *  No need to Update TLV-OTA information if 
+			 *  1. SW version and generated time in OTA file and NVRAM are same
+			 *  2. Current SW version and build time are the same as last MCF OTA SW
+			 */
+			if (apply_path_type == L4C_MCF_PATH_TYPE_OTA) {
+				if ( (strncmp(tlvota_file->last_file.sw_version, nv_sw_info.last_update_general_tlvota_file.sw_version, pFile->sw_version_len) != 0) ||
+				(strncmp(tlvota_file->last_file.gen_time, nv_sw_info.last_update_general_tlvota_file.gen_time, pFile->gen_time_len) != 0) ||
+				(strncmp(nv_sw_info.last_update_general_tlvota_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN) != 0) ||
+				(strncmp(nv_sw_info.last_update_general_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)) {
+					/* Write updated MCF TLV-OTA file information to NVRAM */
+					if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+						strncpy(nv_sw_info.last_update_general_tlvota_file.sw_version, tlvota_file->last_file.sw_version, pFile->sw_version_len);
+						nv_sw_info.last_update_general_tlvota_file.sw_version[pFile->sw_version_len] = '\0';
+					} else {
+						MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_VERSION, pFile->sw_version_len);
+					}
+
+					if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+						strncpy(nv_sw_info.last_update_general_tlvota_file.gen_time, tlvota_file->last_file.gen_time, pFile->gen_time_len);
+						nv_sw_info.last_update_general_tlvota_file.gen_time[pFile->gen_time_len] = '\0';
+					} else {
+						MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_GEN_TIME, pFile->gen_time_len);
+					}
+					strncpy(nv_sw_info.last_update_general_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+					strncpy(nv_sw_info.last_update_general_tlvota_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+					for(i = 0; i < MAX_SIM_NUM; i++){
+						is_read_general_tlvota[i] = KAL_TRUE;
+					}
+				}
+			}else if (apply_path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+				if ( (strncmp(tlvota_file->last_file.sw_version, nv_sw_info.last_update_general_tlvota_file.sw_version, pFile->sw_version_len) != 0) ||
+				(strncmp(tlvota_file->last_file.gen_time, nv_sw_info.last_update_general_tlvota_file.gen_time, pFile->gen_time_len) != 0) ||
+				(strncmp(nv_sw_info.last_update_general_tlvota_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN) != 0) ||
+				(strncmp(nv_sw_info.last_update_general_tlvota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)) {
+					/* Write updated MCF TLV-OTA file information to NVRAM */
+					if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+						strncpy(nv_sw_info.last_update_general_tlvota_file.sw_version, tlvota_file->last_file.sw_version, pFile->sw_version_len);
+						nv_sw_info.last_update_general_tlvota_file.sw_version[pFile->sw_version_len] = '\0';
+					} else {
+						MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_VERSION, pFile->sw_version_len);
+					}
+
+					if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+						strncpy(nv_sw_info.last_update_general_tlvota_file.gen_time, tlvota_file->last_file.gen_time, pFile->gen_time_len);
+						nv_sw_info.last_update_general_tlvota_file.gen_time[pFile->gen_time_len] = '\0';
+					} else {
+						MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_GEN_TIME, pFile->gen_time_len);
+					}
+					strncpy(nv_sw_info.last_update_general_tlvota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+					strncpy(nv_sw_info.last_update_general_tlvota_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+					for(i = 0; i < MAX_SIM_NUM; i++){
+						is_read_general_tlvota[i] = KAL_TRUE;
+					}
+				}
+				
+			}
+						
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		}else{
+			MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_GENERAL_TLVOTA_FILE_TAKE_READ_LOCK_FAIL);
+		}
+		MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_GENERAL_TLVOTA_FILE_INFO, apply_path_type, apply_filename);
+    
+	}
+    
+    
+
+    /* Read TLV-OTA file into cache buffer */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+        kal_mem_set(apply_filename, 0, MCF_FILE_MAX_NAME_LEN);
+        kal_mem_set(&read_file_info, 0, sizeof(em_mcf_read_ota_file_info_struct));
+		com_Mcf.update_tlvota[i] = KAL_FALSE;
+		com_Mcf.update_general_tlvota[i] = KAL_FALSE;
+        
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        
+        read_file_info.trigger_type = EM_MCF_TRIGGER_TYPE_BY_BOOT_UP;
+        read_file_info.config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        read_file_info.ps_id = l4c_gemini_get_switched_sim_id(i);
+
+        /* Read MCF TLV-OTA file into cache buffer */
+        if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, i + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_LID_FAIL, NVRAM_EF_MCF_TLVOTA_FILE_LID, i + 1);
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_FILE_LID_FAIL;
+            mcf_utfwk_printf("Fail to read MCF LID(%d)!! record_idx(%d) \r\n", NVRAM_EF_MCF_TLVOTA_FILE_LID, i + 1);
+        }
+
+        read_file_info.start_time = kal_get_systicks();
+
+        ret = mcf_read_tlvota_file(KAL_TRUE, i, nv_tlvota_file.path, nv_tlvota_file.name, &apply_path_type, apply_filename, pMcf);
+        tlvota_ret = ret;
+        if (ret == MCF_OTA_R_SUCCESS) {
+            MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (tlvota_file) {
+                pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+
+                /* Store last updated file informantion */
+                tlvota_file->last_file.path_type = apply_path_type;
+                strncpy(tlvota_file->last_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+                if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+                    strncpy(tlvota_file->last_file.sw_version, &(pFile->buff_start), pFile->sw_version_len);
+                    tlvota_file->last_file.sw_version[pFile->sw_version_len] = '\0';
+                } else {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_VERSION, pFile->sw_version_len);
+                }
+                if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+                    strncpy(tlvota_file->last_file.gen_time, &(pFile->buff_start) + pFile->sw_version_len, pFile->gen_time_len);
+                    tlvota_file->last_file.gen_time[pFile->gen_time_len] = '\0';
+                } else {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_GEN_TIME, pFile->gen_time_len);
+                }
+				/*
+				 *  No need to Update TLV-OTA information if 
+				 *  1. SW version and generated time in OTA file and NVRAM are same
+				 *  2. Current SW version and build time are the same as last MCF OTA SW
+				 */
+				if (apply_path_type == L4C_MCF_PATH_TYPE_OTA) {
+					if ( (strncmp(tlvota_file->last_file.sw_version, nv_sw_info.last_update_tlvota_file[i].sw_version, pFile->sw_version_len) != 0) ||
+						(strncmp(tlvota_file->last_file.gen_time, nv_sw_info.last_update_tlvota_file[i].gen_time, pFile->gen_time_len) != 0) ||
+						(strncmp(nv_sw_info.last_update_tlvota_file[i].name, apply_filename, MCF_FILE_MAX_NAME_LEN) != 0) ||
+						(strncmp(nv_sw_info.last_update_tlvota_file[i].path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)){
+						
+						/* Write updated MCF TLV-OTA file information to NVRAM */
+						if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+							strncpy(nv_sw_info.last_update_tlvota_file[i].sw_version, tlvota_file->last_file.sw_version, pFile->sw_version_len);
+							nv_sw_info.last_update_tlvota_file[i].sw_version[pFile->sw_version_len] = '\0';
+						} else {
+							MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_VERSION, pFile->sw_version_len);
+						}
+
+						if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+							strncpy(nv_sw_info.last_update_tlvota_file[i].gen_time, tlvota_file->last_file.gen_time, pFile->gen_time_len);
+							nv_sw_info.last_update_tlvota_file[i].gen_time[pFile->gen_time_len] = '\0';
+						} else {
+							MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_GEN_TIME, pFile->gen_time_len);
+						}
+						strncpy(nv_sw_info.last_update_tlvota_file[i].path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+						strncpy(nv_sw_info.last_update_tlvota_file[i].name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+						is_read_tlvota[i] = KAL_TRUE;
+						
+					}
+				}else if(apply_path_type == L4C_MCF_PATH_TYPE_RUNTIME){
+					if ( (strncmp(tlvota_file->last_file.sw_version, nv_sw_info.last_update_tlvota_file[i].sw_version, pFile->sw_version_len) != 0) ||
+						(strncmp(tlvota_file->last_file.gen_time, nv_sw_info.last_update_tlvota_file[i].gen_time, pFile->gen_time_len) != 0) ||
+						(strncmp(nv_sw_info.last_update_tlvota_file[i].name, apply_filename, MCF_FILE_MAX_NAME_LEN) != 0) ||
+						(strncmp(nv_sw_info.last_update_tlvota_file[i].path,  MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)){
+							/* Write updated MCF TLV-OTA file information to NVRAM */
+							if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+								strncpy(nv_sw_info.last_update_tlvota_file[i].sw_version, tlvota_file->last_file.sw_version, pFile->sw_version_len);
+								nv_sw_info.last_update_tlvota_file[i].sw_version[pFile->sw_version_len] = '\0';
+							} else {
+								MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_VERSION, pFile->sw_version_len);
+							}
+
+							if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+								strncpy(nv_sw_info.last_update_tlvota_file[i].gen_time, tlvota_file->last_file.gen_time, pFile->gen_time_len);
+								nv_sw_info.last_update_tlvota_file[i].gen_time[pFile->gen_time_len] = '\0';
+							} else {
+								MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_GEN_TIME, pFile->gen_time_len);
+							}
+							strncpy(nv_sw_info.last_update_tlvota_file[i].path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+							strncpy(nv_sw_info.last_update_tlvota_file[i].name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+							is_read_tlvota[i] = KAL_TRUE;
+							
+					}
+					
+				}
+				
+                MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            }else{
+				MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_TLVOTA_FILE_TAKE_READ_LOCK_FAIL);
+			}
+            
+            read_file_info.path_type = apply_path_type;
+            strncpy(read_file_info.file_name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_TLVOTA_FILE_INFO, i, apply_path_type, apply_filename);	
+        }else{
+			/* Copy last updated file informantion */
+			MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (tlvota_file) {
+				if ((strncmp(nv_sw_info.last_update_tlvota_file[i].path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) == 0)) {
+					tlvota_file->last_file.path_type = L4C_MCF_PATH_TYPE_OTA;
+				}else if ((strncmp(nv_sw_info.last_update_tlvota_file[i].path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) == 0)) {
+					tlvota_file->last_file.path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+				}
+				strncpy(tlvota_file->last_file.name, nv_sw_info.last_update_tlvota_file[i].name, MCF_FILE_MAX_NAME_LEN - 1);
+				strncpy(tlvota_file->last_file.sw_version, nv_sw_info.last_update_tlvota_file[i].sw_version, MCF_FILE_MAX_SW_VERSION_LEN-1);
+				strncpy(tlvota_file->last_file.gen_time, nv_sw_info.last_update_tlvota_file[i].gen_time, MCF_FILE_MAX_GEN_TIME_LEN - 1);
+				MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			}else{
+				MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_TLVOTA_FILE_TAKE_READ_LOCK_FAIL);
+			}
+
+		}
+        read_file_info.result = ret;
+        read_file_info.end_time = kal_get_systicks();
+
+        mcf_em_send_ota_file_info(&read_file_info);
+        
+        if (pMcf->is_ignore_dsbp[i] == KAL_TRUE){
+            set_op_read_ret[i] = tlvota_ret;
+            /* Check if file type is TLV-OTA file */
+            MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (tlvota_file) {
+                if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+                    kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+                    mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_FILE, str_tmp);
+                    com_Mcf.tlvota_result[i] = MCF_OTA_R_INVALID_FILE;
+                }
+                MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            }else{
+				MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_TLVOTA_FILE_TAKE_READ_LOCK_FAIL);
+			}
+        }
+    }
+
+    kal_mem_set(&read_file_info, 0, sizeof(em_mcf_read_ota_file_info_struct));
+    read_file_info.trigger_type = EM_MCF_TRIGGER_TYPE_BY_BOOT_UP;
+    read_file_info.config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+
+    /* Read MCF OTA file into cache buffer */
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_LID_FAIL, NVRAM_EF_MCF_OTA_FILE_LID, 1);
+        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_FILE_LID_FAIL;
+        mcf_utfwk_printf("Fail to read MCF LID(%d)!! record_idx(%d) \r\n", NVRAM_EF_MCF_OTA_FILE_LID, 1);
+    }
+	
+	nv_int_info.update_ota_result = KAL_FALSE;
+    apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+    kal_mem_set(apply_filename, 0, MCF_FILE_MAX_NAME_LEN);
+    read_file_info.start_time = kal_get_systicks();
+
+    ret = mcf_read_ota_file(KAL_TRUE, nv_ota_file.path, nv_ota_file.name, &apply_path_type, apply_filename, pMcf);
+
+    if (ret == MCF_OTA_R_SUCCESS) {
+        read_file_info.path_type = apply_path_type;
+        strncpy(read_file_info.file_name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_OTA_FILE_INFO, apply_path_type, apply_filename);
+    } else {
+        /* Cannot do OTA if fail to read OTA file */
+        read_file_info.result = ret;
+        read_file_info.end_time = kal_get_systicks();
+
+        mcf_em_send_ota_file_info(&read_file_info);
+
+        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_OTA_FILE_FAIL);
+        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_FULL_OTA_FAIL;
+        mcf_utfwk_printf("Fail to read OTA file, cannot do full OTA!! \r\n");
+
+        return ret;
+    }
+    
+
+    MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+
+        /* Check if file type is OTA file */
+        if (strcmp(pFile->file_type, MCF_FILE_TYPE_OTA) != 0) {
+            kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+
+            ret = MCF_OTA_R_INVALID_FILE;
+            read_file_info.result = ret;
+            read_file_info.end_time = kal_get_systicks();
+
+            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+            mcf_em_send_ota_file_info(&read_file_info);
+
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_FILE, str_tmp);
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_INVALID_FILE;
+            mcf_utfwk_printf("Invalid file type(%s)!! \r\n", str_tmp);
+
+            return ret;
+        }
+
+        /*
+         *  No need to do OTA if 
+         *  1. SW version and generated time in OTA file and NVRAM are same
+         *  2. Current SW version and build time are the same as last MCF OTA SW
+         */
+        if ( (strncmp(nv_sw_info.last_update_file.sw_version, &(pFile->buff_start), pFile->sw_version_len) == 0) &&
+            (strncmp(nv_sw_info.last_update_file.gen_time, &(pFile->buff_start) + pFile->sw_version_len, pFile->gen_time_len) == 0) &&
+            (strncmp(nv_sw_info.version, release_verno(), MCF_SW_VERNO_LEN) == 0) &&
+            (strncmp(nv_sw_info.build_time, build_date_time(), MCF_SW_BUILD_TIME_LEN) == 0) ) {
+            if (apply_path_type == L4C_MCF_PATH_TYPE_OTA) {
+                if ((strncmp(nv_sw_info.last_update_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) == 0) &&
+                    (strncmp(nv_sw_info.last_update_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN) == 0) ) {
+                    MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+                    read_file_info.result = ret;
+                    read_file_info.end_time = kal_get_systicks();
+
+                    mcf_em_send_ota_file_info(&read_file_info);
+
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_NO_NEED1);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_NO_NEED2, nv_sw_info.last_update_file.sw_version, nv_sw_info.last_update_file.gen_time);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_NO_NEED3, nv_sw_info.version, nv_sw_info.build_time);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_TOTAL_RESET_TIME, CALCULATE_LETENCY_DURATION(total_start_time, GET_CURRENT_TIME()));
+                    com_Mcf.boot_trace_flag |= (MCF_BOOT_TRACE_F_NO_NEED | MCF_BOOT_TRACE_F_FULL_OTA_SUCCESS);
+                    mcf_utfwk_printf("MD version is not changed, no need to do full OTA!!\r\n");
+
+                    return ret;
+                }
+            } else if (apply_path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                if ((strncmp(nv_sw_info.last_update_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) == 0) &&
+                    (strncmp(nv_sw_info.last_update_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN) == 0) ) {
+                    MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+                    read_file_info.result = ret;
+                    read_file_info.end_time = kal_get_systicks();
+
+                    mcf_em_send_ota_file_info(&read_file_info);
+
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_NO_NEED1);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_NO_NEED2, nv_sw_info.last_update_file.sw_version, nv_sw_info.last_update_file.gen_time);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_NO_NEED3, nv_sw_info.version, nv_sw_info.build_time);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_TOTAL_RESET_TIME, CALCULATE_LETENCY_DURATION(total_start_time, GET_CURRENT_TIME()));
+                    com_Mcf.boot_trace_flag |= (MCF_BOOT_TRACE_F_NO_NEED | MCF_BOOT_TRACE_F_FULL_OTA_SUCCESS);
+                    mcf_utfwk_printf("MD version is not changed, no need to do full OTA!!\r\n");
+
+                    return ret;
+                }
+            }
+        }
+
+
+        /* Reset LID to default value */
+        if((pFile->operation_mask & MCF_FILE_OP_NOT_RESET_LID) == 0) {
+            /* Copy last modified LID list to global variable */
+            kal_mem_cpy(&mcf_last_mod_lid_g, &nv_int_info.last_mod_lid, sizeof(nvram_mcf_lid_info_struct));
+
+            start_time = GET_CURRENT_TIME();
+            if (nv_int_info.last_mod_lid.lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+               for(i = 0; i < nv_int_info.last_mod_lid.lid_cnt; i++){
+                    nvram_api_ret = nvram_external_get_lid_info(MCF_LAST_MODIFIED_LID, &lid_info);
+                    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+                        mcf_utfwk_printf("is_reset_all(%d). Fail to get all LID information!! lid(%d), nvram_ret(%d)\r\n", 0, MCF_LAST_MODIFIED_LID, nvram_api_ret);
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_GET_ALL_LID_INFO_FAIL, 0, MCF_LAST_MODIFIED_LID, nvram_api_ret);
+                        continue;
+                    }
+                    if((lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) {
+                        if ( (lid_info.attr & NVRAM_ATTR_OTA_RESET) != 0) {
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+                            if(nv_int_info.not_reset_ota == KAL_FALSE || nv_int_info.last_mod_lid.lid_conf[i].not_reset == KAL_FALSE)
+#endif
+							{
+								MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_ALL_RESET_LID, 0, MCF_LAST_MODIFIED_LID);
+								if ( !nvram_external_reset_data(MCF_LAST_MODIFIED_LID, 1, lid_info.total_records) ) {
+									MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_ALL_RESET_LID_FAIL, 0, MCF_LAST_MODIFIED_LID, lid_info.total_records);
+									mcf_utfwk_printf("is_reset_all(%d). Reset All LID(%d) FAIL!!, total_record(%d)\r\n", 0, MCF_LAST_MODIFIED_LID, lid_info.total_records);
+								}
+							}
+                        } else {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_ALL_RESET_ATTR_NOT_SET, 0, lid_info.LID, lid_info.attr);
+                            mcf_utfwk_printf("is_reset_all(%d). OTA all reset LID attribute is not set!! lid(%d), attribute(%x)\r\n", 0, lid_info.LID, lid_info.attr);
+                        }
+						
+                    }
+                }
+            }else{
+                for(i = 0; i < MCF_LID_MAPPING_TBL_SIZE; i++){
+                    nvram_api_ret = nvram_external_get_lid_info(mcf_db_lid_mapping_tbl[i].lid_num, &lid_info);
+                    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_GET_ALL_LID_INFO_FAIL, 1, mcf_db_lid_mapping_tbl[i].lid_num, nvram_api_ret);
+                        mcf_utfwk_printf("is_reset_all(%d). Fail to get all LID information!! lid(%d), nvram_ret(%d)\r\n", 1, mcf_db_lid_mapping_tbl[i].lid_num, nvram_api_ret);
+                        continue;
+                    }
+                    if((lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) {
+                        if ( (lid_info.attr & NVRAM_ATTR_OTA_RESET) != 0) {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_ALL_RESET_LID, 1, mcf_db_lid_mapping_tbl[i].lid_num);
+                            if ( !nvram_external_reset_data(mcf_db_lid_mapping_tbl[i].lid_num, 1, lid_info.total_records) ) {
+                                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_ALL_RESET_LID_FAIL, 1, mcf_db_lid_mapping_tbl[i].lid_num, lid_info.total_records);
+                                mcf_utfwk_printf("is_reset_all(%d). Reset All LID(%d) FAIL!!, total_record(%d)\r\n", 1, mcf_db_lid_mapping_tbl[i].lid_num, lid_info.total_records);
+                            }
+                        } else {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_ALL_RESET_ATTR_NOT_SET, 1, lid_info.LID, lid_info.attr);
+                            mcf_utfwk_printf("is_reset_all(%d). OTA all reset LID attribute is not set!! lid(%d), attribute(%x)\r\n", 1, lid_info.LID, lid_info.attr);
+                        }
+                    }
+                }
+            }
+
+            kal_mem_set(&nv_int_info.last_mod_lid, 0, sizeof(nvram_mcf_lid_info_struct));
+
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_RESET_TIME, CALCULATE_LETENCY_DURATION(start_time, GET_CURRENT_TIME()));
+        }
+
+        
+        /* Update MCF OTA file flow - MCF2.0 */
+        if (pFile->file_version == 3) {
+            pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+            pItem = (mcf_tool_gid_ota_file_item_t *)(ota_file->buff + pFile->total_len);
+
+            /* Read changed items from OTA file */
+            while (item_cnt < pFile->item_num) {
+                /* Check if array_tag_len is valid */
+                if ( (pItem->array_index_len < 0) || (pItem->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ARRAY_INDEX_LEN, pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    mcf_utfwk_printf("Invalid array_index_len(%d)!! max array_index_len(%d)\r\n", pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    goto next;
+                }
+                strncpy(array_tag, &(pItem->buff_start), pItem->array_index_len);
+                array_tag[pItem->array_index_len] = '\0';
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_GID_ARRAY_INDEX, pItem->global_id, array_tag);
+                
+                /* Find GID corresponding LID */
+                item_lid = mcf_find_gid_return_lid_num(pItem->global_id);
+                if (item_lid == 65535){
+                    //-1(65535) means not found
+                    goto next;
+                }
+                
+                if ( (is_read_nvram == KAL_FALSE) || (item_lid != pre_lid_info.LID) || (pItem->record_idx != pre_record_idx) ) {
+                    nvram_api_ret = nvram_external_get_lid_info(item_lid, &lid_info);
+                    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_GET_LID_INFO_FAIL, item_lid, nvram_api_ret);
+                        mcf_utfwk_printf("Fail to get LID information!! lid(%d), nvram_ret(%d)\r\n", item_lid, nvram_api_ret);
+                        goto next;
+                    }
+
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+                    /* Store last time modified LID */
+                    if ( (item_lid != pre_lid_info.LID) && ((lid_info.attr & NVRAM_ATTR_OTA_RESET) != 0)
+                            && (((lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) || ((lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0)) ) {
+                        if (nv_int_info.last_mod_lid.lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+                            pos = mcf_binary_search_lid(item_lid, nv_int_info.last_mod_lid.lid, nv_int_info.last_mod_lid.lid_cnt, &in_pos);
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_SEARCH_STORE_LID, item_lid, pos);
+                            if (pos == -1) {
+                                if(mcf_insert_lid(item_lid, nv_int_info.last_mod_lid.lid, nv_int_info.last_mod_lid.lid_cnt, in_pos) != KAL_TRUE){
+                                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID_FAIL, item_lid);
+                                    mcf_utfwk_printf("Save Last modified LID fail!!! LID buffer is full(%d)\r\n", item_lid);
+                                }else{
+                                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID, item_lid, in_pos);
+                                }
+                                nv_int_info.last_mod_lid.lid_cnt++;
+                            }
+                        }
+                    }
+#else				
+					/* Store last time modified LID */
+                    if ( (item_lid != pre_lid_info.LID) && ((lid_info.attr & NVRAM_ATTR_OTA_RESET) != 0)
+                            && (((lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) || ((lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0)) ) {
+                        if (nv_int_info.last_mod_lid.lid_cnt < NVRAM_MCF_SAVE_LAST_LID_CNT){
+                            pos = mcf_binary_search_lid_struct(item_lid, nv_int_info.last_mod_lid.lid_conf, nv_int_info.last_mod_lid.lid_cnt, &in_pos);
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_SEARCH_STORE_LID, item_lid, pos);
+                            if (pos == -1) {
+                                if(mcf_insert_lid_struct(item_lid, nv_int_info.last_mod_lid.lid_conf, nv_int_info.last_mod_lid.lid_cnt, in_pos, nv_int_info.not_reset_ota, KAL_FALSE) != KAL_TRUE){
+                                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID_FAIL, item_lid);
+                                    mcf_utfwk_printf("Save Last modified LID fail!!! LID buffer is full(%d)\r\n", item_lid);
+                                }else{
+                                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_STORE_LID, item_lid, in_pos);
+                                }
+                                nv_int_info.last_mod_lid.lid_cnt++;
+                            }
+                        }
+                    }
+#endif
+
+                    /* Do not update LID if OTA attribute is not set */
+                    if ( (lid_info.attr & NVRAM_ATTR_MCF_OTA) == 0 ) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR, lid_info.LID, lid_info.attr);
+                        mcf_utfwk_printf("OTA attribute is not set, do not write to NVRAM. lid(%d), attribute(%x)\r\n", lid_info.LID, lid_info.attr);
+                        /* Write previous LID record */
+						if (is_read_nvram == KAL_TRUE && (item_lid != pre_lid_info.LID)) {
+							if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0 ) {
+								if ( !nvram_external_write_data(pre_lid_info.LID, pre_record_idx, pre_lid_buffer, pre_lid_info.size) ) {
+									MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_FAIL, pre_lid_info.LID, pre_record_idx);
+									com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_WRITE_ITEM_LID_FAIL;
+									mcf_utfwk_printf("Fail to write item LID(%d), record(%d)\r\n", pre_lid_info.LID, pre_record_idx);
+								} else {
+									MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_SUCCESS, pre_lid_info.LID, pre_record_idx);
+								}
+							} else if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0 ) {
+								MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_QUERY_ATTR_SET, pre_lid_info.LID, pre_lid_info.attr);
+							} else if ( ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) && ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0) ) {
+								MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR2, pre_lid_info.LID, pre_lid_info.attr);
+								mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are set! lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+							} else {
+								MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR3, pre_lid_info.LID, pre_lid_info.attr);
+								mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are not set! lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+							}
+							mcf_utfwk_printf("OTA query attribute is set, do not write to NVRAM. lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+
+							free_ctrl_buffer_set_null(pre_lid_buffer);
+						}
+						
+						is_read_nvram = KAL_FALSE;
+                        goto next;
+                    }
+
+                    /* Write previous LID record */
+                    if (is_read_nvram == KAL_TRUE) {
+                        if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0 ) {
+                            if ( !nvram_external_write_data(pre_lid_info.LID, pre_record_idx, pre_lid_buffer, pre_lid_info.size) ) {
+                                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_FAIL, pre_lid_info.LID, pre_record_idx);
+                                com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_WRITE_ITEM_LID_FAIL;
+                                mcf_utfwk_printf("Fail to write item LID(%d), record(%d)\r\n", pre_lid_info.LID, pre_record_idx);
+                            } else {
+                                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_SUCCESS, pre_lid_info.LID, pre_record_idx);
+                            }
+                        } else if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0 ) {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_QUERY_ATTR_SET, pre_lid_info.LID, pre_lid_info.attr);
+                        } else if ( ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) && ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0) ) {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR2, pre_lid_info.LID, pre_lid_info.attr);
+                            mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are set! lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+                        } else {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR3, pre_lid_info.LID, pre_lid_info.attr);
+                            mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are not set! lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+                        }
+                        mcf_utfwk_printf("OTA query attribute is set, do not write to NVRAM. lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+
+                        free_ctrl_buffer_set_null(pre_lid_buffer);
+                        is_read_nvram = KAL_FALSE;
+                    }
+
+                    /* Do not reset LID if same with previos one */
+                    if (item_lid != pre_lid_info.LID) {
+                        if ( (lid_info.attr & NVRAM_ATTR_OTA_RESET) != 0 ) {
+                            if(nv_int_info.not_reset_ota == KAL_FALSE){
+                                if ( !nvram_external_reset_data(item_lid, 1, lid_info.total_records) ) {
+                                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_RESET_LID_FAIL, item_lid, lid_info.total_records);
+                                    mcf_utfwk_printf("Reset LID(%d) FAIL!!, total_record(%d)\r\n", item_lid, lid_info.total_records);
+                                }
+                            }
+                        } else {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_RESET_ATTR_NOT_SET, lid_info.LID, lid_info.attr);
+                            mcf_utfwk_printf("OTA reset attribute is not set!! lid(%d), attribute(%x)\r\n", lid_info.LID, lid_info.attr);
+                        }
+                    }
+
+                    lid_buffer = (kal_uint8 *)get_ctrl_buffer(lid_info.size);
+
+                    /* Read NVRAM LID */
+                    if ( !nvram_external_read_data(item_lid, pItem->record_idx, lid_buffer, lid_info.size) ) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_READ_ITEM_LID_FAIL, item_lid, pItem->record_idx);
+                        mcf_utfwk_printf("Fail to read item LID(%d), record(%d)\r\n", item_lid, pItem->record_idx);
+                        is_read_nvram = KAL_FALSE;
+                        free_ctrl_buffer_set_null(lid_buffer);
+
+                        goto next;
+                    } else {
+                        is_read_nvram = KAL_TRUE;
+                    }
+                }
+                
+                if(mcf_find_gid_offset(pItem->global_id, array_tag, &item_lid, &item_byte_offset, &item_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                    goto next;
+                }
+
+                /* Update LID item */
+                if (item_is_bit == 0) {
+                    if (pItem->value_len > item_size) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_LARGE_VAL_LEN, pItem->value_len, item_size);
+                        mcf_utfwk_printf("Invalid value len(%d)!! larger than current item len(%d)\r\n", pItem->value_len, item_size);
+                        goto next;
+                    }
+
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_BYTE_UPDATE, item_lid, item_byte_offset, pItem->value_len);
+                    mcf_dump_data(KAL_TRUE, &(pItem->buff_start) + pItem->array_index_len, pItem->value_len);
+
+                    kal_mem_cpy( (lid_buffer + item_byte_offset), &(pItem->buff_start) + pItem->array_index_len, pItem->value_len);
+					nv_int_info.update_ota_result = KAL_TRUE;
+                } else {
+                    kal_uint32 bit_value = 0;
+                    kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(item_size);
+					kal_uint32 offset = 0;
+					kal_uint32 var_size = 1;
+					kal_uint32 val_tmp = 0;
+
+                    kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->array_index_len, pItem->value_len);
+                    
+                    if (pItem->value_len > 4) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_BIT_LEN, pItem->value_len, item_size, pItem->value_len);
+                        mcf_utfwk_printf("Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)\r\n", item_size, item_size, pItem->value_len);
+                        goto next;
+                    }
+
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_BIT_UPDATE, item_lid, item_byte_offset, item_bit_offset, item_size, bit_value);
+					
+					if (item_size > 8 && item_size <= 16) {
+					    var_size = 2;
+					}else if (item_size > 16 && item_size <= 24) {
+					    var_size = 3;
+					}else if (item_size > 24 && item_size <= 32) {
+					    var_size = 4;
+					}
+
+                    if (item_bit_offset > 0 && item_bit_offset < 8){
+						offset = 0;
+					}else if(item_bit_offset >= 8 && item_bit_offset < 16){
+						offset = 1;
+					}else if(item_bit_offset >= 16 && item_bit_offset < 24){
+						offset = 2;
+					}else if(item_bit_offset >= 24 && item_bit_offset < 32){
+						offset = 3;
+					}else if (item_bit_offset >= 32){
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_BIT_OFFSET, item_bit_offset, item_size, pItem->value_len);
+                        mcf_utfwk_printf("Invalid item_bit_offset(%d)!! current item len(%d), bit_value_len(%d) \r\n",  item_bit_offset, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    if (item_bit_offset > 0) {
+                        if ((item_bit_offset) / 8 != (item_size + item_bit_offset) / 8) {
+                            var_size+=((item_size + item_bit_offset) / 8 - item_bit_offset / 8);
+                        }
+                    }
+					
+                    if (var_size > 4) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_BIT_LEN, var_size, item_size, pItem->value_len);
+                        mcf_utfwk_printf("Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d)\r\n", var_size, item_size, pItem->value_len);
+                        goto next;
+                    }
+					
+                    if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        item_bit_offset -= 8;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        item_bit_offset -= 16;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        item_bit_offset -= 24;
+                    }
+					
+
+					kal_mem_cpy(&val_tmp, lid_buffer + item_byte_offset + offset, var_size);
+					val_tmp &= ~(bit_mask << item_bit_offset);
+                    val_tmp |= (bit_value << item_bit_offset);
+					
+					kal_mem_cpy(lid_buffer + item_byte_offset + offset, &val_tmp, var_size);
+					
+					nv_int_info.update_ota_result = KAL_TRUE;
+                }
+
+
+        next:
+                pre_lid_info = lid_info;
+                pre_record_idx = pItem->record_idx;
+                pre_lid_buffer = lid_buffer;
+                pItem = (mcf_tool_gid_ota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+                item_cnt++;
+            }
+            
+            if (item_cnt > 0) {
+                /* Write previous LID record */
+                if (is_read_nvram == KAL_TRUE) {
+                    if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0 ) {
+                        if ( !nvram_external_write_data(pre_lid_info.LID, pre_record_idx, pre_lid_buffer, pre_lid_info.size) ) {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_FAIL, pre_lid_info.LID, pre_record_idx);
+                            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_WRITE_ITEM_LID_FAIL;
+                            mcf_utfwk_printf("Fail to write item LID(%d), record(%d)\r\n", pre_lid_info.LID, pre_record_idx);
+                        } else {
+                            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_ITEM_NVRAM_SUCCESS, pre_lid_info.LID, pre_record_idx);
+                        }
+                    } else if ( (pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0 ) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_QUERY_ATTR_SET, pre_lid_info.LID, pre_lid_info.attr);
+                    } else if ( ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) && ((pre_lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0) ) {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR2, pre_lid_info.LID, pre_lid_info.attr);
+                        mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are set! lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+                    } else {
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_ATTR3, pre_lid_info.LID, pre_lid_info.attr);
+                        mcf_utfwk_printf("ERROR!! Both OTA normal and query attribute are not set! lid(%d), attribute(%x)\r\n", pre_lid_info.LID, pre_lid_info.attr);
+                    }
+                    free_ctrl_buffer_set_null(pre_lid_buffer);
+
+                }
+            }
+            if (ret != MCF_OTA_R_SUCCESS){
+                MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                return ret;
+            }
+        }else if (pFile->file_version == 2){
+            mcf_v1_do_ota_full(ota_file);
+        }
+
+        /* Write updated MCF OTA file information to NVRAM */
+        if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+            strncpy(nv_sw_info.last_update_file.sw_version, &(pFile->buff_start), pFile->sw_version_len);
+            nv_sw_info.last_update_file.sw_version[pFile->sw_version_len] = '\0';
+			MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_FILE_SW_VERSION, nv_sw_info.last_update_file.sw_version);
+        } else {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_VERSION, pFile->sw_version_len);
+            mcf_utfwk_printf("Invalid OTA file SW version!! file_version_len(%d)!!\r\n", pFile->sw_version_len);
+        }
+
+        if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+            strncpy(nv_sw_info.last_update_file.gen_time, (&(pFile->buff_start) + pFile->sw_version_len), pFile->gen_time_len);
+            nv_sw_info.last_update_file.gen_time[pFile->gen_time_len] = '\0';
+			MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_FILE_GEN_TIME, nv_sw_info.last_update_file.gen_time);
+        } else {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_INVALID_SW_GEN_TIME, pFile->gen_time_len);
+            mcf_utfwk_printf("Invalid OTA file SW gen time!! file_gen_time_len(%d)!!\r\n", pFile->gen_time_len);
+        }
+		
+		if (pFile->tool_version_len < MCF_FILE_MAX_TOOL_VERSION_LEN && pFile->tool_version_len > 0) {
+            strncpy(tool_version, (&(pFile->buff_start) + pFile->sw_version_len + pFile->gen_time_len), pFile->tool_version_len);
+            tool_version[pFile->tool_version_len] = '\0';
+			MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_FILE_TOOL_VERSION, tool_version);
+        } else if (pFile->tool_version_len >= MCF_FILE_MAX_TOOL_VERSION_LEN){
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_FILE_INVALID_TOOL_VERSION, pFile->tool_version_len);
+            mcf_utfwk_printf("Invalid OTA file tool version!! file_tool_version_len(%d)!!\r\n", pFile->tool_version_len);
+        }
+
+        if (apply_path_type == L4C_MCF_PATH_TYPE_OTA) {
+            strncpy(nv_sw_info.last_update_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+            strncpy(nv_sw_info.last_update_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+        } else if (apply_path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+            strncpy(nv_sw_info.last_update_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+            strncpy(nv_sw_info.last_update_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+        }
+
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_LID_FAIL, NVRAM_EF_MCF_OTA_FILE_LID, 1);
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_WRITE_FILE_LID_FAIL;
+            mcf_utfwk_printf("Fail to write MCF LID(%d)!! record_idx(%d)\r\n", NVRAM_EF_MCF_OTA_FILE_LID, 1);
+            ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+
+            read_file_info.result = ret;
+            read_file_info.end_time = kal_get_systicks();
+
+            mcf_em_send_ota_file_info(&read_file_info);
+
+            return ret;
+        }
+        MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_TAKE_READ_LOCK_FAIL);
+        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_TAKE_READ_LOCK_FAIL;
+        mcf_utfwk_printf("Read OTA, Fail to take read lock!!\r\n");
+
+        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+        read_file_info.result = ret;
+        read_file_info.end_time = kal_get_systicks();
+
+        mcf_em_send_ota_file_info(&read_file_info);
+
+        return ret;
+    }
+
+    /* Copy current modified LID list to global variable */
+    kal_mem_cpy(&mcf_curr_mod_lid_g, &nv_int_info.last_mod_lid, sizeof(nvram_mcf_lid_info_struct));
+
+    /* Write updated MCF SW information in NVRAM */
+    strncpy(nv_sw_info.version, release_verno(), MCF_SW_VERNO_LEN - 1);
+    strncpy(nv_sw_info.build_time, build_date_time(), MCF_SW_BUILD_TIME_LEN - 1);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_LID_FAIL, NVRAM_EF_MCF_SW_INFO_LID, 1);
+        mcf_utfwk_printf("Fail to write MCF LID(%d)!! record_idx(%d)\r\n", NVRAM_EF_MCF_SW_INFO_LID, 1);
+        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_WRITE_SW_INFO_LID_FAIL;
+    }
+    /* Write updated MCF internal information in NVRAM */
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_WRITE_LID_FAIL, NVRAM_EF_MCF_INTERNAL_INFO_LID, 1);
+        mcf_utfwk_printf("Fail to write MCF LID(%d)!! record_idx(%d)\r\n", NVRAM_EF_MCF_INTERNAL_INFO_LID, 1);
+        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_WRITE_INT_INFO_LID_FAIL;
+    }
+
+    read_file_info.result = ret;
+    read_file_info.end_time = kal_get_systicks();
+
+    mcf_em_send_ota_file_info(&read_file_info);
+
+    MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_TOTAL_RESET_TIME, CALCULATE_LETENCY_DURATION(total_start_time, GET_CURRENT_TIME()));
+
+    return ret;
+}
+
+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)
+{
+    mcf_t                          *pMcf = mcf_get_instance();
+    mcf_ota_result_e                ret = MCF_OTA_R_SUCCESS;
+    mcf_tool_file_info_t           *pFile;
+    mcf_tool_gid_ota_file_item_t   *pItem;
+    mcf_ota_file_t                 *ota_file = &(pMcf->ota_file);
+    kal_bool                        is_read_nvram = KAL_FALSE;
+    kal_uint16                      pre_record_idx = 0xFFFF;
+    kal_bool                        is_found_target = KAL_FALSE;
+    kal_uint8                      *pre_lid_buffer = NULL;
+    kal_uint8                      *lid_buffer = NULL;
+    kal_uint16                      item_cnt = 0;
+    kal_char                        array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_uint16                      item_byte_offset;
+    kal_uint16                      item_bit_offset;
+    kal_uint32                      item_size;
+    kal_bool                        item_is_bit = KAL_FALSE;
+    kal_uint16                      item_lid;
+
+    DEBUG_ASSERT(lid_info);
+    if (!lid_info) {
+        MD_TRC_MCF_TR_LID_OTA_LID_INVALID_PARA(lid, lid_info);
+        ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return ret;
+    }
+    MD_TRC_MCF_TR_LID_OTA_START(lid, record_idx, record_amount);
+
+    MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+        
+
+        /* Check if file type is OTA file */
+        if (strcmp(pFile->file_type, MCF_FILE_TYPE_OTA) != 0) {
+            kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+            MD_TRC_MCF_TR_LID_OTA_LID_INVALID_FILE(str_tmp);
+            ret = MCF_OTA_R_INVALID_FILE;
+            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        /* If NVRAM_ATTR_MCF_OTA is not set, do not OTA */
+        if ( (lid_info->attr & NVRAM_ATTR_MCF_OTA) == 0 ) {
+            MD_TRC_MCF_TR_LID_OTA_INVALID_ATTR(lid, lid_info->attr);
+            ret = MCF_OTA_R_INVALID_ATTR;
+            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        /* Not allow to set both NVRAM_ATTR_MCF_OTA and NVRAM_ATTR_MCF_OTA_FOR_QUERY */
+        if ( (lid_info->attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0 ) {
+            MD_TRC_MCF_TR_LID_OTA_DOUBLE_ATTR(lid, lid_info->attr);
+            ret = MCF_OTA_R_INVALID_ATTR;
+            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+        
+        /* MCF 1.0 update flow */
+        if (pFile->file_version == 2){
+            ret = mcf_v1_do_ota_by_lid (ota_file, lid, record_idx, record_amount, lid_info);
+            if(ret != MCF_OTA_R_SUCCESS)
+            {
+                return ret;
+            }
+        }else if (pFile->file_version == 3){
+            pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+            pItem = (mcf_tool_gid_ota_file_item_t *)(ota_file->buff + pFile->total_len);
+            /* Read changed items from OTA file */
+            while (item_cnt < pFile->item_num) {
+                if ( (pItem->array_index_len < 0) || (pItem->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+                    MD_TRC_MCF_TR_LID_OTA_INVALID_ARRAY_INDEX_LEN(pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    goto next;
+                }
+                strncpy(array_tag, &(pItem->buff_start), pItem->array_index_len);
+                array_tag[pItem->array_index_len] = '\0';
+                
+                /* Find GID corresponding LID */
+                item_lid = mcf_find_gid_return_lid_num(pItem->global_id);
+                if (item_lid == 65535){
+                    //-1(65535) means not found
+                    goto next;
+                }
+
+                if ( (item_lid != lid) || (pItem->record_idx < record_idx) || (pItem->record_idx > (record_idx + record_amount - 1)) ) {
+                    if (is_found_target == KAL_FALSE) {
+                        goto next;
+                    } else {
+                        // Item in file has been sorted. If target has been found, stop searching while next item is not the one we are searching
+                        break;
+                    }
+                }
+
+                if ( (is_read_nvram == KAL_FALSE) || (pItem->record_idx != pre_record_idx) ) {
+                    is_found_target = KAL_TRUE;
+
+                    /* Write previous LID record */
+                    if (is_read_nvram == KAL_TRUE) {
+                        if ( !nvram_external_write_data(lid, pre_record_idx, pre_lid_buffer, lid_info->size) ) {
+                            MD_TRC_MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_FAIL(lid, pre_record_idx);
+                        } else {
+                            MD_TRC_MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_SUCCESS(lid, pre_record_idx);
+                        }
+
+                        free_ctrl_buffer_set_null(pre_lid_buffer);
+                        is_read_nvram = KAL_FALSE;
+                    }
+
+                    lid_buffer = (kal_uint8 *)get_ctrl_buffer(lid_info->size);
+
+                    /* Read NVRAM LID */
+                    if ( !nvram_external_read_data(item_lid, pItem->record_idx, lid_buffer, lid_info->size) ) {
+                        MD_TRC_MCF_TR_LID_OTA_READ_ITEM_NVRAM_FAIL(lid, pItem->record_idx);
+                        is_read_nvram = KAL_FALSE;
+                        free_ctrl_buffer_set_null(lid_buffer);
+
+                        goto next;
+                    } else {
+                        is_read_nvram = KAL_TRUE;
+                    }
+                }
+                
+                if(mcf_find_gid_offset(pItem->global_id, array_tag, &item_lid, &item_byte_offset, &item_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                    goto next;
+                }
+
+                /* Update LID item */
+                if (item_is_bit == 0) {
+                    if (pItem->value_len > item_size) {
+                        MD_TRC_MCF_TR_LID_OTA_LARGE_VAL_LEN(pItem->value_len, item_size);
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_LID_OTA_BYTE_UPDATE(lid, item_byte_offset, pItem->value_len);
+                    mcf_dump_data(KAL_FALSE, &(pItem->buff_start)+pItem->array_index_len, pItem->value_len);
+
+                    kal_mem_cpy( (lid_buffer + item_byte_offset), &(pItem->buff_start) + pItem->array_index_len, pItem->value_len);
+                } else {
+                    kal_uint32 bit_value = 0;
+                    kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(item_size);
+					kal_uint32 offset = 0;
+					kal_uint32 var_size = 1;
+					kal_uint32 val_tmp = 0;
+
+                    kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->array_index_len, pItem->value_len);
+
+                    if (pItem->value_len > 4) {
+                        MD_TRC_MCF_TR_LID_OTA_INVALID_BIT_LEN(pItem->value_len, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_LID_OTA_BIT_UPDATE(lid, item_byte_offset, item_bit_offset, item_size, bit_value);
+
+                    if (item_size > 8 && item_size <= 16) {
+                        var_size = 2;
+                    }else if (item_size > 16 && item_size <= 24) {
+                        var_size = 3;
+                    }else if (item_size > 24 && item_size <= 32) {
+                        var_size = 4;
+                    }
+
+                    if (item_bit_offset > 0 && item_bit_offset < 8) {
+                        offset = 0;
+                    }else if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        offset = 1;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        offset = 2;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        offset = 3;
+                    }else if (item_bit_offset >= 32){
+                        MD_TRC_MCF_TR_LID_OTA_INVALID_BIT_OFFSET(item_bit_offset, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    if (item_bit_offset > 0) {
+                        if ((item_bit_offset) / 8 != (item_size + item_bit_offset) / 8) {
+                            var_size += ((item_size + item_bit_offset) / 8 - item_bit_offset / 8);
+                        }
+                    }
+                    
+                    if (var_size > 4) {
+                        MD_TRC_MCF_TR_LID_OTA_INVALID_BIT_LEN(var_size, item_size, pItem->value_len);
+                        goto next;
+                    }
+
+                    if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        item_bit_offset -= 8;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        item_bit_offset -= 16;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        item_bit_offset -= 24;
+                    }
+
+
+                    kal_mem_cpy(&val_tmp, lid_buffer + item_byte_offset + offset, var_size);
+                    val_tmp &= ~(bit_mask << item_bit_offset);
+                    val_tmp |= (bit_value << item_bit_offset);
+
+                    kal_mem_cpy(lid_buffer + item_byte_offset + offset, &val_tmp, var_size);
+                }
+
+    next:
+                pre_record_idx = pItem->record_idx;
+                pre_lid_buffer = lid_buffer;
+                pItem = (mcf_tool_gid_ota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+                item_cnt++;
+            }
+            if (item_cnt > 0) {
+                /* Write previous LID record */
+                if (is_read_nvram == KAL_TRUE) {
+                    if ( !nvram_external_write_data(lid, pre_record_idx, pre_lid_buffer, lid_info->size) ) {
+                        MD_TRC_MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_FAIL(lid, pre_record_idx);
+                        ret = MCF_OTA_R_WRITE_NVRAM_FAIL;
+                    } else {
+                        MD_TRC_MCF_TR_LID_OTA_WRITE_ITEM_NVRAM_SUCCESS(lid, pre_record_idx);
+                    }
+
+                    free_ctrl_buffer_set_null(pre_lid_buffer);
+                }
+            }
+            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+        }
+    } else {
+        MD_TRC_MCF_TR_LID_OTA_TAKE_READ_LOCK_FAIL(lid);
+        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+    }
+
+    return ret;
+}
+
+mcf_ota_result_e mcf_read_ota_buffer(
+    nvram_lid_enum lid,
+    kal_uint16 record_idx,
+    kal_uint8 *buffer,
+    kal_uint32 size)
+{
+    mcf_t                          *pMcf = mcf_get_instance();
+    mcf_ota_result_e                ret = MCF_OTA_R_SUCCESS;
+    nvram_ltable_entry_struct       lid_info = {0};
+    mcf_tool_file_info_t           *pFile;
+    mcf_tool_gid_ota_file_item_t   *pItem;
+    mcf_ota_file_t                 *ota_file = &(pMcf->ota_file);
+    kal_uint16                      item_cnt = 0;
+    nvram_errno_enum                nvram_api_ret;
+    kal_bool                        is_found_target = KAL_FALSE;
+    kal_char                        array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_uint16                      item_byte_offset;
+    kal_uint16                      item_bit_offset;
+    kal_uint32                      item_size;
+    kal_bool                        item_is_bit = KAL_FALSE;
+    kal_uint16                      item_lid;
+    kal_uint32                      start_time = GET_CURRENT_TIME();
+
+    if (!(buffer && (size > 0))) {
+        MD_TRC_MCF_TR_READ_OTA_BUFFER_INVALID_PARA(lid, buffer, size);
+        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_PARA, lid, buffer, size);
+        mcf_utfwk_printf("Invalid parameters!! LID(%d), buffer(%x), size(%d) \r\n", lid, buffer, size);
+        ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return ret;
+    }
+    MD_TRC_MCF_TR_READ_OTA_BUFFER_START(lid, record_idx, buffer, size);
+
+    MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+
+        /* Check if file type is OTA file */
+        if (strcmp(pFile->file_type, MCF_FILE_TYPE_OTA) != 0) {
+            kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_FILE, str_tmp);
+            MD_TRC_MCF_TR_READ_OTA_BUFFER_INVALID_FILE(str_tmp);
+            ret = MCF_OTA_R_INVALID_FILE;
+            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        nvram_api_ret = nvram_external_get_lid_info(lid, &lid_info);
+        if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+            MD_TRC_MCF_TR_READ_OTA_BUFFER_GET_LID_INFO_FAIL(lid, nvram_api_ret);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_GET_LID_INFO_FAIL, lid, nvram_api_ret);
+            mcf_utfwk_printf("Fail to get LID information!! LID(%d), nvram_api_ret(%d) \r\n", lid, nvram_api_ret);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        if (size != lid_info.size) {
+            MD_TRC_MCF_TR_READ_OTA_BUFFER_INVALID_SIZE(size, lid_info.size);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_SIZE, size, lid_info.size);
+            mcf_utfwk_printf("Invalid buffer_size(%d)!! record_size(%d) \r\n", size, lid_info.size);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+#if 0 //Bypass attribute check because NVRAM_ATTR_MCF_OTA will also use this API
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+        /*MCF 1.0 Read OTA buffer Update flow */
+        if (pFile->file_version == 2){
+            mcf_v1_read_ota_buffer(ota_file, lid, record_idx, buffer);
+        }
+        else if (pFile->file_version == 3){
+            pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+            pItem = (mcf_tool_gid_ota_file_item_t *)(ota_file->buff + pFile->total_len);
+            /* Read changed items from OTA file */
+            while (item_cnt < pFile->item_num) {
+                if ( (pItem->array_index_len < 0) || (pItem->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+                    MD_TRC_MCF_TR_READ_OTA_BUFFER_INVALID_ARRAY_INDEX_LEN(pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_ARRAY_INDEX_LEN, pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    mcf_utfwk_printf("Invalid array_index_len(%d)!! max array_index_len(%d) \r\n",  pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    goto next;
+                }
+                strncpy(array_tag, &(pItem->buff_start), pItem->array_index_len);
+                array_tag[pItem->array_index_len] = '\0';
+                
+                /* Find GID corresponding LID */
+                item_lid = mcf_find_gid_return_lid_num(pItem->global_id);
+                if (item_lid == 65535){
+                    //-1(65535) means not found
+                    goto next;
+                }
+
+                if ( (item_lid != lid) || (pItem->record_idx != record_idx) ) {
+                    if (is_found_target == KAL_FALSE) {
+                        goto next;
+                    } else {
+                        // Item in file has been sorted. If target has been found, stop searching while next item is not the one we are searching
+                        break;
+                    }
+                }
+                is_found_target = KAL_TRUE;
+                
+                if(mcf_find_gid_offset(pItem->global_id, array_tag, &item_lid, &item_byte_offset, &item_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                    goto next;
+                }
+
+                /* Update LID item */
+                if (item_is_bit == 0) {
+                    if (pItem->value_len > item_size) {
+                        MD_TRC_MCF_TR_READ_OTA_BUFFER_LARGE_VAL_LEN(pItem->value_len, item_size);
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_LARGE_VAL_LEN, pItem->value_len, item_size);
+                        mcf_utfwk_printf("Invalid value len(%d)!! larger than current item len(%d) \r\n",  pItem->value_len, item_size);
+
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_READ_OTA_BUFFER_BYTE_UPDATE(lid, item_byte_offset, pItem->value_len);
+                    if (kal_query_systemInit() == KAL_TRUE){
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_GID_ARRAY_INDEX, pItem->global_id, array_tag);
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_BYTE_UPDATE, lid, item_byte_offset, pItem->value_len);
+                        mcf_dump_data(KAL_TRUE, &(pItem->buff_start) + pItem->array_index_len, pItem->value_len);
+                    }
+                    mcf_dump_data(KAL_FALSE, &(pItem->buff_start) + pItem->array_index_len, pItem->value_len);
+
+                    kal_mem_cpy( (buffer + item_byte_offset), &(pItem->buff_start) + pItem->array_index_len, pItem->value_len);
+					nv_int_info.update_general_tlvota_result = KAL_TRUE;
+                } else {
+                    kal_uint32 bit_value = 0;
+                    kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(item_size);
+					kal_uint32 offset = 0;
+					kal_uint32 var_size = 1;
+					kal_uint32 val_tmp = 0;
+
+                    kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->array_index_len, pItem->value_len);
+
+
+                    if (pItem->value_len > 4) {
+                        MD_TRC_MCF_TR_READ_OTA_BUFFER_INVALID_BIT_LEN(pItem->value_len, item_size, pItem->value_len);
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_INVALID_BIT_LEN, item_size, item_size, pItem->value_len);
+                        mcf_utfwk_printf("Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d) \r\n",  item_size, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_READ_OTA_BUFFER_BIT_UPDATE(lid, item_byte_offset, item_bit_offset, item_size, bit_value);
+                    if (kal_query_systemInit() == KAL_TRUE){
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_GID_ARRAY_INDEX, pItem->global_id, array_tag);                       
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_BIT_UPDATE, lid, item_byte_offset, item_bit_offset, item_size, bit_value);
+                    }
+                    
+                    if (item_size > 8 && item_size <= 16) {
+                        var_size = 2;
+                    }else if (item_size > 16 && item_size <= 24) {
+                        var_size = 3;
+                    }else if (item_size > 24 && item_size <= 32) {
+                        var_size = 4;
+                    }
+
+                    if (item_bit_offset > 0 && item_bit_offset < 8) {
+                        offset = 0;
+                    }else if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        offset = 1;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        offset = 2;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        offset = 3;
+                    }else if (item_bit_offset >= 32){
+                        MD_TRC_MCF_TR_READ_OTA_BUFFER_INVALID_BIT_OFFSET(item_bit_offset, item_size, pItem->value_len);
+                        mcf_utfwk_printf("Invalid item_bit_offset(%d)!! current item len(%d), bit_value_len(%d) \r\n",  item_bit_offset, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    if (item_bit_offset > 0) {
+                        if ((item_bit_offset) / 8 != (item_size + item_bit_offset) / 8) {
+                            var_size += ((item_size + item_bit_offset) / 8 - item_bit_offset / 8);
+                        }
+                    }
+                    
+                    if (var_size > 4) {
+                        MD_TRC_MCF_TR_READ_OTA_BUFFER_INVALID_BIT_LEN(var_size, item_size, pItem->value_len);
+                        mcf_utfwk_printf("Invalid bit_len(%d)!! current item len(%d), bit_value_len(%d) \r\n", var_size, item_size, pItem->value_len);
+                        goto next;
+                    }
+
+                    if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        item_bit_offset -= 8;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        item_bit_offset -= 16;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        item_bit_offset -= 24;
+                    }
+
+
+                    kal_mem_cpy(&val_tmp, buffer + item_byte_offset + offset, var_size);
+                    val_tmp &= ~(bit_mask << item_bit_offset);
+                    val_tmp |= (bit_value << item_bit_offset);
+
+                    kal_mem_cpy(buffer + item_byte_offset + offset, &val_tmp, var_size);
+					nv_int_info.update_general_tlvota_result = KAL_TRUE;
+                }
+
+        next:
+                pItem = (mcf_tool_gid_ota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+                item_cnt++;
+            }
+            MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+        }
+    } else {
+        MD_TRC_MCF_TR_READ_OTA_BUFFER_TAKE_READ_LOCK_FAIL(lid);
+        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_BUFFER_TAKE_READ_LOCK_FAIL, lid);
+        mcf_utfwk_printf("Fail to take read lock!! LID(%d)!! \r\n",  lid);
+        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+    }
+    
+    // calculate total duration when boot up
+    if (kal_query_systemInit() == KAL_TRUE){
+        com_Mcf.ota_api_duration += CALCULATE_LETENCY_DURATION(start_time, GET_CURRENT_TIME());
+    }
+    MD_TRC_MCF_TR_READ_OTA_BUFFER_DURATION(lid, record_idx, CALCULATE_LETENCY_DURATION(start_time, GET_CURRENT_TIME()));
+
+    return ret;
+}
+
+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)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t               *pFile;
+    mcf_tool_gid_tlvota_file_item_t    *pItem;
+    sim_interface_enum                  sim_id = l4c_gemini_get_actual_sim_id(ps_id);
+    mcf_tlvota_file_t                  *tlvota_file = &(pMcf->general_tlvota_file);
+    nvram_ltable_entry_struct           lid_info = {0};
+    nvram_errno_enum                    nvram_api_ret;
+    mcf_ota_result_e                    ret = MCF_OTA_R_SUCCESS;
+    kal_char                            array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_uint16                          item_byte_offset;
+    kal_uint16                          item_bit_offset;
+    kal_uint32                          item_size;
+    kal_bool                            item_is_bit = KAL_FALSE;
+    kal_uint16                          item_lid;
+    kal_uint16                          item_cnt = 0;
+
+    if (!buffer || (size < 0) || !tag.tag) {
+        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_INVALID_PARA(ps_id, lid, buffer, size, tag.tag);
+        ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return ret;
+    }
+    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_START_USIR(ps_id, sim_id, lid, buffer, size, tag.tag);
+
+    MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff); 
+
+        /* Check if file type is TLV-OTA file */
+        if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+            kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+            mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_INVALID_FILE(str_tmp);
+            ret = MCF_OTA_R_INVALID_FILE;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        nvram_api_ret = nvram_external_get_lid_info(lid, &lid_info);
+        if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_GET_LID_INFO_FAIL(lid, nvram_api_ret);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        if (size != lid_info.size) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_INVALID_SIZE(size, lid, lid_info.size);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+
+        if ( (lid_info.attr & NVRAM_ATTR_MCF_OTA_BY_OP) == 0 ) {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_ATTR_NOT_SET(lid, lid_info.attr);
+            ret = MCF_OTA_R_INVALID_ATTR;
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+            return ret;
+        }
+        /*MCF 1.0 read tlvota buffer update flow */
+        if (pFile->file_version == 2){
+            mcf_v1_read_tlvota_buffer(tlvota_file, tag, lid, buffer);
+        }
+        else if (pFile->file_version == 3){
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + pFile->total_len);
+            /* Read changed items from TLV-OTA file */
+            while (item_cnt < pFile->item_num) {
+                /* Check if array_index_len is valid */
+                if ( (pItem->array_index_len < 0) || (pItem->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_INVALID_ARRAY_INDEX_LEN(pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                    goto next;
+                }
+                strncpy(array_tag, &(pItem->buff_start)+pItem->tag_len, pItem->array_index_len);
+                array_tag[pItem->array_index_len] = '\0';
+                
+                /* Find GID corresponding LID */
+                item_lid = mcf_find_gid_return_lid_num(pItem->global_id);
+                if (item_lid == 65535){
+                    //-1(65535) means not found
+                    goto next;
+                }
+
+                /* Check if LID and tag match */
+                if ( (item_lid != lid) || (pItem->tag_type != tag.tag_type) || (strncmp(&(pItem->buff_start), tag.tag, pItem->tag_len) != 0) ) {
+                    goto next;
+                }
+                
+                
+                if(mcf_find_gid_offset(pItem->global_id, array_tag, &item_lid, &item_byte_offset, &item_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                    goto next;
+                }
+
+                /* Update LID item */
+                if (item_is_bit == 0) {
+                    if (pItem->value_len > item_size) {
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_LARGE_VAL_LEN(pItem->value_len, item_size);
+
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_BYTE_UPDATE_USIR(lid, tag.tag, item_byte_offset, pItem->value_len);
+                    mcf_dump_data(KAL_FALSE, &(pItem->buff_start) + pItem->tag_len + pItem->array_index_len, pItem->value_len);
+
+                    kal_mem_cpy( (buffer + item_byte_offset), &(pItem->buff_start) + pItem->tag_len + pItem->array_index_len, pItem->value_len);
+                } else {
+                    kal_uint32 bit_value = 0;
+                    kal_uint32 bit_mask = (kal_uint32)MCF_GEN_BIT_MASK(item_size);
+					kal_uint32 offset = 0;
+					kal_uint32 var_size = 1;
+					kal_uint32 val_tmp = 0;
+
+                    kal_mem_cpy(&bit_value, &(pItem->buff_start) + pItem->tag_len + pItem->array_index_len, pItem->value_len);
+
+                    if (pItem->value_len > 4) {
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_INVALID_BIT_LEN(pItem->value_len, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_BIT_UPDATE_USIR(lid, tag.tag, item_byte_offset, item_bit_offset, item_size, bit_value);
+
+                    if (item_size > 8 && item_size <= 16) {
+                        var_size = 2;
+                    }else if (item_size > 16 && item_size <= 24) {
+                        var_size = 3;
+                    }else if (item_size > 24 && item_size <= 32) {
+                        var_size = 4;
+                    }
+
+                    if (item_bit_offset > 0 && item_bit_offset < 8) {
+                        offset = 0;
+                    }else if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        offset = 1;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        offset = 2;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        offset = 3;
+                    }else if (item_bit_offset >= 32){
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_INVALID_BIT_OFFSET(item_bit_offset, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    if (item_bit_offset > 0) {
+                        if ((item_bit_offset) / 8 != (item_size + item_bit_offset) / 8) {
+                            var_size += ((item_size + item_bit_offset) / 8 - item_bit_offset / 8);
+                        }
+                    }
+                    if(var_size > 4){
+                        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_INVALID_BIT_LEN(var_size, item_size, pItem->value_len);
+
+                        goto next;
+                    }
+
+                    if (item_bit_offset >= 8 && item_bit_offset < 16) {
+                        item_bit_offset -= 8;
+                    }else if (item_bit_offset >= 16 && item_bit_offset < 24) {
+                        item_bit_offset -= 16;
+                    }else if (item_bit_offset >= 24 && item_bit_offset < 32) {
+                        item_bit_offset -= 24;
+                    }
+
+
+                    kal_mem_cpy(&val_tmp, buffer + item_byte_offset + offset, var_size);
+                    val_tmp &= ~(bit_mask << item_bit_offset);
+                    val_tmp |= (bit_value << item_bit_offset);
+
+                    kal_mem_cpy(buffer + item_byte_offset + offset, &val_tmp, var_size);
+                }
+
+        next:
+                pItem = (mcf_tool_gid_tlvota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+                item_cnt++;
+            }
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }
+    } else {
+        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_TAKE_READ_LOCK_FAIL();
+        ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+    }
+
+    return ret;
+}
+
+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)
+{
+    mcf_ota_result_e                    tlvota_ret = MCF_OTA_R_MAX;
+    mcf_ota_result_e                    ret = MCF_OTA_R_MAX;
+    mcf_tlvota_tag_t                    tag_entry[6];
+    kal_uint32                          tag_num = 0;
+    kal_char                            tag[6][MCF_MAX_TAG_LEN];
+    mcf_t                              *pMcf = mcf_get_instance();
+    sim_interface_enum                  sim_id = l4c_gemini_get_actual_sim_id(ps_id);
+    mcf_tlvota_file_t                  *tlvota_file = &(pMcf->tlvota_file[sim_id]);
+    mcf_tlvota_tag_t                    iccid_tag;
+    kal_char                            iccid[21];
+    kal_int32                           ret_snprintf;
+    kal_uint32                          start_time = GET_CURRENT_TIME();
+    
+    kal_mem_set(tag, 0, sizeof(kal_char) * 6 * MCF_MAX_TAG_LEN);
+
+    if (!(buffer && (size > 0))) {
+        MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_INVALID_PARA(ps_id, lid, buffer, size);
+        ret = MCF_OTA_R_INVALID_PARAMETER;
+        mcf_utfwk_printf("Invalid parameters!! ps_id(%d), LID(%d), buffer(%x), size(%d) \r\n", ps_id, lid, buffer, size);
+
+        return ret;
+    }
+    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_START(ps_id, lid, buffer, size, sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+
+    /* Fill tag entry */
+    if (sbp_tag.sbp_id != SBP_ID_INVALID) {
+        if (strcmp((kal_char *)sbp_tag.mcc, "") != 0) {
+            if (strcmp((kal_char *)sbp_tag.mnc, "") != 0) { // sbpid_mcc_mnc case
+                /* NA_NA_NA, NA_mcc_NA and NA_mcc_mnc case should be updated first */
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+                
+                /* NA_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* NA_mcc_mnc */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_%s", (kal_char *)sbp_tag.mcc, (kal_char *)sbp_tag.mnc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_mcc_mnc", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                tlvota_ret = mcf_read_tlvota_buffer_multi_tag(ps_id, tag_entry, tag_num, lid, buffer, size);
+
+                /* Reuse tag_entry */
+                tag_num = 0;
+
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+                
+                /* sbpid_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_NA_NA", sbp_tag.sbp_id);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "SBP_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* sbpid_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_%s_NA", sbp_tag.sbp_id, sbp_tag.mcc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "SBP_mcc_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* sbpid_mcc_mnc */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_%s_%s", sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "SBP_mcc_mnc", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            } else { // sbpid_mcc_NA case
+                /* NA_NA_NA and NA_mcc_NA case should be updated first */
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+                
+                /* NA_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                tlvota_ret = mcf_read_tlvota_buffer_multi_tag(ps_id, tag_entry, tag_num, lid, buffer, size);
+
+                /* Reuse tag_entry */
+                tag_num = 0;
+
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+                
+                /* sbpid_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_NA_NA", sbp_tag.sbp_id);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "SBP_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* sbpid_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_%s_NA", sbp_tag.sbp_id, sbp_tag.mcc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "SBP_mcc_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            }
+        } else {
+            if (strcmp((kal_char *)sbp_tag.mnc, "") == 0) { // sbpid_NA_NA case
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                tlvota_ret = mcf_read_tlvota_buffer_multi_tag(ps_id, tag_entry, tag_num, lid, buffer, size);
+
+                /* Reuse tag_entry */
+                tag_num = 0;
+
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+                
+                /* sbpid_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_NA_NA", sbp_tag.sbp_id);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "SBP_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            } else { // sbpid_NA_mnc case is not allowed!!
+                MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_INVALID_SBP_TAG(sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                ret = MCF_OTA_R_INVALID_SBP_TAG;
+
+                return ret;
+            }
+        }
+    } else {
+        if (strcmp((kal_char *)sbp_tag.mcc, "") != 0) {
+            if (strcmp((kal_char *)sbp_tag.mnc, "") != 0) { // NA_mcc_mnc case
+                /* NA_NA_NA, NA_mcc_NA and NA_mcc_mnc case should be updated first */
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+                
+                /* NA_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* NA_mcc_mnc */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_%s", (kal_char *)sbp_tag.mcc, (kal_char *)sbp_tag.mnc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_mcc_mnc", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                tlvota_ret = mcf_read_tlvota_buffer_multi_tag(ps_id, tag_entry, tag_num, lid, buffer, size);
+
+                /* Reuse tag_entry */
+                tag_num = 0;
+                
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            } else { // NA_mcc_NA case
+                /* NA_mcc_NA and NA_mcc_mnc case should be updated first */
+                /* NA_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+                
+                
+                /* NA_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_mcc_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                tlvota_ret = mcf_read_tlvota_buffer_multi_tag(ps_id, tag_entry, tag_num, lid, buffer, size);
+
+                /* Reuse tag_entry */
+                tag_num = 0;
+                
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                ret_snprintf = kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                if(ret_snprintf < 0 || ret_snprintf > MCF_MAX_TAG_LEN){
+                    strncpy(tag[tag_num], "NA_NA_NA", MCF_MAX_TAG_LEN - 1);
+                    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_SNPRINTF_FAIL(tag[tag_num], sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                }
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            }
+        } else { // NA_NA_mnc cases is not allowed!!
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_INVALID_SBP_TAG(sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+            mcf_utfwk_printf("Invalid SBP tag!! sbp_id(%d), mcc(%s), mnc(%d) \r\n", sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+            ret = MCF_OTA_R_INVALID_SBP_TAG;
+
+            return ret;
+        }
+    }
+
+    ret = mcf_read_tlvota_buffer_sbp_multi_tag(ps_id, tag_entry, tag_num, lid, buffer, size);
+    
+    /*If general TLV-OTA is iccid tag, need to call read_tlv_ota_buffer to update OTA file with iccid tag*/
+    
+    if (com_Mcf.is_iccid == KAL_TRUE){
+        kal_mem_set(&iccid_tag, 0, sizeof(mcf_tlvota_tag_t));
+        iccid_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+        
+        MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file){
+            kal_mem_cpy(&iccid, tlvota_file->iccid, 21);
+            iccid_tag.tag = iccid;
+            iccid_tag.tag_len = strlen((kal_char *)tlvota_file->iccid);
+            
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }else {
+            MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_TAKE_READ_LOCK_FAIL();
+            ret = MCF_OTA_R_TAKE_READ_LOCK_FAIL;
+            return ret;
+        }
+        ret = mcf_read_tlvota_buffer(ps_id, iccid_tag, lid, buffer, size);
+    }
+    
+    if ( (tlvota_ret == MCF_OTA_R_SUCCESS) || (ret == MCF_OTA_R_SUCCESS) ) {
+        ret = MCF_OTA_R_SUCCESS;
+    }
+    
+    MD_TRC_MCF_TR_READ_TLVOTA_BUFFER_SBP_DURATION(lid, ps_id, CALCULATE_LETENCY_DURATION(start_time, GET_CURRENT_TIME()));
+
+    return ret;
+}
+
+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)
+{
+    mcf_ota_result_e    ret = MCF_OTA_R_SUCCESS;
+
+    if (!(buffer && (size > 0))) {
+        MD_TRC_MCF_TR_READ_NVRAM_TLVOTA_BUFFER_SBP_INVALID_PARA(ps_id, lid, buffer, size);
+        ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return ret;
+    }
+    MD_TRC_MCF_TR_READ_NVRAM_TLVOTA_BUFFER_SBP_START(ps_id, lid, record_idx, buffer, size, sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+
+    if ( !nvram_external_read_data(lid, record_idx, buffer, size)) {
+        ret = MCF_OTA_R_READ_NVRAM_FAIL;
+
+        return ret;
+    }
+
+    ret = mcf_read_tlvota_buffer_sbp_tag(ps_id, sbp_tag, lid, buffer, size);
+
+    return ret;
+}
+
+kal_bool mcf_custom_dump_mcf_data(mcf_custom_dump_param_struct *param_ptr)
+{
+    kal_bool ret = KAL_TRUE;
+    sim_interface_enum sim_slot_id  = 0;
+
+    switch (param_ptr->lid)
+    {
+        case NVRAM_EF_MCF_TEST_OTA_LID:
+        {
+            mcf_tlvota_sbp_tag_t    sbp_tag = {0};
+            mcf_ota_result_e        mcf_ret;
+
+            if (param_ptr->type == MCF_TYPE_OTA_BY_OP) {
+                *(param_ptr->size) = sizeof(nvram_ef_mcf_test_struct);
+                sbp_tag.sbp_id = param_ptr->sbp_id;
+                kal_mem_cpy(sbp_tag.mcc, param_ptr->mcc, MAX_MCC_STR_LEN);
+                kal_mem_cpy(sbp_tag.mnc, param_ptr->mnc, MAX_MNC_STR_LEN);
+
+                /* Record_id = sim_id + 1 */
+                sim_slot_id = l4c_gemini_get_actual_sim_id(param_ptr->ps_id);
+                
+                if (!nvram_external_read_data(param_ptr->lid, sim_slot_id + 1, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct))) {
+                    MD_TRC_MCF_TR_DUMP_MCF_LID_READ_NVRAM_FAIL(param_ptr->lid, sim_slot_id + 1, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct));
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+
+                mcf_ret = mcf_read_tlvota_buffer_sbp_tag(param_ptr->ps_id, sbp_tag, param_ptr->lid, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct));
+                if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                    MD_TRC_MCF_TR_DUMP_MCF_LID_FAIL(param_ptr->lid, mcf_ret);
+                }
+            } else {
+                MD_TRC_MCF_TR_DUMP_MCF_LID_INVALID_TYPE(param_ptr->lid, param_ptr->type);
+                ret = KAL_FALSE;
+            }
+            break;
+        }
+
+        case NVRAM_EF_MCF_TEST_OTA_QUERY_LID:
+        {
+            mcf_tlvota_sbp_tag_t    sbp_tag = {0};
+            mcf_ota_result_e        mcf_ret;
+
+            switch (param_ptr->type)
+            {
+                case MCF_TYPE_OTA:
+                    *(param_ptr->size) = sizeof(nvram_ef_mcf_test_struct);
+                    if (!nvram_external_read_data(param_ptr->lid, param_ptr->record_idx, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct))) {
+                        MD_TRC_MCF_TR_DUMP_MCF_LID_READ_NVRAM_FAIL(param_ptr->lid, param_ptr->record_idx, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct));
+                        ret = KAL_FALSE;
+                        return ret;
+                    }
+
+                    mcf_ret = mcf_read_ota_buffer(param_ptr->lid, param_ptr->record_idx, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct));
+                    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                        MD_TRC_MCF_TR_DUMP_MCF_LID_QUERY_MCF_FAIL(param_ptr->lid, param_ptr->record_idx, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct));
+                    }
+
+                    break;
+
+                case MCF_TYPE_OTA_BY_OP:
+                    *(param_ptr->size) = sizeof(nvram_ef_mcf_test_struct);
+                    sbp_tag.sbp_id = param_ptr->sbp_id;
+                    kal_mem_cpy(sbp_tag.mcc, param_ptr->mcc, MAX_MCC_STR_LEN);
+                    kal_mem_cpy(sbp_tag.mnc, param_ptr->mnc, MAX_MNC_STR_LEN);
+
+                    if (!nvram_external_read_data(param_ptr->lid, param_ptr->ps_id + 1, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct))) {
+                        MD_TRC_MCF_TR_DUMP_MCF_LID_READ_NVRAM_FAIL(param_ptr->lid, param_ptr->ps_id + 1, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct));
+                        ret = KAL_FALSE;
+                        return ret;
+                    }
+                    /* Record_id = sim_id + 1 */
+                    sim_slot_id = l4c_gemini_get_actual_sim_id(param_ptr->ps_id);
+                    mcf_ret = mcf_read_ota_buffer(param_ptr->lid, sim_slot_id+1, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct));
+                    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                        MD_TRC_MCF_TR_DUMP_MCF_LID_QUERY_MCF_FAIL(param_ptr->lid, sim_slot_id+1, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct));
+                    }
+                    
+                    mcf_ret = mcf_read_tlvota_buffer_sbp_tag(param_ptr->ps_id, sbp_tag, param_ptr->lid, param_ptr->buffer, sizeof(nvram_ef_mcf_test_struct));
+                    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+                        MD_TRC_MCF_TR_DUMP_MCF_LID_FAIL(param_ptr->lid, mcf_ret);
+                    }
+
+                    break;
+
+                default:
+                    MD_TRC_MCF_TR_DUMP_MCF_LID_INVALID_TYPE(param_ptr->lid, param_ptr->type);
+                    ret =  KAL_FALSE;
+                    break;
+            }
+            break;
+        }
+
+        default:
+            MD_TRC_MCF_TR_DUMP_MCF_LID_UNKNOWN_LID(param_ptr->lid);
+            ret =  KAL_FALSE;
+            break;
+    }
+
+    return ret;
+}
+
+kal_bool mcf_auto_select_tlvota_file(sbp_reconfig_custom_param_struct *param_ptr)
+{
+    mcf_t                                  *pMcf = &mcf_inst_g;
+    sim_interface_enum                      sim_id = l4c_gemini_get_actual_sim_id(param_ptr->ps_id);
+    mcf_tlvota_file_t                      *tlvota_file;
+    kal_char                                file_name[MCF_FILE_MAX_NAME_LEN];
+    kal_char                                apply_filename[MCF_FILE_MAX_NAME_LEN];
+    kal_wchar                               fs_filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+    kal_char                                file_path[MCF_FILE_MAX_MD_PATH_LEN];
+    l4c_mcf_path_type_enum                  apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+    em_mcf_read_ota_file_info_struct        read_file_info = {0};
+    FS_FileDetail                           fs_file_detail[L4C_MCF_PATH_TYPE_MAX] = {0};
+    mcf_ota_result_e                        mcf_ret;
+    mcf_ota_result_e                        gen_mcf_ret;
+    kal_bool                                ret = KAL_TRUE;
+    kal_bool                                gen_ret = KAL_TRUE;
+    kal_int32                               fs_api_ret[L4C_MCF_PATH_TYPE_MAX];
+    kal_uint32                              i;
+    kal_uint32                              ret_sprintf;
+    mcf_tool_file_info_t                   *pFile;
+    mcf_tlvota_sbp_tag_t                    sbp_tag;
+    kal_bool                                is_read_nvram = KAL_FALSE;
+    kal_char                                tool_version[MCF_FILE_MAX_TOOL_VERSION_LEN]={0};
+    mcf_ota_result_e                        tlvota_ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+    kal_uint64                              last_mod_time = 0;
+    kal_uint32                              start_time = GET_CURRENT_TIME();
+
+    MD_TRC_MCF_TR_AUTO_SELECT_BIN_START(param_ptr->ps_id, sim_id, param_ptr->sbp_id, param_ptr->mcc, param_ptr->mnc);
+    
+    if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+        MD_TRC_MCF_TR_AUTO_SELECT_BIN_FILE_INVALID_SIM_ID(param_ptr->ps_id, sim_id);
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+        ret = KAL_FALSE;
+
+        return ret;
+    }
+
+    tlvota_file = &(pMcf->tlvota_file[sim_id]);
+    
+    sbp_tag.sbp_id = param_ptr->sbp_id;
+    kal_mem_cpy(sbp_tag.mcc, param_ptr->mcc, MAX_MCC_STR_LEN);
+    kal_mem_cpy(sbp_tag.mnc, param_ptr->mnc, MAX_MNC_STR_LEN);
+    
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g[sim_id], 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g[sim_id], 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_general_tlvota_last_mod_lid_g[sim_id], 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_general_tlvota_curr_mod_lid_g[sim_id], 0, sizeof(nvram_mcf_lid_info_struct));
+    
+    
+    if (pMcf->is_ignore_dsbp[sim_id] == KAL_TRUE) {
+		/* Read MCF General TLV-OTA info into cache buffer */
+		if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+			MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_LID_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+			ret = KAL_FALSE;
+		}
+		is_read_nvram = KAL_TRUE;
+		
+		if(is_read_tlvota[sim_id] == KAL_TRUE){
+			kal_mem_cpy(&mcf_tlvota_last_mod_lid_g[sim_id], &nv_int_info.tlvota_last_mod_lid[sim_id], sizeof(nvram_mcf_lid_info_struct));
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)	
+			if(mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_FALSE) != MCF_OTA_R_SUCCESS){
+				ret = KAL_FALSE;
+			}
+#else
+			if(mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_FALSE, nv_int_info.not_reset_tlvota[sim_id], KAL_FALSE) != MCF_OTA_R_SUCCESS){
+				ret = KAL_FALSE;
+			}
+#endif
+			is_update_tlvota[sim_id] = KAL_TRUE;
+		}
+	}
+    
+    if (pMcf->general_is_ignore_dsbp == KAL_TRUE) {
+		/* Read MCF General TLV-OTA info into cache buffer */
+		if(is_read_nvram == KAL_FALSE){
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+                MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_LID_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+                ret = KAL_FALSE;
+            }
+            is_read_nvram = KAL_TRUE;
+        }
+		
+		if(is_read_general_tlvota[sim_id] == KAL_TRUE){
+			kal_mem_cpy(&mcf_general_tlvota_last_mod_lid_g[sim_id], &nv_int_info.general_tlvota_last_mod_lid[sim_id], sizeof(nvram_mcf_lid_info_struct));
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)			
+			if(mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_TRUE) != MCF_OTA_R_SUCCESS){
+				ret = KAL_FALSE;
+			}
+#else
+			if(mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_TRUE, nv_int_info.not_reset_general_tlvota, KAL_FALSE) != MCF_OTA_R_SUCCESS){
+				ret = KAL_FALSE;
+			}
+#endif
+			is_update_tlvota[sim_id] = KAL_TRUE;
+		}
+	}
+    
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file){
+        tlvota_file->sbp_id = param_ptr->sbp_id;
+        tlvota_file->ps_id = param_ptr->ps_id;
+        kal_mem_cpy(tlvota_file->mcc, param_ptr->mcc, MAX_MCC_STR_LEN);
+        kal_mem_cpy(tlvota_file->mnc, param_ptr->mnc, MAX_MNC_STR_LEN);
+        kal_mem_cpy(tlvota_file->iccid, param_ptr->iccid, 21);
+        
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+        // Check if need to auto select TLV-OTA file
+        if (pMcf->is_ignore_dsbp[sim_id] == KAL_TRUE) {
+            MD_TRC_MCF_TR_AUTO_SELECT_BIN_FILE_NO_NEED(pMcf->is_ignore_dsbp[sim_id]);
+            com_Mcf.tlvota_result[sim_id] = set_op_read_ret[sim_id];
+            goto read_gengeral_opota;
+        }
+    }else {
+        MD_TRC_MCF_TR_AUTO_SELECT_BIN_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL();
+        ret = KAL_FALSE;
+
+        // Check if need to auto select TLV-OTA file
+        if (pMcf->is_ignore_dsbp[sim_id] == KAL_TRUE) {
+            MD_TRC_MCF_TR_AUTO_SELECT_BIN_FILE_NO_NEED(pMcf->is_ignore_dsbp[sim_id]);
+            com_Mcf.tlvota_result[sim_id] = set_op_read_ret[sim_id];
+            goto read_gengeral_opota;
+        }
+
+        goto read_gengeral_opota;
+    }
+
+    ret_sprintf = kal_snprintf(file_name, MCF_FILE_MAX_NAME_LEN - 1, "%s_%d.mcfopota%c", MCF_FS_TLVOTA_FILE_PREFIX, tlvota_file->sbp_id, '\0');
+    if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_NAME_LEN){
+        MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_TLVOTA_FILE_FILENAME_ERROR(tlvota_file->sbp_id, ret_sprintf);
+        ret = KAL_FALSE;
+        return ret;
+    }
+
+    /* Compare modified time of OP-OTA file to select which file to be applied */
+    kal_wsprintf(fs_filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, file_name);
+    fs_api_ret[L4C_MCF_PATH_TYPE_OTA] = FS_GetFileDetail(fs_filename, &fs_file_detail[L4C_MCF_PATH_TYPE_OTA]);
+    MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_FILE_MODIFIED_TIME(tlvota_file->sbp_id, L4C_MCF_PATH_TYPE_OTA, fs_api_ret[L4C_MCF_PATH_TYPE_OTA],
+                    (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime & 0xFFFFFFFF));
+    if (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] != FS_NO_ERROR) {
+        kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_OTA], 0, sizeof(FS_FileDetail));
+    }
+
+    kal_wsprintf(fs_filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, file_name);
+    fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] = FS_GetFileDetail(fs_filename, &fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME]);
+    MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_FILE_MODIFIED_TIME(tlvota_file->sbp_id, L4C_MCF_PATH_TYPE_RUNTIME, fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME],
+                    (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime & 0xFFFFFFFF));
+    if (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] != FS_NO_ERROR) {
+        kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME], 0, sizeof(FS_FileDetail));
+    }
+
+    if ( (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] == FS_NO_ERROR) || (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] == FS_NO_ERROR) ) {
+        if (fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime > fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime) {
+            ret_sprintf = kal_snprintf(file_path, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s%c", MCF_FS_DEFAULT_FOLDER_PATH, '\0');
+            if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                strncpy(file_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN-1);
+                file_path[MCF_FILE_MAX_MD_PATH_LEN-1] = '\0';
+            }
+            last_mod_time = fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime;
+        } else {
+            ret_sprintf = kal_snprintf(file_path, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s%c", MCF_FS_CUSTOM_FOLDER_PATH, '\0');
+            if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                strncpy(file_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN-1);
+                file_path[MCF_FILE_MAX_MD_PATH_LEN-1] = '\0';
+            }
+            last_mod_time = fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime;
+        }
+    } else {
+        MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_FILE_COMPARE_FAIL();
+        ret = KAL_FALSE;
+        tlvota_ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+        goto read_gengeral_opota;
+    }
+
+    read_file_info.trigger_type = EM_MCF_TRIGGER_TYPE_BY_SIM;
+    read_file_info.config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+    read_file_info.ps_id = tlvota_file->ps_id;
+    read_file_info.start_time = kal_get_systicks();
+
+    // last updated file information
+    mcf_make_file_info(&old_file_info, tlvota_file->last_file.path_type, tlvota_file->last_file.name, tlvota_file->last_file.sw_version, tlvota_file->last_file.sw_version_len, tlvota_file->last_file.gen_time, tlvota_file->last_file.gen_time_len, tlvota_file->last_file.last_mod_time, tlvota_file->last_file.checksum);
+    
+    mcf_ret = mcf_read_tlvota_file(KAL_FALSE, sim_id, file_path, file_name, &apply_path_type, apply_filename, pMcf);
+    tlvota_ret = mcf_ret;
+
+
+    if (mcf_ret == MCF_OTA_R_SUCCESS) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+        
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file){
+            // current updated file information
+            mcf_make_file_info(&new_file_info, apply_path_type, apply_filename, &(pFile->buff_start), pFile->sw_version_len, (&(pFile->buff_start) + pFile->sw_version_len), pFile->gen_time_len, last_mod_time, pFile->checksum);
+            /* Check TLV-OTA is need update */
+            if (mcf_compare_file_info(&old_file_info, &new_file_info) == KAL_FALSE){
+                // Need to update TLV-OTA file
+                com_Mcf.update_tlvota[sim_id] = KAL_TRUE;
+                
+                /* Do not reset LIDs if the same file as last one */
+                is_read_tlvota[sim_id] = KAL_TRUE;
+                
+                /* Store last updated file informantion */
+                /* Store TLV-OTA file information */
+                tlvota_file->last_file.path_type = apply_path_type;
+                strncpy(tlvota_file->last_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+                if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+                    strncpy(tlvota_file->last_file.sw_version, &(pFile->buff_start), pFile->sw_version_len);
+                    tlvota_file->last_file.sw_version[pFile->sw_version_len] = '\0';
+                    tlvota_file->last_file.sw_version_len = pFile->sw_version_len;
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_FILE_SW_VERSION(tlvota_file->last_file.sw_version);
+                } else {
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_INVALID_SW_VERSION(pFile->sw_version_len);
+                }
+                if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+                    strncpy(tlvota_file->last_file.gen_time, &(pFile->buff_start) + pFile->sw_version_len, pFile->gen_time_len);
+                    tlvota_file->last_file.gen_time[pFile->gen_time_len] = '\0';
+                    tlvota_file->last_file.gen_time_len = pFile->gen_time_len;
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_FILE_GEN_TIME(tlvota_file->last_file.gen_time);
+                } else {
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_INVALID_GEN_TIME(pFile->gen_time_len);
+                }
+                if (pFile->tool_version_len < MCF_FILE_MAX_TOOL_VERSION_LEN && pFile->tool_version_len > 0) {
+                    strncpy(tool_version, (&(pFile->buff_start) + pFile->sw_version_len + pFile->gen_time_len), pFile->tool_version_len);
+                    tool_version[pFile->tool_version_len] = '\0';
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_FILE_TOOL_VERSION(tool_version);
+                } else if (pFile->tool_version_len >= MCF_FILE_MAX_TOOL_VERSION_LEN){
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_INVALID_TOOL_VERSION(pFile->tool_version_len);
+                }
+
+                tlvota_file->last_file.checksum = pFile->checksum;
+                tlvota_file->last_file.last_mod_time = last_mod_time;
+                tlvota_file->last_file.sw_version_len = pFile->sw_version_len;
+                tlvota_file->last_file.gen_time_len = pFile->gen_time_len;
+            }else{
+                if (com_Mcf.update_tlvota[sim_id] != KAL_TRUE){
+                    tlvota_ret = mcf_ret;
+                    
+                    //TLV-OTA file does not change. No need to trigger dsbp.
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_TLVOTA_FILE_NOT_CHANGE(apply_path_type, com_Mcf.update_tlvota[sim_id]);
+                }
+            }
+            /* Check if file type is TLV-OTA file */
+            if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+                kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+                mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+                MD_TRC_MCF_TR_AUTO_SELECT_BIN_INVALID_FILE(str_tmp);
+                tlvota_ret = MCF_OTA_R_INVALID_FILE;
+            }
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }
+        read_file_info.path_type = apply_path_type;
+        strncpy(read_file_info.file_name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+    } else {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+        /* Store last updated file informantion */
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file){
+            mcf_make_file_info(&new_file_info, apply_path_type, apply_filename, &(pFile->buff_start), pFile->sw_version_len, (&(pFile->buff_start) + pFile->sw_version_len), pFile->gen_time_len, last_mod_time, pFile->checksum);
+            /* Check TLV-OTA is need update */
+            if (mcf_compare_file_info(&old_file_info, &new_file_info) == KAL_FALSE){
+                com_Mcf.update_tlvota[sim_id] = KAL_TRUE;
+            }
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }
+        MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_FILE_FAIL(mcf_ret);
+        ret = KAL_FALSE;
+    }
+    
+    read_file_info.result = mcf_ret;
+    read_file_info.end_time = kal_get_systicks();
+
+    mcf_em_send_ota_file_info(&read_file_info);
+
+    com_Mcf.tlvota_result[sim_id] = tlvota_ret;
+    
+read_gengeral_opota:
+    // TODO: general OP-OTA file CHR implementation
+
+    // Check if need to auto select TLV-OTA file
+    if (pMcf->general_is_ignore_dsbp == KAL_TRUE) {
+        MD_TRC_MCF_TR_AUTO_SELECT_BIN_GENERAL_TLVOTA_FILE_NO_NEED(pMcf->general_is_ignore_dsbp);
+        return ret;
+    }
+    tlvota_file = &(pMcf->general_tlvota_file);
+    ret_sprintf = kal_snprintf(file_name, MCF_FILE_MAX_NAME_LEN - 1, "%s%c", MCF_FS_GENERAL_TLVOTA_FILE_NAME, '\0');
+    if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_NAME_LEN){
+        strncpy(file_name, MCF_FS_GENERAL_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN-1);
+        file_name[MCF_FILE_MAX_NAME_LEN-1] = '\0';
+    }
+
+    /* Compare modified time of general OP-OTA file to select which file to be applied */
+    kal_wsprintf(fs_filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, file_name);
+    fs_api_ret[L4C_MCF_PATH_TYPE_OTA] = FS_GetFileDetail(fs_filename, &fs_file_detail[L4C_MCF_PATH_TYPE_OTA]);
+    MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_OTA, fs_api_ret[L4C_MCF_PATH_TYPE_OTA],
+                    (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime & 0xFFFFFFFF));
+    if (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] != FS_NO_ERROR) {
+        kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_OTA], 0, sizeof(FS_FileDetail));
+    }
+
+    kal_wsprintf(fs_filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, file_name);
+    fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] = FS_GetFileDetail(fs_filename, &fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME]);
+    MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_RUNTIME, fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME],
+                    (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime & 0xFFFFFFFF));
+    if (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] != FS_NO_ERROR) {
+        kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME], 0, sizeof(FS_FileDetail));
+    }
+
+    if ( (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] == FS_NO_ERROR) || (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] == FS_NO_ERROR) ) {
+        if (fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime > fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime) {
+            if (tlvota_file->last_mod_time == fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime) {
+                // General TLV-OTA file does not change. No need to read again.
+                MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_NOT_CHANGE(L4C_MCF_PATH_TYPE_OTA);
+                goto out;
+            } else {
+                ret_sprintf = kal_snprintf(file_path, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s%c", MCF_FS_DEFAULT_FOLDER_PATH, '\0');
+                if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                    strncpy(file_path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN-1);
+                    file_path[MCF_FILE_MAX_MD_PATH_LEN-1] = '\0';
+                }
+                last_mod_time = fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime;
+            }
+        } else {
+            if (tlvota_file->last_mod_time == fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime) {
+                // General TLV-OTA file does not change. No need to read again.
+                MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_NOT_CHANGE(L4C_MCF_PATH_TYPE_RUNTIME);
+                goto out;
+            } else {
+                ret_sprintf = kal_snprintf(file_path, MCF_FILE_MAX_MD_PATH_LEN - 1, "%s%c", MCF_FS_CUSTOM_FOLDER_PATH, '\0');
+                if (ret_sprintf < 0 || ret_sprintf > MCF_FILE_MAX_MD_PATH_LEN){
+                    strncpy(file_path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN-1);
+                    file_path[MCF_FILE_MAX_MD_PATH_LEN-1] = '\0';
+                }
+                last_mod_time = fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime;
+            }
+        }
+    } else {
+        MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_COMPARE_FAIL();
+        gen_ret = KAL_FALSE;
+
+        goto out;
+    }
+    
+    mcf_make_file_info(&old_file_info, tlvota_file->last_file.path_type, tlvota_file->last_file.name, tlvota_file->last_file.sw_version, tlvota_file->last_file.sw_version_len, tlvota_file->last_file.gen_time, tlvota_file->last_file.gen_time_len, tlvota_file->last_file.last_mod_time, tlvota_file->last_file.checksum);
+    gen_mcf_ret = mcf_read_general_tlvota_file(KAL_FALSE, file_path, file_name, &apply_path_type, apply_filename, pMcf);
+
+    if (gen_mcf_ret != MCF_OTA_R_SUCCESS) {
+        MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_FAIL(gen_mcf_ret);
+        gen_ret = KAL_FALSE;
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		/* Store last updated file informantion */
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file){
+			mcf_make_file_info(&new_file_info, apply_path_type, apply_filename, &(pFile->buff_start), pFile->sw_version_len, (&(pFile->buff_start) + pFile->sw_version_len), pFile->gen_time_len, last_mod_time, pFile->checksum);
+            if (mcf_compare_file_info(&old_file_info, &new_file_info) == KAL_FALSE){
+                //If General TLV-OTA update, every SIM need to update
+                for (i = 0; i < MAX_SIM_NUM; i++){
+                    is_read_general_tlvota[i] = KAL_TRUE;
+                    com_Mcf.update_general_tlvota[i] = KAL_TRUE;
+                }
+            }
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }
+    }else{
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		/* Store last updated file informantion */
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file){
+			mcf_make_file_info(&new_file_info, apply_path_type, apply_filename, &(pFile->buff_start), pFile->sw_version_len, (&(pFile->buff_start) + pFile->sw_version_len), pFile->gen_time_len, last_mod_time, pFile->checksum);
+            
+            /* Check TLV-OTA is need update */
+            if (mcf_compare_file_info(&old_file_info, &new_file_info) == KAL_FALSE){
+                //If General TLV-OTA update, every SIM need to update
+                for (i = 0; i < MAX_SIM_NUM; i++){
+                    is_read_general_tlvota[i] = KAL_TRUE;
+                    com_Mcf.update_general_tlvota[i] = KAL_TRUE;
+                }
+                //Store file information
+                tlvota_file->last_file.path_type = apply_path_type;
+                strncpy(tlvota_file->last_file.name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+                if (pFile->sw_version_len < MCF_FILE_MAX_SW_VERSION_LEN) {
+                    strncpy(tlvota_file->last_file.sw_version, &(pFile->buff_start), pFile->sw_version_len);
+                    tlvota_file->last_file.sw_version[pFile->sw_version_len] = '\0';
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_FILE_SW_VERSION(tlvota_file->last_file.sw_version);
+                } else {
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_INVALID_SW_VERSION(pFile->sw_version_len);
+                }
+                if (pFile->gen_time_len < MCF_FILE_MAX_GEN_TIME_LEN) {
+                    strncpy(tlvota_file->last_file.gen_time, &(pFile->buff_start) + pFile->sw_version_len, pFile->gen_time_len);
+                    tlvota_file->last_file.gen_time[pFile->gen_time_len] = '\0';
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_FILE_GEN_TIME(tlvota_file->last_file.gen_time);
+                } else {
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_INVALID_GEN_TIME(pFile->gen_time_len);
+                }
+                if (pFile->tool_version_len < MCF_FILE_MAX_TOOL_VERSION_LEN && pFile->tool_version_len > 0) {
+                    strncpy(tool_version, (&(pFile->buff_start) + pFile->sw_version_len + pFile->gen_time_len), pFile->tool_version_len);
+                    tool_version[pFile->tool_version_len] = '\0';
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_FILE_TOOL_VERSION(tool_version);
+                } else if (pFile->tool_version_len >= MCF_FILE_MAX_TOOL_VERSION_LEN){
+                    MD_TRC_MCF_TR_AUTO_SELECT_BIN_INVALID_TOOL_VERSION(pFile->tool_version_len);
+                }
+                tlvota_file->last_file.checksum = pFile->checksum;
+                tlvota_file->last_file.last_mod_time = last_mod_time;
+                tlvota_file->last_file.sw_version_len = pFile->sw_version_len;
+                tlvota_file->last_file.gen_time_len = pFile->gen_time_len;
+            }else{
+                //General TLV-OTA file does not change. No need to read again.
+                MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_GENERAL_FILE_NOT_CHANGE(apply_path_type);
+            }
+            /* Check if file type is TLV-OTA file */
+            if (strcmp(pFile->file_type, MCF_FILE_TYPE_TLVOTA) != 0) {
+                kal_char    str_tmp[MCF_MAX_DHL_LOGGING_LEN] = {0};
+                mcf_snprintf(str_tmp, MCF_MAX_DHL_LOGGING_LEN - 1, "%s", pFile->file_type);
+                MD_TRC_MCF_TR_AUTO_SELECT_BIN_INVALID_FILE(str_tmp);
+                gen_mcf_ret = MCF_OTA_R_INVALID_FILE;
+            }
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		}
+		
+	}
+
+out:
+    if ( (ret == KAL_TRUE) || (gen_ret == KAL_TRUE) ) {
+        ret = KAL_TRUE;
+    } else {
+        ret = KAL_FALSE;
+    }
+    
+	
+	/* If have updated, store modified LIDs */
+    if (com_Mcf.update_tlvota[sim_id] == KAL_TRUE){
+		nv_int_info.update_tlvota_result[sim_id] = KAL_FALSE;
+		if(is_read_nvram == KAL_FALSE){
+			/* Read MCF TLV-OTA file info into cache buffer */
+			if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+				MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_LID_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+				ret = KAL_FALSE;
+			}
+			is_read_nvram = KAL_TRUE;
+		}
+		
+		kal_mem_cpy(&mcf_tlvota_last_mod_lid_g[sim_id], &nv_int_info.tlvota_last_mod_lid[sim_id], sizeof(nvram_mcf_lid_info_struct));
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+		if(mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_FALSE) != MCF_OTA_R_SUCCESS){
+			ret = KAL_FALSE;
+		}
+#else
+		if(mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_FALSE, nv_int_info.not_reset_tlvota[sim_id], KAL_FALSE) != MCF_OTA_R_SUCCESS){
+			ret = KAL_FALSE;
+		}
+#endif
+		is_update_tlvota[sim_id] = KAL_TRUE;
+	}
+	if (is_read_general_tlvota[sim_id] == KAL_TRUE){
+		nv_int_info.update_general_tlvota_result = KAL_FALSE;
+		if(is_read_nvram == KAL_FALSE){
+			/* Read MCF TLV-OTA file info into cache buffer */
+			if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+				MD_TRC_MCF_TR_AUTO_SELECT_BIN_READ_LID_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+				ret = KAL_FALSE;
+			}
+			is_read_nvram = KAL_TRUE;
+		}
+		kal_mem_cpy(&mcf_general_tlvota_last_mod_lid_g[sim_id], &nv_int_info.general_tlvota_last_mod_lid[sim_id], sizeof(nvram_mcf_lid_info_struct));
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+		if(mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_TRUE) != MCF_OTA_R_SUCCESS){
+			ret = KAL_FALSE;
+		}
+#else
+		if(mcf_store_tlvota_modified_lid(sim_id, sbp_tag, KAL_TRUE, nv_int_info.not_reset_general_tlvota, KAL_FALSE) != MCF_OTA_R_SUCCESS){
+			ret = KAL_FALSE;
+		}
+#endif
+		
+		is_update_tlvota[sim_id] = KAL_TRUE;
+	}
+	MD_TRC_MCF_TR_AUTO_SELECT_BIN_DURATION(CALCULATE_LETENCY_DURATION(start_time, GET_CURRENT_TIME()));
+
+    return ret;
+}
+
+kal_bool mcf_set_config_after_dsbp(protocol_id_enum ps_id)
+{
+    kal_bool                      ret = KAL_TRUE;
+    sim_interface_enum            sim_id = l4c_gemini_get_actual_sim_id(ps_id);
+	nvram_ef_mcf_sw_info_struct   nv_sw_info;
+	mcf_t                        *pMcf = mcf_get_instance();
+	mcf_tlvota_file_t            *tlvota_file;
+	kal_uint32                    start_time = GET_CURRENT_TIME();
+	
+	if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+        MD_TRC_MCF_TR_SET_CONFIG_AFTER_DSBP_INVALID_SIM_ID(ps_id, sim_id);
+
+        return KAL_FALSE;
+    }
+	
+	tlvota_file = &(pMcf->tlvota_file[sim_id]);
+	
+	MD_TRC_MCF_TR_SET_CONFIG_AFTER_DSBP_START(ps_id, is_update_tlvota[sim_id]);
+	
+	
+	
+	// When SIM have updated, need to reset to FALSE
+    if(com_Mcf.update_tlvota[sim_id] == KAL_TRUE){
+        com_Mcf.update_tlvota[sim_id] = KAL_FALSE;
+    }
+	
+	if (com_Mcf.update_general_tlvota[sim_id] == KAL_TRUE){
+		com_Mcf.update_general_tlvota[sim_id] = KAL_FALSE;
+	}
+
+    if (is_update_tlvota[sim_id] == KAL_TRUE){
+        kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+		/* Read MCF internal info into cache buffer */
+		if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+			MD_TRC_MCF_TR_SET_CONFIG_AFTER_DSBP_READ_LID_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+			ret = KAL_FALSE;
+			return ret;
+		}
+		/* Read MCF sw info into cache buffer */
+		if ( !nvram_external_read_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+			MD_TRC_MCF_TR_SET_CONFIG_AFTER_DSBP_READ_LID_FAIL(NVRAM_EF_MCF_SW_INFO_LID);
+			ret = KAL_FALSE;
+			return ret;
+		}
+		
+		if(is_read_tlvota[sim_id] == KAL_TRUE){
+			kal_mem_cpy(&nv_int_info.tlvota_last_mod_lid[sim_id], &mcf_tlvota_curr_mod_lid_g[sim_id], sizeof(nvram_mcf_lid_info_struct));
+			is_read_tlvota[sim_id] = KAL_FALSE;
+			MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (tlvota_file) {
+				/* Write updated MCF TLV-OTA file information to NVRAM */
+				strncpy(nv_sw_info.last_update_tlvota_file[sim_id].sw_version, tlvota_file->last_file.sw_version, MCF_FILE_MAX_SW_VERSION_LEN - 1);
+				strncpy(nv_sw_info.last_update_tlvota_file[sim_id].gen_time, tlvota_file->last_file.gen_time, MCF_FILE_MAX_GEN_TIME_LEN - 1);
+				strncpy(nv_sw_info.last_update_tlvota_file[sim_id].name, tlvota_file->last_file.name, MCF_FILE_MAX_NAME_LEN - 1);
+				if (tlvota_file->last_file.path_type == L4C_MCF_PATH_TYPE_OTA){
+					strncpy(nv_sw_info.last_update_tlvota_file[sim_id].path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				}else if(tlvota_file->last_file.path_type == L4C_MCF_PATH_TYPE_RUNTIME){
+					strncpy(nv_sw_info.last_update_tlvota_file[sim_id].path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				}
+				MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			}else{
+				MD_TRC_MCF_TR_SET_CONFIG_AFTER_DSBP_TAKE_READ_LOCK_FAIL();
+			}
+		}
+		
+		if (is_read_general_tlvota[sim_id] == KAL_TRUE){
+			kal_mem_cpy(&nv_int_info.general_tlvota_last_mod_lid[sim_id], &mcf_general_tlvota_curr_mod_lid_g[sim_id], sizeof(nvram_mcf_lid_info_struct));
+			is_read_general_tlvota[sim_id] = KAL_FALSE;
+			tlvota_file = &(pMcf->general_tlvota_file);
+			MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (tlvota_file) {
+				/* Write updated MCF TLV-OTA file information to NVRAM */
+				strncpy(nv_sw_info.last_update_general_tlvota_file.sw_version, tlvota_file->last_file.sw_version, MCF_FILE_MAX_SW_VERSION_LEN - 1);
+				strncpy(nv_sw_info.last_update_general_tlvota_file.gen_time, tlvota_file->last_file.gen_time, MCF_FILE_MAX_GEN_TIME_LEN - 1);
+				strncpy(nv_sw_info.last_update_general_tlvota_file.name, tlvota_file->last_file.name, MCF_FILE_MAX_NAME_LEN - 1);
+				if (tlvota_file->last_file.path_type == L4C_MCF_PATH_TYPE_OTA){
+					strncpy(nv_sw_info.last_update_general_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				}else if(tlvota_file->last_file.path_type == L4C_MCF_PATH_TYPE_RUNTIME){
+					strncpy(nv_sw_info.last_update_general_tlvota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN - 1);
+				}
+				MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			}else{
+				MD_TRC_MCF_TR_SET_CONFIG_AFTER_DSBP_TAKE_READ_LOCK_FAIL();
+			}
+		}
+
+		/* Write MCF internal info into NVRAM */
+		if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+			MD_TRC_MCF_TR_SET_CONFIG_AFTER_DSBP_WRITE_LID_FAIL(NVRAM_EF_MCF_INTERNAL_INFO_LID);
+			ret = KAL_FALSE;
+			return ret;
+		}
+		/* Write MCF sw info into NVRAM */
+		if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+			MD_TRC_MCF_TR_SET_CONFIG_AFTER_DSBP_WRITE_LID_FAIL(NVRAM_EF_MCF_SW_INFO_LID);
+			ret = KAL_FALSE;
+			return ret;
+		}
+		
+		is_update_tlvota[sim_id] = KAL_FALSE;
+		
+    }
+	
+	MD_TRC_MCF_TR_SET_CONFIG_AFTER_DSBP_DURATION(CALCULATE_LETENCY_DURATION(start_time, GET_CURRENT_TIME()));
+	
+    return ret;
+}
+
+kal_bool mcf_check_lid_need_reset(nvram_lid_enum lid)
+{
+    kal_int16   pos1 = -1;
+    kal_int16   pos2 = -1;
+    kal_uint16  new_pos = 0;
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+	kal_bool    reset = KAL_FALSE;
+#endif
+    MD_TRC_MCF_TR_CHECK_LID_NEED_RESET_START(lid);
+
+    /* Search last modified LID list */
+    if (mcf_last_mod_lid_g.lid_cnt >= NVRAM_MCF_SAVE_LAST_LID_CNT) {
+        /* If last modified LID list is full, all LIDs are needed to be reset */
+        return KAL_TRUE;
+    }
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+    pos1 = mcf_binary_search_lid(lid, mcf_last_mod_lid_g.lid, mcf_last_mod_lid_g.lid_cnt, &new_pos);
+#else
+	pos1 = mcf_binary_search_lid_struct(lid, mcf_last_mod_lid_g.lid_conf, mcf_last_mod_lid_g.lid_cnt, &new_pos);
+	if(pos1 != -1 && pos1 >= 0){
+		if(nv_int_info.not_reset_ota == KAL_FALSE || mcf_last_mod_lid_g.lid_conf[pos1].not_reset == KAL_FALSE){
+			reset = KAL_TRUE;
+		}
+	}
+#endif
+
+    /* Search current modified LID list */
+    if (mcf_curr_mod_lid_g.lid_cnt >= NVRAM_MCF_SAVE_LAST_LID_CNT) {
+        /* If current modified LID list is full, all LIDs are needed to be reset */
+        return KAL_TRUE;
+    }
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+    pos2 = mcf_binary_search_lid(lid, mcf_curr_mod_lid_g.lid, mcf_curr_mod_lid_g.lid_cnt, &new_pos);
+#else
+	pos2 = mcf_binary_search_lid_struct(lid, mcf_curr_mod_lid_g.lid_conf, mcf_curr_mod_lid_g.lid_cnt, &new_pos);
+    if(pos2 != -1 && pos2 >= 0){
+		if(nv_int_info.not_reset_ota == KAL_FALSE || mcf_curr_mod_lid_g.lid_conf[pos2].not_reset == KAL_FALSE){
+			reset = KAL_TRUE;
+		}
+	}
+#endif
+
+    if ( (pos1 != -1) || (pos2 != -1) ) {
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+		if (reset == KAL_TRUE)
+#endif
+		{
+			MD_TRC_MCF_TR_CHECK_LID_NEED_RESET_FOUND(pos1, pos2);
+            return KAL_TRUE;
+		}
+    }
+
+    MD_TRC_MCF_TR_CHECK_LID_NEED_RESET_NOT_FOUND(lid, pos1, pos2);
+
+    return KAL_FALSE;
+}
+
+kal_bool mcf_check_lid_need_reset_by_psid(nvram_lid_enum lid, kal_uint8 ps_id)
+{
+    kal_int16   pos1 = -1;
+    kal_int16   pos2 = -1;
+    kal_uint16  new_pos = 0;
+    sim_interface_enum sim_id = l4c_gemini_get_actual_sim_id(ps_id);
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+	kal_bool    reset = KAL_FALSE;
+#endif
+
+    MD_TRC_MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_START(lid, ps_id);
+	
+	if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+        MD_TRC_MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_INVALID_SIM_ID(ps_id, sim_id);
+
+        return KAL_FALSE;
+    }
+       
+    /* Search tlvota last modified LID list */
+    if (mcf_tlvota_last_mod_lid_g[sim_id].lid_cnt >= NVRAM_MCF_SAVE_LAST_LID_CNT) {
+        /* If last modified LID list is full, all LIDs are needed to be reset */
+        return KAL_TRUE;
+    }
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+    pos1 = mcf_binary_search_lid(lid, mcf_tlvota_last_mod_lid_g[sim_id].lid, mcf_tlvota_last_mod_lid_g[sim_id].lid_cnt, &new_pos);
+#else
+	pos1 = mcf_binary_search_lid_struct(lid, mcf_tlvota_last_mod_lid_g[sim_id].lid_conf, mcf_tlvota_last_mod_lid_g[sim_id].lid_cnt, &new_pos);
+	if(pos1 != -1 && pos1 >= 0){
+		if(nv_int_info.not_reset_tlvota[sim_id] == KAL_FALSE || mcf_tlvota_last_mod_lid_g[sim_id].lid_conf[pos1].not_reset == KAL_FALSE){
+			reset = KAL_TRUE;
+		}
+	}
+#endif
+
+    /* Search tlvota current modified LID list */
+    if (mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt >= NVRAM_MCF_SAVE_LAST_LID_CNT) {
+        /* If current modified LID list is full, all LIDs are needed to be reset */
+        return KAL_TRUE;
+    }
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+    pos2 = mcf_binary_search_lid(lid, mcf_tlvota_curr_mod_lid_g[sim_id].lid, mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt, &new_pos);
+#else
+	pos2 = mcf_binary_search_lid_struct(lid, mcf_tlvota_curr_mod_lid_g[sim_id].lid_conf, mcf_tlvota_curr_mod_lid_g[sim_id].lid_cnt, &new_pos);
+	if(pos2 != -1 && pos2 >= 0){
+		if(nv_int_info.not_reset_tlvota[sim_id] == KAL_FALSE || mcf_tlvota_curr_mod_lid_g[sim_id].lid_conf[pos2].not_reset == KAL_FALSE){
+			reset = KAL_TRUE;
+		}
+	}
+#endif
+
+    if ( (pos1 != -1) || (pos2 != -1) ) {
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+		if (reset == KAL_TRUE)
+#endif
+		{
+			MD_TRC_MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_TLVOTA_FOUND(lid);
+            return KAL_TRUE;
+		}
+    }
+	
+	pos1 = -1;
+    pos2 = -1;
+	
+	/* Search general tlvota last modified LID list */
+    if (mcf_general_tlvota_last_mod_lid_g[sim_id].lid_cnt >= NVRAM_MCF_SAVE_LAST_LID_CNT) {
+        /* If last modified LID list is full, all LIDs are needed to be reset */
+        return KAL_TRUE;
+    }
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+    pos1 = mcf_binary_search_lid(lid, mcf_general_tlvota_last_mod_lid_g[sim_id].lid, mcf_general_tlvota_last_mod_lid_g[sim_id].lid_cnt, &new_pos);
+#else
+	pos1 = mcf_binary_search_lid_struct(lid, mcf_general_tlvota_last_mod_lid_g[sim_id].lid_conf, mcf_general_tlvota_last_mod_lid_g[sim_id].lid_cnt, &new_pos);
+	if(pos1 != -1 && pos1 >= 0){
+		if(nv_int_info.not_reset_general_tlvota == KAL_FALSE || mcf_general_tlvota_last_mod_lid_g[sim_id].lid_conf[pos1].not_reset == KAL_FALSE){
+			reset = KAL_TRUE;
+		}
+	}
+#endif
+
+    /* Search general tlvota current modified LID list */
+    if (mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt >= NVRAM_MCF_SAVE_LAST_LID_CNT) {
+        /* If current modified LID list is full, all LIDs are needed to be reset */
+        return KAL_TRUE;
+    }
+#if !defined(__MCF_COMBINE_FILE_SUPPORT__)
+    pos2 = mcf_binary_search_lid(lid, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt, &new_pos);
+#else
+	pos2 = mcf_binary_search_lid_struct(lid, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_conf, mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_cnt, &new_pos);
+    if(pos2 != -1 && pos2 >= 0){
+		if(nv_int_info.not_reset_general_tlvota == KAL_FALSE || mcf_general_tlvota_curr_mod_lid_g[sim_id].lid_conf[pos2].not_reset == KAL_FALSE){
+			reset = KAL_TRUE;
+		}
+	}
+#endif
+
+    if ( (pos1 != -1) || (pos2 != -1) ) {
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+		if (reset == KAL_TRUE)
+#endif
+		{
+			MD_TRC_MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_GENERAL_TLVOTA_FOUND(lid);
+            return KAL_TRUE;
+		}
+    }
+
+    MD_TRC_MCF_TR_CHECK_LID_NEED_RESET_BY_PSID_NOT_FOUND(lid);
+
+    return KAL_FALSE;
+}
+
+
+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)
+{
+    mcf_ota_result_e    ret = MCF_OTA_R_SUCCESS;
+    
+    if (!(buffer && (size > 0))) {
+        MD_TRC_MCF_TR_CHECK_RESET_AND_TLVOTA_BUFFER_SBP_TAG_INVALID_PARA(ps_id, lid, buffer, size);
+        ret = MCF_OTA_R_INVALID_PARAMETER;
+
+        return ret;
+    }
+    if(mcf_check_lid_need_reset_by_psid(lid, ps_id) == KAL_TRUE){
+        if (NVRAM_DEFAULT_VALUE_POINT != nvram_get_default_value(lid, ps_id, &buffer))
+        {
+            MD_TRC_MCF_TR_CHECK_RESET_AND_TLVOTA_BUFFER_SBP_TAG_GET_DEFAULT_VALUE_FAIL(lid);
+            ret = MCF_OTA_R_READ_NVRAM_FAIL;
+            return ret;
+        }
+    }else{
+        if ( !nvram_external_read_data(lid, record_idx, buffer, size)) {
+            ret = MCF_OTA_R_READ_NVRAM_FAIL;
+            return ret;
+        }
+    }
+    
+    ret = mcf_read_ota_buffer(lid, record_idx, buffer, size);
+    if (ret != MCF_OTA_R_SUCCESS){
+        return ret;
+    }
+    ret = mcf_read_tlvota_buffer_sbp_tag(ps_id, sbp_tag, lid, buffer, size);
+    
+    return ret;
+}
+
+kal_bool mcf_check_ota_need_update(protocol_id_enum ps_id, mcf_tlvota_sbp_tag_t sbp_tag, kal_uint8* iccid)
+{
+    kal_bool is_need_update = KAL_FALSE;
+    kal_bool ret = KAL_FALSE;
+    sbp_reconfig_custom_param_struct param_ptr;
+	sim_interface_enum sim_id = l4c_gemini_get_actual_sim_id(ps_id);
+	
+	if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+		MD_TRC_MCF_TR_CHECK_OTA_NEED_UPDATE_INVALID_SIM_ID(ps_id, sim_id);
+		ret = MCF_OTA_R_INVALID_PARAMETER;
+
+		return ret;
+	}
+
+    MD_TRC_MCF_TR_CHECK_OTA_NEED_UPDATE_START(ps_id, sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+    param_ptr.ps_id = ps_id;
+    param_ptr.sbp_id = sbp_tag.sbp_id;
+    kal_mem_cpy(param_ptr.mcc, sbp_tag.mcc, MAX_MCC_STR_LEN);
+    kal_mem_cpy(param_ptr.mnc, sbp_tag.mnc, MAX_MNC_STR_LEN);
+    kal_mem_cpy(param_ptr.iccid, iccid, 21);
+    
+    
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret == KAL_FALSE){
+        is_need_update = KAL_FALSE;
+        MD_TRC_MCF_TR_CHECK_OTA_NEED_UPDATE_FAIL(ps_id, ret);
+    }
+    
+    if (com_Mcf.update_tlvota[sim_id] == KAL_TRUE || com_Mcf.update_general_tlvota[sim_id] == KAL_TRUE){
+        is_need_update = KAL_TRUE;
+    }
+    MD_TRC_MCF_TR_CHECK_OTA_NEED_UPDATE_RESULT(ps_id, is_need_update);
+
+    return is_need_update;
+}
+
+mcf_ota_result_e mcf_get_tlvota_file_result(protocol_id_enum ps_id){
+    mcf_ota_result_e      mcf_ret = MCF_OTA_R_SUCCESS;
+    sim_interface_enum    sim_id = l4c_gemini_get_actual_sim_id(ps_id);
+    
+    MD_TRC_MCF_TR_GET_TLVOTA_FILE_RESULT_START(ps_id);
+	
+	if (sim_id < 0 || sim_id >= MAX_SIM_NUM){
+        MD_TRC_MCF_TR_GET_TLVOTA_FILE_RESULT_INVALID_SIM_ID(ps_id, sim_id);
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+        return mcf_ret;
+    }
+    
+    mcf_ret = com_Mcf.tlvota_result[sim_id];
+    com_Mcf.tlvota_result[sim_id] = MCF_OTA_R_INVALID_PARAMETER;
+    
+    MD_TRC_MCF_TR_GET_TLVOTA_FILE_RESULT_RETURN_RESULT(ps_id, mcf_ret);
+    
+    return mcf_ret;
+}
diff --git a/mcu/service/mcf/src/mcf_task.c b/mcu/service/mcf/src/mcf_task.c
new file mode 100644
index 0000000..2a240de
--- /dev/null
+++ b/mcu/service/mcf/src/mcf_task.c
@@ -0,0 +1,335 @@
+/*****************************************************************************
+*  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_task.c
+ *
+ * Project:
+ * --------
+ *   UMOLYA
+ *
+ * Description:
+ * ------------
+ *   MD Configuration Framework task 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!
+ * 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!!
+ *==============================================================================
+ *******************************************************************************/
+
+#include "kal_public_api.h"
+#include "syscomp_config.h"
+#include "nvram_interface.h"
+
+#include "mcf_if.h"
+#include "mcf_util.h"
+#include "mcf_defs.h"
+#include "mcf_object.h"
+#include "mcf_debug.h"
+
+/*------------------------------------------------------------------------------
+ * Global variables.
+ *----------------------------------------------------------------------------*/
+extern nvram_ltable_entry_struct logical_data_item_table_mcf[];
+
+/*------------------------------------------------------------------------------
+ * Helper macro.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Private data structure.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Private variables.
+  *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Private fucntions.
+ *----------------------------------------------------------------------------*/
+static void mcf_dump_boot_trace_timeout(void *event_hf_param)
+{
+    if (mcf_timer_eventid_g != NULL) {
+        mcf_timer_eventid_g = NULL;
+    }
+
+    mcf_dump_boot_trace();
+}
+
+static void mcf_dump_important_info_timeout(void *event_hf_param)
+{
+    if (mcf_timer_eventid_g != NULL) {
+        mcf_timer_eventid_g = NULL;
+    }
+
+    mcf_dump_important_info();
+    
+    mcf_timer_eventid_g = evshed_set_event_userid(mcf_timer_es_g,
+                                       mcf_dump_important_info_timeout,
+                                       NULL, KAL_TICKS_5_SEC_REAL * 6,
+                                       2);
+    ASSERT(mcf_timer_eventid_g);
+}
+
+static void mcf_task_main(task_entry_struct *task_entry_ptr)
+{
+    ilm_struct  current_ilm;
+
+    kal_set_active_module_id(MOD_MCF);
+    kal_mem_set(&current_ilm, 0, sizeof(ilm_struct));
+    MCF_BOOT_TRACE(MCF_BOOT_TR_TASK_MAIN_OTA_DURATION, com_Mcf.ota_api_duration);
+                                           
+    mcf_timer_eventid_g = evshed_set_event_userid(mcf_timer_es_g,
+                                       mcf_dump_boot_trace_timeout,
+                                       NULL, KAL_TICKS_5_SEC_REAL * 2,
+                                       1);
+    
+    mcf_timer_eventid_g = evshed_set_event_userid(mcf_timer_es_g,
+                                       mcf_dump_important_info_timeout,
+                                       NULL, KAL_TICKS_5_SEC_REAL * 6,
+                                       2);
+
+    ASSERT(mcf_timer_eventid_g);
+
+    while(1) {
+        if (KAL_TRUE == msg_receive_extq(&current_ilm)) {
+            mcf_on_ilm(&current_ilm);
+            destroy_ilm(&current_ilm);
+        }
+    }
+}
+
+static kal_bool mcf_init(void)
+{
+    mcf_t              *pMcf;
+    mcf_ota_file_t     *ota_file;
+    mcf_tlvota_file_t  *tlvota_file;
+    kal_uint32          i;
+
+    /* Register MCF nvram LID table */
+    nvram_ltable_register(logical_data_item_table_mcf);
+
+    pMcf = mcf_get_instance();
+    ota_file = &(pMcf->ota_file);
+    kal_mem_set(pMcf, 0, sizeof(mcf_t));
+	kal_mem_set(&com_Mcf, 0, sizeof(mcf_common_t));
+
+    /* enh_mutex init */
+    ASSERT(!mcf_enhmutex_g);
+    mcf_enhmutex_g = kal_create_enh_mutex(MCF_LOCK_NAME);
+
+    /* Object init */
+    MCF_INIT_OBJECT_BEGIN(ota_file, mcf_enhmutex_g);
+    MCF_INIT_OBJECT_END(ota_file, mcf_enhmutex_g);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        tlvota_file->sbp_id = SBP_ID_INVALID;
+        MCF_INIT_OBJECT_BEGIN(tlvota_file, mcf_enhmutex_g);
+        MCF_INIT_OBJECT_END(tlvota_file, mcf_enhmutex_g);
+    }
+
+    tlvota_file = &(pMcf->general_tlvota_file);
+    MCF_INIT_OBJECT_BEGIN(tlvota_file, mcf_enhmutex_g);
+    MCF_INIT_OBJECT_END(tlvota_file, mcf_enhmutex_g);
+    
+#if defined(__MCF_UT_FRAMEWORK_SUPPORT__)    
+    /* enh_mutex init */
+    ASSERT(!mcf_utfwk_enhmutex_g);
+    mcf_utfwk_enhmutex_g = kal_create_enh_mutex(MCF_UTFWK_LOCK_NAME);
+#endif
+    /* Timer init */
+    mcf_timer_es_g = evshed_create("MCF_TIMER", MOD_MCF, 0, MAX_DELAY_UNLIMITED);
+
+    if (mcf_timer_es_g == NULL) {
+        ASSERT(KAL_FALSE);
+    }
+	
+	/* Init boot trace buff ptr */
+	com_Mcf.boot_trace_buff_ptr = (kal_uint32 *)com_Mcf.boot_trace_buff;
+
+    return KAL_TRUE;
+}
+
+static kal_bool mcf_reset(void)
+{
+    mcf_t              *pMcf;
+    mcf_ota_file_t     *ota_file;
+    mcf_tlvota_file_t  *tlvota_file;
+    kal_uint32          i;
+
+    pMcf = mcf_get_instance();
+    ota_file = &(pMcf->ota_file);
+
+    /* Cancel Event */
+    if (mcf_timer_eventid_g != NULL) {
+        evshed_cancel_event(mcf_timer_es_g, &mcf_timer_eventid_g);
+    }
+
+    /* Object deinit */
+    MCF_DEINIT_OBJECT_BEGIN(ota_file, mcf_enhmutex_g);
+    MCF_DEINIT_OBJECT_END(ota_file, mcf_enhmutex_g);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_DEINIT_OBJECT_BEGIN(tlvota_file, mcf_enhmutex_g);
+        MCF_DEINIT_OBJECT_END(tlvota_file, mcf_enhmutex_g);
+    }
+
+    kal_mem_set(pMcf, 0, sizeof(mcf_t));
+
+    /* Object init */
+    MCF_INIT_OBJECT_BEGIN(ota_file, mcf_enhmutex_g);
+    MCF_INIT_OBJECT_END(ota_file, mcf_enhmutex_g);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        tlvota_file->sbp_id = SBP_ID_INVALID;
+        MCF_INIT_OBJECT_BEGIN(tlvota_file, mcf_enhmutex_g);
+        MCF_INIT_OBJECT_END(tlvota_file, mcf_enhmutex_g);
+    }
+
+    return KAL_TRUE;
+}
+
+/*------------------------------------------------------------------------------
+ * Public fucntions.
+ *----------------------------------------------------------------------------*/
+kal_bool mcf_create(comptask_handler_struct **handle)
+{
+    static const comptask_handler_struct info =
+    {
+        mcf_task_main,     /* task entry function */
+        mcf_init,     /* task initialization function */
+        mcf_reset,    /* task reset handler */
+    };
+
+    *handle = (comptask_handler_struct *)&info;
+    return KAL_TRUE;
+}
+
diff --git a/mcu/service/mcf/src/mcf_task_clean.c b/mcu/service/mcf/src/mcf_task_clean.c
new file mode 100644
index 0000000..2b6561c
--- /dev/null
+++ b/mcu/service/mcf/src/mcf_task_clean.c
@@ -0,0 +1,72 @@
+/*****************************************************************************
+*  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_task_clean.c
+ *
+ * Project:
+ * --------
+ *   VMOLY
+ *
+ * Description:
+ * ------------
+ *   This function is used for mcf task clean up whem memory dump happen
+ *
+ * Author:
+ * -------
+ * -------
+ *******************************************************************************/
+
+
+#include "mcf_util.h"
+#include "mcf_if.h"
+#include "mcf_object.h"
+#include "mcf_debug.h"
+#include "mcf_defs.h"
+
+void mcf_task_clean_handler(void) {
+    /* invoke each module clean funtion of MCF task */
+    #ifdef __SENSITIVE_DATA_MOSAIC__
+        mcf_t  *pMcf = mcf_get_instance();
+        kal_uint16 i = 0;
+        mcf_tlvota_file_t *tlvota_file;
+        for (i = 0; i < MAX_SIM_NUM; i++) {
+            tlvota_file = &(pMcf->tlvota_file[i]);
+            memset(&(tlvota_file->iccid), 0, 21);
+        }
+    #endif
+}
diff --git a/mcu/service/mcf/src/mcf_ut.c b/mcu/service/mcf/src/mcf_ut.c
new file mode 100644
index 0000000..792c9e7
--- /dev/null
+++ b/mcu/service/mcf/src/mcf_ut.c
@@ -0,0 +1,17045 @@
+/*****************************************************************************
+*  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_ut.c
+ *
+ * Project:
+ * --------
+ *   UMOLYA
+ *
+ * Description:
+ * ------------
+ *   MD Configuration Framework unit test 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!
+ * 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!!
+ *==============================================================================
+ *******************************************************************************/
+
+#include "kal_public_api.h"
+#include "sys_test.h"
+#include "fs_general_api.h"
+#include <direct.h>
+#include "syscomp_config.h"
+
+#include "em_msgid.h"
+#include "em_l4_common_public_struct.h"
+#include "em_mcf_public_struct.h"
+#include "em_struct.h"
+
+#include "nvram_interface.h"
+#include "nvram_group_def.h"
+#include "mcf_nvram_editor.h"
+
+#include "mcf_if.h"
+#include "mcf_util.h"
+#include "mcf_defs.h"
+#include "mcf_object.h"
+#include "mcf_debug.h"
+#include "mcf_utfwk.h"
+
+/*------------------------------------------------------------------------------
+ * Constant definition.
+ *----------------------------------------------------------------------------*/
+#define MCF_FS_DUMMY_AP_FILE_PATH "/nvdata/mdota"
+#define MCF_TEST_OTA_LID_BASE_GID 5059
+#define MCF_TEST_OTA_QUERY_LID_BASE_GID 5188
+ 
+/*------------------------------------------------------------------------------
+ * Private Helper macros.
+ *----------------------------------------------------------------------------*/
+#define MCF_UT_FAKE_PRINT 2
+#if MCF_UT_FAKE_PRINT == 1
+    extern int fake_print(const char *fmt, ...);
+    #define _mcf_ut_printf fake_print
+#elif MCF_UT_FAKE_PRINT == 2
+    #define _mcf_ut_printf printf
+#else
+    #define _mcf_ut_printf(...)  
+#endif
+
+#define mcf_ut_printf(_fmts, ...) \
+        _mcf_ut_printf("%s(): " _fmts, __FUNCTION__, ##__VA_ARGS__)
+
+#define mcf_ut_format_err_str(_fmts, ...) \
+        kal_sprintf(p_ret_err_str, "%s():%d: " _fmts, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+        mcf_ut_printf("[FAILED] %s():%d: " _fmts, __FUNCTION__, __LINE__, ##__VA_ARGS__)
+
+#define MCF_UT_PASS() mcf_ut_printf("PASSED\n")
+
+/*------------------------------------------------------------------------------
+ * Global variables.
+ *----------------------------------------------------------------------------*/
+extern nvram_mcf_lid_info_struct mcf_last_mod_lid_g;
+extern nvram_mcf_lid_info_struct mcf_curr_mod_lid_g;
+extern nvram_mcf_lid_info_struct   mcf_tlvota_last_mod_lid_g[MAX_SIM_NUM];
+extern nvram_mcf_lid_info_struct   mcf_tlvota_curr_mod_lid_g[MAX_SIM_NUM];
+extern nvram_mcf_lid_info_struct   mcf_general_tlvota_last_mod_lid_g[MAX_SIM_NUM];
+extern nvram_mcf_lid_info_struct   mcf_general_tlvota_curr_mod_lid_g[MAX_SIM_NUM];
+extern kal_bool    is_read_tlvota[MAX_SIM_NUM];
+extern kal_bool    is_read_general_tlvota[MAX_SIM_NUM];
+extern nvram_ef_mcf_internal_info_struct nv_int_info;
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+extern kal_uint8 mcf_merge_buffer[MCF_MAX_TLVOTA_FILE_SIZE];
+kal_uint8 mcf_file_buffer[MCF_MAX_TLVOTA_FILE_SIZE];
+#endif
+
+/*------------------------------------------------------------------------------
+ * Private variables.
+ *----------------------------------------------------------------------------*/
+static nvram_ef_mcf_test_struct mcf_utfwk_lid_buffer;
+/* OTA test LID value pattern */
+static const nvram_ef_mcf_test_struct mcf_ut_test_lid_value_pattern = {
+    6, // val_byte_11
+    6, // val_byte_12
+    0x6, // val_bit_byte_11
+    0xf0, // val_bit_byte_12
+    6, // val_short_11
+    6, // val_short_12
+    6, // val_int_1
+    6, // val_float_1
+    6, // val_long_1
+    6.6, // val_double_1
+    "MCF Test 66", // val_buffer_1
+    {6, 6, 0x6, 0xf0, 6, 6, 6, 6, 6, 6.6, "MCF Test 66"}, // val_struct_1
+    6, // val_byte_21
+    6, // val_byte_22
+    0x6, // val_bit_byte_21
+    0xf0, // val_bit_byte_22
+    6, // val_short_21
+    6, // val_short_22
+    6, // val_int_2
+    6, // val_float_2
+    6, // val_long_2
+    6.6, // val_double_2
+    "MCF Test 66", // val_buffer_2
+    {6, 6, 0x6, 0xf0, 6, 6, 6, 6, 6, 6.6, "MCF Test 66"}, // val_struct_2
+    {{6, 6, 0x6, 0x6, 6, 6, 6, 6, 6, 6.6, "MCF"}, // val_struct_3[0]
+     {6, 6, 0x6, 0x6, 6, 6, 6, 6, 6, 6.6, "MCF"}, // val_struct_3[1]
+     {6, 6, 0x6, 0x6, 6, 6, 6, 6, 6, 6.6, "MCF"}, // val_struct_3[2]
+     {6, 6, 0x6, 0x6, 6, 6, 6, 6, 6, 6.6, "MCF"}} // val_struct_3[3]
+};
+
+/* OTA test LID value pattern */
+static nvram_ef_mcf_test_struct mcf_ut_test_lid_value_new_pattern = {
+    0, // val_byte_11
+    0, // val_byte_12
+    0x0, // val_bit_byte_11
+    0x0, // val_bit_byte_12
+    0, // val_short_11
+    0, // val_short_12
+    0, // val_int_1
+    0, // val_float_1
+    0, // val_long_1
+    0, // val_double_1
+    "", // val_buffer_1
+    {0, 0, 0x0, 0x0, 0, 0, 0, 0, 0, 0, "", {"MCF"}, {1,2,3}}, // val_struct_1
+    0, // val_byte_21
+    0, // val_byte_22
+    0x0, // val_bit_byte_21
+    0x0, // val_bit_byte_22
+    0, // val_short_21
+    0, // val_short_22
+    0, // val_int_2
+    0, // val_float_2
+    0, // val_long_2
+    0, // val_double_2
+    "", // val_buffer_2
+    {0, 0, 0x0, 0x0, 0, 0, 0, 0, 0, 0, "", {"MCF"}, {1,2,3}}, // val_struct_2
+    {{0, 0, 0x0, 0x0, 0, 0, 0, 0, 0, 0, "", {"MCF"}, {1,2,3}}, // val_struct_3[0]
+     {0, 0, 0x0, 0x0, 0, 0, 0, 0, 0, 0, "", {"MCF"}, {1,2,3}}, // val_struct_3[1]
+     {0, 0, 0x0, 0x0, 0, 0, 0, 0, 0, 0, "", {"MCF"}, {1,2,3}}, // val_struct_3[2]
+     {0, 0, 0x0, 0x0, 0, 0, 0, 0, 0, 0, "", {"MCF"}, {1,2,3}}}, // val_struct_3[3]
+    0xFFFF,
+    0xFFFFFFFF,
+    0xFF,
+    0xFF,
+    0xFFFF,
+    0xFFFFFFFF
+};
+
+/*------------------------------------------------------------------------------
+ * Private fucntions.
+ *----------------------------------------------------------------------------*/
+extern kal_char* release_verno(void);
+extern kal_char* build_date_time(void);
+extern sim_interface_enum l4c_gemini_get_actual_sim_id(sim_interface_enum simId);
+extern kal_bool mcf_set_file_path(l4c_mcf_set_config_req_struct *req);
+extern kal_bool mcf_get_applied_file_path(l4c_mcf_get_config_req_struct *req, l4c_mcf_get_config_cnf_struct *resp);
+extern kal_bool mcf_em_update_req_hdlr(local_para_struct *local_para_ptr);
+extern chmod(const char *_Filename,int _Mode);
+
+void mcf_ut_init(void)
+{
+    mcf_t              *pMcf;
+    mcf_ota_file_t     *ota_file;
+    mcf_tlvota_file_t  *tlvota_file;
+    kal_uint8          *lid_buffer;
+    kal_uint32          i;
+
+    pMcf = mcf_get_instance();
+    ota_file = &(pMcf->ota_file);
+    kal_mem_set(pMcf, 0, sizeof(mcf_t));
+
+    /* Object init */
+    MCF_INIT_OBJECT_BEGIN(ota_file, mcf_enhmutex_g);
+    MCF_INIT_OBJECT_END(ota_file, mcf_enhmutex_g);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_INIT_OBJECT_BEGIN(tlvota_file, mcf_enhmutex_g);
+        MCF_INIT_OBJECT_END(tlvota_file, mcf_enhmutex_g);
+    }
+
+    tlvota_file = &(pMcf->general_tlvota_file);
+    MCF_INIT_OBJECT_BEGIN(tlvota_file, mcf_enhmutex_g);
+    MCF_INIT_OBJECT_END(tlvota_file, mcf_enhmutex_g);
+
+    /* Reset NVRAM_EF_MCF_OTA_FILE_LID */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /* Reset NVRAM_EF_MCF_TLVOTA_FILE_LID */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TLVOTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TLVOTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /* Reset NVRAM_EF_MCF_TEST_OTA_LID */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /* Reset NVRAM_EF_MCF_TEST_OTA_QUERY_LID */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_QUERY_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_QUERY_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /* Reset NVRAM_EF_MCF_SW_INFO_LID */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_SW_INFO_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+    
+    /* Reset NVRAM_EF_MCF_INTERNAL_INFO_LID */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_internal_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_INTERNAL_INFO_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_INTERNAL_INFO_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    return;
+}
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_open_test_data(kal_char *filename, kal_char *data_buff, kal_uint32 size)
+{
+    kal_char    test_data_path[512];
+    kal_char   *pos; 
+    FILE       *file;
+
+    getcwd(test_data_path, sizeof(test_data_path));
+    pos = strstr(test_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, filename, '\0');
+    file = fopen(test_data_path, "rb");
+
+    if(file != NULL)
+    {
+        kal_mem_set(data_buff, 0, size);
+        fread(data_buff, size, 1, file);
+        fclose(file);
+    } else {
+        return KAL_FALSE;
+    }
+
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_write_test_data(kal_char *filename, kal_char *data_buff)
+{
+    kal_char    test_data_path[512];
+    kal_char   *pos; 
+    FILE       *file;
+
+    getcwd(test_data_path, sizeof(test_data_path));
+    pos = strstr(test_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, filename, '\0');
+    file = fopen(test_data_path, "w");
+
+    if(file != NULL)
+    {
+		fwrite(data_buff,1,strlen(data_buff),file);
+        fclose(file);
+    } else {
+        return KAL_FALSE;
+    }
+
+    return KAL_TRUE;
+}
+static kal_bool mcf_utfwk_dsbp_callback(sbp_reconfig_custom_param_struct *param_ptr)
+{
+    mcf_ota_result_e mcf_ota_result = MCF_OTA_R_SUCCESS;
+    mcf_tlvota_sbp_tag_t ota_sbp_tag;
+  
+    ota_sbp_tag.sbp_id = param_ptr->sbp_id;
+    memcpy(&(ota_sbp_tag.mcc), param_ptr->mcc, MAX_MCC_STR_LEN);
+    memcpy(&(ota_sbp_tag.mnc), param_ptr->mnc, MAX_MNC_STR_LEN);
+    mcf_ota_result = mcf_read_tlvota_buffer_sbp_tag(param_ptr->ps_id, ota_sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8*)&mcf_utfwk_lid_buffer, sizeof(mcf_utfwk_lid_buffer));
+    
+    return KAL_TRUE;
+}
+#endif
+
+kal_bool mcf_check_dsbp_mode(kal_bool is_ignore_dsbp, sim_interface_enum sim_id)
+{
+    nvram_ef_mcf_internal_info_struct nv_int_info;
+    kal_bool                    ret = KAL_TRUE;
+
+    /* Read MCF SW information in NVRAM */
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct))) {
+        printf("%s():%d: Fail to read LID(%d)\n", __FUNCTION__, __LINE__, NVRAM_EF_MCF_INTERNAL_INFO_LID);
+        ret = KAL_FALSE;
+
+        return ret;
+    }
+
+    if (nv_int_info.tlvota_is_ignore_dsbp[sim_id] != is_ignore_dsbp) {
+        ret = KAL_FALSE;
+
+        return ret;
+    }
+
+    return ret;
+}
+
+kal_bool mcf_ut_check_file_path(
+    l4c_mcf_set_config_req_struct *req,
+    kal_bool is_null_ota_path,
+    kal_bool is_null_tlvota_path,
+    kal_bool is_dsbp_active_mode)
+{
+    mcf_t      *pMcf = mcf_get_instance();
+    kal_bool    ret = KAL_TRUE;
+    kal_uint8   sim_id = req->ps_id;
+
+    switch (req->op)
+    {
+        case L4C_MCF_CONFIG_SET_OTA_AND_OPOTA_FILE_PATH:
+        {
+            nvram_ef_mcf_ota_file_info_struct       nv_ota_file;
+            nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+
+            ret = mcf_check_dsbp_mode(KAL_FALSE, sim_id);
+            if ( (ret != KAL_TRUE) || (pMcf->is_ignore_dsbp[sim_id] != KAL_FALSE) ) {
+                printf("%s():%d: MCF DSBP mode is incorrect!! is_ignore_dsbp(%d)\n", __FUNCTION__, __LINE__, pMcf->is_ignore_dsbp[sim_id]);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+
+            /* OTA */
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+                printf("%s():%d: Fail to read LID(%d)\n", __FUNCTION__, __LINE__, NVRAM_EF_MCF_OTA_FILE_LID);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+            if (is_null_ota_path == KAL_FALSE) {
+                if ( (strncmp(nv_ota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)
+                     || (strncmp(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN) != 0) ){
+                    ret = KAL_FALSE;
+                }
+            } else {
+                if ( (strcmp(nv_ota_file.path, "") != 0) || (strcmp(nv_ota_file.name, "") != 0) ) {
+                    ret = KAL_FALSE;
+                }
+            }
+
+            /* TLV-OTA */
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+                printf("%s():%d: Fail to read LID(%d)\n", __FUNCTION__, __LINE__, NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+            if (is_null_tlvota_path == KAL_FALSE) {
+                if ( (strncmp(nv_tlvota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)
+                     || (strncmp(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN) != 0) ){
+                    ret = KAL_FALSE;
+                }
+            } else {
+                if ( (strcmp(nv_tlvota_file.path, "") != 0) || (strcmp(nv_tlvota_file.name, "") != 0) ) {
+                    ret = KAL_FALSE;
+                }
+            }
+            break;
+        }
+
+        case L4C_MCF_CONFIG_SET_OTA_FILE_PATH:
+        {
+            nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+
+            ret = mcf_check_dsbp_mode(KAL_FALSE, sim_id);
+            if ( (ret != KAL_TRUE) || (pMcf->is_ignore_dsbp[sim_id] != KAL_FALSE) ) {
+                printf("%s():%d: MCF DSBP mode is incorrect!! is_ignore_dsbp(%d)\n", __FUNCTION__, __LINE__, pMcf->is_ignore_dsbp[sim_id]);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+                printf("%s():%d: Fail to read LID(%d)\n", __FUNCTION__, __LINE__, NVRAM_EF_MCF_OTA_FILE_LID);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+
+            if (is_null_ota_path == KAL_FALSE) {
+                if ( (strncmp(nv_ota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)
+                     || (strncmp(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN) != 0) ){
+                    ret = KAL_FALSE;
+                }
+            } else {
+                if ( (strcmp(nv_ota_file.path, "") != 0) || (strcmp(nv_ota_file.name, "") != 0) ) {
+                    ret = KAL_FALSE;
+                }
+            }
+            break;
+        }
+
+        case L4C_MCF_CONFIG_SET_OPOTA_FILE_PATH:
+        {
+            nvram_ef_mcf_tlvota_file_info_struct   nv_tlvota_file;
+
+            ret = mcf_check_dsbp_mode(KAL_FALSE, sim_id);
+            if ( (ret != KAL_TRUE) || (pMcf->is_ignore_dsbp[sim_id] != KAL_FALSE) ) {
+                printf("%s():%d: MCF DSBP mode is incorrect!! is_ignore_dsbp(%d)\n", __FUNCTION__, __LINE__, pMcf->is_ignore_dsbp[sim_id]);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+
+            if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+                printf("%s():%d: Fail to read LID(%d)\n", __FUNCTION__, __LINE__, NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+
+            if (is_null_tlvota_path == KAL_FALSE) {
+                if ( (strncmp(nv_tlvota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)
+                     || (strncmp(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN) != 0) ){
+                    ret = KAL_FALSE;
+                }
+            } else {
+                if ( (strcmp(nv_tlvota_file.path, "") != 0) || (strcmp(nv_tlvota_file.name, "") != 0) ) {
+                    ret = KAL_FALSE;
+                }
+            }
+            break;
+        }
+
+        case L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE:
+        {
+            ret = mcf_check_dsbp_mode(KAL_TRUE, sim_id);
+            if ( (ret != KAL_TRUE) || (pMcf->is_ignore_dsbp[sim_id] != KAL_TRUE) ) {
+                printf("%s():%d: MCF DSBP mode is incorrect!! is_ignore_dsbp(%d)\n", __FUNCTION__, __LINE__, pMcf->is_ignore_dsbp[sim_id]);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+
+            switch (req->config_type)
+            {
+                case L4C_MCF_CONFIG_TYPE_DEFAULT_BIN:
+                {
+                    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+
+                    if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct))) {
+                        printf("%s():%d: Fail to read LID(%d)\n", __FUNCTION__, __LINE__, NVRAM_EF_MCF_OTA_FILE_LID);
+                        ret = KAL_FALSE;
+
+                        return ret;
+                    }
+
+                    if (is_null_ota_path == KAL_FALSE) {
+                        if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+                            if ( (strncmp(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)
+                                 || (strncmp(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN) != 0) ) {
+                                ret = KAL_FALSE;
+                            }
+                        } else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                            if ( (strncmp(nv_ota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)
+                                 || (strncmp(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN) != 0) ) {
+                                ret = KAL_FALSE;
+                            }
+                        }
+                    } else {
+                        if ( (strncmp(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)
+                             || (strncmp(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN) != 0) ){
+                            ret = KAL_FALSE;
+                        }
+                    }
+                    break;
+                }
+
+                case L4C_MCF_CONFIG_TYPE_CARRIER_BIN:
+                {
+                    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+
+                    if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, sim_id + 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+                        printf("%s():%d: Fail to read LID(%d)\n", __FUNCTION__, __LINE__, NVRAM_EF_MCF_TLVOTA_FILE_LID);
+                        ret = KAL_FALSE;
+
+                        return ret;
+                    }
+
+                    if (is_null_tlvota_path == KAL_FALSE) {
+                        if (req->path_type == L4C_MCF_PATH_TYPE_OTA) {
+                            if ( (strncmp(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)
+                                 || (strncmp(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN) != 0) ){
+                                ret = KAL_FALSE;
+                            }
+                        } else if (req->path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                            if ( (strncmp(nv_tlvota_file.path, MCF_FS_CUSTOM_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN) != 0)
+                                 || (strncmp(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN) != 0) ) {
+                                ret = KAL_FALSE;
+                            }
+                        }
+                    } else {
+                        if ( (strcmp(nv_tlvota_file.path, "") != 0) || (strcmp(nv_tlvota_file.name, "") != 0) ) {
+                            ret = KAL_FALSE;
+                        }
+                    }
+                    break;
+                }
+
+                default:
+                    printf("%s():%d: Invalid config type(%d)\n", __FUNCTION__, __LINE__, req->config_type);
+                    ret = KAL_FALSE;
+                    break;
+            }
+
+            break;
+        }
+
+        default:
+            ret = KAL_FALSE;
+            break;
+    }
+
+    return ret;
+}
+
+kal_bool mcf_check_test_lid_value(kal_uint8 *target_buff)
+{
+    kal_bool    ret = KAL_TRUE;
+    kal_uint8  *lid_buffer;
+
+    if (target_buff) {
+        if ( kal_mem_cmp(target_buff, &mcf_ut_test_lid_value_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+            ret = KAL_FALSE;
+        }
+    } else {
+        /*
+         *  NVRAM_EF_MCF_TEST_OTA_LID record 1
+         */
+        lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+        if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+            ret = KAL_FALSE;
+        }
+
+        if ( kal_mem_cmp(lid_buffer, &mcf_ut_test_lid_value_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+            ret = KAL_FALSE;
+        }
+        free_ctrl_buffer_set_null(lid_buffer);
+        
+        if (ret == KAL_FALSE) {
+            return ret;
+        }
+
+        /*
+         *  NVRAM_EF_MCF_TEST_OTA_LID record 2
+         */
+        lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+        if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 2, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+            ret = KAL_FALSE;
+        }
+
+        if ( kal_mem_cmp(lid_buffer, &mcf_ut_test_lid_value_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+            ret = KAL_FALSE;
+        }
+        free_ctrl_buffer_set_null(lid_buffer);
+
+        if (ret == KAL_FALSE) {
+            return ret;
+        }
+    }
+
+
+    return ret;
+}
+
+/*------------------------------------------------------------------------------
+ * Test case functions.
+ *----------------------------------------------------------------------------*/
+kal_bool mcf_ut_mcf_set_file_path_dsbp_passive_mode(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    l4c_mcf_set_config_req_struct  *req;
+    kal_uint8                       i;
+    mcf_ota_result_e                mcf_ret;
+    kal_bool                        ret;
+
+    mcf_ut_init();
+
+    /*
+     * Set both OTA and TLV-OTA path positive test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_OTA_AND_OPOTA_FILE_PATH;
+        strcpy(req->config1, MCF_FS_DUMMY_AP_FILE_PATH);
+        strcpy(req->config2, MCF_FS_DEFAULT_OTA_FILE_NAME);
+        strcpy(req->config3, MCF_FS_DUMMY_AP_FILE_PATH);
+        strcpy(req->config4, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+        req->ps_id = i;
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set both OTA/TLV-OTA file paths positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+
+        ret = mcf_ut_check_file_path(req, KAL_FALSE, KAL_FALSE, KAL_FALSE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set both OTA/TLV-OTA file paths positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set both OTA and TLV-OTA path positive test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_OTA_AND_OPOTA_FILE_PATH;
+        strcpy(req->config1, MCF_FS_DUMMY_AP_FILE_PATH);
+        strcpy(req->config2, MCF_FS_DEFAULT_OTA_FILE_NAME);
+        strcpy(req->config3, "");
+        strcpy(req->config4, "");
+        req->ps_id = i;
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set one of OTA/TLV-OTA file path positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+
+        ret = mcf_ut_check_file_path(req, KAL_FALSE, KAL_TRUE, KAL_FALSE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set one of OTA/TLV-OTA file path positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set both OTA and TLV-OTA path negative test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_OTA_AND_OPOTA_FILE_PATH;
+        strcpy(req->config1, MCF_FS_DUMMY_AP_FILE_PATH);
+        strcpy(req->config2, MCF_FS_DEFAULT_OTA_FILE_NAME);
+        strcpy(req->config3, "");
+        strcpy(req->config4, "");
+        req->ps_id = i;
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set one of OTA/TLV-OTA file path negative test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+
+        ret = mcf_ut_check_file_path(req, KAL_FALSE, KAL_FALSE, KAL_FALSE);
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check set one of OTA/TLV-OTA file path negative test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set OTA path positive test
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_OTA_FILE_PATH;
+    strcpy(req->config1, MCF_FS_DUMMY_AP_FILE_PATH);
+    strcpy(req->config2, MCF_FS_DEFAULT_OTA_FILE_NAME);
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Set OTA file path positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    ret = mcf_ut_check_file_path(req, KAL_FALSE, KAL_TRUE, KAL_FALSE);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check set OTA file path positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+
+    /*
+     * Delete OTA path positive test
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_OTA_FILE_PATH;
+    strcpy(req->config1, "");
+    strcpy(req->config2, "");
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Delete OTA file path positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_FALSE);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check delete OTA file path positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+
+    /*
+     * Set OTA path negative test
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_OTA_FILE_PATH;
+    strcpy(req->config1, MCF_FS_DUMMY_AP_FILE_PATH);
+    strcpy(req->config2, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Set OTA file path negative test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    ret = mcf_ut_check_file_path(req, KAL_FALSE, KAL_TRUE, KAL_FALSE);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check set OTA file path negative test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+
+    /*
+     * Set TLV-OTA path positive test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_OPOTA_FILE_PATH;
+        strcpy(req->config1, MCF_FS_DUMMY_AP_FILE_PATH);
+        strcpy(req->config2, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+        req->ps_id = i;
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_FALSE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Delete TLV-OTA path positive test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_OPOTA_FILE_PATH;
+        strcpy(req->config1, "");
+        strcpy(req->config2, "");
+        req->ps_id = i;
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Delete TLV-OTA file path positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+
+        ret = mcf_ut_check_file_path(req, KAL_FALSE, KAL_TRUE, KAL_FALSE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check delete TLV-OTA file path positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set TLV-OTA path negative test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_OPOTA_FILE_PATH;
+        strcpy(req->config1, MCF_FS_DUMMY_AP_FILE_PATH);
+        strcpy(req->config2, MCF_FS_DEFAULT_OTA_FILE_NAME);
+        req->ps_id = i;
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path negative test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+
+        ret = mcf_ut_check_file_path(req, KAL_FALSE, KAL_FALSE, KAL_FALSE);
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path negative test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_mcf_set_file_path_dsbp_active_mode(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                          *pMcf = mcf_get_instance();
+    mcf_ota_file_t                 *ota_file;
+    mcf_tlvota_file_t              *tlvota_file;
+    mcf_tool_file_info_t           *pFile;
+    l4c_mcf_set_config_req_struct  *req;
+	sim_interface_enum              sim_id;
+    kal_uint8                       i;
+    mcf_ota_result_e                mcf_ret;
+    kal_bool                        ret;
+
+    mcf_ut_init();
+
+    ota_file = &(pMcf->ota_file);
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+        pFile->file_version = 2;
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("set file path FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pFile->file_version = 2;
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        }else {
+            mcf_ut_format_err_str("set file path FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     * Set OTA path in default path positive test
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+    req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+    req->path_type = L4C_MCF_PATH_TYPE_OTA;
+    strcpy(req->config1, MCF_FS_DEFAULT_OTA_FILE_NAME);
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Set OTA file path in default path positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    ret = mcf_ut_check_file_path(req, KAL_FALSE, KAL_TRUE, KAL_TRUE);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check set OTA file path in default path positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+	
+	/*
+     * Set OTA path in default path with NULL file name positive test
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+    req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+    req->path_type = L4C_MCF_PATH_TYPE_OTA;
+    strcpy(req->config1, "");
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Set OTA file path in default path with NULL file name positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_TRUE, KAL_TRUE);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check set OTA file path in default path with NULL file name positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+
+    /*
+     * Set OTA path in runtime path positive test
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+    req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+    req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+    strcpy(req->config1, MCF_FS_DEFAULT_OTA_FILE_NAME);
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Set OTA file path in runtime path positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    ret = mcf_ut_check_file_path(req, KAL_FALSE, KAL_TRUE, KAL_TRUE);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check set OTA file path in runtime path positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+
+    /*
+     * Set OTA path in default path with NULL file name positive test
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+    req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+    req->path_type = L4C_MCF_PATH_TYPE_OTA;
+    strcpy(req->config1, "");
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Set OTA file path in default path with NULL file name positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_TRUE, KAL_TRUE);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check set OTA file path in default path with NULL file name positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+
+    /*
+     * Set OTA path in runtime path with NULL file name positive test
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+    req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+    req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+    strcpy(req->config1, "");
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Set OTA file path in runtime path with NULL file name positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_TRUE, KAL_TRUE);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check set OTA file path in runtime path with NULL file name positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+
+    /*
+     * Set TLV-OTA path in default path positive test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->path_type = L4C_MCF_PATH_TYPE_OTA;
+        strcpy(req->config1, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pFile->file_version = 2;
+            req->ps_id = i;
+			sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+		
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set TLV-OTA path in default path with NULL file name (deactivate OTA by OP) positive test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->path_type = L4C_MCF_PATH_TYPE_OTA;
+        strcpy(req->config1, "");
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pFile->file_version = 2;
+            req->ps_id = i;
+			sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path with NULL file name (deactivate OTA by OP) positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+		
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_TRUE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path with NULL file name (deactivate OTA by OP) positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set TLV-OTA path in runtime path positive test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+        strcpy(req->config1, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pFile->file_version = 2;
+            req->ps_id = i;
+			sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in runtime path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+		
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+
+		
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in runtime path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set TLV-OTA path in runtime path with NULL file name (deactivate OTA by OP) positive test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+        strcpy(req->config1, "");
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pFile->file_version = 2;
+            req->ps_id = i;
+			sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in runtime path with NULL file name (deactivate OTA by OP) positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+		
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_TRUE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in runtime path with NULL file name (deactivate OTA by OP) positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set TLV-OTA path in default path positive test - file is not changed
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pFile->file_version = 2;
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->path_type = L4C_MCF_PATH_TYPE_OTA;
+        strcpy(req->config1, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+        req->ps_id = i;
+		sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+
+        // First send file path
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+		
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+
+        // Send same file path
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_FILE_NOT_CHANGE) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+		
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set TLV-OTA path in runtime path positive test - file is not changed
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pFile->file_version = 2;
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+        strcpy(req->config1, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+        req->ps_id = i;
+		sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+
+        // First send file path
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+		
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+
+        // Send same file path
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_FILE_NOT_CHANGE) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+		
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set TLV-OTA path in default path positive test - set file path after deactivated
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pFile->file_version = 2;
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->path_type = L4C_MCF_PATH_TYPE_OTA;
+        strcpy(req->config1, "");
+        req->ps_id = i;
+		sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+
+        // First send file path
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+		
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_TRUE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+
+        // Send same file path
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile->file_version = 2;
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        strcpy(req->config1, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+		
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set TLV-OTA path in runtime path positive test - set file path after deactivated
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pFile->file_version = 2;
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+        strcpy(req->config1, "");
+        req->ps_id = i;
+		sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+
+        // First send file path
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+		
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_TRUE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+
+        // Send same file path
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile->file_version = 2;
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Set TLV-OTA path fail! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        strcpy(req->config1, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+		
+		/* Assume DSBP success */
+        pMcf->is_dsbp_ongoing[sim_id] = KAL_FALSE;
+        kal_mem_cpy(&(tlvota_file->last_file), &(tlvota_file->temp_file), sizeof(mcf_file_info_t));
+
+        ret = mcf_ut_check_file_path(req, KAL_TRUE, KAL_FALSE, KAL_TRUE);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check set TLV-OTA file path in default path positive test FAIL\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+    /*
+     * Set OTA path in default path negative test - invalid config type
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+    req->config_type = L4C_MCF_CONFIG_TYPE_MAX;
+    req->path_type = L4C_MCF_PATH_TYPE_OTA;
+    strcpy(req->config1, MCF_FS_DEFAULT_OTA_FILE_NAME);
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("Check set OTA path in default path negative test (invalid config type) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+
+    /*
+     * Set OTA path negative test - invalid path type
+     */
+    req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+    req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+    req->path_type = L4C_MCF_PATH_TYPE_MAX;
+    strcpy(req->config1, MCF_FS_DEFAULT_OTA_FILE_NAME);
+
+    mcf_ret = mcf_set_file_path(req);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("Check set OTA path negative test (invalid path type) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+
+    /*
+     * Set TLV-OTA path negative test - invalid path type
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_SET_FILE_PATH_IN_MCF_DSBP_ACTIVE_MODE;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->path_type = L4C_MCF_PATH_TYPE_MAX;
+        strcpy(req->config1, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+        req->ps_id = i;
+
+        mcf_ret = mcf_set_file_path(req);
+        if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+            mcf_ut_format_err_str("Set TLV-OTA file path in runtime path with NULL file name (deactivate OTA by OP) positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_mcf_get_applied_file_path(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                          *pMcf = mcf_get_instance();
+    l4c_mcf_get_config_req_struct  *req;
+    l4c_mcf_get_config_cnf_struct  *resp;
+    sim_interface_enum              sim_id;
+    kal_uint8                       i;
+    mcf_ota_result_e                mcf_ret;
+
+    mcf_ut_init();
+
+    pMcf->ota_file.path_type = L4C_MCF_PATH_TYPE_OTA;
+    strcpy(pMcf->ota_file.relative_path_name, MCF_FS_DEFAULT_OTA_FILE_NAME);
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        pMcf->tlvota_file[i].path_type = L4C_MCF_PATH_TYPE_OTA;
+        strcpy(pMcf->tlvota_file[i].relative_path_name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+    }
+
+    /*
+     * Get applied OTA file path positive test
+     */
+    req = (l4c_mcf_get_config_req_struct *)construct_local_para(sizeof(l4c_mcf_get_config_req_struct), TD_RESET);
+    resp = (l4c_mcf_get_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_get_config_cnf_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_GET_APPLIED_FILE_PATH;
+    req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+
+    mcf_ret = mcf_get_applied_file_path(req, resp);
+    if ( (mcf_ret != MCF_OTA_R_SUCCESS) || (resp->config_type != req->config_type)
+         || (resp->path_type != pMcf->ota_file.path_type)
+         || (strcmp(resp->config1, pMcf->ota_file.relative_path_name) != 0) ) {
+        mcf_ut_format_err_str("Get applied OTA file path positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)resp);
+
+    /*
+     * Get applied TLV-OTA file path positive test
+     */
+    for(i = 0; i < MAX_SIM_NUM; i++) {
+        req = (l4c_mcf_get_config_req_struct *)construct_local_para(sizeof(l4c_mcf_get_config_req_struct), TD_RESET);
+        resp = (l4c_mcf_get_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_get_config_cnf_struct), TD_RESET);
+        req->op = L4C_MCF_CONFIG_GET_APPLIED_FILE_PATH;
+        req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+        req->ps_id = i;
+        sim_id = l4c_gemini_get_actual_sim_id(req->ps_id);
+
+        mcf_ret = mcf_get_applied_file_path(req, resp);
+        if ( (mcf_ret != MCF_OTA_R_SUCCESS) || (resp->config_type != req->config_type)
+             || (resp->path_type != pMcf->tlvota_file[sim_id].path_type)
+             || (strcmp(resp->config1, pMcf->tlvota_file[sim_id].relative_path_name) != 0) ) {
+            mcf_ut_format_err_str("Get applied TLV-OTA file path positive test FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+        free_local_para((local_para_struct *)req);
+        free_local_para((local_para_struct *)resp);
+    }
+
+    /*
+     * Get applied file path negative test - invalid config type
+     */
+    req = (l4c_mcf_get_config_req_struct *)construct_local_para(sizeof(l4c_mcf_get_config_req_struct), TD_RESET);
+    resp = (l4c_mcf_get_config_cnf_struct *)construct_local_para(sizeof(l4c_mcf_get_config_cnf_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_GET_APPLIED_FILE_PATH;
+    req->config_type = L4C_MCF_CONFIG_TYPE_MAX;
+
+    mcf_ret = mcf_get_applied_file_path(req, resp);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("Get applied OTA file path negative test (invalid config type) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)resp);
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_do_ota_full(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    mcf_tool_file_info_t               *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    kal_uint8                          *lid_buffer;
+    nvram_ef_mcf_test_struct            empty_buffer = {0};
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+    kal_uint32                          i;
+
+    mcf_ut_init();
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - Both SW verno of file and MD mismatch
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (Both SW verno of file and MD mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - SW verno of file mismatch
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /* Reset updated file information in NVRAM */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (SW verno of file mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - SW verno of MD mismatch
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /* Reset updated MD SW version in NVRAM */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (SW verno of MD mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - SW verno match
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    mcf_ret = mcf_do_ota_full();
+    if ( (mcf_ret != MCF_OTA_R_SUCCESS) || ((com_Mcf.boot_trace_flag & MCF_BOOT_TRACE_F_NO_NEED) == 0) ) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+        printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        ret = KAL_FALSE;
+    }
+
+    if (kal_mem_cmp(lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+        mcf_ut_format_err_str("Do full OTA positive test (SW verno match) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /*
+     *  Do full OTA negative test - invlaid file type
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        strncpy(pFile->file_type, "MCF", 8);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if ( (mcf_ret != MCF_OTA_R_INVALID_FILE) || ((com_Mcf.boot_trace_flag & MCF_BOOT_TRACE_F_INVALID_FILE) == 0) ) {
+        mcf_ut_format_err_str("full OTA: invalid file type case FAIL!! ret(%d), boot_flag(%x) \r\n", mcf_ret, com_Mcf.boot_trace_flag);
+        return KAL_FALSE;
+    }
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+        printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        ret = KAL_FALSE;
+    }
+
+    if (kal_mem_cmp(lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+        mcf_ut_format_err_str("Do full OTA positive test (SW verno match) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /*
+     *  Do full OTA positive test - item with mismatched verno in file
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_mismatched_verno.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_mismatched_verno.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (item with mismatched verno in file) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - File with checksum
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_checksum_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_checksum_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (File with checksum) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - File with checksum and encryption
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_checksum_and_encryption_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_checksum_and_encryption_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (File with checksum) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_do_ota_by_lid(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t               *pFile;
+    mcf_tool_ota_file_item_t           *pItem;
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    kal_uint8                          *lid_buffer;
+    kal_uint32                          i;
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    nvram_ltable_entry_struct           lid_info;
+    nvram_errno_enum                    nvram_api_ret;
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+
+    mcf_ut_init();
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    pItem = (mcf_tool_ota_file_item_t *)(ota_file->buff + sizeof(mcf_tool_file_info_t));
+
+    /*
+     *  Do OTA by LID positive test
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    nvram_api_ret = nvram_external_get_lid_info(NVRAM_EF_MCF_TEST_OTA_LID, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        mcf_ut_format_err_str("Fail to get LID information!! lid(%d), nvram_ret(%d)\r\n", NVRAM_EF_MCF_TEST_OTA_LID, nvram_api_ret);
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_by_lid(NVRAM_EF_MCF_TEST_OTA_LID, 1, NVRAM_EF_MCF_TEST_OTA_TOTAL, &lid_info);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do OTA by LID positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do OTA by LID negative test - invalid OTA attribute
+     */
+    lid_info.attr &= ~NVRAM_ATTR_MCF_OTA;
+    mcf_ret = mcf_do_ota_by_lid(NVRAM_EF_MCF_TEST_OTA_LID, 1, NVRAM_EF_MCF_TEST_OTA_TOTAL, &lid_info);
+    if (mcf_ret != MCF_OTA_R_INVALID_ATTR) {
+        mcf_ut_format_err_str("OTA by LID: invalid OTA attribute case FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do OTA by LID negative test - invlaid file type
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        strncpy(pFile->file_type, "MCF", 8);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_by_lid(NVRAM_EF_MCF_TEST_OTA_LID, 1, NVRAM_EF_MCF_TEST_OTA_TOTAL, &lid_info);
+    if (mcf_ret != MCF_OTA_R_INVALID_FILE) {
+        mcf_ut_format_err_str("OTA by LID: invlaid file type case FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do OTA by LID positive test - item with mismatched verno in file
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    nvram_api_ret = nvram_external_get_lid_info(NVRAM_EF_MCF_TEST_OTA_LID, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        mcf_ut_format_err_str("Fail to get LID information!! lid(%d), nvram_ret(%d)", NVRAM_EF_MCF_TEST_OTA_LID, nvram_api_ret);
+        return KAL_FALSE;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_mismatched_verno.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_mismatched_verno.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_by_lid(NVRAM_EF_MCF_TEST_OTA_LID, 1, NVRAM_EF_MCF_TEST_OTA_TOTAL, &lid_info);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do OTA by LID positive test (item with mismatched verno in file) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_read_ota_buffer(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t               *pFile;
+    mcf_tool_ota_file_item_t           *pItem;
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    nvram_ef_mcf_test_struct            test_lid_buffer;
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+
+    mcf_ut_init();
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    pItem = (mcf_tool_ota_file_item_t *)(ota_file->buff + sizeof(mcf_tool_file_info_t));
+
+    /*
+     *  Read OTA LID positive test
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    // Record index 1
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    // Record index 2
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 2, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read OTA by LID positive test - item with mismatched verno in file
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_mismatched_verno.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_mismatched_verno.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read OTA by LID positive test (item with mismatched verno in file) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_read_tlvota_buffer(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                                  *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t                   *pFile;
+    mcf_tool_tlvota_file_item_t            *pItem;
+    mcf_tlvota_file_t                      *tlvota_file;
+    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+    nvram_ef_mcf_test_struct                test_lid_buffer;
+    nvram_ef_mcf_test_struct                empty_buffer = {0};
+    mcf_tlvota_tag_t                        tlvota_tag;
+    kal_char                                tag[16];
+    mcf_ota_result_e                        mcf_ret;
+    kal_bool                                ret;
+
+    mcf_ut_init();
+
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & tag positive test - fully matched tag
+     */
+    tlvota_file = &(pMcf->general_tlvota_file);
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+        pItem = (mcf_tool_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+        ret = mcf_ut_open_test_data("MCF_TLVOTA_ICCID_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_ICCID_ut_normal.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(&tlvota_tag, 0, sizeof(mcf_tlvota_tag_t));
+    tlvota_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+    strcpy(tag, SBP_PARTIAL_TAG);
+    tlvota_tag.tag_len = strlen(tag);
+    tlvota_tag.tag = tag;
+
+    mcf_ret = mcf_read_tlvota_buffer(0, tlvota_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag positive test (fully matched tag) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), but user searches tag (12_NA_NA_TEST)
+     */
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(&tlvota_tag, 0, sizeof(mcf_tlvota_tag_t));
+    tlvota_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+    strcpy(tag, "12_NA_NA_TEST");
+    tlvota_tag.tag_len = strlen(tag);
+    tlvota_tag.tag = tag;
+
+    mcf_ret = mcf_read_tlvota_buffer(0, tlvota_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag positive test (partially matched tag) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & tag positive test - no matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), but user searches tag (12_NA)
+     */
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(&tlvota_tag, 0, sizeof(mcf_tlvota_tag_t));
+    tlvota_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+    strcpy(tag, "12_NA");
+    tlvota_tag.tag_len = strlen(tag);
+    tlvota_tag.tag = tag;
+
+    mcf_ret = mcf_read_tlvota_buffer(0, tlvota_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag positive test (no matched tag) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & tag positive test - item with mismatched verno in file
+     */
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(&tlvota_tag, 0, sizeof(mcf_tlvota_tag_t));
+    tlvota_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+    strcpy(tag, SBP_PARTIAL_TAG);
+    tlvota_tag.tag_len = strlen(tag);
+    tlvota_tag.tag = tag;
+
+    tlvota_file = &(pMcf->general_tlvota_file);
+    pItem = (mcf_tool_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        ret = mcf_ut_open_test_data("MCF_TLVOTA_ICCID_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_ICCID_ut_normal.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_read_tlvota_buffer(0, tlvota_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag negative test (item with mismatched verno in file) FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag positive test (fully matched tag) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_read_tlvota_buffer_sbp(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                                  *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t                   *pFile;
+    mcf_tool_tlvota_file_item_t            *pItem;
+    mcf_tlvota_file_t                      *tlvota_file;
+    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+    nvram_ef_mcf_test_struct                test_lid_buffer;
+    nvram_ef_mcf_test_struct                empty_buffer = {0};
+    mcf_tlvota_sbp_tag_t                    sbp_tag;
+    kal_uint8                               i;
+    mcf_ota_result_e                        mcf_ret;
+    kal_bool                                ret;
+
+    mcf_ut_init();
+
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), but user searches SBP_FULL_TAG (12_33_21)
+     */
+    /* Fill TLV-OTA file into buffer */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (NA_NA_NA), but user searches SBP_FULL_TAG (12_33_21)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_NA_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_NA_ut_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - fully matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_FULL_TAG (12_33_21), and user searches SBP_FULL_TAG (12_33_21)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (fully matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - no matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_FULL_TAG (12_33_21), and user searches SBP_FULL_TAG (12_33_NA)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, "", MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (no matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - no matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG_NO_SBPID (NA_33_21), and user searches SBP_FULL_TAG (12_33_21)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+             ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_no_sbpid_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_no_sbpid_ut_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (no matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - no matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_FULL_TAG (12_33_21), and user searches SBP_FULL_TAG (12_NA_NA)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+             ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, "", MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, "", MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (no matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG_NO_SBPID (NA_33_21), and user searches SBP_PARTIAL_TAG_NO_SBPID (NA_33_21)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+             ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_no_sbpid_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_no_sbpid_ut_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_ID_INVALID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MCC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (no matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - item with mismatched verno in file
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+             ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_mismatched_verno.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_mismatched_verno.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MCC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag negative test (item with mismatched verno in file) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_reset_lid_full(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    mcf_tool_file_info_t               *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    nvram_ef_mcf_test_struct            empty_buffer = {0};
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+    nvram_ef_mcf_test_struct            test_lid_buffer;
+    kal_uint8                           *lid_buffer;
+
+    mcf_ut_init();
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Reset all LID positive
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+        printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        ret = KAL_FALSE;
+    }
+
+    if (kal_mem_cmp(lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+        mcf_ut_format_err_str("Reset LID record 1 FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    free_ctrl_buffer_set_null(lid_buffer);
+  
+    
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID New OTA apply FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    /*
+     *  Reset all LID negative
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    pFile->operation_mask |= MCF_FILE_OP_NOT_RESET_LID;
+    
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    pFile->operation_mask |= MCF_FILE_OP_NOT_RESET_LID;
+    
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID New OTA apply FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+  
+    
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID New OTA apply FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_gid_do_ota_full(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    mcf_tool_file_info_t               *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    kal_uint8                          *lid_buffer;
+    nvram_ef_mcf_test_struct            empty_buffer = {0};
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+    kal_uint32                          i;
+    nvram_ef_mcf_test_struct            nv_lid_buffer;
+
+    mcf_ut_init();
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - Both SW verno of file and MD mismatch
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (Both SW verno of file and MD mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - SW verno of file mismatch
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /* Reset updated file information in NVRAM */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (SW verno of file mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - SW verno of MD mismatch
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /* Reset updated MD SW version in NVRAM */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (SW verno of MD mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - SW verno match
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    mcf_ret = mcf_do_ota_full();
+    if ( (mcf_ret != MCF_OTA_R_SUCCESS) || ((com_Mcf.boot_trace_flag & MCF_BOOT_TRACE_F_NO_NEED) == 0) ) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+        printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        ret = KAL_FALSE;
+    }
+
+    if (kal_mem_cmp(lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+        mcf_ut_format_err_str("Do full OTA positive test (SW verno match) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    /*
+     *  Do full OTA negative test - invlaid file type
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        strncpy(pFile->file_type, "MCF", 8);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if ( (mcf_ret != MCF_OTA_R_INVALID_FILE) || ((com_Mcf.boot_trace_flag & MCF_BOOT_TRACE_F_INVALID_FILE) == 0) ) {
+        mcf_ut_format_err_str("full OTA: invalid file type case FAIL!! ret(%d), boot_flag(%x) \r\n", mcf_ret, com_Mcf.boot_trace_flag);
+        return KAL_FALSE;
+    }
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+        printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        ret = KAL_FALSE;
+    }
+
+    if (kal_mem_cmp(lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+        mcf_ut_format_err_str("Do full OTA positive test (SW verno match) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+    
+    /*
+     *  Do full OTA positive test - 3-Dimension array
+     */
+    
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+    
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_3d_array_and_bit_byte_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_3d_array_and_bit_byte_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, (kal_uint8 *)&nv_lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+        printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        ret = KAL_FALSE;
+    }
+    
+    if ( kal_mem_cmp((kal_uint8 *)&nv_lid_buffer, &mcf_ut_test_lid_value_new_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+        ret = KAL_FALSE;
+        printf("Do full OTA positive test (SW verno match) FAIL!!\r\n");
+    }
+    
+    
+    if (ret == KAL_FALSE) {
+        return ret;
+    }
+
+    /*
+     *  Do full OTA positive test - File with checksum
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_checksum_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_checksum_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (File with checksum) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do full OTA positive test - File with checksum and encryption
+     */
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+    kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+        if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+            printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+        }
+    }
+    free_ctrl_buffer_set_null(lid_buffer);
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_checksum_and_encryption_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_checksum_and_encryption_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (File with checksum) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_gid_do_ota_by_lid(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t               *pFile;
+    mcf_tool_gid_ota_file_item_t       *pItem;
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    nvram_ltable_entry_struct           lid_info;
+    nvram_errno_enum                    nvram_api_ret;
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+
+    mcf_ut_init();
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    pItem = (mcf_tool_gid_ota_file_item_t *)(ota_file->buff + sizeof(mcf_tool_file_info_t));
+
+    /*
+     *  Do OTA by LID positive test
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    nvram_api_ret = nvram_external_get_lid_info(NVRAM_EF_MCF_TEST_OTA_LID, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        mcf_ut_format_err_str("Fail to get LID information!! lid(%d), nvram_ret(%d)\r\n", NVRAM_EF_MCF_TEST_OTA_LID, nvram_api_ret);
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_by_lid(NVRAM_EF_MCF_TEST_OTA_LID, 1, NVRAM_EF_MCF_TEST_OTA_TOTAL, &lid_info);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do OTA by LID positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do OTA by LID negative test - invalid OTA attribute
+     */
+    lid_info.attr &= ~NVRAM_ATTR_MCF_OTA;
+    mcf_ret = mcf_do_ota_by_lid(NVRAM_EF_MCF_TEST_OTA_LID, 1, NVRAM_EF_MCF_TEST_OTA_TOTAL, &lid_info);
+    if (mcf_ret != MCF_OTA_R_INVALID_ATTR) {
+        mcf_ut_format_err_str("OTA by LID: invalid OTA attribute case FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Do OTA by LID negative test - invlaid file type
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        strncpy(pFile->file_type, "MCF", 8);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_by_lid(NVRAM_EF_MCF_TEST_OTA_LID, 1, NVRAM_EF_MCF_TEST_OTA_TOTAL, &lid_info);
+    if (mcf_ret != MCF_OTA_R_INVALID_FILE) {
+        mcf_ut_format_err_str("OTA by LID: invlaid file type case FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_gid_read_ota_buffer(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t               *pFile;
+    mcf_tool_gid_ota_file_item_t       *pItem;
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    nvram_ef_mcf_test_struct            test_lid_buffer;
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+
+    mcf_ut_init();
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    pItem = (mcf_tool_gid_ota_file_item_t *)(ota_file->buff + sizeof(mcf_tool_file_info_t));
+
+    /*
+     *  Read OTA LID positive test
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    // Record index 1
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    // Record index 2
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 2, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_gid_read_tlvota_buffer(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                                  *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t                   *pFile;
+    mcf_tool_gid_tlvota_file_item_t        *pItem;
+    mcf_tlvota_file_t                      *tlvota_file;
+    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+    nvram_ef_mcf_test_struct                test_lid_buffer;
+    nvram_ef_mcf_test_struct                empty_buffer = {0};
+    mcf_tlvota_tag_t                        tlvota_tag;
+    kal_char                                tag[16];
+    mcf_ota_result_e                        mcf_ret;
+    kal_bool                                ret;
+
+    mcf_ut_init();
+
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & tag positive test - fully matched tag
+     */
+    tlvota_file = &(pMcf->general_tlvota_file);
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+        pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+        ret = mcf_ut_open_test_data("MCF_TLVOTA_ICCID_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_ICCID_ut_gid_normal.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(&tlvota_tag, 0, sizeof(mcf_tlvota_tag_t));
+    tlvota_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+    strcpy(tag, SBP_PARTIAL_TAG);
+    tlvota_tag.tag_len = strlen(tag);
+    tlvota_tag.tag = tag;
+
+    mcf_ret = mcf_read_tlvota_buffer(0, tlvota_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag positive test (fully matched tag) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), but user searches tag (12_NA_NA_TEST)
+     */
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(&tlvota_tag, 0, sizeof(mcf_tlvota_tag_t));
+    tlvota_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+    strcpy(tag, "12_NA_NA_TEST");
+    tlvota_tag.tag_len = strlen(tag);
+    tlvota_tag.tag = tag;
+
+    mcf_ret = mcf_read_tlvota_buffer(0, tlvota_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag positive test (partially matched tag) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & tag positive test - no matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), but user searches tag (12_NA)
+     */
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(&tlvota_tag, 0, sizeof(mcf_tlvota_tag_t));
+    tlvota_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+    strcpy(tag, "12_NA");
+    tlvota_tag.tag_len = strlen(tag);
+    tlvota_tag.tag = tag;
+
+    mcf_ret = mcf_read_tlvota_buffer(0, tlvota_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag positive test (no matched tag) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & tag positive test - item with mismatched verno in file
+     */
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(&tlvota_tag, 0, sizeof(mcf_tlvota_tag_t));
+    tlvota_tag.tag_type = MCF_TLVOTA_TAG_ICCID;
+    strcpy(tag, SBP_PARTIAL_TAG);
+    tlvota_tag.tag_len = strlen(tag);
+    tlvota_tag.tag = tag;
+
+    tlvota_file = &(pMcf->general_tlvota_file);
+    pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        ret = mcf_ut_open_test_data("MCF_TLVOTA_ICCID_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_ICCID_ut_gid_normal.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_read_tlvota_buffer(0, tlvota_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag negative test (item with mismatched verno in file) FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & tag positive test (fully matched tag) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_gid_read_tlvota_buffer_sbp(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                                  *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t                   *pFile;
+    mcf_tool_gid_tlvota_file_item_t        *pItem;
+    mcf_tlvota_file_t                      *tlvota_file;
+    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+    nvram_ef_mcf_test_struct                test_lid_buffer;
+    nvram_ef_mcf_test_struct                empty_buffer = {0};
+    mcf_tlvota_sbp_tag_t                    sbp_tag;
+    kal_uint8                               i;
+    mcf_ota_result_e                        mcf_ret;
+    kal_bool                                ret;
+
+    mcf_ut_init();
+
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), but user searches SBP_FULL_TAG (12_33_21)
+     */
+    /* Fill TLV-OTA file into buffer */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (NA_NA_NA), but user searches SBP_FULL_TAG (12_33_21)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_NA_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_NA_ut_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - fully matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_FULL_TAG (12_33_21), and user searches SBP_FULL_TAG (12_33_21)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (fully matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - no matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_FULL_TAG (12_33_21), and user searches SBP_FULL_TAG (12_33_NA)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, "", MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (no matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - no matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG_NO_SBPID (NA_33_21), and user searches SBP_FULL_TAG (12_33_21)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+             ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_no_sbpid_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_no_sbpid_ut_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (no matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - no matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_FULL_TAG (12_33_21), and user searches SBP_FULL_TAG (12_NA_NA)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+             ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, "", MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, "", MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (no matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG_NO_SBPID (NA_33_21), and user searches SBP_PARTIAL_TAG_NO_SBPID (NA_33_21)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+             ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_no_sbpid_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_no_sbpid_ut_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_ID_INVALID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (no matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+    
+    /*
+     *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), and user searches SBP_PARTIAL_TAG (12_NA_NA)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+             ret = mcf_ut_open_test_data("MCF_OPOTA_ut_gid_3d_array_bit_byte_SBP_partial.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OPOTA_ut_gid_3d_array_bit_byte_SBP_partial.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, "NA", MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, "NA", MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        if (kal_mem_cmp(&test_lid_buffer, &mcf_ut_test_lid_value_new_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (no matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+    
+    /*
+     *  General OPOTA INVALID_FILE / OPOTA SUCCESS
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), and user searches SBP_PARTIAL_TAG (12_NA_NA)
+     */
+    tlvota_file = &(pMcf->general_tlvota_file);
+    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+             ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, "NA", MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, "NA", MAX_MNC_STR_LEN);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    /*
+     *  General OPOTA SUCCESS / OPOTA INVALID_FILE
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG_NO_SBPID (NA_33_21), and user searches SBP_FULL_TAG (NA_33_21)
+     */
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+    }
+    tlvota_file = &(pMcf->general_tlvota_file);
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_no_sbpid_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_no_sbpid_ut_gid_normal.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+    
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id =  SBP_ID_INVALID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_tlvota_buffer_sbp_tag(0, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_gid_reset_lid_full(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    mcf_tool_file_info_t               *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    nvram_ef_mcf_test_struct            empty_buffer = {0};
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+    nvram_ef_mcf_test_struct            test_lid_buffer;
+    kal_uint8                           *lid_buffer;
+
+    mcf_ut_init();
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Reset all LID positive
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+
+    lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+        printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        ret = KAL_FALSE;
+    }
+
+    if (kal_mem_cmp(lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+        mcf_ut_format_err_str("Reset LID record 1 FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    free_ctrl_buffer_set_null(lid_buffer);
+  
+    
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID New OTA apply FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    /*
+     *  Reset all LID negative
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    pFile->operation_mask |= MCF_FILE_OP_NOT_RESET_LID;
+    
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    pFile->operation_mask |= MCF_FILE_OP_NOT_RESET_LID;
+    
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID New OTA apply FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+  
+    
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID New OTA apply FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+kal_bool mcf_ut_em_update_req_hdlr(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                      *pMcf = mcf_get_instance();
+    l4cps_em_update_req_struct  req;
+    kal_bool                    ret;
+
+    mcf_ut_init();
+
+    /*
+     *  EM update request handler positive test - ON
+     */
+    com_Mcf.is_em_on = KAL_FALSE;
+    req.em_src = EM_FROM_ELT;
+    req.info_request[MCF_EM_OTA_FILE_INFO] = EM_ON;
+
+    ret = mcf_em_update_req_hdlr((local_para_struct *)&req);
+    if ( (ret != KAL_TRUE) && (com_Mcf.is_em_on != KAL_TRUE) ) {
+        mcf_ut_format_err_str("EM update request handler positive test (ON) FAIL!! \r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  EM update request handler positive test - OFF
+     */
+    com_Mcf.is_em_on = KAL_TRUE;
+    req.em_src = EM_FROM_ELT;
+    req.info_request[MCF_EM_OTA_FILE_INFO] = EM_OFF;
+
+    ret = mcf_em_update_req_hdlr((local_para_struct *)&req);
+    if ( (ret != KAL_TRUE) && (com_Mcf.is_em_on != KAL_FALSE) ) {
+        mcf_ut_format_err_str("EM update request handler positive test (OFF) FAIL!! \r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  EM update request handler positive test - No change
+     */
+    com_Mcf.is_em_on = KAL_TRUE;
+    req.em_src = EM_FROM_ELT;
+    req.info_request[MCF_EM_OTA_FILE_INFO] = EM_NC;
+
+    ret = mcf_em_update_req_hdlr((local_para_struct *)&req);
+    if ( (ret != KAL_TRUE) && (com_Mcf.is_em_on != KAL_TRUE) ) {
+        mcf_ut_format_err_str("EM update request handler positive test (No change) FAIL!! \r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  EM update request handler positive test - Invalid operation
+     */
+    com_Mcf.is_em_on = KAL_TRUE;
+    req.em_src = EM_FROM_ELT;
+    req.info_request[MCF_EM_OTA_FILE_INFO] = 0xFF;
+
+    ret = mcf_em_update_req_hdlr((local_para_struct *)&req);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("EM update request handler positive test (Invalid operation) FAIL!! \r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  EM update request handler positive test - Invalid EM source
+     */
+    com_Mcf.is_em_on = KAL_TRUE;
+    req.em_src = EM_FROM_RMMI;
+    req.info_request[MCF_EM_OTA_FILE_INFO] = EM_OFF;
+
+    ret = mcf_em_update_req_hdlr((local_para_struct *)&req);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("EM update request handler positive test (Invalid EM source) FAIL!! \r\n");
+        return KAL_FALSE;
+    }
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+#if defined(__MCF_FIND_TAG_SUPPORT__)
+kal_bool mcf_ut_find_tag(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_bool    ret;
+    kal_uint16  byte_offset, bit_offset;
+    kal_uint32  size;
+    mcf_tag_info_struct   unuse;
+    MCF_DB_STRUCT_VARIABLE    const *unuse_db_ptr = NULL;
+    kal_char     tag[64];
+
+    // INT
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_BYTE_11");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 0 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+
+    // BIT
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_BIT_BYTE_11.B1");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 2 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_BIT_BYTE_11.B4");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 2 || bit_offset != 3 || size != 1)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_BIT_BYTE_12.F4B");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 3 || bit_offset != 0 || size != 4)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_BIT_BYTE_12.L4B");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 3 || bit_offset != 4 || size != 4)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_DOUBLE_1");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 24 || bit_offset != 0 || size != 8)
+        return KAL_FALSE;
+
+    // array
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_BUFFER_1");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 32 || bit_offset != 0 || size != 32)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_BUFFER_1[0]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 32 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_BUFFER_1[10]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 42 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+
+    // struct
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_1.VBYTE1");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 64 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_1.VDOUBLE");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 88 || bit_offset != 0 || size != 8)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_1.VBUFFER");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 96 || bit_offset != 0 || size != 32)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_1.VBUFFER[31]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 127 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[0].VBUFFER[0]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 896 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3.VBUFFER[0]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 896 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[0].VBUFFER");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 896 || bit_offset != 0 || size != 32)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[3].VBUFFER[0]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 2000 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[3].VBUFFER[3]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 2003 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[0].ARRAY_D[0][0][0]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 928 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[0].ARRAY_D[4][3][2]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 987 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[3].ARRAY_D[0][0][0]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 2032 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[3].ARRAY_D[4][3][2]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 2091 || bit_offset != 0 || size != 1)
+        return KAL_FALSE;
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[3].ARRAY_D4[0][0][2]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 2100 || bit_offset != 0 || size != 4)
+        return KAL_FALSE;
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "VAL_STRUCT_3[3].ARRAY_D4[4][3][2]");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_TRUE || byte_offset != 2328 || bit_offset != 0 || size != 4)
+        return KAL_FALSE;
+	
+    // can not find tag
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "XXX");
+    ret = mcf_find_tag_offset(4098, tag, &byte_offset, &bit_offset, &size, &unuse_db_ptr, &unuse);
+    if(ret != KAL_FALSE)
+        return KAL_FALSE;
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+#if defined(__MCF_FIND_GID_SUPPORT__)
+kal_bool mcf_ut_find_gid(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+	kal_bool ret = KAL_FALSE;
+	kal_uint16 lid_num;
+    kal_uint16 byte_offset;
+    kal_int16 bit_offset;
+    kal_uint32 size;
+    kal_bool is_bit;
+	
+	// val_byte_11
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 44, "", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 0 || bit_offset  != -1 || size !=1 || is_bit != KAL_FALSE) return KAL_FALSE;
+
+	// val_bit_2byte_3.F2b
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 1, "", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 2336 || bit_offset  != 8 || size != 2 || is_bit != KAL_TRUE) return KAL_FALSE;
+
+	// val_buffer_2[]
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 43, "0$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 464 || bit_offset  != -1 && size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 43, "1$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 465 || bit_offset  != -1 && size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 43, "31$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 495 || bit_offset  != -1 && size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+
+	//val_struct_3[x].array_d[x][x][x]
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 106, "0$0$0$0$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 928 || bit_offset  != -1 && size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 106, "0$4$3$2$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 987 || bit_offset  != -1 && size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 106, "2$0$0$0$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 1664 || bit_offset  != -1 && size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 106, "3$4$3$2$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 2091 || bit_offset  != -1 && size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+
+	// val_struct_3[x].vbit_byte1.b8
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 116, "2$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 1602 || bit_offset  != 7 || size != 1 || is_bit != KAL_TRUE) return KAL_FALSE;
+	// val_struct_3[x].vbit_byte2.F4b
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 118, "2$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 1603 || bit_offset  != 0 || size != 4 || is_bit != KAL_TRUE) return KAL_FALSE;
+	// val_struct_3[x].vbit_byte2.L4b
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 119, "2$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 1603 || bit_offset  != 4 || size != 4 || is_bit != KAL_TRUE) return KAL_FALSE;
+	
+	// val_struct_1.vbuffer[]
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 74, "0$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 96 || bit_offset  != -1 || size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 74, "31$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 127 || bit_offset  != -1 || size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+	
+	// val_struct_1.array_d4[][][]
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 61, "0$0$0$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 188 || bit_offset  != -1 || size != 4 || is_bit != KAL_FALSE) return KAL_FALSE;
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 61, "4$3$2$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 424 || bit_offset  != -1 || size != 4 || is_bit != KAL_FALSE) return KAL_FALSE;
+
+	// val_struct_1.array_d[][][]
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 60, "0$0$0$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 128 || bit_offset  != -1 || size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+	ret = mcf_find_gid_offset(MCF_TEST_OTA_LID_BASE_GID + 60, "4$3$2$", &lid_num, &byte_offset, &bit_offset, &size, &is_bit);
+	if(ret!= KAL_TRUE || lid_num != 4098 || byte_offset != 187 || bit_offset  != -1 || size != 1 || is_bit != KAL_FALSE) return KAL_FALSE;
+
+	MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+
+kal_bool mcf_ut_mcf_encrypt_decrypt(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_char    password[] = "MTKTEST";
+    kal_bool    ret = KAL_FALSE;
+    kal_char    content[192] = {0}; 
+    kal_uint32  content_length = 0;
+    kal_char    test_data[] = "What does it take to change everything? Technology that¡¦s great, not expensive. Technology that helps people change the world on their own terms.";
+
+    
+    strcpy(content, test_data);
+    content_length = (strlen(test_data) + 0xF & ~0xF); // 16B alignment
+
+    // CASE1 : AES128 test
+    ret =  mcf_encrypt_128bit(password, content, content_length);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    ret =  mcf_decrypt_128bit(password, content, content_length);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+
+    if(strcmp(content, test_data) != 0) return KAL_FALSE;
+    
+    // CASE2 : AES256 test
+    ret =  mcf_encrypt_256bit(password, content, content_length);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    ret =  mcf_decrypt_256bit(password, content, content_length);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+
+    if(strcmp(content, test_data) != 0) return KAL_FALSE;
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_find_ini_item(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t              *pMcf = mcf_get_instance();
+    mcf_ini_file_t     *ini_file;
+    kal_bool            ret;
+	kal_char            value[64];
+    kal_char            tag[64];
+
+    mcf_ut_init();
+    
+    ini_file = &(pMcf->ini_file);
+	
+	//kal_mem_set(&ini_file, 0, sizeof(mcf_ini_file_t));
+    /*
+     *  Read ini positive test
+     */
+    
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+
+    kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "AP_Monitor_Time");
+    
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"120") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        //return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "TagName");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"108_466_97,1_460_NA,1_460_02") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "AP_Monitor_Time");
+
+    if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"120") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "Gen_Time");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"2018.1025.120000") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	   /*
+     *  Read ini positive test --- don't care uppercase
+     */
+    
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "GeN_TIme");
+    
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"2018.1025.120000") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "GEN_TIME");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"2018.1025.120000") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "gen_time");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"2018.1025.120000") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	   /*
+     *  Read ini positive test --- don't care space
+     */
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "g e n_ tim e");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"2018.1025.120000") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "gen _ time");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"2018.1025.120000") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "AP _Monitor_Time");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"120") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+
+    /*
+     *  Read ini negative test
+     */
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "Critical");
+	
+    if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) == KAL_TRUE) {
+		mcf_ut_format_err_str("Read OTA by LID FAIL!!  \r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "Config");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) == KAL_TRUE) {
+		mcf_ut_format_err_str("Read OTA by LID FAIL!!  \r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "GenTime");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) == KAL_TRUE) {
+		mcf_ut_format_err_str("Read OTA by LID FAIL!!  \r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "Tag_Name");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) == KAL_TRUE) {
+		mcf_ut_format_err_str("Read OTA by LID FAIL!!  \r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "108");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) == KAL_TRUE) {
+		mcf_ut_format_err_str("Read OTA by LID FAIL!!  \r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "0000");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) == KAL_TRUE) {
+		mcf_ut_format_err_str("Read OTA by LID FAIL!!  \r\n");
+        return KAL_FALSE;
+	}
+
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_find_ini_sbp_id(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+	kal_uint32                         sbp_id[200];
+	kal_uint16                         sbp_id_num = 0;
+	kal_uint16                         i = 0;
+	kal_uint32                         sbp_id_ans[5]={108,1};
+	kal_bool                           general = KAL_FALSE;
+    kal_char                           tag[64];
+
+    mcf_ut_init();
+	
+    /*
+     *  Read ini positive test
+     */
+    
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "108_466_97,1_460_NA,1_460_02");
+    if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	
+	
+	
+	for (i = 0; i < sbp_id_num; i++){
+		if (sbp_id[i] != sbp_id_ans[i]){
+			mcf_ut_format_err_str("Find ini file sbp id FAIL!! sbp id(%d) sbp id ans(%d) \r\n", sbp_id[i], sbp_id_ans[i]);
+			return KAL_FALSE;
+		}
+	}
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "108_466_97,1_460_NA,1_460_02,1_450_01,1_10_1");
+    if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+
+	
+	for (i = 0; i < sbp_id_num; i++){
+		if (sbp_id[i] != sbp_id_ans[i]){
+			mcf_ut_format_err_str("Find ini file sbp id FAIL!! sbp id(%d) sbp id ans(%d) \r\n", sbp_id[i], sbp_id_ans[i]);
+			return KAL_FALSE;
+		}
+	}
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "108_470_97,108_466_97,1_460_NA,1_460_02");
+	if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+
+	
+	for (i = 0; i < sbp_id_num; i++){
+		if (sbp_id[i] != sbp_id_ans[i]){
+			mcf_ut_format_err_str("Find ini file sbp id FAIL!! sbp id(%d) sbp id ans(%d) \r\n", sbp_id[i], sbp_id_ans[i]);
+			return KAL_FALSE;
+		}
+	}
+	
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "108_470_97,108_466_97,1_460_NA,1_460_02,");
+	if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+
+	
+	for (i = 0; i < sbp_id_num; i++){
+		if (sbp_id[i] != sbp_id_ans[i]){
+			mcf_ut_format_err_str("Find ini file sbp id FAIL!! sbp id(%d) sbp id ans(%d) \r\n", sbp_id[i], sbp_id_ans[i]);
+			return KAL_FALSE;
+		}
+	}
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "108_470_97,108_466_97,105_25_43,5_470_123,5_460_NA,1_460_NA,1_460_02");
+    if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	
+	sbp_id_ans[0]=108; sbp_id_ans[1]=105; sbp_id_ans[2]=5; sbp_id_ans[3]=1; 
+	
+	
+	for (i = 0; i < sbp_id_num; i++){
+		if (sbp_id[i] != sbp_id_ans[i]){
+			mcf_ut_format_err_str("Find ini file sbp id FAIL!! sbp id(%d) sbp id ans(%d) \r\n", sbp_id[i], sbp_id_ans[i]);
+			return KAL_FALSE;
+		}
+	}
+	
+	//NA case
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "NA_123_45,NA_02_53,108_470_97,108_466_97,1_460_NA,1_460_02,");
+	if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if (general != KAL_TRUE){
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! general(%d)  \r\n", general);
+		return KAL_FALSE;
+	}
+	
+	//ICCID case
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "123456,NA_02_53,108_470_97,108_466_97,1_460_NA,1_460_02,");
+	if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if (general != KAL_TRUE){
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! general(%d)  \r\n", general);
+		return KAL_FALSE;
+	}
+	
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "123456");
+	if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if (general != KAL_TRUE){
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! general(%d)  \r\n", general);
+		return KAL_FALSE;
+	}
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "108_460_32,123456");
+    if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if (general != KAL_TRUE){
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! general(%d)  \r\n", general);
+		return KAL_FALSE;
+	}
+	
+	kal_mem_set(tag, 0, 64);
+    strcpy(tag, "108_460_32");
+    if (mcf_find_ini_sbp_id(tag, sbp_id, &sbp_id_num, &general) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find ini file sbp id FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	for (i = 0; i < sbp_id_num; i++){
+		if (sbp_id[i] != sbp_id_ans[i]){
+			mcf_ut_format_err_str("Find ini file sbp id FAIL!! sbp id(%d) sbp id ans(%d) \r\n", sbp_id[i], sbp_id_ans[i]);
+			return KAL_FALSE;
+		}
+	}
+	
+	
+	
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_compose_ini_item(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_bool                            ret;
+	mcf_t                              *pMcf = mcf_get_instance();
+    mcf_ini_file_t                     *ini_file = &(pMcf->ini_file);
+	kal_char                           value[64];
+    kal_char                           test_data_path[512];
+    kal_char                           *pos; 
+    kal_char                           tag[64];
+    kal_char                           new_value[64];
+    kal_char                           old_value[64];
+	
+
+    mcf_ut_init();
+	
+
+    /*
+     *  Read ini positive test
+     */
+	kal_mem_set(ini_file->buff, 0, MCF_MAX_INI_FILE_SIZE);
+	kal_mem_set(ini_file->tmp_buff, 0, MCF_MAX_INI_FILE_SIZE);
+    ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG.ini", ini_file->buff, MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+
+	kal_mem_set(tag, 0, 64);
+    kal_mem_set(new_value, 0, 64);
+    kal_mem_set(old_value, 0, 64);
+    strcpy(tag, "AP_Monitor_Time");
+    strcpy(old_value, "120");
+    strcpy(new_value, "2");
+    
+    if (mcf_compose_ini_item(ini_file->buff, ini_file->tmp_buff, tag, old_value, new_value) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find compose_ini_item FAIL!! item(%s) value(%s) \r\n", tag, new_value);
+        return KAL_FALSE;
+	}
+    
+    /* Change write permission of ini file */
+    getcwd(test_data_path, sizeof(test_data_path));
+    pos = strstr(test_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MTK_MD_OTA_CONFIG_WRITE.ini", '\0');
+    chmod(test_data_path, 0666);
+	
+	ret = mcf_ut_write_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", ini_file->tmp_buff);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+	
+	
+	/* Read again */
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+    kal_mem_set(tag, 0, 64);
+    kal_mem_set(new_value, 0, 64);
+    kal_mem_set(old_value, 0, 64);
+    strcpy(tag, "TagName");
+    strcpy(old_value, "108_466_97,1_460_NA,1_460_02");
+    strcpy(new_value, "108_466_97,1_460_02");
+    
+	if (mcf_compose_ini_item(ini_file->buff, ini_file->tmp_buff, tag, old_value, new_value) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find compose_ini_item FAIL!! item(%s) value(%s) \r\n", tag, new_value);
+        return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_write_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", ini_file->tmp_buff);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+	
+	
+	/* Read again */
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+    kal_mem_set(tag, 0, 64);
+    kal_mem_set(new_value, 0, 64);
+    kal_mem_set(old_value, 0, 64);
+    strcpy(tag, "AP_Monitor_Time");
+    strcpy(old_value, "2");
+    strcpy(new_value, "23000");
+    
+	if (mcf_compose_ini_item(ini_file->buff, ini_file->tmp_buff, tag, old_value, new_value) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find compose_ini_item FAIL!! item(%s) value(%s) \r\n", tag, new_value);
+        return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_write_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", ini_file->tmp_buff);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+	
+	
+	/* Read again */
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+	kal_mem_set(tag, 0, 64);
+    kal_mem_set(new_value, 0, 64);
+    kal_mem_set(old_value, 0, 64);
+    strcpy(tag, "Gen_Time");
+    strcpy(old_value, "2018.1025.120000");
+    strcpy(new_value, "2018.1104.182054");
+    
+    if (mcf_compose_ini_item(ini_file->buff, ini_file->tmp_buff, tag, old_value, new_value) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find compose_ini_item FAIL!! item(%s) value(%s) \r\n", tag, new_value);
+        return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_write_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", ini_file->tmp_buff);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+	
+	
+	/* Read again */
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+	/* New item */
+	
+    kal_mem_set(tag, 0, 64);
+    kal_mem_set(new_value, 0, 64);
+    kal_mem_set(old_value, 0, 64);
+    strcpy(tag, "Reboot_Mode");
+    strcpy(old_value, "");
+    strcpy(new_value, "1");
+    
+	if (mcf_compose_ini_item(ini_file->buff, ini_file->tmp_buff, tag, old_value, new_value) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find compose_ini_item FAIL!! item(%s) value(%s) \r\n", tag, new_value);
+        return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_write_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", ini_file->tmp_buff);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+	
+	
+	/* Read again */
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+    kal_mem_set(tag, 0, 64);
+    kal_mem_set(new_value, 0, 64);
+    kal_mem_set(old_value, 0, 64);
+    strcpy(tag, "GenTime");
+    strcpy(old_value, "");
+    strcpy(new_value, "2018.1106.110355");
+    
+	if (mcf_compose_ini_item(ini_file->buff, ini_file->tmp_buff, tag, old_value, new_value) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find compose_ini_item FAIL!! item(%s) value(%s) \r\n", tag, new_value);
+        return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_write_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", ini_file->tmp_buff);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+	
+	
+	/* Read again */
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+    kal_mem_set(tag, 0, 64);
+    kal_mem_set(new_value, 0, 64);
+    kal_mem_set(old_value, 0, 64);
+    strcpy(tag, "BatteryLife");
+    strcpy(old_value, "");
+    strcpy(new_value, "87%");
+    
+	if (mcf_compose_ini_item(ini_file->buff, ini_file->tmp_buff, tag, old_value, new_value) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find compose_ini_item FAIL!! item(%s) value(%s) \r\n", tag, new_value);
+        return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_write_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", ini_file->tmp_buff);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+
+    kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "AP_Monitor_Time");
+    
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"23000") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "GenTime");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"2018.1106.110355") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "TagName");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"108_466_97,1_460_02") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "Gen_Time");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"2018.1104.182054") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "Reboot_Mode");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"1") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "BatteryLife");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"87%") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "Battery Life");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"87%") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "BaTTery LIFE");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"87%") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	/* Read again */
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+    kal_mem_set(tag, 0, 64);
+    kal_mem_set(new_value, 0, 64);
+    kal_mem_set(old_value, 0, 64);
+    strcpy(tag, "Gen_Time");
+    strcpy(old_value, "2018.1104.182054");
+    strcpy(new_value, "");
+    
+	if (mcf_compose_ini_item(ini_file->buff, ini_file->tmp_buff, tag, old_value, new_value) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find compose_ini_item FAIL!! item(%s) value(%s) \r\n", tag, new_value);
+        return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_write_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", ini_file->tmp_buff);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "Gen_Time");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+    kal_mem_set(tag, 0, 64);
+    kal_mem_set(new_value, 0, 64);
+    kal_mem_set(old_value, 0, 64);
+    strcpy(tag, "Gen_Time");
+    strcpy(old_value, "");
+    strcpy(new_value, "125_25_67");
+    
+	if (mcf_compose_ini_item(ini_file->buff, ini_file->tmp_buff, tag, old_value, new_value) != KAL_TRUE) {
+		mcf_ut_format_err_str("Find compose_ini_item FAIL!! item(%s) value(%s) \r\n", tag, new_value);
+        return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_write_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", ini_file->tmp_buff);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG.ini");
+		return KAL_FALSE;
+	}
+	
+	ret = mcf_ut_open_test_data("MTK_MD_OTA_CONFIG_WRITE.ini", (kal_char *)(ini_file->buff), MCF_MAX_INI_FILE_SIZE);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_MD_OTA_CONFIG_WRITE.ini");
+		return KAL_FALSE;
+	}
+	
+	kal_mem_set(value, 0, 64);
+    
+    kal_mem_set(tag, 0, 64);
+    strcpy(tag, "Gen_Time");
+	
+	if (mcf_find_ini_item((kal_char *)ini_file->buff, tag, value, pMcf) != KAL_TRUE) {
+		mcf_ut_format_err_str("Read ini file FAIL!! item(%s) \r\n", tag);
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(value,"125_25_67") != 0){
+		mcf_ut_format_err_str("Read ini file positive test FAIL!!\r\n");
+        return KAL_FALSE;
+	}
+	
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_mcf_boot_trace(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+	kal_uint32 d1 = 100, d2 = 200;
+	char string[] = "MCF TEST";
+	char string2[] = "MCF TEST2";
+	kal_uint32 i = 0;
+	
+	mcf_do_ota_full();
+	
+	MCF_BOOT_TRACE(MCF_BOOT_TRACE_TEST2);
+	MCF_BOOT_TRACE(MCF_BOOT_TRACE_TEST1, d1);
+	MCF_BOOT_TRACE(MCF_BOOT_TRACE_TEST3, string);
+	MCF_BOOT_TRACE(MCF_BOOT_TRACE_TEST4, d1, string);
+	MCF_BOOT_TRACE(MCF_BOOT_TRACE_TEST5, string, string2, d1);
+	
+	for(i = 0;i< 10000;i++)
+	{
+		MCF_BOOT_TRACE(MCF_BOOT_TRACE_TEST5, string, string2, d1);
+	}
+	
+	mcf_dump_boot_trace();
+	
+	MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_config_LID(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_bool                                                ret;
+    l4c_mcf_config_lid_variable_operation_req_struct       *req = NULL;
+    l4c_mcf_config_lid_variable_operation_cnf_struct       *cnf = NULL;
+    mcf_ota_result_e                                        mcf_ret = MCF_OTA_R_SUCCESS;
+    mcf_t                                                  *pMcf = mcf_get_instance();
+    mcf_ota_file_t                                         *ota_file = &(pMcf->ota_file);
+    mcf_tool_file_info_t                                   *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    nvram_ef_mcf_ota_file_info_struct                       nv_ota_file;
+    nvram_ef_mcf_sw_info_struct                             nv_sw_info;
+    mcf_tlvota_file_t                                      *tlvota_file;
+    nvram_ef_mcf_tlvota_file_info_struct                    nv_tlvota_file;
+    mcf_tlvota_sbp_tag_t                                    sbp_tag;
+    kal_uint8                                               i;
+    kal_uint8                                               test_pattern[512];
+
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Apply default OTA
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    
+    
+    /*
+     * Set OTA path in default path positive test
+     */
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_BYTE_11");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable FAIL!!(%s)\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_byte_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_BYTE_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, VAL_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_BIT_BYTE_11");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable FAIL!!(%s)\r\n", "VAL_BIT_BYTE_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_bit_byte_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_BIT_BYTE_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, VAL_BIT_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_BIT_BYTE_11.B3");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_BIT_BYTE_11.B3");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "01", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_BIT_BYTE_11.B3, %s, %s\r\n", cnf->value, "01");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, VAL_BIT_BYTE_11.B3, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_byte_12");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_byte_12");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_bit_byte_12), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_byte_12, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_bit_byte_12, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_byte_12.L4b");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_byte_12.L4b");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_byte_12.F4b, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_bit_byte_12.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_short_11");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_short_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_short_11), cnf->len*2, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*4) != 0){
+        mcf_ut_format_err_str("Config LID, val_short_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_short_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->tag_name, "val_double_1");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_double_1");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_double_1), cnf->len*8, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*16) != 0){
+        mcf_ut_format_err_str("Config LID, val_double_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_double_1, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+	req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->tag_name, "val_buffer_1");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_buffer_1");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_buffer_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("Config LID, val_buffer_1, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_buffer_1");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_buffer_1");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_buffer_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 32){
+        mcf_ut_format_err_str("Config LID, val_buffer_1, %d, %d\r\n", cnf->len, 32);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->tag_name, "val_buffer_1[0]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_buffer_1[0]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_buffer_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_buffer_1, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->tag_name, "val_struct_1.vfloat");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_struct_1.vfloat");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_struct_1.vfloat), cnf->len*4, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*8) != 0){
+        mcf_ut_format_err_str("Config LID, val_struct_1.vfloat, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_struct_1.vfloat, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->tag_name, "val_struct_3[0].vint");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_struct_3[0].vint");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_struct_3[0].vint), cnf->len*4, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*8) != 0){
+        mcf_ut_format_err_str("Config LID, val_struct_3[0].vint, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_struct_3[0].vint, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+	req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_struct_3[0]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_struct_3[0]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+	if(strncmp((kal_char *)(cnf->value), test_pattern, 510) != 0){
+         mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0], %s, %s\r\n", cnf->value, test_pattern);
+         return KAL_FALSE;
+     }
+    
+     if(cnf->len != 255){
+         mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0], %d, %d\r\n", cnf->len, 255);
+         return KAL_FALSE;
+     }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    
+
+
+    /* negative test */
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[3].VBUFFER[2][4][5]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[3].VBUFFER[2][4][5]");
+        return KAL_FALSE;
+    }
+
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    /* Test TLV OTA */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_NA_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_NA_ut_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    req->ps_id = 0;
+    strcpy(req->tag_name, "VAL_BYTE_11");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_byte_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_BYTE_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, VAL_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    
+    /* Test 3-d array */
+    
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Apply 3-d array default OTA
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_3d_array_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_3d_array_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D[4][3][2]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][3][2]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "06", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4][3][2], %s, %s\r\n", cnf->value, "06");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4][3][2], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 4;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D[4][3]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][3]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4][3], %s, %s\r\n", cnf->value, "060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 3){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4][3], %d, %d\r\n", cnf->len, 3);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D[4][3]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][3]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4][3], %s, %s\r\n", cnf->value, "060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 3){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4][3], %d, %d\r\n", cnf->len, 3);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D[4]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060606060606060606060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4], %s, %s\r\n", cnf->value, "060606060606060606060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 12){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4], %d, %d\r\n", cnf->len, 12);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D, %s, %s\r\n", cnf->value, "060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 60){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D, %d, %d\r\n", cnf->len, 60);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D[4][2]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][2]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4][2], %s, %s\r\n", cnf->value, "0606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[4][2], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 10;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D[3]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[3]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "06060606060606060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[3], %s, %s\r\n", cnf->value, "06060606060606060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 10){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D[3], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    
+    /* Different variable size */
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D4[4][3][2]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4][3][2]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "06000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4][3][2], %s, %s\r\n", cnf->value, "06000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4][3][2], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D4[4][3]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4][3]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060000000600000006000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4][3], %s, %s\r\n", cnf->value, "060000000600000006000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 3){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4][3], %d, %d\r\n", cnf->len, 3);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D4[4]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060000000600000006000000060000000600000006000000060000000600000006000000060000000600000006000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4], %s, %s\r\n", cnf->value, "060000000600000006000000060000000600000006000000060000000600000006000000060000000600000006000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 12){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4], %d, %d\r\n", cnf->len, 12);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D4[4]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0600000006000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4], %s, %s\r\n", cnf->value, "0600000006000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D4[4][2]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4][2]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0600000006000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4], %s, %s\r\n", cnf->value, "0600000006000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4[4], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D4");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern, 0 , 512);
+    for (i = 0; i < cnf->len; i++){
+        kal_mem_cpy(test_pattern+(i*8),"06000000",8);
+    }
+    
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*8) != 0){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 60){
+        mcf_ut_format_err_str("Config LID, VAL_STRUCT_3[0].ARRAY_D4, %d, %d\r\n", cnf->len, 60);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    /* Nagative test case */
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[0].ARRAY_D[5]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[5]");
+        return KAL_FALSE;
+    }
+
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "VAL_STRUCT_3[4]");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "VAL_STRUCT_3[4]");
+        return KAL_FALSE;
+    }
+
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    /*
+     *  Apply 2bytes to bit default OTA
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_2_byte_4_byte_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_2byte_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_2byte_3");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_2byte_3");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "F02F", cnf->len*4) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3, %s, %s\r\n", cnf->value, "F02F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3, %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_2byte_3.F4b");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_2byte_3.F4b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "00", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.F4b, %s, %s\r\n", cnf->value, "00");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_2byte_3.L4b");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_2byte_3.L4b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.L4b, %s, %s\r\n", cnf->value, "0F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.L4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_2byte_3.F2b");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_2byte_3.F2b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "03", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.F2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.F2b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_2byte_3.L2b");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_2byte_3.L2b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "03", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.L2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.L2b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_2byte_3.b2");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_2byte_3.b2");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "01", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.b2, %s, %s\r\n", cnf->value, "01");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_bit_2byte_3.b2, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_4byte_3");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_4byte_3");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0001FE0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_4byte_3, %s, %s\r\n", cnf->value, "0001FE0F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("Config LID, val_bit_4byte_3, %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_4byte_3.F9b");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_4byte_3.F9b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0001", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_4byte_3.F9b, %s, %s\r\n", cnf->value, "0001");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("Config LID, val_bit_4byte_3.F9b, %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_4byte_3.F4b");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_4byte_3.F4b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_4byte_3.F4b, %s, %s\r\n", cnf->value, "0F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_bit_4byte_3.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_config_lid_variable_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_LID_VARIABLE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->lid_num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->tag_name, "val_bit_4byte_3.F2b");
+    
+    cnf = (l4c_mcf_config_lid_variable_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_config_lid_variable_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_config_LID_variable(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Config LID variable (%s) FAIL!!\r\n", "val_bit_4byte_3.F2b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "03", cnf->len*2) != 0){
+        mcf_ut_format_err_str("Config LID, val_bit_4byte_3.F2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("Config LID, val_bit_4byte_3.F2b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_query_variable_value(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_bool                                                ret;
+    l4c_mcf_variable_value_operation_req_struct                *req = NULL;
+    l4c_mcf_variable_value_operation_cnf_struct                *cnf = NULL;
+    mcf_ota_result_e                                        mcf_ret = MCF_OTA_R_SUCCESS;
+    mcf_t                                                  *pMcf = mcf_get_instance();
+    mcf_ota_file_t                                         *ota_file = &(pMcf->ota_file);
+    mcf_tool_file_info_t                                   *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    nvram_ef_mcf_ota_file_info_struct                       nv_ota_file;
+    nvram_ef_mcf_sw_info_struct                             nv_sw_info;
+    mcf_tlvota_file_t                                      *tlvota_file;
+    nvram_ef_mcf_tlvota_file_info_struct                    nv_tlvota_file;
+    mcf_tlvota_sbp_tag_t                                    sbp_tag;
+    kal_uint8                                               i;
+    kal_uint8                                               test_pattern[512];
+    kal_uint8                                               array_tag[16];
+    nvram_ef_mcf_test_struct                                nv_lid_buffer;
+
+#ifdef __MCF_FIND_TAG_SUPPORT__    
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Apply default OTA
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+     //Byte operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_BYTE_11");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_byte_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BYTE_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //Bit operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_BIT_BYTE_11");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_bit_byte_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_BIT_BYTE_11.B3");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11.B3");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "01", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11.B3, %s, %s\r\n", cnf->value, "01");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11.B3, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_byte_12");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_byte_12");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_bit_byte_12), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_byte_12, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_byte_12, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_byte_12.L4b");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_byte_12.L4b");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_byte_12.F4b, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_byte_12.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //short operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_short_11");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_short_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_short_11), cnf->len*2, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*4) != 0){
+        mcf_ut_format_err_str("val_short_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_short_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+
+    //double operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "val_double_1");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_double_1");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_double_1), cnf->len*8, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*16) != 0){
+        mcf_ut_format_err_str("val_double_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_double_1, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+	//buffer operation with len = 2
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "val_buffer_1");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_buffer_1");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_buffer_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("val_buffer_1, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //buffer operation - read all buffer
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_buffer_1");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_buffer_1");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_buffer_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 32){
+        mcf_ut_format_err_str("val_buffer_1, %d, %d\r\n", cnf->len, 32);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //buffer operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "val_buffer_1[0]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_buffer_1[0]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_buffer_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_buffer_1, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //float operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "val_struct_1.vfloat");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_struct_1.vfloat");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_struct_1.vfloat), cnf->len*4, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*8) != 0){
+        mcf_ut_format_err_str("val_struct_1.vfloat, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_struct_1.vfloat, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //int in struct operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "val_struct_3[0].vint");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_struct_3[0].vint");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_struct_3[0].vint), cnf->len*4, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*8) != 0){
+        mcf_ut_format_err_str("val_struct_3[0].vint, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_struct_3[0].vint, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+	//struct operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_struct_3[0]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_struct_3[0]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+	if(strncmp((kal_char *)(cnf->value), test_pattern, 510) != 0){
+         mcf_ut_format_err_str("VAL_STRUCT_3[0], %s, %s\r\n", cnf->value, test_pattern);
+         return KAL_FALSE;
+     }
+    
+     if(cnf->len != 255){
+         mcf_ut_format_err_str("VAL_STRUCT_3[0], %d, %d\r\n", cnf->len, 255);
+         return KAL_FALSE;
+     }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //buffer in struct operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[3].VBUFFER[2][4][5]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[3].VBUFFER[2][4][5]");
+        return KAL_FALSE;
+    }
+
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    
+    /* Test TLV OTA */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_NA_ut_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_NA_ut_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    
+    //byte operation
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    req->ps_id = 0;
+    strcpy(req->config, "VAL_BYTE_11");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_byte_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BYTE_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    
+    /* Test 3-d array */
+    
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Apply 3-d array default OTA
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_3d_array_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_3d_array_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D[4][3][2]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][3][2]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "06", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3][2], %s, %s\r\n", cnf->value, "06");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3][2], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 4;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D[4][3]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][3]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3], %s, %s\r\n", cnf->value, "060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 3){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3], %d, %d\r\n", cnf->len, 3);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D[4][3]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][3]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3], %s, %s\r\n", cnf->value, "060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 3){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3], %d, %d\r\n", cnf->len, 3);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D[4]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060606060606060606060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4], %s, %s\r\n", cnf->value, "060606060606060606060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 12){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4], %d, %d\r\n", cnf->len, 12);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D, %s, %s\r\n", cnf->value, "060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 60){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D, %d, %d\r\n", cnf->len, 60);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D[4][2]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][2]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][2], %s, %s\r\n", cnf->value, "0606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][2], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 10;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D[3]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[3]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "06060606060606060606", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[3], %s, %s\r\n", cnf->value, "06060606060606060606");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 10){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[3], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    
+    /* Different variable size */
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D4[4][3][2]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4][3][2]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "06000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][3][2], %s, %s\r\n", cnf->value, "06000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][3][2], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D4[4][3]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4][3]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060000000600000006000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][3], %s, %s\r\n", cnf->value, "060000000600000006000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 3){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][3], %d, %d\r\n", cnf->len, 3);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D4[4]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "060000000600000006000000060000000600000006000000060000000600000006000000060000000600000006000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %s, %s\r\n", cnf->value, "060000000600000006000000060000000600000006000000060000000600000006000000060000000600000006000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 12){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %d, %d\r\n", cnf->len, 12);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D4[4]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0600000006000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %s, %s\r\n", cnf->value, "0600000006000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D4[4][2]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4][2]");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0600000006000000", cnf->len*8) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %s, %s\r\n", cnf->value, "0600000006000000");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D4");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern, 0 , 512);
+    for (i = 0; i < cnf->len; i++){
+        kal_mem_cpy(test_pattern+(i*8),"06000000",8);
+    }
+    
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*8) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 60){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4, %d, %d\r\n", cnf->len, 60);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    /* Nagative test case */
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[0].ARRAY_D[5]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[5]");
+        return KAL_FALSE;
+    }
+
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "VAL_STRUCT_3[4]");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[4]");
+        return KAL_FALSE;
+    }
+
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    /*
+     *  Apply 2bytes to bit default OTA
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_2_byte_4_byte_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_2byte_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_2byte_3");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "F02F", cnf->len*4) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3, %s, %s\r\n", cnf->value, "F02F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("val_bit_2byte_3, %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_2byte_3.F4b");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.F4b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "00", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.F4b, %s, %s\r\n", cnf->value, "00");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_2byte_3.L4b");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.L4b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.L4b, %s, %s\r\n", cnf->value, "0F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.L4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_2byte_3.F2b");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.F2b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "03", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.F2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.F2b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_2byte_3.L2b");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.L2b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "03", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.L2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.L2b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_2byte_3.b2");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.b2");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "01", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.b2, %s, %s\r\n", cnf->value, "01");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.b2, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_4byte_3");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_4byte_3");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0001FE0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_4byte_3, %s, %s\r\n", cnf->value, "0001FE0F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("val_bit_4byte_3, %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_4byte_3.F9b");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_4byte_3.F9b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0001", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_4byte_3.F9b, %s, %s\r\n", cnf->value, "0001");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("val_bit_4byte_3.F9b, %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_4byte_3.F4b");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_4byte_3.F4b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_4byte_3.F4b, %s, %s\r\n", cnf->value, "0F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_4byte_3.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_PATH;
+    req->num = 4098;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "val_bit_4byte_3.F2b");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Query Variable Value (%s) FAIL!!\r\n", "val_bit_4byte_3.F2b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "03", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_4byte_3.F2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_4byte_3.F2b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+#else
+    
+#endif
+
+    /*Query variable with gid format*/
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Apply default OTA
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Reset LID FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+     //Byte operation - VAL_BYTE_11
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+44;
+    req->rec_id = 1;
+    req->len = 0;
+    kal_mem_set(array_tag, 0, 16);
+    strcpy(req->config, array_tag);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_byte_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BYTE_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //Bit operation - VAL_BIT_BYTE_11
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+18;
+    req->rec_id = 1;
+    req->len = 0;
+    kal_mem_set(array_tag, 0, 16);
+    strcpy(req->config, array_tag);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BIT_BYTE_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_bit_byte_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //Bit operation - VAL_BIT_BYTE_11.B3
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+21;
+    req->rec_id = 1;
+    req->len = 0;
+    kal_mem_set(array_tag, 0, 16);
+    strcpy(req->config, array_tag);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BIT_BYTE_11.B3");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "01", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11.B3, %s, %s\r\n", cnf->value, "01");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11.B3, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //Bit operation - val_bit_byte_12 
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+27;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_byte_12");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_bit_byte_12), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_byte_12, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_byte_12, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //Bit operation - val_bit_byte_12.L4b
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+29;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_byte_12.L4b");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_byte_12.F4b, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_byte_12.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //short operation - val_short_11
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+56;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_short_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_short_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_short_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("val_short_11, %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+
+    //double operation - val_double_1
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+48;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_double_1");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_double_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_double_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 8){
+        mcf_ut_format_err_str("val_double_1, %d, %d\r\n", cnf->len, 8);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+	//buffer operation with len = 2 - val_buffer_1
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+42;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_buffer_1");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_buffer_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("val_buffer_1, %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //buffer operation - read all buffer - val_buffer_1[0]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+42;
+    req->rec_id = 1;
+    req->len = 32;
+    strcpy(req->config, "0");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_buffer_1[0]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_buffer_1[0], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 32){
+        mcf_ut_format_err_str("val_buffer_1[0], %d, %d\r\n", cnf->len, 32);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //buffer operation - val_buffer_1[0]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+42;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "0");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_buffer_1[0]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_buffer_1[0], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("val_buffer_1[0], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //float operation - val_struct_1.vfloat
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+78;
+    req->rec_id = 1;
+    req->len = 4;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_struct_1.vfloat");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_struct_1.vfloat), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_struct_1.vfloat, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("val_struct_1.vfloat, %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //int in struct operation - val_struct_3[0].vint
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+125;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_struct_3[0].vint");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_struct_3[0].vint), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_struct_3[0].vint, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("val_struct_3[0].vint, %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+    
+    //buffer in struct operation - VAL_STRUCT_3[3].VBUFFER[2][4][5]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+120;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "3,2,4,5");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[3].VBUFFER[2][4][5]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_struct_3[3].vbuffer[2]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[3].VBUFFER[2][4][5], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_STRUCT_3[3].VBUFFER[2][4][5], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    /* Test TLV OTA */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_NA_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_NA_ut_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    
+    //byte operation - VAL_BYTE_11
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+44;
+    req->rec_id = 1;
+    req->len = 0;
+    req->ps_id = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_pattern.val_byte_11), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BYTE_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    
+    /* Test 3-d array */
+    
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Apply 3-d array and bit byte operation default OTA 
+     */
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_3d_array_and_bit_byte_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_3d_array_and_bit_byte_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Reset LID FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, (kal_uint8 *)&nv_lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+        mcf_ut_format_err_str("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+        ret = KAL_FALSE;
+    }
+    
+    if ( kal_mem_cmp((kal_uint8 *)&nv_lid_buffer, &mcf_ut_test_lid_value_new_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+        ret = KAL_FALSE;
+        mcf_ut_format_err_str("Do full OTA positive test (SW verno match) FAIL!!\r\n");
+    }
+
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D[4][3][2]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0,4,3,2");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][3][2]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d[4][3][2]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3][2], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3][2], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D[4][3]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0,4,3");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][3]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d[4][3]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][3], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D[4]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0,4");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d[4]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D[4][2]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "0,4,2");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[4][2]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d[4][2]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][2], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[4][2], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D[3]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 10;
+    strcpy(req->config, "0,3");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[3]");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d[3]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[3], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 10){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[3], %d, %d\r\n", cnf->len, 10);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    
+    /* Different variable size */
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D4[4][3][2]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+107;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0,4,3,2");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4][3][2]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d4[4][3][2]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][3][2], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][3][2], %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D4[4][3]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+107;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0,4,3");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4][3]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d4[4][3]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][3], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][3], %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D4[4]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+107;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0,4");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4]");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d4[4]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D4[4]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+107;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "0,4");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d4[4]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D4[4][2]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+107;
+    req->rec_id = 1;
+    req->len = 2;
+    strcpy(req->config, "0,4,2");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4[4][2]");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d4[4]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][2], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4[4][2], %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D4
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+107;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D4");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d4), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D4, %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    /* Nagative test case */
+    
+    //over array size - VAL_STRUCT_3[0].ARRAY_D[5] 
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0,5");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("over array size! VAL_STRUCT_3[0].ARRAY_D[5] is not FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //over array size - VAL_STRUCT_3[4].ARRAY_D
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "4");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_INVALID_PARAMETER) {
+        mcf_ut_format_err_str("over array size! VAL_STRUCT_3[4].ARRAY_D is not FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation- val_bit_2byte_3
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "FFFF", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3, %s, %s\r\n", cnf->value, "FFFF");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("val_bit_2byte_3, %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation- val_bit_2byte_3.F4b
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+2;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.F4b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.F4b, %s, %s\r\n", cnf->value, "0F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation - val_bit_2byte_3.L4b
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+4;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.L4b");
+        return KAL_FALSE;
+    }
+
+
+    if(strncmp((kal_char *)(cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.L4b, %s, %s\r\n", cnf->value, "0F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.L4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation - val_bit_2byte_3.F2b
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+1;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.F2b");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "03", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.F2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.F2b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation - val_bit_2byte_3.L2b
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+3;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.L2b");
+        return KAL_FALSE;
+    }
+    
+
+    if(strncmp((kal_char *)(cnf->value), "03", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.L2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.L2b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation - val_bit_2byte_3.b2
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+6;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_2byte_3.b2");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "01", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_2byte_3.b2, %s, %s\r\n", cnf->value, "01");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_2byte_3.b2, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation - val_bit_4byte_3
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+9;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_4byte_3");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "FFFFFFFF", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_4byte_3, %s, %s\r\n", cnf->value, "FFFFFFFF");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("val_bit_4byte_3, %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation - val_bit_4byte_3.F9b
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+12;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_4byte_3.F9b");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "FF01", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_4byte_3.F9b, %s, %s\r\n", cnf->value, "FF01");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("val_bit_4byte_3.F9b, %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation - val_bit_4byte_3.F4b
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+11;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_4byte_3.F4b");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "0F", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_4byte_3.F4b, %s, %s\r\n", cnf->value, "0F");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_4byte_3.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //2 byte bit operation - val_bit_4byte_3
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+10;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_4byte_3.F2b");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "03", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_4byte_3.F2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_4byte_3.F2b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    /* Negative test */
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D[3] - not end '$'
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 10;
+    strcpy(req->config, "0,3");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[3]");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d[3]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[3], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 10){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[3], %d, %d\r\n", cnf->len, 10);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //3-D array operation - VAL_STRUCT_3[0].ARRAY_D[3] - not use '$' to separate - result = VAL_STRUCT_3[0].ARRAY_D[0]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+106;
+    req->rec_id = 1;
+    req->len = 1;
+    strcpy(req->config, "0,3");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_STRUCT_3[0].ARRAY_D[3]");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(mcf_ut_test_lid_value_new_pattern.val_struct_3[0].array_d[3]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+
+    if(strncmp((kal_char *)(cnf->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[3], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_STRUCT_3[0].ARRAY_D[3], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    //Read len is too large - val_bit_4byte_3(4 byte)
+     req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+9;
+    req->rec_id = 1;
+    req->len = 4;
+    strcpy(req->config, "");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "val_bit_4byte_3.F2b");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((kal_char *)(cnf->value), "FFFFFFFF", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_4byte_3.F2b, %s, %s\r\n", cnf->value, "03");
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("val_bit_4byte_3.F2b, %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_ut_mcf_check_lid_need_reset(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+
+    mcf_ut_init();
+
+    /*
+     *  Check LID need reset positive test - Modify 3 LIDs
+     */
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("OTA_3_LIDs.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "OTA_3_LIDs.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Check LID need reset positive test - Modify 2 LIDs
+     */
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("OTA_2_LIDs.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "OTA_2_LIDs.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Check LID need reset positive test - OTA file does not update
+     */
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Check LID need reset positive test - Max last LID list count
+     */
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_last_mod_lid_g.lid_cnt = NVRAM_MCF_SAVE_LAST_LID_CNT;
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max last LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max last LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max last LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Check LID need reset positive test - Max current LID list count
+     */
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_curr_mod_lid_g.lid_cnt = NVRAM_MCF_SAVE_LAST_LID_CNT;
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max current LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max current LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max current LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+
+	MCF_UT_PASS();
+    return KAL_TRUE;
+}
+kal_bool mcf_ut_gid_mcf_check_lid_need_reset(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+
+    mcf_ut_init();
+
+    /*
+     *  Check LID need reset positive test - Modify 3 LIDs
+     */
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("OTA_3_LIDs_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "OTA_3_LIDs_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Check LID need reset positive test - Modify 2 LIDs
+     */
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("OTA_2_LIDs_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "OTA_2_LIDs_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Check LID need reset positive test - OTA file does not update
+     */
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Check LID need reset positive test - Max last LID list count
+     */
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_last_mod_lid_g.lid_cnt = NVRAM_MCF_SAVE_LAST_LID_CNT;
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max last LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max last LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max last LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    /*
+     *  Check LID need reset positive test - Max current LID list count
+     */
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    mcf_curr_mod_lid_g.lid_cnt = NVRAM_MCF_SAVE_LAST_LID_CNT;
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max current LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_IMS_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max current LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_XCAP_PROFILE_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Max current LID list count) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+
+	MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_ut_gid_mcf_check_lid_need_reset_by_psid(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    mcf_t                                  *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t                   *pFile;
+    mcf_tool_gid_tlvota_file_item_t        *pItem;
+    mcf_tlvota_file_t                      *tlvota_file;
+    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+    mcf_ota_result_e                        mcf_ret;
+    kal_bool                                ret;
+    kal_uint8                               i;
+    sbp_reconfig_custom_param_struct        param_ptr;
+    nvram_ef_mcf_sw_info_struct             nv_sw_info;
+
+    mcf_ut_init();
+    
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+        mcf_ut_format_err_str("Read NVRAM_EF_MCF_SW_INFO_LID FAIL!");
+        return KAL_FALSE;
+    }
+    
+    strncpy(nv_sw_info.version, release_verno(), MCF_SW_VERNO_LEN);
+    strncpy(nv_sw_info.build_time, build_date_time(), MCF_SW_BUILD_TIME_LEN);
+
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+        mcf_ut_format_err_str("Write NVRAM_EF_MCF_SW_INFO_LID FAIL!");
+        return KAL_FALSE;
+    } 
+
+    /*
+     *  Check LID need reset positive test - Modify 3 LIDs with SBP_PARTIAL_TAG
+     */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_3LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_3LIDs_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        is_read_general_tlvota[i] = KAL_FALSE;
+        is_read_tlvota[i] = KAL_TRUE;
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_PARTIAL_TAG) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_PARTIAL_TAG) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_PARTIAL_TAG) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+    
+    /*
+     *  Check LID need reset positive test - Modify 2 LIDs
+     */
+	 
+	/* Read MCF TLV-OTA file into cache buffer */
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+		mcf_ut_format_err_str("Fail to read MCF TLV-OTA file info to NVRAM!!\r\n");
+		return KAL_FALSE;
+	} 
+	
+    /* Write MCF TLV-OTA file version to NVRAM */
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_2LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_2LIDs_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        is_read_general_tlvota[i] = KAL_FALSE;
+        is_read_tlvota[i] = KAL_TRUE;
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+        
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+	
+	/*
+     *  Check LID need reset positive test - TLV-OTA file does not update
+     */
+	 
+	kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+	
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+        
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (TLV-OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (TLV-OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (TLV-OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+	
+	/*
+     *  Check LID need reset positive test - Max last LID list count
+     */
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		mcf_tlvota_last_mod_lid_g[i].lid_cnt = NVRAM_MCF_SAVE_LAST_LID_CNT;
+
+		ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+			return KAL_FALSE;
+		}
+	}
+	
+	/*
+     *  Check LID need reset positive test - Max current LID list count
+     */
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		mcf_tlvota_curr_mod_lid_g[i].lid_cnt = NVRAM_MCF_SAVE_LAST_LID_CNT;
+
+		ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+			return KAL_FALSE;
+		}
+	}
+	
+	/*
+     *  Check LID need reset positive test - Modify 3 LIDs with SBP_PARTIAL_TAG_WITH_MCC 
+     */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_tag_with_mcc_ut_3LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_tag_with_mcc_ut_3LIDs_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG_WITH_MCC
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        is_read_general_tlvota[i] = KAL_FALSE;
+        is_read_tlvota[i] = KAL_TRUE;
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_partial_tag_with_mcc) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_partial_tag_with_mcc) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_partial_tag_with_mcc) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+	
+	/*
+     *  Check LID need reset positive test - Modify 3 LIDs with SBP_FULL_TAG
+     */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_tag_ut_3LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_tag_ut_3LIDs_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID with SBP_FULL_TAG
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        is_read_general_tlvota[i] = KAL_FALSE;
+        is_read_tlvota[i] = KAL_TRUE;
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_full_tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_full_tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_full_tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+	
+	/*
+     *  Check LID need reset positive test - Modify 3 LIDs by auto select apply
+     */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MTK_OPOTA_SBPID_12.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_OPOTA_SBPID_12.mcfopota");
+                return KAL_FALSE;
+            }
+			
+			tlvota_file->last_mod_time = MCF_UT_GEN_TIME;
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        is_read_general_tlvota[i] = KAL_FALSE;
+        is_read_tlvota[i] = KAL_FALSE;
+        pMcf->is_ignore_dsbp[i] = KAL_FALSE;
+
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_full_tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+		
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_full_tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_full_tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+    }
+	
+	for (i = 0; i < MAX_SIM_NUM; i++){
+		mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+	}
+
+	/*General TLV-OTA*/
+
+	/*
+     *  Check LID need reset positive test - Modify 3 LIDs
+     */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF General TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_general_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_general_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+	tlvota_file = &(pMcf->general_tlvota_file);
+
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_NA_ut_3LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_NA_ut_3LIDs_gid_normal.mcfopota");
+			return KAL_FALSE;
+		}
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+	kal_mem_set(is_read_general_tlvota, 0, MAX_SIM_NUM);
+    
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        is_read_tlvota[i] = KAL_FALSE;
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+		is_read_general_tlvota[i] = KAL_TRUE;
+
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with NA tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with NA tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with NA tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+    
+    /*
+     *  Check LID need reset positive test - Modify 2 LIDs
+     */
+	 
+	/* Read MCF TLV-OTA file into cache buffer */
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct))) {
+		mcf_ut_format_err_str("Fail to read MCF General TLV-OTA file info to NVRAM!!\r\n");
+		return KAL_FALSE;
+	} 
+	
+    /* Write MCF TLV-OTA file version to NVRAM */
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF General TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_general_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_general_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+	tlvota_file = &(pMcf->general_tlvota_file);
+
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_NA_ut_2LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_NA_ut_2LIDs_gid_normal.mcfopota");
+			return KAL_FALSE;
+		}
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+    kal_mem_set(is_read_general_tlvota, 0, MAX_SIM_NUM);
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+        
+        is_read_tlvota[i] = KAL_FALSE;
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+		is_read_general_tlvota[i] = KAL_TRUE;
+        
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs with NA tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs with NA tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs with NA tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+	
+	/*
+     *  Check LID need reset positive test - General TLV-OTA file does not update
+     */
+	 
+	kal_mem_set(&mcf_general_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_general_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+        
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (TLV-OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (TLV-OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (TLV-OTA file does not update) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+	
+	/*
+     *  Check LID need reset positive test - Modify 3 LIDs with ICCID tag by auto select apply
+     */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_GENERAL_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF General TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_general_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_general_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+	tlvota_file = &(pMcf->general_tlvota_file);
+
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MCF_TLVOTA_ICCID_ut_3LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_ICCID_ut_3LIDs_gid_normal.mcfopota");
+			return KAL_FALSE;
+		}
+		tlvota_file->last_mod_time = MCF_UT_GEN_TIME;
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+	
+    kal_mem_set(is_read_general_tlvota, 0, MAX_SIM_NUM);
+	
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		strcpy(param_ptr.iccid, SBP_PARTIAL_TAG);
+
+        is_read_tlvota[i] = KAL_FALSE;
+        pMcf->is_ignore_dsbp[i] = KAL_FALSE;
+
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with NA tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with NA tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with NA tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+    }
+	for (i = 0; i < MAX_SIM_NUM; i++){
+		mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+	}
+	
+	/*
+     *  Check LID need reset positive test - Apply SIM1 and SIM2 and General OP-OTA separately
+     */
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+
+	tlvota_file = &(pMcf->tlvota_file[0]);
+
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MTK_OPOTA_SBPID_12.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_OPOTA_SBPID_12.mcfopota");
+			return KAL_FALSE;
+		}
+		
+		tlvota_file->last_mod_time = MCF_UT_GEN_TIME;
+		kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+
+	param_ptr.sbp_id = SBP_TAG_SBPID; 
+	param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(0);
+	kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+	kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	kal_mem_set(param_ptr.iccid, 0, 21);
+
+	is_read_general_tlvota[0] = KAL_FALSE;
+	is_read_tlvota[0] = KAL_FALSE;
+	pMcf->is_ignore_dsbp[i] = KAL_FALSE;
+
+	ret = mcf_auto_select_tlvota_file(&param_ptr);
+	if (ret != KAL_TRUE) {
+		mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+		return KAL_FALSE;
+	}
+
+	ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(0));
+	if (ret != KAL_TRUE) {
+		mcf_ut_format_err_str("Apply SIM1 and SIM2 and General OP-OTA separately FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+		return KAL_FALSE;
+	}
+
+	ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(0));
+	if (ret != KAL_TRUE) {
+		mcf_ut_format_err_str("Apply SIM1 and SIM2 and General OP-OTA separately FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+		return KAL_FALSE;
+	}
+
+	ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(0));
+	if (ret != KAL_TRUE) {
+		mcf_ut_format_err_str("Apply SIM1 and SIM2 and General OP-OTA separately FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+		return KAL_FALSE;
+	}
+	
+	mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(0));
+	
+	tlvota_file = &(pMcf->tlvota_file[1]);
+
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MTK_OPOTA_SBPID_12.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_OPOTA_SBPID_12.mcfopota");
+			return KAL_FALSE;
+		}
+		
+		tlvota_file->last_mod_time = MCF_UT_GEN_TIME;
+		kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+
+	param_ptr.sbp_id = SBP_TAG_SBPID; 
+	param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(1);
+	kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+	kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	kal_mem_set(param_ptr.iccid, 0, 21);
+
+	is_read_general_tlvota[1] = KAL_FALSE;
+	is_read_tlvota[1] = KAL_FALSE;
+	pMcf->is_ignore_dsbp[i] = KAL_FALSE;
+
+	ret = mcf_auto_select_tlvota_file(&param_ptr);
+	if (ret != KAL_TRUE) {
+		mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+		return KAL_FALSE;
+	}
+
+	ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(1));
+	if (ret != KAL_TRUE) {
+		mcf_ut_format_err_str("Apply SIM1 and SIM2 and General OP-OTA separately FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+		return KAL_FALSE;
+	}
+
+	ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(1));
+	if (ret != KAL_TRUE) {
+		mcf_ut_format_err_str("Apply SIM1 and SIM2 and General OP-OTA separately FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+		return KAL_FALSE;
+	}
+
+	ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(1));
+	if (ret != KAL_TRUE) {
+		mcf_ut_format_err_str("Apply SIM1 and SIM2 and General OP-OTA separately FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+		return KAL_FALSE;
+	}
+	
+	mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(1));
+	
+	tlvota_file = &(pMcf->general_tlvota_file);
+
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_NA_ut_2LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_NA_ut_2LIDs_gid_normal.mcfopota");
+			return KAL_FALSE;
+		}
+		
+		tlvota_file->last_mod_time = MCF_UT_GEN_TIME;
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+
+	kal_mem_set(is_read_general_tlvota, 0, MAX_SIM_NUM);
+	
+	for(i = 0; i < MAX_SIM_NUM; i++){
+		param_ptr.sbp_id = SBP_TAG_SBPID; 
+		param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+		kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		kal_mem_set(param_ptr.iccid, 0, 21);
+
+		
+		is_read_tlvota[i] = KAL_FALSE;
+		pMcf->is_ignore_dsbp[i] = KAL_FALSE;
+
+		ret = mcf_auto_select_tlvota_file(&param_ptr);
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_full_tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_full_tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+		if (ret != KAL_TRUE) {
+			mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_full_tag) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+			return KAL_FALSE;
+		}
+	}
+	
+	for(i = 0; i < MAX_SIM_NUM; i++){
+		mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+	}
+	
+	/*
+     *  Check LID need reset positive test - Change SIM1, SIM2 card
+     */
+	
+	kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_tlvota_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    kal_mem_set(&mcf_tlvota_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct)*MAX_SIM_NUM);
+    
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_3LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_3LIDs_gid_normal.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        is_read_general_tlvota[i] = KAL_FALSE;
+        is_read_tlvota[i] = KAL_TRUE;
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_PARTIAL_TAG) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_PARTIAL_TAG) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_PARTIAL_TAG) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+	
+	//Change SIM1/SIM2
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+        // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+        param_ptr.sbp_id = 108; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+
+        is_read_general_tlvota[i] = KAL_FALSE;
+        is_read_tlvota[i] = KAL_FALSE;
+        pMcf->is_ignore_dsbp[i] = KAL_TRUE;
+
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_PARTIAL_TAG) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_PARTIAL_TAG) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+            return KAL_FALSE;
+        }
+
+        ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, l4c_gemini_get_switched_sim_id(i));
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs with SBP_PARTIAL_TAG) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+            return KAL_FALSE;
+        }
+        
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(i));
+    }
+	
+	
+	MCF_UT_PASS();
+    return KAL_TRUE;
+}
+kal_bool mcf_ut_mcf_check_ota_need_update(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_bool                            ret;
+    mcf_tlvota_sbp_tag_t                sbp_tag;
+    kal_char                            iccid_tag[16];
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t               *pFile;
+    mcf_tool_tlvota_file_item_t        *pItem;
+    mcf_tlvota_file_t                  *tlvota_file;
+    sbp_reconfig_custom_param_struct    param_ptr;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    
+    mcf_ut_init();
+    
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+        mcf_ut_format_err_str("Read NVRAM_EF_MCF_SW_INFO_LID FAIL!");
+        return KAL_FALSE;
+    }
+    
+    strncpy(nv_sw_info.version, release_verno(), MCF_SW_VERNO_LEN);
+    strncpy(nv_sw_info.build_time, build_date_time(), MCF_SW_BUILD_TIME_LEN);
+
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+        mcf_ut_format_err_str("Write NVRAM_EF_MCF_SW_INFO_LID FAIL!");
+        return KAL_FALSE;
+    } 
+    
+    /*
+    *  TLV-OTA file test
+    */
+    /* First time, need to update TLV-OTA*/
+    
+    /* Fill TLV-OTA file into buffer */
+    
+    tlvota_file = &(pMcf->tlvota_file[0]);
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+        pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+        ret = mcf_ut_open_test_data("MTK_OPOTA_SBPID_12.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_OPOTA_SBPID_12.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+    
+
+    // fill in SBP TAG
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    
+    kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+    strcpy(iccid_tag, SBP_PARTIAL_TAG);
+    
+    param_ptr.sbp_id = SBP_TAG_SBPID; 
+    param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(0);
+    kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    kal_mem_set(param_ptr.iccid, 0, 21);
+    
+    
+    // Check TLV-OTA need update
+    ret = mcf_check_ota_need_update(param_ptr.ps_id, sbp_tag, iccid_tag);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_check_ota_need_update FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    
+    //DSBP flow
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+    
+    
+    /* Second time, do not change TLV-OTA, no need to update */
+    
+    // Check TLV-OTA need update
+    ret = mcf_check_ota_need_update(param_ptr.ps_id, sbp_tag, iccid_tag);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("mcf_check_ota_need_update FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    
+    //DSBP flow
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+    
+    /* When chang sim card, need to update */
+    
+    // fill in SBP TAG
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = 1;
+    strncpy(sbp_tag.mcc, "460", MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, "01", MAX_MNC_STR_LEN);
+    
+    kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+    strcpy(iccid_tag, SBP_PARTIAL_TAG);
+    
+    param_ptr.sbp_id = 1; 
+    param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(0);
+    kal_mem_cpy(param_ptr.mcc, "460", MAX_MCC_STR_LEN);
+    kal_mem_cpy(param_ptr.mnc, "01", MAX_MNC_STR_LEN);
+    kal_mem_set(param_ptr.iccid, 0, 21);
+    
+    /* Fill TLV-OTA file into buffer */
+    
+    tlvota_file = &(pMcf->tlvota_file[0]);
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+        pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+        ret = mcf_ut_open_test_data("MTK_OPOTA_SBPID_1.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_OPOTA_SBPID_1.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+    
+    // Check TLV-OTA need update
+    ret = mcf_check_ota_need_update(param_ptr.ps_id, sbp_tag, iccid_tag);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_check_ota_need_update FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    
+    /*
+    *  General TLV-OTA file test
+    */
+    /* First time, need to update TLV-OTA*/
+    
+    /* Fill TLV-OTA file into buffer */
+    
+    tlvota_file = &(pMcf->general_tlvota_file);
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+        pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+        ret = mcf_ut_open_test_data("MTK_OPOTA_GENERAL.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_OPOTA_GENERAL.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+    
+
+    // fill in SBP TAG
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    
+    kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+    strcpy(iccid_tag, SBP_PARTIAL_TAG);
+    
+    param_ptr.sbp_id = SBP_TAG_SBPID; 
+    param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(0);
+    kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    kal_mem_set(param_ptr.iccid, 0, 21);
+    
+    
+    // Check TLV-OTA need update
+    ret = mcf_check_ota_need_update(param_ptr.ps_id, sbp_tag, iccid_tag);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_check_ota_need_update FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    
+    //DSBP flow
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+    
+    
+    
+    /* Second time, do not change General TLV-OTA, no need to update */
+    
+    // Check TLV-OTA need update
+    ret = mcf_check_ota_need_update(param_ptr.ps_id, sbp_tag, iccid_tag);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("mcf_check_ota_need_update FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    
+    //DSBP flow
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+    
+    MCF_UT_PASS();
+    return KAL_TRUE;
+
+}
+
+kal_bool mcf_ut_mcf_get_tlvota_file_result(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_bool                            ret;
+    mcf_tlvota_sbp_tag_t                sbp_tag;
+    kal_char                            iccid_tag[16];
+    mcf_t                              *pMcf = mcf_get_instance();
+    mcf_tool_file_info_t               *pFile;
+    mcf_tool_tlvota_file_item_t        *pItem;
+    mcf_tlvota_file_t                  *tlvota_file;
+    sbp_reconfig_custom_param_struct    param_ptr;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    mcf_ota_result_e                    mcf_ret = MCF_OTA_R_SUCCESS;
+    kal_uint8                           i;
+    
+    mcf_ut_init();
+    
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+        mcf_ut_format_err_str("Read NVRAM_EF_MCF_SW_INFO_LID FAIL!");
+        return KAL_FALSE;
+    }
+    
+    strncpy(nv_sw_info.version, release_verno(), MCF_SW_VERNO_LEN);
+    strncpy(nv_sw_info.build_time, build_date_time(), MCF_SW_BUILD_TIME_LEN);
+
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+        mcf_ut_format_err_str("Write NVRAM_EF_MCF_SW_INFO_LID FAIL!");
+        return KAL_FALSE;
+    } 
+    
+    /*
+    *  TLV-OTA file test
+    */
+    /* First time, need to update TLV-OTA*/
+    
+    /* Fill TLV-OTA file into buffer */
+    
+    tlvota_file = &(pMcf->tlvota_file[0]);
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+        pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+        ret = mcf_ut_open_test_data("MTK_OPOTA_SBPID_12.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_OPOTA_SBPID_12.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+    
+
+    // fill in SBP TAG
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    
+    kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+    strcpy(iccid_tag, SBP_PARTIAL_TAG);
+    
+    param_ptr.sbp_id = SBP_TAG_SBPID; 
+    param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(0);
+    kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    kal_mem_set(param_ptr.iccid, 0, 21);
+    
+    //DSBP flow
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+    
+    mcf_ret = mcf_get_tlvota_file_result(param_ptr.ps_id);
+    
+    if (mcf_ret != MCF_OTA_R_SUCCESS){
+        mcf_ut_format_err_str("mcf_get_tlvota_file_result FAIL! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    
+    /* Second time, do not change TLV-OTA, no need to update */
+
+    //DSBP flow
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+    
+    mcf_ret = mcf_get_tlvota_file_result(param_ptr.ps_id);
+    
+    if (mcf_ret != MCF_OTA_R_SUCCESS){
+        mcf_ut_format_err_str("mcf_get_tlvota_file_result FAIL! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    
+    /* When chang sim card, need to update */
+    
+    // fill in SBP TAG
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = 1;
+    strncpy(sbp_tag.mcc, "460", MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, "01", MAX_MNC_STR_LEN);
+    
+    kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+    strcpy(iccid_tag, SBP_PARTIAL_TAG);
+    
+    param_ptr.sbp_id = 1; 
+    param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(0);
+    kal_mem_cpy(param_ptr.mcc, "460", MAX_MCC_STR_LEN);
+    kal_mem_cpy(param_ptr.mnc, "01", MAX_MNC_STR_LEN);
+    kal_mem_set(param_ptr.iccid, 0, 21);
+    
+    /* Fill TLV-OTA file into buffer */
+    
+    tlvota_file = &(pMcf->tlvota_file[0]);
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+        pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+        ret = mcf_ut_open_test_data("MTK_OPOTA_SBPID_1.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MTK_OPOTA_SBPID_1.mcfopota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+    
+   //DSBP flow
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+    
+    mcf_ret = mcf_get_tlvota_file_result(param_ptr.ps_id);
+    
+    if (mcf_ret != MCF_OTA_R_SUCCESS){
+        mcf_ut_format_err_str("mcf_get_tlvota_file_result FAIL! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+    
+    /*
+    *
+    * False positive test - Invalid TLVOTA file
+    *
+    */
+    
+    for(i = 0; i < MAX_SIM_NUM; i++){
+        // fill in SBP TAG
+        kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+        sbp_tag.sbp_id = SBP_TAG_SBPID;
+        strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        
+        kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+        strcpy(iccid_tag, SBP_PARTIAL_TAG);
+        
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+        
+        /* Use OTA file */
+        
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        
+        //DSBP flow
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+        mcf_ret = mcf_get_tlvota_file_result(param_ptr.ps_id);
+        
+        if (mcf_ret != MCF_OTA_R_INVALID_FILE){
+            mcf_ut_format_err_str("mcf_get_tlvota_file_result FAIL! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+    }
+    
+    /*
+    *
+    * False positive test - decyption FAIL
+    *
+    */
+    
+    for(i = 0; i < MAX_SIM_NUM; i++){
+        // fill in SBP TAG
+        kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+        sbp_tag.sbp_id = SBP_TAG_SBPID;
+        strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        
+        kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+        strcpy(iccid_tag, SBP_PARTIAL_TAG);
+        
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+        
+        /* Use error AES-128 file */
+        
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_encyption_wrong_key.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_encyption_wrong_key.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        
+        //DSBP flow
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+        mcf_ret = mcf_get_tlvota_file_result(param_ptr.ps_id);
+        
+        if (mcf_ret != MCF_OTA_R_CHECKSUM_ERROR){
+            mcf_ut_format_err_str("mcf_get_tlvota_file_result FAIL! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+    }
+    
+    /*
+    *
+    * False positive test - digest FAIL
+    *
+    */
+    
+    for(i = 0; i < MAX_SIM_NUM; i++){
+        // fill in SBP TAG
+        kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+        sbp_tag.sbp_id = SBP_TAG_SBPID;
+        strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        
+        kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+        strcpy(iccid_tag, SBP_PARTIAL_TAG);
+        
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+        
+        /* Use error AES-128 file */
+        
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_wrong_RSA2048.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_wrong_RSA2048.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        
+        //DSBP flow
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+        mcf_ret = mcf_get_tlvota_file_result(param_ptr.ps_id);
+        
+        if (mcf_ret != MCF_OTA_R_DIGEST_FAIL){
+            mcf_ut_format_err_str("mcf_get_tlvota_file_result FAIL! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+    }
+    
+    /*
+    *
+    * False positive test - Invalid TLVOTA file - mcf_check_ota_need_update
+    *
+    */
+    
+    for(i = 0; i < MAX_SIM_NUM; i++){
+        // fill in SBP TAG
+        kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+        sbp_tag.sbp_id = SBP_TAG_SBPID;
+        strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        
+        kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+        strcpy(iccid_tag, SBP_PARTIAL_TAG);
+        
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+        
+        /* Use OTA file */
+        
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+    
+    
+        // Check TLV-OTA need update
+        ret = mcf_check_ota_need_update(param_ptr.ps_id, sbp_tag, iccid_tag);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("mcf_check_ota_need_update FAIL! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+        
+        //DSBP flow
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+        mcf_ret = mcf_get_tlvota_file_result(param_ptr.ps_id);
+        
+        if (mcf_ret != MCF_OTA_R_INVALID_FILE){
+            mcf_ut_format_err_str("mcf_get_tlvota_file_result FAIL! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+    }
+    
+    /*
+    *
+    * False positive test - decyption FAIL - mcf_check_ota_need_update
+    *
+    */
+    
+    for(i = 0; i < MAX_SIM_NUM; i++){
+        // fill in SBP TAG
+        kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+        sbp_tag.sbp_id = SBP_TAG_SBPID;
+        strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        
+        kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+        strcpy(iccid_tag, SBP_PARTIAL_TAG);
+        
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+        
+        /* Use error AES-128 file */
+        
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_encyption_wrong_key.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_encyption_wrong_key.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        
+        // Check TLV-OTA need update
+        ret = mcf_check_ota_need_update(param_ptr.ps_id, sbp_tag, iccid_tag);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("mcf_check_ota_need_update FAIL! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+        
+        /* Use error AES-128 file */
+        
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_encyption_wrong_key.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_encyption_wrong_key.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        
+        //DSBP flow
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+        mcf_ret = mcf_get_tlvota_file_result(param_ptr.ps_id);
+        
+        if (mcf_ret != MCF_OTA_R_CHECKSUM_ERROR){
+            mcf_ut_format_err_str("mcf_get_tlvota_file_result FAIL! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+    }
+    
+    /*
+    *
+    * False positive test - digest FAIL - mcf_check_ota_need_update
+    *
+    */
+    
+    for(i = 0; i < MAX_SIM_NUM; i++){
+        // fill in SBP TAG
+        kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+        sbp_tag.sbp_id = SBP_TAG_SBPID;
+        strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        
+        kal_mem_set(&iccid_tag, 0, sizeof(kal_char));
+        strcpy(iccid_tag, SBP_PARTIAL_TAG);
+        
+        param_ptr.sbp_id = SBP_TAG_SBPID; 
+        param_ptr.ps_id =  l4c_gemini_get_switched_sim_id(i);
+        kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+        kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+        kal_mem_set(param_ptr.iccid, 0, 21);
+        
+        /* Use error RSA2048 file */
+        
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_wrong_RSA2048.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_wrong_RSA2048.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        
+        // Check TLV-OTA need update
+        ret = mcf_check_ota_need_update(param_ptr.ps_id, sbp_tag, iccid_tag);
+        if (ret != KAL_TRUE) {
+            mcf_ut_format_err_str("mcf_check_ota_need_update FAIL! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+        
+        /* Use error RSA2048 file */
+        
+        tlvota_file = &(pMcf->tlvota_file[i]);
+
+        MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+            ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_wrong_RSA2048.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+            if (ret == KAL_FALSE) {
+                mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_wrong_RSA2048.mcfopota");
+                return KAL_FALSE;
+            }
+
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            mcf_ut_format_err_str("Read TLV-OTA FAIL!! Fail to take write lock! \r\n");
+            return KAL_FALSE;
+        }
+        
+        //DSBP flow
+        ret = mcf_auto_select_tlvota_file(&param_ptr);
+        if (ret != KAL_FALSE) {
+            mcf_ut_format_err_str("mcf_auto_select_tlvota_file FAIL! ret(%d) \r\n", ret);
+            return KAL_FALSE;
+        }
+        mcf_set_config_after_dsbp(l4c_gemini_get_switched_sim_id(param_ptr.ps_id));
+        mcf_ret = mcf_get_tlvota_file_result(param_ptr.ps_id);
+        
+        if (mcf_ret != MCF_OTA_R_DIGEST_FAIL){
+            mcf_ut_format_err_str("mcf_get_tlvota_file_result FAIL! ret(%d) \r\n", mcf_ret);
+            return KAL_FALSE;
+        }
+    }
+    
+    MCF_UT_PASS();
+    return KAL_TRUE;
+
+}
+#endif
+
+#if defined(__MCF_UT_FRAMEWORK_SUPPORT__)
+extern kal_bool mcf_utfwk_sample_code_start_ut();
+kal_bool mcf_utfwk_sample_code_ut(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+	kal_bool ret = KAL_TRUE;
+	ret = mcf_utfwk_sample_code_start_ut();
+	if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("mcf utfwk sample code failed \r\n");
+        return KAL_FALSE;
+    }
+	MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_utfwk_ut_test_flow (void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_bool ret = KAL_TRUE;
+    static mcf_utfwk_ota_input_struct    ota_input;
+    kal_char    ota_data_path[512];
+    kal_char   *pos; 
+    kal_uint8    *dump_buffer;
+    nvram_errno_enum                 nvram_api_ret;
+    nvram_ltable_entry_struct        lid_info = {0};
+    static kal_uint32          value;
+    kal_uint64          sh_value;
+    kal_uint8           oring_value[20];
+    kal_uint8           hex_value[20];
+    kal_uint32          sim_id = 0;
+    static mcf_utfwk_config_variable_struct     var;
+    static mcf_utfwk_config_variable_struct     var_arr[5];
+    static kal_uint32          value1;
+    static kal_uint32          bit_value;
+    nvram_ef_mcf_test_struct  test_lid_buffer;
+
+    
+    /* Normal Case */
+    kal_mem_set(&ota_input, 0, sizeof(mcf_utfwk_ota_input_struct));
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_ut_gid_normal.mcfota", '\0');
+    
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    strcpy(ota_input.input_mode.file_path_name, ota_data_path);
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;
+    }
+    
+    mcf_utfwk_execute();
+    
+    nvram_api_ret = nvram_external_get_lid_info(NVRAM_EF_MCF_TEST_OTA_LID, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        ret = KAL_FALSE;
+
+        return ret;
+    }
+    
+    dump_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_LID, dump_buffer, lid_info.size, 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+        
+    if ( kal_mem_cmp(dump_buffer, &mcf_ut_test_lid_value_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+
+    free_ctrl_buffer_set_null(dump_buffer);
+    
+    mcf_utfwk_reset();
+    
+    /* OTA for Query Case */
+    kal_mem_set(&ota_input, 0, sizeof(mcf_utfwk_ota_input_struct));
+    
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_QUERY_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_QUERY_ut_gid_normal.mcfota", '\0');
+    
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    strcpy(ota_input.input_mode.file_path_name, ota_data_path);
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;
+    }
+
+    mcf_utfwk_execute();
+    
+    nvram_api_ret = nvram_external_get_lid_info(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    if((lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) != 0) {
+        if(mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct)) != MCF_OTA_R_SUCCESS){
+            ret = KAL_FALSE;
+            return ret;
+        }
+    }else {
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    if ( kal_mem_cmp(&test_lid_buffer, &mcf_ut_test_lid_value_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    dump_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, MCF_UTFWK_DUMP_LID, dump_buffer, lid_info.size, 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    if ( kal_mem_cmp(dump_buffer, &mcf_ut_test_lid_value_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+        ret = KAL_FALSE;
+        
+        return KAL_FALSE;
+    }
+
+    free_ctrl_buffer_set_null(dump_buffer);
+    
+    mcf_utfwk_reset();
+    
+    
+    /* Generate OTA Case */
+    
+    kal_mem_set(&ota_input, 0, sizeof(mcf_utfwk_ota_input_struct));
+    kal_mem_set(&var, 0, sizeof(mcf_utfwk_config_variable_struct));
+
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+    ota_input.input_op = MCF_UTFWK_OTA_VARIABLE_CONFIG;
+    
+    //VAL_STRUCT_3[0].ARRAY_D[4][3][2]
+    var.gid = MCF_TEST_OTA_LID_BASE_GID+106;
+    strcpy(var.array_index, "0$4$3$2$");
+    value = 12;
+    var.value = &value;
+    var.value_len = 1;
+    var.rec_id = 1;
+    ota_input.input_mode.var_info.var = &var;
+    ota_input.input_mode.var_info.var_cnt = 1;
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;
+    }
+    
+    mcf_utfwk_execute();
+    
+    nvram_api_ret = nvram_external_get_lid_info(NVRAM_EF_MCF_TEST_OTA_LID, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    dump_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_ONE_VARIABLE, dump_buffer, 1, var.gid, var.array_index) != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    mcf_bytes_to_hex(&value, 1, KAL_FALSE, &oring_value);
+    mcf_bytes_to_hex(dump_buffer, 1, KAL_FALSE, &hex_value);
+    
+    if (strncmp(hex_value, oring_value, 2) != 0 ) {
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+
+    free_ctrl_buffer_set_null(dump_buffer);
+    
+    mcf_utfwk_reset();
+    
+    /* Generate OTA Case - 2 variables */
+    
+    kal_mem_set(&ota_input, 0, sizeof(mcf_utfwk_ota_input_struct));
+    kal_mem_set(&var_arr, 0, sizeof(mcf_utfwk_config_variable_struct)*5);
+
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+    ota_input.input_op = MCF_UTFWK_OTA_VARIABLE_CONFIG;
+    
+    //VAL_STRUCT_3[0].ARRAY_D[4][3][2]
+    var_arr[0].gid = MCF_TEST_OTA_LID_BASE_GID+106;
+    strcpy(var_arr[0].array_index, "0$4$3$2$");
+    value = 12;
+    var_arr[0].value = &value;
+    var_arr[0].value_len = 1;
+    var_arr[0].rec_id = 1;
+    
+    //val_byte_11
+    var_arr[1].gid = MCF_TEST_OTA_LID_BASE_GID+44;
+    value1 = 32;
+    var_arr[1].value = &value1;
+    var_arr[1].value_len = 1;
+    var_arr[1].rec_id = 1;
+    ota_input.input_mode.var_info.var = var_arr;
+    ota_input.input_mode.var_info.var_cnt = 2;  
+
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;
+    }
+    
+    mcf_utfwk_execute();
+    
+    nvram_api_ret = nvram_external_get_lid_info(NVRAM_EF_MCF_TEST_OTA_LID, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    dump_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_ONE_VARIABLE, dump_buffer, 1, var_arr[0].gid, var_arr[0].array_index) != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    mcf_bytes_to_hex(&value, 1, KAL_FALSE, &oring_value);
+    mcf_bytes_to_hex(dump_buffer, 1, KAL_FALSE, &hex_value);
+    
+    if (strncmp(hex_value, oring_value, 2) != 0 ) {
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_ONE_VARIABLE, dump_buffer, 1, var_arr[1].gid, var_arr[1].array_index) != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    mcf_bytes_to_hex(&value1, 1, KAL_FALSE, &oring_value);
+    mcf_bytes_to_hex(dump_buffer, 1, KAL_FALSE, &hex_value);
+    
+    if (strncmp(hex_value, oring_value, 2) != 0 ) {
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+
+    free_ctrl_buffer_set_null(dump_buffer);
+    
+    mcf_utfwk_reset();
+    
+    /* OP OTA Case */
+    
+    kal_mem_set(&ota_input, 0, sizeof(mcf_utfwk_ota_input_struct));
+    kal_mem_set(&mcf_utfwk_lid_buffer,0, sizeof(nvram_ef_mcf_test_struct));
+    
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA_BY_OP;
+    ota_input.sim_id = 0;
+    ota_input.sbp_id = SBP_TAG_SBPID;
+    strncpy(ota_input.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(ota_input.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MCF_TLVOTA_SBP_full_ut_gid_normal.mcfopota", '\0');
+    
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    strcpy(ota_input.input_mode.file_path_name, ota_data_path);
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;
+    }
+    
+    mcf_utfwk_initial_dsbp_callback(mcf_utfwk_dsbp_callback);
+    
+    mcf_utfwk_execute();
+    
+    if ( kal_mem_cmp(&mcf_utfwk_lid_buffer, &mcf_ut_test_lid_value_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    nvram_api_ret = nvram_external_get_lid_info(NVRAM_EF_MCF_TEST_OTA_LID, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    dump_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_LID, dump_buffer, lid_info.size, 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+
+    
+    if ( kal_mem_cmp(dump_buffer, &mcf_ut_test_lid_value_pattern, sizeof(nvram_ef_mcf_test_struct)) != 0 ) {
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+
+    free_ctrl_buffer_set_null(dump_buffer);
+    
+    mcf_utfwk_reset();
+    
+    /* OP OTA Generate Case */
+    
+    kal_mem_set(&ota_input, 0, sizeof(mcf_utfwk_ota_input_struct));
+    kal_mem_set(&var_arr, 0, sizeof(mcf_utfwk_config_variable_struct)*5);
+    kal_mem_set(&mcf_utfwk_lid_buffer,0, sizeof(nvram_ef_mcf_test_struct));
+    
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA_BY_OP;
+    ota_input.sim_id = 0;
+    ota_input.sbp_id = SBP_TAG_SBPID;
+    strncpy(ota_input.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(ota_input.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+
+    ota_input.input_mode.var_info.tag_type = 1;
+    ota_input.input_op = MCF_UTFWK_OTA_VARIABLE_CONFIG;
+    //VAL_BYTE_11
+    var_arr[0].gid = MCF_TEST_OTA_LID_BASE_GID+44;
+    value = 32;
+    var_arr[0].value = &value;
+    var_arr[0].value_len = 1;
+    var_arr[0].rec_id = 1;
+    //VAL_STRUCT_3[0].ARRAY_D[4][3][2]
+    var_arr[1].gid = MCF_TEST_OTA_LID_BASE_GID+106;
+    strcpy(var_arr[1].array_index, "0$4$3$2$");
+    value1 = 64;
+    var_arr[1].value = &value1;
+    var_arr[1].value_len = 1;
+    var_arr[1].rec_id = 1;
+    //VAL_SHORT_11
+    var_arr[2].gid = MCF_TEST_OTA_LID_BASE_GID+56;
+    sh_value = 5566;
+    var_arr[2].value = &sh_value;
+    var_arr[2].value_len = 2;
+    var_arr[2].rec_id = 1;
+    //VAL_BIT_BYTE_11.B3
+    var_arr[3].gid = MCF_TEST_OTA_LID_BASE_GID+21;
+    bit_value = 1;
+    var_arr[3].value = &bit_value;
+    var_arr[3].value_len = 1;
+    var_arr[3].rec_id = 1;
+    
+    
+    ota_input.input_mode.var_info.var = var_arr;
+    ota_input.input_mode.var_info.var_cnt = 4; 
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;
+    }
+    
+    mcf_utfwk_initial_dsbp_callback(mcf_utfwk_dsbp_callback);
+    
+    mcf_utfwk_execute();
+    
+    nvram_api_ret = nvram_external_get_lid_info(NVRAM_EF_MCF_TEST_OTA_LID, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    dump_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_ONE_VARIABLE, dump_buffer, 1, var_arr[0].gid, var_arr[0].array_index) != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    mcf_bytes_to_hex(&value, 1, KAL_FALSE, &oring_value);
+    mcf_bytes_to_hex(dump_buffer, 1, KAL_FALSE, &hex_value);
+    
+    if (strncmp(hex_value, oring_value, 2) != 0 ) {
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_ONE_VARIABLE, dump_buffer, 1, var_arr[1].gid, var_arr[1].array_index) != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    mcf_bytes_to_hex(&value1, 1, KAL_FALSE, &oring_value);
+    mcf_bytes_to_hex(dump_buffer, 1, KAL_FALSE, &hex_value);
+    
+    if (strncmp(hex_value, oring_value, 2) != 0 ) {
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_ONE_VARIABLE, dump_buffer, 2, var_arr[2].gid, var_arr[2].array_index) != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    mcf_bytes_to_hex(&sh_value, 2, KAL_FALSE, &oring_value);
+    mcf_bytes_to_hex(dump_buffer, 2, KAL_FALSE, &hex_value);
+    
+    if (strncmp(hex_value, oring_value, 4) != 0 ) {
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(dump_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+    
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_ONE_VARIABLE, dump_buffer, 1, var_arr[3].gid, var_arr[3].array_index) != KAL_TRUE){
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+    
+    mcf_bytes_to_hex(&bit_value, 1, KAL_FALSE, &oring_value);
+    mcf_bytes_to_hex(dump_buffer, 1, KAL_FALSE, &hex_value);
+    
+    if (strncmp(hex_value, oring_value, 2) != 0 ) {
+        ret = KAL_FALSE;
+        return KAL_FALSE;
+    }
+
+    free_ctrl_buffer_set_null(dump_buffer);
+    
+    mcf_utfwk_reset();
+
+    
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+#endif
+#if defined(__MCF_COMBINE_FILE_SUPPORT__)
+kal_uint8 test_file1[MCF_MAX_OTA_FILE_SIZE];
+kal_uint8 test_file2[MCF_MAX_OTA_FILE_SIZE];
+kal_uint8 output_file[MCF_MAX_OTA_FILE_SIZE];
+kal_bool mcf_merge_ota_file_ut(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_char ota_data_path[512];
+    kal_bool ret = KAL_FALSE;
+    FILE *file1, *file2;
+    kal_char *pos;
+	kal_bool mcf_ret;
+    
+	// ========== BASIC TEST ========== //
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "OTA_2_LIDs_ut_gid_normal.mcfota");
+    file1 = fopen(ota_data_path, "rb");
+    
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "OTA_3_LIDs_ut_gid_normal.mcfota");
+    file2 = fopen(ota_data_path, "rb");
+    
+    if(file1 != NULL && file2 != NULL)
+    {
+        kal_mem_set(test_file1, 0, sizeof(test_file1));
+        fread(test_file1, sizeof(test_file1), 1, file1);
+        fclose(file1);
+        kal_mem_set(test_file2, 0, sizeof(test_file2));
+        fread(test_file2, sizeof(test_file2), 1, file2);
+        fclose(file2);
+    } else {
+        mcf_ut_format_err_str("Merge OTA open file failed!!\r\n");
+        return KAL_FALSE;
+    }
+    ret = mcf_merge_ota_buffer(test_file1, test_file2, output_file, sizeof(output_file));
+    if (ret == KAL_FALSE){
+        mcf_ut_format_err_str("Merge OTA buffer failed!!\r\n");
+        return KAL_FALSE;
+    }
+
+	// checksum comparasion
+	{
+		mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_file;
+		if (mcf_check_check_sum((kal_uint32 *)output_file, output_header->file_size) != 0) {
+			mcf_ut_format_err_str("Merge OTA buffer checksim failed!!\r\n");
+			return KAL_FALSE;
+		}
+	}
+
+	// ========== VALUE TEST : no encypted file========== //
+	{
+		mcf_t                              *pMcf = mcf_get_instance();
+		mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+		mcf_tool_file_info_t               *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+		nvram_ef_mcf_test_struct                test_lid_buffer;
+		mcf_tool_file_info_t *file_header;
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_ut_gid_normal.mcfota");
+		file1 = fopen(ota_data_path, "rb");
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_QUERY_ut_gid_normal.mcfota");
+		file2 = fopen(ota_data_path, "rb");
+
+		if (file1 != NULL && file2 != NULL)
+		{
+			kal_mem_set(test_file1, 0, sizeof(test_file1));
+			fread(test_file1, sizeof(test_file1), 1, file1);
+			fclose(file1);
+			kal_mem_set(test_file2, 0, sizeof(test_file2));
+			fread(test_file2, sizeof(test_file2), 1, file2);
+			fclose(file2);
+		}
+		else {
+			mcf_ut_format_err_str("Merge OTA open file failed!!\r\n");
+			return KAL_FALSE;
+		}
+		file_header = (mcf_tool_file_info_t *)test_file2;
+		file_header->operation_mask |= MCF_FILE_OP_AES_128;
+		ret = mcf_merge_ota_buffer(test_file1, test_file2, output_file, sizeof(output_file));
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Merge OTA buffer failed!!\r\n");
+			return KAL_FALSE;
+		}
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_GID_MERGE.mcfota");
+		file1 = fopen(ota_data_path, "wb");
+
+		if (file1 != NULL)
+		{
+			mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_file;
+			fwrite(output_file, 1, output_header->file_size, file1);
+			fclose(file1);
+		}
+		else {
+			return KAL_FALSE;
+		}
+
+		if (ota_file) {
+			ret = mcf_ut_open_test_data("MCF_OTA_GID_MERGE.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+			if (ret == KAL_FALSE) {
+				mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_GID_MERGE.mcfota");
+				return KAL_FALSE;
+			}
+		}
+		else {
+			mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+
+		mcf_ret = mcf_do_ota_full();
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_test_lid_value(NULL);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Do full OTA positive test FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+
+		// Record index 1
+		kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+		mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+
+		// Record index 2
+		kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+		mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 2, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+	}
+    // ========== VALUE TEST : encypted file========== //
+	{
+		mcf_t                              *pMcf = mcf_get_instance();
+		mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+		mcf_tool_file_info_t               *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+		nvram_ef_mcf_test_struct                test_lid_buffer;
+		mcf_tool_file_info_t *file_header;
+        kal_char password[32] = {0};
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_ut_gid_normal_AES256_RSA3072.mcfota");
+		file1 = fopen(ota_data_path, "rb");
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_QUERY_ut_gid_normal_AES256_RSA3072.mcfota");
+		file2 = fopen(ota_data_path, "rb");
+
+		if (file1 != NULL && file2 != NULL)
+		{
+			kal_mem_set(test_file1, 0, sizeof(test_file1));
+			fread(test_file1, sizeof(test_file1), 1, file1);
+			fclose(file1);
+			kal_mem_set(test_file2, 0, sizeof(test_file2));
+			fread(test_file2, sizeof(test_file2), 1, file2);
+			fclose(file2);
+		}
+		else {
+			mcf_ut_format_err_str("Merge OTA open file failed!!\r\n");
+			return KAL_FALSE;
+		}
+        
+        // decrypt input file
+        file_header = (mcf_tool_file_info_t *)test_file1;
+        mcf_get_custom_aes_password(password);
+        if (mcf_decrypt_256bit(password, (kal_char *)file_header + file_header->total_len, (file_header->file_size - file_header->total_len)) != KAL_TRUE)
+            return KAL_FALSE;
+        
+        file_header = (mcf_tool_file_info_t *)test_file2;
+        if (mcf_decrypt_256bit(password, (kal_char *)file_header + file_header->total_len, (file_header->file_size - file_header->total_len)) != KAL_TRUE)
+            return KAL_FALSE;
+
+        
+		ret = mcf_merge_ota_buffer(test_file1, test_file2, output_file, sizeof(output_file));
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Merge OTA buffer failed!!\r\n");
+			return KAL_FALSE;
+		}
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_GID_MERGE_AES256.mcfota");
+		file1 = fopen(ota_data_path, "wb");
+
+		if (file1 != NULL)
+		{
+			mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_file;
+			fwrite(output_file, 1, output_header->file_size, file1);
+			fclose(file1);
+		}
+		else {
+			return KAL_FALSE;
+		}
+
+		if (ota_file) {
+			ret = mcf_ut_open_test_data("MCF_OTA_GID_MERGE_AES256.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+			if (ret == KAL_FALSE) {
+				mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_GID_MERGE_AES256.mcfota");
+				return KAL_FALSE;
+			}
+		}
+		else {
+			mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+
+		mcf_ret = mcf_do_ota_full();
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_test_lid_value(NULL);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Do full OTA positive test FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+
+		// Record index 1
+		kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+		mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+
+		// Record index 2
+		kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+		mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 2, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+			return KAL_FALSE;
+		}
+
+		ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+	}
+    
+    // ========== BIG FILE TEST ========== //
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_ut_big_size.mcfota");
+    file1 = fopen(ota_data_path, "rb");
+    
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_ut_big_size.mcfota");
+    file2 = fopen(ota_data_path, "rb");
+    
+    if(file1 != NULL && file2 != NULL)
+    {
+        kal_mem_set(test_file1, 0, sizeof(test_file1));
+        fread(test_file1, sizeof(test_file1), 1, file1);
+        fclose(file1);
+        kal_mem_set(test_file2, 0, sizeof(test_file2));
+        fread(test_file2, sizeof(test_file2), 1, file2);
+        fclose(file2);
+    } else {
+        mcf_ut_format_err_str("Merge OTA open file failed!!\r\n");
+        return KAL_FALSE;
+    }
+    ret = mcf_merge_ota_buffer(test_file1, test_file2, output_file, sizeof(output_file));
+    if (ret == KAL_FALSE){
+        mcf_ut_format_err_str("Merge OTA buffer failed!!\r\n");
+        return KAL_FALSE;
+    }
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+kal_bool mcf_merge_ota_by_op_file_ut(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+	kal_char ota_data_path[512];
+	kal_bool ret = KAL_FALSE;
+	FILE *file1, *file2;
+	kal_char *pos;
+
+	getcwd(ota_data_path, sizeof(ota_data_path));
+	pos = strstr(ota_data_path, "mcu");
+	kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MTK_OPOTA_SBPID_1.mcfopota");
+	file1 = fopen(ota_data_path, "rb");
+
+	getcwd(ota_data_path, sizeof(ota_data_path));
+	pos = strstr(ota_data_path, "mcu");
+	kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MTK_OPOTA_SBPID_2.mcfopota");
+	file2 = fopen(ota_data_path, "rb");
+
+	if (file1 != NULL && file2 != NULL)
+	{
+		kal_mem_set(test_file1, 0, sizeof(test_file1));
+		fread(test_file1, sizeof(test_file1), 1, file1);
+		fclose(file1);
+		kal_mem_set(test_file2, 0, sizeof(test_file2));
+		fread(test_file2, sizeof(test_file2), 1, file2);
+		fclose(file2);
+	}
+	else {
+		mcf_ut_format_err_str("Merge OTA by OP open file failed!!\r\n");
+		return KAL_FALSE;
+	}
+	ret = mcf_merge_ota_buffer(test_file1, test_file2, output_file, sizeof(output_file));
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Merge OTA by OP buffer failed!!\r\n");
+		return KAL_FALSE;
+	}
+	// checksum comparasion
+	{
+		mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_file;
+		if (mcf_check_check_sum((kal_uint32 *)output_file, output_header->file_size) != 0) {
+			mcf_ut_format_err_str("Merge OTA by OP buffer checksim failed!!\r\n");
+			return KAL_FALSE;
+		}
+	}
+	// ========== VALUE TEST : no encrypted file========== //
+	{
+		mcf_t                                  *pMcf = mcf_get_instance();
+		mcf_tool_file_info_t                   *pFile;
+		mcf_tool_gid_tlvota_file_item_t        *pItem;
+		mcf_tlvota_file_t                      *tlvota_file;
+		nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+		nvram_ef_mcf_test_struct                test_lid_buffer;
+		nvram_ef_mcf_test_struct                empty_buffer = { 0 };
+		mcf_tlvota_sbp_tag_t                    sbp_tag;
+		kal_uint8                               i;
+		mcf_ota_result_e                        mcf_ret;
+		kal_bool                                ret;
+		mcf_tool_file_info_t *file_header;
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_TLVOTA_SBP_full_ut_gid_normal.mcfopota");
+		file1 = fopen(ota_data_path, "rb");
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota");
+		file2 = fopen(ota_data_path, "rb");
+
+		if (file1 != NULL && file2 != NULL)
+		{
+			kal_mem_set(test_file1, 0, sizeof(test_file1));
+			fread(test_file1, sizeof(test_file1), 1, file1);
+			fclose(file1);
+			kal_mem_set(test_file2, 0, sizeof(test_file2));
+			fread(test_file2, sizeof(test_file2), 1, file2);
+			fclose(file2);
+		}
+		else {
+			mcf_ut_format_err_str("Merge OTA open file failed!!\r\n");
+			return KAL_FALSE;
+		}
+		file_header = (mcf_tool_file_info_t *)test_file2;
+		//file_header->operation_mask |= MCF_FILE_OP_AES_128;
+		ret = mcf_merge_ota_buffer(test_file1, test_file2, output_file, sizeof(output_file));
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Merge OTA buffer failed!!\r\n");
+			return KAL_FALSE;
+		}
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_BY_OP_GID_MERGE.mcfota");
+		file1 = fopen(ota_data_path, "wb");
+
+		if (file1 != NULL)
+		{
+			mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_file;
+			fwrite(output_file, 1, output_header->file_size, file1);
+			fclose(file1);
+		}
+		else {
+			return KAL_FALSE;
+		}
+		/*
+		 *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+		 *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), but user searches SBP_FULL_TAG (12_33_21)
+		 */
+		 /* Fill TLV-OTA file into buffer */
+		for (i = 0; i < MAX_SIM_NUM; i++) {
+			tlvota_file = &(pMcf->tlvota_file[i]);
+
+			if (tlvota_file) {
+				pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+				pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+				ret = mcf_ut_open_test_data("MCF_OTA_BY_OP_GID_MERGE.mcfota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+				if (ret == KAL_FALSE) {
+					mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_BY_OP_GID_MERGE.mcfota");
+					return KAL_FALSE;
+				}
+
+			}
+			else {
+				mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+				return KAL_FALSE;
+			}
+		}
+
+		// NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+		kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+		sbp_tag.sbp_id = SBP_TAG_SBPID;
+		strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+		for (i = 0; i < MAX_SIM_NUM; i++) {
+			kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+			mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+			if (mcf_ret != MCF_OTA_R_SUCCESS) {
+				mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+				return KAL_FALSE;
+			}
+
+			ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+			if (ret == KAL_FALSE) {
+				mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+				return KAL_FALSE;
+			}
+		}
+	}
+    
+    // ========== VALUE TEST : encrypted file========== //
+	{
+		mcf_t                                  *pMcf = mcf_get_instance();
+		mcf_tool_file_info_t                   *pFile;
+		mcf_tool_gid_tlvota_file_item_t        *pItem;
+		mcf_tlvota_file_t                      *tlvota_file;
+		nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+		nvram_ef_mcf_test_struct                test_lid_buffer;
+		nvram_ef_mcf_test_struct                empty_buffer = { 0 };
+		mcf_tlvota_sbp_tag_t                    sbp_tag;
+		kal_uint8                               i;
+		mcf_ota_result_e                        mcf_ret;
+		kal_bool                                ret;
+		mcf_tool_file_info_t *file_header;
+        kal_char password[32] = {0};
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_TLVOTA_SBP_full_ut_gid_normal_AES256_RSA3072.mcfopota");
+		file1 = fopen(ota_data_path, "rb");
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_TLVOTA_SBP_partial_ut_gid_normal_AES256_RSA3072.mcfopota");
+		file2 = fopen(ota_data_path, "rb");
+
+		if (file1 != NULL && file2 != NULL)
+		{
+			kal_mem_set(test_file1, 0, sizeof(test_file1));
+			fread(test_file1, sizeof(test_file1), 1, file1);
+			fclose(file1);
+			kal_mem_set(test_file2, 0, sizeof(test_file2));
+			fread(test_file2, sizeof(test_file2), 1, file2);
+			fclose(file2);
+		}
+		else {
+			mcf_ut_format_err_str("Merge OTA open file failed!!\r\n");
+			return KAL_FALSE;
+		}
+        
+        // decrypt input file
+        file_header = (mcf_tool_file_info_t *)test_file1;
+        mcf_get_custom_aes_password(password);
+        if (mcf_decrypt_256bit(password, (kal_char *)file_header + file_header->total_len, (file_header->file_size - file_header->total_len)) != KAL_TRUE)
+            return KAL_FALSE;
+        
+        file_header = (mcf_tool_file_info_t *)test_file2;
+        if (mcf_decrypt_256bit(password, (kal_char *)file_header + file_header->total_len, (file_header->file_size - file_header->total_len)) != KAL_TRUE)
+            return KAL_FALSE;
+    
+		ret = mcf_merge_ota_buffer(test_file1, test_file2, output_file, sizeof(output_file));
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Merge OTA buffer failed!!\r\n");
+			return KAL_FALSE;
+		}
+
+		getcwd(ota_data_path, sizeof(ota_data_path));
+		pos = strstr(ota_data_path, "mcu");
+		kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_BY_OP_GID_MERGE_AES256.mcfota");
+		file1 = fopen(ota_data_path, "wb");
+
+		if (file1 != NULL)
+		{
+			mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_file;
+			fwrite(output_file, 1, output_header->file_size, file1);
+			fclose(file1);
+		}
+		else {
+			return KAL_FALSE;
+		}
+		/*
+		 *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+		 *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), but user searches SBP_FULL_TAG (12_33_21)
+		 */
+		 /* Fill TLV-OTA file into buffer */
+		for (i = 0; i < MAX_SIM_NUM; i++) {
+			tlvota_file = &(pMcf->tlvota_file[i]);
+
+			if (tlvota_file) {
+                l4c_mcf_path_type_enum *apply_path_type;
+                kal_char               apply_filename[256],
+				pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+				pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+				ret = mcf_ut_open_test_data("MCF_OTA_BY_OP_GID_MERGE_AES256.mcfota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+                mcf_read_tlvota_file(KAL_FALSE, i, "", "", &apply_path_type, apply_filename, pMcf); 
+				if (ret == KAL_FALSE) {
+					mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_BY_OP_GID_MERGE_AES256.mcfota");
+					return KAL_FALSE;
+				}
+
+			}
+			else {
+				mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+				return KAL_FALSE;
+			}
+		}
+
+		// NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+		kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+		sbp_tag.sbp_id = SBP_TAG_SBPID;
+		strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+		for (i = 0; i < MAX_SIM_NUM; i++) {
+			kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+			mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+			if (mcf_ret != MCF_OTA_R_SUCCESS) {
+				mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+				return KAL_FALSE;
+			}
+
+			ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+			if (ret == KAL_FALSE) {
+				mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+				return KAL_FALSE;
+			}
+		}
+	}
+	MCF_UT_PASS();
+	return KAL_TRUE;
+}
+
+kal_uint8 gid_buffer[256];
+kal_bool mcf_merge_one_gid_ut(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+	kal_bool ret = KAL_FALSE;
+	mcf_tool_gid_ota_file_item_t *ota_gid;
+	mcf_tool_gid_tlvota_file_item_t *ota_by_op_gid;
+	kal_uint32 *value;
+
+	kal_mem_set(gid_buffer, 0, sizeof(gid_buffer));
+	ota_gid = gid_buffer;
+	ota_gid->global_id = 5103;
+	ota_gid->record_idx = 1;
+	ota_gid->value_len = 4;
+	value = &ota_gid->buff_start;
+	*value = 6;
+	ota_gid->total_len = (kal_uint32)&ota_gid->buff_start + ota_gid->value_len - (kal_uint32)gid_buffer;
+
+	mcf_merge_one_gid(ota_gid, MCF_TYPE_OTA, output_file, sizeof(output_file), MCF_FILE_OP_CHECKSUM);
+	// check result
+	{
+		mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_file;
+		kal_uint8 *current_pos = NULL;
+		if (output_header->item_num != 1) {
+			mcf_ut_format_err_str("Merge one gid item_num FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+		if (output_header->operation_mask != MCF_FILE_OP_CHECKSUM) {
+			mcf_ut_format_err_str("Merge one gid mask FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+		if (mcf_check_check_sum((kal_uint32 *)output_file, output_header->file_size) != 0) {
+			mcf_ut_format_err_str("Merge one gid checksum failed!!\r\n");
+			return KAL_FALSE;
+		}
+		current_pos = (kal_uint8 *)output_header + output_header->total_len;
+		if (kal_mem_cmp(ota_gid, current_pos, ota_gid->total_len)) {
+			mcf_ut_format_err_str("Merge one gid value failed!!\r\n");
+			return KAL_FALSE;
+		}
+	}
+
+	kal_mem_set(gid_buffer, 0, sizeof(gid_buffer));
+	ota_by_op_gid = gid_buffer;
+	ota_by_op_gid->global_id = 5103;
+	ota_by_op_gid->value_len = 4;
+	
+	ota_by_op_gid->tag_type = MCF_TLVOTA_TAG_SBPID;
+	ota_by_op_gid->tag_len = strlen(SBP_FULL_TAG);
+	strcpy((kal_uint32)&ota_by_op_gid->buff_start, SBP_FULL_TAG);
+	value = &ota_by_op_gid->buff_start + ota_by_op_gid->tag_len;
+	*value = 6;
+	ota_by_op_gid->total_len = (kal_uint32)&ota_by_op_gid->buff_start + ota_by_op_gid->value_len + ota_by_op_gid->tag_len - (kal_uint32)gid_buffer;
+
+	mcf_merge_one_gid(ota_by_op_gid, MCF_TYPE_OTA_BY_OP, output_file, sizeof(output_file), MCF_FILE_OP_CHECKSUM);
+	// check result
+	{
+		mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_file;
+		kal_uint8 *current_pos = NULL;
+		if (output_header->item_num != 1) {
+			mcf_ut_format_err_str("Merge one gid item_num FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+		if (output_header->operation_mask != MCF_FILE_OP_CHECKSUM) {
+			mcf_ut_format_err_str("Merge one gid mask FAIL!!\r\n");
+			return KAL_FALSE;
+		}
+		if (mcf_check_check_sum((kal_uint32 *)output_file, output_header->file_size) != 0) {
+			mcf_ut_format_err_str("Merge one gid checksum failed!!\r\n");
+			return KAL_FALSE;
+		}
+		current_pos = (kal_uint8 *)output_header + output_header->total_len;
+		if (kal_mem_cmp(ota_by_op_gid, current_pos, ota_by_op_gid->total_len)) {
+			mcf_ut_format_err_str("Merge one gid value failed!!\r\n");
+			return KAL_FALSE;
+		}
+	}
+	MCF_UT_PASS();
+	return KAL_TRUE;
+}
+
+
+kal_bool mcf_merge_ota_by_op_merge_one_gid_ut(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+	kal_char ota_data_path[512];
+	kal_bool ret = KAL_FALSE;
+	FILE *file1, *file2;
+	kal_char *pos;
+
+	getcwd(ota_data_path, sizeof(ota_data_path));
+	pos = strstr(ota_data_path, "mcu");
+	kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "MTK_OPOTA_SBPID_1.mcfopota");
+	file1 = fopen(ota_data_path, "rb");
+
+	if (file1 != NULL)
+	{
+		kal_mem_set(test_file1, 0, sizeof(test_file1));
+		fread(test_file1, sizeof(test_file1), 1, file1);
+		fclose(file1);
+	}
+	else {
+		mcf_ut_format_err_str("Merge OTA by OP open file failed!!\r\n");
+		return KAL_FALSE;
+	}
+    
+	mcf_tool_gid_tlvota_file_item_t *ota_by_op_gid;
+	kal_uint32 *value;
+
+	kal_mem_set(gid_buffer, 0, sizeof(gid_buffer));
+	ota_by_op_gid = gid_buffer;
+	ota_by_op_gid->global_id = 5103;
+	ota_by_op_gid->value_len = 4;
+	
+	ota_by_op_gid->tag_type = MCF_TLVOTA_TAG_SBPID;
+	ota_by_op_gid->tag_len = strlen(SBP_FULL_TAG);
+	strcpy((kal_uint32)&ota_by_op_gid->buff_start, SBP_FULL_TAG);
+	value = &ota_by_op_gid->buff_start + ota_by_op_gid->tag_len;
+	*value = 6;
+	ota_by_op_gid->total_len = (kal_uint32)&ota_by_op_gid->buff_start + ota_by_op_gid->value_len + ota_by_op_gid->tag_len - (kal_uint32)gid_buffer;
+
+	mcf_merge_one_gid(ota_by_op_gid, MCF_TYPE_OTA_BY_OP, test_file2, sizeof(test_file2), MCF_FILE_OP_CHECKSUM);
+    
+	ret = mcf_merge_ota_buffer(test_file1, test_file2, output_file, sizeof(output_file));
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Merge OTA by OP buffer failed!!\r\n");
+		return KAL_FALSE;
+	}
+	MCF_UT_PASS();
+	return KAL_TRUE;
+}
+
+kal_bool mcf_merge_encrypted_ota_file_ut(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_char ota_data_path[512];
+    kal_bool ret = KAL_FALSE;
+    FILE *file1, *file2;
+    kal_char *pos;
+    kal_bool mcf_ret;
+    kal_char password[32] = {0};
+    mcf_tool_file_info_t *file_header;
+    
+    // ========== BASIC TEST ========== //
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "AES256_SHA256_RSA2048.mcfota");
+    file1 = fopen(ota_data_path, "rb");
+    
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s", MCF_UT_DB_FOLDER_PATH, "AES256_SHA384_RSA3072.mcfota");
+    file2 = fopen(ota_data_path, "rb");
+    
+    if(file1 != NULL && file2 != NULL)
+    {
+        kal_mem_set(test_file1, 0, sizeof(test_file1));
+        fread(test_file1, sizeof(test_file1), 1, file1);
+        fclose(file1);
+        kal_mem_set(test_file2, 0, sizeof(test_file2));
+        fread(test_file2, sizeof(test_file2), 1, file2);
+        fclose(file2);
+    } else {
+        mcf_ut_format_err_str("Merge OTA open file failed!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    // decrypt input file
+    file_header = (mcf_tool_file_info_t *)test_file1;
+    mcf_get_custom_aes_password(password);
+    if (mcf_decrypt_256bit(password, (kal_char *)file_header + file_header->total_len, (file_header->file_size - file_header->total_len)) != KAL_TRUE)
+        return KAL_FALSE;
+    
+    file_header = (mcf_tool_file_info_t *)test_file2;
+    if (mcf_decrypt_256bit(password, (kal_char *)file_header + file_header->total_len, (file_header->file_size - file_header->total_len)) != KAL_TRUE)
+        return KAL_FALSE;
+    
+    ret = mcf_merge_ota_buffer(test_file1, test_file2, output_file, sizeof(output_file));
+    if (ret == KAL_FALSE){
+        mcf_ut_format_err_str("Merge OTA buffer failed!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    // decrypt merge file
+    file_header = (mcf_tool_file_info_t *)output_file;
+    if (mcf_decrypt_256bit(password, (kal_char *)file_header + file_header->total_len, (file_header->file_size - file_header->total_len)) != KAL_TRUE)
+        return KAL_FALSE;
+
+    // checksum comparasion
+    {
+        mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_file;
+        if (mcf_check_check_sum((kal_uint32 *)output_file, output_header->file_size) != 0) {
+            mcf_ut_format_err_str("Merge OTA buffer checksim failed!!\r\n");
+            return KAL_FALSE;
+        }
+    }
+
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+kal_bool mcf_ut_combined_ota_file(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+	mcf_t                              *pMcf = mcf_get_instance();
+    mcf_ota_file_t                     *ota_file = &(pMcf->ota_file);
+    mcf_tool_file_info_t               *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    nvram_ef_mcf_ota_file_info_struct   nv_ota_file;
+    nvram_ef_mcf_sw_info_struct         nv_sw_info;
+    kal_uint8                          *lid_buffer;
+    nvram_ef_mcf_test_struct            empty_buffer = {0};
+    mcf_ota_result_e                    mcf_ret;
+    kal_bool                            ret;
+    kal_uint32                          i;
+    nvram_ef_mcf_test_struct            nv_lid_buffer;
+	nvram_ef_mcf_test_struct            test_lid_buffer;
+	l4c_mcf_set_config_req_struct      *assigned_file_req;
+	l4c_mcf_set_config_req_struct      *combined_file_req;
+    mcf_tool_gid_tlvota_file_item_t        *pItem;
+    mcf_tlvota_file_t                      *tlvota_file;
+    nvram_ef_mcf_tlvota_file_info_struct    nv_tlvota_file;
+    mcf_tlvota_sbp_tag_t                    sbp_tag;
+    sbp_reconfig_custom_param_struct        param_ptr;
+
+
+    mcf_ut_init();
+
+    /*
+     *  Merge two file positive test - Same path
+     */
+	
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+	
+	assigned_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	assigned_file_req->op = L4C_MCF_CONFIG_ASSIGN_COMBINED_PATH;
+	assigned_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	assigned_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(assigned_file_req->config1,"MCF_OTA_ut_merge.mcfota");
+	
+	if(mcf_assign_combined_file_path(assigned_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Assign combined OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	free_local_para((local_para_struct *)assigned_file_req);
+	
+	/* First apply MCF_OTA_ut_gid_normal - reset */
+	
+	combined_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_OTA_ut_normal.mcfota");
+	combined_file_req->reset = KAL_TRUE;
+	
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	/* Second. apply MCF_OTA_QUERY_ut_gid_normal.mcfota - append */
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_OTA_QUERY_ut_gid_normal.mcfota");
+	combined_file_req->reset = KAL_FALSE;
+
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(mcf_file_buffer, ota_file->buff, MCF_MAX_OTA_FILE_SIZE);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+	if (ota_file) {
+		if(mcf_merge_ota_buffer(mcf_file_buffer, ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE) != KAL_TRUE){
+			mcf_ut_format_err_str("Merge OTA file FAIL!!\r\n");
+			ret = KAL_FALSE;
+			MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+			return ret;
+		}
+			MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+	}
+	
+	free_local_para((local_para_struct *)combined_file_req);
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	if(strcmp(nv_ota_file.path,MCF_FS_CUSTOM_FOLDER_PATH) != 0){
+		mcf_ut_format_err_str("Fail to store file path!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(nv_ota_file.name,"MCF_OTA_ut_merge.mcfota") != 0){
+		mcf_ut_format_err_str("Fail to store file name!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy((kal_char *)(ota_file->buff), mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (Both SW verno of file and MD mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	//first reset NVRAM_EF_MCF_TEST_OTA_LID
+	ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_QUERY_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	/*
+     *  Merge two file positive test - different path
+     */
+	
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+	
+	/* Reset NVRAM_EF_MCF_INTERNAL_INFO_LID */
+    kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write NVRAM_EF_MCF_INTERNAL_INFO_LID to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	assigned_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	assigned_file_req->op = L4C_MCF_CONFIG_ASSIGN_COMBINED_PATH;
+	assigned_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	assigned_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(assigned_file_req->config1,"MCF_OTA_ut_merge.mcfota");
+	
+	if(mcf_assign_combined_file_path(assigned_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Assign combined OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	free_local_para((local_para_struct *)assigned_file_req);
+	
+	/* First apply MCF_OTA_ut_gid_normal - reset */
+	
+	combined_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_OTA_ut_normal.mcfota");
+	combined_file_req->reset = KAL_TRUE;
+	
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+
+	/* Second. apply MCF_OTA_QUERY_ut_gid_normal.mcfota - append */
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_OTA_QUERY_ut_gid_normal.mcfota");
+	combined_file_req->reset = KAL_FALSE;
+
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(mcf_file_buffer, ota_file->buff, MCF_MAX_OTA_FILE_SIZE);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+	if (ota_file) {
+		if(mcf_merge_ota_buffer(mcf_file_buffer, ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE) != KAL_TRUE){
+			mcf_ut_format_err_str("Merge OTA file FAIL!!\r\n");
+			ret = KAL_FALSE;
+			MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+			return ret;
+		}
+			MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+	}
+	
+	free_local_para((local_para_struct *)combined_file_req);
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	if(strcmp(nv_ota_file.path,MCF_FS_CUSTOM_FOLDER_PATH) != 0){
+		mcf_ut_format_err_str("Fail to store file path!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(nv_ota_file.name,"MCF_OTA_ut_merge.mcfota") != 0){
+		mcf_ut_format_err_str("Fail to store file name!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy((kal_char *)(ota_file->buff), mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (Both SW verno of file and MD mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	//first reset, second append
+	ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_QUERY_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	/*
+     *  Merge two file positive test - Same path - both of reset
+     */
+	
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+	
+	/* Reset NVRAM_EF_MCF_INTERNAL_INFO_LID */
+    kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write NVRAM_EF_MCF_INTERNAL_INFO_LID to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	/* Reset NVRAM_EF_MCF_INTERNAL_INFO_LID */
+    kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+	
+	assigned_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	assigned_file_req->op = L4C_MCF_CONFIG_ASSIGN_COMBINED_PATH;
+	assigned_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	assigned_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(assigned_file_req->config1,"MCF_OTA_ut_merge.mcfota");
+	
+	if(mcf_assign_combined_file_path(assigned_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Assign combined OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	free_local_para((local_para_struct *)assigned_file_req);
+	
+	/* First. apply MCF_OTA_QUERY_ut_gid_normal.mcfota - reset */
+	combined_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_OTA_QUERY_ut_gid_normal.mcfota");
+	combined_file_req->reset = KAL_TRUE;
+	
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	/* Second apply MCF_OTA_ut_gid_normal - reset */
+
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_OTA_ut_gid_normal.mcfota");
+	combined_file_req->reset = KAL_TRUE;
+	
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+
+	free_local_para((local_para_struct *)combined_file_req);
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	if(strcmp(nv_ota_file.path,MCF_FS_CUSTOM_FOLDER_PATH) != 0){
+		mcf_ut_format_err_str("Fail to store file path!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(nv_ota_file.name,"MCF_OTA_ut_gid_normal.mcfota") != 0){
+		mcf_ut_format_err_str("Fail to store file name!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (Both SW verno of file and MD mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	//Due to reset, need to reset
+
+	ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    if (kal_mem_cmp(&test_lid_buffer, &empty_buffer, sizeof(nvram_ef_mcf_test_struct)) != 0) {
+        mcf_ut_format_err_str("Reset LID FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	/*
+     *  Merge two file positive test - Same path - both of append
+     */
+	
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    
+    kal_mem_set(&mcf_last_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+    kal_mem_set(&mcf_curr_mod_lid_g, 0, sizeof(nvram_mcf_lid_info_struct));
+	
+	/* Reset NVRAM_EF_MCF_INTERNAL_INFO_LID */
+    kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write NVRAM_EF_MCF_INTERNAL_INFO_LID to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	assigned_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	assigned_file_req->op = L4C_MCF_CONFIG_ASSIGN_COMBINED_PATH;
+	assigned_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	assigned_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(assigned_file_req->config1,"MCF_OTA_ut_merge.mcfota");
+	
+	if(mcf_assign_combined_file_path(assigned_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Assign combined OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	free_local_para((local_para_struct *)assigned_file_req);
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	/* First. apply MCF_OTA_QUERY_ut_gid_normal.mcfota - append */
+	combined_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_OTA_QUERY_ut_gid_normal.mcfota");
+	combined_file_req->reset = KAL_FALSE;
+	
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_QUERY_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_QUERY_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+
+	/* Second apply MCF_OTA_ut_gid_normal - append */
+
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_OTA_ut_normal.mcfota");
+	combined_file_req->reset = KAL_FALSE;
+	
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(mcf_file_buffer, ota_file->buff, MCF_MAX_OTA_FILE_SIZE);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+	if (ota_file) {
+		if(mcf_merge_ota_buffer(mcf_file_buffer, ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE) != KAL_TRUE){
+			mcf_ut_format_err_str("Merge OTA file FAIL!!\r\n");
+			ret = KAL_FALSE;
+			MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+			return ret;
+		}
+			MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+	}
+
+	free_local_para((local_para_struct *)combined_file_req);
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+	if(strcmp(nv_ota_file.path,MCF_FS_CUSTOM_FOLDER_PATH) != 0){
+		mcf_ut_format_err_str("Fail to store file path!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(nv_ota_file.name,"MCF_OTA_ut_merge.mcfota") != 0){
+		mcf_ut_format_err_str("Fail to store file name!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+		kal_mem_cpy((kal_char *)(ota_file->buff), mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (Both SW verno of file and MD mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	//Due to append, no need to reset
+	ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_QUERY_LID);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Read OTA by LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Read OTA by LID positive test FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	//Deactive combine OTA
+	combined_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_DEFAULT_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"");
+	combined_file_req->reset = KAL_FALSE;
+	
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        ret = mcf_ut_open_test_data("MCF_OTA_ut_gid_normal.mcfota", (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE);
+        if (ret == KAL_FALSE) {
+            mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_OTA_ut_gid_normal.mcfota");
+            return KAL_FALSE;
+        }
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	free_local_para((local_para_struct *)combined_file_req);
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+	if(strcmp(nv_ota_file.path,"") != 0){
+		mcf_ut_format_err_str("Fail to store file path!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(nv_ota_file.name,"") != 0){
+		mcf_ut_format_err_str("Fail to store file name!!\r\n");
+        return KAL_FALSE;
+	}
+
+    mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Do full OTA FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_test_lid_value(NULL);
+    if (ret == KAL_FALSE) {
+        mcf_ut_format_err_str("Do full OTA positive test (Both SW verno of file and MD mismatch) FAIL!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	ret = mcf_check_lid_need_reset(NVRAM_EF_MCF_TEST_OTA_LID);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+	
+	
+	/*
+     *  Read TLV-OTA by LID & sbp_tag positive test - partially matched tag
+     *  NVRAM_EF_MCF_TEST_OTA_LID with tag SBP_PARTIAL_TAG (12_NA_NA), but user searches SBP_FULL_TAG (12_33_21)
+     */
+    /* Fill TLV-OTA file into buffer */
+	/*Merge two OP-OTA file positive test - Same path */
+	
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	/* Reset NVRAM_EF_MCF_INTERNAL_INFO_LID */
+    kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write NVRAM_EF_MCF_INTERNAL_INFO_LID to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	/*Assign merged file name*/
+	assigned_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	assigned_file_req->op = L4C_MCF_CONFIG_ASSIGN_COMBINED_PATH;
+	assigned_file_req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+	assigned_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(assigned_file_req->config1,"MCF_OPOTA_ut_merge.mcfopota");
+	
+	if(mcf_assign_combined_file_path(assigned_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Assign combined OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	free_local_para((local_para_struct *)assigned_file_req);
+
+	/* First. apply MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota - reset */
+	combined_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota");
+	combined_file_req->reset = KAL_TRUE;
+    
+	tlvota_file = &(pMcf->tlvota_file[0]);
+
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota");
+			return KAL_FALSE;
+		}
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+
+	
+	/* Second. apply MCF_TLVOTA_SBP_full_ut_gid_query_normal.mcfopota - append */
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_TLVOTA_SBP_full_ut_gid_query_normal.mcfopota");
+	combined_file_req->reset = KAL_FALSE;
+    
+	tlvota_file = &(pMcf->tlvota_file[0]);
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	//Due to append, no need to reset
+	ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, 0);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 0);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 3 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+	
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		kal_mem_cpy(mcf_file_buffer, (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+	
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_full_ut_gid_query_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_full_ut_gid_query_normal.mcfopota");
+			return KAL_FALSE;
+		}
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+	
+	MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		if(mcf_merge_ota_buffer(mcf_file_buffer, tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE) != KAL_TRUE){
+			//XXX
+			ret = MCF_OTA_R_INVALID_PARAMETER;
+			MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			return ret;
+		}
+		MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	}
+	
+	free_local_para((local_para_struct *)combined_file_req);
+    
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLVOTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+	if(strcmp(nv_tlvota_file.path,MCF_FS_CUSTOM_FOLDER_PATH) != 0){
+		mcf_ut_format_err_str("Fail to store file path!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(nv_tlvota_file.name,"MCF_OPOTA_ut_merge.mcfopota") != 0){
+		mcf_ut_format_err_str("Fail to store file name!!\r\n");
+        return KAL_FALSE;
+	}
+
+	MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+		MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	}
+
+    // NVRAM_EF_MCF_TEST_OTA_LID with SBP_PARTIAL_TAG
+    kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+
+    
+	kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+	mcf_ret = mcf_read_tlvota_buffer_sbp_tag(0, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+	if (mcf_ret != MCF_OTA_R_SUCCESS) {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", 0, mcf_ret);
+		return KAL_FALSE;
+	}
+
+	ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+		return KAL_FALSE;
+	}
+	
+	kal_mem_set(&test_lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+	mcf_ret = mcf_read_tlvota_buffer_sbp_tag(0, sbp_tag, NVRAM_EF_MCF_TEST_OTA_QUERY_LID, (kal_uint8 *)&test_lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+	if (mcf_ret != MCF_OTA_R_SUCCESS) {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", 0, mcf_ret);
+		return KAL_FALSE;
+	}
+
+	ret = mcf_check_test_lid_value((kal_uint8 *)&test_lid_buffer);
+	if (ret == KAL_FALSE) {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag positive test (partially matched tag) FAIL!!\r\n");
+		return KAL_FALSE;
+	}
+    
+    /* Test By OP merged reset */
+    
+    /* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	/* Reset NVRAM_EF_MCF_INTERNAL_INFO_LID */
+    kal_mem_set(&nv_int_info, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, 1, (kal_uint8 *)&nv_int_info, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write NVRAM_EF_MCF_INTERNAL_INFO_LID to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	/*Assign merged file name*/
+	assigned_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	assigned_file_req->op = L4C_MCF_CONFIG_ASSIGN_COMBINED_PATH;
+	assigned_file_req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+	assigned_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(assigned_file_req->config1,"MCF_OPOTA_ut_merge.mcfopota");
+	
+	if(mcf_assign_combined_file_path(assigned_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Assign combined OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	free_local_para((local_para_struct *)assigned_file_req);
+
+	/* First. apply MCF_TLVOTA_SBP_partial_ut_3LIDs_gid_normal.mcfopota - reset */
+	combined_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_TLVOTA_SBP_partial_ut_3LIDs_gid_normal.mcfopota");
+	combined_file_req->reset = KAL_TRUE;
+    
+	tlvota_file = &(pMcf->tlvota_file[0]);
+
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_3LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_3LIDs_gid_normal.mcfopota");
+			return KAL_FALSE;
+		}
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+
+	
+	/* Second. apply MCF_TLVOTA_SBP_partial_ut_2LIDs_gid_normal.mcfopota - append */
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_TLVOTA_SBP_partial_ut_2LIDs_gid_normal.mcfopota");
+	combined_file_req->reset = KAL_FALSE;
+    combined_file_req->trigger_dsbp = KAL_TRUE;
+    
+	tlvota_file = &(pMcf->tlvota_file[0]);
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+	
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		kal_mem_cpy(mcf_file_buffer, (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+	
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_2LIDs_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_2LIDs_gid_normal.mcfopota");
+			return KAL_FALSE;
+		}
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+	
+	MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		if(mcf_merge_ota_buffer(mcf_file_buffer, tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE) != KAL_TRUE){
+			//XXX
+			ret = MCF_OTA_R_INVALID_PARAMETER;
+			MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+			return ret;
+		}
+		MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	}
+	
+	free_local_para((local_para_struct *)combined_file_req);
+    
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLVOTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+
+	if(strcmp(nv_tlvota_file.path,MCF_FS_CUSTOM_FOLDER_PATH) != 0){
+		mcf_ut_format_err_str("Fail to store file path!!\r\n");
+        return KAL_FALSE;
+	}
+	
+	if(strcmp(nv_tlvota_file.name,"MCF_OPOTA_ut_merge.mcfopota") != 0){
+		mcf_ut_format_err_str("Fail to store file name!!\r\n");
+        return KAL_FALSE;
+	}
+
+	MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+		MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	}
+    
+    param_ptr.sbp_id = SBP_TAG_SBPID; 
+    param_ptr.ps_id = 0;
+    kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    kal_mem_set(param_ptr.iccid, 0, 21);
+    
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    
+    //Due to append, no need to reset
+    ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, 0);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, 0);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, 0);
+    if (ret != KAL_FALSE) {
+        mcf_ut_format_err_str("Check LID need reset positive test (Modify 2 LIDs) FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+    
+    ret = mcf_set_config_after_dsbp(0);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("can not set config. ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    
+    //Apply MCF_TLVOTA_SBP_partial_ut_gid_normal with reset
+    
+    combined_file_req = (l4c_mcf_set_config_req_struct *)construct_local_para(sizeof(l4c_mcf_set_config_req_struct), TD_RESET);
+	combined_file_req->op = L4C_MCF_CONFIG_SET_FILE_PATH_AND_AUTO_SELECT_BIN;
+	combined_file_req->config_type = L4C_MCF_CONFIG_TYPE_CARRIER_BIN;
+	combined_file_req->path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+	strcpy(combined_file_req->config1,"MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota");
+	combined_file_req->reset = KAL_TRUE;
+    combined_file_req->trigger_dsbp = KAL_TRUE;
+    
+	tlvota_file = &(pMcf->tlvota_file[0]);
+
+	MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	if (tlvota_file) {
+		pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+		pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + sizeof(mcf_tool_file_info_t));
+
+		ret = mcf_ut_open_test_data("MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota", (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE);
+		if (ret == KAL_FALSE) {
+			mcf_ut_format_err_str("Open test data(%s) FAIL!! \r\n", "MCF_TLVOTA_SBP_partial_ut_gid_normal.mcfopota");
+			return KAL_FALSE;
+		}
+
+		MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+	} else {
+		mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! Fail to take write lock! \r\n");
+		return KAL_FALSE;
+	}
+	
+	if(mcf_combined_ota_file(combined_file_req) != MCF_OTA_R_SUCCESS){
+		mcf_ut_format_err_str("Combine OTA fail!! \r\n");
+        return KAL_FALSE;
+	}
+    free_local_para((local_para_struct *)combined_file_req);
+    
+    param_ptr.sbp_id = SBP_TAG_SBPID; 
+    param_ptr.ps_id = 0;
+    kal_mem_cpy(param_ptr.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    kal_mem_cpy(param_ptr.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+    kal_mem_set(param_ptr.iccid, 0, 21);
+    
+    ret = mcf_auto_select_tlvota_file(&param_ptr);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("auto select tlvota file FAIL!! ret(%d) \r\n", ret);
+        return KAL_FALSE;
+    }
+    
+    //Due to reset, need to reset
+	ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_MCF_TEST_OTA_LID, 0);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset reset test FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_MCF_TEST_OTA_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_IMS_PROFILE_LID, 0);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset reset test FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_IMS_PROFILE_LID);
+        return KAL_FALSE;
+    }
+
+    ret = mcf_check_lid_need_reset_by_psid(NVRAM_EF_XCAP_PROFILE_LID, 0);
+    if (ret != KAL_TRUE) {
+        mcf_ut_format_err_str("Check LID need reset reset test FAIL!! ret(%d), LID(%d) \r\n", ret, NVRAM_EF_XCAP_PROFILE_LID);
+        return KAL_FALSE;
+    }
+    
+	
+	MCF_UT_PASS();
+	return KAL_TRUE;
+}
+
+kal_bool mcf_ut_write_variable_value(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+	kal_bool                                                ret;
+    l4c_mcf_variable_value_operation_req_struct            *req = NULL;
+    l4c_mcf_variable_value_operation_cnf_struct            *cnf = NULL;
+    mcf_ota_result_e                                        mcf_ret = MCF_OTA_R_SUCCESS;
+    mcf_t                                                  *pMcf = mcf_get_instance();
+    mcf_ota_file_t                                         *ota_file = &(pMcf->ota_file);
+    mcf_tool_file_info_t                                   *pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+    nvram_ef_mcf_ota_file_info_struct                       nv_ota_file;
+    nvram_ef_mcf_sw_info_struct                             nv_sw_info;
+    mcf_tlvota_file_t                                      *tlvota_file;
+    nvram_ef_mcf_tlvota_file_info_struct                    nv_tlvota_file;
+    mcf_tlvota_sbp_tag_t                                    sbp_tag;
+    kal_uint8                                               i;
+    kal_uint8                                               test_pattern[512];
+    kal_uint8                                               array_tag[16];
+    nvram_ef_mcf_test_struct                                nv_lid_buffer;
+	kal_uint32                                              int_value;
+	kal_char                                                value[256];
+	kal_uint16                                               sh_value;
+	nvram_ef_mcf_test_struct                                lid_buffer;
+	l4c_mcf_variable_value_operation_req_struct            *query_req = NULL;
+    l4c_mcf_variable_value_operation_cnf_struct            *query_cnf = NULL;
+	double                                                  db_value;
+	float                                                   fl_value;
+	kal_uint8                                               ch_value;
+
+    mcf_ut_init();
+	
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+     //Byte operation - VAL_BYTE_11
+	req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+44;
+    req->rec_id = 1;
+    req->len = 1;
+    kal_mem_set(array_tag, 0, 16);
+    strcpy(req->config, array_tag);
+	int_value = 64;
+	mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_byte_11), 1, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BYTE_11, %s, %s\r\n", req->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BYTE_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //Bit operation - VAL_BIT_BYTE_11
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+18;
+    req->rec_id = 1;
+    req->len = 0;
+    kal_mem_set(array_tag, 0, 16);
+    strcpy(req->config, array_tag);
+	int_value = 255;
+	mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+	
+	kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_bit_byte_11), 1, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_byte_11, %s, %s\r\n", req->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_byte_11, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //Bit operation - VAL_BIT_BYTE_11.B3
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+21;
+    req->rec_id = 1;
+    req->len = 0;
+    kal_mem_set(array_tag, 0, 16);
+    strcpy(req->config, array_tag);
+	int_value = 255;
+	mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+	
+	query_req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    query_req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    query_req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    query_req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    query_req->num = MCF_TEST_OTA_LID_BASE_GID+21;
+    query_req->rec_id = 1;
+    query_req->len = 0;
+    kal_mem_set(array_tag, 0, 16);
+    strcpy(query_req->config, array_tag);
+    
+    query_cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(query_req, query_cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BIT_BYTE_11.B3");
+        return KAL_FALSE;
+    }
+
+    if(strncmp((query_cnf->value), "01", cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11.B3, %s, %s\r\n", cnf->value, "01");
+        return KAL_FALSE;
+    }
+	
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_BIT_BYTE_11.B3, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+	free_local_para((local_para_struct *)query_req);
+    free_local_para((local_para_struct *)query_cnf);
+    
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //Bit operation - val_bit_byte_12 
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+27;
+    req->rec_id = 1;
+    req->len = 1;
+    strcpy(req->config, "");
+	int_value = 16;
+	mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+
+    if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+	
+	kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_bit_byte_12), 1, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_bit_byte_12, %s, %s\r\n", req->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_byte_12, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //Bit operation - val_bit_byte_12.L4b
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+29;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+	int_value = 15;
+	mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+	
+	query_req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    query_req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    query_req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OTA;
+    query_req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    query_req->num = MCF_TEST_OTA_LID_BASE_GID+29;
+    query_req->rec_id = 1;
+    query_req->len = 0;
+    kal_mem_set(array_tag, 0, 16);
+    strcpy(query_req->config, array_tag);
+    
+    query_cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_query_variable_value(query_req, query_cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BIT_BYTE_11.B3");
+        return KAL_FALSE;
+    }
+
+    if(strncmp(query_cnf->value, "0F", cnf->len*2+2) != 0){
+        mcf_ut_format_err_str("val_bit_byte_12.F4b, %s, %s\r\n", cnf->value, "0F");
+        return KAL_FALSE;
+    }
+
+    
+    if(query_cnf->len != 1){
+        mcf_ut_format_err_str("val_bit_byte_12.F4b, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+	free_local_para((local_para_struct *)query_req);
+    free_local_para((local_para_struct *)query_cnf);
+    
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //short operation - val_short_11
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+56;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+	sh_value = 256;
+	mcf_bytes_to_hex(&sh_value, 2, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_short_11), 2, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_short_11, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 2){
+        mcf_ut_format_err_str("val_short_11, %d, %d\r\n", cnf->len, 2);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //double operation - val_double_1
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+48;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "");
+	db_value = 6.6;
+	mcf_bytes_to_hex(&db_value, 8, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+    
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_double_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_double_1, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 8){
+        mcf_ut_format_err_str("val_double_1, %d, %d\r\n", cnf->len, 8);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //buffer operation -  val_buffer_1[0]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+42;
+    req->rec_id = 1;
+    req->len = 1;
+    strcpy(req->config, "0");
+	ch_value = 'M';
+    mcf_bytes_to_hex(&ch_value, 1, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+    
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_buffer_1[0], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("val_buffer_1[0], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //float operation - val_struct_1.vfloat
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+78;
+    req->rec_id = 1;
+    req->len = 4;
+    strcpy(req->config, "");
+	fl_value = 0.4;
+    mcf_bytes_to_hex(&fl_value, 4, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_struct_1.vfloat), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_struct_1.vfloat, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("val_struct_1.vfloat, %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+    
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //int in struct operation - val_struct_3[0].vint
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+125;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "0");
+	int_value = 66;
+    mcf_bytes_to_hex(&int_value, 4, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_struct_3[0].vint), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_struct_3[0].vint, %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 4){
+        mcf_ut_format_err_str("val_struct_3[0].vint, %d, %d\r\n", cnf->len, 4);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+
+    /* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //buffer in struct operation - VAL_STRUCT_3[3].VBUFFER[2][4][5]
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = MCF_TEST_OTA_LID_BASE_GID+120;
+    req->rec_id = 1;
+    req->len = 0;
+    strcpy(req->config, "3,2,4,5");
+    ch_value = 'C';
+    mcf_bytes_to_hex(&ch_value, 1, KAL_FALSE, &value);
+	strcpy((kal_char *)(req->value), value);
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_struct_3[3].vbuffer[2]), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+        mcf_ut_format_err_str("VAL_STRUCT_3[3].VBUFFER[2][4][5], %s, %s\r\n", cnf->value, test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 1){
+        mcf_ut_format_err_str("VAL_STRUCT_3[3].VBUFFER[2][4][5], %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+	
+	//Test value byte is not equal to variable size
+	
+	/* Write MCF OTA file version to NVRAM */
+    kal_mem_set(&nv_ota_file, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+    strncpy(nv_ota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_ota_file.name, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, 1, (kal_uint8 *)&nv_ota_file, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+    kal_mem_set(&nv_sw_info, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+    strncpy(nv_sw_info.last_update_file.sw_version, MCF_UT_SW_VERNO, MCF_FILE_MAX_SW_VERSION_LEN);
+    strncpy(nv_sw_info.last_update_file.gen_time, MCF_UT_GEN_TIME, MCF_FILE_MAX_GEN_TIME_LEN);
+    strcpy(nv_sw_info.last_update_file.path, "");
+    strcpy(nv_sw_info.last_update_file.name, "");
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF sw info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+    //buffer operation -  val_long_1
+    req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+    req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+    req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OTA;
+    req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+    req->num = 5113;
+    req->rec_id = 1;
+    req->len = 1;
+	strcpy((kal_char *)(req->value), "be15");
+    
+    cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+    mcf_ret = mcf_set_variable_value(req, cnf);
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+        return KAL_FALSE;
+    }
+	
+	MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_cpy(ota_file->buff, mcf_merge_buffer, MCF_MAX_OTA_FILE_SIZE);
+
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        mcf_ut_format_err_str("Do full OTA FAIL!! Fail to take write lock! \r\n");
+        return KAL_FALSE;
+    }
+	
+	mcf_ret = mcf_do_ota_full();
+    if (mcf_ret != MCF_OTA_R_SUCCESS) {
+        mcf_ut_format_err_str("Reset LID FAIL!! ret(%d) \r\n", mcf_ret);
+        return KAL_FALSE;
+    }
+	
+	if ( !nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, &lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+		printf("Fail to read NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+		ret = KAL_FALSE;
+	}
+    
+    kal_mem_set(test_pattern,0,512);
+    mcf_bytes_to_hex(&(lid_buffer.val_long_1), cnf->len, KAL_FALSE, &test_pattern);
+    mcf_toupper((char *)test_pattern);
+	mcf_toupper((char *)req->value);
+
+    if(strncmp(test_pattern, "BE15000000000000", cnf->len*2) != 0){
+        mcf_ut_format_err_str("val_long_1, %s, %s\r\n", "BE15000000000000", test_pattern);
+        return KAL_FALSE;
+    }
+    
+    if(cnf->len != 8){
+        mcf_ut_format_err_str("val_long_1, %d, %d\r\n", cnf->len, 1);
+        return KAL_FALSE;
+    }
+    
+    free_local_para((local_para_struct *)req);
+    free_local_para((local_para_struct *)cnf);
+	
+	/*Test TLVOTA file*/
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+44;
+		req->ps_id = i;
+		req->len = 1;
+		kal_mem_set(array_tag, 0, 16);
+		strcpy(req->config, array_tag);
+		int_value = 64;
+		mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		kal_mem_set(&lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+		kal_mem_set(test_pattern,0,512);
+		mcf_bytes_to_hex(&(lid_buffer.val_byte_11), 1, KAL_FALSE, &test_pattern);
+		mcf_toupper((char *)test_pattern);
+		mcf_toupper((char *)req->value);
+
+		if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+			mcf_ut_format_err_str("VAL_BYTE_11, %s, %s\r\n", req->value, test_pattern);
+			return KAL_FALSE;
+		}
+		
+		if(cnf->len != 1){
+			mcf_ut_format_err_str("VAL_BYTE_11, %d, %d\r\n", cnf->len, 1);
+			return KAL_FALSE;
+		}
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+	}
+	
+    //Bit operation - VAL_BIT_BYTE_11
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+18;
+		req->ps_id = i;
+		req->len = 1;
+		kal_mem_set(array_tag, 0, 16);
+		strcpy(req->config, array_tag);
+		int_value = 255;
+		mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		kal_mem_set(&lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+		kal_mem_set(test_pattern,0,512);
+		mcf_bytes_to_hex(&(lid_buffer.val_bit_byte_11), 1, KAL_FALSE, &test_pattern);
+		mcf_toupper((char *)test_pattern);
+		mcf_toupper((char *)req->value);
+
+		if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+			mcf_ut_format_err_str("val_bit_byte_11, %s, %s\r\n", req->value, test_pattern);
+			return KAL_FALSE;
+		}
+		
+		if(cnf->len != 1){
+			mcf_ut_format_err_str("val_bit_byte_11, %d, %d\r\n", cnf->len, 1);
+			return KAL_FALSE;
+		}
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+	}
+	
+    //Bit operation - VAL_BIT_BYTE_11.B3
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BIT_BYTE_11.B3
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+21;
+		req->ps_id = i;
+		req->len = 1;
+		kal_mem_set(array_tag, 0, 16);
+		strcpy(req->config, array_tag);
+		int_value = 255;
+		mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		query_req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		query_req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		query_req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA;
+		query_req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		query_req->num = MCF_TEST_OTA_LID_BASE_GID+21;
+		query_req->ps_id = i;
+		query_req->len = 0;
+		kal_mem_set(array_tag, 0, 16);
+		strcpy(query_req->config, array_tag);
+		
+		query_cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		mcf_ret = mcf_query_variable_value(query_req, query_cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BIT_BYTE_11.B3");
+			return KAL_FALSE;
+		}
+
+		if(strncmp(query_cnf->value, "01", cnf->len*2) != 0){
+			mcf_ut_format_err_str("VAL_BIT_BYTE_11.B3, %s, %s\r\n", cnf->value, "01");
+			return KAL_FALSE;
+		}
+		
+		
+		if(cnf->len != 1){
+			mcf_ut_format_err_str("VAL_BIT_BYTE_11.B3, %d, %d\r\n", cnf->len, 1);
+			return KAL_FALSE;
+		}
+
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+		free_local_para((local_para_struct *)query_req);
+		free_local_para((local_para_struct *)query_cnf);
+	}
+    
+	//Bit operation - val_bit_byte_12 
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+27;
+		req->ps_id = i;
+		req->len = 1;
+		kal_mem_set(array_tag, 0, 16);
+		strcpy(req->config, array_tag);
+		int_value = 16;
+		mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		kal_mem_set(&lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+		kal_mem_set(test_pattern,0,512);
+		mcf_bytes_to_hex(&(lid_buffer.val_bit_byte_12), 1, KAL_FALSE, &test_pattern);
+		mcf_toupper((char *)test_pattern);
+		mcf_toupper((char *)req->value);
+
+		if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+			mcf_ut_format_err_str("val_bit_byte_12, %s, %s\r\n", req->value, test_pattern);
+			return KAL_FALSE;
+		}
+		
+		if(cnf->len != 1){
+			mcf_ut_format_err_str("val_bit_byte_12, %d, %d\r\n", cnf->len, 1);
+			return KAL_FALSE;
+		}
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+	}
+	
+    //Bit operation - val_bit_byte_12.L4b
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+29;
+		req->ps_id = i;
+		req->len = 1;
+		kal_mem_set(array_tag, 0, 16);
+		strcpy(req->config, array_tag);
+		int_value = 15;
+		mcf_bytes_to_hex(&int_value, 1, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		query_req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		query_req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		query_req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_READ_OPOTA;
+		query_req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		query_req->num = MCF_TEST_OTA_LID_BASE_GID+29;
+		query_req->ps_id = i;
+		query_req->len = 0;
+		kal_mem_set(array_tag, 0, 16);
+		strcpy(query_req->config, array_tag);
+		
+		query_cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		mcf_ret = mcf_query_variable_value(query_req, query_cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BIT_BYTE_11.B3");
+			return KAL_FALSE;
+		}
+
+		if(strncmp(query_cnf->value, "0F", cnf->len*2) != 0){
+			mcf_ut_format_err_str("VAL_BIT_BYTE_12.L4B, %s, %s\r\n", cnf->value, "01");
+			return KAL_FALSE;
+		}
+		
+		
+		if(query_cnf->len != 1){
+			mcf_ut_format_err_str("VAL_BIT_BYTE_12.L4B, %d, %d\r\n", cnf->len, 1);
+			return KAL_FALSE;
+		}
+
+
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+		free_local_para((local_para_struct *)query_req);
+		free_local_para((local_para_struct *)query_cnf);
+	}
+
+    //short operation - val_short_11
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+56;
+		req->ps_id = i;
+		req->len = 1;
+		kal_mem_set(array_tag, 0, 16);
+		strcpy(req->config, array_tag);
+		sh_value = 256;
+		mcf_bytes_to_hex(&sh_value, 2, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		kal_mem_set(&lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+		kal_mem_set(test_pattern,0,512);
+		mcf_bytes_to_hex(&(lid_buffer.val_short_11), 2, KAL_FALSE, &test_pattern);
+		mcf_toupper((char *)test_pattern);
+		mcf_toupper((char *)req->value);
+
+		if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+			mcf_ut_format_err_str("val_short_11, %s, %s\r\n", cnf->value, test_pattern);
+			return KAL_FALSE;
+		}
+		
+		if(cnf->len != 2){
+			mcf_ut_format_err_str("val_short_11, %d, %d\r\n", cnf->len, 2);
+			return KAL_FALSE;
+		}
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+	}
+	
+    //double operation - val_double_1
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+48;
+		req->ps_id = i;
+		req->len = 1;
+		kal_mem_set(array_tag, 0, 16);
+		strcpy(req->config, array_tag);
+		db_value = 6.6;
+		mcf_bytes_to_hex(&db_value, 8, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		kal_mem_set(&lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+		kal_mem_set(test_pattern,0,512);
+		mcf_bytes_to_hex(&(lid_buffer.val_double_1), cnf->len, KAL_FALSE, &test_pattern);
+		mcf_toupper((char *)test_pattern);
+		mcf_toupper((char *)req->value);
+
+		if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+			mcf_ut_format_err_str("val_double_1, %s, %s\r\n", cnf->value, test_pattern);
+			return KAL_FALSE;
+		}
+		
+		if(cnf->len != 8){
+			mcf_ut_format_err_str("val_double_1, %d, %d\r\n", cnf->len, 8);
+			return KAL_FALSE;
+		}
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+	}
+	
+    //buffer operation -  val_buffer_1[0]
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+42;
+		req->ps_id = i;
+		req->len = 1;
+		strcpy(req->config, "0");
+		ch_value = 'M';
+		mcf_bytes_to_hex(&ch_value, 1, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		kal_mem_set(&lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+		kal_mem_set(test_pattern,0,512);
+		mcf_bytes_to_hex(&(lid_buffer.val_buffer_1), cnf->len, KAL_FALSE, &test_pattern);
+		mcf_toupper((char *)test_pattern);
+		mcf_toupper((char *)req->value);
+
+		if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+			mcf_ut_format_err_str("val_buffer_1[0], %s, %s\r\n", cnf->value, test_pattern);
+			return KAL_FALSE;
+		}
+		
+		if(cnf->len != 1){
+			mcf_ut_format_err_str("val_buffer_1[0], %d, %d\r\n", cnf->len, 1);
+			return KAL_FALSE;
+		}
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+	}
+	
+    //float operation - val_struct_1.vfloat
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+78;
+		req->ps_id = i;
+		req->len = 4;
+		strcpy(req->config, "");
+		fl_value = 0.4;
+		mcf_bytes_to_hex(&fl_value, 4, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		kal_mem_set(&lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+		kal_mem_set(test_pattern,0,512);
+		mcf_bytes_to_hex(&(lid_buffer.val_struct_1.vfloat), cnf->len, KAL_FALSE, &test_pattern);
+		mcf_toupper((char *)test_pattern);
+		mcf_toupper((char *)req->value);
+
+		if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+			mcf_ut_format_err_str("val_struct_1.vfloat, %s, %s\r\n", cnf->value, test_pattern);
+			return KAL_FALSE;
+		}
+		
+		if(cnf->len != 4){
+			mcf_ut_format_err_str("val_struct_1.vfloat, %d, %d\r\n", cnf->len, 4);
+			return KAL_FALSE;
+		}
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+	}
+	
+    //int in struct operation - val_struct_3[0].vint
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+125;
+		req->ps_id = i;
+		req->len = 0;
+		strcpy(req->config, "0");
+		int_value = 66;
+		mcf_bytes_to_hex(&int_value, 4, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		kal_mem_set(&lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+		kal_mem_set(test_pattern,0,512);
+		mcf_bytes_to_hex(&(lid_buffer.val_struct_3[0].vint), cnf->len, KAL_FALSE, &test_pattern);
+		mcf_toupper((char *)test_pattern);
+		mcf_toupper((char *)req->value);
+
+		if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+			mcf_ut_format_err_str("val_struct_3[0].vint, %s, %s\r\n", cnf->value, test_pattern);
+			return KAL_FALSE;
+		}
+		
+		if(cnf->len != 4){
+			mcf_ut_format_err_str("val_struct_3[0].vint, %d, %d\r\n", cnf->len, 4);
+			return KAL_FALSE;
+		}
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+	}
+	
+    //buffer in struct operation - VAL_STRUCT_3[3].VBUFFER[2][4][5]
+	/* Write MCF TLV-OTA file version to NVRAM */
+    kal_mem_set(&nv_tlvota_file, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+    strncpy(nv_tlvota_file.path, MCF_FS_DEFAULT_FOLDER_PATH, MCF_FILE_MAX_MD_PATH_LEN);
+    strncpy(nv_tlvota_file.name, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN);
+    if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, 1, (kal_uint8 *)&nv_tlvota_file, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+        mcf_ut_format_err_str("Fail to write MCF TLV-OTA file info to NVRAM!!\r\n");
+        return KAL_FALSE;
+    }
+	
+	kal_mem_set(&sbp_tag, 0, sizeof(mcf_tlvota_sbp_tag_t));
+    sbp_tag.sbp_id = SBP_TAG_SBPID;
+    strncpy(sbp_tag.mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+    strncpy(sbp_tag.mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+	
+	for (i = 0; i < MAX_SIM_NUM; i++) {
+		tlvota_file = &(pMcf->tlvota_file[i]);
+		tlvota_file->sbp_id = SBP_TAG_SBPID;
+		strncpy(tlvota_file->mcc, SBP_TAG_MCC, MAX_MCC_STR_LEN);
+		strncpy(tlvota_file->mnc, SBP_TAG_MNC, MAX_MNC_STR_LEN);
+		
+		 //Byte operation - VAL_BYTE_11
+		req = (l4c_mcf_variable_value_operation_req_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_req_struct), TD_RESET);
+		req->op = L4C_MCF_CONFIG_VARIABLE_VALUE_OPERATION;
+		req->action = L4C_MCF_CONFIG_LID_VARIABLE_ACT_WRITE_OPOTA;
+		req->format = L4C_MCF_QUERY_VARIABLE_FORM_GID;
+		req->num = MCF_TEST_OTA_LID_BASE_GID+120;
+		req->ps_id = i;
+		req->len = 0;
+		strcpy(req->config, "3,2,4,5");
+		ch_value = 'C';
+		mcf_bytes_to_hex(&ch_value, 1, KAL_FALSE, &value);
+		strcpy((kal_char *)(req->value), value);
+		
+		cnf = (l4c_mcf_variable_value_operation_cnf_struct *)construct_local_para(sizeof(l4c_mcf_variable_value_operation_cnf_struct), TD_RESET);
+
+		mcf_ret = mcf_set_variable_value(req, cnf);
+		if (mcf_ret != MCF_OTA_R_SUCCESS) {
+			mcf_ut_format_err_str("GID Query Variable Value (%s) FAIL!!\r\n", "VAL_BYTE_11");
+			return KAL_FALSE;
+		}
+		
+		MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		if (tlvota_file) {
+			kal_mem_cpy(tlvota_file->buff, mcf_merge_buffer, MCF_MAX_TLVOTA_FILE_SIZE);
+
+			MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+		} else {
+			mcf_ut_format_err_str("Fail to take write lock! \r\n");
+			return KAL_FALSE;
+		}
+		
+		kal_mem_set(&lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+
+        mcf_ret = mcf_read_tlvota_buffer_sbp_tag(i, sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8 *)&lid_buffer, sizeof(nvram_ef_mcf_test_struct));
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_ut_format_err_str("Read TLV-OTA by LID & sbp_tag FAIL!! i(%d), ret(%d) \r\n", i, mcf_ret);
+            return KAL_FALSE;
+        }
+
+		kal_mem_set(test_pattern,0,512);
+		mcf_bytes_to_hex(&(lid_buffer.val_struct_3[3].vbuffer[2]), cnf->len, KAL_FALSE, &test_pattern);
+		mcf_toupper((char *)test_pattern);
+		mcf_toupper((char *)req->value);
+
+		if(strncmp((kal_char *)(req->value), test_pattern, cnf->len*2) != 0){
+			mcf_ut_format_err_str("VAL_STRUCT_3[3].VBUFFER[2][4][5], %s, %s\r\n", cnf->value, test_pattern);
+			return KAL_FALSE;
+		}
+		
+		if(cnf->len != 1){
+			mcf_ut_format_err_str("VAL_STRUCT_3[3].VBUFFER[2][4][5], %d, %d\r\n", cnf->len, 1);
+			return KAL_FALSE;
+		}
+		free_local_para((local_para_struct *)req);
+		free_local_para((local_para_struct *)cnf);
+	}
+	
+	MCF_UT_PASS();
+	return KAL_TRUE;
+}
+#endif
+
+kal_char mcf_ut_digest_file[MCF_MAX_OTA_FILE_SIZE];
+kal_bool mcf_ut_mcf_verify_digest(void *p_param, kal_char *p_ret_err_str, kal_uint32 *p_ret_err_str_sz)
+{
+    kal_uint32 ret = KAL_TRUE;
+    kal_uint32 checksum = KAL_TRUE;
+    mcf_tool_file_info_t *ota_file;
+    mcf_digest *sign;
+    
+    // CASE1 : verify pure digest by SHA256+RSA2048
+    ret = mcf_ut_open_test_data("SHA256_RSA2048.mcfota", mcf_ut_digest_file, MCF_MAX_OTA_FILE_SIZE);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    ota_file = (mcf_tool_file_info_t *) mcf_ut_digest_file;
+    sign = (kal_char *)ota_file + ota_file->file_size;
+
+    ret =  mcf_verify_digest(MCF_FILE_OP_SHA256_RSA2048, ota_file, sign);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    // CASE2 : verify AES128 & digest by SHA256+RSA2048
+    
+    ret = mcf_ut_open_test_data("AES128_SHA256_RSA2048.mcfota", mcf_ut_digest_file, MCF_MAX_OTA_FILE_SIZE);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    ota_file = (mcf_tool_file_info_t *) mcf_ut_digest_file;
+    sign = (kal_char *)ota_file + ota_file->file_size;
+
+    ret =  mcf_verify_digest(MCF_FILE_OP_SHA256_RSA2048, ota_file, sign);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    {
+        kal_char   password[32] = { '\0' };
+        mcf_get_custom_aes_password(password);
+        mcf_decrypt_128bit((kal_char *)password, ((kal_char *)ota_file + ota_file->total_len), (ota_file->file_size - ota_file->total_len));
+        checksum = mcf_check_check_sum((kal_uint32 *)(ota_file), ota_file->file_size);
+        if(checksum != 0) return KAL_FALSE;
+    }
+    
+    // CASE3 : verify AES256 & digest by SHA256+RSA2048
+    
+    ret = mcf_ut_open_test_data("AES256_SHA256_RSA2048.mcfota", mcf_ut_digest_file, MCF_MAX_OTA_FILE_SIZE);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    ota_file = (mcf_tool_file_info_t *) mcf_ut_digest_file;
+    sign = (kal_char *)ota_file + ota_file->file_size;
+
+    ret =  mcf_verify_digest(MCF_FILE_OP_SHA256_RSA2048, ota_file, sign);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    {
+        kal_char   password[32] = { '\0' };
+        mcf_get_custom_aes_password(password);
+        mcf_decrypt_256bit((kal_char *)password, ((kal_char *)ota_file + ota_file->total_len), (ota_file->file_size - ota_file->total_len));
+        checksum = mcf_check_check_sum((kal_uint32 *)(ota_file), ota_file->file_size);
+        if(checksum != 0) return KAL_FALSE;
+    }
+
+    // CASE4 : verify pure digest by SHA384+RSA3072
+    ret = mcf_ut_open_test_data("SHA384_RSA3072.mcfota", mcf_ut_digest_file, MCF_MAX_OTA_FILE_SIZE);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    ota_file = (mcf_tool_file_info_t *) mcf_ut_digest_file;
+    sign = (kal_char *)ota_file + ota_file->file_size;
+
+    ret =  mcf_verify_digest(MCF_FILE_OP_SHA384_RSA3072, ota_file, sign);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+
+    // CASE5 : verify AES128 & pure digest by SHA384+RSA3072
+
+    ret = mcf_ut_open_test_data("AES128_SHA384_RSA3072.mcfota", mcf_ut_digest_file, MCF_MAX_OTA_FILE_SIZE);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    ota_file = (mcf_tool_file_info_t *) mcf_ut_digest_file;
+    sign = (kal_char *)ota_file + ota_file->file_size;
+
+    ret =  mcf_verify_digest(MCF_FILE_OP_SHA384_RSA3072, ota_file, sign);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    {
+        kal_char   password[32] = { '\0' };
+        mcf_get_custom_aes_password(password);
+        mcf_decrypt_128bit((kal_char *)password, ((kal_char *)ota_file + ota_file->total_len), (ota_file->file_size - ota_file->total_len));
+        checksum = mcf_check_check_sum((kal_uint32 *)(ota_file), ota_file->file_size);
+        if(checksum != 0) return KAL_FALSE;
+    }
+    
+    // CASE6 : verify AES256 & pure digest by SHA384+RSA3072
+
+    ret = mcf_ut_open_test_data("AES256_SHA384_RSA3072.mcfota", mcf_ut_digest_file, MCF_MAX_OTA_FILE_SIZE);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    ota_file = (mcf_tool_file_info_t *) mcf_ut_digest_file;
+    sign = (kal_char *)ota_file + ota_file->file_size;
+
+    ret =  mcf_verify_digest(MCF_FILE_OP_SHA384_RSA3072, ota_file, sign);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    {
+        kal_char   password[32] = { '\0' };
+        mcf_get_custom_aes_password(password);
+        mcf_decrypt_256bit((kal_char *)password, ((kal_char *)ota_file + ota_file->total_len), (ota_file->file_size - ota_file->total_len));
+        checksum = mcf_check_check_sum((kal_uint32 *)(ota_file), ota_file->file_size);
+        if(checksum != 0) return KAL_FALSE;
+    }
+    
+    // CASE7 : Test wrong digest for SHA256 RSA2048
+    ret = mcf_ut_open_test_data("wrong_SHA256_RSA2048.mcfota", mcf_ut_digest_file, MCF_MAX_OTA_FILE_SIZE);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    ota_file = (mcf_tool_file_info_t *) mcf_ut_digest_file;
+    sign = (kal_char *)ota_file + ota_file->file_size;
+
+    ret =  mcf_verify_digest(MCF_FILE_OP_SHA256_RSA2048, ota_file, sign);
+    if(ret == KAL_TRUE) return KAL_FALSE;
+    
+    // CASE8 : Test wrong digest for SHA384 RSA3072
+    ret = mcf_ut_open_test_data("wrong_SHA384_RSA3072.mcfota", mcf_ut_digest_file, MCF_MAX_OTA_FILE_SIZE);
+    if(ret == KAL_FALSE) return KAL_FALSE;
+    
+    ota_file = (mcf_tool_file_info_t *) mcf_ut_digest_file;
+    sign = (kal_char *)ota_file + ota_file->file_size;
+
+    ret =  mcf_verify_digest(MCF_FILE_OP_SHA384_RSA3072, ota_file, sign);
+    if(ret == KAL_TRUE) return KAL_FALSE;
+    
+    MCF_UT_PASS();
+    return KAL_TRUE;
+}
+
+/*------------------------------------------------------------------------------
+ * Public fucntions.
+ *----------------------------------------------------------------------------*/
+#define MCF_UT_CASE(_func, _param) { #_func, _func, _param }
+
+kal_bool mcf_ut_st_create(void)
+{
+    static ST_TCASE_T mcf_ut_cases_s[] = {
+		
+        MCF_UT_CASE(mcf_ut_mcf_set_file_path_dsbp_passive_mode, NULL),
+        MCF_UT_CASE(mcf_ut_mcf_set_file_path_dsbp_active_mode, NULL),
+        MCF_UT_CASE(mcf_ut_mcf_get_applied_file_path, NULL),
+#if !defined(__MTK_TARGET__)
+		MCF_UT_CASE(mcf_ut_find_ini_item, NULL),
+        MCF_UT_CASE(mcf_ut_find_ini_sbp_id, NULL),
+        MCF_UT_CASE(mcf_ut_compose_ini_item, NULL),
+        MCF_UT_CASE(mcf_ut_gid_do_ota_full, NULL),
+        MCF_UT_CASE(mcf_ut_gid_do_ota_by_lid, NULL),
+        MCF_UT_CASE(mcf_ut_gid_read_ota_buffer, NULL),
+        MCF_UT_CASE(mcf_ut_gid_read_tlvota_buffer, NULL),
+        MCF_UT_CASE(mcf_ut_gid_read_tlvota_buffer_sbp, NULL),      
+        MCF_UT_CASE(mcf_ut_gid_reset_lid_full, NULL),
+        MCF_UT_CASE(mcf_ut_gid_mcf_check_lid_need_reset, NULL),
+        MCF_UT_CASE(mcf_ut_mcf_check_ota_need_update, NULL),
+        MCF_UT_CASE(mcf_ut_mcf_get_tlvota_file_result, NULL),
+        #if defined(__MCF_COMBINE_FILE_SUPPORT__)
+            MCF_UT_CASE(mcf_ut_combined_ota_file, NULL),
+            MCF_UT_CASE(mcf_ut_write_variable_value, NULL),
+        #endif
+#endif
+#if defined(__MCF_UT_FRAMEWORK_SUPPORT__)
+        MCF_UT_CASE(mcf_utfwk_ut_test_flow, NULL),
+		MCF_UT_CASE(mcf_utfwk_sample_code_ut, NULL),
+#endif
+        MCF_UT_CASE(mcf_ut_em_update_req_hdlr, NULL),
+#if defined(__MCF_FIND_TAG_SUPPORT__)
+        MCF_UT_CASE(mcf_ut_find_tag, NULL),
+        MCF_UT_CASE(mcf_ut_config_LID, NULL),
+        #if !defined(__MTK_TARGET__)
+            MCF_UT_CASE(mcf_ut_do_ota_full, NULL),
+            MCF_UT_CASE(mcf_ut_do_ota_by_lid, NULL),
+            MCF_UT_CASE(mcf_ut_read_ota_buffer, NULL),
+            MCF_UT_CASE(mcf_ut_read_tlvota_buffer, NULL),
+            MCF_UT_CASE(mcf_ut_read_tlvota_buffer_sbp, NULL),      
+            MCF_UT_CASE(mcf_ut_reset_lid_full, NULL),
+            MCF_UT_CASE(mcf_ut_mcf_check_lid_need_reset, NULL),
+        #endif
+#endif
+#if defined(__MCF_FIND_GID_SUPPORT__)
+        MCF_UT_CASE(mcf_ut_find_gid, NULL),
+        MCF_UT_CASE(mcf_ut_query_variable_value, NULL),
+#endif
+        MCF_UT_CASE(mcf_ut_gid_mcf_check_lid_need_reset_by_psid, NULL),
+        MCF_UT_CASE(mcf_ut_mcf_encrypt_decrypt, NULL),
+        MCF_UT_CASE(mcf_ut_mcf_verify_digest, NULL),
+        #if defined(__MCF_COMBINE_FILE_SUPPORT__)
+            MCF_UT_CASE(mcf_merge_ota_file_ut, NULL),
+            MCF_UT_CASE(mcf_merge_ota_by_op_file_ut, NULL),
+            MCF_UT_CASE(mcf_merge_one_gid_ut, NULL),
+            MCF_UT_CASE(mcf_merge_ota_by_op_merge_one_gid_ut, NULL),
+            MCF_UT_CASE(mcf_merge_encrypted_ota_file_ut, NULL),
+        #endif
+		//MCF_UT_CASE(mcf_ut_mcf_boot_trace, NULL),
+        
+		
+    };
+
+#if defined(TEST_MCF_TEST_TASK)
+    {
+        kal_uint32 i = 0;
+        kal_bool ret = KAL_FALSE;
+        kal_char p_ret_err_str[100];
+        kal_uint32  p_ret_err_str_sz;
+        for (i = 0 ; i < (sizeof(mcf_ut_cases_s)/sizeof(ST_TCASE_T)) ; i++)
+        {
+            ret = mcf_ut_cases_s[i].test_func(mcf_ut_cases_s[i].test_param, p_ret_err_str, &p_ret_err_str_sz);
+            if (ret == KAL_FALSE) 
+                ASSERT(0);
+        }
+    }
+#elif defined(TEST_SYS_TEST_TASK)
+    return st_reg_test("MCF", &(mcf_ut_cases_s[0]), (sizeof(mcf_ut_cases_s)/sizeof(ST_TCASE_T)));
+#endif
+}
+
+#if defined(TEST_MCF_TEST_TASK)
+kal_bool mcf_test_task_init(void)
+{
+    return KAL_TRUE;
+}
+
+void mcf_test_task_main(task_entry_struct *task_entry_ptr)
+{
+    ilm_struct	current_ilm;
+
+    kal_set_active_module_id(MOD_MCF_TEST);
+
+    mcf_ut_st_create();
+    // external queue, this may suspend.*/
+	while(1)
+	{
+		if (KAL_TRUE == msg_receive_extq(&current_ilm)) {
+		// handle ILM
+			destroy_ilm(&current_ilm);
+		}
+	}
+}
+
+kal_bool mcf_test_create(comptask_handler_struct **handle)
+{
+    static const comptask_handler_struct mcf_test_task_info =
+    {
+        mcf_test_task_main,          /* task entry function */
+        mcf_test_task_init,          /* task initialization function */
+        NULL                        /* task reset handler */
+    };
+
+    *handle = (comptask_handler_struct *)&mcf_test_task_info;
+    return KAL_TRUE;
+}
+#endif
+
diff --git a/mcu/service/mcf/src/mcf_utfwk.c b/mcu/service/mcf/src/mcf_utfwk.c
new file mode 100644
index 0000000..4a6c5b8
--- /dev/null
+++ b/mcu/service/mcf/src/mcf_utfwk.c
@@ -0,0 +1,1844 @@
+#include "kal_public_api.h"
+#include "fs_general_api.h"
+#include <direct.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+
+#include "em_msgid.h"
+#include "em_l4_common_public_struct.h"
+#include "em_mcf_public_struct.h"
+#include "em_struct.h"
+
+#include "nvram_interface.h"
+#include "nvram_group_def.h"
+#include "mcf_nvram_editor.h"
+
+#include "mcf_msgid.h"
+#include "md_svc_sap.h"
+#include "mcf_if.h"
+#include "mcf_util.h"
+#include "mcf_defs.h"
+#include "mcf_object.h"
+#include "mcf_debug.h"
+#include "mcf_utfwk.h"
+#include "mcf_custom.h"
+#include "mcf_struct.h"
+
+/*------------------------------------------------------------------------------
+ * Constant definition.
+ *----------------------------------------------------------------------------*/
+#define MCF_FS_DUMMY_AP_FILE_PATH "/nvdata/mdota"
+#define MCF_UTFWK_DYN_PTR_NUM 1024
+#define MCF_UT_FWK_OTA_FILE_PREFIX       "MTK_UTFWK_OTA"
+#define MCF_UT_FWK_TLVOTA_FILE_PREFIX       "MTK_UTFWK_OPOTA_SBPID"
+#define MCF_UT_FWK_GENERAL_TLVOTA_FILE_PREFIX       "MTK_UTFWK_GENERAL_OPOTA"
+
+ 
+/*------------------------------------------------------------------------------
+ * Private Helper macros.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Global variables.
+ *----------------------------------------------------------------------------*/
+extern nvram_mcf_lid_info_struct mcf_last_mod_lid_g;
+extern nvram_mcf_lid_info_struct mcf_curr_mod_lid_g;
+kal_bool   execute_ota = KAL_FALSE;
+kal_bool   execute_op_ota = KAL_FALSE;
+kal_bool   execute_gen_op_ota = KAL_FALSE;
+mcf_utfwk_common_t    com_buff;
+kal_uint8    mcf_utfwk_dump_buffer[MCF_MAX_DUMP_SIZE + MCF_MAX_RECORD_CNT];
+kal_bool   is_ut_fwk = KAL_FALSE;
+
+
+/*------------------------------------------------------------------------------
+ * Private variables.
+ *----------------------------------------------------------------------------*/
+/* OTA test LID value pattern */
+static const nvram_ef_mcf_test_struct mcf_ut_test_lid_value_pattern = {
+    6, // val_byte_11
+    6, // val_byte_12
+    0x6, // val_bit_byte_11
+    0xf0, // val_bit_byte_12
+    6, // val_short_11
+    6, // val_short_12
+    6, // val_int_1
+    6, // val_float_1
+    6, // val_long_1
+    6.6, // val_double_1
+    "MCF Test 66", // val_buffer_1
+    {6, 6, 0x6, 0xf0, 6, 6, 6, 6, 6, 6.6, "MCF Test 66"}, // val_struct_1
+    6, // val_byte_21
+    6, // val_byte_22
+    0x6, // val_bit_byte_21
+    0xf0, // val_bit_byte_22
+    6, // val_short_21
+    6, // val_short_22
+    6, // val_int_2
+    6, // val_float_2
+    6, // val_long_2
+    6.6, // val_double_2
+    "MCF Test 66", // val_buffer_2
+    {6, 6, 0x6, 0xf0, 6, 6, 6, 6, 6, 6.6, "MCF Test 66"}, // val_struct_2
+    {{6, 6, 0x6, 0x6, 6, 6, 6, 6, 6, 6.6, "MCF"}, // val_struct_3[0]
+     {6, 6, 0x6, 0x6, 6, 6, 6, 6, 6, 6.6, "MCF"}, // val_struct_3[1]
+     {6, 6, 0x6, 0x6, 6, 6, 6, 6, 6, 6.6, "MCF"}, // val_struct_3[2]
+     {6, 6, 0x6, 0x6, 6, 6, 6, 6, 6, 6.6, "MCF"}} // val_struct_3[3]
+};
+kal_uint8 mcf_dump_buffer[MCF_MAX_DUMP_SIZE + MCF_MAX_RECORD_CNT * MCF_DUMP_LID_HEADER_SIZE];
+
+/*------------------------------------------------------------------------------
+ * Private fucntions.
+ *----------------------------------------------------------------------------*/
+extern kal_char* release_verno(void);
+extern kal_char* build_date_time(void);
+extern sim_interface_enum l4c_gemini_get_actual_sim_id(sim_interface_enum simId);
+extern kal_bool mcf_set_file_path(l4c_mcf_set_config_req_struct *req);
+extern kal_bool mcf_get_applied_file_path(l4c_mcf_get_config_req_struct *req, l4c_mcf_get_config_cnf_struct *resp);
+extern kal_bool mcf_em_update_req_hdlr(local_para_struct *local_para_ptr);
+extern chmod(const char *_Filename,int _Mode);
+extern mcf_dump_param_struct mcf_dump_param_tbl[];
+extern kal_uint32 mcf_dump_param_tbl_num;
+extern sim_interface_enum l4c_gemini_get_switched_sim_id(sim_interface_enum simId);
+
+#if !defined(__MTK_TARGET__)
+kal_bool mcf_utfwk_open_test_data(kal_char *filename, kal_char *data_buff, kal_uint32 size, kal_char *relative_path_name)
+{
+    kal_char    test_data_path[512];
+    FILE       *file;
+    kal_char    short_filename[512];
+    kal_char   *pos; 
+    
+    kal_sprintf(test_data_path, "%s%c", filename, '\0');
+    file = fopen(test_data_path, "rb");
+    
+    pos = strstr(test_data_path, "mcu");
+    kal_sprintf(short_filename, "%s%c", pos + strlen("mcu"), '\0');
+
+    if(file != NULL)
+    {
+        kal_mem_set(data_buff, 0, size);
+        fread(data_buff, size, 1, file);
+        fclose(file);
+        if (strlen(short_filename) < MCF_FILE_MAX_NAME_LEN){
+            strncpy(relative_path_name, short_filename, strlen(short_filename));
+        }
+    } else {
+        return KAL_FALSE;
+    }
+
+    return KAL_TRUE;
+}
+
+
+#endif
+
+kal_bool mcf_utfwk_spilt_tag(kal_char *tag, kal_uint32 *sbp_id, kal_uint8 *mcc, kal_uint8 *mnc)
+{
+    kal_char *saveptr = NULL, *substr = NULL;
+    kal_bool  ret = KAL_TRUE;
+    
+    substr = kal_strtok_r(tag, "_", &saveptr);
+    
+    if (strcmp(substr,"") == 0){
+        ret = KAL_FALSE;
+        MD_TRC_MCF_TR_UTFWK_SPILT_TAG_UNKNOWN_SBP_ID();
+        mcf_utfwk_printf("Unknown sbp_id \r\n");
+        return ret;
+    }else if (strcmp(substr,"NA") == 0){
+        *sbp_id = SBP_ID_INVALID;
+    }else{
+        *sbp_id = mcf_atoi(substr);
+    }
+    substr = kal_strtok_r(NULL, "_",&saveptr);
+    strncpy(mcc, substr, MAX_MCC_STR_LEN);
+    substr = kal_strtok_r(NULL, "_",&saveptr);
+    strncpy(mnc, substr, MAX_MNC_STR_LEN);
+
+    return ret;
+}
+
+kal_bool mcf_utfwk_check_tag_match(
+    mcf_tool_gid_tlvota_file_item_t *pItem,
+    mcf_tlvota_tag_t *tag_entry,
+    kal_uint32 tag_num,
+    kal_uint32 *match_idx)
+{
+    kal_uint32  tag_cnt = 0;
+
+    ASSERT(pItem);
+    ASSERT(tag_entry);
+    ASSERT(tag_num >= 0);
+
+    while(tag_cnt < tag_num) {
+        if ( (pItem->tag_type == tag_entry[tag_cnt].tag_type) && (strncmp(&(pItem->buff_start), tag_entry[tag_cnt].tag, pItem->tag_len) == 0) ) {
+            *match_idx = tag_cnt;
+
+            return KAL_TRUE;
+        }
+
+        tag_cnt++;
+    }
+
+    return KAL_FALSE;
+}
+
+kal_bool mcf_utfwk_check_tag_entry(mcf_tlvota_sbp_tag_t sbp_tag, mcf_tool_gid_tlvota_file_item_t *pItem)
+{
+    mcf_tlvota_tag_t    tag_entry[4];
+    kal_uint32          tag_num = 0;
+    kal_char            tag[4][MCF_MAX_TAG_LEN];
+    kal_uint32          match_idx;
+    kal_bool            ret;
+    
+    if(!pItem ){
+        mcf_utfwk_printf("Invalid parameters!! pItem(%x)\r\n", pItem);
+        MD_TRC_MCF_TR_UTFWK_CHECK_TAG_ENTRY_INVALID_PARA(pItem);
+        ASSERT(0);
+    }
+    
+    /* Fill tag entry */
+    if (sbp_tag.sbp_id != SBP_ID_INVALID) {
+        if (strcmp((kal_char *)sbp_tag.mcc, "") != 0) {
+            if (strcmp((kal_char *)sbp_tag.mnc, "") != 0) { // sbpid_mcc_mnc case
+                /* NA_mcc_NA and NA_mcc_mnc case should be updated first */
+                /* NA_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* NA_mcc_mnc */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_%s", (kal_char *)sbp_tag.mcc, (kal_char *)sbp_tag.mnc);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                if(mcf_utfwk_check_tag_match(pItem, tag_entry, tag_num, &match_idx) == KAL_TRUE){
+                    com_buff.is_general = KAL_TRUE;
+                    ret = KAL_TRUE;
+                    return ret;
+                }
+
+                /* Reuse tag_entry */
+                tag_num = 0;
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* sbpid_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_NA_NA", sbp_tag.sbp_id);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* sbpid_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_%s_NA", sbp_tag.sbp_id, sbp_tag.mcc);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* sbpid_mcc_mnc */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_%s_%s", sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            } else { // sbpid_mcc_NA case
+                /* NA_mcc_NA case should be updated first */
+                /* NA_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                if(mcf_utfwk_check_tag_match(pItem, tag_entry, tag_num, &match_idx) == KAL_TRUE){
+                    com_buff.is_general = KAL_TRUE;
+                    ret = KAL_TRUE;
+                    return ret;
+                }
+
+                /* Reuse tag_entry */
+                tag_num = 0;
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* sbpid_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_NA_NA", sbp_tag.sbp_id);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* sbpid_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_%s_NA", sbp_tag.sbp_id, sbp_tag.mcc);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            }
+        } else {
+            if (strcmp((kal_char *)sbp_tag.mnc, "") == 0) { // sbpid_NA_NA case
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* sbpid_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "%d_NA_NA", sbp_tag.sbp_id);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            } else { // sbpid_NA_mnc case is not allowed!!
+                MD_TRC_MCF_TR_UTFWK_CHECK_TAG_ENTRY_INVALID_SBP_TAG(sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                mcf_utfwk_printf("Invalid SBP tag!! sbp_id(%d), mcc(%s), mnc(%d)\r\n", sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+                ret = KAL_FALSE;
+
+                return ret;
+            }
+        }
+    } else {
+        if (strcmp((kal_char *)sbp_tag.mcc, "") != 0) {
+            if (strcmp((kal_char *)sbp_tag.mnc, "") != 0) { // NA_mcc_mnc case
+                /* NA_mcc_NA and NA_mcc_mnc case should be updated first */
+                /* NA_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                /* NA_mcc_mnc */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_%s", (kal_char *)sbp_tag.mcc, (kal_char *)sbp_tag.mnc);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                if(mcf_utfwk_check_tag_match(pItem, tag_entry, tag_num, &match_idx) == KAL_TRUE){
+                    com_buff.is_general = KAL_TRUE;
+                    ret = KAL_TRUE;
+                    return ret;
+                }
+
+                /* Reuse tag_entry */
+                tag_num = 0;
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            } else { // NA_mcc_NA case
+                /* NA_mcc_NA and NA_mcc_mnc case should be updated first */
+                /* NA_mcc_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_%s_NA", (kal_char *)sbp_tag.mcc);
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+
+                if(mcf_utfwk_check_tag_match(pItem, tag_entry, tag_num, &match_idx) == KAL_TRUE){
+                    com_buff.is_general = KAL_TRUE;
+                    ret = KAL_TRUE;
+                    return ret;
+                }
+
+                /* Reuse tag_entry */
+                tag_num = 0;
+                /* NA_NA_NA */
+                tag_entry[tag_num].tag_type = MCF_TLVOTA_TAG_SBPID;
+                kal_snprintf(tag[tag_num], MCF_MAX_TAG_LEN, "NA_NA_NA");
+                tag_entry[tag_num].tag_len = strlen(tag[tag_num]);
+                tag_entry[tag_num].tag = tag[tag_num];
+                tag_num++;
+            }
+        } else { // NA_NA_mnc cases is not allowed!!
+            MD_TRC_MCF_TR_UTFWK_CHECK_TAG_ENTRY_INVALID_SBP_TAG(sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+            mcf_utfwk_printf("Invalid SBP tag!! sbp_id(%d), mcc(%s), mnc(%d)\r\n", sbp_tag.sbp_id, sbp_tag.mcc, sbp_tag.mnc);
+            ret = KAL_FALSE;
+
+            return ret;
+        }
+    }
+    ret = mcf_utfwk_check_tag_match(pItem, tag_entry, tag_num, &match_idx);
+    com_buff.is_general = KAL_FALSE;
+    return ret;
+                
+}
+
+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)
+{
+    nvram_ltable_entry_struct           lid_info = {0};
+    kal_char                            sw_version[MCF_SW_VERNO_LEN] = {0};
+    kal_char                            gen_time[MCF_FILE_MAX_GEN_TIME_LEN] = {0};
+    time_t                              time_sec;
+    struct                              tm tm;
+    kal_char                            file_buffer[MCF_SW_VERNO_LEN+MCF_FILE_MAX_GEN_TIME_LEN] = {0};
+    kal_uint16                          dump_byte_offset = 0;
+    kal_uint16                          dump_bit_offset = 0;
+    kal_uint32                          item_size = 0;
+    kal_bool                            item_is_bit = KAL_FALSE;
+    kal_uint16                          item_lid = 0;
+    kal_bool                            ret = KAL_TRUE;
+    mcf_tool_file_info_t                pFile;
+    mcf_tool_gid_ota_file_item_t        pItem;
+    mcf_tool_gid_tlvota_file_item_t     pItem_op;
+    kal_char                            tag[MCF_MAX_TAG_LEN];
+    kal_uint8                           sbp_len = 0;
+    kal_uint8                           array_index[256];
+    kal_uint32                          len = 0;
+    kal_uint32                          item_num = 0;
+    kal_uint32                          align_len = 0;
+    kal_uint16                          item_cnt = 0;
+    kal_uint16                          offset = 0;
+    kal_uint32                          check_sum = 0;
+    kal_char                            password[MCF_MAX_PASSWORD_LEN] = {0};
+    mcf_utfwk_config_variable_info_struct  var_info;
+    kal_bool                            is_found_lid = KAL_FALSE;
+    kal_uint32                          i = 0;
+
+    
+    mcf_utfwk_printf("Start! OTA type(%d)\r\n", ota_input.ota_type);
+    MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_START(ota_input.ota_type);
+    
+
+    kal_mem_set(sw_version, 0, sizeof(kal_char) * MCF_SW_VERNO_LEN);
+    kal_mem_set(gen_time, 0, sizeof(kal_char) * MCF_FILE_MAX_GEN_TIME_LEN);
+    kal_mem_set(file_buffer, 0, sizeof(kal_char) * (MCF_SW_VERNO_LEN+MCF_FILE_MAX_GEN_TIME_LEN));
+    kal_mem_set(array_index, 0, sizeof(kal_uint8) *256);
+    kal_mem_set(&var_info, 0, sizeof(mcf_utfwk_config_variable_info_struct));
+    var_info = ota_input.input_mode.var_info;
+    
+    item_cnt = 0;
+
+    switch (ota_input.ota_type)
+    {
+        case MCF_UTFWK_ATTR_OTA:
+            kal_mem_set(&pFile, 0, sizeof(mcf_tool_file_info_t));
+            mcf_utfwk_printf("Start to generate OTA file. number of variable(%d), operation_mask(%d) \r\n", var_info.var_cnt, var_info.operation_mask);
+            MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_GEN_OTA_START(var_info.var_cnt, var_info.operation_mask);
+            time(&time_sec);      
+            pFile.file_version = 3;
+            strcpy(pFile.file_type, MCF_FILE_TYPE_OTA);
+            pFile.operation_mask = var_info.operation_mask;
+            
+            pFile.item_num = var_info.var_cnt;
+
+            strncpy(sw_version, release_verno(), MCF_SW_VERNO_LEN-1);
+            pFile.sw_version_len = strlen(sw_version);
+            
+            tm = *localtime(&time_sec);
+
+            sprintf(gen_time,"%04d.%02d.%02d.%02d%02d%02d\0", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+            
+            pFile.gen_time_len = strlen(gen_time);
+            
+            strncpy(file_buffer, sw_version, pFile.sw_version_len);
+            strncpy(file_buffer+pFile.sw_version_len, gen_time, pFile.gen_time_len);
+            
+            strncpy(&(pFile.buff_start), file_buffer, 1);
+            
+            
+            pFile.total_len = 43 + pFile.sw_version_len + pFile.gen_time_len;
+            pFile.file_size = pFile.total_len;
+            
+            kal_mem_cpy(buff, &pFile, pFile.total_len);
+            strncpy(buff+40, file_buffer, pFile.sw_version_len+pFile.gen_time_len);
+            
+            offset = pFile.total_len;
+            
+            while (item_cnt < var_info.var_cnt) {
+                dump_byte_offset = 0;
+                dump_bit_offset = 0;
+                item_size = 0;
+                item_lid = 0;
+                align_len = 0;
+                kal_mem_set(&pItem, 0, sizeof(mcf_tool_gid_ota_file_item_t));
+                mcf_toupper((char *)var_info.var[item_cnt].array_index);
+                kal_mem_set(array_index, 0, sizeof(kal_uint8) *256);
+                kal_mem_cpy(array_index, var_info.var[item_cnt].array_index, strlen(var_info.var[item_cnt].array_index));
+
+                pItem.global_id = var_info.var[item_cnt].gid;
+                pItem.record_idx = var_info.var[item_cnt].rec_id;
+                pItem.array_index_len = strlen(array_index);
+
+                /* Find GID corresponding LID */
+                item_lid = mcf_find_gid_return_lid_num(pItem.global_id);
+                if (item_lid == 65535){
+                    //-1(65535) means not found
+                    mcf_utfwk_printf("Can not find this gid(%d)\r\n", pItem.global_id);
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+                                
+                is_found_lid = KAL_FALSE;
+                for(i = 0; i < ota_input.lid_cnt; i++){
+                    if (item_lid == ota_input.lid[i]){
+                        is_found_lid = KAL_TRUE;
+                    }
+                }
+                if (is_found_lid == KAL_FALSE){
+                    mcf_utfwk_printf("LID(%d) of variable is not match given LID\r\n", item_lid);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_OTA_LID_INVALID(item_lid);
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+                
+                if(mcf_find_gid_offset(pItem.global_id, array_index, &item_lid, &dump_byte_offset, &dump_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                    kal_mem_set(array_index, 0, sizeof(kal_uint8) *256);
+                    kal_mem_cpy(array_index, var_info.var[item_cnt].array_index, strlen(var_info.var[item_cnt].array_index));
+                    mcf_utfwk_printf("Can not find this gid(%d), array_index(%s) \r\n", pItem.global_id, array_index);
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+                
+                if (item_is_bit == 0){
+                    if(var_info.var[item_cnt].value_len > item_size){
+                        mcf_utfwk_printf("Invalid value length! value_len(%d), variable_size(%d) \r\n", var_info.var[item_cnt].value_len, item_size);
+                        MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_INVALID_VAL_LEN(var_info.var[item_cnt].value_len, item_size);
+                        ret = KAL_FALSE;
+                        return ret;
+                    }
+                }else{
+                    if(var_info.var[item_cnt].value_len > 4){
+                        mcf_utfwk_printf("Invalid bit_len(%d)!! current bit_value_len(%d) \r\n", var_info.var[item_cnt].value_len, item_size);
+                        MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_INVALID_BIT_LEN(var_info.var[item_cnt].value_len, item_size);
+                        ret = KAL_FALSE;
+                        return ret;
+                    }
+                }
+                
+                pItem.total_len = 16;
+                
+                pItem.value_len = var_info.var[item_cnt].value_len;
+                pItem.total_len += pItem.value_len;
+                
+                if (item_cnt == var_info.var_cnt -1){
+                    if (pFile.file_size % 4 != 0){
+                        align_len = (4-(pFile.file_size % 4));
+                        pItem.total_len += align_len;
+                    }
+                }
+                
+                pItem.total_len += pItem.array_index_len;
+
+                if (pItem.array_index_len > 0){
+                    strncpy(&(pItem.buff_start), var_info.var[item_cnt].array_index, 1);
+                }else{
+                    strncpy(&(pItem.buff_start), var_info.var[item_cnt].value, 1);
+                }
+                pFile.file_size += pItem.total_len;
+                
+                if(pFile.file_size > MCF_MAX_OTA_FILE_SIZE){
+                    mcf_utfwk_printf("file size(%d) is larger than allocated buffer size(%d)!! \r\n", pFile.file_size, MCF_MAX_OTA_FILE_SIZE);
+                    MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_FILE_OVERSIZE(pFile.file_size, MCF_MAX_OTA_FILE_SIZE);
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+                
+                
+                kal_mem_cpy(buff+offset, &pItem, pItem.total_len);
+                strncpy(buff+offset+16, var_info.var[item_cnt].array_index, strlen(var_info.var[item_cnt].array_index));
+                kal_mem_cpy(buff+offset+16+strlen(var_info.var[item_cnt].array_index), var_info.var[item_cnt].value, var_info.var[item_cnt].value_len);
+                kal_mem_set(buff+offset+16+strlen(var_info.var[item_cnt].array_index)+var_info.var[item_cnt].value_len, 0, align_len);
+                
+                offset += pItem.total_len;
+                item_cnt++;
+                
+            }
+            
+            kal_mem_cpy(buff+20, &(pFile.file_size), 4);
+            *buff_size = pFile.file_size;
+            
+            if((var_info.operation_mask & MCF_FILE_OP_AES_128) != 0){
+                if ((pFile.file_size - pFile.total_len) % 16 != 0){
+                    align_len = (16-((pFile.file_size - pFile.total_len) % 16));
+                    kal_mem_set(buff+pFile.file_size, 0, align_len);
+                    pFile.file_size += align_len;
+                    kal_mem_cpy(buff+20, &(pFile.file_size), 4);
+                    *buff_size = pFile.file_size;
+                }
+            }
+            
+            if((var_info.operation_mask & MCF_FILE_OP_CHECKSUM) != 0){
+                check_sum = mcf_calc_check_sum((kal_uint32 *)buff, pFile.file_size);
+                pFile.checksum = check_sum;
+                kal_mem_cpy(buff+36, &(pFile.checksum), 4);
+            }
+                
+            if((var_info.operation_mask & MCF_FILE_OP_AES_128) != 0){
+                mcf_get_custom_aes_password(password);
+                if (mcf_encrypt_128bit(password, (kal_char *)(buff + pFile.total_len), (pFile.file_size - pFile.total_len) ) != KAL_TRUE) {
+                    mcf_utfwk_printf("OTA file encryption FAIL!!\r\n");
+                    MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_ENCRYPTION_FAIL();
+                    return KAL_FALSE;
+                }
+            }
+            
+            break;
+
+        case MCF_UTFWK_ATTR_OTA_BY_OP:
+            mcf_utfwk_printf("Start to generate OP-OTA file. number of variable(%d), operation_mask(%d), tag type(%d) \r\n", var_info.var_cnt, var_info.operation_mask, var_info.tag_type);
+            MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_GEN_TLVOTA_START(var_info.var_cnt, var_info.operation_mask, var_info.tag_type);
+            
+            if(var_info.tag_type == 0){
+                mcf_utfwk_printf("Invalid tag type(%d) \r\n", var_info.tag_type);
+                MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_GEN_TLVOTA_INVALID_TAG_TYPE(var_info.tag_type);
+                var_info.tag_type = 1;
+            }
+            
+            kal_mem_set(&pFile, 0, sizeof(mcf_tool_file_info_t));
+            *is_general = KAL_FALSE;
+            
+            time(&time_sec);      
+            pFile.file_version = 3;
+            strcpy(pFile.file_type, MCF_FILE_TYPE_TLVOTA);
+            pFile.operation_mask = 0;
+            
+            pFile.item_num = var_info.var_cnt;
+
+            strncpy(sw_version, release_verno(), MCF_SW_VERNO_LEN-1);
+            pFile.sw_version_len = strlen(sw_version);
+            
+            tm = *localtime(&time_sec);
+
+            sprintf(gen_time,"%04d.%02d.%02d.%02d%02d%02d\0", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+            
+            pFile.gen_time_len = strlen(gen_time);
+            
+            strncpy(file_buffer, sw_version, pFile.sw_version_len);
+            strncpy(file_buffer+pFile.sw_version_len, gen_time, pFile.gen_time_len);
+            
+            strncpy(&(pFile.buff_start), file_buffer, 1);
+            
+            
+            pFile.total_len = 43 + pFile.sw_version_len + pFile.gen_time_len;
+            pFile.file_size = pFile.total_len;
+            
+            kal_mem_cpy(buff, &pFile, pFile.total_len);
+            strncpy(buff+40, file_buffer, pFile.sw_version_len+pFile.gen_time_len);
+            
+            offset = pFile.total_len;
+            item_cnt = 0;
+            
+            while (item_cnt < var_info.var_cnt) {
+                dump_byte_offset = 0;
+                dump_bit_offset = 0;
+                item_size = 0;
+                item_lid = 0;
+                align_len = 0;
+                kal_mem_set(&pItem_op, 0, sizeof(mcf_tool_gid_tlvota_file_item_t));
+                mcf_toupper((char *)var_info.var[item_cnt].array_index);
+                kal_mem_set(array_index, 0, sizeof(kal_uint8) *256);
+                kal_mem_cpy(array_index, var_info.var[item_cnt].array_index, strlen(var_info.var[item_cnt].array_index));
+                
+                pItem_op.global_id = var_info.var[item_cnt].gid;
+                pItem_op.array_index_len = strlen(array_index);
+                pItem_op.tag_type = var_info.tag_type;
+
+                if(var_info.tag_type == 2){
+                    pItem_op.tag_len = strlen(ota_input.iccid);
+                    strncpy(tag, ota_input.iccid, 21);
+                    *is_general = KAL_TRUE;
+                }else if (ota_input.sbp_id == SBP_ID_INVALID || ota_input.sbp_id == 0){
+                    *is_general = KAL_TRUE;
+                }
+                   
+                /* Find GID corresponding LID */
+                item_lid = mcf_find_gid_return_lid_num(pItem_op.global_id);
+                if (item_lid == 65535){
+                    //-1(65535) means not found
+                    mcf_utfwk_printf("Can not find this gid(%d)\r\n", pItem_op.global_id);
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+                
+                is_found_lid = KAL_FALSE;
+                for(i = 0; i < ota_input.lid_cnt; i++){
+                    if (item_lid == ota_input.lid[i]){
+                        is_found_lid = KAL_TRUE;
+                    }
+                    MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_TAKE_TLV_OTA_READ_LOCK_FAIL();
+                }
+                if (is_found_lid == KAL_FALSE){
+                    mcf_utfwk_printf("LID(%d) of variable is not match given LID\r\n", item_lid);
+                    MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_INVALID_LID(item_lid);
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+                
+                if(mcf_find_gid_offset(pItem_op.global_id, array_index, &item_lid, &dump_byte_offset, &dump_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                    kal_mem_set(array_index, 0, sizeof(kal_uint8) *256);
+                    kal_mem_cpy(array_index, var_info.var[item_cnt].array_index, strlen(var_info.var[item_cnt].array_index));
+                    mcf_utfwk_printf("Can not find this gid(%d), array_index(%s) \r\n", pItem_op.global_id, array_index);
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+                
+                if (item_is_bit == 0){
+                    if(var_info.var[item_cnt].value_len > item_size){
+                        mcf_utfwk_printf("Invalid value length! value_len(%d), variable_size(%d) \r\n", var_info.var[item_cnt].value_len, item_size);
+                        MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_INVALID_VAL_LEN(var_info.var[item_cnt].value_len, item_size);
+                        ret = KAL_FALSE;
+                        return ret;
+                    }
+                }else{
+                    if(var_info.var[item_cnt].value_len > 4){
+                        mcf_utfwk_printf("Invalid bit_len(%d)!! current bit_value_len(%d) \r\n", var_info.var[item_cnt].value_len, item_size);
+                        MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_INVALID_BIT_LEN(var_info.var[item_cnt].value_len, item_size);
+                        ret = KAL_FALSE;
+                        return ret;
+                    }
+                }
+                
+                pItem_op.total_len = 16;
+                
+                pItem_op.value_len = var_info.var[item_cnt].value_len;
+                pItem_op.total_len += pItem_op.value_len;
+                pItem_op.total_len += pItem_op.array_index_len;
+                
+                if (pItem_op.tag_type == 1){
+                    if (ota_input.sbp_id != SBP_ID_INVALID) {
+                        if (strcmp((kal_char *)ota_input.mcc, "") != 0) {
+                            if (strcmp((kal_char *)ota_input.mnc, "") != 0){
+                                kal_snprintf(tag, MCF_MAX_TAG_LEN, "%d_%s_%s%c", ota_input.sbp_id, (kal_char *)ota_input.mcc, (kal_char *)ota_input.mnc, '\0');
+                            }else{
+                                kal_snprintf(tag, MCF_MAX_TAG_LEN, "%d_%s_NA%c", ota_input.sbp_id, (kal_char *)ota_input.mcc, '\0');
+                            }
+                        }else{
+                            if (strcmp((kal_char *)ota_input.mnc, "") != 0){
+                                kal_snprintf(tag, MCF_MAX_TAG_LEN, "%d_NA_%s%c", ota_input.sbp_id, (kal_char *)ota_input.mnc, '\0');
+                            }else{
+                                kal_snprintf(tag, MCF_MAX_TAG_LEN, "%d_NA_NA%c", ota_input.sbp_id, '\0');
+                            }
+                        }
+                    }else{
+                        if (strcmp((kal_char *)ota_input.mcc, "") != 0) {
+                            if (strcmp((kal_char *)ota_input.mnc, "") != 0){
+                                kal_snprintf(tag, MCF_MAX_TAG_LEN, "NA_%s_%s%c", (kal_char *)ota_input.mcc, (kal_char *)ota_input.mnc, '\0');
+                            }else{
+                                kal_snprintf(tag, MCF_MAX_TAG_LEN, "NA_%s_NA%c", (kal_char *)ota_input.mcc, '\0');
+                            }
+                        }else{
+                            if (strcmp((kal_char *)ota_input.mnc, "") != 0){
+                                kal_snprintf(tag, MCF_MAX_TAG_LEN, "NA_NA_%s%c", (kal_char *)ota_input.mnc, '\0');
+                            }else{
+                                *is_general = KAL_FALSE;
+                                kal_snprintf(tag, MCF_MAX_TAG_LEN, "NA_NA_NA%c", '\0');
+                            }
+                        }
+                    }
+                    
+                    pItem_op.tag_len = strlen(tag);
+                }else if (pItem_op.tag_type == 2){
+                    *is_general = KAL_TRUE;
+                    if (strcmp(ota_input.iccid,"") != 0){
+                        kal_snprintf(tag, MCF_MAX_TAG_LEN, "%s%c", ota_input.iccid, '\0');
+                    }
+                    
+                    pItem_op.tag_len = strlen(tag);
+                }
+                
+                pItem_op.total_len += pItem_op.tag_len;
+                
+                strncpy(&(pItem_op.buff_start), tag, 1);
+                
+                if (item_cnt == var_info.var_cnt -1){
+                    if (pFile.file_size % 4 != 0){
+                        align_len = (4-(pFile.file_size % 4));
+                        pItem_op.total_len += align_len;
+                    }
+                }
+                
+                pFile.file_size += pItem_op.total_len;
+                
+                if(pFile.file_size > MCF_MAX_TLVOTA_FILE_SIZE){
+                    mcf_utfwk_printf("file size(%d) is larger than allocated buffer size(%d)!! \r\n", pFile.file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+                    MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_FILE_OVERSIZE(pFile.file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+                
+                kal_mem_cpy(buff+offset, &pItem_op, pItem_op.total_len);
+                strncpy(buff+offset+16, tag, strlen(tag));
+                strncpy(buff+offset+16+strlen(tag), var_info.var[item_cnt].array_index, strlen(var_info.var[item_cnt].array_index));
+                kal_mem_cpy(buff+offset+16+strlen(tag)+strlen(var_info.var[item_cnt].array_index), var_info.var[item_cnt].value, var_info.var[item_cnt].value_len);
+                kal_mem_set(buff+offset+16+strlen(tag)+strlen(var_info.var[item_cnt].array_index)+var_info.var[item_cnt].value_len, 0, align_len);
+                
+                offset += pItem_op.total_len;
+                item_cnt++;
+                
+            }
+            
+            kal_mem_cpy(buff+20, &(pFile.file_size), 4);
+            *buff_size = pFile.file_size;
+            
+            if((var_info.operation_mask & MCF_FILE_OP_AES_128) != 0){
+                if ((pFile.file_size - pFile.total_len) % 16 != 0){
+                    align_len = (16-((pFile.file_size - pFile.total_len) % 16));
+                    kal_mem_set(buff+pFile.file_size, 0, align_len);
+                    pFile.file_size += align_len;
+                    kal_mem_cpy(buff+20, &(pFile.file_size), 4);
+                    *buff_size = pFile.file_size;
+                }
+            }
+            
+            if(var_info.operation_mask & MCF_FILE_OP_CHECKSUM != 0){
+                check_sum = mcf_calc_check_sum((kal_uint32 *)buff, pFile.file_size);
+                pFile.checksum = check_sum;
+                kal_mem_cpy(buff+36, &(pFile.checksum), 4);
+            }
+            
+            if(var_info.operation_mask & MCF_FILE_OP_AES_128 != 0){
+                mcf_get_custom_aes_password(password);
+                if (mcf_encrypt_128bit(password, (kal_char *)(buff + pFile.total_len), (pFile.file_size - pFile.total_len) ) != KAL_TRUE) {
+                    mcf_utfwk_printf("OTA file encryption FAIL!!\r\n");
+                    MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_ENCRYPTION_FAIL();
+                    return KAL_FALSE;
+                }
+            }
+            
+
+            break;
+            
+        default:
+            MD_TRC_MCF_TR_UTFWK_GENERATE_OTA_FILE_UNKNOWN_OTA_TYPE(ota_input.ota_type);
+            mcf_utfwk_printf("Unknown ota type(%d) \r\n", ota_input.ota_type);
+            break;
+    }
+    
+    
+    return ret;
+}
+
+kal_bool mcf_utfwk_is_working_status()
+{
+    return is_ut_fwk;
+}
+kal_bool mcf_utfwk_initial_env(mcf_utfwk_ota_input_struct ota_input)
+{
+    mcf_t                           *pMcf = mcf_get_instance();
+    mcf_ota_file_t                  *ota_file = &(pMcf->ota_file);
+    mcf_tlvota_file_t               *tlvota_file;
+    kal_uint8                       *lid_buffer;
+    kal_uint32                       i;
+    mcf_tool_file_info_t            *pFile;
+    mcf_tool_gid_ota_file_item_t    *pItem;
+    mcf_tool_gid_tlvota_file_item_t *pItem_op;
+    kal_char                         tag[MCF_MAX_TAG_LEN];
+    kal_uint32                       sbp_id;
+    kal_uint8                        mcc[MAX_MCC_STR_LEN];
+    kal_uint8                        mnc[MAX_MNC_STR_LEN];
+    kal_uint8                        iccid[21];
+    kal_uint32                       item_cnt = 0;
+    nvram_errno_enum                 nvram_api_ret;
+    nvram_ltable_entry_struct        lid_info = {0};
+    kal_char                         password[MCF_MAX_PASSWORD_LEN] = {0};
+    mcf_tlvota_sbp_tag_t             sbp_tag;
+    kal_uint16                       item_byte_offset;
+    kal_uint16                       item_bit_offset;
+    kal_uint32                       item_size;
+    kal_char                         array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_bool                         item_is_bit = KAL_FALSE;
+    kal_uint16                       item_lid;
+    kal_bool                         is_found_lid = KAL_FALSE;
+    kal_uint16                       buff_size = 0;
+
+    mcf_utfwk_printf("Start! OTA type(%d), Operation(%d), SIM(%d)\r\n", ota_input.ota_type, ota_input.input_op, ota_input.sim_id);
+    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_START(ota_input.ota_type, ota_input.input_op, ota_input.sim_id);
+    kal_take_enh_mutex(mcf_utfwk_enhmutex_g); 
+
+    if (execute_ota == KAL_FALSE && execute_op_ota == KAL_FALSE && execute_gen_op_ota == KAL_FALSE){
+        kal_mem_set(pMcf, 0, sizeof(mcf_t));
+
+        /* Object init */
+        MCF_INIT_OBJECT_BEGIN(ota_file, mcf_enhmutex_g);
+        MCF_INIT_OBJECT_END(ota_file, mcf_enhmutex_g);
+
+        for (i = 0; i < MAX_SIM_NUM; i++) {
+            tlvota_file = &(pMcf->tlvota_file[i]);
+            MCF_INIT_OBJECT_BEGIN(tlvota_file, mcf_enhmutex_g);
+            MCF_INIT_OBJECT_END(tlvota_file, mcf_enhmutex_g);
+        }
+
+        tlvota_file = &(pMcf->general_tlvota_file);
+        MCF_INIT_OBJECT_BEGIN(tlvota_file, mcf_enhmutex_g);
+        MCF_INIT_OBJECT_END(tlvota_file, mcf_enhmutex_g);
+        
+        
+        kal_mem_set(&com_buff, 0, sizeof(mcf_utfwk_common_t));
+        com_buff.initial_ret = KAL_TRUE;
+        com_buff.ota_input = ota_input;
+        
+        /* UT FWK is working, need to use fread to read file */
+        is_ut_fwk = KAL_TRUE;
+        
+        /* Reset NVRAM_EF_MCF_OTA_FILE_LID */
+        lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_ota_file_info_struct));
+        kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_ota_file_info_struct));
+        for(i = 0; i < NVRAM_EF_MCF_OTA_FILE_TOTAL; i++) {
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_OTA_FILE_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_ota_file_info_struct)) ) {
+                mcf_utfwk_printf("Fail to reset NVRAM_EF_MCF_OTA_FILE_LID!!\r\n");
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_RESET_OTA_FILE_LID_FAIL();
+                com_buff.initial_ret = KAL_FALSE;
+                free_ctrl_buffer_set_null(lid_buffer);
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                return com_buff.initial_ret;
+            }
+        }
+        free_ctrl_buffer_set_null(lid_buffer);
+
+        /* Reset NVRAM_EF_MCF_TLVOTA_FILE_LID */
+        lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+        kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_tlvota_file_info_struct));
+        for(i = 0; i < NVRAM_EF_MCF_TLVOTA_FILE_TOTAL; i++) {
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_TLVOTA_FILE_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_tlvota_file_info_struct)) ) {
+                mcf_utfwk_printf("Fail to reset NVRAM_EF_MCF_TLVOTA_FILE_LID!!\r\n");
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_RESET_TLVOTA_FILE_LID_FAIL();
+                com_buff.initial_ret = KAL_FALSE;
+                free_ctrl_buffer_set_null(lid_buffer);
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                return com_buff.initial_ret;
+            }
+        }
+        free_ctrl_buffer_set_null(lid_buffer);
+
+        /* Reset NVRAM_EF_MCF_TEST_OTA_LID */
+        lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+        kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+        for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_TOTAL; i++) {
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+                mcf_utfwk_printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_LID!!\r\n");
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_RESET_TEST_OTA_LID_FAIL();
+                com_buff.initial_ret = KAL_FALSE;
+                free_ctrl_buffer_set_null(lid_buffer);
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                return com_buff.initial_ret;
+            }
+        }
+        free_ctrl_buffer_set_null(lid_buffer);
+
+        /* Reset NVRAM_EF_MCF_TEST_OTA_QUERY_LID */
+        lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_test_struct));
+        kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_test_struct));
+        for(i = 0; i < NVRAM_EF_MCF_TEST_OTA_QUERY_TOTAL; i++) {
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_test_struct)) ) {
+                mcf_utfwk_printf("Fail to reset NVRAM_EF_MCF_TEST_OTA_QUERY_LID!!\r\n");
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_RESET_TEST_OTA_QUERY_LID_FAIL();
+                com_buff.initial_ret = KAL_FALSE;
+                free_ctrl_buffer_set_null(lid_buffer);
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                return com_buff.initial_ret;
+            }
+        }
+        free_ctrl_buffer_set_null(lid_buffer);
+
+        /* Reset NVRAM_EF_MCF_SW_INFO_LID */
+        lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_sw_info_struct));
+        kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_sw_info_struct));
+        for(i = 0; i < NVRAM_EF_MCF_SW_INFO_TOTAL; i++) {
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_SW_INFO_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_sw_info_struct)) ) {
+                mcf_utfwk_printf("Fail to reset NVRAM_EF_MCF_SW_INFO_LID!!\r\n");
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_RESET_SW_INFO_LID_FAIL();
+                com_buff.initial_ret = KAL_FALSE;
+                free_ctrl_buffer_set_null(lid_buffer);
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                return com_buff.initial_ret;
+            }
+        }
+        free_ctrl_buffer_set_null(lid_buffer);
+        
+        /* Reset NVRAM_EF_MCF_INTERNAL_INFO_LID */
+        lid_buffer = (kal_uint8 *)get_ctrl_buffer(sizeof(nvram_ef_mcf_internal_info_struct));
+        kal_mem_set(lid_buffer, 0, sizeof(nvram_ef_mcf_internal_info_struct));
+        for(i = 0; i < NVRAM_EF_MCF_INTERNAL_INFO_TOTAL; i++) {
+            if ( !nvram_external_write_data(NVRAM_EF_MCF_INTERNAL_INFO_LID, i+1, lid_buffer, sizeof(nvram_ef_mcf_internal_info_struct)) ) {
+                mcf_utfwk_printf("Fail to reset NVRAM_EF_MCF_INTERNAL_INFO_LID!!\r\n");
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_RESET_INTERNAL_INFO_LID_FAIL();
+                com_buff.initial_ret = KAL_FALSE;
+                free_ctrl_buffer_set_null(lid_buffer);
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                return com_buff.initial_ret;
+            }
+        }
+        free_ctrl_buffer_set_null(lid_buffer);
+        
+        
+        
+        for (i = 0; i < com_buff.ota_input.lid_cnt; i++){
+            kal_mem_set(&lid_info, 0, sizeof(nvram_ltable_entry_struct));
+            nvram_api_ret = nvram_external_get_lid_info(com_buff.ota_input.lid[i], &lid_info);
+            if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+                mcf_utfwk_printf("Fail to get LID information!! LID(%d), nvram_api_ret(%d) \r\n", com_buff.ota_input.lid[i], nvram_api_ret);
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_GET_LID_INFO_FAIL(com_buff.ota_input.lid[i], nvram_api_ret);
+                com_buff.initial_ret = KAL_FALSE;
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                return com_buff.initial_ret;
+            }
+            if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA){
+                if ( (lid_info.attr & NVRAM_ATTR_MCF_OTA) == 0 && (lid_info.attr & NVRAM_ATTR_MCF_OTA_FOR_QUERY) == 0) {
+                    mcf_utfwk_printf("Invalid OTA type!! LID(%d), LID attribute(%x), ota_type(%d) \r\n", com_buff.ota_input.lid[i], lid_info.attr, com_buff.ota_input.ota_type);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_INVALID_OTA_TYPE(com_buff.ota_input.lid[i], lid_info.attr, com_buff.ota_input.ota_type);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+                
+            }else if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA_BY_OP){
+                if (com_buff.ota_input.sim_id >= MAX_SIM_NUM){
+                    mcf_utfwk_printf("Invalid Parameters! SIM(%d)\r\n", com_buff.ota_input.sim_id);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_INVALID_SIM_ID(com_buff.ota_input.sim_id);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+                if ( (lid_info.attr & NVRAM_ATTR_MCF_OTA_BY_OP) == 0 ) {
+                    mcf_utfwk_printf("Invalid OP-OTA type!! LID(%d), LID attribute(%x), ota_type(%d) \r\n", com_buff.ota_input.lid[i], lid_info.attr, com_buff.ota_input.ota_type);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_INVALID_TLVOTA_TYPE(com_buff.ota_input.lid[i], lid_info.attr, com_buff.ota_input.ota_type);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+            }
+            if((lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) {
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_RESET_LID(com_buff.ota_input.lid[i]);
+                if ( !nvram_external_reset_data(com_buff.ota_input.lid[i], 1, lid_info.total_records) ) {
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_RESET_LID_FAIL(com_buff.ota_input.lid[i], lid_info.total_records);
+                    mcf_utfwk_printf("Fail to reset LID!! LID(%d), total_record(%d) \r\n", com_buff.ota_input.lid, lid_info.total_records);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+                
+            }
+        }
+
+    
+        if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA_BY_OP){
+            for (i = 0; i < MAX_SIM_NUM; i++) {
+                tlvota_file = &(pMcf->tlvota_file[i]);
+                tlvota_file->sbp_id = SBP_ID_INVALID;
+            }
+
+            tlvota_file = &(pMcf->tlvota_file[com_buff.ota_input.sim_id]);
+            tlvota_file->sbp_id = com_buff.ota_input.sbp_id;
+            if (com_buff.ota_input.sbp_id == SBP_ID_INVALID || com_buff.ota_input.sbp_id == 0){
+                if (strcmp(com_buff.ota_input.iccid,"") == 0){
+                    mcf_utfwk_printf("Invalid SBP ID! SBP_ID(%d)\r\n", com_buff.ota_input.sbp_id);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_INVALID_SBP_ID(com_buff.ota_input.sbp_id);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+            }
+            strncpy(tlvota_file->mcc, com_buff.ota_input.mcc, MAX_MCC_STR_LEN);
+            strncpy(tlvota_file->mnc, com_buff.ota_input.mnc, MAX_MNC_STR_LEN);
+            strncpy(tlvota_file->iccid, com_buff.ota_input.iccid, 21);
+
+        }
+    }
+    
+    if (com_buff.ota_input.input_op == MCF_UTFWK_OTA_FILE_PATH){
+        if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA){
+            MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+            if (ota_file) {
+                com_buff.initial_ret = mcf_utfwk_open_test_data(com_buff.ota_input.input_mode.file_path_name, (kal_char *)(ota_file->buff), MCF_MAX_OTA_FILE_SIZE, ota_file->relative_path_name);
+                if (com_buff.initial_ret == KAL_FALSE) {
+                    mcf_utfwk_printf("Open OTA test data(%s) FAIL!! \r\n", com_buff.ota_input.input_mode.file_path_name);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_OPEN_OTA_FAIL(com_buff.ota_input.input_mode.file_path_name);
+                    MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    com_buff.initial_ret = KAL_FALSE;
+                    return com_buff.initial_ret;
+                }
+                pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+                pItem = (mcf_tool_gid_ota_file_item_t *)(ota_file->buff + pFile->total_len);
+                if (pFile->file_size > MCF_MAX_OTA_FILE_SIZE) {
+                    mcf_utfwk_printf("file size(%d) is larger than allocated buffer size(%d)!! \r\n", pFile->file_size, MCF_MAX_OTA_FILE_SIZE);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_FILE_OVERSIZE(pFile->file_size, MCF_MAX_OTA_FILE_SIZE);
+                    MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+                if (pFile->file_version == 3) {
+                    /*
+                     *  If file is encrypted and has checksum.
+                     *  Decrypt file before checking checksum.
+                     */
+                    if ( (pFile->operation_mask & MCF_FILE_OP_AES_128) != 0) {
+                        mcf_get_custom_aes_password(password);
+
+                        if (mcf_decrypt_128bit(password, (kal_char *)(ota_file->buff + pFile->total_len), (pFile->file_size - pFile->total_len) ) != KAL_TRUE) {
+                            kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+                            MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                            mcf_utfwk_printf("file(%s) decryption FAIL!! \r\n", com_buff.ota_input.input_mode.file_path_name);
+                            MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_FILE_DECRYPTION_FAIL(com_buff.ota_input.input_mode.file_path_name);
+                            com_buff.initial_ret = KAL_FALSE;
+                            kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                            return com_buff.initial_ret;
+                        }
+                    }
+
+                    if ( (pFile->operation_mask & MCF_FILE_OP_CHECKSUM) != 0) {
+                        if (mcf_check_check_sum((kal_uint32 *)(ota_file->buff), pFile->file_size) != 0) {
+                            kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+                            MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                            mcf_utfwk_printf("file(%s) checksum ERROR!! \r\n", com_buff.ota_input.input_mode.file_path_name);
+                            MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_FILE_CHECKSUM_ERROR(com_buff.ota_input.input_mode.file_path_name);
+                            com_buff.initial_ret = KAL_FALSE;
+                            kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                            return com_buff.initial_ret;
+                        }
+                    }
+                } else {
+                    mcf_utfwk_printf("file version(%d) is INVALID!! \r\n", pFile->file_version);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_FILE_INVALID_FILE_VERSION(pFile->file_version);
+                    kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+                    MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+                item_cnt = 0;
+                while (item_cnt < pFile->item_num) {
+                    if ( (pItem->array_index_len < 0) || (pItem->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+                        MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_TAG_INVALID_ARRAY_INDEX_LEN(pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                        mcf_utfwk_printf("Invalid array_index_len(%d)!! max array_index_len(%d)", pItem->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                        goto next;
+                    }
+                    strncpy(array_tag, &(pItem->buff_start), pItem->array_index_len);
+                    array_tag[pItem->array_index_len] = '\0';
+                    
+                    if(mcf_find_gid_offset(pItem->global_id, array_tag, &item_lid, &item_byte_offset, &item_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                        goto next;
+                    }
+                    is_found_lid = KAL_FALSE;
+                    for(i = 0; i <com_buff.ota_input.lid_cnt; i++){
+                        if (item_lid == com_buff.ota_input.lid[i]){
+                            is_found_lid = KAL_TRUE;
+                        }
+                    }
+                    if (is_found_lid == KAL_FALSE){
+                        mcf_utfwk_printf("LID(%d) in OTA file is not match given LID\r\n", item_lid);
+                        MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_OTA_LID_INVALID(item_lid);
+                        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                        com_buff.initial_ret = KAL_FALSE;
+                        kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                        return com_buff.initial_ret;
+                    }
+                    
+next:
+                    pItem = (mcf_tool_gid_ota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+                    item_cnt++;
+                }
+                execute_ota = KAL_TRUE;
+                MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+            } else {
+                mcf_utfwk_printf("Read OTA test data FAIL!! Fail to take read lock! \r\n");
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_TAKE_OTA_READ_LOCK_FAIL();
+                MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                com_buff.initial_ret = KAL_FALSE;
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                return com_buff.initial_ret;
+            }
+            execute_ota = KAL_TRUE;
+        }else if(com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA_BY_OP){
+            tlvota_file = &(pMcf->tlvota_file[com_buff.ota_input.sim_id]);
+            kal_mem_set(tag, 0, sizeof(kal_char) * MCF_MAX_TAG_LEN);
+            kal_mem_set(iccid, 0, 21);
+            MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (tlvota_file) {
+                com_buff.initial_ret = mcf_utfwk_open_test_data(com_buff.ota_input.input_mode.file_path_name, (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE, tlvota_file->relative_path_name);
+                if (com_buff.initial_ret == KAL_FALSE) {
+                    mcf_utfwk_printf("Open OP-OTA test data(%s) FAIL!! \r\n", com_buff.ota_input.input_mode.file_path_name);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_OPEN_TLVOTA_FAIL(com_buff.ota_input.input_mode.file_path_name);
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+                
+                pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+                pItem_op = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + pFile->total_len);
+
+                if (pFile->file_size > MCF_MAX_TLVOTA_FILE_SIZE) {
+                    mcf_utfwk_printf("file size(%d) is larger than allocated buffer size(%d)!! \r\n", pFile->file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_FILE_OVERSIZE(pFile->file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+                if (pFile->file_version == 3) {
+                    if (pItem_op->tag_type == 1){
+                        strncpy(tag, &(pItem_op->buff_start), pItem_op->tag_len);
+                        com_buff.initial_ret = mcf_utfwk_spilt_tag(tag, &sbp_id, mcc, mnc);
+                        if (sbp_id == SBP_ID_INVALID){
+                            com_buff.is_general = KAL_TRUE;
+                        }
+                        sbp_tag.sbp_id = com_buff.ota_input.sbp_id;
+                        strncpy(sbp_tag.mcc, com_buff.ota_input.mcc, MAX_MCC_STR_LEN);
+                        strncpy(sbp_tag.mnc, com_buff.ota_input.mnc, MAX_MNC_STR_LEN);
+                        
+                        if(mcf_utfwk_check_tag_entry(sbp_tag, pItem_op) != KAL_TRUE){
+                            MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_TAG_IS_NOT_MATCH(com_buff.ota_input.sbp_id, com_buff.ota_input.mcc, com_buff.ota_input.mnc, sbp_id, mcc, mnc);
+                            mcf_utfwk_printf("Tag(%d_%s_%s) in OP-OTA file is not match given tag(%d_%s_%s)\r\n", com_buff.ota_input.sbp_id, com_buff.ota_input.mcc, com_buff.ota_input.mnc, sbp_id, mcc, mnc);
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                            com_buff.initial_ret = KAL_FALSE;
+                            kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                            return com_buff.initial_ret;
+                        }
+
+                        
+                    }else if(pItem_op->tag_type == 2){
+                        strncpy(iccid, &(pItem_op->buff_start), pItem_op->tag_len);
+                        strncpy(tlvota_file->iccid, iccid, 21);
+                        com_buff.is_general = KAL_TRUE;
+                    }
+                    
+                    
+                    /*
+                     *  If file is encrypted and has checksum.
+                     *  Decrypt file before checking checksum.
+                     */
+                    if ( (pFile->operation_mask & MCF_FILE_OP_AES_128) != 0) {
+                        mcf_get_custom_aes_password(password);
+
+                        if (mcf_decrypt_128bit(password, (kal_char *)(tlvota_file->buff + pFile->total_len), (pFile->file_size - pFile->total_len) ) != KAL_TRUE) {
+                            kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                            mcf_utfwk_printf("file(%s) decryption FAIL!! \r\n", com_buff.ota_input.input_mode.file_path_name);
+                            MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_FILE_DECRYPTION_FAIL(com_buff.ota_input.input_mode.file_path_name);
+                            com_buff.initial_ret = KAL_FALSE;
+                            kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                            return com_buff.initial_ret;
+                        }
+                    }
+
+                    if ( (pFile->operation_mask & MCF_FILE_OP_CHECKSUM) != 0) {
+                        if (mcf_check_check_sum((kal_uint32 *)(tlvota_file->buff), pFile->file_size) != 0) {
+                            kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                            mcf_utfwk_printf("file(%s) checksum ERROR!! \r\n", com_buff.ota_input.input_mode.file_path_name);
+                            MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_FILE_CHECKSUM_ERROR(com_buff.ota_input.input_mode.file_path_name);
+                            com_buff.initial_ret = KAL_FALSE;
+                            kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                            return com_buff.initial_ret;
+                        }
+                    }
+                } else {
+                    mcf_utfwk_printf("file version(%d) is INVALID!! \r\n", pFile->file_version);
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_FILE_INVALID_FILE_VERSION(pFile->file_version);
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+                
+                item_cnt = 0;
+                while (item_cnt < pFile->item_num) {
+                    if ( (pItem_op->array_index_len < 0) || (pItem_op->array_index_len >= MCF_FILE_MAX_ARRAY_TAG_LEN-1) ) {
+                        MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_TAG_INVALID_ARRAY_INDEX_LEN(pItem_op->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                        mcf_utfwk_printf("Invalid array_index_len(%d)!! max array_index_len(%d)", pItem_op->array_index_len, MCF_FILE_MAX_ARRAY_TAG_LEN);
+                        goto next1;
+                    }
+                    strncpy(array_tag, &(pItem_op->buff_start), pItem_op->array_index_len);
+                    array_tag[pItem_op->array_index_len] = '\0';
+                    
+                    if(mcf_find_gid_offset(pItem_op->global_id, array_tag, &item_lid, &item_byte_offset, &item_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+                        goto next1;
+                    }
+                    is_found_lid = KAL_FALSE;
+                    for(i = 0; i <com_buff.ota_input.lid_cnt; i++){
+                        if (item_lid == com_buff.ota_input.lid[i]){
+                            is_found_lid = KAL_TRUE;
+                        }
+                    }
+                    if (is_found_lid == KAL_FALSE){
+                        mcf_utfwk_printf("LID(%d) in OP-OTA file is not match given\r\n", item_lid);
+                        MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_TLVOTA_LID_INVALID(item_lid);
+                        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        com_buff.initial_ret = KAL_FALSE;
+                        kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                        return com_buff.initial_ret;
+                    }
+next1:
+                    pItem_op = (mcf_tool_gid_tlvota_file_item_t *)((kal_uint8 *)pItem_op + pItem_op->total_len);
+                    item_cnt++;
+                }
+                execute_op_ota = KAL_TRUE;
+                MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                
+            }else {
+                mcf_utfwk_printf("Read OP-OTA test data FAIL!! Fail to take read lock! \r\n");
+                MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_TAKE_TLV_OTA_READ_LOCK_FAIL();
+                MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                com_buff.initial_ret = KAL_FALSE;
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                return com_buff.initial_ret;
+            }
+            /* General OP-OTA */
+            if (com_buff.is_general == KAL_TRUE){
+                tlvota_file = &(pMcf->general_tlvota_file);
+                kal_mem_set(tag, 0, sizeof(kal_char) * MCF_MAX_TAG_LEN);
+                kal_mem_set(iccid, 0, 21);
+                MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                if (tlvota_file) {
+                    com_buff.initial_ret = mcf_utfwk_open_test_data(com_buff.ota_input.input_mode.file_path_name, (kal_char *)(tlvota_file->buff), MCF_MAX_TLVOTA_FILE_SIZE, tlvota_file->relative_path_name);
+                    if (com_buff.initial_ret == KAL_FALSE) {
+                        mcf_utfwk_printf("Open OP-OTA test data(%s) FAIL!! \r\n", com_buff.ota_input.input_mode.file_path_name);
+                        MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_OPEN_TLVOTA_FAIL(com_buff.ota_input.input_mode.file_path_name);
+                        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                        com_buff.initial_ret = KAL_FALSE;
+                        kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                        return com_buff.initial_ret;
+                    }
+                    pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+                    pItem_op = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + pFile->total_len);
+
+                    if (pItem_op->tag_type == 1){
+                        strncpy(tag, &(pItem_op->buff_start), pItem_op->tag_len);
+                        com_buff.initial_ret = mcf_utfwk_spilt_tag(tag, &sbp_id, mcc, mnc);
+                        if (sbp_id == SBP_ID_INVALID){
+                            com_buff.is_general = KAL_TRUE;
+                        }
+                        tlvota_file->sbp_id = com_buff.ota_input.sbp_id;
+                        strncpy(tlvota_file->mcc, com_buff.ota_input.mcc, MAX_MCC_STR_LEN);
+                        strncpy(tlvota_file->mnc, com_buff.ota_input.mnc, MAX_MNC_STR_LEN);
+                    }else if(pItem_op->tag_type == 2){
+                        strncpy(iccid, &(pItem_op->buff_start), pItem_op->tag_len);
+                        strncpy(tlvota_file->iccid, iccid, 21);
+                    }
+                    execute_gen_op_ota = KAL_TRUE;
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                }else{
+                    mcf_utfwk_printf("Read OP-OTA test data FAIL!! Fail to take read lock! \r\n");
+                    MD_TRC_MCF_TR_UTFWK_INITIAL_ENV_TAKE_TLV_OTA_READ_LOCK_FAIL();
+                    MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    com_buff.initial_ret = KAL_FALSE;
+                    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                    return com_buff.initial_ret;
+                }
+            }
+        }
+    }else if (com_buff.ota_input.input_op == MCF_UTFWK_OTA_VARIABLE_CONFIG){
+        if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA){
+            MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+            com_buff.initial_ret = mcf_utfwk_generate_gid_ota_file(ota_file->buff, com_buff.ota_input, &(com_buff.is_general), &buff_size);
+            MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+            if (com_buff.initial_ret == KAL_FALSE){
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+            }
+        }else if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA_BY_OP){
+            MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            com_buff.initial_ret = mcf_utfwk_generate_gid_ota_file(tlvota_file->buff, com_buff.ota_input, &(com_buff.is_general), &buff_size);
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (com_buff.initial_ret == KAL_FALSE){
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+            }
+        }
+    }
+
+
+    return com_buff.initial_ret;
+}
+
+void mcf_utfwk_initial_dsbp_callback(MCF_UTFWK_DSBP_FUNC dsbp_func_ptr)
+{
+    mcf_utfwk_printf("Start!!\r\n");
+    MD_TRC_MCF_TR_UTFWK_INITIAL_DSBP_CALLBACK_START();
+    com_buff.utfwk_dsbp_func_ptr = dsbp_func_ptr;
+}
+
+void mcf_utfwk_execute()
+{
+    nvram_ltable_entry_struct        lid_info = {0};
+    sbp_reconfig_custom_param_struct sbp_reconfig_custom_param;
+    mcf_ota_result_e                 mcf_ret;
+    
+    mcf_utfwk_printf("Start! OTA type(%d), SIM(%d)\r\n", com_buff.ota_input.ota_type, com_buff.ota_input.sim_id);
+    MD_TRC_MCF_TR_UTFWK_EXECUTE_START(com_buff.ota_input.ota_type, com_buff.ota_input.sim_id);
+    if (com_buff.initial_ret == KAL_FALSE){
+        mcf_utfwk_printf("Initial env is fail, ret(%d)\r\n", com_buff.initial_ret);
+        MD_TRC_MCF_TR_UTFWK_EXECUTE_INITIAL_ENV_FAIL(com_buff.initial_ret);
+        ASSERT(0);
+    }
+
+    if(com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA){
+        mcf_ret = mcf_do_ota_full();
+        if (mcf_ret != MCF_OTA_R_SUCCESS) {
+            mcf_utfwk_printf("Update default OTA FAIL!! ret(%d) \r\n", mcf_ret);
+            MD_TRC_MCF_TR_UTFWK_EXECUTE_UPDATE_DEFAULT_OTA_FAIL(mcf_ret);
+            ASSERT(0);
+        }else{
+            execute_ota = KAL_FALSE;
+            return;
+        }
+       
+    }else if(com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA_BY_OP){
+        if (!(com_buff.utfwk_dsbp_func_ptr)){
+            MD_TRC_MCF_TR_UTFWK_EXECUTE_NOT_REGISTER_DSBP_CALLBACK();
+            mcf_utfwk_printf("Not register DSBP callback function!!! \r\n");
+            return;
+        }
+        sbp_reconfig_custom_param.sbp_id = com_buff.ota_input.sbp_id;
+        sbp_reconfig_custom_param.is_in_dynamic_sbp = KAL_TRUE;   
+        sbp_reconfig_custom_param.sbp_sub_id = 0;
+        sbp_reconfig_custom_param.is_boot_up = KAL_FALSE;
+        sbp_reconfig_custom_param.trans_id = 250;
+        sbp_reconfig_custom_param.ps_id = l4c_gemini_get_switched_sim_id(com_buff.ota_input.sim_id);
+        kal_mem_set(sbp_reconfig_custom_param.mcc, 0, MAX_MCC_STR_LEN);
+        kal_mem_set(sbp_reconfig_custom_param.mnc, 0, MAX_MNC_STR_LEN);
+        kal_mem_set(sbp_reconfig_custom_param.iccid, 0, 21);
+        kal_mem_cpy(sbp_reconfig_custom_param.mcc, com_buff.ota_input.mcc, MAX_MCC_STR_LEN);
+        kal_mem_cpy(sbp_reconfig_custom_param.mnc, com_buff.ota_input.mnc, MAX_MNC_STR_LEN);
+        kal_mem_cpy(sbp_reconfig_custom_param.iccid, com_buff.ota_input.iccid, 21);
+
+        if (com_buff.utfwk_dsbp_func_ptr(&sbp_reconfig_custom_param) == KAL_FALSE){
+            MD_TRC_MCF_TR_UTFWK_EXECUTE_UPDATE_OP_OTA_FAIL(KAL_FALSE);
+            mcf_utfwk_printf("Update OP-OTA FAIL!! ret(%d) \r\n", KAL_FALSE);
+            ASSERT(0);
+        }
+        execute_op_ota = KAL_TRUE;
+        execute_gen_op_ota = KAL_TRUE;
+    }
+ 
+}
+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)
+{
+    nvram_ltable_entry_struct       lid_info = {0};
+    nvram_errno_enum                nvram_api_ret;
+    kal_uint16                      item_byte_offset;
+    kal_uint16                      item_bit_offset;
+    kal_uint32                      item_size;
+    mcf_custom_dump_param_struct    dump_para;
+    kal_uint32                      lid_size;
+    kal_uint32                      i;
+    kal_uint32                      j = 0;
+    kal_uint32                      n = 1;
+    kal_uint32                      read_len = 0;
+    kal_bool                        invalid_arr_size = KAL_FALSE;
+    kal_bool                        next_level_array = KAL_FALSE;
+    kal_bool                        is_found = KAL_FALSE;
+    kal_bool                        ret = KAL_TRUE;
+    kal_uint8                      *buffer = (kal_uint8*)dump_buffer;
+    kal_char                        array_tag[MCF_FILE_MAX_ARRAY_TAG_LEN]={0};
+    kal_bool                        item_is_bit = KAL_FALSE;
+    kal_uint16                      item_lid;
+
+    if ((!(buffer && (size > 0))) && rec_id == 0) {
+        MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_INVALID_PARA(lid, buffer, size);
+        mcf_utfwk_printf("Invalid parameters!! LID(%d), buffer(%x), size(%d) \r\n", lid, buffer, size);
+        kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_START(dump_type, com_buff.ota_input.ota_type, lid, rec_id, com_buff.ota_input.sim_id);
+    mcf_utfwk_printf("Start! dump type(%d), OTA type(%d), LID(%d), Record(%d), SIM(%d)\r\n", dump_type, com_buff.ota_input.ota_type, lid, rec_id, com_buff.ota_input.sim_id);
+
+    kal_mem_set(&dump_para, 0, sizeof(mcf_custom_dump_param_struct));
+    
+
+    nvram_api_ret = nvram_external_get_lid_info(lid, &lid_info);
+    if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+        MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_GET_LID_INFO_FAIL(lid, nvram_api_ret);
+        mcf_utfwk_printf("Get LID information FAIL!! lid(%d), nvram_ret(%d) \r\n", lid, nvram_api_ret);
+        kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    kal_mem_set(mcf_dump_buffer, 0, lid_info.size);
+
+    dump_para.sbp_id = com_buff.ota_input.sbp_id;
+    kal_mem_cpy(&(dump_para.mcc), &(com_buff.ota_input.mcc), MAX_MCC_STR_LEN);
+    kal_mem_cpy(&(dump_para.mnc), &(com_buff.ota_input.mnc), MAX_MNC_STR_LEN);
+    kal_mem_cpy(&(dump_para.iccid), &(com_buff.ota_input.iccid), 21);
+    dump_para.size = &lid_size;
+    
+    for (i = 0; i < mcf_dump_param_tbl_num; i++) {
+        if ( (mcf_dump_param_tbl[i].lid == lid) ) {
+            is_found = KAL_TRUE;
+            if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA){
+
+                dump_para.type = MCF_TYPE_OTA;
+                dump_para.record_idx = rec_id;
+                
+                if ((mcf_dump_param_tbl[i].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA) != 0) {
+
+                    dump_para.lid = mcf_dump_param_tbl[i].lid; 
+                    dump_para.buffer = mcf_dump_buffer;
+                    *(dump_para.size) = 0;
+
+                    MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_CALLBACK(dump_para.lid, mcf_dump_param_tbl[i].ntfy_type, dump_para.record_idx);
+                    mcf_utfwk_printf("Read default OTA by callback. LID(%d), type(%d), record_id(%d) \r\n", dump_para.lid, mcf_dump_param_tbl[i].ntfy_type, dump_para.record_idx);
+                    
+                    ret = mcf_dump_param_tbl[i].dump_func_ptr(&dump_para);
+                    if ( (ret == KAL_FALSE) || (*(dump_para.size) != lid_info.size) ) {
+                        MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_DUMP_ERROR(mcf_dump_param_tbl[i].lid, ret, lid_info.size, *(dump_para.size));
+                        mcf_utfwk_printf("Read OTA dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d) \r\n", mcf_dump_param_tbl[i].lid, ret, lid_info.size, *(dump_para.size));
+                        kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                        ret = KAL_FALSE;
+                        return ret;
+                    }   
+                } else {
+                    /* If not register callback */
+                    MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_NVRAM(lid_info.LID, mcf_dump_param_tbl[i].ntfy_type, dump_para.record_idx);
+                    mcf_utfwk_printf("Read default OTA by NVRAM. LID(%d), type(%d), record_id(%d) \r\n", lid_info.LID, mcf_dump_param_tbl[i].ntfy_type, dump_para.record_idx);
+                    dump_para.buffer = mcf_dump_buffer;
+                    if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                        MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_NVRAM_FAIL(mcf_dump_param_tbl[i].lid, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                        mcf_utfwk_printf("Read default OTA by NVRAM FAIL!! LID(%d), record_idx(%d), buffer(0x%x), size(%d) \r\n", mcf_dump_param_tbl[i].lid, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                        kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                        ret = KAL_FALSE;
+                        return ret;
+                    } 
+                }
+            }else if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA_BY_OP){
+                dump_para.type = MCF_TYPE_OTA_BY_OP;
+                dump_para.record_idx = 1;
+                dump_para.ps_id = l4c_gemini_get_switched_sim_id(com_buff.ota_input.sim_id);
+                
+                mcf_utfwk_printf("Read OP OTA. LID(%d), record_id(%d), ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s), iccid(%s) \r\n", dump_para.lid, dump_para.record_idx, dump_para.ps_id, dump_para.sbp_id, dump_para.mnc, dump_para.mcc, dump_para.iccid);
+                MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_USIR(dump_para.lid, dump_para.record_idx, dump_para.ps_id, dump_para.sbp_id, dump_para.mnc, dump_para.mcc, dump_para.iccid);
+
+                if ((mcf_dump_param_tbl[i].ntfy_type & MCF_DUMP_NTFY_TYPE_OTA_BY_OP) != 0) {
+                    dump_para.lid = mcf_dump_param_tbl[i].lid;
+                    dump_para.buffer = mcf_dump_buffer;
+                    *(dump_para.size) = 0;
+
+                    mcf_utfwk_printf("Read OP OTA by callback. LID(%d), type(%d), record_id(%d), sbp_id(%d), mnc(%s), mcc(%s), iccid(%s) \r\n", dump_para.lid, dump_para.type, dump_para.record_idx, dump_para.sbp_id, dump_para.mnc, dump_para.mcc, dump_para.iccid);
+                    MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_CALLBACK_USIR(dump_para.lid, dump_para.type, dump_para.record_idx, dump_para.sbp_id, dump_para.mnc, dump_para.mcc, dump_para.iccid);
+
+                    ret = mcf_dump_param_tbl[i].dump_func_ptr(&dump_para);
+                    if ( (ret == KAL_FALSE) || (*(dump_para.size) != lid_info.size) ) {
+                        MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_DUMP_FAIL(mcf_dump_param_tbl[i].lid, ret, lid_info.size, *(dump_para.size));
+                        mcf_utfwk_printf("Read OP OTA dump LID(%d) FAIL!! ret(%d), lid_size(%d), return_size(%d) \r\n", mcf_dump_param_tbl[i].lid, ret, lid_info.size, *(dump_para.size));
+                        kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                        ret = KAL_FALSE;
+                        return ret;
+                    }   
+                } else {
+                    /* If not register callback */
+                    MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_NVRAM(dump_para.lid, mcf_dump_param_tbl[i].ntfy_type);
+                    mcf_utfwk_printf("Read OP OTA by NVRAM. LID(%d), type(%d) \r\n", dump_para.lid, mcf_dump_param_tbl[i].ntfy_type);
+                    dump_para.buffer = mcf_dump_buffer;
+                    if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                        MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_NVRAM_FAIL(mcf_dump_param_tbl[i].lid, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                        mcf_utfwk_printf("Read OP OTA by NVRAM FAIL!! LID(%d), record_idx(%d), buffer(0x%x), size(%d) \r\n", mcf_dump_param_tbl[i].lid, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                        kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                        ret = KAL_FALSE;
+                        return ret;
+                    } 
+                }
+            }
+            break;
+        }
+    }
+
+     if (is_found == KAL_FALSE){
+        /* If not register callback */
+        if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA){
+
+            dump_para.type = MCF_TYPE_OTA;
+            dump_para.record_idx = rec_id;
+
+            mcf_utfwk_printf("Read default OTA by NVRAM (non-register callback). LID(%d), record_id(%d) \r\n", lid, rec_id);
+            MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_NVRAM_NOT_CALLBACK(lid, rec_id);
+            dump_para.buffer = mcf_dump_buffer;
+            if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OTA_NVRAM_NOT_CALLBACK_FAIL(lid, rec_id, dump_para.buffer, lid_info.size);
+                mcf_utfwk_printf("Read default OTA by NVRAM FAIL (non-register callback)!!. LID(%d), record_idx(%d), buffer(0x%x), size(%d) \r\n", com_buff.ota_input.lid, rec_id, dump_para.buffer, lid_info.size);
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                ret = KAL_FALSE;
+                return ret;
+            } 
+            
+        }else if (com_buff.ota_input.ota_type == MCF_UTFWK_ATTR_OTA_BY_OP){
+            dump_para.type = MCF_TYPE_OTA_BY_OP;
+            dump_para.record_idx = 1;
+            dump_para.ps_id = l4c_gemini_get_switched_sim_id(com_buff.ota_input.sim_id);
+            
+            MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_NVRAM_NOT_CALLBACK_USIR(lid, dump_para.ps_id, dump_para.sbp_id, dump_para.mnc, dump_para.mcc, dump_para.iccid);
+            mcf_utfwk_printf("Read OP OTA by NVRAM (non-register callback). LID(%d) ps_id(%d), sbp_id(%d), mcc(%s), mnc(%s), iccid(%s) \r\n", lid, dump_para.ps_id, dump_para.sbp_id, dump_para.mcc, dump_para.mnc, dump_para.iccid);
+            dump_para.buffer = mcf_dump_buffer;
+            if ( !nvram_external_read_data(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size) ) {
+                MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_OPOTA_NVRAM_NOT_CALLBACK_FAIL(lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                mcf_utfwk_printf("Read OP OTA by NVRAM FAIL (non-register callback)!! LID(%d), record_idx(%d), buffer(0x%x), size(%d) \r\n", lid_info.LID, dump_para.record_idx, dump_para.buffer, lid_info.size);
+                kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+                ret = KAL_FALSE;
+                return ret;
+            } 
+   
+        }
+            
+    }
+    
+    
+    if(dump_type == MCF_UTFWK_DUMP_LID){
+        if (size != lid_info.size) {
+            MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_INVALID_SIZE(size, lid_info.size);
+            mcf_utfwk_printf("Invalid buffer_size(%d)!! record_size(%d) \r\n", size, lid_info.size);
+            kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+            ret = KAL_FALSE;
+            return ret;
+        }
+        kal_mem_cpy(buffer, mcf_dump_buffer, size);
+        return ret;
+    }else if (dump_type == MCF_UTFWK_DUMP_ONE_VARIABLE){
+        kal_mem_set(array_tag, 0, MCF_FILE_MAX_ARRAY_TAG_LEN);
+        if (gid == 0){
+            mcf_utfwk_printf("Dump one variable, Invalid GID(%d)!!! \r\n", gid);
+            MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_INVALID_GID(gid);
+            ret = KAL_FALSE;
+            return ret;
+        }else{
+            if (array_index != NULL){
+                mcf_utfwk_printf("GID(%d), array index(%s) \r\n", gid, array_index);
+                strcpy(array_tag, array_index);
+            }else{
+                mcf_utfwk_printf("GID(%d) \r\n", gid);
+                strcpy(array_tag, "");
+            }
+            MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_DUMP_ONE_VARIABLE_START(gid, array_tag);
+        }
+
+        /* Find GID corresponding LID */
+        item_lid = mcf_find_gid_return_lid_num(gid);
+        if (item_lid == 65535){
+            //-1(65535) means not found
+            mcf_utfwk_printf("Can not find this gid(%d) \r\n", gid);
+            ret = KAL_FALSE;
+            return ret;
+        }
+        
+        if (item_lid != lid){
+            MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_INVALID_LID(item_lid, gid, lid);
+            mcf_utfwk_printf("LID(%d) of GID(%d) item is not match given LID(%d) \r\n", item_lid, gid, lid);
+            ret = KAL_FALSE;
+            return ret;
+        }
+
+        if(mcf_find_gid_offset(gid, array_tag, &item_lid, &item_byte_offset, &item_bit_offset, &item_size, &item_is_bit) == KAL_FALSE){
+            //Cannot find the tag
+            kal_mem_set(array_tag, 0, sizeof(kal_uint8) *256);
+            strcpy(array_tag, array_index);
+            mcf_utfwk_printf("Can not find this gid(%d), array_index(%s) \r\n", gid, array_tag);
+            ret = KAL_FALSE;
+            return ret;
+        }
+
+        if (item_size > size){
+            MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_INVALID_SIZE(size, item_size);
+            mcf_utfwk_printf("Invalid buffer_size(%d)!! record_size(%d) \r\n", size, item_size);
+            ret = KAL_FALSE;
+            return ret;
+        }
+        
+        kal_mem_set(buffer, 0, lid_info.size);
+        
+        if (item_is_bit == KAL_FALSE){
+            kal_mem_cpy(buffer, (mcf_dump_buffer + item_byte_offset), item_size);
+            MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_VARIABLE_BYTE(buffer, item_size);
+            mcf_utfwk_printf("Read variable by byte. value(%s), len(%d) \r\n", buffer, item_size);
+        }else{
+            if (item_size <= 8){
+                kal_uint8 bit_value = *(mcf_dump_buffer + item_byte_offset);
+                kal_uint8 bit_mask = (kal_uint8)MCF_GEN_BIT_MASK(item_size);
+                bit_value &= (bit_mask << item_bit_offset);
+                bit_value = ((kal_uint8)bit_value >> item_bit_offset);
+                
+                size = 1;
+                MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_VARIABLE_BIT(bit_value, size);
+                mcf_utfwk_printf("Read variable by bit. value(%d), len(%d) \r\n", bit_value, size);
+                kal_mem_cpy(buffer, &bit_value, size);
+            }else if (item_size > 8 && item_size <= 16){
+                kal_uint16 bit_value = *(mcf_dump_buffer + item_byte_offset);
+                kal_uint16 bit_mask = (kal_uint8)MCF_GEN_BIT_MASK(item_size);
+                bit_value &= (bit_mask << item_bit_offset);
+                bit_value = ((kal_uint8)bit_value >> item_bit_offset);
+                
+                size = 2;
+                MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_VARIABLE_BIT(bit_value, size);
+
+                MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_VARIABLE_BIT(bit_value, size);
+                mcf_utfwk_printf("Read variable by bit. value(%d), len(%d) \r\n", bit_value, size);
+                kal_mem_cpy(buffer, &bit_value, size);
+            }else if (item_size > 16 && item_size <= 32){
+                kal_uint32 bit_value = *(mcf_dump_buffer + item_byte_offset);
+                kal_uint32 bit_mask = (kal_uint8)MCF_GEN_BIT_MASK(item_size);
+                bit_value &= (bit_mask << item_bit_offset);
+                bit_value = ((kal_uint8)bit_value >> item_bit_offset);
+                size = 4;
+                MD_TRC_MCF_TR_UTFWK_DUMP_RESULT_READ_VARIABLE_BIT(bit_value, size);
+                mcf_utfwk_printf("Read variable by bit. value(%d), len(%d) \r\n", bit_value, size);
+                kal_mem_cpy(buffer, &bit_value, size);
+            }
+        }
+    }
+
+    return ret;
+
+}
+void mcf_utfwk_reset()
+{
+    mcf_t                          *pMcf = mcf_get_instance();
+    nvram_errno_enum                nvram_api_ret;
+    nvram_ltable_entry_struct       lid_info = {0};
+    mcf_ota_file_t                 *ota_file = &(pMcf->ota_file);
+    kal_uint32                      i;
+
+    MD_TRC_MCF_TR_UTFWK_RESET_START();
+    mcf_utfwk_printf("Reset Start!!\r\n");
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        kal_mem_set(ota_file->buff, 0, sizeof(kal_uint8) * MCF_MAX_OTA_FILE_SIZE);
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        MD_TRC_MCF_TR_UTFWK_RESET_TAKE_WRITE_LOCK_FAIL();
+        mcf_utfwk_printf("Take write lock FAIL!!\r\n");
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+        ASSERT(0);
+    }
+    
+    for(i = 0; i < com_buff.ota_input.lid_cnt; i++){
+        kal_mem_set(&lid_info, 0, sizeof(nvram_ltable_entry_struct));
+        nvram_api_ret = nvram_external_get_lid_info(com_buff.ota_input.lid[i], &lid_info);
+        if (nvram_api_ret != NVRAM_ERRNO_SUCCESS) {
+            mcf_utfwk_printf("Fail to get LID information!! LID(%d), nvram_api_ret(%d) \r\n", com_buff.ota_input.lid[i], nvram_api_ret);
+            MD_TRC_MCF_TR_UTFWK_RESET_GET_LID_INFO_FAIL(com_buff.ota_input.lid[i], nvram_api_ret);
+            ASSERT(0);
+        
+        }
+        /* Reset LID to default value */
+        if((lid_info.attr & NVRAM_ATTR_MCF_OTA) != 0) {
+            MD_TRC_MCF_TR_UTFWK_RESET_RESET_LID(com_buff.ota_input.lid[i]);
+            if ( !nvram_external_reset_data(com_buff.ota_input.lid[i], 1, lid_info.total_records) ) {
+                MD_TRC_MCF_TR_UTFWK_RESET_RESET_LID_FAIL(com_buff.ota_input.lid[i], lid_info.total_records);
+                mcf_utfwk_printf("Fail to reset LID!! LID(%d), total_record(%d) \r\n", com_buff.ota_input.lid[i], lid_info.total_records);
+                ASSERT(0);
+            }
+            
+        }
+    }
+    kal_mem_set(&com_buff, 0, sizeof(mcf_utfwk_common_t));
+    execute_ota = KAL_FALSE;
+    execute_op_ota = KAL_FALSE;
+    execute_gen_op_ota = KAL_FALSE;
+    
+    /* UT FWK is done */
+    is_ut_fwk = KAL_FALSE;
+    kal_give_enh_mutex(mcf_utfwk_enhmutex_g);
+
+}
+
+void mcf_utfwk_ilm_initial_env(ilm_struct *ilm)
+{
+    mcf_utfwk_initial_env_req_struct    *req = (mcf_utfwk_initial_env_req_struct *)ilm->local_para_ptr;
+    mcf_utfwk_initial_env_resp_struct   *resp;
+
+    resp = (mcf_utfwk_initial_env_resp_struct *)construct_local_para(sizeof(mcf_utfwk_initial_env_resp_struct), TD_RESET);
+    if (!resp) {
+        ASSERT(0);
+    }
+
+    resp->result = mcf_utfwk_initial_env(req->ota_input);
+
+
+    /* Send process result to ATCI */
+    msg_send6(MOD_MCF, /* src_mod_id */
+            ilm->src_mod_id, /* dest_mod_id */
+            MCF_UTFWK_SAP, /* sap_id */
+            MSG_ID_MCF_UTFWK_INITIAL_ENV_RESP, /* msg_id */
+            (local_para_struct*)resp, /* local_para_ptr */
+            NULL); /* peer_buff_ptr */
+    
+}
+
+void mcf_utfwk_ilm_initial_dsbp_callback(ilm_struct *ilm)
+{
+    mcf_utfwk_initial_dsbp_callback_req_struct    *req = (mcf_utfwk_initial_dsbp_callback_req_struct *)ilm->local_para_ptr;
+
+    mcf_utfwk_initial_dsbp_callback(req->utfwk_dsbp_func_ptr);
+
+
+    /* Send process result to ATCI */
+    msg_send6(MOD_MCF, /* src_mod_id */
+            ilm->src_mod_id, /* dest_mod_id */
+            MCF_UTFWK_SAP, /* sap_id */
+            MSG_ID_MCF_UTFWK_INITIAL_DSBP_CALLBACK_RESP, /* msg_id */
+            NULL, /* local_para_ptr */
+            NULL); /* peer_buff_ptr */
+    
+}
+
+void mcf_utfwk_ilm_execute(ilm_struct *ilm)
+{
+    mcf_utfwk_execute();
+
+    /* Send process result to ATCI */
+    msg_send6(MOD_MCF, /* src_mod_id */
+            ilm->src_mod_id, /* dest_mod_id */
+            MCF_UTFWK_SAP, /* sap_id */
+            MSG_ID_MCF_UTFWK_EXECUTE_RESP, /* msg_id */
+            NULL, /* local_para_ptr */
+            NULL); /* peer_buff_ptr */
+    
+}
+
+void mcf_utfwk_ilm_dump_result(ilm_struct *ilm)
+{
+    mcf_utfwk_dump_result_req_struct    *req = (mcf_utfwk_dump_result_req_struct *)ilm->local_para_ptr;
+    mcf_utfwk_dump_result_resp_struct   *resp;
+
+    resp = (mcf_utfwk_dump_result_resp_struct *)construct_local_para(sizeof(mcf_utfwk_dump_result_resp_struct), TD_RESET);
+    if (!resp) {
+        ASSERT(0);
+    }
+
+    resp->result = mcf_utfwk_dump_result(req->lid, req->rec_id, req->dump_type, req->buffer, req->size, req->gid, req->array_index);
+
+    /* Send process result to ATCI */
+    msg_send6(MOD_MCF, /* src_mod_id */
+            ilm->src_mod_id, /* dest_mod_id */
+            MCF_UTFWK_SAP, /* sap_id */
+            MSG_ID_MCF_UTFWK_DUMP_RESULT_RESP, /* msg_id */
+            (local_para_struct*)resp, /* local_para_ptr */
+            NULL); /* peer_buff_ptr */
+    
+}
+
+void mcf_utfwk_ilm_reset(ilm_struct *ilm)
+{
+    mcf_utfwk_reset();
+
+    /* Send process result to ATCI */
+    msg_send6(MOD_MCF, /* src_mod_id */
+            ilm->src_mod_id, /* dest_mod_id */
+            MCF_UTFWK_SAP, /* sap_id */
+            MSG_ID_MCF_UTFWK_RESET_RESP, /* msg_id */
+            NULL, /* local_para_ptr */
+            NULL); /* peer_buff_ptr */
+    
+}
diff --git a/mcu/service/mcf/src/mcf_utfwk_sample_code.c b/mcu/service/mcf/src/mcf_utfwk_sample_code.c
new file mode 100644
index 0000000..ee475e0
--- /dev/null
+++ b/mcu/service/mcf/src/mcf_utfwk_sample_code.c
@@ -0,0 +1,1271 @@
+/*****************************************************************************
+*  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_utfwk_sample_code.c
+ *
+ * Project:
+ * --------
+ *   Common
+ *
+ * Description:
+ * ------------
+ *   MCF UT Framework sample code.
+ *
+ * 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!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+
+#if defined(__MCF_UT_FRAMEWORK_SUPPORT__)
+#include "sys_test.h"
+#include "mcf_nvram_def.h"
+#include "mcf_utfwk.h"
+#include "nvram_interface.h"
+#include "nvram_group_def.h"
+#include "mcf_msgid.h"
+#include "md_svc_sap.h"
+
+/********* TEST CASE LIST ****************
+
+We provide test cases in the following scenario :
+1-1. Get default OTA value (Get by API, Get OTA value from OTA file)                                 => TC : mcf_utfwk_sample_code_TC_1_1
+1-2. Get default OTA value (Get by API, Get OTA value from runtime created file)                 => TC : mcf_utfwk_sample_code_TC_1_2
+1-3  Get default OTA value (Get by ILM, Get OTA value from runtime created file)                => TC : mcf_utfwk_sample_code_TC_1_3
+2-1. Get OTA by OP value (Get by API, Get OTA value from OTA file)                                    => TC : mcf_utfwk_sample_code_TC_2_1
+2-2. Get OTA by OP value (Get by API, Get OTA value from runtime created file)                    => TC : mcf_utfwk_sample_code_TC_2_2
+2-3. Get OTA by OP value (Get by ILM, Get OTA value from runtime created file)                => TC : mcf_utfwk_sample_code_TC_2_3
+2-4. Get OTA by OP value from Dual SIMs(Get by API, Get OTA value from OTA file)            => TC : mcf_utfwk_sample_code_TC_2_4
+2-5. Get OTA by OP value from General OTA file(Get by API, Get OTA value from OTA file)    => TC : mcf_utfwk_sample_code_TC_2_5
+3-1. Get OTA by Query value (Get by API, Get OTA value from OTA file)                                => TC : mcf_utfwk_sample_code_TC_3_1
+3-2. Get OTA by Query value (Get by API, Get OTA value from runtime created file)            => TC : mcf_utfwk_sample_code_TC_3_2
+3-3. Get OTA by Query value (Get by ILM, Get OTA value from runtime created file)            => TC : mcf_utfwk_sample_code_TC_3_3
+All.  Execute as above all test cases     => TC : mcf_utfwk_sample_code_start_ut()
+
+Each test case flow :
+1. Initial => 2. Execute => 3. Check OTA result => 4. Check dump result => 5. Reset
+
+If you want to execute as above test cases, 
+please extern mcf_utfwk_sample_code_start_ut and then call this function in your file.
+
+******************************************/
+#define MCF_TEST_OTA_LID_BASE_GID 5059
+#define MCF_TEST_OTA_QUERY_LID_BASE_GID 5188
+static nvram_ef_mcf_test_struct lid_buffer;
+MCF_UTFWK_DUMP_VAR nvram_ef_mcf_test_struct dump_buffer;
+    
+static void mcf_utfwk_sample_code_initial_enviroment()
+{
+    // reset NVRAM_EF_MCF_TEST_OTA_LID
+    kal_mem_set(&lid_buffer, 0, sizeof(lid_buffer));
+    nvram_external_write_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, (kal_uint8 *)&lid_buffer, sizeof(lid_buffer));
+}
+
+static kal_bool mcf_utfwk_sample_code_dsbp_callback(sbp_reconfig_custom_param_struct *param_ptr)
+{
+    mcf_ota_result_e mcf_ota_result = MCF_OTA_R_SUCCESS;
+    mcf_tlvota_sbp_tag_t ota_sbp_tag;
+  
+    ota_sbp_tag.sbp_id = param_ptr->sbp_id;
+    memcpy(&(ota_sbp_tag.mcc), param_ptr->mcc, MAX_MCC_STR_LEN);
+    memcpy(&(ota_sbp_tag.mnc), param_ptr->mnc, MAX_MNC_STR_LEN);
+    mcf_ota_result = mcf_read_tlvota_buffer_sbp_tag(param_ptr->ps_id, ota_sbp_tag, NVRAM_EF_MCF_TEST_OTA_LID, (kal_uint8*)&lid_buffer, sizeof(lid_buffer));
+    
+    return KAL_TRUE;
+}
+
+// 1-1. Get default OTA value (Get by API, Get OTA value from OTA file)
+// Brief: Initial OTA value from MCF_OTA_ut_gid_normal.mcfota, after executed, use NVRAM API to get the value,
+//          and then check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_1_1()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    // Set val_byte_11 = 6 in MCF_OTA_ut_gid_normal.mcfota
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_ut_gid_normal.mcfota", '\0');
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    strcpy(ota_input.input_mode.file_path_name, ota_data_path);
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;    
+    }
+    /* Step2 : Execute MCF & configure your test case */
+    mcf_utfwk_execute();
+    
+    /* Step3 : Check test result */
+    
+    nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, (kal_uint8 *)&lid_buffer, sizeof(lid_buffer));
+
+    if(lid_buffer.val_byte_11 != 6) // we set OTA value =6 in MCF_OTA_ut_gid_normal.mcfota
+    {
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    // Step4 : Check dump result
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_LID, (kal_uint8 *)&dump_buffer, sizeof(lid_buffer), 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return ret;
+    }
+    if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+       ret = KAL_FALSE;
+       return ret;
+    }
+
+    // Step5 : Reset test environment
+    mcf_utfwk_reset();
+
+    return KAL_TRUE;
+}
+
+// 1-2. Get default OTA value (Get by API, Get OTA value from runtime created file)
+// Brief:  Initial OTA value by config variable method, after executed, use NVRAM API to get the value,
+//          and then check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_1_2()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    // Set val_byte_11 = 12 and val_byte_12 = 5566
+    ota_input.input_op = MCF_UTFWK_OTA_VARIABLE_CONFIG;
+    {
+        MCF_UTFWK_INPUT_VAR mcf_utfwk_config_variable_struct     var_arr[2];
+        MCF_UTFWK_INPUT_VAR kal_uint32    value1, value2;
+
+        kal_mem_set(&var_arr, 0, sizeof(mcf_utfwk_config_variable_struct)*2);
+        //val_byte_11
+        var_arr[0].gid = MCF_TEST_OTA_LID_BASE_GID+44;
+        value1 = 12;
+        var_arr[0].value = &value1;
+        var_arr[0].value_len = 1;
+        var_arr[0].rec_id = 1;
+        //val_short_11
+        var_arr[1].gid = MCF_TEST_OTA_LID_BASE_GID+56;
+        value2 = 5566;
+        var_arr[1].value = &value2;
+        var_arr[1].value_len = 2;
+        var_arr[1].rec_id = 1;
+        ota_input.input_mode.var_info.var = var_arr;
+        ota_input.input_mode.var_info.var_cnt = 2;
+    }
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;    
+    }
+    /* Step2 : Execute MCF & configure your test case */
+    mcf_utfwk_execute();
+    
+    /* Step3 : Check test result */
+    nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, (kal_uint8 *)&lid_buffer, sizeof(lid_buffer));
+
+    if(lid_buffer.val_byte_11 != 12 || lid_buffer.val_short_11 != 5566) 
+    {
+        ret = KAL_FALSE;
+        return ret;
+    }
+
+    // Step4 : Check dump result
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_LID, (kal_uint8 *)&dump_buffer, sizeof(lid_buffer), 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return ret;
+    }
+    if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+       ret = KAL_FALSE;
+       return ret;
+    }
+
+    // Step5 : Reset test environment
+    mcf_utfwk_reset();
+
+    return KAL_TRUE;
+}
+
+// 1-3  Get default OTA value (Get by ILM, Get OTA value from runtime created file)    
+// Brief:  Use MCF UT FWK ILM function to initial OTA value by config variable method, use NVRAM API to get the value,
+//          and then check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_1_3()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    ilm_struct  current_ilm;
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    // Set val_byte_11 = 12 and val_byte_12 = 5566
+    ota_input.input_op = MCF_UTFWK_OTA_VARIABLE_CONFIG;
+    {
+        MCF_UTFWK_INPUT_VAR mcf_utfwk_config_variable_struct     var_arr[2];
+        MCF_UTFWK_INPUT_VAR kal_uint32    value1, value2;
+
+        kal_mem_set(&var_arr, 0, sizeof(mcf_utfwk_config_variable_struct)*2);
+        //val_byte_11
+        var_arr[0].gid = MCF_TEST_OTA_LID_BASE_GID+44;
+        value1 = 12;
+        var_arr[0].value = &value1;
+        var_arr[0].value_len = 1;
+        var_arr[0].rec_id = 1;
+        //val_short_11
+        var_arr[1].gid = MCF_TEST_OTA_LID_BASE_GID+56;
+        value2 = 5566;
+        var_arr[1].value = &value2;
+        var_arr[1].value_len = 2;
+        var_arr[1].rec_id = 1;
+        ota_input.input_mode.var_info.var = var_arr;
+        ota_input.input_mode.var_info.var_cnt = 2;
+    }
+    
+    // Send ILM to initial envirement
+    {
+        mcf_utfwk_initial_env_req_struct *req;
+        mcf_utfwk_initial_env_resp_struct *resp;
+
+        req = (mcf_utfwk_initial_env_req_struct *)construct_local_para(sizeof(mcf_utfwk_initial_env_req_struct), TD_RESET);
+        if (!req) {
+            ASSERT(0);
+        }
+
+        req->ota_input= ota_input;
+        
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_INITIAL_ENV_REQ, /* msg_id */
+               (local_para_struct*)req, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        resp = (mcf_utfwk_initial_env_resp_struct *)current_ilm.local_para_ptr;
+        ret = resp->result;
+        if(ret == KAL_FALSE){
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+    
+    /* Step2 : Execute MCF & configure your test case */
+    {
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_EXECUTE_REQ, /* msg_id */
+               NULL, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        if(current_ilm.msg_id != MSG_ID_MCF_UTFWK_EXECUTE_RESP){
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+    
+    /* Step3 : Check test result */
+    nvram_external_read_data(NVRAM_EF_MCF_TEST_OTA_LID, 1, (kal_uint8 *)&lid_buffer, sizeof(lid_buffer));
+
+    if(lid_buffer.val_byte_11 != 12 || lid_buffer.val_short_11 != 5566) 
+    {
+        return KAL_FALSE;
+    }
+    
+    // Step4 : Check dump result
+    {
+        mcf_utfwk_dump_result_req_struct   *req;
+        mcf_utfwk_dump_result_resp_struct *resp;
+        
+        req = (mcf_utfwk_dump_result_req_struct *)construct_local_para(sizeof(mcf_utfwk_dump_result_req_struct), TD_RESET);
+        if (! req) {
+            ASSERT(0);
+        }
+
+        req->lid = NVRAM_EF_MCF_TEST_OTA_LID;
+        req->rec_id = 1;
+        req->dump_type = MCF_UTFWK_DUMP_LID;
+        req->buffer = (kal_uint8 *)&dump_buffer;
+        req->size = sizeof(dump_buffer);
+        req->gid = 0;
+        req->array_index = "";
+        
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_DUMP_RESULT_REQ, /* msg_id */
+               (local_para_struct*)req, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        resp = (mcf_utfwk_dump_result_resp_struct *)current_ilm.local_para_ptr;
+        ret = resp->result;
+        if(ret == KAL_FALSE){
+            destroy_ilm(&current_ilm);
+            return ret;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+
+        if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+           return KAL_FALSE;
+        }
+    }
+    
+
+    // Step5 : Reset test environment
+    {
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_RESET_REQ, /* msg_id */
+               NULL, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        if(current_ilm.msg_id != MSG_ID_MCF_UTFWK_RESET_RESP){
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+
+    return KAL_TRUE;
+}
+
+// 2-1. Get OTA by OP value (Get by API, Get OTA value from OTA file)        
+// Brief:  Initial OTA by OP value from MTK_OPOTA_SBPID_1.mcfota, and register a DSBP callback function,
+//          after executed, use MCF TLV API to get the value in the callback function, and then check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_2_1()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    // Set sbp_id =1, mcc = 111, mnc = 222, val_byte_11 = 12 in MTK_OPOTA_SBPID_1.mcfota
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA_BY_OP;
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    ota_input.sim_id = 0;
+    ota_input.sbp_id = 1;
+    strcpy(ota_input.mcc, "111");
+    strcpy(ota_input.mnc, "222");
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MTK_OPOTA_SBPID_1.mcfopota", '\0');
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    strcpy(ota_input.input_mode.file_path_name, ota_data_path);
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;    
+    }
+    
+    // Register a UT DSBP callback
+    mcf_utfwk_initial_dsbp_callback(mcf_utfwk_sample_code_dsbp_callback);
+    
+    /* Step2 : Execute MCF & configure your test case */
+    mcf_utfwk_execute();
+    
+    /* Step3 : Check test result */
+    // Already get value in DSBP callback function
+    if(lid_buffer.val_byte_11 != 12) // we set val_byte_11 = 12 in MTK_OPOTA_SBPID_1.mcfota
+    {
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    // Step4 : Check dump result
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_LID, (kal_uint8 *)&dump_buffer, sizeof(lid_buffer), 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return ret;
+    }
+    if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+       ret = KAL_FALSE;
+       return ret;
+    }
+
+    // Step5 : Reset test environment
+    mcf_utfwk_reset();
+
+    return KAL_TRUE;
+}
+
+// 2-2. Get OTA by OP value (Get by API, Get OTA value from runtime created file)        
+// Brief:  Initial OTA by OP value by config variable method, and register a DSBP callback function, 
+//          after executed, use MCF TLV API to get the value in the callback function, and then check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_2_2()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    // Set sbp_id =1, mcc = 111, mnc = 222, val_byte_11 = 12
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA_BY_OP;
+    ota_input.sim_id = 0;
+    ota_input.sbp_id = 1;
+    strcpy(ota_input.mcc, "111");
+    strcpy(ota_input.mnc, "222");
+    // Set val_byte_11 = 12 and val_byte_12 = 5566
+    ota_input.input_op = MCF_UTFWK_OTA_VARIABLE_CONFIG;
+    {
+        MCF_UTFWK_INPUT_VAR mcf_utfwk_config_variable_struct     var_arr[2];
+        MCF_UTFWK_INPUT_VAR kal_uint32    value1, value2;
+
+        kal_mem_set(&var_arr, 0, sizeof(mcf_utfwk_config_variable_struct)*2);
+        //val_byte_11
+        var_arr[0].gid = MCF_TEST_OTA_LID_BASE_GID+44;
+        value1 = 12;
+        var_arr[0].value = &value1;
+        var_arr[0].value_len = 1;
+        var_arr[0].rec_id = 1;
+        //val_short_11
+        var_arr[1].gid = MCF_TEST_OTA_LID_BASE_GID+56;
+        value2 = 5566;
+        var_arr[1].value = &value2;
+        var_arr[1].value_len = 2;
+        var_arr[1].rec_id = 1;
+        ota_input.input_mode.var_info.tag_type = 1;
+        ota_input.input_mode.var_info.var = var_arr;
+        ota_input.input_mode.var_info.var_cnt = 2;
+    }
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;    
+    }
+    
+    // Register a UT DSBP callback
+    mcf_utfwk_initial_dsbp_callback(mcf_utfwk_sample_code_dsbp_callback);
+    
+    /* Step2 : Execute MCF & configure your test case */
+    mcf_utfwk_execute();
+    
+    /* Step3 : Check test result */
+    // Already get value in DSBP callback function
+    if(lid_buffer.val_byte_11 != 12  || lid_buffer.val_short_11 != 5566) // we set val_byte_11 = 12
+    {
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    // Step4 : Check dump result
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_LID, (kal_uint8 *)&dump_buffer, sizeof(lid_buffer), 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return ret;
+    }
+    if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+       ret = KAL_FALSE;
+       return ret;
+    }
+
+    // Step5 : Reset test environment
+    mcf_utfwk_reset();
+
+    return KAL_TRUE;
+}
+
+// 2-3. Get OTA by OP value (Get by ILM, Get OTA value from runtime created file)
+// Brief:  Use MCF UT FWK ILM function to initial OTA by OP value by config variable method, and register a DSBP callback function, 
+//          after executed, use MCF TLV API  to get the value in the callback function, and then check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_2_3()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    ilm_struct  current_ilm;
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    // Set sbp_id =1, mcc = 111, mnc = 222, val_byte_11 = 12
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA_BY_OP;
+    ota_input.sim_id = 0;
+    ota_input.sbp_id = 1;
+    strcpy(ota_input.mcc, "111");
+    strcpy(ota_input.mnc, "222");
+    // Set val_byte_11 = 12 and val_byte_12 = 5566 in MCF_OTA_ut_gid_normal.mcfota
+    ota_input.input_op = MCF_UTFWK_OTA_VARIABLE_CONFIG;
+    {
+        MCF_UTFWK_INPUT_VAR mcf_utfwk_config_variable_struct     var_arr[2];
+        MCF_UTFWK_INPUT_VAR kal_uint32    value1, value2;
+
+        kal_mem_set(&var_arr, 0, sizeof(mcf_utfwk_config_variable_struct)*2);
+        //val_byte_11
+        var_arr[0].gid = MCF_TEST_OTA_LID_BASE_GID+44;
+        value1 = 12;
+        var_arr[0].value = &value1;
+        var_arr[0].value_len = 1;
+        var_arr[0].rec_id = 1;
+        //val_short_11
+        var_arr[1].gid = MCF_TEST_OTA_LID_BASE_GID+56;
+        value2 = 5566;
+        var_arr[1].value = &value2;
+        var_arr[1].value_len = 2;
+        var_arr[1].rec_id = 1;
+        ota_input.input_mode.var_info.tag_type = 1;
+        ota_input.input_mode.var_info.var = var_arr;
+        ota_input.input_mode.var_info.var_cnt = 2;
+    }
+    
+    // Send ILM to initial envirement
+    {
+        mcf_utfwk_initial_env_req_struct *req;
+        mcf_utfwk_initial_env_resp_struct *resp;
+
+        req = (mcf_utfwk_initial_env_req_struct *)construct_local_para(sizeof(mcf_utfwk_initial_env_req_struct), TD_RESET);
+        if (!req) {
+            ASSERT(0);
+        }
+
+        req->ota_input= ota_input;
+        
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_INITIAL_ENV_REQ, /* msg_id */
+               (local_para_struct*)req, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        resp = (mcf_utfwk_initial_env_resp_struct *)current_ilm.local_para_ptr;
+        ret = resp->result;
+        if(ret == KAL_FALSE)
+        {
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+    
+    // Register DSBP callback by ILM
+    {
+        mcf_utfwk_initial_dsbp_callback_req_struct *req;
+        req = (mcf_utfwk_initial_dsbp_callback_req_struct*)construct_local_para(sizeof(mcf_utfwk_initial_dsbp_callback_req_struct), TD_RESET);
+        if (! req) {
+            ASSERT(0);
+        }
+
+        req->utfwk_dsbp_func_ptr= mcf_utfwk_sample_code_dsbp_callback;
+        
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_INITIAL_DSBP_CALLBACK_REQ, /* msg_id */
+               (local_para_struct*)req, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+
+        msg_receive_extq(&current_ilm);
+        if(current_ilm.msg_id != MSG_ID_MCF_UTFWK_INITIAL_DSBP_CALLBACK_RESP){
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+    
+    /* Step2 : Execute MCF & configure your test case */
+    {
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_EXECUTE_REQ, /* msg_id */
+               NULL, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        if(current_ilm.msg_id != MSG_ID_MCF_UTFWK_EXECUTE_RESP){
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+    
+    /* Step3 : Check test result */
+    // Already get value in DSBP callback function
+    if(lid_buffer.val_byte_11 != 12 || lid_buffer.val_short_11 != 5566) 
+    {
+        return KAL_FALSE;
+    }
+    
+    // Step4 : Check dump result
+    {
+        mcf_utfwk_dump_result_req_struct   *req;
+        mcf_utfwk_dump_result_resp_struct   *resp;
+        req = (mcf_utfwk_dump_result_req_struct *)construct_local_para(sizeof(mcf_utfwk_dump_result_req_struct), TD_RESET);
+        if (! req) {
+            ASSERT(0);
+        }
+
+        req->lid = NVRAM_EF_MCF_TEST_OTA_LID;
+        req->rec_id = 1;
+        req->dump_type = MCF_UTFWK_DUMP_LID;
+        req->buffer = (kal_uint8 *)&dump_buffer;
+        req->size = sizeof(dump_buffer);
+        req->gid = 0;
+        req->array_index = "";
+        
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_DUMP_RESULT_REQ, /* msg_id */
+               (local_para_struct*)req, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        resp = (mcf_utfwk_dump_result_resp_struct *)current_ilm.local_para_ptr;
+        ret = resp->result;
+        if(ret == KAL_FALSE)
+        {
+            destroy_ilm(&current_ilm);
+            return ret;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+        
+        if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+           return KAL_FALSE;
+        }
+    }
+    
+    // Step5 : Reset test environment
+    {
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_RESET_REQ, /* msg_id */
+               NULL, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        if(current_ilm.msg_id != MSG_ID_MCF_UTFWK_RESET_RESP){
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+
+    return KAL_TRUE;
+}
+
+// 2-4. Get OTA by OP value from Dual SIMs(Get by API, Get OTA value from OTA file)
+// Brief:  Same as TC 2-1, test SIM 1 first, and then test SIM 2.
+//           SIM 1 config file is MTK_OPOTA_SBPID_1.mcfota, and SIM2 config file is MTK_OPOTA_SBPID_2.mcfota
+static kal_bool mcf_utfwk_sample_code_TC_2_4()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+
+    // SIM1
+    {
+        /* Step1 : Initial MCF environment */
+        mcf_utfwk_sample_code_initial_enviroment();
+        
+        // Set sbp_id =1, mcc = 111, mnc = 222, val_byte_11 = 12 in MTK_OPOTA_SBPID_1.mcfota
+        ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+        ota_input.lid_cnt = 1;
+        ota_input.ota_type = MCF_UTFWK_ATTR_OTA_BY_OP;
+        ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+        ota_input.sim_id = 0;
+        ota_input.sbp_id = 1;
+        strcpy(ota_input.mcc, "111");
+        strcpy(ota_input.mnc, "222");
+        getcwd(ota_data_path, sizeof(ota_data_path));
+        pos = strstr(ota_data_path, "mcu");
+        kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MTK_OPOTA_SBPID_1.mcfopota", '\0');
+        ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+        strcpy(ota_input.input_mode.file_path_name, ota_data_path);
+        
+        ret = mcf_utfwk_initial_env(ota_input);
+        if (ret == KAL_FALSE){
+            return ret;    
+        }
+        
+        // Register a UT DSBP callback
+        mcf_utfwk_initial_dsbp_callback(mcf_utfwk_sample_code_dsbp_callback);
+        
+        /* Step2 : Execute MCF & configure your test case */
+        mcf_utfwk_execute();
+        
+        /* Step3 : Check test result */
+        // Already get value in DSBP callback function
+        if(lid_buffer.val_byte_11 != 12) // we set val_byte_11 = 12 in MTK_OPOTA_SBPID_1.mcfota
+        {
+            ret = KAL_FALSE;
+            return ret;
+        }
+        
+        // Step4 : Check dump result
+        if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_LID, (kal_uint8 *)&dump_buffer, sizeof(lid_buffer), 0, "") != KAL_TRUE){
+            ret = KAL_FALSE;
+            return ret;
+        }
+        if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+           ret = KAL_FALSE;
+           return ret;
+        }
+        
+        // Step5 : Reset test environment
+        mcf_utfwk_reset();
+    }
+    
+    // SIM2
+    {
+        /* Step1 : Initial MCF environment */
+        mcf_utfwk_sample_code_initial_enviroment();
+        
+        // Set sbp_id =2, mcc = 222, mnc = 333, val_short_11 = 5566 in MTK_OPOTA_SBPID_2.mcfota
+        ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+        ota_input.lid_cnt = 1;
+        ota_input.ota_type = MCF_UTFWK_ATTR_OTA_BY_OP;
+        ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+        ota_input.sim_id = 1;
+        ota_input.sbp_id = 2;
+        strcpy(ota_input.mcc, "222");
+        strcpy(ota_input.mnc, "333");
+        getcwd(ota_data_path, sizeof(ota_data_path));
+        pos = strstr(ota_data_path, "mcu");
+        kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MTK_OPOTA_SBPID_2.mcfopota", '\0');
+        ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+        strcpy(ota_input.input_mode.file_path_name, ota_data_path);
+        
+        ret = mcf_utfwk_initial_env(ota_input);
+        if (ret == KAL_FALSE){
+            return ret;    
+        }
+        
+        // Register a UT DSBP callback
+        mcf_utfwk_initial_dsbp_callback(mcf_utfwk_sample_code_dsbp_callback);
+        
+        /* Step2 : Execute MCF & configure your test case */
+        mcf_utfwk_execute();
+        
+        /* Step3 : Check test result */
+        // Already get value in DSBP callback function
+        if(lid_buffer.val_short_11 != 5566) // we set val_short_11 = 5566 in MTK_OPOTA_SBPID_2.mcfota
+        {
+            ret = KAL_FALSE;
+            return ret;
+        }
+        
+        // Step4 : Check dump result
+        if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_LID, (kal_uint8 *)&dump_buffer, sizeof(lid_buffer), 0, "") != KAL_TRUE){
+           ret = KAL_FALSE;
+           return ret; 
+        }
+        if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+           ret = KAL_FALSE;
+           return ret;
+        }
+        
+        // Step5 : Reset test environment
+        mcf_utfwk_reset();
+    }
+    
+    return KAL_TRUE;
+}
+
+// 2-5. Get OTA by OP value from General OTA file(Get by API, Get OTA value from OTA file)
+// Brief:  Config a general ota file (not set SBP ID in MTK_OPOTA_GENERAL_ut_gid.mcfopota), and get the value by mcc & mnc only,
+//           check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_2_5()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    // Set mcc = 111, mnc = 222, val_byte_11 = 12 in MTK_OPOTA_GENERAL_ut_gid.mcfopota, and NOT SET SBP ID
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA_BY_OP;
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    ota_input.sim_id = 0;
+    ota_input.sbp_id = 5; // it means any SBP ID
+    strcpy(ota_input.mcc, "111");
+    strcpy(ota_input.mnc, "222");
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MTK_OPOTA_GENERAL.mcfopota", '\0');
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    strcpy(ota_input.input_mode.file_path_name, ota_data_path);
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;    
+    }
+    
+    // Register a UT DSBP callback
+    mcf_utfwk_initial_dsbp_callback(mcf_utfwk_sample_code_dsbp_callback);
+    
+    /* Step2 : Execute MCF & configure your test case */
+    mcf_utfwk_execute();
+    
+    /* Step3 : Check test result */
+    // Already get value in DSBP callback function
+    if(lid_buffer.val_byte_11 != 12) // we set val_byte_11 = 12 in MTK_OPOTA_GENERAL.mcfopota
+    {
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    // Step4 : Check dump result
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_LID, 1, MCF_UTFWK_DUMP_LID, (kal_uint8 *)&dump_buffer, sizeof(lid_buffer), 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return ret;
+    }
+    if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+       ret = KAL_FALSE;
+       return ret;
+    }
+
+    // Step5 : Reset test environment
+    mcf_utfwk_reset();
+
+    return KAL_TRUE;
+}
+
+// 3-1. Get OTA by Query value (Get by API, Get OTA value from OTA file)    
+// Brief:  Initial OTA by Query value from MCF_OTA_QUERY_ut_gid_normal.mcfota, 
+//          after executed, use MCF Query API to get the value, and then check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_3_1()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    mcf_ota_result_e mcf_ret;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_QUERY_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    // Set val_byte_11 = 6 in MCF_OTA_QUERY_ut_gid_normal.mcfota
+    getcwd(ota_data_path, sizeof(ota_data_path));
+    pos = strstr(ota_data_path, "mcu");
+    kal_sprintf(pos + strlen("mcu"), "\\%s\\%s%c", MCF_UT_DB_FOLDER_PATH, "MCF_OTA_QUERY_ut_gid_normal.mcfota", '\0');
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    strcpy(ota_input.input_mode.file_path_name, ota_data_path);
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;    
+    }
+    
+    /* Step2 : Execute MCF & configure your test case */
+    mcf_utfwk_execute();
+    
+    /* Step3 : Check test result */
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&lid_buffer, sizeof(lid_buffer));
+    if(mcf_ret != MCF_OTA_R_SUCCESS) return KAL_FALSE;
+
+    if(lid_buffer.val_byte_11 != 6) // we set OTA value =6 in MCF_OTA_QUERY_ut_gid_normal.mcfota
+    {
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    // Step4 : Check dump result
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, MCF_UTFWK_DUMP_LID, (kal_uint8 *)&dump_buffer, sizeof(lid_buffer), 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return ret;
+    }
+    if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+       ret = KAL_FALSE;
+       return ret;
+    }
+
+    // Step5 : Reset test environment
+    mcf_utfwk_reset();
+
+    return KAL_TRUE;
+}
+
+// 3-2. Get OTA by Query value (Get by API, Get OTA value from runtime created file)
+// Brief:  Initial OTA by Query value by config variable method, 
+//          after executed, use MCF Query API to get the value, and then check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_3_2()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    mcf_ota_result_e mcf_ret;
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_QUERY_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    // Set val_byte_11 = 12 and val_byte_12 = 5566
+    ota_input.input_op = MCF_UTFWK_OTA_VARIABLE_CONFIG;
+    {
+        MCF_UTFWK_INPUT_VAR mcf_utfwk_config_variable_struct     var_arr[2];
+        MCF_UTFWK_INPUT_VAR kal_uint32    value1, value2;
+
+        kal_mem_set(&var_arr, 0, sizeof(mcf_utfwk_config_variable_struct)*2);
+        //val_byte_11
+        var_arr[0].gid = MCF_TEST_OTA_QUERY_LID_BASE_GID+44;
+        value1 = 12;
+        var_arr[0].value = &value1;
+        var_arr[0].value_len = 1;
+        var_arr[0].rec_id = 1;
+        //val_short_11
+        var_arr[1].gid = MCF_TEST_OTA_QUERY_LID_BASE_GID+56;
+        value2 = 5566;
+        var_arr[1].value = &value2;
+        var_arr[1].value_len = 2;
+        var_arr[1].rec_id = 1;
+        ota_input.input_mode.var_info.var = var_arr;
+        ota_input.input_mode.var_info.var_cnt = 2;
+    }
+    
+    ret = mcf_utfwk_initial_env(ota_input);
+    if (ret == KAL_FALSE){
+        return ret;    
+    }
+    /* Step2 : Execute MCF & configure your test case */
+    mcf_utfwk_execute();
+    
+    /* Step3 : Check test result */
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&lid_buffer, sizeof(lid_buffer));
+    if(mcf_ret != MCF_OTA_R_SUCCESS) return KAL_FALSE;
+
+    if(lid_buffer.val_byte_11 != 12 || lid_buffer.val_short_11 != 5566) 
+    {
+        ret = KAL_FALSE;
+        return ret;
+    }
+
+    // Step4 : Check dump result
+    if(mcf_utfwk_dump_result(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, MCF_UTFWK_DUMP_LID, (kal_uint8 *)&dump_buffer, sizeof(lid_buffer), 0, "") != KAL_TRUE){
+        ret = KAL_FALSE;
+        return ret;
+    }
+    if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+       ret = KAL_FALSE;
+       return ret;
+    }
+
+    // Step5 : Reset test environment
+    mcf_utfwk_reset();
+
+    return KAL_TRUE;
+}
+
+// 3-3. Get OTA by Query value (Get by ILM, Get OTA value from runtime created file)
+// Brief: Use MCF UT FWK ILM function to initial OTA by Query value by config variable method, 
+//          after executed, use MCF Query API to get the value, and then check the value and dump value.
+static kal_bool mcf_utfwk_sample_code_TC_3_3()
+{
+    MCF_UTFWK_INPUT_VAR mcf_utfwk_ota_input_struct ota_input;
+    kal_bool ret = KAL_FALSE;
+    char* pos = 0;
+    char ota_data_path[512] = {'\0'};
+    ilm_struct  current_ilm;
+    mcf_ota_result_e mcf_ret;
+    
+    /* Step1 : Initial MCF environment */
+    mcf_utfwk_sample_code_initial_enviroment();
+    
+    ota_input.lid[0] = NVRAM_EF_MCF_TEST_OTA_QUERY_LID;
+    ota_input.lid_cnt = 1;
+    ota_input.ota_type = MCF_UTFWK_ATTR_OTA;
+    ota_input.input_op = MCF_UTFWK_OTA_FILE_PATH;
+    // Set val_byte_11 = 12 and val_byte_12 = 5566
+    ota_input.input_op = MCF_UTFWK_OTA_VARIABLE_CONFIG;
+    {
+        MCF_UTFWK_INPUT_VAR mcf_utfwk_config_variable_struct     var_arr[2];
+        MCF_UTFWK_INPUT_VAR kal_uint32    value1, value2;
+
+        kal_mem_set(&var_arr, 0, sizeof(mcf_utfwk_config_variable_struct)*2);
+        //val_byte_11
+        var_arr[0].gid = MCF_TEST_OTA_QUERY_LID_BASE_GID+44;
+        value1 = 12;
+        var_arr[0].value = &value1;
+        var_arr[0].value_len = 1;
+        var_arr[0].rec_id = 1;
+        //val_short_11
+        var_arr[1].gid = MCF_TEST_OTA_QUERY_LID_BASE_GID+56;
+        value2 = 5566;
+        var_arr[1].value = &value2;
+        var_arr[1].value_len = 2;
+        var_arr[1].rec_id = 1;
+        ota_input.input_mode.var_info.var = var_arr;
+        ota_input.input_mode.var_info.var_cnt = 2;
+    }
+    
+    // Send ILM to initial envirement
+    {
+        mcf_utfwk_initial_env_req_struct *req;
+        mcf_utfwk_initial_env_resp_struct *resp;
+
+        req = (mcf_utfwk_initial_env_req_struct *)construct_local_para(sizeof(mcf_utfwk_initial_env_req_struct), TD_RESET);
+        if (!req) {
+            ASSERT(0);
+        }
+
+        req->ota_input= ota_input;
+        
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_INITIAL_ENV_REQ, /* msg_id */
+               (local_para_struct*)req, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        resp = (mcf_utfwk_initial_env_resp_struct *)current_ilm.local_para_ptr;
+        ret = resp->result;
+        if(ret == KAL_FALSE)
+        {
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+    
+    /* Step2 : Execute MCF & configure your test case */
+    {
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_EXECUTE_REQ, /* msg_id */
+               NULL, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        if(current_ilm.msg_id != MSG_ID_MCF_UTFWK_EXECUTE_RESP){
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+    
+    /* Step3 : Check test result */
+    mcf_ret = mcf_read_ota_buffer(NVRAM_EF_MCF_TEST_OTA_QUERY_LID, 1, (kal_uint8 *)&lid_buffer, sizeof(lid_buffer));
+    if(mcf_ret != MCF_OTA_R_SUCCESS) return KAL_FALSE;
+
+    if(lid_buffer.val_byte_11 != 12 || lid_buffer.val_short_11 != 5566) 
+    {
+        return KAL_FALSE;
+    }
+    
+    // Step4 : Check dump result
+    {
+        mcf_utfwk_dump_result_req_struct   *req;
+        mcf_utfwk_dump_result_resp_struct   *resp;
+
+        req = (mcf_utfwk_dump_result_req_struct *)construct_local_para(sizeof(mcf_utfwk_dump_result_req_struct), TD_RESET);
+        if (! req) {
+            ASSERT(0);
+        }
+
+        req->lid = NVRAM_EF_MCF_TEST_OTA_QUERY_LID;
+        req->rec_id = 1;
+        req->dump_type = MCF_UTFWK_DUMP_LID;
+        req->buffer = (kal_uint8 *)&dump_buffer;
+        req->size = sizeof(dump_buffer);
+        req->gid = 0;
+        req->array_index = "";
+        
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_DUMP_RESULT_REQ, /* msg_id */
+               (local_para_struct*)req, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        resp = (mcf_utfwk_dump_result_resp_struct *)current_ilm.local_para_ptr;
+        ret = resp->result;
+        if(ret == KAL_FALSE)
+        {
+            destroy_ilm(&current_ilm);
+            return ret;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+        
+        if(kal_mem_cmp((char *)&dump_buffer, (char *)&lid_buffer, sizeof(lid_buffer)) != 0){
+           return KAL_FALSE;
+        }
+    }
+    
+
+    // Step5 : Reset test environment
+    {
+        /* Send process result to ATCI */
+        msg_send6(kal_get_active_module_id(), /* src_mod_id */
+                MOD_MCF, /* dest_mod_id */
+                MCF_UTFWK_SAP, /* sap_id */
+                MSG_ID_MCF_UTFWK_RESET_REQ, /* msg_id */
+               NULL, /* local_para_ptr */
+               NULL); /* peer_buff_ptr */
+               
+        msg_receive_extq(&current_ilm);
+        if(current_ilm.msg_id != MSG_ID_MCF_UTFWK_RESET_RESP){
+            destroy_ilm(&current_ilm);
+            return KAL_FALSE;
+        }else{
+            destroy_ilm(&current_ilm);
+        }
+    }
+
+    return KAL_TRUE;
+}
+
+kal_bool mcf_utfwk_sample_code_start_ut()
+{
+    if(mcf_utfwk_sample_code_TC_1_1() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_1_2() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_1_3() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_2_1() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_2_2() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_2_3() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_2_4() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_2_5() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_3_1() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_3_2() == KAL_FALSE) {return KAL_FALSE;}
+    if(mcf_utfwk_sample_code_TC_3_3() == KAL_FALSE) {return KAL_FALSE;}
+    
+    return KAL_TRUE;
+}
+
+#endif
diff --git a/mcu/service/mcf/src/mcf_util.c b/mcu/service/mcf/src/mcf_util.c
new file mode 100644
index 0000000..67e15a8
--- /dev/null
+++ b/mcu/service/mcf/src/mcf_util.c
@@ -0,0 +1,3978 @@
+/*****************************************************************************
+*  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_util.c
+ *
+ * Project:
+ * --------
+ *   UMOLYA
+ *
+ * Description:
+ * ------------
+ *   MD Configuration Framework internal utility.
+ *
+ * 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!
+ * 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!!
+ *==============================================================================
+ *******************************************************************************/
+
+#include "kal_public_api.h"
+#include "fs_general_api.h"
+
+#include "mcf_custom.h"
+#include "mcf_defs.h"
+#include "mcf_debug.h"
+#include "mcf_struct.h"
+#include "mcf_util.h"
+#include "mcf_object.h"
+#include "cust_chl_interface.h"
+#include "us_timer.h"
+#include <stdarg.h>
+#include "sleepdrv_interface.h" 
+
+/*------------------------------------------------------------------------------
+ * Global variables.
+ *----------------------------------------------------------------------------*/
+mcf_t               mcf_inst_g;
+kal_enhmutexid      mcf_enhmutex_g = NULL;
+event_scheduler    *mcf_timer_es_g = NULL;
+eventid             mcf_timer_eventid_g = NULL;
+mcf_common_t        com_Mcf;
+kal_enhmutexid      mcf_utfwk_enhmutex_g = NULL;
+mcf_file_info_t     new_file_info;
+mcf_file_info_t     old_file_info;
+
+#undef BOOT_TRC_MSG
+#define BOOT_TRC_MSG(_name,_format) {_format},
+static MCF_BOOT_LOG boot_trace_format[] = 
+{
+    #include "mcf_boot_trace.h"
+};
+
+/*------------------------------------------------------------------------------
+ * Helper macro.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Private data structure.
+ *----------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------------
+ * Private variables.
+  *----------------------------------------------------------------------------*/
+static KAL_ADM_ID mcf_mem_id = NULL;
+static kal_uint8  mcf_mem_pool[MCF_MAX_MEM_MALLOC_SIZE];
+static kal_bool   mcf_mem_init_flag = KAL_FALSE;
+/*------------------------------------------------------------------------------
+ * Private fucntions.
+ *----------------------------------------------------------------------------*/
+extern kal_char* release_verno(void);
+extern kal_char* build_date_time(void);
+/*------------------------------------------------------------------------------
+ * Public fucntions.
+ *----------------------------------------------------------------------------*/
+#if !defined(__HIF_CCCI_SUPPORT__) || !defined(__MTK_TARGET__)
+kal_int32 MCF_dummy_FS_CMPT_Read(const WCHAR * FileName, NVRAM_FS_PARAM_CMPT_T* nvram_param)
+{
+	return FS_NO_ERROR;
+}
+#include <stdio.h>
+#include <windows.h>
+kal_int32 MCF_Win_FS_CMPT_Read(const WCHAR * FileName, NVRAM_FS_PARAM_CMPT_T* nvram_param)
+{
+    char fname[MCF_FILE_MAX_NAME_LEN] = { 0 };
+	char fullpath[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN] = { 0 };
+    kal_uint32 i = 0;
+    FILE *fd = NULL;
+    if (mcf_utfwk_is_working_status == KAL_TRUE){
+        return FS_NO_ERROR;
+    }
+    
+    // translate wchar to char
+    WCHAR *ptr = FileName; // skip drive "S:"
+    while (*ptr != NULL) {
+        fname[i++] = (char)*ptr;
+        ptr++;
+    }
+	
+	if (GetModuleFileName(NULL, fullpath, MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN) != NULL) {
+		char *pch = strrchr(fullpath, '\\');
+		*(++pch) = 0;
+		strncat(fullpath, fname, MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN - 1);
+	}
+	else {
+		return FS_FILE_NOT_FOUND;
+	}
+    
+    // due to open & close operation are must, so always open & close file (ignore CCCI_FS_CMPT_OPEN & CCCI_FS_CMPT_CLOSE)
+    fd = fopen(fullpath, "rb");
+    if (fd == NULL)
+        return FS_FILE_NOT_FOUND;
+    //get file size
+    if (nvram_param->opid_map & CCCI_FS_CMPT_GETFILESIZE)
+    {
+        fseek(fd, 0, SEEK_END);
+        *nvram_param->FileSize = ftell(fd);
+        fseek(fd, 0, SEEK_SET);
+    }
+    // seek
+    if (nvram_param->opid_map & CCCI_FS_CMPT_SEEK)
+    {
+        fseek(fd, nvram_param->Offset, nvram_param->Whence);
+    }
+    // read
+    if (nvram_param->opid_map & CCCI_FS_CMPT_READ)
+    {
+		if (nvram_param->DataPtr != NULL) {
+			*nvram_param->Read = fread(nvram_param->DataPtr, nvram_param->Length, 1, fd);
+		}
+    }
+    fclose(fd);
+    return FS_NO_ERROR;
+}
+#endif
+
+void mcf_mem_init(void)
+{
+    if (mcf_mem_init_flag == KAL_FALSE)
+    {
+        mcf_mem_id = kal_adm_create((void*)mcf_mem_pool, sizeof(mcf_mem_pool), NULL, KAL_FALSE);
+        mcf_mem_init_flag = KAL_TRUE;
+    }
+}
+
+void *mcf_malloc(unsigned int size)
+{
+    mcf_mem_init();
+    if (NULL != mcf_mem_id) {
+        void *ret = kal_adm_alloc(mcf_mem_id, size);
+        if(ret == NULL)
+        {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_ALLOC_MEM_ERROR);
+            MD_TRC_MCF_TR_ALLOC_MEM_ERROR();
+        }
+        return ret;
+    }
+    return NULL;
+}
+
+void mcf_free(void *ptr)
+{
+    if (NULL == mcf_mem_id) {
+        return;
+    }
+    kal_adm_free(mcf_mem_id, ptr);
+}
+
+void mcf_create_custom_folder(mcf_t *pMcf)
+{
+    kal_wchar   foldername[MCF_FILE_MAX_MD_PATH_LEN] = {0};
+    kal_int32   fs_api_ret;
+
+    kal_wsprintf(foldername, "%s\0", MCF_FS_CUSTOM_FOLDER_PATH);
+    fs_api_ret = FS_CreateDir(foldername);
+    if (fs_api_ret < FS_NO_ERROR) {
+        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_CREATE_CUSTOM_FOLDER_FAIL;
+        MCF_BOOT_TRACE(MCF_BOOT_TR_CREATE_CUSTOM_FOLDER_FAIL, MCF_FS_CUSTOM_FOLDER_PATH, fs_api_ret);
+    }
+
+    return;
+}
+
+mcf_ota_result_e mcf_read_ota_file(
+    kal_bool                is_booting,
+    kal_char               *req_fs_root_path,
+    kal_char               *req_file_path_name,
+    l4c_mcf_path_type_enum *apply_path_type,
+    kal_char               *apply_filename,
+    mcf_t                  *pMcf)
+{
+    NVRAM_FS_PARAM_CMPT_T   fs_cmpt;
+    FS_FileDetail           fs_file_detail[L4C_MCF_PATH_TYPE_MAX] = {0};
+    kal_uint32              read_byte = 0;
+    kal_uint32              file_size = 0;
+    mcf_ota_result_e        ret = MCF_OTA_R_SUCCESS;
+    mcf_ota_file_t         *ota_file = &(pMcf->ota_file);
+    kal_wchar               filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+    mcf_tool_file_info_t   *pFile;
+    kal_char                password[MCF_MAX_PASSWORD_LEN] = {0};
+    kal_bool                is_get_custom_filename = KAL_FALSE;
+    kal_bool                is_default_path;
+    kal_uint32              dummy_para;
+    kal_int32               fs_api_ret[L4C_MCF_PATH_TYPE_MAX];
+    kal_uint64              last_mod_time = 0;
+    kal_char                default_file_name_tag[30];
+    kal_uint64              ini_path_ota_file_last_mod_time = 0;
+    kal_uint64              ini_path_runtime_file_last_mod_time = 0;
+    kal_char                ini_root_path[20];
+
+    fs_cmpt.opid_map = NVRAM_FS_CMPT_OPEN | NVRAM_FS_CMPT_GETFILESIZE | NVRAM_FS_CMPT_CLOSE;
+    fs_cmpt.Flag = FS_READ_ONLY;
+    fs_cmpt.Length = 0;
+    fs_cmpt.Offset = 0;
+    fs_cmpt.Whence = FS_FILE_BEGIN;
+    fs_cmpt.DataPtr = &dummy_para;
+    fs_cmpt.Read = &dummy_para;
+    fs_cmpt.FileSize = &file_size;
+
+    if ( (strcmp(req_fs_root_path, "") != 0) && (strcmp(req_file_path_name, "") != 0) ) {
+        if (strcmp(req_fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH) == 0) {
+            *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+        } else if (strcmp(req_fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH) == 0) {
+            *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+        }else{
+            MD_TRC_MCF_TR_READ_OTA_FILE_INVALID_PATH(req_fs_root_path);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+
+            return ret;
+        }
+        kal_wsprintf(filename, "%s\\%s\0", req_fs_root_path, req_file_path_name);
+        strncpy(apply_filename, req_file_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        is_default_path = KAL_FALSE;
+    } else {
+        is_get_custom_filename = mcf_get_custom_file_path_name((kal_uint8 *)apply_path_type, apply_filename);
+        strncpy(default_file_name_tag, "Default_OTA_File_Name", 29);
+        if (is_get_custom_filename == KAL_TRUE) {
+            if (*apply_path_type >= L4C_MCF_PATH_TYPE_MAX || *apply_path_type < 0) {
+                MD_TRC_MCF_TR_READ_OTA_FILE_INVALID_PATH_TYPE(*apply_path_type);
+                ret = MCF_OTA_R_INVALID_PARAMETER;
+
+                return ret;
+            }
+
+            if (*apply_path_type == L4C_MCF_PATH_TYPE_OTA) {
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, apply_filename);
+            } else if (*apply_path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, apply_filename);
+            }
+        }
+        else {
+            /* Try to read default ota file name in INI file */
+            /* Compare modified time of ini file to select which file to be applied */
+            if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ini_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                ini_path_ota_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_READ_OTA_FILE_READ_INI_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if (mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ini_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    ini_path_runtime_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_READ_OTA_FILE_READ_INI_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                }    
+            }
+
+            if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_RUNTIME, &ini_path_runtime_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                ini_path_runtime_file_last_mod_time = 0;
+                MD_TRC_MCF_TR_READ_OTA_FILE_READ_INI_FILE_FAIL(L4C_MCF_PATH_TYPE_RUNTIME, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                
+                if(mcf_get_file_last_mod_time (MCF_FS_DEFAULT_INI_FILE_NAME, L4C_MCF_PATH_TYPE_OTA, &ini_path_ota_file_last_mod_time) == MCF_OTA_R_READ_OTA_FILE_FAIL){
+                    ini_path_ota_file_last_mod_time = 0;
+                    MD_TRC_MCF_TR_READ_OTA_FILE_READ_INI_FILE_FAIL(L4C_MCF_PATH_TYPE_OTA, MCF_OTA_R_READ_OTA_FILE_FAIL);
+                }
+            }
+
+            kal_mem_set(ini_root_path,0,20);
+            if (ini_path_ota_file_last_mod_time > ini_path_runtime_file_last_mod_time){
+                strncpy(ini_root_path,MCF_FS_DEFAULT_FOLDER_PATH, 19);
+            }else{
+               strncpy(ini_root_path,MCF_FS_CUSTOM_FOLDER_PATH, 19);
+            }
+            if (mcf_read_ini_file(ini_root_path , MCF_FS_DEFAULT_INI_FILE_NAME, apply_path_type, apply_filename, pMcf) == MCF_OTA_R_SUCCESS &&
+                    mcf_find_ini_item((kal_char *)pMcf->ini_file.buff, default_file_name_tag, apply_filename, pMcf) == KAL_TRUE && strcmp(apply_filename, "") != 0) {
+                strncat (apply_filename,".mcfota", MCF_FILE_MAX_NAME_LEN - 1);
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, apply_filename);
+                MCF_BOOT_TRACE(MCF_BOOT_TR_DO_OTA_FULL_GET_DEFAULT_OTA_FILE_NAME_FROM_INI, apply_filename);
+                
+            }else{
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_DEFAULT_OTA_FILE_NAME);
+                strncpy(apply_filename, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+            }
+            
+            /* Compare modified time of OTA file to select which file to be applied */
+            fs_api_ret[L4C_MCF_PATH_TYPE_OTA] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_OTA]);
+            MD_TRC_MCF_TR_READ_OTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_OTA, fs_api_ret[L4C_MCF_PATH_TYPE_OTA],
+                            (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime & 0xFFFFFFFF));
+            if (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] != FS_NO_ERROR) {
+                kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_OTA], 0, sizeof(FS_FileDetail));
+            }
+            
+            kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_OTA_FILE_NAME);
+            fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME]);
+            MD_TRC_MCF_TR_READ_OTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_RUNTIME, fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME],
+                            (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime & 0xFFFFFFFF));
+            if (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] != FS_NO_ERROR) {
+                kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME], 0, sizeof(FS_FileDetail));
+            }
+
+            if ( (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] == FS_NO_ERROR) || (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] == FS_NO_ERROR) ) {
+                if (fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime > fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime) {
+                    *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+                    kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, apply_filename);
+                } else {
+                    *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+                    kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_OTA_FILE_NAME);
+                }
+            } else {
+                if (is_booting == KAL_TRUE) {
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL;
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_COMPARE_FAIL);
+                }
+                MD_TRC_MCF_TR_READ_OTA_FILE_COMPARE_FAIL();
+                ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                return ret;
+            }
+            
+        }
+        is_default_path = KAL_TRUE;
+    }
+
+    fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+    if (fs_api_ret[0] < FS_NO_ERROR) {
+        if (is_booting == KAL_TRUE) {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_FAIL, *apply_path_type, fs_api_ret[0]);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+        }
+        MD_TRC_MCF_TR_READ_OTA_FILE_FAIL(*apply_path_type, fs_api_ret[0]);
+        dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+
+        /* If cannot read given OTA file, read default OTA file */
+        if (is_default_path == KAL_FALSE) {
+            is_get_custom_filename = mcf_get_custom_file_path_name((kal_uint8 *)apply_path_type, apply_filename);
+            if (*apply_path_type >= L4C_MCF_PATH_TYPE_MAX || *apply_path_type < 0) {
+                MD_TRC_MCF_TR_READ_OTA_FILE_INVALID_PATH_TYPE(*apply_path_type);
+                ret = MCF_OTA_R_INVALID_PARAMETER;
+
+                return ret;
+            }
+
+            if (is_get_custom_filename == KAL_TRUE) {
+                if (*apply_path_type == L4C_MCF_PATH_TYPE_OTA) {
+                    kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, apply_filename);
+                } else if (*apply_path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                    kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, apply_filename);
+                }
+            } else {
+                /* Compare modified time of OTA file to select which file to be applied */
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_DEFAULT_OTA_FILE_NAME);
+                fs_api_ret[L4C_MCF_PATH_TYPE_OTA] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_OTA]);
+                MD_TRC_MCF_TR_READ_OTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_OTA, fs_api_ret[L4C_MCF_PATH_TYPE_OTA],
+                                (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime & 0xFFFFFFFF));
+                if (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] != FS_NO_ERROR) {
+                    kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_OTA], 0, sizeof(FS_FileDetail));
+                }
+
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_OTA_FILE_NAME);
+                fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME]);
+                MD_TRC_MCF_TR_READ_OTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_RUNTIME, fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME],
+                                (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime & 0xFFFFFFFF));
+                if (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] != FS_NO_ERROR) {
+                    kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME], 0, sizeof(FS_FileDetail));
+                }
+
+                if ( (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] == FS_NO_ERROR) || (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] == FS_NO_ERROR) ) {
+                    if (fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime > fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime) {
+                        *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+                        kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_DEFAULT_OTA_FILE_NAME);
+                    } else {
+                        *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+                        kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_OTA_FILE_NAME);
+                    }
+                } else {
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_COMPARE_FAIL);
+                    }
+                    MD_TRC_MCF_TR_READ_OTA_FILE_COMPARE_FAIL();
+                    ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                    return ret;
+                }
+ 
+                strncpy(apply_filename, MCF_FS_DEFAULT_OTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+
+            }
+
+            fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+            if (fs_api_ret[0] < FS_NO_ERROR) {
+                if (is_booting == KAL_TRUE) {
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL;
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_FAIL, *apply_path_type, fs_api_ret[0]);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+                }
+                MD_TRC_MCF_TR_READ_OTA_FILE_FAIL(*apply_path_type, fs_api_ret[0]);
+                dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+                ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                return ret;
+            }
+        } else {
+            ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+            return ret;
+        }
+    }
+
+    if (file_size > MCF_MAX_OTA_FILE_SIZE) {
+        if (is_booting == KAL_TRUE) {
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_OTA_FILE_OVERSIZE;
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_OVERSIZE, file_size, MCF_MAX_OTA_FILE_SIZE);
+        }
+        MD_TRC_MCF_TR_READ_OTA_FILE_OVERSIZE(file_size, MCF_MAX_OTA_FILE_SIZE);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+        return ret;
+    }
+
+    /* Read file */
+    fs_cmpt.opid_map = NVRAM_FS_CMPT_OPEN | NVRAM_FS_CMPT_READ | NVRAM_FS_CMPT_CLOSE;
+    fs_cmpt.Flag = FS_READ_ONLY;
+    fs_cmpt.Length = file_size;
+    fs_cmpt.Offset = 0;
+    fs_cmpt.Whence = FS_FILE_BEGIN;
+    fs_cmpt.DataPtr = ota_file->buff;
+    fs_cmpt.Read = &read_byte;
+    fs_cmpt.FileSize = &dummy_para;
+    
+    fs_api_ret[*apply_path_type] = FS_GetFileDetail(filename, &fs_file_detail[*apply_path_type]);
+    MD_TRC_MCF_TR_READ_OTA_FILE_MODIFIED_TIME(*apply_path_type, fs_api_ret[*apply_path_type],
+                     (kal_uint32)((fs_file_detail[*apply_path_type].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[*apply_path_type].LastStatusChangeTime & 0xFFFFFFFF));
+    if (fs_api_ret[*apply_path_type] == FS_NO_ERROR) {
+        last_mod_time = fs_file_detail[*apply_path_type].LastStatusChangeTime;
+    } else {
+        if (is_booting == KAL_TRUE) {
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL;
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_FAIL, *apply_path_type, fs_api_ret[*apply_path_type]);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+        }
+        MD_TRC_MCF_TR_READ_OTA_FILE_FAIL(*apply_path_type, fs_api_ret[*apply_path_type]);
+        dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+        return ret;
+    }
+
+    MCF_W_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+        if (fs_api_ret[0] < FS_NO_ERROR) {
+            MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+            if (is_booting == KAL_TRUE) {
+                com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL;
+                MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_FAIL, *apply_path_type, fs_api_ret[0]);
+                MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+            }
+            MD_TRC_MCF_TR_READ_OTA_FILE_FAIL(*apply_path_type, fs_api_ret[0]);
+            dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+            ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+            return ret;
+        }
+
+        pFile = (mcf_tool_file_info_t *)(ota_file->buff);
+#ifdef __MCF_FIND_TAG_SUPPORT__
+        if (pFile->file_version == 2 || pFile->file_version == 3) { 
+#else
+        if (pFile->file_version == 3) {
+#endif
+            kal_uint32 operation_mask = 0;
+            
+            /* Check custom operation mask */
+            operation_mask = mcf_get_custom_operation_mask();
+            if ((pFile->operation_mask & operation_mask) != operation_mask) {				
+                if (is_booting == KAL_TRUE) {
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_OPERATION_MASK_FAIL;
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_OPERATION_MASK_FAIL, apply_filename, pFile->operation_mask, operation_mask);
+                }
+                MD_TRC_MCF_TR_READ_OTA_FILE_OPERATION_MASK_FAIL(apply_filename, pFile->operation_mask, operation_mask);
+                ret = MCF_OTA_R_INVALID_FILE;
+                
+                kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+                kal_mem_set(ota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                ota_file->path_type = 0;
+                ota_file->last_mod_time = 0;
+                MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+
+                return ret;
+			}
+            
+            /*  First check digest first 
+             *  If file is encrypted and has checksum.
+             *  Decrypt file before checking checksum.
+             */
+
+			 // RSA verify digest 
+			if ((pFile->operation_mask & MCF_FILE_OP_SHA256_RSA2048) != 0) {				
+
+				if (mcf_verify_digest(MCF_FILE_OP_SHA256_RSA2048, (mcf_tool_file_info_t *)(ota_file->buff), (mcf_digest *)(ota_file->buff + pFile->file_size)) != KAL_TRUE) {
+					kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+                    kal_mem_set(ota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    ota_file->path_type = 0;
+                    ota_file->last_mod_time = 0;
+					MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+					if (is_booting == KAL_TRUE) {
+						com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DIGEST_FAIL;
+						MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_DIGEST_FAIL, apply_filename);
+					}
+					MD_TRC_MCF_TR_READ_OTA_FILE_DIGEST_FAIL(apply_filename);
+					ret = MCF_OTA_R_DIGEST_FAIL;
+
+					return ret;
+				}
+
+			}
+
+			else if ((pFile->operation_mask & MCF_FILE_OP_SHA384_RSA3072) != 0) {
+
+				if (mcf_verify_digest(MCF_FILE_OP_SHA384_RSA3072, (mcf_tool_file_info_t *)(ota_file->buff), (mcf_digest *)(ota_file->buff + pFile->file_size)) != KAL_TRUE) {
+					kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+                    kal_mem_set(ota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    ota_file->path_type = 0;
+                    ota_file->last_mod_time = 0;
+					MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+					if (is_booting == KAL_TRUE) {
+						com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DIGEST_FAIL;
+						MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_DIGEST_FAIL, apply_filename);
+					}
+					MD_TRC_MCF_TR_READ_OTA_FILE_DIGEST_FAIL(apply_filename);
+					ret = MCF_OTA_R_DIGEST_FAIL;
+
+					return ret;
+				}
+
+			}
+
+            if ( (pFile->operation_mask & MCF_FILE_OP_AES_128) != 0) {
+                mcf_get_custom_aes_password(password);
+
+                if (mcf_decrypt_128bit(password, (kal_char *)(ota_file->buff + pFile->total_len), (pFile->file_size - pFile->total_len) ) != KAL_TRUE) {
+                    kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+                    kal_mem_set(ota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    ota_file->path_type = 0;
+                    ota_file->last_mod_time = 0;
+                    MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DECRYPTION_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_DECRYPTION_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_OTA_FILE_DECRYPTION_FAIL(apply_filename);
+                    ret = MCF_OTA_R_DECRYPTION_FAIL;
+
+                    return ret;
+                }
+            }
+            // for AES_256  
+            else if ((pFile->operation_mask & MCF_FILE_OP_AES_256) != 0) {
+                mcf_get_custom_aes_password(password);
+                if (mcf_decrypt_256bit(password, (kal_char *)(ota_file->buff + pFile->total_len), (pFile->file_size - pFile->total_len)) != KAL_TRUE) {
+                    kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+                    kal_mem_set(ota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    ota_file->path_type = 0;
+                    ota_file->last_mod_time = 0;
+                    MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DECRYPTION_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_DECRYPTION_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_OTA_FILE_DECRYPTION_FAIL(apply_filename);
+                    ret = MCF_OTA_R_DECRYPTION_FAIL;
+
+                    return ret;
+                }
+            }
+
+            if ( (pFile->operation_mask & MCF_FILE_OP_CHECKSUM) != 0) {
+                if (mcf_check_check_sum((kal_uint32 *)(ota_file->buff), pFile->file_size) != 0) {
+                    kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+                    kal_mem_set(ota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    ota_file->path_type = 0;
+                    ota_file->last_mod_time = 0;
+                    MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_CHECKSUM_ERROR;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_CHECKSUM_ERROR, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_OTA_FILE_CHECKSUM_ERROR(apply_filename);
+                    ret = MCF_OTA_R_CHECKSUM_ERROR;
+
+                    return ret;
+                }
+            }
+        } else {
+            if (is_booting == KAL_TRUE) {
+                com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_INVALID_FILE;
+                MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_INVALID_FILE_VERSION, pFile->file_version);
+            }
+            MD_TRC_MCF_TR_READ_OTA_FILE_INVALID_FILE_VERSION(pFile->file_version);
+            kal_mem_set(ota_file->buff, 0, MCF_MAX_OTA_FILE_SIZE);
+            kal_mem_set(ota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+            ota_file->path_type = 0;
+            ota_file->last_mod_time = 0;
+            MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+            ret = MCF_OTA_R_INVALID_FILE;
+
+            return ret;
+        }
+
+        ota_file->path_type = *apply_path_type;
+        ota_file->last_mod_time = last_mod_time;   
+#if defined(__MCF_UT_FRAMEWORK_SUPPORT__)        
+        if (strcmp(ota_file->relative_path_name, "") == 0){
+            strncpy(ota_file->relative_path_name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+        }else{
+            strncpy(apply_filename, ota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        }
+#else
+        strncpy(ota_file->relative_path_name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+#endif 
+        MCF_W_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        if (is_booting == KAL_TRUE) {
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_TAKE_WRITE_LOCK_FAIL;
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_OTA_FILE_TAKE_WRITE_LOCK_FAIL, apply_filename, *apply_path_type);
+        }
+        MD_TRC_MCF_TR_READ_OTA_FILE_TAKE_WRITE_LOCK_FAIL(apply_filename, *apply_path_type);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+    }
+
+    return ret;
+}
+
+mcf_ota_result_e mcf_read_tlvota_file(
+    kal_bool                is_booting,
+    kal_uint8               sim_id,
+    kal_char               *req_fs_root_path,
+    kal_char               *req_file_path_name,
+    l4c_mcf_path_type_enum *apply_path_type,
+    kal_char               *apply_filename,
+    mcf_t                  *pMcf)
+{
+    NVRAM_FS_PARAM_CMPT_T   fs_cmpt;
+    FS_FileDetail           fs_file_detail[L4C_MCF_PATH_TYPE_MAX] = {0};
+    kal_uint32              read_byte = 0;
+    kal_uint32              file_size = 0;
+    mcf_ota_result_e        ret = MCF_OTA_R_SUCCESS;
+    mcf_tlvota_file_t      *tlvota_file = &(pMcf->tlvota_file[sim_id]);
+    kal_wchar               filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+    mcf_tool_file_info_t   *pFile;
+    kal_char                password[MCF_MAX_PASSWORD_LEN] = {0};
+    kal_bool                is_default_path;
+    kal_uint32              dummy_para;
+    kal_int32               fs_api_ret[L4C_MCF_PATH_TYPE_MAX];
+    kal_uint64              last_mod_time = 0;
+
+    fs_cmpt.opid_map = NVRAM_FS_CMPT_OPEN | NVRAM_FS_CMPT_GETFILESIZE | NVRAM_FS_CMPT_CLOSE;
+    fs_cmpt.Flag = FS_READ_ONLY;
+    fs_cmpt.Length = 0;
+    fs_cmpt.Offset = 0;
+    fs_cmpt.Whence = FS_FILE_BEGIN;
+    fs_cmpt.DataPtr = &dummy_para;
+    fs_cmpt.Read = &dummy_para;
+    fs_cmpt.FileSize = &file_size;
+
+    if ( (strcmp(req_fs_root_path, "") != 0) && (strcmp(req_file_path_name, "") != 0) ) {
+        if (strcmp(req_fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH) == 0) {
+            *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+        } else if (strcmp(req_fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH) == 0) {
+            *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+        } else{
+            MD_TRC_MCF_TR_READ_TLVOTA_FILE_INVALID_PATH(req_fs_root_path);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+
+            return ret;
+        }
+        kal_wsprintf(filename, "%s\\%s\0", req_fs_root_path, req_file_path_name);
+        strncpy(apply_filename, req_file_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        is_default_path = KAL_FALSE;
+    } else {
+        /* Compare modified time of OP-OTA file to select which file to be applied */
+        kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+        fs_api_ret[L4C_MCF_PATH_TYPE_OTA] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_OTA]);
+        MD_TRC_MCF_TR_READ_TLVOTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_OTA, fs_api_ret[L4C_MCF_PATH_TYPE_OTA],
+                         (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime & 0xFFFFFFFF));
+        if (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] != FS_NO_ERROR) {
+            kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_OTA], 0, sizeof(FS_FileDetail));
+        }
+
+        kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+        fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME]);
+        MD_TRC_MCF_TR_READ_TLVOTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_RUNTIME, fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME],
+                         (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime & 0xFFFFFFFF));
+        if (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] != FS_NO_ERROR) {
+            kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME], 0, sizeof(FS_FileDetail));
+        }
+
+        if ( (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] == FS_NO_ERROR) || (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] == FS_NO_ERROR) ) {
+            if (fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime > fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime) {
+                *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+            } else {
+                *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+            }
+        } else {
+            if (is_booting == KAL_TRUE) {
+                com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL;
+                MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_COMPARE_FAIL);
+            }
+            MD_TRC_MCF_TR_READ_TLVOTA_FILE_COMPARE_FAIL();
+            ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+            return ret;
+        }
+
+        strncpy(apply_filename, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+
+        is_default_path = KAL_TRUE;
+    }
+
+    fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+    if (fs_api_ret[0] < FS_NO_ERROR) {
+        if (is_booting == KAL_TRUE) {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_FAIL, *apply_path_type, sim_id, fs_api_ret[0]);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+        }
+        MD_TRC_MCF_TR_READ_TLVOTA_FILE_FAIL(*apply_path_type, sim_id, fs_api_ret[0]);
+        dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+
+        /* If cannot read given TLV-OTA file, read default TLV-OTA file */
+        if (is_default_path == KAL_FALSE) {
+            /* Compare modified time of OP-OTA file to select which file to be applied */
+            kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+            fs_api_ret[L4C_MCF_PATH_TYPE_OTA] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_OTA]);
+            MD_TRC_MCF_TR_READ_TLVOTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_OTA, fs_api_ret[L4C_MCF_PATH_TYPE_OTA],
+                             (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime & 0xFFFFFFFF));
+            if (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] != FS_NO_ERROR) {
+                kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_OTA], 0, sizeof(FS_FileDetail));
+            }
+
+            kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+            fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME]);
+            MD_TRC_MCF_TR_READ_TLVOTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_RUNTIME, fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME],
+                             (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime & 0xFFFFFFFF));
+            if (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] != FS_NO_ERROR) {
+                kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME], 0, sizeof(FS_FileDetail));
+            }
+
+            if ( (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] == FS_NO_ERROR) || (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] == FS_NO_ERROR) ) {
+                if (fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime > fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime) {
+                    *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+                    kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+                } else {
+                    *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+                    kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_DEFAULT_TLVOTA_FILE_NAME);
+                }
+            } else {
+                if (is_booting == KAL_TRUE) {
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL;
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_COMPARE_FAIL);
+                }
+                MD_TRC_MCF_TR_READ_TLVOTA_FILE_COMPARE_FAIL();
+                ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                return ret;
+            }
+
+            strncpy(apply_filename, MCF_FS_DEFAULT_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+
+            fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+            if (fs_api_ret[0] < FS_NO_ERROR) {
+                if (is_booting == KAL_TRUE) {
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_TLVOTA_FILE_FAIL;
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_FAIL, *apply_path_type, sim_id, fs_api_ret[0]);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+                }
+                MD_TRC_MCF_TR_READ_TLVOTA_FILE_FAIL(*apply_path_type, sim_id, fs_api_ret[0]);
+                dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+                ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                return ret;
+            }
+        } else {
+            ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+            return ret;
+        }
+    }
+
+    if (file_size > MCF_MAX_TLVOTA_FILE_SIZE) {
+        if (is_booting == KAL_TRUE) {
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_TLVOTA_FILE_OVERSIZE;
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_OVERSIZE, file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+        }
+        MD_TRC_MCF_TR_READ_TLVOTA_FILE_OVERSIZE(file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+        return ret;
+    }
+
+    /* Read file */
+    fs_cmpt.opid_map = NVRAM_FS_CMPT_OPEN | NVRAM_FS_CMPT_READ | NVRAM_FS_CMPT_CLOSE;
+    fs_cmpt.Flag = FS_READ_ONLY;
+    fs_cmpt.Length = file_size;
+    fs_cmpt.Offset = 0;
+    fs_cmpt.Whence = FS_FILE_BEGIN;
+    fs_cmpt.DataPtr = tlvota_file->buff;
+    fs_cmpt.Read = &read_byte;
+    fs_cmpt.FileSize = &dummy_para;
+
+    fs_api_ret[*apply_path_type] = FS_GetFileDetail(filename, &fs_file_detail[*apply_path_type]);
+    MD_TRC_MCF_TR_READ_TLVOTA_FILE_MODIFIED_TIME(*apply_path_type, fs_api_ret[*apply_path_type],
+                     (kal_uint32)((fs_file_detail[*apply_path_type].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[*apply_path_type].LastStatusChangeTime & 0xFFFFFFFF));
+    if (fs_api_ret[*apply_path_type] == FS_NO_ERROR) {
+        last_mod_time = fs_file_detail[*apply_path_type].LastStatusChangeTime;
+    } else {
+        if (is_booting == KAL_TRUE) {
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_TLVOTA_FILE_FAIL;
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_FAIL, *apply_path_type, sim_id, fs_api_ret[0]);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+        }
+        MD_TRC_MCF_TR_READ_TLVOTA_FILE_FAIL(*apply_path_type, sim_id, fs_api_ret[*apply_path_type]);
+        dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+        return ret;
+    }
+    
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+        if (fs_api_ret[0] < FS_NO_ERROR) {
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (is_booting == KAL_TRUE) {
+                com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_TLVOTA_FILE_FAIL;
+                MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_FAIL, *apply_path_type, sim_id, fs_api_ret[0]);
+                MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+            }
+            MD_TRC_MCF_TR_READ_TLVOTA_FILE_FAIL(*apply_path_type, sim_id, fs_api_ret[0]);
+            dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+            ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+            return ret;
+        }
+
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+#ifdef __MCF_FIND_TAG_SUPPORT__
+        if (pFile->file_version == 2 || pFile->file_version == 3) { 
+#else
+        if (pFile->file_version == 3) {
+#endif
+            kal_uint32 operation_mask = 0;
+            
+            /* Check custom operation mask */
+            operation_mask = mcf_get_custom_operation_mask();
+            if ((pFile->operation_mask & operation_mask) != operation_mask) {				
+                if (is_booting == KAL_TRUE) {
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_OPERATION_MASK_FAIL;
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_OPERATION_MASK_FAIL, apply_filename, pFile->operation_mask, operation_mask);
+                }
+                MD_TRC_MCF_TR_READ_TLVOTA_FILE_OPERATION_MASK_FAIL(apply_filename, pFile->operation_mask, operation_mask);
+                ret = MCF_OTA_R_INVALID_FILE;
+                
+                kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                tlvota_file->path_type = 0;
+                tlvota_file->last_mod_time = 0;
+                kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+                return ret;
+			}
+            
+            /*  First check digest first 
+             *  If file is encrypted and has checksum.
+             *  Decrypt file before checking checksum.
+             */
+              // RSA verify digest 
+            if ((pFile->operation_mask & MCF_FILE_OP_SHA256_RSA2048) != 0) {
+
+                if (mcf_verify_digest(MCF_FILE_OP_SHA256_RSA2048, (mcf_tool_file_info_t *)(tlvota_file->buff), (mcf_digest *)(tlvota_file->buff + pFile->file_size)) != KAL_TRUE) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DIGEST_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_DIGEST_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_TLVOTA_FILE_DIGEST_FAIL(apply_filename);
+                    ret = MCF_OTA_R_DIGEST_FAIL;
+
+                    return ret;
+                }
+
+            }
+            else if ((pFile->operation_mask & MCF_FILE_OP_SHA384_RSA3072) != 0) {
+
+                if (mcf_verify_digest(MCF_FILE_OP_SHA384_RSA3072, (mcf_tool_file_info_t *)(tlvota_file->buff), (mcf_digest *)(tlvota_file->buff + pFile->file_size)) != KAL_TRUE) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DIGEST_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_DIGEST_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_TLVOTA_FILE_DIGEST_FAIL(apply_filename);
+                    ret = MCF_OTA_R_DIGEST_FAIL;
+
+                    return ret;
+                }
+
+            }
+            
+            if ( (pFile->operation_mask & MCF_FILE_OP_AES_128) != 0) {
+                mcf_get_custom_aes_password(password);
+
+                if (mcf_decrypt_128bit(password, (kal_char *)(tlvota_file->buff + pFile->total_len), (pFile->file_size - pFile->total_len) ) != KAL_TRUE) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DECRYPTION_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_DECRYPTION_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_TLVOTA_FILE_DECRYPTION_FAIL(apply_filename);
+                    ret = MCF_OTA_R_DECRYPTION_FAIL;
+
+                    return ret;
+                }
+            }
+            else if ((pFile->operation_mask & MCF_FILE_OP_AES_256) != 0) { // for AES_256  
+                mcf_get_custom_aes_password(password);
+
+                if (mcf_decrypt_256bit(password, (kal_char *)(tlvota_file->buff + pFile->total_len), (pFile->file_size - pFile->total_len)) != KAL_TRUE) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DECRYPTION_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_DECRYPTION_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_TLVOTA_FILE_DECRYPTION_FAIL(apply_filename);
+                    ret = MCF_OTA_R_DECRYPTION_FAIL;
+
+                    return ret;
+                }
+            }
+
+            if ( (pFile->operation_mask & MCF_FILE_OP_CHECKSUM) != 0) {
+                if (mcf_check_check_sum((kal_uint32 *)(tlvota_file->buff), pFile->file_size) != 0) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_CHECKSUM_ERROR;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_CHECKSUM_ERROR, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_TLVOTA_FILE_CHECKSUM_ERROR(apply_filename);
+                    ret = MCF_OTA_R_CHECKSUM_ERROR;
+
+                    return ret;
+                }
+            }
+        } else {
+            if (is_booting == KAL_TRUE) {
+                com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_INVALID_FILE;
+                MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_INVALID_FILE_VERSION, pFile->file_version);
+            }
+            MD_TRC_MCF_TR_READ_TLVOTA_FILE_INVALID_FILE_VERSION(apply_filename);
+            kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+            kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+            tlvota_file->path_type = 0;
+            tlvota_file->last_mod_time = 0;
+            kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            ret = MCF_OTA_R_INVALID_FILE;
+
+            return ret;
+        }
+
+        tlvota_file->path_type = *apply_path_type;
+        tlvota_file->last_mod_time = last_mod_time;
+        tlvota_file->last_file.last_mod_time = last_mod_time;
+
+#if defined(__MCF_UT_FRAMEWORK_SUPPORT__)        
+        if (strcmp(tlvota_file->relative_path_name, "") == 0){
+            strncpy(tlvota_file->relative_path_name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+        }else{
+            strncpy(apply_filename, tlvota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        }
+#else   
+        strncpy(tlvota_file->relative_path_name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+#endif 
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        if (is_booting == KAL_TRUE) {
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_TAKE_WRITE_LOCK_FAIL;
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL, apply_filename, *apply_path_type, sim_id);
+        }
+        MD_TRC_MCF_TR_READ_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL(apply_filename, *apply_path_type, sim_id);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+    }
+
+    return ret;
+}
+
+mcf_ota_result_e mcf_read_general_tlvota_file(
+    kal_bool                is_booting,
+    kal_char               *req_fs_root_path,
+    kal_char               *req_file_path_name,
+    l4c_mcf_path_type_enum *apply_path_type,
+    kal_char               *apply_filename,
+    mcf_t                  *pMcf)
+{
+    NVRAM_FS_PARAM_CMPT_T               fs_cmpt;
+    FS_FileDetail                       fs_file_detail[L4C_MCF_PATH_TYPE_MAX] = {0};
+    kal_uint32                          read_byte = 0;
+    kal_uint32                          file_size = 0;
+    mcf_ota_result_e                    ret = MCF_OTA_R_SUCCESS;
+    mcf_tlvota_file_t                  *tlvota_file = &(pMcf->general_tlvota_file);
+    kal_wchar                           filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+    mcf_tool_file_info_t               *pFile;
+    kal_char                            password[MCF_MAX_PASSWORD_LEN] = {0};
+    kal_bool                            is_default_path;
+    kal_uint32                          dummy_para;
+    kal_int32                           fs_api_ret[L4C_MCF_PATH_TYPE_MAX];
+    kal_uint64                          last_mod_time = 0;
+    mcf_tool_gid_tlvota_file_item_t    *pItem;
+    kal_uint16                          item_cnt = 0;
+
+    com_Mcf.is_iccid = KAL_FALSE;
+
+    fs_cmpt.opid_map = NVRAM_FS_CMPT_OPEN | NVRAM_FS_CMPT_GETFILESIZE | NVRAM_FS_CMPT_CLOSE;
+    fs_cmpt.Flag = FS_READ_ONLY;
+    fs_cmpt.Length = 0;
+    fs_cmpt.Offset = 0;
+    fs_cmpt.Whence = FS_FILE_BEGIN;
+    fs_cmpt.DataPtr = &dummy_para;
+    fs_cmpt.Read = &dummy_para;
+    fs_cmpt.FileSize = &file_size;
+
+    if ( (strcmp(req_fs_root_path, "") != 0) && (strcmp(req_file_path_name, "") != 0) ) {
+        if (strcmp(req_fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH) == 0) {
+            *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+        } else if (strcmp(req_fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH) == 0) {
+            *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+        } else{
+            MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_INVALID_PATH(req_fs_root_path);
+            ret = MCF_OTA_R_INVALID_PARAMETER;
+
+            return ret;
+        }
+        kal_wsprintf(filename, "%s\\%s\0", req_fs_root_path, req_file_path_name);
+        strncpy(apply_filename, req_file_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        is_default_path = KAL_FALSE;
+    } else {
+        /* Compare modified time of general OP-OTA file to select which file to be applied */
+        kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_GENERAL_TLVOTA_FILE_NAME);
+        fs_api_ret[L4C_MCF_PATH_TYPE_OTA] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_OTA]);
+        MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_OTA, fs_api_ret[L4C_MCF_PATH_TYPE_OTA],
+                         (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime & 0xFFFFFFFF));
+        if (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] != FS_NO_ERROR) {
+            kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_OTA], 0, sizeof(FS_FileDetail));
+        }
+
+        kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_GENERAL_TLVOTA_FILE_NAME);
+        fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME]);
+        MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_RUNTIME, fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME],
+                         (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime & 0xFFFFFFFF));
+        if (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] != FS_NO_ERROR) {
+            kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME], 0, sizeof(FS_FileDetail));
+        }
+
+        if ( (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] == FS_NO_ERROR) || (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] == FS_NO_ERROR) ) {
+            if (fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime > fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime) {
+                *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_GENERAL_TLVOTA_FILE_NAME);
+            } else {
+                *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_GENERAL_TLVOTA_FILE_NAME);
+            }
+        } else {
+            if (is_booting == KAL_TRUE) {
+                com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL;
+                MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_COMPARE_FAIL);
+            }
+            MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_COMPARE_FAIL();
+            ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+            return ret;
+        }
+
+        strncpy(apply_filename, MCF_FS_GENERAL_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+        is_default_path = KAL_TRUE;
+    }
+
+    fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+    if (fs_api_ret[0] < FS_NO_ERROR) {
+        if (is_booting == KAL_TRUE) {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_FAIL, *apply_path_type, fs_api_ret[0]);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+        }
+        MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_FAIL(*apply_path_type, fs_api_ret[0]);
+        dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+
+        /* If cannot read given TLV-OTA file, read default TLV-OTA file */
+        if (is_default_path == KAL_FALSE) {
+            /* Compare modified time of general OP-OTA file to select which file to be applied */
+            kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_GENERAL_TLVOTA_FILE_NAME);
+            fs_api_ret[L4C_MCF_PATH_TYPE_OTA] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_OTA]);
+            MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_OTA, fs_api_ret[L4C_MCF_PATH_TYPE_OTA],
+                             (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime & 0xFFFFFFFF));
+            if (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] != FS_NO_ERROR) {
+                kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_OTA], 0, sizeof(FS_FileDetail));
+            }
+
+            kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_GENERAL_TLVOTA_FILE_NAME);
+            fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] = FS_GetFileDetail(filename, &fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME]);
+            MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_MODIFIED_TIME(L4C_MCF_PATH_TYPE_RUNTIME, fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME],
+                             (kal_uint32)((fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime & 0xFFFFFFFF));
+            if (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] != FS_NO_ERROR) {
+                kal_mem_set(&fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME], 0, sizeof(FS_FileDetail));
+            }
+
+            if ( (fs_api_ret[L4C_MCF_PATH_TYPE_OTA] == FS_NO_ERROR) || (fs_api_ret[L4C_MCF_PATH_TYPE_RUNTIME] == FS_NO_ERROR) ) {
+                if (fs_file_detail[L4C_MCF_PATH_TYPE_OTA].LastStatusChangeTime > fs_file_detail[L4C_MCF_PATH_TYPE_RUNTIME].LastStatusChangeTime) {
+                    *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+                    kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, MCF_FS_GENERAL_TLVOTA_FILE_NAME);
+                } else {
+                    *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+                    kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, MCF_FS_GENERAL_TLVOTA_FILE_NAME);
+                }
+            } else {
+                if (is_booting == KAL_TRUE) {
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_OTA_FILE_FAIL;
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_COMPARE_FAIL);
+                }
+                MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_COMPARE_FAIL();
+                ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                return ret;
+            }
+
+            strncpy(apply_filename, MCF_FS_GENERAL_TLVOTA_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+
+            fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+            if (fs_api_ret[0] < FS_NO_ERROR) {
+                if (is_booting == KAL_TRUE) {
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_TLVOTA_FILE_FAIL;
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_FAIL, *apply_path_type, fs_api_ret[0]);
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+                }
+                MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_FAIL(*apply_path_type, fs_api_ret[0]);
+                dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+                ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+                return ret;
+            }
+        } else {
+            ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+            return ret;
+        }
+    }
+
+    if (file_size > MCF_MAX_TLVOTA_FILE_SIZE) {
+        if (is_booting == KAL_TRUE) {
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_TLVOTA_FILE_OVERSIZE;
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_OVERSIZE, file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+        }
+        MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_OVERSIZE(file_size, MCF_MAX_TLVOTA_FILE_SIZE);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+        return ret;
+    }
+
+    /* Read file */
+    fs_cmpt.opid_map = NVRAM_FS_CMPT_OPEN | NVRAM_FS_CMPT_READ | NVRAM_FS_CMPT_CLOSE;
+    fs_cmpt.Flag = FS_READ_ONLY;
+    fs_cmpt.Length = file_size;
+    fs_cmpt.Offset = 0;
+    fs_cmpt.Whence = FS_FILE_BEGIN;
+    fs_cmpt.DataPtr = tlvota_file->buff;
+    fs_cmpt.Read = &read_byte;
+    fs_cmpt.FileSize = &dummy_para;
+
+    fs_api_ret[*apply_path_type] = FS_GetFileDetail(filename, &fs_file_detail[*apply_path_type]);
+    MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_MODIFIED_TIME(*apply_path_type, fs_api_ret[*apply_path_type],
+                     (kal_uint32)((fs_file_detail[*apply_path_type].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[*apply_path_type].LastStatusChangeTime & 0xFFFFFFFF));
+    if (fs_api_ret[*apply_path_type] == FS_NO_ERROR) {
+        last_mod_time = fs_file_detail[*apply_path_type].LastStatusChangeTime;
+    } else {
+        if (is_booting == KAL_TRUE) {
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_TLVOTA_FILE_FAIL;
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_FAIL, *apply_path_type, fs_api_ret[0]);
+            MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+        }
+        MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_FAIL(*apply_path_type, fs_api_ret[*apply_path_type]);
+        dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+        return ret;
+    }
+
+    MCF_W_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+        if (fs_api_ret[0] < FS_NO_ERROR) {
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            if (is_booting == KAL_TRUE) {
+                com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_READ_TLVOTA_FILE_FAIL;
+                MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_FAIL, *apply_path_type, fs_api_ret[0]);
+                MCF_BOOT_TRACE(MCF_BOOT_TR_STRING, apply_filename);
+            }
+            MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_FAIL(*apply_path_type, fs_api_ret[0]);
+            dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+            ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+
+            return ret;
+        }
+
+        com_Mcf.is_iccid = KAL_FALSE;
+        pFile = (mcf_tool_file_info_t *)(tlvota_file->buff);
+#ifdef __MCF_FIND_TAG_SUPPORT__
+        if (pFile->file_version == 2 || pFile->file_version == 3) { 
+#else
+        if (pFile->file_version == 3) {
+#endif
+            kal_uint32 operation_mask = 0;
+            
+            /* Check custom operation mask */
+            operation_mask = mcf_get_custom_operation_mask();
+            if ((pFile->operation_mask & operation_mask) != operation_mask) {				
+                if (is_booting == KAL_TRUE) {
+                    com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_OPERATION_MASK_FAIL;
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_OPERATION_MASK_FAIL, apply_filename, pFile->operation_mask, operation_mask);
+                }
+                MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_OPERATION_MASK_FAIL(apply_filename, pFile->operation_mask, operation_mask);
+                ret = MCF_OTA_R_INVALID_FILE;
+                
+                kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                tlvota_file->path_type = 0;
+                tlvota_file->last_mod_time = 0;
+                kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+
+                return ret;
+			}
+            /*  First check digest first 
+             *  If file is encrypted and has checksum.
+             *  Decrypt file before checking checksum.
+             */
+              // RSA verify digest 
+            if ((pFile->operation_mask & MCF_FILE_OP_SHA256_RSA2048) != 0) {
+
+                if (mcf_verify_digest(MCF_FILE_OP_SHA256_RSA2048, (mcf_tool_file_info_t *)(tlvota_file->buff), (mcf_digest *)(tlvota_file->buff + pFile->file_size)) != KAL_TRUE) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE );
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DIGEST_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_DIGEST_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_DIGEST_FAIL(apply_filename); 
+                    ret = MCF_OTA_R_DIGEST_FAIL;
+
+                    return ret;
+                }
+
+            }
+
+            else if ((pFile->operation_mask & MCF_FILE_OP_SHA384_RSA3072) != 0) {
+
+                if (mcf_verify_digest(MCF_FILE_OP_SHA384_RSA3072, (mcf_tool_file_info_t *)(tlvota_file->buff), (mcf_digest *)(tlvota_file->buff + pFile->file_size)) != KAL_TRUE) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE );
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DIGEST_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_DIGEST_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_DIGEST_FAIL(apply_filename); 
+                    ret = MCF_OTA_R_DIGEST_FAIL;
+
+                    return ret;
+                }
+
+            }
+            
+            if ( (pFile->operation_mask & MCF_FILE_OP_AES_128) != 0) {
+                mcf_get_custom_aes_password(password);
+
+                if (mcf_decrypt_128bit(password, (kal_char *)(tlvota_file->buff + pFile->total_len), (pFile->file_size - pFile->total_len) ) != KAL_TRUE) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE );
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DECRYPTION_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_DECRYPTION_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_DECRYPTION_FAIL(apply_filename);
+                    ret = MCF_OTA_R_DECRYPTION_FAIL;
+
+                    return ret;
+                }
+            }
+            else if ((pFile->operation_mask & MCF_FILE_OP_AES_256) != 0) { // for AES_256  
+                mcf_get_custom_aes_password(password);
+
+                if (mcf_decrypt_256bit(password, (kal_char *)(tlvota_file->buff + pFile->total_len), (pFile->file_size - pFile->total_len)) != KAL_TRUE) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_DECRYPTION_FAIL;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_DECRYPTION_FAIL, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_DECRYPTION_FAIL(apply_filename); 
+                    ret = MCF_OTA_R_DECRYPTION_FAIL;
+
+                    return ret;
+                }
+            }
+
+            if ( (pFile->operation_mask & MCF_FILE_OP_CHECKSUM) != 0) {
+                if (mcf_check_check_sum((kal_uint32 *)(tlvota_file->buff), pFile->file_size) != 0) {
+                    kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+                    kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+                    tlvota_file->path_type = 0;
+                    tlvota_file->last_mod_time = 0;
+                    kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+                    MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+                    if (is_booting == KAL_TRUE) {
+                        com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_CHECKSUM_ERROR;
+                        MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_CHECKSUM_ERROR, apply_filename);
+                    }
+                    MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_CHECKSUM_ERROR(apply_filename);
+                    ret = MCF_OTA_R_CHECKSUM_ERROR;
+
+                    return ret;
+                }
+            }
+            
+            //Check whether general TLV-OTA have iccid tag
+            pItem = (mcf_tool_gid_tlvota_file_item_t *)(tlvota_file->buff + pFile->total_len);
+            while (item_cnt < pFile->item_num) {
+                if ((pItem->tag_type == MCF_TLVOTA_TAG_ICCID)) {
+                    com_Mcf.is_iccid = KAL_TRUE;
+                    MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_TAG_TYPE(MCF_TLVOTA_TAG_ICCID);
+                    break;
+                }
+                pItem = (mcf_tool_gid_tlvota_file_item_t *)((kal_uint8 *)pItem + pItem->total_len);
+                item_cnt++;
+            }
+        } else {
+            if (is_booting == KAL_TRUE) {
+                com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_INVALID_FILE;
+                MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_INVALID_FILE_VERSION, pFile->file_version);
+            }
+            MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_INVALID_FILE_VERSION(pFile->file_version);
+            kal_mem_set(tlvota_file->buff, 0, MCF_MAX_TLVOTA_FILE_SIZE);
+            kal_mem_set(tlvota_file->relative_path_name, 0, MCF_FILE_MAX_NAME_LEN);
+            tlvota_file->path_type = 0;
+            tlvota_file->last_mod_time = 0;
+            kal_mem_set(&(tlvota_file->last_file), 0, sizeof(mcf_file_info_t));
+            MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+            ret = MCF_OTA_R_INVALID_FILE;
+
+            return ret;
+        }
+
+        tlvota_file->path_type = *apply_path_type;  
+#if defined(__MCF_UT_FRAMEWORK_SUPPORT__)        
+        if (strcmp(tlvota_file->relative_path_name, "") == 0){
+            strncpy(tlvota_file->relative_path_name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+        }else{
+            strncpy(apply_filename, tlvota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        }
+#else
+        strncpy(tlvota_file->relative_path_name, apply_filename, MCF_FILE_MAX_NAME_LEN - 1);
+#endif  
+        tlvota_file->last_mod_time = last_mod_time;
+        tlvota_file->last_file.last_mod_time = last_mod_time;
+        MCF_W_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        if (is_booting == KAL_TRUE) {
+            com_Mcf.boot_trace_flag |= MCF_BOOT_TRACE_F_TAKE_WRITE_LOCK_FAIL;
+            MCF_BOOT_TRACE(MCF_BOOT_TR_READ_GENERAL_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL, apply_filename, *apply_path_type);
+        }
+        MD_TRC_MCF_TR_READ_GENERAL_TLVOTA_FILE_TAKE_WRITE_LOCK_FAIL(apply_filename, *apply_path_type);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+    }
+    
+    
+    return ret;
+}
+
+mcf_ota_result_e mcf_read_ini_file(
+    kal_char               *req_fs_root_path,
+    kal_char               *req_file_path_name,
+    l4c_mcf_path_type_enum *apply_path_type,
+    kal_char               *apply_filename,
+    mcf_t                  *pMcf)
+{
+    NVRAM_FS_PARAM_CMPT_T   fs_cmpt;
+    kal_uint32              read_byte = 0;
+    kal_uint32              file_size = 0;
+    mcf_ota_result_e        ret = MCF_OTA_R_SUCCESS;
+    mcf_ini_file_t         *ini_file = &(pMcf->ini_file);
+    kal_wchar               filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+    kal_bool                is_default_path;
+    kal_uint32              dummy_para;
+    kal_int32               fs_api_ret[L4C_MCF_PATH_TYPE_MAX];
+
+    fs_cmpt.opid_map = NVRAM_FS_CMPT_OPEN | NVRAM_FS_CMPT_GETFILESIZE | NVRAM_FS_CMPT_CLOSE;
+    fs_cmpt.Flag = FS_READ_ONLY;
+    fs_cmpt.Length = 0;
+    fs_cmpt.Offset = 0;
+    fs_cmpt.Whence = FS_FILE_BEGIN;
+    fs_cmpt.DataPtr = &dummy_para;
+    fs_cmpt.Read = &dummy_para;
+    fs_cmpt.FileSize = &file_size;
+
+    
+    if ( (strcmp(req_fs_root_path, "") != 0) && (strcmp(req_file_path_name, "") != 0) ) {
+        if (strcmp(req_fs_root_path, MCF_FS_DEFAULT_FOLDER_PATH) == 0) {
+            *apply_path_type = L4C_MCF_PATH_TYPE_OTA;
+        } else if (strcmp(req_fs_root_path, MCF_FS_CUSTOM_FOLDER_PATH) == 0) {
+            *apply_path_type = L4C_MCF_PATH_TYPE_RUNTIME;
+        }
+        kal_wsprintf(filename, "%s\\%s\0", req_fs_root_path, req_file_path_name);
+        strncpy(apply_filename, req_file_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        is_default_path = KAL_FALSE;
+    } else {
+        if (*apply_path_type == L4C_MCF_PATH_TYPE_OTA) {
+            kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, apply_filename);
+        } else if (*apply_path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+            kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, apply_filename);
+        }
+        strncpy(apply_filename, MCF_FS_DEFAULT_INI_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+        is_default_path = KAL_TRUE;
+    }
+
+    fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+    if (fs_api_ret[0] < FS_NO_ERROR) {
+        
+        MD_TRC_MCF_TR_READ_INI_FILE_FAIL(*apply_path_type, fs_api_ret[0]);
+        dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+
+        /* If cannot read given INI file, read default INI file */
+        if (is_default_path == KAL_FALSE) {
+            if (*apply_path_type == L4C_MCF_PATH_TYPE_OTA) {
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, apply_filename);
+            } else if (*apply_path_type == L4C_MCF_PATH_TYPE_RUNTIME) {
+                kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, apply_filename);
+            }
+            strncpy(apply_filename, MCF_FS_DEFAULT_INI_FILE_NAME, MCF_FILE_MAX_NAME_LEN - 1);
+
+            fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+            if (fs_api_ret[0] < FS_NO_ERROR) {
+                
+                MD_TRC_MCF_TR_READ_INI_FILE_FAIL(*apply_path_type, fs_api_ret[0]);
+                dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+                ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+
+                return ret;
+            }
+        } else {
+            ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+
+            return ret;
+        }
+    }
+    if (file_size >= MCF_MAX_INI_FILE_SIZE-1) {
+        MD_TRC_MCF_TR_READ_INI_FILE_OVERSIZE(file_size, MCF_MAX_INI_FILE_SIZE);
+        ret = MCF_OTA_R_READ_INI_FILE_FAIL;
+
+        return ret;
+    }
+
+    /* Read file */
+    fs_cmpt.opid_map = NVRAM_FS_CMPT_OPEN | NVRAM_FS_CMPT_READ | NVRAM_FS_CMPT_CLOSE;
+    fs_cmpt.Flag = FS_READ_ONLY;
+    fs_cmpt.Length = file_size;
+    fs_cmpt.Offset = 0;
+    fs_cmpt.Whence = FS_FILE_BEGIN;
+    fs_cmpt.DataPtr = ini_file->buff;
+    fs_cmpt.Read = &read_byte;
+    fs_cmpt.FileSize = &dummy_para;
+
+    
+    fs_api_ret[0] = MCF_FS_CMPT_Read(filename, &fs_cmpt);
+    if (fs_api_ret[0] < FS_NO_ERROR) {
+        MD_TRC_MCF_TR_READ_INI_FILE_FAIL(*apply_path_type, fs_api_ret[0]);
+        dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, apply_filename);
+        ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+        return ret;
+    }
+    
+    if (file_size < MCF_MAX_INI_FILE_SIZE){
+        ini_file->buff[file_size] = '\0';
+    }
+    
+    
+    return ret;
+}
+
+kal_bool mcf_find_ini_item(kal_char* buff, kal_char *item, kal_char *value, mcf_t *pMcf)
+{
+    kal_bool   ret = KAL_TRUE;
+    kal_char *varstr = NULL, *substr = NULL;
+    kal_char *saveptr = NULL;
+    kal_char *item_ptr = NULL;
+    kal_char *item_tag = NULL;
+    mcf_ini_file_t *ini_file = &(pMcf->ini_file);
+    kal_char  *buffer = (kal_char *)ini_file->tmp_buff;
+     
+    
+    
+    //buff and item cannot be NULL
+    if(buff == NULL || item == NULL) {
+        MD_TRC_MCF_TR_FIND_INI_ITEM_ERROR_INPUT_NULL();
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    MD_TRC_MCF_TR_FIND_INI_ITEM_START(item);
+        
+    /* Remove space and to uppercase */
+    mcf_remove_spaces_and_carrier_return(buff);
+    mcf_toupper(buff);
+    mcf_toupper(item);
+    mcf_remove_spaces_and_carrier_return(item);
+    
+    kal_mem_set(buffer,0,MCF_MAX_INI_FILE_SIZE);
+    strncpy(buffer,buff,MCF_MAX_INI_FILE_SIZE-1);
+    buffer[MCF_MAX_INI_FILE_SIZE-1] = '\0';
+    
+    
+    item_ptr = strstr (buffer,item);
+    if (item_ptr != 0) {
+        item_tag = kal_strtok_r(item_ptr,"=",&saveptr);
+        substr = kal_strtok_r(NULL,"=",&saveptr);
+        if (item_tag != 0) {
+            if (strcmp(item_tag,item) == 0){ 
+                if (substr != NULL){
+                    varstr = strstr(substr,"\n");
+                    if (varstr == NULL){
+                        if (strlen(substr) > MCF_MAX_INI_ITEM_VALUE_LEN-1){
+                            memset(value, 0, MCF_MAX_INI_ITEM_VALUE_LEN);
+                            strncpy(value, substr, MCF_MAX_INI_ITEM_VALUE_LEN);
+                        }else{
+                            memset(value, 0, MCF_MAX_INI_ITEM_VALUE_LEN);
+                            strncpy(value, substr, strlen(substr));
+                        }
+                        
+                    }else{
+                        if (strlen(substr)-strlen(varstr) + 1 > MCF_MAX_INI_ITEM_VALUE_LEN-1){
+                            memset(value, 0, MCF_MAX_INI_ITEM_VALUE_LEN);
+                            strncpy(value, substr, MCF_MAX_INI_ITEM_VALUE_LEN);
+                        }else{
+                            memset(value, 0, MCF_MAX_INI_ITEM_VALUE_LEN);
+                            strncpy(value, substr, strlen(substr)-strlen(varstr));
+                        }
+                        
+                        
+                    }
+                }else{
+                    value = NULL;
+                    MD_TRC_MCF_TR_FIND_INI_ITEM_ERROR_CAN_NOT_FIND_ITEM();
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+            }else{
+                value = NULL;
+                MD_TRC_MCF_TR_FIND_INI_ITEM_ERROR_ITEM_LENGTH();
+                ret = KAL_FALSE;
+                return ret;
+            }
+            
+        } else {
+            value = NULL;
+            MD_TRC_MCF_TR_FIND_INI_ITEM_ERROR_CAN_NOT_FIND_ITEM();
+            ret = KAL_FALSE;
+            return ret;
+        }
+    } else {
+        value = NULL;
+        MD_TRC_MCF_TR_FIND_INI_ITEM_ERROR_CAN_NOT_FIND_ITEM();
+        ret = KAL_FALSE;
+        return ret;
+    }
+            
+    
+    
+    MD_TRC_MCF_TR_FIND_INI_ITEM_RETURN_VALUE(item, value);
+    
+    return ret;
+}
+
+kal_bool mcf_find_ini_sbp_id(kal_char *tag_str, kal_uint32 *sbp_id, kal_uint16 *sbp_id_num, kal_bool *general)
+{
+    kal_uint16 i = 0;
+    kal_bool   ret = KAL_TRUE;
+    kal_char *saveptr = NULL, *varstr = NULL, *substr = NULL, *tmpstr = NULL;
+    kal_char *sbp_id_tag[MCF_MAX_TAG_NUM];
+    kal_uint16 tag_cnt = 0;
+    kal_char *tag[MCF_MAX_TAG_NUM];
+    kal_uint16 tag_num = 0;
+    
+    MD_TRC_MCF_TR_FIND_INI_SBP_ID_START(tag_str);
+    
+    //buff and item cannot be NULL
+    if(tag_str == NULL) {
+        MD_TRC_MCF_TR_FIND_INI_SBP_ID_ERROR_INPUT_NULL();
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    
+    //Split ',' from tag
+    substr = kal_strtok_r(tag_str, ",", &saveptr);
+    
+    if (substr == NULL){
+        MD_TRC_MCF_TR_FIND_INI_SBP_ID_ERROR_CAN_NOT_FIND_ITEM();
+        ret = KAL_FALSE;
+        return ret;
+    }
+
+    
+    while(substr != NULL){
+        tag[tag_cnt] = substr;
+        tag_cnt++;
+        substr = kal_strtok_r(NULL, ",",&saveptr); 
+   }
+    
+    
+    
+    /* ICCID case should apply general tlvota*/
+    tmpstr = strstr(tag[0], "_");
+    if (tmpstr == NULL){
+        *general = KAL_TRUE;
+        MD_TRC_MCF_TR_FIND_INI_SBP_ID_ICCID_USIR(tag[0]);
+    }
+    
+    //Split '_' from SBPID_MNC_MCC tag
+    sbp_id_tag[0] = kal_strtok_r(tag[0], "_", &saveptr);
+    
+    if (strcmp(sbp_id_tag[0],"") == 0){
+        MD_TRC_MCF_TR_FIND_INI_SBP_ID_ERROR_CAN_NOT_FIND_ITEM();
+    }
+    
+    
+    /* NA case should apply general tlvota */
+    if (strcmp(sbp_id_tag[0],"NA") == 0){
+        *general = KAL_TRUE;
+        MD_TRC_MCF_TR_FIND_INI_SBP_ID_NA(*general);
+    }
+    
+    for (i = 1; i < tag_cnt; i++){
+        
+        tmpstr = strstr(tag[i], "_");
+        if (tmpstr == NULL){
+            *general = KAL_TRUE;
+            if(i+1 < tag_cnt){
+                i++;
+            }
+        }else{
+            varstr = kal_strtok_r(tag[i], "_",&saveptr);
+            if(varstr == NULL){
+				*general = KAL_TRUE;
+                if(i+1 < tag_cnt){
+                    i++;
+                }
+			}else{
+				if(strcmp(varstr,"NA") == 0){
+					*general = KAL_TRUE;
+					if(i+1 < tag_cnt){
+						i++;
+					}
+                }
+				if (strcmp(varstr,sbp_id_tag[tag_num]) != 0){
+					//save different sbp_id
+					tag_num++;
+					sbp_id_tag[tag_num] = varstr;
+				}
+			}
+        }
+   }
+   
+   for (i = 0; i < tag_num + 1; i++){
+       sbp_id[i] = mcf_atoi(sbp_id_tag[i]);
+   }
+   
+ 
+   
+   *sbp_id_num = tag_num + 1;
+   
+    MD_TRC_MCF_TR_FIND_INI_SBP_ID_RETURN_NUM(*sbp_id_num);
+    
+    return ret;
+}
+
+kal_bool mcf_compose_ini_item(kal_char *orig_buff, kal_char *new_buff, kal_char *item, kal_char *orig_value, kal_char *value)
+{
+    kal_bool ret = KAL_TRUE;
+    kal_char *tmpstr = NULL, *varstr = NULL, *substr = NULL;
+    kal_uint32 len = 0;
+    
+    MD_TRC_MCF_TR_COMPOSE_INI_ITEM_START(item, orig_value);
+    
+    mcf_remove_spaces_and_carrier_return(orig_buff);
+    mcf_remove_spaces_and_carrier_return(item);
+    kal_mem_set(new_buff, 0, MCF_MAX_INI_FILE_SIZE);
+    
+    substr = strstr (orig_buff,"\0");
+    if (substr != NULL){
+        len = strlen(orig_buff);
+    }else{
+        MD_TRC_MCF_TR_COMPOSE_INI_ITEM_INVALID_BUFF();
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    
+    
+    substr = strstr (orig_buff,item);
+    if (substr != NULL){
+        varstr = strstr(substr,"=");
+        if (varstr != NULL){
+            if (strlen(substr)-strlen(varstr) == strlen(item)){
+				if(strcmp(orig_value,"") != 0){
+                    tmpstr = strstr(substr,orig_value);
+                    if (tmpstr != NULL){
+                        if ((len-strlen(varstr)+4+strlen(value)+strlen(tmpstr)-strlen(orig_value)) >= MCF_MAX_INI_FILE_SIZE){
+                            MD_TRC_MCF_TR_COMPOSE_INI_ITEM_INVALID_BUFF_LENGTH();
+                            ret = KAL_FALSE;
+                            return ret;
+                        }
+                        strncpy(new_buff,orig_buff,len-strlen(varstr));
+                        strncat (new_buff,"=", MCF_MAX_INI_FILE_SIZE - 1);
+                        strncat (new_buff,value, MCF_MAX_INI_FILE_SIZE - 1);
+                        strncat (new_buff,tmpstr+strlen(orig_value), MCF_MAX_INI_FILE_SIZE - 1);
+                        strncat (new_buff,"\n\0", MCF_MAX_INI_FILE_SIZE - 1);
+                    }else{
+                        MD_TRC_MCF_TR_COMPOSE_INI_ITEM_INVALID_ORIGINAL_VALUE(orig_value);
+                        ret = KAL_FALSE;
+                        return ret;
+                    }
+				}else{
+                    if ((len-strlen(varstr)+4+strlen(value)+strlen(substr)-strlen(item)) >= MCF_MAX_INI_FILE_SIZE){
+                        MD_TRC_MCF_TR_COMPOSE_INI_ITEM_INVALID_BUFF_LENGTH();
+                        ret = KAL_FALSE;
+                        return ret;
+                    }
+                    strncpy(new_buff,orig_buff,len-strlen(varstr));
+                    strncat (new_buff,"=", MCF_MAX_INI_FILE_SIZE - 1);
+                    strncat (new_buff,value, MCF_MAX_INI_FILE_SIZE - 1);
+                    strncat (new_buff,"\n", MCF_MAX_INI_FILE_SIZE - 1);
+                    strncat (new_buff,substr+strlen(item)+1, MCF_MAX_INI_FILE_SIZE - 1);
+                    strncat (new_buff,"\n\0", MCF_MAX_INI_FILE_SIZE - 1);
+                }
+            }else{
+                MD_TRC_MCF_TR_COMPOSE_INI_ITEM_ERROR_ITEM_LENGTH();
+                ret = KAL_FALSE;
+                return ret;
+                
+            }
+        }else{
+            tmpstr = strstr(substr,orig_value);
+            if (tmpstr != NULL){
+                if ((len+4+strlen(value)+strlen(tmpstr)-strlen(orig_value)) >= MCF_MAX_INI_FILE_SIZE){
+                    MD_TRC_MCF_TR_COMPOSE_INI_ITEM_INVALID_BUFF_LENGTH();
+                    ret = KAL_FALSE;
+                    return ret;
+                }
+                strncpy(new_buff,orig_buff,len);
+                strncat (new_buff,"=", MCF_MAX_INI_FILE_SIZE - 1);
+                strncat (new_buff,value, MCF_MAX_INI_FILE_SIZE - 1);
+                strncat (new_buff,tmpstr+strlen(orig_value), MCF_MAX_INI_FILE_SIZE - 1);
+                strncat (new_buff,"\n\0", MCF_MAX_INI_FILE_SIZE - 1);
+            }else{
+                MD_TRC_MCF_TR_COMPOSE_INI_ITEM_INVALID_ORIGINAL_VALUE(orig_value);
+                ret = KAL_FALSE;
+                return ret;
+            }
+        }
+
+        
+    }
+    else{
+        //new item
+        if ((len+5+strlen(item)+strlen(value)) >= MCF_MAX_INI_FILE_SIZE){
+            MD_TRC_MCF_TR_COMPOSE_INI_ITEM_INVALID_BUFF_LENGTH();
+            ret = KAL_FALSE;
+            return ret;
+        }
+        strncpy(new_buff,orig_buff, MCF_MAX_INI_FILE_SIZE - 1);
+        strncat(new_buff,"\n", MCF_MAX_INI_FILE_SIZE - 1);
+        strncat(new_buff,item, MCF_MAX_INI_FILE_SIZE - 1);
+        strncat(new_buff,"=", MCF_MAX_INI_FILE_SIZE - 1);
+        strncat(new_buff,value, MCF_MAX_INI_FILE_SIZE - 1);
+        strncat (new_buff,"\n\0", MCF_MAX_INI_FILE_SIZE - 1);
+    }
+    
+    
+    return ret;
+}
+
+void mcf_dump_data(kal_bool is_booting, void *p_data, kal_uint32 len)
+{
+    kal_uint32  i = 0;
+    kal_uint32  buff;
+
+    for (i = 0; len > 0; i++){
+        if (len >= 4) {
+            buff = 0;
+            kal_mem_cpy(&buff, (kal_uint8 *)p_data + (i * 4), 4);
+            len -= 4;
+        } else {
+            buff = 0;
+            kal_mem_cpy(&buff, (kal_uint8 *)p_data + (i * 4), len);
+            len = 0;
+        }
+
+        if (is_booting == KAL_TRUE) {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_DATA_DUMP_TRACE, i, buff);
+        }
+        MD_TRC_MCF_TR_DATA_DUMP_TRACE(i, buff);
+    }
+}
+
+#define GUARD_PARRTEN 0xAABBCCDD
+#define FULL_PARRTEN  0xAABBFFFF
+void mcf_write_boot_trace(kal_uint32 trace_enum, ...)
+{
+    va_list ap;
+    kal_uint32 i = 0;
+    kal_uint32 *value= NULL;
+    char *substr = NULL;
+    // store into com_Mcf.boot_trace_buff
+    // enum, num, type, size, value, type, size, value
+    // enum, num, type, size, value, type, size, value
+    // enum, num, type, size, value, type, size, value
+    mcf_boot_trace_struct *trace_ptr = (mcf_boot_trace_struct *)com_Mcf.boot_trace_buff_ptr;
+    mcf_boot_trace_value_struct *value_ptr = NULL;
+    
+    if(com_Mcf.boot_trace_buff_ptr == NULL ){
+        com_Mcf.boot_trace_buff_ptr = (kal_uint32 *)com_Mcf.boot_trace_buff;
+        trace_ptr = (mcf_boot_trace_struct *)com_Mcf.boot_trace_buff_ptr;
+    } 
+    
+    value_ptr = &trace_ptr->value_ptr;
+    
+    if((char *)trace_ptr + 512 > (char *)com_Mcf.boot_trace_buff + sizeof(com_Mcf.boot_trace_buff))
+    {
+        if(com_Mcf.boot_trace_full == 1) return;
+		com_Mcf.boot_trace_full = 1;
+        trace_ptr->guard_pattern = GUARD_PARRTEN;
+        trace_ptr->trace_enum = FULL_PARRTEN;
+        com_Mcf.boot_trace_buff_ptr = (kal_uint32 *)(trace_ptr+1);
+        return;
+    }        
+    
+    trace_ptr->guard_pattern = GUARD_PARRTEN;
+    trace_ptr->trace_enum = trace_enum;
+    
+    substr = strstr(boot_trace_format[trace_enum].log_format, "%");
+    va_start(ap, trace_enum);
+    while ( (kal_uint32)(value = (kal_uint32 *)va_arg(ap,void *)) != END_PATTERN)
+    {
+        if(substr == NULL) break;
+
+        switch(*(substr + 1))
+        {
+            case 's':
+            {
+                char *string_ptr = (char *)value;
+                value_ptr->size = strlen(string_ptr);
+                kal_mem_cpy(&value_ptr->type_u.string, string_ptr, value_ptr->size + 1);
+                value_ptr->size = ((value_ptr->size + 4) >> 2 ) << 2 ; // size pedding to 4 byte alignment
+                value_ptr->type = MCF_TYPE_STRING;
+            }
+            break;
+            default:
+            {
+                value_ptr->size = sizeof(kal_uint32);
+                value_ptr->type_u.integer = (kal_uint32)value;
+                value_ptr->type = MCF_TYPE_INTEGER;
+            }
+            break;
+        }
+        
+        i++;
+        value_ptr = (mcf_boot_trace_value_struct *)((kal_uint8 *)&value_ptr->type_u.value + value_ptr->size);
+        
+        substr = strstr(substr + 1, "%");
+    }
+    va_end(ap);
+    
+    trace_ptr->total_num = i;
+    
+    if(trace_ptr->total_num == 0 ) com_Mcf.boot_trace_buff_ptr = (kal_uint32 *)(trace_ptr+1);
+    else com_Mcf.boot_trace_buff_ptr = (kal_uint32 *)value_ptr;
+}
+
+void mcf_dump_boot_trace(void)
+{
+    mcf_boot_trace_struct *trace_ptr = (mcf_boot_trace_struct *)com_Mcf.boot_trace_buff;
+    kal_uint32 i = 0;
+    mcf_boot_trace_value_struct value_list[7]; // max DHL arg is 7
+    mcf_boot_trace_value_struct *current_value;
+    
+    while ((char *)trace_ptr < (char *)com_Mcf.boot_trace_buff_ptr)
+    {
+        ASSERT(trace_ptr->guard_pattern == GUARD_PARRTEN);
+        current_value = &trace_ptr->value_ptr;
+        
+        if(trace_ptr->trace_enum == FULL_PARRTEN)
+        {
+            MCF_BOOT_PRINT("[MCF] boot trace buffer full!!!");
+            break;
+        }
+        
+        for(i = 0 ; i < trace_ptr->total_num ; i++)
+        {
+            value_list[i].size = current_value->size;
+            switch(current_value->type)
+            {
+                case MCF_TYPE_INTEGER:
+                    value_list[i].type_u.value = current_value->type_u.integer;
+                break;
+                case MCF_TYPE_STRING:
+                    value_list[i].type_u.value = (kal_uint32)&current_value->type_u.string;
+                break;
+                default:
+                break;
+            }
+            current_value = (mcf_boot_trace_value_struct *)((kal_uint8 *)&current_value->type_u.value + current_value->size);
+        }
+        switch(trace_ptr->total_num)
+        {
+            case 0:
+            MCF_BOOT_PRINT(boot_trace_format[trace_ptr->trace_enum].log_format);
+            break;
+            case 1:
+            MCF_BOOT_PRINT(boot_trace_format[trace_ptr->trace_enum].log_format, value_list[0].type_u.value);
+            break;
+            case 2:
+            MCF_BOOT_PRINT(boot_trace_format[trace_ptr->trace_enum].log_format, value_list[0].type_u.value, value_list[1].type_u.value);
+            break;
+            case 3:
+            MCF_BOOT_PRINT(boot_trace_format[trace_ptr->trace_enum].log_format, value_list[0].type_u.value, value_list[1].type_u.value, value_list[2].type_u.value);
+            break;
+            case 4:
+            MCF_BOOT_PRINT(boot_trace_format[trace_ptr->trace_enum].log_format, value_list[0].type_u.value, value_list[1].type_u.value, value_list[2].type_u.value, value_list[3].type_u.value);
+            break;
+            case 5:
+            MCF_BOOT_PRINT(boot_trace_format[trace_ptr->trace_enum].log_format, value_list[0].type_u.value, value_list[1].type_u.value, value_list[2].type_u.value, value_list[3].type_u.value, value_list[4].type_u.value);
+            break;
+            case 6:
+            MCF_BOOT_PRINT(boot_trace_format[trace_ptr->trace_enum].log_format, value_list[0].type_u.value, value_list[1].type_u.value, value_list[2].type_u.value, value_list[3].type_u.value, value_list[4].type_u.value, value_list[5].type_u.value);
+            break;
+            case 7:
+            MCF_BOOT_PRINT(boot_trace_format[trace_ptr->trace_enum].log_format, value_list[0].type_u.value, value_list[1].type_u.value, value_list[2].type_u.value, value_list[3].type_u.value, value_list[4].type_u.value, value_list[5].type_u.value, value_list[6].type_u.value);
+            break;
+        }
+        
+        if(trace_ptr->total_num == 0) trace_ptr++;
+        else trace_ptr = (mcf_boot_trace_struct *)current_value;
+    }
+}
+
+mcf_ota_result_e mcf_write_buffer(
+    kal_char *folder_path,
+    kal_char *file_name,
+    kal_uint8 *buffer,
+    kal_uint32 total_size)
+{
+    mcf_ota_result_e    mcf_ret = MCF_OTA_R_SUCCESS;
+#if defined(__MTK_TARGET__)	
+    kal_wchar           file_path_name[MCF_FILE_MAX_MD_PATH_LEN * 2];
+    FS_HANDLE           file_handle;
+    kal_uint32          len = 0;
+    kal_int32           ret = FS_NO_ERROR;
+
+    MD_TRC_MCF_TR_WRITE_BUFFER_START(file_name, folder_path, total_size);
+
+    kal_wsprintf(file_path_name, "%s\\%s\0", folder_path, file_name);
+    file_handle = FS_Open(file_path_name, FS_CREATE | FS_READ_WRITE | FS_OPEN_NO_DIR);
+
+    ret = FS_Write(file_handle, buffer, total_size, &len);
+    if (ret != FS_NO_ERROR) {
+        MD_TRC_MCF_TR_WRITE_BUFFER_FAIL(file_handle, ret);
+        mcf_ret = MCF_OTA_R_WRITE_DISK_FAIL;
+    }
+
+    FS_Close(file_handle);
+#endif
+    return mcf_ret;
+}
+
+mcf_ota_result_e mcf_get_file_last_mod_time(
+    kal_char *apply_filename,
+    l4c_mcf_path_type_enum apply_path_type,
+    kal_uint64 *last_mod_time)
+{
+    mcf_ota_result_e    mcf_ret = MCF_OTA_R_SUCCESS;
+    kal_wchar           filename[MCF_FILE_MAX_MD_PATH_LEN + MCF_FILE_MAX_NAME_LEN];
+    FS_FileDetail       fs_file_detail[L4C_MCF_PATH_TYPE_MAX] = {0};
+    kal_int32           fs_api_ret[L4C_MCF_PATH_TYPE_MAX];
+
+    MD_TRC_MCF_TR_GET_FILE_LAST_MOD_TIME_START(apply_filename, apply_path_type);
+    if (apply_path_type == L4C_MCF_PATH_TYPE_OTA){
+        kal_wsprintf(filename, "%s\\%s\0", MCF_FS_DEFAULT_FOLDER_PATH, apply_filename);
+    }else if(apply_path_type == L4C_MCF_PATH_TYPE_RUNTIME){
+        kal_wsprintf(filename, "%s\\%s\0", MCF_FS_CUSTOM_FOLDER_PATH, apply_filename);
+    }else{
+        *last_mod_time = 0;
+        MD_TRC_MCF_TR_GET_FILE_LAST_MOD_TIME_INVALID_PATH_TYPE(apply_path_type);
+        mcf_ret = MCF_OTA_R_INVALID_PARAMETER;
+        return mcf_ret;
+    }
+    fs_api_ret[apply_path_type] = FS_GetFileDetail(filename, &fs_file_detail[apply_path_type]);
+    MD_TRC_MCF_TR_GET_FILE_LAST_MOD_TIME(apply_path_type, fs_api_ret[apply_path_type],
+                     (kal_uint32)((fs_file_detail[apply_path_type].LastStatusChangeTime >> 32) & 0xFFFFFFFF), (kal_uint32)(fs_file_detail[apply_path_type].LastStatusChangeTime & 0xFFFFFFFF));
+    if (fs_api_ret[apply_path_type] == FS_NO_ERROR) {
+        *last_mod_time = fs_file_detail[apply_path_type].LastStatusChangeTime;
+    } else {
+        *last_mod_time = 0;
+        MD_TRC_MCF_TR_GET_FILE_LAST_MOD_TIME_FAIL(L4C_MCF_PATH_TYPE_OTA, fs_api_ret[L4C_MCF_PATH_TYPE_OTA]);
+        mcf_ret = MCF_OTA_R_READ_OTA_FILE_FAIL;
+        return mcf_ret;
+    }
+
+    return mcf_ret;
+}
+
+void mcf_dump_important_info(void)
+{
+    mcf_t              *pMcf = mcf_get_instance();
+    mcf_ota_file_t     *ota_file = &(pMcf->ota_file);
+    mcf_tlvota_file_t  *tlvota_file;
+    kal_uint8           path_type;
+    kal_char            relative_path_name[MCF_FILE_MAX_NAME_LEN];
+    kal_uint8           i = 0;
+    
+    MCF_R_LOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    if (ota_file) {
+        path_type = ota_file->path_type;
+        strncpy(relative_path_name, ota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        MD_TRC_MCF_TR_DUMP_IMPORTANT_INFO_OTA_FILE(path_type, relative_path_name);
+        MCF_R_UNLOCK_OBJECT(ota_file, mcf_enhmutex_g);
+    } else {
+        MD_TRC_MCF_TR_DUMP_IMPORTANT_INFO_TAKE_READ_LOCK_FAIL();
+    }
+    
+    for (i = 0; i < MAX_SIM_NUM; i++) {
+        tlvota_file = &(pMcf->tlvota_file[i]);
+        MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        if (tlvota_file) {
+            path_type = tlvota_file->path_type;
+            strncpy(relative_path_name, tlvota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+            MD_TRC_MCF_TR_DUMP_IMPORTANT_INFO_TLVOTA_FILE(i, path_type, relative_path_name);
+            MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+        } else {
+            MD_TRC_MCF_TR_DUMP_IMPORTANT_INFO_TAKE_READ_LOCK_FAIL();
+        }
+    }
+    
+    tlvota_file = &(pMcf->general_tlvota_file);
+    MCF_R_LOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    if (tlvota_file) {
+        path_type = tlvota_file->path_type;
+        strncpy(relative_path_name, tlvota_file->relative_path_name, MCF_FILE_MAX_NAME_LEN - 1);
+        MD_TRC_MCF_TR_DUMP_IMPORTANT_INFO_GENERAL_TLVOTA_FILE(path_type, relative_path_name);
+        MCF_R_UNLOCK_OBJECT(tlvota_file, mcf_enhmutex_g);
+    } else {
+        MD_TRC_MCF_TR_DUMP_IMPORTANT_INFO_TAKE_READ_LOCK_FAIL();
+    }
+    
+}
+
+kal_int32 mcf_atoi(const void *src)
+{
+    kal_int32 res=0;
+    kal_int8 *p_src=(kal_int8*)src;
+
+    while( *p_src>='0' && *p_src<='9' ){
+        res = res*10 + (*p_src - '0');
+        p_src++;
+    }
+
+    return res;
+}
+
+kal_int32 mcf_str_strcmp(const void *str1, const void *str2)
+{
+    kal_int8 *p_str1=(kal_int8*)str1, *p_str2=(kal_int8*)str2;
+
+    if( p_str1==NULL || p_str2==NULL ){
+        return 1;
+    }
+
+    while(*p_str1==*p_str2 && *p_str1!='\0'){
+        p_str1++;
+        p_str2++;
+    }
+    return *p_str1 - *p_str2;
+}
+
+void mcf_remove_spaces_and_carrier_return(kal_char* src)
+{
+    kal_char* str1 = src;
+    kal_char* str2 = src;
+    while(*str2 != 0)
+    {
+    
+        *str1 = *str2++;
+        
+        /* 32 = space, 13 = "\r" */
+        /* Windows uses \r\n to a new line, Linux uses \n to a new line */
+    
+        if(*str1 != 32 && *str1 != 13){
+            str1++;
+        }
+    }
+    *str1 = 0;
+    
+}
+
+void mcf_toupper(kal_char* src)
+{
+    kal_uint32 k = 0;
+    while(src[k] != 0)
+    {
+        if(src[k] >= 'a' && src[k] <= 'z'){
+            src[k] = src[k]-32;
+        }
+        k++;
+    }
+    
+}
+
+kal_int32 mcf_str_strlen(const void *src)
+{
+    kal_int8 *p_src=(kal_int8*)src;
+    kal_int32 len=0;
+    
+    if( p_src==NULL ){
+        return 0;
+    }
+    
+    while('\0' != *p_src){
+        len++;
+        p_src++;
+    }
+    return len;
+}
+
+kal_bool mcf_hex_str_reverse(kal_char *str, kal_uint32 length)
+{
+    kal_char      temp1;
+	kal_char      temp2;
+	kal_uint32    i;
+	
+	if(str == NULL || length < 0 || length %2 != 0){
+		return KAL_FALSE;
+	}
+	
+	if(length < 4){
+		return KAL_TRUE;
+	}
+	
+	for(i = 0; i < length/2; i+=2){
+		temp1 = str[i];
+		str[i] = str[length-2-i];
+		str[length-2-i] = temp1;
+		
+		temp2 = str[i+1];
+		str[i+1] = str[length-1-i];
+		str[length-1-i] = temp2;
+	}
+	
+	return KAL_TRUE;
+}
+
+kal_int16 mcf_binary_search_lid(kal_uint16 find_lid, kal_uint16 *lid_arr, kal_uint16 lid_size, kal_uint16 *new_pos)
+{
+    kal_int16 first = 0,             // First array element
+        last = lid_size - 1,       // Last array element
+        middle = 0,                // Mid point of search
+        position = -1;         // Position of search value
+    kal_bool found = KAL_FALSE;        // Flag
+
+    while (!found && first <= last)
+    {
+        middle = (first + last) / 2;     // Calculate mid point
+        if(middle < 0)
+            return -1;
+        if (lid_arr[middle] == find_lid)      // If value is found at mid
+        {
+            found = KAL_TRUE;
+            position = middle;
+        }
+        else if (lid_arr[middle] > find_lid){  // If value is in lower half
+            last = middle - 1;
+            *new_pos = middle;
+        }
+        else{
+            first = middle + 1;           // If value is in upper half
+            *new_pos = first;
+        }
+    }
+    if(lid_size == 0){
+        *new_pos = 0;
+    }
+    
+    
+    return position;
+}
+
+kal_bool mcf_insert_lid(kal_uint16 new_lid, kal_uint16 *lid_arr, kal_uint16 lid_size, kal_uint16 new_pos)
+{
+    kal_bool ret = KAL_TRUE;
+    kal_uint16 i = 0;
+    if (lid_size >= NVRAM_MCF_SAVE_LAST_LID_CNT){
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    for(i = lid_size; i > new_pos; i--){
+        lid_arr[i] = lid_arr[i-1];
+    }
+    lid_arr[new_pos] = new_lid;
+    
+    return ret;
+}
+
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+kal_int16 mcf_binary_search_lid_struct(kal_uint16 find_lid, nvram_mcf_lid_config_struct *lid_conf, kal_uint16 lid_size, kal_uint16 *new_pos)
+{
+    kal_int16 first = 0,             // First array element
+        last = lid_size - 1,       // Last array element
+        middle = 0,                // Mid point of search
+        position = -1;         // Position of search value
+    kal_bool found = KAL_FALSE;        // Flag
+
+    while (!found && first <= last)
+    {
+        middle = (first + last) / 2;     // Calculate mid point
+        if(middle < 0)
+            return -1;
+        if (lid_conf[middle].lid == find_lid)      // If value is found at mid
+        {
+            found = KAL_TRUE;
+            position = middle;
+        }
+        else if (lid_conf[middle].lid > find_lid){  // If value is in lower half
+            last = middle - 1;
+            *new_pos = middle;
+        }
+        else{
+            first = middle + 1;           // If value is in upper half
+            *new_pos = first;
+        }
+    }
+    if(lid_size == 0){
+        *new_pos = 0;
+    }
+    
+    
+    return position;
+}
+
+kal_bool mcf_insert_lid_struct(kal_uint16 new_lid, nvram_mcf_lid_config_struct *lid_conf, kal_uint16 lid_size, kal_uint16 new_pos, kal_bool not_reset, kal_bool set_combined)
+{
+    kal_bool ret = KAL_TRUE;
+    kal_uint16 i = 0;
+    if (lid_size >= NVRAM_MCF_SAVE_LAST_LID_CNT){
+        ret = KAL_FALSE;
+        return ret;
+    }
+    
+    for(i = lid_size; i > new_pos; i--){
+        kal_mem_cpy(&lid_conf[i], &lid_conf[i-1], sizeof(nvram_mcf_lid_config_struct));
+    }
+    lid_conf[new_pos].lid = new_lid;
+	lid_conf[new_pos].not_reset = not_reset;
+	lid_conf[new_pos].set_combined = set_combined;
+    
+    return ret;
+}
+
+kal_bool mcf_clear_last_modified_lid(nvram_mcf_lid_config_struct *lid_conf, kal_uint16 *lid_size)
+{
+    kal_bool ret = KAL_TRUE;
+	kal_uint16 i = 0;
+	kal_uint16 index = 0;
+	kal_uint16 lid_cnt = 0;
+    kal_uint16 total_cnt = 0;
+    
+	lid_cnt = *lid_size;
+	
+	if (lid_cnt >= NVRAM_MCF_SAVE_LAST_LID_CNT){
+        ret = KAL_FALSE;
+        return ret;
+    }
+
+    for(i = 0; i < lid_cnt; i++){
+        
+        if(lid_conf[i].set_combined == KAL_TRUE ){
+            kal_mem_set(&lid_conf[i], 0, sizeof(nvram_mcf_lid_config_struct));
+            index++;
+            while(index < lid_cnt && lid_conf[index].set_combined == KAL_TRUE){
+                kal_mem_set(&lid_conf[index], 0, sizeof(nvram_mcf_lid_config_struct));
+                index++;
+            }
+		}
+        
+        if (index < lid_cnt && i != index){
+            kal_mem_cpy(&lid_conf[i], &lid_conf[index], sizeof(nvram_mcf_lid_config_struct));
+            kal_mem_set(&lid_conf[index], 0, sizeof(nvram_mcf_lid_config_struct));
+            total_cnt++;
+        }else if(i == index){
+            total_cnt++;
+        }
+        
+        index ++;
+
+    }
+	
+	*lid_size = total_cnt;
+
+    
+    return ret;
+}
+#endif
+
+kal_int8* mcf_bytes_to_hex(const void *bytes, kal_int32 length, kal_bool upperCase, void *hex)
+{
+    kal_int8 *p_hex=(kal_int8*)hex, *p_bytes=(kal_int8*)bytes;
+    kal_int8 LCaseHexArray[] = "0123456789abcdef";
+    kal_int8 UCaseHexArray[] = "0123456789ABCDEF";
+    kal_uint32 i=0, v=0;
+    kal_mem_set(p_hex, 0, length*2 + 1);
+    
+    if (p_bytes == NULL) {
+        return NULL;
+    }
+    
+    for (i=0; i<length; i++) {
+        v=p_bytes[i]&0xFF;
+        if( v<0 || (v>>4)>=sizeof(LCaseHexArray) || (v&0x0F)>=sizeof(LCaseHexArray) || (v>>4) < 0 || (v&0x0F) < 0){
+            return NULL;
+        } else if( upperCase ){
+            p_hex[i*2] = UCaseHexArray[v >> 4];
+            p_hex[i*2 + 1] = UCaseHexArray[v & 0x0F];
+        } else{
+            p_hex[i*2] = LCaseHexArray[v >> 4];
+            p_hex[i*2 + 1] = LCaseHexArray[v & 0x0F];
+        }
+        
+    }
+    return p_hex;
+}
+
+kal_int8* mcf_hex_to_bytes(const void *hex, kal_int32 *length, void *bytes)
+{
+    kal_int8 *p_hex=(kal_int8*)hex, *p_bytes=(kal_int8*)bytes;
+    kal_int32 len_hex=mcf_str_strlen(p_hex), i=0, j=0;
+    kal_int8 temp[2];
+    
+    //EXT_ASSERT(len_hex%2==0, len_hex, bytes, 0);
+    if( len_hex%2==1 || len_hex<0 ){
+        return NULL;
+    }
+    
+    kal_mem_set(p_bytes, 0, len_hex / 2);
+    *length = 0;
+    
+    for( i=0; i<(len_hex/2); i++ ) {
+        temp[0] = p_hex[i * 2];
+		temp[1] = p_hex[i * 2 + 1];
+
+        for (j=0; j<2; j++) {
+            if (temp[j] >= 'A' && temp[j] <= 'F') {
+                temp[j] = temp[j] - 'A' + 10;
+            } else if (temp[j] >= 'a' && temp[j] <= 'f') {
+                temp[j] = temp[j] - 'a' + 10;
+            } else if (temp[j] >= '0' && temp[j] <= '9') {
+                temp[j] = temp[j] - '0';
+            } else {
+                return NULL;
+            }
+        }
+        p_bytes[i] = (temp[0]<<4) | temp[1];
+    }
+	*length = len_hex / 2;
+    
+    return p_bytes;
+}
+
+void mcf_replace_char(kal_char* src, kal_char old_ch, kal_char new_ch)
+{
+    kal_uint32 k = 0;
+    while(src[k] != 0)
+    {
+        if(src[k] == old_ch){
+            src[k] = new_ch;
+        }
+        k++;
+    }
+    
+}
+
+void mcf_snprintf(kal_char * str, size_t num, const char * fmt, ...)
+{
+    kal_int32     ret_snprintf = 0;
+    va_list       arglist;
+    
+    va_start(arglist, fmt);
+    ret_snprintf = vsnprintf(str, num, fmt, arglist);
+    va_end(arglist);
+    if (ret_snprintf < 0 || ret_snprintf > num){
+        strncpy(str, "unknown error", num - 1);
+        MD_TRC_MCF_TR_MCF_SNPRINTF_FAIL(num, ret_snprintf);
+    }
+}
+
+#ifdef __MCF_FIND_TAG_SUPPORT__
+extern MCF_DB_LID_MAPPING mcf_db_lid_mapping_tbl[];
+extern MCF_DB_STRUCT_IDX mcf_db_struct_idx_tbl[];
+kal_int32 mcf_parser_binary_search_struct_list(char *find_string, MCF_DB_STRUCT_VARIABLE const *struct_ptr, kal_uint32 struct_size)
+{
+    kal_int32 first = 0,             // First array element
+        last = struct_size - 1,       // Last array element
+        middle,                // Mid point of search
+        position = -1;         // Position of search value
+    kal_bool found = KAL_FALSE;        // Flag
+
+    while (!found && first <= last)
+    {
+        middle = (first + last) / 2;     // Calculate mid point
+        if(middle < 0)
+            return -1;
+        if (mcf_str_strcmp(struct_ptr[middle].variable_name, find_string) == 0)      // If value is found at mid
+        {
+            found = KAL_TRUE;
+            position = middle;
+        }
+        else if (mcf_str_strcmp(struct_ptr[middle].variable_name, find_string) > 0)  // If value is in lower half
+            last = middle - 1;
+        else
+            first = middle + 1;           // If value is in upper half
+    }
+    return position;
+}
+#endif
+kal_bool mcf_find_tag_offset(
+    kal_uint32 lid_num, 
+    char *tag_name, 
+    kal_uint16 *byte_offset, 
+    kal_uint16 *bit_offset, 
+    kal_uint32 *size,
+    MCF_DB_STRUCT_VARIABLE const **var_ptr,
+    mcf_tag_info_struct *tag_ptr)
+{
+#ifdef __MCF_FIND_TAG_SUPPORT__
+    kal_uint16 i = 0;
+    kal_uint16 array_size_cnt = 1;
+    kal_int32 lid_idx = -1, struct_idx = -1;
+    char *saveptr = NULL, *saveptr2 = NULL, *varstr = NULL, *substr = NULL;
+    char var_name[MAX_VAR_LEN] = {0};
+    kal_bool next_is_bit = KAL_FALSE;
+    kal_uint32 start_time = GET_CURRENT_TIME();
+    
+    if(tag_name == NULL || byte_offset == NULL || bit_offset == NULL || size == NULL)
+    {
+        MD_TRC_MCF_TR_FIND_TAG_ERROR_INPUT_NULL();
+        return KAL_FALSE;
+    }
+    
+    *byte_offset = 0;
+    *bit_offset = 0;
+    *size= 0;
+    dhl_print_string(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MCF, tag_name);
+    
+    for(i = 0 ; i < MCF_LID_MAPPING_TBL_SIZE ; i++)
+    {
+        if(mcf_db_lid_mapping_tbl[i].lid_num == lid_num)
+        {
+           lid_idx = i;
+           struct_idx = mcf_db_lid_mapping_tbl[i].struct_idx;
+           break;
+        }
+    }
+    
+    // can not find this lid_num in mcf_db_lid_mapping_tbl
+    if(lid_idx == -1 || struct_idx > MCF_STRUCT_LIST_TBL_SIZE)
+    {
+        MD_TRC_MCF_TR_FIND_TAG_ERROR_CAN_NOT_FIND_LID_NUM(lid_num, struct_idx);
+        return KAL_FALSE;
+    }
+    
+    // split "." for each variable
+    substr = kal_strtok_r(tag_name, ".", &saveptr);    
+    while (substr){
+        kal_int32 pos = -1;
+        MCF_DB_STRUCT_VARIABLE const *var_struct_ptr = NULL;
+        
+        // split "[" for get array num
+        varstr = kal_strtok_r(substr, "[", &saveptr2);
+        if(next_is_bit == KAL_TRUE){
+            kal_uint32 len = strlen(var_name);
+            var_name[len] = '.';
+            strcpy(var_name + len + 1, varstr);
+        }
+        else
+        {
+            strcpy(var_name, varstr);
+        }
+        
+        var_struct_ptr = mcf_db_struct_idx_tbl[struct_idx].struct_ptr;
+        pos =  mcf_parser_binary_search_struct_list(var_name, var_struct_ptr, mcf_db_struct_idx_tbl[struct_idx].struct_size);
+        if(pos == -1)
+        {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_FIND_TAG_ERROR_CAN_NOT_FIND_TAG);
+            MD_TRC_MCF_TR_FIND_TAG_ERROR_CAN_NOT_FIND_TAG();
+            dhl_print_string(TRACE_ERROR, DHL_USER_FLAG_NONE, MOD_MCF, var_name);
+            return KAL_FALSE;
+        }
+        
+        // get array size
+        if(next_is_bit == KAL_TRUE)
+        {
+            *bit_offset += var_struct_ptr[pos].bit_offset;
+            *size = var_struct_ptr[pos].total_size;
+        }
+        else
+        {
+            kal_uint32 array_size;
+            kal_uint8 i = 0;
+            tag_ptr->arr_cnt = 0;
+            *byte_offset += var_struct_ptr[pos].byte_offset;
+            *size = var_struct_ptr[pos].variable_size;
+            
+            varstr = kal_strtok_r(NULL, "[", &saveptr2);
+            if(varstr != NULL){
+                do{
+                    kal_uint8 j = 0;
+                    kal_uint32 n = 1;
+                    array_size = mcf_atoi(varstr);
+                    j = i+1;
+                    while(var_struct_ptr[pos].array_size[j] != 0)
+                    {
+                        n *= (var_struct_ptr[pos].array_size[j]);
+                        j++;
+                        array_size_cnt++;
+                    }
+                    i++;
+                    *byte_offset += (array_size * n * var_struct_ptr[pos].variable_size);
+                    tag_ptr->array_size[tag_ptr->arr_cnt] = array_size;
+                    tag_ptr->arr_cnt++;
+                }while((varstr = kal_strtok_r(NULL, "[", &saveptr2)) != NULL);
+
+                if (i > array_size_cnt){
+                    MD_TRC_MCF_TR_FIND_TAG_ERROR_OVER_SIZE(i, array_size_cnt);
+                    dhl_print_string(TRACE_ERROR, DHL_USER_FLAG_NONE, MOD_MCF, var_name);
+                    return KAL_FALSE;
+                }
+            }
+            else{
+                *size = var_struct_ptr[pos].total_size;
+            }
+        }
+
+        if(var_struct_ptr[pos].is_bit)
+        {
+            next_is_bit = KAL_TRUE;
+            tag_ptr->is_bit = KAL_TRUE;
+            tag_ptr->upper_vsize = var_struct_ptr[pos].variable_size;
+        }
+
+        if(var_struct_ptr[pos].struct_idx != -1)
+        {
+            struct_idx = var_struct_ptr[pos].struct_idx;
+        }
+
+        substr = kal_strtok_r(NULL, ".", &saveptr);
+        if (substr != 0){
+            tag_ptr->arr_cnt = 0;
+            kal_mem_set(tag_ptr->array_size, 0, 5);
+        }
+        *var_ptr = &var_struct_ptr[pos];
+    };
+    
+    MD_TRC_MCF_TR_FIND_TAG_RETURN_VALUE(lid_num, *byte_offset, *bit_offset, *size, CALCULATE_LETENCY_DURATION(start_time, GET_CURRENT_TIME()));
+    
+    return KAL_TRUE;
+#else
+    return KAL_FALSE;
+#endif
+}
+
+#ifdef __MCF_FIND_GID_SUPPORT__
+extern MCF_DB_GID_LIST_STRUCT MCF_DB_GID_LIST[];
+extern MCF_DB_GID_FORMULA_STRUCT MCF_DB_FORMULA_LIST[];
+kal_int32 mcf_gid_binary_search_gid_list(kal_uint32 gid)
+{
+    kal_int32 first = 0,             // First array element
+        last = MCF_MAX_GID_LIST_SIZE - 1,       // Last array element
+        middle,                // Mid point of search
+        position = -1;         // Position of search value
+    kal_bool found = KAL_FALSE;        // Flag
+
+    while (!found && first <= last)
+    {
+        middle = (first + last) / 2;     // Calculate mid point
+        if(middle < 0)
+            return -1;
+        if (gid == MCF_DB_GID_LIST[middle].gid)      // If value is found at mid
+        {
+            found = KAL_TRUE;
+            position = middle;
+        }
+        else if (gid < MCF_DB_GID_LIST[middle].gid)  // If value is in lower half
+            last = middle - 1;
+        else
+            first = middle + 1;           // If value is in upper half
+    }
+    return position;
+}
+kal_int32 mcf_gid_binary_search_gid_formula_list(kal_uint32 gid)
+{
+    kal_int32 first = 0,             // First array element
+        last = MCF_MAX_GID_FORMULA_LIST_SIZE - 1,       // Last array element
+        middle,                // Mid point of search
+        position = -1;         // Position of search value
+    kal_bool found = KAL_FALSE;        // Flag
+
+    while (!found && first <= last)
+    {
+        middle = (first + last) / 2;     // Calculate mid point
+        if(middle < 0)
+            return -1;
+        if (gid == MCF_DB_FORMULA_LIST[middle].gid)      // If value is found at mid
+        {
+            found = KAL_TRUE;
+            position = middle;
+        }
+        else if (gid < MCF_DB_FORMULA_LIST[middle].gid)  // If value is in lower half
+            last = middle - 1;
+        else
+            first = middle + 1;           // If value is in upper half
+    }
+    return position;
+}
+#endif
+kal_bool mcf_find_gid_offset(
+    kal_uint32 gid,
+    char *array_idx_string,
+    kal_uint16 *lid_num,
+    kal_uint16 *byte_offset,
+    kal_uint16 *bit_offset,
+    kal_uint32 *size,
+    kal_bool *is_bit
+)
+{
+#ifdef __MCF_FIND_GID_SUPPORT__
+    kal_int32 gid_list_pos = 0, gid_formula_list_pos = 0;
+    kal_uint32 start_time = GET_CURRENT_TIME();
+
+    if(byte_offset == NULL || bit_offset == NULL || size == NULL || is_bit == NULL || array_idx_string == NULL)
+    {
+        MD_TRC_MCF_TR_FIND_GID_ERROR_INPUT_NULL();
+        return KAL_FALSE;
+    }
+    
+    MD_TRC_MCF_TR_FIND_GID_START(gid, array_idx_string);
+    
+    gid_list_pos = mcf_gid_binary_search_gid_list(gid);
+    if(gid_list_pos == -1 || gid_list_pos < 0)
+    {
+        MCF_BOOT_TRACE(MCF_BOOT_TR_FIND_GID_ERROR_CAN_NOT_FIND_GID, gid);
+        MD_TRC_MCF_TR_FIND_GID_ERROR_CAN_NOT_FIND_GID(gid);
+        return KAL_FALSE;
+    }
+
+    *lid_num = MCF_DB_GID_LIST[gid_list_pos].lid_num;
+    *size = MCF_DB_GID_LIST[gid_list_pos].variable_size;
+    *is_bit = MCF_DB_GID_LIST[gid_list_pos].is_bit;
+    *bit_offset = MCF_DB_GID_LIST[gid_list_pos].bit_offset;
+    if(MCF_DB_GID_LIST[gid_list_pos].array_formula == KAL_FALSE)
+    {
+        *byte_offset = MCF_DB_GID_LIST[gid_list_pos].byte_offset;
+    }
+    else
+    {
+		kal_int32 array_size[10] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
+        kal_uint32 i = 0, j = 0;
+        kal_uint32 current_array_i = 0;
+        char *saveptr = NULL, *saveptr2 = NULL, *varstr = NULL, *substr = NULL;
+		char gid_formula_string[MCF_MAX_FORMULA_LEN] = {0};
+        char temp_array_idx[64] = {0};
+
+        *byte_offset = 0;
+        strncpy(temp_array_idx, array_idx_string, 63);
+        temp_array_idx[63] = '\0';
+        // parsing array_idx_string
+        varstr = kal_strtok_r(temp_array_idx, "$", &saveptr);
+        if(varstr != NULL){
+            do{
+                array_size[i++] = mcf_atoi(varstr);
+                if(i >= 10)
+               {
+                    MCF_BOOT_TRACE(MCF_BOOT_TR_FIND_GID_ERROR_FORMULA_OUT_OF_BOUND , gid);
+                    MD_TRC_MCF_TR_FIND_GID_ERROR_FORMULA_OUT_OF_BOUND(gid);
+                    dhl_print_string(TRACE_ERROR, DHL_USER_FLAG_NONE, MOD_MCF, temp_array_idx);
+                    return KAL_FALSE;
+                }
+            }while((varstr = kal_strtok_r(NULL, "$", &saveptr)) != NULL);
+
+        }
+
+        gid_formula_list_pos = mcf_gid_binary_search_gid_formula_list(gid);
+        if(gid_formula_list_pos == -1 || gid_formula_list_pos < 0)
+        {
+            MCF_BOOT_TRACE(MCF_BOOT_TR_FIND_GID_ERROR_CAN_NOT_FIND_FORMULA, gid);
+            MD_TRC_MCF_TR_FIND_GID_ERROR_CAN_NOT_FIND_FORMULA(gid);
+            return KAL_FALSE;
+        }
+
+        //[5](0,164)+[8](4,20)+[5](0,4)+0
+        //[10](0,12)+2+2
+        //[2,8,2](4,2)
+		strncpy(gid_formula_string, MCF_DB_FORMULA_LIST[gid_formula_list_pos].byte_offset_formula, MCF_MAX_FORMULA_LEN - 1);
+        substr = kal_strtok_r(gid_formula_string, "+", &saveptr);
+        if(substr != NULL){
+            do{
+				kal_int32 max_array_idx[5] = {-1,-1,-1,-1,-1};
+                kal_uint32 local_base = 0, local_size = 0, base = 0;
+                kal_uint32 max_array_i = 0;
+                kal_bool max_array_start = KAL_FALSE, local_start = KAL_FALSE, base_start = KAL_TRUE;
+				char temp[20] = {0};
+
+				j = 0;
+                while(substr[j] != '\0')
+                {
+                    if(substr[j] == '['){ 
+                        max_array_start = KAL_TRUE; local_start = KAL_FALSE; base_start = KAL_FALSE;
+						kal_mem_set(temp, 0, 20);
+						i = 0;
+                    } 
+                    else if(substr[j] == ']'){ 
+                        max_array_start = KAL_FALSE; local_start = KAL_FALSE; base_start = KAL_FALSE;
+						varstr = kal_strtok_r(temp, ",", &saveptr2);
+                        if(varstr != NULL){
+                            do{
+                                max_array_idx[max_array_i++] = mcf_atoi(varstr);
+                            }while((varstr = kal_strtok_r(NULL, ",", &saveptr2)) != NULL);
+                        }
+                    }
+                    else if(substr[j] == '('){
+                        max_array_start =  KAL_FALSE; local_start = KAL_TRUE; base_start = KAL_FALSE;
+						kal_mem_set(temp, 0, 20);
+						i = 0;
+                    }
+                    else if(substr[j] == ')'){
+                        max_array_start =  KAL_FALSE; local_start = KAL_FALSE; base_start = KAL_FALSE;
+						varstr = kal_strtok_r(temp, ",", &saveptr2);
+                        if (varstr != NULL){
+                            local_base = mcf_atoi(varstr);
+                        }
+                        varstr = kal_strtok_r(NULL, ",", &saveptr2);
+                        if (varstr != NULL){
+                            local_size = mcf_atoi(varstr);
+                        }
+                    }
+                    else // digit
+                    {
+                        // get max array idx
+                        if(max_array_start == KAL_TRUE)
+                        {
+                            temp[i++] = substr[j];
+                        }
+                        else if(local_start == KAL_TRUE)
+                        {
+                            temp[i++] = substr[j];
+                        }
+                        else if(base_start == KAL_TRUE)
+                        {
+                            base = mcf_atoi(substr);
+                        }
+                    }
+
+                    j++;
+                }
+                {
+                    kal_uint32 temp_offset = 0;
+                    for(i = 0; i< max_array_i; i++)
+                    {
+                        kal_uint32 array_idx = array_size[current_array_i++];
+                        kal_uint32 array_offset = 0;
+                        if(array_idx == -1) break;
+                        array_offset = array_idx * local_size;
+
+                        if(array_idx >= max_array_idx[i])
+                        {
+                            return KAL_FALSE; // array size error
+                        }
+                        for(j = i + 1 ; j < 5 ; j++)
+                        {
+                            if(max_array_idx[j] == -1) break;
+                            array_offset *= max_array_idx[j];
+                        }
+                        temp_offset += array_offset;
+
+                    }
+                    *byte_offset += temp_offset + local_base;
+
+                }
+                *byte_offset += base;
+           
+            }while((substr = kal_strtok_r(NULL, "+", &saveptr)) != NULL);
+        }
+
+
+    }
+
+    MD_TRC_MCF_TR_FIND_GID_RETURN_VALUE(*lid_num, *byte_offset, *bit_offset, *size, *is_bit, CALCULATE_LETENCY_DURATION(start_time, GET_CURRENT_TIME()));
+
+    return KAL_TRUE;
+#else
+    return KAL_FALSE;
+#endif
+}
+
+kal_uint16 mcf_find_gid_return_lid_num(kal_uint32 gid)
+{
+#ifdef __MCF_FIND_GID_SUPPORT__
+     kal_int32 gid_list_pos = 0;
+    gid_list_pos = mcf_gid_binary_search_gid_list(gid);
+    if(gid_list_pos == -1 || gid_list_pos < 0)
+    {
+        MCF_BOOT_TRACE(MCF_BOOT_TR_FIND_GID_RETURN_LID_NUM_ERROR_CAN_NOT_FIND_GID, gid);
+        MD_TRC_MCF_TR_FIND_GID_RETURN_LID_NUM_ERROR_CAN_NOT_FIND_GID(gid);
+        return -1; // not found
+    }
+    return MCF_DB_GID_LIST[gid_list_pos].lid_num;
+#else
+    return -1;
+#endif
+}
+
+kal_uint32 mcf_calc_check_sum(kal_uint32 *ptr, kal_uint32 len)
+{
+    kal_uint32 check_sum = 0, i = 0;
+    for(i = 0; i< (len/sizeof(kal_uint32)) ; i++, ptr++)
+        check_sum += *ptr;
+    check_sum = ~check_sum + 1;
+    return check_sum;
+}
+kal_uint32 mcf_check_check_sum(kal_uint32 *ptr, kal_uint32 len)
+{
+    kal_uint32 check_sum = 0, i = 0;
+    for(i = 0; i< (len/sizeof(kal_uint32)) ; i++, ptr++)
+        check_sum += *ptr;
+    
+    if(check_sum != 0)
+        MD_TRC_MCF_TR_CHECKSUM_ERROR(check_sum);
+    
+    return check_sum;
+}
+
+// password will be auto padding to 16B
+// content should be padding to 16B alignment
+// conrent length should be mod by 16
+kal_bool mcf_encrypt_128bit(char *password, char *content, kal_uint32 content_length)
+{
+    kal_uint8 iv[]  = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
+    kal_uint8 copy_len = 0; 
+    kal_uint32 output_len;
+    t_cust_chl_sym_key key;
+    AES_PARAM aes_param;
+    kal_uint32 ret = CUST_CHL_ERROR_NONE;
+    kal_uint32 start_time = ust_get_current_time();
+    
+    if(content == NULL) return KAL_FALSE;
+    if(content_length % 16 != 0) return KAL_FALSE;
+    
+    copy_len = strlen(password);
+    if(copy_len > 16) copy_len = 16;
+    
+    key.m_key_len = 16;
+    kal_mem_set(key.m_key, 0, sizeof(key.m_key));
+    kal_mem_cpy(&key.m_key, password, copy_len);
+    aes_param.IVLength = 16;
+    aes_param.IV = iv;
+    ret = CustCHL_AES_Encrypt_data(CUST_CHL_ALG_AES128, CUST_CHL_MODE_CBC, content_length, (kal_uint8 *)content, &output_len, (kal_uint8 *)content, &key, &aes_param);
+    
+    MD_TRC_MCF_TR_ENCRYPT(ust_us_duration(start_time, ust_get_current_time()));
+    if (ret != CUST_CHL_ERROR_NONE)
+        return KAL_FALSE;
+    return KAL_TRUE;
+}
+
+// password will be auto padding to 16B
+// content should be padding to 16B alignment
+// conrent length should be mod by 16
+kal_bool mcf_decrypt_128bit(char *password, char *content, kal_uint32 content_length)
+{
+    kal_uint8 iv[]  = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
+    kal_uint8 copy_len = 0; 
+    kal_uint32 output_len;
+    t_cust_chl_sym_key key;
+    AES_PARAM aes_param;
+    kal_uint32 ret = CUST_CHL_ERROR_NONE;
+    kal_uint32 start_time = ust_get_current_time();
+    
+    if(content == NULL) return KAL_FALSE;
+    if(content_length % 16 != 0) return KAL_FALSE;
+    
+    copy_len = strlen(password);
+    if(copy_len > 16) copy_len = 16;
+    
+    key.m_key_len = 16;
+    kal_mem_set(key.m_key, 0, sizeof(key.m_key));
+    kal_mem_cpy(&key.m_key, password, copy_len);
+    aes_param.IVLength = 16;
+    aes_param.IV = iv;
+    ret = CustCHL_AES_Decrypt_data(CUST_CHL_ALG_AES128, CUST_CHL_MODE_CBC, content_length, (kal_uint8 *)content, &output_len, (kal_uint8 *)content, &key, &aes_param);
+   
+    MD_TRC_MCF_TR_DECRYPT(ust_us_duration(start_time, ust_get_current_time()));
+    if (ret != CUST_CHL_ERROR_NONE)
+        return KAL_FALSE;
+    
+    return KAL_TRUE;
+}
+#ifdef __MCF_COMBINE_FILE_SUPPORT__
+void mcf_merge_insert_node(mcf_merge_link_list_struct *pre_node, mcf_merge_link_list_struct *next_node, mcf_merge_link_list_struct *insert_node, void *insert_data)
+{
+    if(pre_node != NULL) pre_node->next_node = insert_node;
+    if(next_node != NULL) next_node->pre_node = insert_node;
+    insert_node->pre_node = pre_node;
+    insert_node->next_node = next_node;
+    insert_node->data = insert_data;
+    MD_TRC_MCF_TR_MERGE_LINK_LIST_INSERT_NODE_INFO((pre_node != NULL)?(kal_uint32)pre_node->next_node : 0, 
+                                                   (next_node != NULL)?(kal_uint32)next_node->pre_node : 0, 
+                                                   (kal_uint32)insert_node->pre_node, (kal_uint32)insert_node->next_node);
+}
+
+// comparison sequence : LID => RID => GID => array idx
+kal_int8 mcf_merge_compare_ota_data(mcf_tool_gid_ota_file_item_t *first_data, mcf_tool_gid_ota_file_item_t *second_data)
+{
+    kal_uint16 first_lid_num = mcf_find_gid_return_lid_num(first_data->global_id);
+    kal_uint16 second_lid_num = mcf_find_gid_return_lid_num(second_data->global_id);
+    kal_int32 array_cmp_result = 0;
+    
+    MD_TRC_MCF_TR_MERGE_CMP_OTA_DATA_INFO(first_lid_num, first_data->record_idx, first_data->global_id, second_lid_num, second_data->record_idx, second_data->global_id);
+
+    if(first_lid_num < second_lid_num) return -1;
+    else if (first_lid_num > second_lid_num) return 1;
+    
+    if(first_data->record_idx < second_data->record_idx) return -1;
+    else if (first_data->record_idx > second_data->record_idx) return 1;
+    
+    if(first_data->global_id < second_data->global_id) return -1;
+    else if (first_data->global_id > second_data->global_id) return 1;
+    
+    if (first_data->array_index_len > 0)
+    {
+        array_cmp_result= strncmp(&(first_data->buff_start), &(second_data->buff_start), first_data->array_index_len);
+        MD_TRC_MCF_TR_MERGE_CMP_OTA_DATA_ARRAY_INFO(array_cmp_result);
+        if (array_cmp_result < 0) return -1;
+        if (array_cmp_result > 0) return 1;
+    }
+
+    return 0;
+}
+
+kal_int8 mcf_merge_compare_ota_by_op_tag(char *tag1, char *tag2)
+{
+	kal_uint16 tag1_sbpid= 0, tag1_mcc=0, tag1_mnc=0, tag2_sbpid=0, tag2_mcc=0, tag2_mnc=0; // use 0 as "NA"
+	kal_char sbp_id_tag[MCF_MAX_TAG_NUM] = {0};
+	const char *delim = "_";
+	char * pch;
+    kal_char *saveptr = NULL;
+	// parsing tag1
+	strncpy(sbp_id_tag, tag1, MCF_MAX_TAG_NUM-1);
+	pch = kal_strtok_r(sbp_id_tag, delim, &saveptr);
+	if (pch != NULL && strcmp(pch, "NA") != 0) tag1_sbpid = mcf_atoi(pch);
+	pch = kal_strtok_r(NULL, delim, &saveptr);
+	if (pch != NULL && strcmp(pch, "NA") != 0) tag1_mcc = mcf_atoi(pch);
+	pch = kal_strtok_r(NULL, delim, &saveptr);
+	if (pch != NULL && strcmp(pch, "NA") != 0) tag1_mnc = mcf_atoi(pch);
+	// parsing tag2
+	strncpy(sbp_id_tag, tag2, MCF_MAX_TAG_NUM-1);
+	pch = kal_strtok_r(sbp_id_tag, delim, &saveptr);
+	if (pch != NULL && strcmp(pch, "NA") != 0) tag2_sbpid = mcf_atoi(pch);
+	pch = kal_strtok_r(NULL, delim, &saveptr);
+	if (pch != NULL && strcmp(pch, "NA") != 0) tag2_mcc = mcf_atoi(pch);
+	pch = kal_strtok_r(NULL, delim, &saveptr);
+	if (pch != NULL && strcmp(pch, "NA") != 0) tag2_mnc = mcf_atoi(pch);
+
+	// comparion
+	// SBP
+	if ((tag1_sbpid == tag2_sbpid) && (tag1_mcc == tag2_mcc) && (tag1_mnc == tag2_mnc))
+		return 0;
+	else if (tag1_sbpid > tag2_sbpid)
+		return 1;
+	else if (tag1_sbpid < tag2_sbpid)
+		return -1;
+	else
+	{
+		// SBP is equal, then compare MCC
+		if (tag1_mcc > tag2_mcc)      return 1;
+		else if (tag1_mcc < tag2_mcc) return -1;
+		else
+		{
+			// SBP and MCC are equal, then compare MNC
+			if (tag1_mnc > tag2_mnc)      return 1;
+			else if (tag1_mnc < tag2_mnc) return -1;
+		}
+	}
+	return 0;
+}
+
+// comparison sequence : LID => TAG type=> TAG => GID => array idx
+kal_int8 mcf_merge_compare_ota_by_op_data(mcf_tool_gid_tlvota_file_item_t *first_data, mcf_tool_gid_tlvota_file_item_t *second_data)
+{
+    kal_uint16 first_lid_num = mcf_find_gid_return_lid_num(first_data->global_id);
+    kal_uint16 second_lid_num = mcf_find_gid_return_lid_num(second_data->global_id);
+    kal_int32 array_cmp_result = 0;
+
+    MD_TRC_MCF_TR_MERGE_CMP_OTA_DATA_INFO(first_lid_num, first_data->tag_type, first_data->global_id, second_lid_num, second_data->tag_type, second_data->global_id);
+    
+    if(first_lid_num < second_lid_num) return -1;
+    else if (first_lid_num > second_lid_num) return 1;
+    
+    if(first_data->tag_type < second_data->tag_type) return -1;
+    else if (first_data->tag_type > second_data->tag_type) return 1;
+    
+    {
+        kal_char sbp_tag1[MCF_FILE_MAX_TAG_LEN] = {0};
+        kal_char sbp_tag2[MCF_FILE_MAX_TAG_LEN] = {0};
+        kal_int8 result= 0;
+        
+        strncpy(sbp_tag1, &(first_data->buff_start) , first_data->tag_len);
+        strncpy(sbp_tag2, &(second_data->buff_start) , second_data->tag_len);
+        
+        result= mcf_merge_compare_ota_by_op_tag(sbp_tag1, sbp_tag2);
+        if(result < 0) return -1;
+        if(result > 0) return 1;
+    }
+    
+    if(first_data->global_id < second_data->global_id) return -1;
+    else if (first_data->global_id > second_data->global_id) return 1;
+    
+    if (first_data->array_index_len > 0)
+    {
+        array_cmp_result = strncmp(&(first_data->buff_start) + first_data->tag_len, &(second_data->buff_start) + second_data->tag_len, first_data->array_index_len);
+        MD_TRC_MCF_TR_MERGE_CMP_OTA_DATA_ARRAY_INFO(array_cmp_result);
+        if (array_cmp_result < 0) return -1;
+        if (array_cmp_result > 0) return 1;
+    }
+
+    return 0;
+}
+
+// sort by ascending 
+mcf_merge_link_list_struct * mcf_merge_link_list_insert(mcf_merge_link_list_struct *head, mcf_merge_link_list_struct *tail, mcf_merge_link_list_struct *current, void *insert_data, mcf_ota_type_enum type)
+{
+    mcf_merge_link_list_struct *current_node = head->next_node;
+    mcf_merge_link_list_struct *new_node = NULL;
+    kal_int8 result = 0;
+    if (type == MCF_TYPE_OTA)			 MD_TRC_MCF_TR_MERGE_LINK_LIST_INSERT_DATA_START(((mcf_tool_gid_ota_file_item_t *)insert_data)->global_id);
+    else if (type == MCF_TYPE_OTA_BY_OP) MD_TRC_MCF_TR_MERGE_LINK_LIST_INSERT_DATA_START(((mcf_tool_gid_tlvota_file_item_t *)insert_data)->global_id);
+
+    if (current != NULL)
+    {
+        // quick determine
+        if (type == MCF_TYPE_OTA)
+        {
+            result = mcf_merge_compare_ota_data((mcf_tool_gid_ota_file_item_t *)insert_data, (mcf_tool_gid_ota_file_item_t *)current->data);
+        }
+        else if (type == MCF_TYPE_OTA_BY_OP)
+        {
+            result = mcf_merge_compare_ota_by_op_data((mcf_tool_gid_tlvota_file_item_t *)insert_data, (mcf_tool_gid_tlvota_file_item_t *)current->data);
+        }
+        else
+        {
+            DEBUG_ASSERT(0);
+            return NULL;
+        }
+        MD_TRC_MCF_TR_MERGE_LINK_LIST_INSERT_CMP_RESULT(result);
+        // if insert data >= current, then start from current.
+        // if insert data < current, back to head to find again.
+        if (result == 1 || result == 0) {
+            current_node = current;
+            MD_TRC_MCF_TR_MERGE_LINK_LIST_USE_CURRENT_AS_START();
+        }
+        else {
+            current_node = head->next_node;
+            MD_TRC_MCF_TR_MERGE_LINK_LIST_USE_HEAD_AS_START();
+        }
+    }
+
+    while (current_node != tail)
+    {
+        // ========= COMPARE NODE =========
+        result = 0;
+        if (type == MCF_TYPE_OTA)
+        {
+            result = mcf_merge_compare_ota_data((mcf_tool_gid_ota_file_item_t *)insert_data, (mcf_tool_gid_ota_file_item_t *)current_node->data);
+        }
+        else if (type == MCF_TYPE_OTA_BY_OP)
+        {
+            result = mcf_merge_compare_ota_by_op_data((mcf_tool_gid_tlvota_file_item_t *)insert_data, (mcf_tool_gid_tlvota_file_item_t *)current_node->data);
+        }
+        else
+        {
+            DEBUG_ASSERT(0);
+            return NULL;
+        }
+        MD_TRC_MCF_TR_MERGE_LINK_LIST_INSERT_CMP_RESULT(result);
+        // ========= INSERT NODE =========
+        // insert data should be inserted BEFORE current node
+        if (result == -1)
+        {
+            new_node = mcf_malloc(sizeof(mcf_merge_link_list_struct)); 
+            if(new_node == NULL) return NULL;
+            MD_TRC_MCF_TR_MERGE_OTA_BUFFER_ALLOCATE((kal_uint32)new_node);
+            kal_mem_set(new_node, 0, sizeof(mcf_merge_link_list_struct));
+            mcf_merge_insert_node(current_node->pre_node, current_node, new_node, insert_data);
+            return current_node->pre_node;
+        }
+        // insert data should be REPLACED current node
+        else if (result == 0)
+        {
+            current_node->data = insert_data;
+            return current_node;
+        }
+        // insert data should be inserted AFTER current node
+        else if (result == 1)
+        {
+            // due to the link list is acending, skip
+        }
+        else
+            DEBUG_ASSERT(0);
+
+        current_node = current_node->next_node;
+    }
+
+    // insert the last
+    new_node = mcf_malloc(sizeof(mcf_merge_link_list_struct)); 
+    if(new_node == NULL) return NULL;
+    MD_TRC_MCF_TR_MERGE_OTA_BUFFER_ALLOCATE((kal_uint32)new_node);
+    kal_mem_set(new_node, 0, sizeof(mcf_merge_link_list_struct));
+    mcf_merge_insert_node(current_node->pre_node, current_node, new_node, insert_data);
+
+    return current_node->pre_node;
+}
+
+void mcf_merge_link_list_free(mcf_merge_link_list_struct *head)
+{
+    mcf_merge_link_list_struct *current = head;
+    while (current != NULL)
+    {
+        mcf_merge_link_list_struct *next = current->next_node;
+        MD_TRC_MCF_TR_MERGE_OTA_BUFFER_FREE((kal_uint32)current);
+        mcf_free(current);
+        current = next;
+    }
+}
+
+kal_bool mcf_merge_read_buffer_to_linklist(void *buffer, mcf_merge_link_list_struct *head, mcf_merge_link_list_struct *tail, mcf_ota_type_enum type)
+{
+    mcf_tool_file_info_t *file_header = (mcf_tool_file_info_t *)buffer;
+    kal_uint32 item_cnt = 0; 
+    mcf_merge_link_list_struct *current = NULL;
+    
+    if (type == MCF_TYPE_OTA) {
+        mcf_tool_gid_ota_file_item_t *current_data = (mcf_tool_gid_ota_file_item_t *)((kal_uint8 *)file_header + file_header->total_len);
+        MD_TRC_MCF_TR_MERGE_READ_BUFFER_TO_LINKLIST_TOTAL_ITEM(file_header->item_num);
+        for (item_cnt = 0 ; item_cnt < file_header->item_num ; item_cnt ++)
+        {
+            current = mcf_merge_link_list_insert(head, tail, current, current_data, type);
+            if(current == NULL) return KAL_FALSE;
+            MD_TRC_MCF_TR_MERGE_READ_BUFFER_TO_LINKLIST_ITEM_INFO(item_cnt, current_data->global_id);
+            current_data = (mcf_tool_gid_ota_file_item_t *)((kal_uint8 *)current_data + current_data->total_len);
+        }   
+    }
+    else if (type == MCF_TYPE_OTA_BY_OP)
+    {
+        mcf_tool_gid_tlvota_file_item_t *current_data = (mcf_tool_gid_tlvota_file_item_t *)((kal_uint8 *)file_header + file_header->total_len);
+        MD_TRC_MCF_TR_MERGE_READ_BUFFER_TO_LINKLIST_TOTAL_ITEM(file_header->item_num);
+        for (item_cnt = 0 ; item_cnt < file_header->item_num ; item_cnt ++)
+        {
+            current = mcf_merge_link_list_insert(head, tail, current, current_data, type);
+            if(current == NULL) return KAL_FALSE;
+            MD_TRC_MCF_TR_MERGE_READ_BUFFER_TO_LINKLIST_ITEM_INFO(item_cnt, current_data->global_id);
+            current_data = (mcf_tool_gid_tlvota_file_item_t *)((kal_uint8 *)current_data + current_data->total_len);
+        }   
+    }
+    else
+    {
+        DEBUG_ASSERT(0);
+        return KAL_FALSE;
+    }
+    return KAL_TRUE;
+}
+
+void mcf_merge_make_ota_file_header(mcf_tool_file_info_t *output_header, mcf_tool_file_info_t *copy_header)
+{
+    kal_char sw_version[MCF_SW_VERNO_LEN] = {0};
+    kal_char gen_time[MCF_FILE_MAX_GEN_TIME_LEN] = {0};
+    
+    struct tm current_time;
+    
+#if defined(__MTK_TARGET__) && defined(__SUPPORT_CLIB_TIME__)
+	time_t currenttime;
+	kal_mem_set(&current_time, 0, sizeof(struct tm));
+	if (time(&currenttime) != -1)
+		localtime_r(&currenttime, &current_time);
+#else
+    current_time.tm_year = 118;
+    current_time.tm_mon = 0;
+    current_time.tm_mday = 1;
+    current_time.tm_hour = 0;
+    current_time.tm_min = 0;
+    current_time.tm_sec = 0;
+#endif
+    MD_TRC_MCF_TR_MERGE_MAKE_OTA_FILE_HEADER_START();
+    kal_mem_set(output_header, 0, sizeof(mcf_tool_file_info_t));
+    
+    kal_mem_set(sw_version, 0, sizeof(kal_char) * MCF_SW_VERNO_LEN);
+    kal_mem_set(gen_time, 0, sizeof(kal_char) * MCF_FILE_MAX_GEN_TIME_LEN);
+    
+    if(sprintf(gen_time,"%04d.%02d%02d.%02d%02d%02d", current_time.tm_year + 1900, current_time.tm_mon + 1, current_time.tm_mday, current_time.tm_hour, current_time.tm_min, current_time.tm_sec) <0)
+		DEBUG_ASSERT(0);
+    strncpy(sw_version, release_verno(), MCF_SW_VERNO_LEN-1);
+
+    output_header->sw_version_len = strlen(sw_version);
+    output_header->gen_time_len = strlen(gen_time);
+    output_header->file_version = copy_header->file_version;
+    output_header->operation_mask = copy_header->operation_mask;
+    if((output_header->operation_mask & MCF_FILE_OP_SHA256_RSA2048) || (output_header->operation_mask & MCF_FILE_OP_SHA384_RSA3072))
+    {
+        output_header->operation_mask &= ~(MCF_FILE_OP_SHA256_RSA2048);
+        output_header->operation_mask &= ~(MCF_FILE_OP_SHA384_RSA3072);
+    }
+    strcpy(output_header->file_type, copy_header->file_type);
+    // copy header
+    {
+        // use copy_len to prevent out of array
+        kal_uint32 copy_len = 0;
+        if (output_header->sw_version_len >= MCF_SW_VERNO_LEN -1) copy_len = MCF_SW_VERNO_LEN -1;
+        else copy_len = output_header->sw_version_len;
+        strncpy(&output_header->buff_start, sw_version, copy_len);
+        
+        if (output_header->gen_time_len >= MCF_FILE_MAX_GEN_TIME_LEN -1) copy_len = MCF_FILE_MAX_GEN_TIME_LEN -1;
+        else copy_len = output_header->gen_time_len;
+        strncpy(&output_header->buff_start + output_header->sw_version_len, gen_time, copy_len);
+    }
+    output_header->total_len = (kal_uint32)&output_header->buff_start + output_header->sw_version_len + output_header->gen_time_len - (kal_uint32)output_header;    // end addr - start addr
+    if ((output_header->total_len % 4) != 0)
+        output_header->total_len += 4 - (output_header->total_len % 4); // 4 bytes alignment
+    MD_TRC_MCF_TR_MERGE_MAKE_OTA_FILE_HEADER_END();
+}
+
+// if first buffer has same gid, it will be replaced by second_buffer
+kal_bool mcf_merge_ota_buffer(void *first_buffer, void *second_buffer, void *output_buffer, kal_uint32 output_buffer_size)
+{
+    mcf_merge_link_list_struct *head, *tail; 
+    mcf_ota_type_enum type = 0;
+    kal_bool ret = KAL_FALSE;
+    kal_uint32 coreID = kal_get_current_core_id();
+
+    MD_TRC_MCF_TR_MERGE_OTA_BUFFER_START();
+    MD_TRC_MCF_TR_MERGE_OTA_BUFFER_MCF_CORE(coreID);
+    //If MCF is running on Core0, need to wake up Core1 to run other task
+    if (coreID == 0){
+        SleepDrv_LockSleep( SLEEP_CTL_MCF, CORE1);
+        MD_TRC_MCF_TR_MERGE_OTA_BUFFER_LOCK_CORE(CORE1, coreID);
+    }
+    if (first_buffer == NULL || second_buffer == NULL || output_buffer == NULL) {
+        MD_TRC_MCF_TR_MERGE_OTA_BUFFER_INPUT_PARAM_ERROR((kal_uint32)first_buffer, (kal_uint32)second_buffer, (kal_uint32)output_buffer);
+        if (coreID == 0){
+            SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+            MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+        }
+        return KAL_FALSE;
+    }
+    
+    // head init
+    head = mcf_malloc(sizeof(mcf_merge_link_list_struct)); 
+    tail = mcf_malloc(sizeof(mcf_merge_link_list_struct)); 
+    if(head == NULL || tail == NULL){
+        if (coreID == 0){
+            SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+            MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+        }
+        return KAL_FALSE;
+    }
+    kal_mem_set(head, 0, sizeof(mcf_merge_link_list_struct));
+    kal_mem_set(tail, 0, sizeof(mcf_merge_link_list_struct));
+    head->next_node = tail;
+    tail->pre_node = head;
+    MD_TRC_MCF_TR_MERGE_OTA_BUFFER_ALLOCATE_HEAD_TAIL((kal_uint32)head, (kal_uint32)tail);
+    // ========== read first buffer ==========
+    {
+        mcf_tool_file_info_t *file_header = (mcf_tool_file_info_t *)first_buffer;
+        if (strcmp(file_header->file_type, MCF_FILE_TYPE_OTA) == 0) type = MCF_TYPE_OTA;
+        else if (strcmp(file_header->file_type, MCF_FILE_TYPE_TLVOTA) == 0) type = MCF_TYPE_OTA_BY_OP;
+        else{
+            DEBUG_ASSERT(0);
+            if (coreID == 0){
+                SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+                MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+            }
+            return KAL_FALSE;
+        }
+        MD_TRC_MCF_TR_MERGE_OTA_BUFFER_FIRST_BUFFER_TYPE(type);
+        ret = mcf_merge_read_buffer_to_linklist(first_buffer, head, tail, type);
+        if(ret == KAL_FALSE){
+            if (coreID == 0){
+                SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+                MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+            }
+            return KAL_FALSE;
+        }
+    }
+    // ========== read second buffer ==========
+    {
+        mcf_tool_file_info_t *file_header = (mcf_tool_file_info_t *)second_buffer;
+        if (strcmp(file_header->file_type, MCF_FILE_TYPE_OTA) == 0) type = MCF_TYPE_OTA;
+        else if (strcmp(file_header->file_type, MCF_FILE_TYPE_TLVOTA) == 0) type = MCF_TYPE_OTA_BY_OP;
+        else{
+            DEBUG_ASSERT(0);
+            if (coreID == 0){
+                SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+                MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+            }
+            return KAL_FALSE;
+        }
+        MD_TRC_MCF_TR_MERGE_OTA_BUFFER_SECOND_BUFFER_TYPE(type);
+        ret = mcf_merge_read_buffer_to_linklist(second_buffer, head, tail, type);
+        if(ret == KAL_FALSE){
+            if (coreID == 0){
+                SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+                MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+            }
+            return KAL_FALSE;
+        }
+    }
+    // ========== output buffer ==========
+    {
+        mcf_tool_file_info_t *copy_header = (mcf_tool_file_info_t *)second_buffer;
+        mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_buffer;
+        kal_uint8 *current_pos = NULL;
+        mcf_merge_link_list_struct *current_node = head->next_node;
+        
+        mcf_merge_make_ota_file_header(output_header, copy_header); // copy first header to output header
+        current_pos = (kal_uint8 *)output_header + output_header->total_len;
+        
+        if (strcmp(output_header->file_type, MCF_FILE_TYPE_OTA) == 0) type = MCF_TYPE_OTA;
+        else if (strcmp(output_header->file_type, MCF_FILE_TYPE_TLVOTA) == 0) type = MCF_TYPE_OTA_BY_OP;
+        else{
+            DEBUG_ASSERT(0);
+            if (coreID == 0){
+                SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+                MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+            }
+            return KAL_FALSE;
+        }
+            
+        while (current_node != tail)
+        {
+            if (type == MCF_TYPE_OTA)
+            {
+                mcf_tool_gid_ota_file_item_t *current_ota_data = current_node->data;
+                kal_mem_cpy(current_pos, current_ota_data, current_ota_data->total_len);
+                current_pos += current_ota_data->total_len;
+                MD_TRC_MCF_TR_MERGE_OTA_BUFFER_OUTPUT_GID(current_ota_data->global_id);
+                mcf_dump_data(KAL_FALSE, &current_ota_data->buff_start + current_ota_data->array_index_len, current_ota_data->value_len);
+            }
+            else if (type == MCF_TYPE_OTA_BY_OP)
+            {
+                mcf_tool_gid_tlvota_file_item_t *current_ota_by_data = current_node->data;
+                kal_mem_cpy(current_pos, current_ota_by_data, current_ota_by_data->total_len);
+                current_pos += current_ota_by_data->total_len;
+                MD_TRC_MCF_TR_MERGE_OTA_BUFFER_OUTPUT_GID(current_ota_by_data->global_id);
+                mcf_dump_data(KAL_FALSE, &current_ota_by_data->buff_start + current_ota_by_data->tag_len + current_ota_by_data->array_index_len, current_ota_by_data->value_len);
+            }
+            current_node = current_node->next_node;
+            output_header->item_num++;
+            output_header->file_size = (kal_uint32)((kal_uint8 *)current_pos - (kal_uint8 *)output_header);
+            if (output_header->file_size > output_buffer_size)
+            {
+                MD_TRC_MCF_TR_MERGE_OTA_BUFFER_OUTPUT_BUFFER_OUT_OF_SIZE(output_header->file_size, output_buffer_size);
+                if (coreID == 0){
+                    SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+                    MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+                }
+                return KAL_FALSE;
+            }
+        }
+        
+        if ((output_header->operation_mask & MCF_FILE_OP_AES_128) || (output_header->operation_mask & MCF_FILE_OP_AES_256))
+		{
+			if (((output_header->file_size - output_header->total_len) % 16) != 0)
+				output_header->file_size += 16 - (output_header->file_size - output_header->total_len) % 16; // content should be 16 bytes alignment
+		}
+		else if (((output_header->file_size - output_header->total_len) % 4) != 0)
+		{
+			output_header->file_size += 4 - (output_header->file_size - output_header->total_len) % 4; // content should be 4 bytes alignment
+		}
+        
+    }
+    
+    // ========== security ==========
+    {
+        mcf_tool_file_info_t *file_header = (mcf_tool_file_info_t *)output_buffer;
+        // checksum
+        if (file_header->operation_mask & MCF_FILE_OP_CHECKSUM) 
+        {
+            file_header->checksum = 0;
+            file_header->checksum = mcf_calc_check_sum((kal_uint32 *)output_buffer, file_header->file_size);
+        }
+        // encrypt
+        if (file_header->operation_mask & MCF_FILE_OP_AES_128) 
+        {
+            kal_char password[MCF_MAX_PASSWORD_LEN] = {0};
+            mcf_get_custom_aes_password(password);
+            if (mcf_encrypt_128bit(password, (kal_char *)((kal_uint8 *)file_header + file_header->total_len), (file_header->file_size - file_header->total_len)) == KAL_FALSE)
+            {
+                if (coreID == 0){
+                    SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+                    MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+                }
+                return KAL_FALSE;
+            }
+        }
+        else if (file_header->operation_mask & MCF_FILE_OP_AES_256) 
+        {
+            kal_char password[MCF_MAX_PASSWORD_LEN] = {0};
+            mcf_get_custom_aes_password(password);
+            if (mcf_encrypt_256bit(password, (kal_char *)((kal_uint8 *)file_header + file_header->total_len), (file_header->file_size - file_header->total_len)) == KAL_FALSE)
+            {
+                if (coreID == 0){
+                    SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+                    MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+                }
+                return KAL_FALSE;
+            }
+        }
+    }
+    
+    mcf_merge_link_list_free(head);
+    MD_TRC_MCF_TR_MERGE_OTA_BUFFER_END();
+    if (coreID == 0){
+        SleepDrv_UnlockSleep( SLEEP_CTL_MCF, CORE1);
+        MD_TRC_MCF_TR_MERGE_OTA_BUFFER_UNLOCK_CORE(CORE1, coreID);
+    }
+    return KAL_TRUE;
+}
+
+// NOTE : if this gid needs to merge to a file, call mcf_merge_ota_buffer to combine this buffer
+kal_bool mcf_merge_one_gid(void *new_gid, mcf_ota_type_enum type, void *output_buffer, kal_uint32 output_buffer_size, kal_uint32 operation_mask)
+{
+    MD_TRC_MCF_TR_MERGE_ONE_GID_START();
+    if (new_gid == NULL || output_buffer == NULL) {
+        MD_TRC_MCF_TR_MERGE_ONE_GID_INPUT_PARAM_ERROR((kal_uint32)new_gid, (kal_uint32)output_buffer);
+        return KAL_FALSE;
+    }
+    
+    mcf_tool_file_info_t copy_header;
+    mcf_tool_file_info_t *output_header = (mcf_tool_file_info_t *)output_buffer;
+    kal_uint32 gid_size = 0;
+    copy_header.file_version = 3;
+    copy_header.operation_mask = operation_mask;
+    mcf_merge_make_ota_file_header(output_header, &copy_header); // copy first header to output header
+    if (type == MCF_TYPE_OTA)
+    {
+        strcpy(output_header->file_type, MCF_FILE_TYPE_OTA);
+        mcf_tool_gid_ota_file_item_t *ota = new_gid;
+        gid_size = ota->total_len;
+        MD_TRC_MCF_TR_MERGE_OTA_BUFFER_OUTPUT_GID(ota->global_id);
+        mcf_dump_data(KAL_FALSE, &ota->buff_start + ota->array_index_len, ota->value_len);
+    }
+    else if (type == MCF_TYPE_OTA_BY_OP)
+    {
+        strcpy(output_header->file_type, MCF_FILE_TYPE_TLVOTA);
+        mcf_tool_gid_tlvota_file_item_t *ota_by_op = new_gid;
+        gid_size = ota_by_op->total_len;
+        MD_TRC_MCF_TR_MERGE_OTA_BUFFER_OUTPUT_GID(ota_by_op->global_id);
+        mcf_dump_data(KAL_FALSE, &ota_by_op->buff_start + ota_by_op->tag_len + ota_by_op->array_index_len, ota_by_op->value_len);
+    }
+    else
+    {
+        return KAL_FALSE;
+    }
+    // check buffer size
+    if ((output_header->total_len + gid_size) > output_buffer_size) {
+        MD_TRC_MCF_TR_MERGE_OTA_BUFFER_OUTPUT_BUFFER_OUT_OF_SIZE((output_header->total_len + gid_size), output_buffer_size);
+        return KAL_FALSE;
+    }
+    
+    kal_mem_cpy((kal_uint8 *)output_buffer + output_header->total_len, new_gid, gid_size);
+    output_header->item_num = 1;
+    output_header->file_size = (kal_uint32)((kal_uint8 *)output_buffer + output_header->total_len + gid_size - (kal_uint8 *)output_header);
+    if (((output_header->file_size - output_header->total_len) % 4) != 0)
+        output_header->file_size += 4 - (output_header->file_size - output_header->total_len) % 4; // content should be 16 bytes alignment
+    // ========== security ==========
+    {
+        mcf_tool_file_info_t *file_header = (mcf_tool_file_info_t *)output_buffer;
+        // checksum
+        if (file_header->operation_mask & MCF_FILE_OP_CHECKSUM)
+        {
+            file_header->checksum = 0;
+            file_header->checksum = mcf_calc_check_sum((kal_uint32 *)output_buffer, file_header->file_size);
+        }
+        // encrypt
+        if (file_header->operation_mask & MCF_FILE_OP_AES_128 || file_header->operation_mask & MCF_FILE_OP_AES_256)
+        {
+            // this output is temp buffer, no need to encrypt
+            file_header->operation_mask &= ~(MCF_FILE_OP_AES_128);
+            file_header->operation_mask &= ~(MCF_FILE_OP_AES_256);
+        }
+    }
+    MD_TRC_MCF_TR_MERG_ONE_GID_END();
+    return KAL_TRUE;
+}
+#endif
+
+// password will be auto padding to 32B
+// content should be padding to 32B alignment
+// conrent length should be mod by 32
+kal_bool mcf_encrypt_256bit(char *password, char *content, kal_uint32 content_length)
+{
+    kal_uint8 iv[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+    kal_uint8 copy_len = 0;
+    kal_uint32 output_len;
+    t_cust_chl_sym_key key;
+    AES_PARAM aes_param;
+    kal_uint32 ret = CUST_CHL_ERROR_NONE;
+    kal_uint32 start_time = ust_get_current_time();
+
+    kal_mem_set(&aes_param, 0, sizeof(AES_PARAM));
+
+    if (content == NULL) return KAL_FALSE;
+    if (content_length % 16 != 0) return KAL_FALSE;
+
+    copy_len = strlen(password);
+    if (copy_len > 32) copy_len = 32;
+
+    key.m_key_len = 32;
+    kal_mem_set(key.m_key, 0, sizeof(key.m_key));
+    kal_mem_cpy(&key.m_key, password, copy_len);
+    aes_param.IVLength = 16;
+    aes_param.IV = iv;
+    ret = CustCHL_AES_Encrypt_data(CUST_CHL_ALG_AES256, CUST_CHL_MODE_CBC, content_length, (kal_uint8 *)content, &output_len, (kal_uint8 *)content, &key, &aes_param);
+
+    MD_TRC_MCF_TR_ENCRYPT(ust_us_duration(start_time, ust_get_current_time()));
+    if (ret != CUST_CHL_ERROR_NONE)
+        return KAL_FALSE;
+
+    return KAL_TRUE;
+}
+
+// password will be auto padding to 32B
+// content should be padding to 32B alignment
+// conrent length should be mod by 32
+kal_bool mcf_decrypt_256bit(char *password, char *content, kal_uint32 content_length)
+{
+    kal_uint8 iv[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+    kal_uint8 copy_len = 0;
+    kal_uint32 output_len;
+    t_cust_chl_sym_key key;
+    AES_PARAM aes_param;
+    kal_uint32 ret = CUST_CHL_ERROR_NONE;
+    kal_uint32 start_time = ust_get_current_time();
+
+    kal_mem_set(&aes_param, 0, sizeof(AES_PARAM));
+
+    if (content == NULL) return KAL_FALSE;
+    if (content_length % 16 != 0) return KAL_FALSE;
+
+    copy_len = strlen(password);
+    if (copy_len > 32) copy_len = 32;
+
+    key.m_key_len = 32;
+    kal_mem_set(key.m_key, 0, sizeof(key.m_key));
+    kal_mem_cpy(&key.m_key, password, copy_len);
+    aes_param.IVLength = 16;
+    aes_param.IV = iv;
+    ret = CustCHL_AES_Decrypt_data(CUST_CHL_ALG_AES256, CUST_CHL_MODE_CBC, content_length, (kal_uint8 *)content, &output_len, (kal_uint8 *)content, &key, &aes_param);
+
+    MD_TRC_MCF_TR_DECRYPT(ust_us_duration(start_time, ust_get_current_time()));
+    if (ret != CUST_CHL_ERROR_NONE)
+        return KAL_FALSE;
+
+    return KAL_TRUE;
+}
+
+// digest verify  
+kal_bool mcf_verify_digest(kal_uint32 digest_tag, mcf_tool_file_info_t *ota_file, mcf_digest *sign)
+{
+    kal_uint32 ret = KAL_FALSE;
+    t_cust_chl_asym_key key;
+
+    if (digest_tag == MCF_FILE_OP_SHA256_RSA2048) {
+        ret = mcf_get_custom_digest_public_key(sign->sequence, &key);
+        if (ret == KAL_FALSE) return KAL_FALSE;
+        ret = CustCHL_Verify_RSA_Signature(CUST_CHL_ALG_RSA_PKCS1_V15_SHA256_ASN1, (kal_uint8 *)ota_file, ota_file->file_size, sign->digest_value, sign->digest_len, &key);
+    }
+    else if(digest_tag == MCF_FILE_OP_SHA384_RSA3072){
+        ret = mcf_get_custom_digest_public_key(sign->sequence, &key);
+        if (ret == KAL_FALSE) return KAL_FALSE;
+        ret = CustCHL_Verify_RSA_Signature(CUST_CHL_ALG_RSA_PKCS1_V15_SHA384_ASN1, (kal_uint8 *)ota_file, ota_file->file_size, sign->digest_value, sign->digest_len, &key);
+    }
+    else
+    {
+        // not support
+        return KAL_FALSE;
+    }
+
+    if (ret != CUST_CHL_ERROR_NONE)
+        return KAL_FALSE;
+
+    return KAL_TRUE;
+}
+
+void mcf_make_file_info(mcf_file_info_t *file_info, kal_uint8 path_type, kal_char *name, kal_char *sw_version, kal_uint8 sw_version_len, kal_char *gen_time, kal_uint8 gen_time_len, kal_uint64 last_mod_time, kal_uint32 checksum)
+{   
+    MD_TRC_MCF_TR_MAKE_FILE_INFO_START(path_type, last_mod_time & 0xFFFFFFFF, checksum & 0xFFFFFFFF);
+    
+    kal_mem_set(file_info, 0, sizeof(mcf_file_info_t));
+    file_info->path_type = path_type;
+    strncpy(file_info->name, name, MCF_FILE_MAX_NAME_LEN-1);
+    strncpy(file_info->sw_version, sw_version, sw_version_len);
+    strncpy(file_info->gen_time, gen_time, gen_time_len);
+    file_info->last_mod_time = last_mod_time;
+    file_info->checksum = checksum;
+    file_info->sw_version_len = sw_version_len;
+    file_info->gen_time_len = gen_time_len;
+}
+
+kal_bool mcf_compare_file_info(mcf_file_info_t *old_file, mcf_file_info_t *new_file)
+{   
+    static nvram_ef_mcf_sw_info_struct             nv_sw_info;
+
+    MD_TRC_MCF_TR_COMPARE_FILE_INFO_START();
+    MD_TRC_MCF_TR_COMPARE_FILE_INFO_OLD_FILE_INFO(old_file->sw_version, old_file->gen_time);
+    MD_TRC_MCF_TR_COMPARE_FILE_INFO_NEW_FILE_INFO(new_file->sw_version, new_file->gen_time);
+    MD_TRC_MCF_TR_COMPARE_FILE_INFO_FILE_CHECKSUM(old_file->checksum & 0xFFFFFFFF, new_file->checksum & 0xFFFFFFFF);
+    MD_TRC_MCF_TR_COMPARE_FILE_INFO_FILE_LAST_MOD_TIME(old_file->last_mod_time & 0xFFFFFFFF, new_file->last_mod_time & 0xFFFFFFFF);
+    if ( (strncmp(old_file->sw_version, new_file->sw_version, new_file->sw_version_len) == 0) &&
+            (strncmp(old_file->gen_time, new_file->gen_time, new_file->gen_time_len) == 0) &&
+            (old_file->path_type == new_file->path_type) &&
+            (strncmp(old_file->name, new_file->name, MCF_FILE_MAX_NAME_LEN) == 0) &&
+            (old_file->last_mod_time == new_file->last_mod_time) &&
+            (old_file->checksum == new_file->checksum) ) {
+        
+        if ( !nvram_external_read_data(NVRAM_EF_MCF_SW_INFO_LID, 1, (kal_uint8 *)&nv_sw_info, sizeof(nvram_ef_mcf_sw_info_struct))) {
+            MD_TRC_MCF_TR_COMPARE_FILE_INFO_READ_FILE_NVRAM_FAIL(NVRAM_EF_MCF_SW_INFO_LID);
+            return KAL_FALSE;
+        }    
+
+        if ((strncmp(nv_sw_info.version, release_verno(), MCF_SW_VERNO_LEN) == 0) &&
+            (strncmp(nv_sw_info.build_time, build_date_time(), MCF_SW_BUILD_TIME_LEN) == 0)){
+            MD_TRC_MCF_TR_COMPARE_FILE_INFO_MD_INFO(nv_sw_info.version, nv_sw_info.build_time);  
+            return KAL_TRUE;
+        }else{
+            MD_TRC_MCF_TR_COMPARE_FILE_INFO_FILE_NOT_THE_SAME();
+            return KAL_FALSE;
+        }
+    }else{
+        MD_TRC_MCF_TR_COMPARE_FILE_INFO_FILE_NOT_THE_SAME();
+        return KAL_FALSE;
+        
+    }
+
+}
+