[Feature]Upload Modem source code

Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/custom/middleware/common/Conversions.h b/mcu/custom/middleware/common/Conversions.h
new file mode 100644
index 0000000..8041c15
--- /dev/null
+++ b/mcu/custom/middleware/common/Conversions.h
@@ -0,0 +1,932 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * Conversions.h
+ *
+ * Project:
+ * --------
+ * MAUI
+ *
+ * Description:
+ * ------------
+ * This file defines constant, enum value, and structures for converting 
+ *    realted utilities.
+ *
+ * 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
+ *==============================================================================
+ *******************************************************************************/
+#ifndef _MMI_CONVERSIONS_H
+#define _MMI_CONVERSIONS_H
+#include "kal_public_api.h" //MSBB change #include "kal_release.h"
+
+#if !defined(NEPTUNE_MMI)
+#include "kal_general_types.h"
+#endif
+
+#ifndef FALSE
+  #define FALSE           0
+#endif
+#define TRUE            1
+#define UNKOWN_UCS2_CHAR   0xFFEB
+
+typedef enum
+{
+    BIG_5_ENCODING_TYPE,
+    GB2312_ENCODING_TYPE,
+    HKSCS_ENCODING_TYPE,
+    NO_OF_TEXT_ENCODING
+} TextEncodingEnum;
+
+typedef struct
+{
+    short start;
+    short end;
+} key_index_t;
+
+/*-- function prototypes --*/
+
+extern kal_uint16 mmi_chset_wchar_to_ucs2(kal_uint16 encode_char, TextEncodingEnum encoding);
+extern kal_uint16 mmi_chset_ucs2_to_wchar(kal_uint16 ucs2_char, TextEncodingEnum encoding);
+
+extern kal_uint16 mmi_chset_text_to_ucs2_str(
+                    kal_uint8 *dest,
+                    kal_int32 dest_size,
+                    kal_uint8 *src,
+                    TextEncodingEnum encoding);
+extern kal_uint16 mmi_chset_text_to_ucs2_str_ex(
+                    kal_uint8 *dest,
+                    kal_int32 dest_size,
+                    kal_uint8 *src,
+                    TextEncodingEnum encoding,
+                    kal_uint32 *src_end_pos);
+
+extern kal_uint16 mmi_chset_ucs2_to_text_str(
+                    kal_uint8 *dest,
+                    kal_int32 dest_size,
+                    kal_uint8 *src,
+                    TextEncodingEnum encoding);
+extern kal_uint16 mmi_chset_ucs2_to_text_str_ex(
+                    kal_uint8 *dest,
+                    kal_int32 dest_size,
+                    kal_uint8 *src,
+                    TextEncodingEnum encoding,
+                    kal_uint32 *src_end_pos);
+
+extern kal_uint8 mmi_chset_is_text_in_str(kal_uint8 *src);
+
+/*-- exposed global data --*/
+
+extern const kal_uint8 *g_ucs2_to_encode_key_MSB[NO_OF_TEXT_ENCODING];
+extern const kal_uint8 *g_encode_to_ucs2_key_MSB[NO_OF_TEXT_ENCODING];
+extern const kal_uint16 *g_ucs2_to_encode_table[NO_OF_TEXT_ENCODING];
+extern const kal_uint16 *g_encode_to_ucs2_table[NO_OF_TEXT_ENCODING];
+extern const kal_uint16 g_unknown_encode_char[NO_OF_TEXT_ENCODING];
+extern const kal_uint16 *g_text_encoding_name[NO_OF_TEXT_ENCODING];
+
+#define CHSET_MAX_COUNT             25
+#define CHSET_BIT_WORD_16           16
+#define CHSET_BIT_WORD_8            8
+#define CHSET_TMP_BUFF_SIZE         2048        /* the size of the temp buffer in mmi_chset_convert() */
+
+/* Supported Guess Charsets */
+#define CHSET_GUESS_ALL				0x00000000
+#define CHSET_GUESS_UTF8			0x00000001
+#define CHSET_GUESS_UTF16LE			0x00000002
+#define CHSET_GUESS_UTF16BE			0x00000004
+#define CHSET_GUESS_UCS2			0x00000008
+#define CHSET_GUESS_GB2312			0x00000010
+#define CHSET_GUESS_BIG5			0x00000020
+#define CHSET_GUESS_WESTERN_ISO		0x00000040
+#define CHSET_GUESS_HKSCS                0x00000080
+
+#define CHSET_LANG_MAP_SIZE   5
+
+/* Enum of all supported charsets*/
+typedef enum
+{
+    CHSET_BASE,
+    MMI_CHSET_BASE = CHSET_BASE,
+    CHSET_ASCII,
+    MMI_CHSET_ASCII = CHSET_ASCII, // ASCII
+    CHSET_ARABIC_ISO, 
+    MMI_CHSET_ARABIC_ISO = CHSET_ARABIC_ISO, // ISO 8859-6 (Arabic)
+    CHSET_ARABIC_WIN,
+    MMI_CHSET_ARABIC_WIN = CHSET_ARABIC_WIN, // Windows-1256 (Arabic)
+    CHSET_PERSIAN_CP1097,
+    MMI_CHSET_PERSIAN_CP1097 = CHSET_PERSIAN_CP1097, // CP1097  (Persian) 
+    CHSET_PERSIAN_CP1098,
+    MMI_CHSET_PERSIAN_CP1098 = CHSET_PERSIAN_CP1098, // CP1098  (Persian)
+    CHSET_BALTIC_ISO,
+    MMI_CHSET_BALTIC_ISO = CHSET_BALTIC_ISO, // ISO-8859-4 (Baltic language group)
+    CHSET_BALTIC_WIN,
+    MMI_CHSET_BALTIC_WIN = CHSET_BALTIC_WIN, // Windows-1257 (Baltic language group)
+    CHSET_CEURO_ISO,
+    MMI_CHSET_CEURO_ISO = CHSET_CEURO_ISO, // ISO-8859-2 (Central european language group)
+    CHSET_CEURO_WIN,
+    MMI_CHSET_CEURO_WIN = CHSET_CEURO_WIN, // Windows-1250 (Central european language group)
+    CHSET_CYRILLIC_ISO,
+    MMI_CHSET_CYRILLIC_ISO = CHSET_CYRILLIC_ISO, // ISO-8859-5 (Cyrillic script based languages)
+    CHSET_CYRILLIC_WIN,
+    MMI_CHSET_CYRILLIC_WIN = CHSET_CYRILLIC_WIN, // Windows-1251 (Cyrillic script)
+    CHSET_GREEK_ISO,
+    MMI_CHSET_GREEK_ISO = CHSET_GREEK_ISO, // ISO-8859-7 (Greek)
+    CHSET_GREEK_WIN,
+    MMI_CHSET_GREEK_WIN = CHSET_GREEK_WIN, // Windows-1253 (Greek)
+    CHSET_HEBREW_ISO,
+    MMI_CHSET_HEBREW_ISO = CHSET_HEBREW_ISO, // ISO-8859-8 (Hebrew)
+    CHSET_HEBREW_WIN,
+    MMI_CHSET_HEBREW_WIN = CHSET_HEBREW_WIN, // Windows-1255 (Hebrew)
+    CHSET_LATIN_ISO,
+    MMI_CHSET_LATIN_ISO = CHSET_LATIN_ISO, // ISO-8859-4 (North european language group)
+    CHSET_NORDIC_ISO,
+    MMI_CHSET_NORDIC_ISO = CHSET_NORDIC_ISO, // ISO-8859-10 (Nordic language group)
+    CHSET_SEURO_ISO,
+    MMI_CHSET_SEURO_ISO = CHSET_SEURO_ISO,  // ISO-8859-3 (South european language group)
+    CHSET_TURKISH_ISO,
+    MMI_CHSET_TURKISH_ISO = CHSET_TURKISH_ISO, // ISO-8859-9 (Turkish)
+    CHSET_TURKISH_WIN,
+    MMI_CHSET_TURKISH_WIN = CHSET_TURKISH_WIN, // Windows-1254 (Turkish)
+    CHSET_WESTERN_ISO,
+    MMI_CHSET_WESTERN_ISO = CHSET_WESTERN_ISO, // ISO-8859-1 (Latin script based languages)
+    CHSET_ARMENIAN_ISO,
+    MMI_CHSET_ARMENIAN_ISO  = CHSET_ARMENIAN_ISO, // ISO-10585 ARMSCII (Armenian)
+	CHSET_THAI_WIN,
+    MMI_CHSET_THAI_WIN = CHSET_THAI_WIN, // Windows-874 (Thai)
+    CHSET_VIETNAMESE_WIN,
+    MMI_CHSET_VIETNAMESE_WIN = CHSET_VIETNAMESE_WIN,  // Windows-1258 (Vietnamese)
+    CHSET_KOI8_R,
+    MMI_CHSET_KOI8_R = CHSET_KOI8_R,  // KOI8-russian 
+    CHSET_TIS_620,
+    MMI_CHSET_TIS_620 = CHSET_TIS_620,  // Thai Industrial Standard 620
+    CHSET_WESTERN_WIN,
+    MMI_CHSET_WESTERN_WIN = CHSET_WESTERN_WIN, // Windows-1252 (Latin script based languages)
+    
+    /* Add new (8-bit) encodings above this line */
+    
+    CHSET_BIG5,
+    MMI_CHSET_BIG5 = CHSET_BIG5,  // Big5 (Traditional chinese)
+    CHSET_GB2312,
+    MMI_CHSET_GB2312 = CHSET_GB2312, // GB2312 (Simplified chinese)
+    CHSET_HKSCS,
+    MMI_CHSET_HKSCS = CHSET_HKSCS,  // HKSCS 2004 (Hong Kong chinese)
+    CHSET_SJIS,
+    MMI_CHSET_SJIS = CHSET_SJIS,  // SJIS (Japanese)
+    CHSET_GB18030,
+    MMI_CHSET_GB18030 = CHSET_GB18030, // GB18030 (Simplified chinese-extended)
+    CHSET_UTF7,
+    MMI_CHSET_UTF7 = CHSET_UTF7,  // UTF-7 
+    CHSET_EUCKR,
+    MMI_CHSET_EUCKR = CHSET_EUCKR, // Extended Unix Code - korean
+
+    /* Place all CJK encodings above this one */
+
+    CHSET_UTF16LE,
+    MMI_CHSET_UTF16LE = CHSET_UTF16LE, // UTF-16LE
+    CHSET_UTF16BE,
+    MMI_CHSET_UTF16BE = CHSET_UTF16BE, // UTF-16BE
+    CHSET_UTF8,
+    MMI_CHSET_UTF8 = CHSET_UTF8,  // UTF-8
+    CHSET_UCS2,
+    MMI_CHSET_UCS2 = CHSET_UCS2,  // UCS2
+    CHSET_TOTAL,
+    MMI_CHSET_TOTAL = CHSET_TOTAL 
+} mmi_chset_enum, chset_enum;
+
+/* do not change the order */
+
+/* Enum of all supporte charset pairs */
+
+typedef enum _ENCODING_SCHEMES_ENUM
+{
+    BASE_ENCODING_SCHEME,
+
+    ASCII_TO_UCS2,
+    UCS2_TO_ASCII,   
+
+    ARABIC_ISO_TO_UCS2,
+    UCS2_TO_ARABIC_ISO,
+
+    ARABIC_WINDOWS_TO_UCS2,
+    UCS2_TO_ARABIC_WINDOWS,
+    
+    PERSIAN_CP1097_TO_UCS2,
+    UCS2_TO_PERSIAN_CP1097,
+
+    PERSIAN_CP1098_TO_UCS2,
+    UCS2_TO_PERSIAN_CP1098,
+    
+    BALTIC_ISO_TO_UCS2,
+    UCS2_TO_BALTIC_ISO,
+
+    BALTIC_WINDOWS_TO_UCS2,
+    UCS2_TO_BALTIC_WINDOWS,
+
+    CENTRAL_EUROPEAN_ISO_TO_UCS2,
+    UCS2_TO_CENTRAL_EUROPEAN_ISO,
+
+    CENTRAL_EUROPEAN_WINDOWS_TO_UCS2,
+    UCS2_TO_CENTRAL_EUROPEAN_WINDOWS,
+
+    CYRILLIC_ISO_TO_UCS2,
+    UCS2_TO_CYRILLIC_ISO,
+
+    CYRILLIC_WINDOWS_TO_UCS2,
+    UCS2_TO_CYRILLIC_WINDOWS,
+    
+    GREEK_ISO_TO_UCS2,
+    UCS2_TO_GREEK_ISO,
+
+    GREEK_WINDOWS_TO_UCS2,
+    UCS2_TO_GREEK_WINDOWS,
+
+    HEBREW_ISO_TO_UCS2,
+    UCS2_TO_HEBREW_ISO,
+
+    HEBREW_WINDOWS_TO_UCS2,
+    UCS2_TO_HEBREW_WINDOWS,
+
+    LATIN_ISO_TO_UCS2,
+    UCS2_TO_LATIN_ISO,
+
+    NORDIC_ISO_TO_UCS2,
+    UCS2_TO_NORDIC_ISO,
+
+    SOUTH_EUROPEAN_ISO_TO_UCS2,
+    UCS2_TO_SOUTH_EUROPEAN_ISO,
+
+    TURKISH_ISO_TO_UCS2,
+    UCS2_TO_TURKISH_ISO,
+
+    TURKISH_WINDOWS_TO_UCS2,
+    UCS2_TO_TURKISH_WINDOWS,
+
+    WESTERN_ISO_TO_UCS2,
+    UCS2_TO_WESTERN_ISO,
+
+    ARMENIAN_ISO_TO_UCS2,
+    UCS2_TO_ARMENIAN_ISO,
+    
+    THAI_WINDOWS_TO_UCS2,
+    UCS2_TO_THAI_WINDOWS,
+
+    VIETNAMESE_WINDOWS_TO_UCS2,
+    UCS2_TO_VIETNAMESE_WINDOWS,
+
+    KOI8_R_TO_UCS2,
+    UCS2_TO_KOI8_R,
+
+    TIS_620_TO_UCS2,
+    UCS2_TO_TIS_620,
+    
+    WESTERN_WINDOWS_TO_UCS2,
+    UCS2_TO_WESTERN_WINDOWS,
+
+    /* Add new (8-bit) encodings above this line */
+    BIG5_TO_UCS2,
+    UCS2_TO_BIG5,
+
+    GB2312_TO_UCS2,
+    UCS2_TO_GB2312,
+
+    HKSCS_TO_UCS2,
+    UCS2_TO_HKSCS,
+
+    SJIS_TO_UCS2,
+    UCS2_TO_SJIS,
+
+    GB18030_TO_UCS2,
+    UCS2_TO_GB18030,
+
+    UTF7_TO_UCS2,
+    UCS2_TO_UTF7,
+
+    EUCKR_WINDOWS_TO_UCS2,
+    UCS2_TO_EUCKR_WINDOWS,
+
+    /* Place all CJK encodings above this one */
+    UTF16LE_TO_UCS2,
+    UCS2_TO_UTF16LE,
+    
+    UTF16BE_TO_UCS2,
+    UCS2_TO_UTF16BE,
+    
+    UTF8_TO_UCS2,
+    UCS2_TO_UTF8,
+
+    CHSET_PAIR_TOTAL
+} mmi_chset_pair_enum;
+
+/* Global variable to hold curent default encoding in phone 
+   This value will be updated by MMI phone setup module */
+extern mmi_chset_enum g_chset_text_encoding;    
+
+extern kal_uint16 EncodingDecoding(
+                    mmi_chset_pair_enum Scheme,
+                    char *pOutBuffer,
+                    char *pInBuffer,
+                    kal_int32 dest_size,
+                    kal_uint32 *src_end_pos);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_init
+ * DESCRIPTION
+ *  Routine for initializing the related data structures of the various encoding types
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  void
+ *****************************************************************************/
+extern void mmi_chset_init(void);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_convert
+ * DESCRIPTION
+ *  Convert string between 2 character sets. (will add the terminate character)
+ * PARAMETERS
+ *  src_type        :   [IN]        Charset type of source
+ *  dest_type       :   [IN]        Charset type of destination
+ *  src_buff        :   [IN]        Buffer stores source string
+ *  dest_buff       :   [OUT]       Buffer stores destination string
+ *  dest_size       :   [IN]        Size of destination buffer (bytes)
+ * RETURNS
+ *  Length of destination string, including null terminator. (bytes)
+ *****************************************************************************/
+extern kal_int32 mmi_chset_convert(
+                    mmi_chset_enum src_type,
+                    mmi_chset_enum dest_type,
+                    char *src_buff,
+                    char *dest_buff,
+                    kal_int32 dest_size);
+
+extern kal_int32 mmi_chset_convert_ex(
+                    mmi_chset_enum src_type,
+                    mmi_chset_enum dest_type,
+                    char *src_buff,
+                    char *dest_buff,
+                    kal_int32 dest_size,
+                    kal_uint32 *src_end_pos);
+
+extern kal_int32 chset_convert(
+                    chset_enum src_type,
+                    chset_enum dest_type,
+                    char *src_buff,
+                    char *dest_buff,
+                    kal_int32 dest_size);
+
+extern kal_int32 chset_convert_ex(
+                    chset_enum src_type,
+                    chset_enum dest_type,
+                    char *src_buff,
+                    char *dest_buff,
+                    kal_int32 dest_size,
+                    kal_uint32 *src_end_pos);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_use_space_for_unknown_character
+ * DESCRIPTION
+ *  It's a property of charset conversion module. Setting it up would cause invalid character values behave as 'space' character.
+ *  It is applicable only with ideographic charsets.
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  void
+ *****************************************************************************/
+extern void mmi_chset_use_space_for_unknown_character(void);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_use_space_for_unknown_character
+ * DESCRIPTION
+ *  It's a property of charset conversion module. Setting it up would cause invalid character values behave as 0xFFFF.
+ *  It is applicable only with ideographic charsets.
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  void
+ *****************************************************************************/
+extern void mmi_chset_do_not_use_space_for_unknown_character(void);
+
+extern kal_int32 mmi_chset_convert_with_src_length(
+        mmi_chset_enum src_type,
+        mmi_chset_enum dest_type,
+        char *src_buff,
+        kal_int32 src_size,
+        char *dest_buff,
+        kal_int32 dest_size);
+extern kal_uint16 UCS2_TO_WCHAR(kal_uint16 src_char);
+
+extern void mmi_chset_mixed_text_to_ucs2_str(
+                kal_uint8 *dest,
+                kal_int16 dest_size,
+                kal_uint8 *src,
+                mmi_chset_enum encoding);
+extern void mmi_chset_mixed_text_to_ucs2_str_ex(
+                kal_uint8 *dest,
+                kal_int16 dest_size,
+                kal_uint8 *src,
+                mmi_chset_enum encoding,
+                kal_uint32 *src_end_pos);
+
+extern kal_int32 mmi_chset_text_to_ucs2(kal_uint8 *dest, kal_int32 dest_size, kal_uint8 *src);
+extern kal_int32 mmi_chset_text_to_ucs2_ex(
+                    kal_uint8 *dest,
+                    kal_int32 dest_size,
+                    kal_uint8 *src,
+                    kal_uint32 *src_end_pos);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_get_char_size_of_charset
+ * DESCRIPTION
+ *  Get maximum number of bytes, that the given charset can take for a single character
+ * PARAMETERS
+ *  mmi_chset_enum         :  [IN]        Charset
+ * RETURNS
+ *  Maximum number of bytes, that chset can take for a single character
+ *****************************************************************************/
+extern kal_int32 mmi_chset_get_char_size_of_charset(mmi_chset_enum chset);
+
+extern kal_int32 mmi_chset_get_char_size_of_default_charset(void);
+
+/* UTF8 related */
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_utf8_to_ucs2
+ * DESCRIPTION
+ *  Convert single UTF8 character to UCS2
+ * PARAMETERS
+ *  ucs2	:  [OUT] Output buffer (Needs at least 2 bytes)
+ *  utf8 :  [IN]  Input buffer (Can have 1 to 4 bytes, depending ont he character)
+ * RETURNS
+ *  Number of input bytes used
+ *****************************************************************************/
+extern kal_int32 mmi_chset_utf8_to_ucs2(kal_uint8 *ucs2, kal_uint8 *utf8);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_ucs2_to_utf8
+ * DESCRIPTION
+ *  Convert single UCS2 character to UTF8
+ * PARAMETERS
+ *  utf8  :  [OUT]Output buffer (Needs 1 to 4 bytes, depending ont he character)
+ *  ucs2  :  [IN] Input
+ * RETURNS
+ *  Number of bytes taken in utf8
+ *****************************************************************************/
+extern kal_int32 mmi_chset_ucs2_to_utf8(kal_uint8 *utf8, kal_uint16 ucs2);
+
+extern kal_int32 mmi_chset_utf8_to_ucs2_string(kal_uint8 *dest, kal_int32 dest_size, kal_uint8 *src);
+extern kal_int32 mmi_chset_utf8_to_ucs2_string_ex(
+                    kal_uint8 *dest,
+                    kal_int32 dest_size,
+                    kal_uint8 *src,
+                    kal_uint32 *src_end_pos);
+extern kal_int32 mmi_chset_ucs2_to_utf8_string(kal_uint8 *dest, kal_int32 dest_size, kal_uint8 *src);
+extern kal_int32 mmi_chset_ucs2_to_utf8_string_ex(
+                    kal_uint8 *dest,
+                    kal_int32 dest_size,
+                    kal_uint8 *src,
+                    kal_uint32 *src_end_pos);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_utf8_strlen
+ * DESCRIPTION
+ *  Get string length of a UTF8 encoded buffer
+ * PARAMETERS
+ *  s   :  [IN] Input buffer
+ * RETURNS
+ *  Number of valid characters
+ *****************************************************************************/
+extern kal_int32 mmi_chset_utf8_strlen(const kal_uint8 *s);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_get_charset_id
+ * DESCRIPTION
+ *  This function is used for get the charset id for the given charset name string. It's a name resolver for charsets.
+ * PARAMETERS
+ *  chset_name     :   [IN]        Charset name
+ *  chset_id_p      :   [OUT]       Charset ID
+ * RETURNS
+ *  retrun KAL_TRUE if succeed, otherwise return KAL_FALSE
+ *****************************************************************************/
+extern kal_bool mmi_chset_get_charset_id(const kal_int8 *chset_name, mmi_chset_enum *chset_id_p);
+
+extern kal_bool chset_get_charset_id(const kal_int8 *chset_name, chset_enum *chset_id_p);
+
+/*****************************************************************************
+ * FUNCTION
+ *  chset_get_preferred_mime_name
+ * DESCRIPTION
+ *  This function is used for get the preferred MIME name of character set via
+ *  the character set id.
+ * PARAMETERS
+ *  chset_id       :   [IN]        Character set id.
+ * RETURNS
+ *  If successful, retrun the const pointer to the character set name,
+ *  otherwise return NULL
+ *****************************************************************************/
+extern const kal_int8 *chset_get_preferred_mime_name(chset_enum chset_id);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_get_utf_byte_order
+ * DESCRIPTION
+ *  The function is used for get the byte order via the byte order mark .
+ * PARAMETERS
+ *  str_bom     :  [IN]        The byte order mark.
+ * RETURNS
+ *  returns MMI_CHSET_UTF16LE if the stream is little-endian
+ *  returns MMI_CHSET_UTF16BE if the stream is big-endian
+ *  returns MMI_CHSET_UTF8 if the input BOM is a UTF-8's BOM
+ *  Otherwise returns -1
+ *****************************************************************************/
+extern kal_int8 mmi_chset_get_utf_byte_order(const kal_int8 *str_bom);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_utf16_strlen
+ * DESCRIPTION
+ *  The function is used for get the number of characters of the given UTF16
+ *  encoded string, not including the beginning BOM and the final null
+ *  character.
+ *  Here we only accept FFFE/FEFF marks as endianness indicators in the
+ *  beginning of the stream(See RFC 2781 section 3.2 specifies).
+ *  If there is no BOM, the text default is interpreted as big-endian.
+ *  The function does not count the surrogate pair. Because of it can't translate
+ *  to UCS2.
+ * PARAMETERS
+ *  str_utf16    :    [IN]        UTF-16 encoded string which length is to be computed.
+ *  utf16_type   :    [IN]        The type of input UTF-16 encoded string. MMI_CHSET_UTF16LE or MMI_CHSET_UTF16BE
+ * RETURNS
+ *  The number of characters of the input UTF16 encoded string.
+ *****************************************************************************/
+extern kal_int32 mmi_chset_utf16_strlen(const kal_int8 *str_utf16, mmi_chset_enum utf16_type);
+
+extern kal_int32 mmi_chset_ucs2_to_utf16_bom_str(
+                    kal_uint8 *dest_utf16,
+                    kal_int32 dest_size,
+                    mmi_chset_enum utf16_type,
+                    kal_uint8 *src_ucs2,
+                    kal_uint32 *src_end_pos);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_guess
+ * DESCRIPTION
+ *  Try to guess the charset of string buffer with given guess size.
+ *  It will try only the suspect list if suspect_chset_mask is not CHSET_GUESS_ALL.
+ *  Otherwise it will guess all the supported chsets.
+ *	This function will return the preferred charset if more than one charsets
+ *	have the same possibility.
+ *  Currently we support:   UTF8, UTF16, UCS2, GB2312, BIG5, ISO8859-1
+ * PARAMETERS
+ *  buff                   :  [IN]        String buffer need to guess the charset
+ *  guess_size             :  [IN]        String buffer size in byte used to guess
+ *  preferred_chset        :  [IN]        Preferred charset name, pass 0 to use system prefer charset
+ *  suspect_chset_mask     :  [IN]        Suspect charsets, use "|" to add more suspect charsets. 
+ *                                     Use CHSET_GUESS_ALL to guess in all supported charsets.
+ * RETURNS
+ *  Charset Guess result
+ *****************************************************************************/                    
+extern mmi_chset_enum mmi_chset_guess(
+                          const char *buff,
+                          kal_int32 guess_size,
+                          mmi_chset_enum preferred_chset,
+                          kal_uint32 suspect_chset_mask);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_set_default_encoding_type
+ * DESCRIPTION
+ *  This function is used for set default encoding type (g_chset_text_encoding)
+ * PARAMETERS
+ *  chset_name      :  [IN]        Charset name
+ * RETURNS
+ *  Default encoding type setting success or fail
+ *****************************************************************************/
+extern kal_bool mmi_chset_set_default_encoding_type(const kal_int8 *chset_name);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_set_default_encoding_type
+ * DESCRIPTION
+ *  This function is used for set default encoding type (g_chset_text_encoding)
+ * PARAMETERS
+ *  chset_id        :  [IN]        Charset ID
+ * RETURNS
+ *  Default encoding type setting success or fail
+ *****************************************************************************/
+extern kal_bool mmi_chset_set_default_encoding_type_by_id(mmi_chset_enum chset_id);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_get_default_encoding_type
+ * DESCRIPTION
+ *  This function is used to get default encoding type (g_chset_text_encoding)
+ * PARAMETERS
+ *  NONE
+ * RETURNS
+ *  Default encoding id
+ *****************************************************************************/
+extern mmi_chset_enum mmi_chset_get_default_encoding_type(void);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_get_chset_list_by_language
+ * DESCRIPTION
+ *  Get charset list according to current language
+ * PARAMETERS
+ *  chset_list      :  [OUT]        Charset list.
+ *  default         :  [OUT]        Default charset.
+ * RETURNS
+ *  chset number in the list
+ *****************************************************************************/
+extern kal_int32 mmi_chset_get_chset_list_by_language(mmi_chset_enum *chset_list, mmi_chset_enum *default_chset);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_get_enabled_chset_list
+ * DESCRIPTION
+ *  Get charset list 
+ * PARAMETERS
+ *  chset_list      :  [OUT]        Array of charset ids.
+ * RETURNS
+ *  Total number of enabled charsets
+ *****************************************************************************/
+extern kal_int32 mmi_chset_get_enabled_chset_list(mmi_chset_enum *chset_list);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_get_english_default_chset
+ * DESCRIPTION
+ *  Get default charset of English. Dependent of available languages in phone
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  default charset
+ *****************************************************************************/
+extern mmi_chset_enum mmi_chset_get_english_default_chset(void);
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_get_chset_string
+ * DESCRIPTION
+ *  Get charset string id (shown in menus) by chset enum
+ * PARAMETERS
+ *  chset      :  [IN]        Charset id (enum value)
+ * RETURNS
+ *  chset string id
+ *****************************************************************************/
+extern kal_uint16 mmi_chset_get_chset_string(mmi_chset_enum chset);
+
+#ifdef __MMI_CHSET_SJIS__
+extern kal_uint32 mmi_chset_sjis_to_ucs2(
+            kal_uint8 *dest,
+            kal_int32 dest_size,
+            kal_uint8 *src,
+            kal_uint32 *src_end_pos);
+extern kal_uint32 mmi_chset_ucs2_to_sjis(
+            kal_uint8 *dest,
+            kal_int32 dest_size,
+            kal_uint8 *src,
+            kal_uint32 *src_end_pos);
+#endif /* __MMI_CHSET_SJIS__ */
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_chset_is_enabled
+ * DESCRIPTION
+ *  Checks whether chset is enabled or not.
+ * PARAMETERS
+ *  chset            :  [IN]       Input charset id
+ * RETURNS
+ *  TRUE if enabled
+ *****************************************************************************/
+ extern kal_bool mmi_chset_is_enabled(mmi_chset_enum chset);
+
+/* DOM-NOT_FOR_SDK-BEGIN */
+
+/*****************************************************************************
+ * FUNCTION
+ *  mmi_charset_ucs2_to_utf8_length_in_bytes
+ * DESCRIPTION
+ *  
+ * PARAMETERS
+ *  raw     [IN]        
+ * RETURNS
+ *  
+ *****************************************************************************/
+extern int mmi_charset_ucs2_to_utf8_length_in_bytes(const kal_uint8 *raw);
+
+/* DOM-NOT_FOR_SDK-END */
+
+#endif /* _MMI_CONVERSIONS_H */ 
+
diff --git a/mcu/custom/middleware/common/audio_nvram_def.c b/mcu/custom/middleware/common/audio_nvram_def.c
new file mode 100644
index 0000000..3a72a2d
--- /dev/null
+++ b/mcu/custom/middleware/common/audio_nvram_def.c
@@ -0,0 +1,160 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * audio_nvram_def.c
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *    This file contains `vendor' defined logical data items stored in NVRAM.
+ *    These logical data items are used in object code of Protocol Stack software.
+ *
+ *    As for customizable logical data items, they are defined in nvram_user_config.c
+ *
+ * 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!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#ifndef NVRAM_NOT_PRESENT
+
+/*
+ *   Include Headers
+ */
+
+#include "kal_general_types.h"
+
+/*
+ *   NVRAM Basic Headers
+ */
+#ifdef NVRAM_AUTO_GEN
+#include "nvram_auto_gen.h"
+#endif
+
+#include "nvram_enums.h"
+#include "nvram_defs.h"
+#include "nvram_data_items.h"
+
+/*
+ *   User Headers
+ */
+#include "audio_nvram_def.h"
+#include "audio_nvram_editor.h"
+
+
+/*
+ *   Default value
+ */
+
+#include "nvram_default_audio.h"
+#include "AudCoeff.h"
+#include "audcoeff_default.h"
+
+/**
+	Default values for each LID struture
+*/
+
+
+#if !defined(MED_NOT_PRESENT)
+
+
+/*
+ *   LID table
+ */
+ltable_entry_struct logical_data_item_table_audio[] =
+{
+#if 0
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+};
+
+#elif !defined(__MTK_TARGET__)
+
+ltable_entry_struct logical_data_item_table_audio[] =
+{
+    {
+        NVRAM_LID_GRP_AUDIO(0),
+        1,
+        1,
+        NVRAM_NORMAL_NOT_GEN(0),
+        NVRAM_CATEGORY_USER,
+        NVRAM_ATTR_AVERAGE,
+        "AU6A",
+        0
+    },
+};
+
+#endif
+
+#endif /* NVRAM_NOT_PRESENT */
diff --git a/mcu/custom/middleware/common/audio_nvram_def.h b/mcu/custom/middleware/common/audio_nvram_def.h
new file mode 100644
index 0000000..b8fa555
--- /dev/null
+++ b/mcu/custom/middleware/common/audio_nvram_def.h
@@ -0,0 +1,214 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * audio_nvram_def.h
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *    This file contains `vendor' defined logical data items stored in NVRAM.
+ *    These logical data items are used in object code of Protocol Stack software.
+ *
+ *    As for customizable logical data items, they are defined in nvram_user_config.c
+ *
+ * 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!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#ifndef __AUDIO_NVRAM_DEF_H__
+#define __AUDIO_NVRAM_DEF_H__
+
+#if !defined(MED_NOT_PRESENT)
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */ 
+
+/*
+ *   Include Headers
+ */
+#include "med_struct.h"
+
+/*
+ *   NVRAM Basic Headers
+ */
+#include "nvram_data_items.h"
+#include "nvram_defs.h"
+
+
+/*
+ *   User Headers
+ */
+
+
+/*
+ *   LID Enums
+ */
+ 
+typedef enum
+{
+    NVRAM_EF_CUST_ACOUSTIC_DATA_LID             = NVRAM_LID_GRP_AUDIO(0),
+    NVRAM_EF_AUDIO_PARAM_LID                    = NVRAM_LID_GRP_AUDIO(1),
+    NVRAM_EF_AUDIO_BESLOUDNESS_LID              = NVRAM_LID_GRP_AUDIO(2),
+    NVRAM_EF_AUDIO_GAIN_TABLE_LID               = NVRAM_LID_GRP_AUDIO(3),
+    NVRAM_EF_AUDIO_SWFIR_LID                    = NVRAM_LID_GRP_AUDIO(4),
+
+    /* WB speech */
+    NVRAM_EF_AUDIO_WB_SPEECH_INPUT_FIR_LID      = NVRAM_LID_GRP_AUDIO(5),
+    NVRAM_EF_AUDIO_WB_SPEECH_OUTPUT_FIR_LID     = NVRAM_LID_GRP_AUDIO(6),
+    NVRAM_EF_AUDIO_WB_SPEECH_MODE_PARAM_LID     = NVRAM_LID_GRP_AUDIO(7),
+
+    /* Dual Mic */
+    NVRAM_EF_AUDIO_DUAL_MIC_PARAM_LID           = NVRAM_LID_GRP_AUDIO(8),
+    NVRAM_EF_AUDIO_DC_CALIBRATION_LID           = NVRAM_LID_GRP_AUDIO(9),
+
+/*
+ *  Last LID of GPS Group
+ */
+    NVRAM_EF_AUDIO_LAST_LID                     = NVRAM_LID_GRP_AUDIO(255)
+}nvram_lid_audio_enum;
+
+
+/*
+ *   Verno
+ */
+#if 0
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+
+// Hash Key
+#define NVRAM_EF_CUST_ACOUSTIC_DATA_LID_HASH   0x9E5A9348
+#define NVRAM_EF_AUDIO_PARAM_LID_HASH   0xC808ABF8
+#define NVRAM_EF_AUDIO_BESLOUDNESS_LID_HASH   0xDE06AED6
+#define NVRAM_EF_AUDIO_GAIN_TABLE_LID_HASH   0x9498E8F1
+#define NVRAM_EF_AUDIO_SWFIR_LID_HASH   0x2B5A8BE4
+#define NVRAM_EF_AUDIO_WB_SPEECH_INPUT_FIR_LID_HASH   0x8B594AD1
+#define NVRAM_EF_AUDIO_WB_SPEECH_OUTPUT_FIR_LID_HASH   0xBC624540
+#define NVRAM_EF_AUDIO_WB_SPEECH_MODE_PARAM_LID_HASH   0x7C62DFEA
+#define NVRAM_EF_AUDIO_DUAL_MIC_PARAM_LID_HASH   0x056131DF
+#define NVRAM_EF_AUDIO_DC_CALIBRATION_LID_HASH   0x337B468D
+
+
+/*
+ *   Data Structure
+ */
+
+
+extern nvram_ltable_entry_struct logical_data_item_table_audio[];
+
+#ifdef __cplusplus
+}
+#endif 
+
+#endif
+
+#endif /* __AUDIO_NVRAM_DEF_H__ */ 
diff --git a/mcu/custom/middleware/common/audio_nvram_editor.h b/mcu/custom/middleware/common/audio_nvram_editor.h
new file mode 100644
index 0000000..42fcef8
--- /dev/null
+++ b/mcu/custom/middleware/common/audio_nvram_editor.h
@@ -0,0 +1,155 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * audio_nvram_editor.h
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *    This file contains `vendor' defined logical data items stored in NVRAM.
+ *    These logical data items are used in object code of Protocol Stack software.
+ *
+ *    As for customizable logical data items, they are defined in nvram_user_config.c
+ *
+ * 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!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#ifndef __AUDIO_NVRAM_EDITOR_H__
+#define __AUDIO_NVRAM_EDITOR_H__
+#ifndef NVRAM_NOT_PRESENT
+
+#if !defined(MED_NOT_PRESENT)
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */ 
+
+/*
+ *   Include Headers
+ */
+
+
+/*
+ *   NVRAM Basic Headers
+ */
+#include "nvram_data_items.h"
+ 
+/*
+ *   User Headers
+ */
+#include "audio_nvram_def.h"
+
+/*
+ *   Default value
+ */
+#include "nvram_default_audio.h"
+
+/*
+ *   Bit Level Description Language
+ */
+#ifdef GEN_FOR_PC
+BEGIN_NVRAM_DATA
+
+#if !defined(L4_NOT_PRESENT)
+#if 0
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+#endif
+
+END_NVRAM_DATA
+
+#endif  /* GEN_FOR_PC */
+
+#ifdef __cplusplus
+}
+#endif 
+
+#endif
+#endif  /* !NVRAM_NOT_PRESENT */
+#endif  /* __AUDIO_NVRAM_EDITOR_H__ */
diff --git a/mcu/custom/middleware/common/custom_nvram_config.c b/mcu/custom/middleware/common/custom_nvram_config.c
new file mode 100644
index 0000000..5962ab3
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_nvram_config.c
@@ -0,0 +1,491 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * custom_nvram_config.c
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   The file contains nvram configuration default value.
+ *
+ * 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!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+
+#ifndef NVRAM_NOT_PRESENT
+
+#include "kal_general_types.h"
+
+#include "nvram_enums.h"            /* NVRAM_CLEAN_FOLDER_FACTORY */
+#include "custom_nvram_config.h"
+#include "nvram_data_items.h"
+#include "fs_gprot.h"
+
+#if defined(__MMI_FMI__)
+#include "nvram_common_defs.h"
+#include "nvram_user_defs.h"
+#include "MMI_features.h"
+#include "custom_mmi_default_value.h"
+#include "resource_verno.h"     /* ENTRY_PREAMBLE */
+#include "resource_custpack_jtbl.h"     /* CUSTPACK_NVRAM */
+
+#endif
+
+/*
+ * Restore factory begin
+ */
+#ifdef __MMI_IMPS__
+__fs_align(2)
+static kal_wchar IMPS_FOLDER[] = L"Z:\\@imps\\setting.dat";
+#endif
+#if defined (__MMI_FTS_SUPPORT__) || defined (__MMI_FTC_SUPPORT__)
+__fs_align(2)
+static kal_wchar FTP_FOLDER[] = L"Z:\\@ftp\\shared_file_path";
+#endif
+#ifdef __EMAIL__
+__fs_align(2)
+static kal_wchar EMAIL_FOLDER[] = L"Z:\\@email_sys\\sort.dat";
+#endif
+#ifdef SYNCML_DM_SUPPORT
+__fs_align(2)
+static kal_wchar DM_SERVERID_FOLDER[] = L"Z:\\@dm\\serverid.dat";
+#endif
+
+#ifdef __CERTMAN_SUPPORT__
+__fs_align(2)
+static kal_wchar CERTMAN_FOLDER[] = L"Z:\\@certman";
+#endif
+
+#ifdef __TCPIP__
+__fs_align(2)
+static kal_wchar DTCNT_SRV_FOLDER[] = L"Z:\\@Dtcnt\\DB\\SIM";
+#endif
+
+#ifdef __QQMOVIE_SUPPORT__
+#if   defined(MT6238)
+static kal_wchar QQM_SETTING_FOLDER[] = L"D:\\QQMovie\\setting";
+#endif
+#endif
+
+const nvram_clean_folder_entry nvram_clean_folder_list[] =
+{
+#ifdef __MMI_IMPS__
+    {NVRAM_CLEAN_FOLDER_FACTORY, IMPS_FOLDER},
+#endif
+#if defined (__MMI_FTS_SUPPORT__) || defined (__MMI_FTC_SUPPORT__)
+    {NVRAM_CLEAN_FOLDER_FACTORY, FTP_FOLDER},
+#endif
+#ifdef __EMAIL__
+    {NVRAM_CLEAN_FOLDER_FACTORY, EMAIL_FOLDER},
+#endif
+#ifdef SYNCML_DM_SUPPORT
+    {NVRAM_CLEAN_FOLDER_FACTORY, DM_SERVERID_FOLDER},
+#endif
+#ifdef __CERTMAN_SUPPORT__
+		{NVRAM_CLEAN_FOLDER_FACTORY, CERTMAN_FOLDER},
+#endif
+
+#ifdef __TCPIP__
+		{NVRAM_CLEAN_FOLDER_FACTORY, DTCNT_SRV_FOLDER},
+#endif
+
+#ifdef __QQMOVIE_SUPPORT__
+    {NVRAM_CLEAN_FOLDER_FACTORY, QQM_SETTING_FOLDER},
+#endif
+
+    /* Add above this */
+    {NVRAM_CLEAN_FOLDER_SYSTEM | NVRAM_CLEAN_FOLDER_FACTORY | NVRAM_CLEAN_FOLDER_BRANCH , NULL}
+};
+/*
+ * Restore factory end
+ */
+
+nvram_shutdown_cb_struct nvram_shutdown_cb_table[] =
+{
+    {0, NULL}
+};
+
+
+/*****************************************************************************
+ * FUNCTION
+ *  nvram_custom_max_clean_folder_size
+ * DESCRIPTION
+ *  Return the maximum clean folder size
+ * PARAMETERS
+ * RETURNS
+ *  maximum record size
+ *****************************************************************************/
+kal_uint32 nvram_custom_max_clean_folder_size(void)
+{
+    /*----------------------------------------------------------------*/
+    /* Local Variables                                                */
+    /*----------------------------------------------------------------*/
+    /*----------------------------------------------------------------*/
+    /* Code Body                                                      */
+    /*----------------------------------------------------------------*/
+
+    return sizeof(nvram_clean_folder_list) / sizeof(nvram_clean_folder_entry);
+}
+
+/*****************************************************************************
+ * FUNCTION
+ * DESCRIPTION
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  nvram_lid_enum
+ *****************************************************************************/
+nvram_lid_enum nvram_get_first_core_lid(void)
+{
+    return NVRAM_EF_START;
+}
+
+/*****************************************************************************
+ * FUNCTION
+ *  nvram_get_last_core_lid
+ * DESCRIPTION
+ *  Get the last core lid
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  nvram_lid_enum
+ *****************************************************************************/
+nvram_lid_enum nvram_get_last_core_lid(void)
+{
+    return NVRAM_EF_LAST_LID_CORE;
+}
+
+#if defined(__MMI_FMI__)
+/*****************************************************************************
+ * FUNCTION
+ *  nvram_get_first_comm_lid
+ * DESCRIPTION
+ *  Get the first common lid
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  nvram_lid_enum
+ *****************************************************************************/
+nvram_lid_enum nvram_get_first_comm_lid(void)
+{
+    return NVRAM_LID_COMMAPP_BEGIN;
+}
+
+/*****************************************************************************
+ * FUNCTION
+ *  nvram_get_last_comm_lid
+ * DESCRIPTION
+ *  Get the last common lid
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  nvram_lid_enum
+ *****************************************************************************/
+nvram_lid_enum nvram_get_last_comm_lid(void)
+{
+    return NVRAM_EF_LAST_LID_COMMAPP;
+}
+
+/*****************************************************************************
+ * FUNCTION
+ *  nvram_get_first_cust_lid
+ * DESCRIPTION
+ *  Get the first custom lid
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  nvram_lid_enum
+ *****************************************************************************/
+nvram_lid_enum nvram_get_first_cust_lid(void)
+{
+    return NVRAM_LID_CUST_BEGIN;
+}
+#endif
+
+#ifdef NEPTUNE_MMI
+/*****************************************************************************
+ * FUNCTION
+ *  nvram_get_total_byte
+ * DESCRIPTION
+ *  Get the total byte number
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  nvram_lid_enum
+ *****************************************************************************/
+kal_uint16 nvram_get_total_byte(void)
+{
+    return NVRAM_LAST_BYTE_ELEMENT;
+}
+
+/*****************************************************************************
+ * FUNCTION
+ *  nvram_get_total_short
+ * DESCRIPTION
+ *  Get the total short number
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  nvram_lid_enum
+ *****************************************************************************/
+kal_uint16 nvram_get_total_short(void)
+{
+    return NVRAM_LAST_SHORT_ELEMENT;
+}
+
+/*****************************************************************************
+ * FUNCTION
+ *  nvram_get_total_double
+ * DESCRIPTION
+ *  Get the total double number
+ * PARAMETERS
+ *  void
+ * RETURNS
+ *  nvram_lid_enum
+ *****************************************************************************/
+
+kal_uint16 nvram_get_total_double(void)
+{
+    return NVRAM_LAST_DOUBLE_ELEMENT;
+}
+#endif
+
+#ifdef __NVRAM_SUPPORT_CUSTPACK__
+/*****************************************************************************
+ * FUNCTION
+ *  nvram_ltable_init
+ * DESCRIPTION
+ * PARAMETERS
+ * RETURNS
+ *****************************************************************************/
+extern void nvram_custpack_int_init(custpack_nvram_header *custpack_ptr);
+
+void nvram_custpack_init()
+{
+    custpack_nvram_header *custpack_header_ptr;
+    void **custpack_header = NULL;
+
+
+    custpack_header = (void **)GET_ResCUSTPACK_Addr(ENTRY_PREAMBLE);
+    custpack_header_ptr = (custpack_nvram_header*) custpack_header[CUSTPACK_NVRAM];
+
+    nvram_custpack_int_init(custpack_header_ptr);
+
+   
+}
+
+
+sys_indirect_init_func g_nvram_custpack_init = nvram_custpack_init;
+
+#endif  /* __NVRAM_SUPPORT_CUSTPACK__ */
+
+#endif /* NVRAM_NOT_PRESENT */
diff --git a/mcu/custom/middleware/common/custom_nvram_config.h b/mcu/custom/middleware/common/custom_nvram_config.h
new file mode 100644
index 0000000..43f612c
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_nvram_config.h
@@ -0,0 +1,256 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * custom_nvram_config.h
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   The file contains nvram configuration default value.
+ *
+ * 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+#ifndef CUSTOM_NVRAM_CONFIG_H
+#define CUSTOM_NVRAM_CONFIG_H
+
+#include "kal_general_types.h"
+#include "nvram_config.h"
+#include "nvram_enums.h"
+#include "nvram_defs.h"
+
+
+//***************************************************************************
+// Configuration by each Application or User.
+// Only for protocol layer or library use. If your ap belongs to MMI
+// please use the app_id in mmi_res_range_def.h directly.
+//
+// App_id   : Application id
+// Name rule: NVRAM_APP_[applition name]
+// Action   : Use to class the data item to relate application
+//
+//***************************************************************************
+#if !defined(EMPTY_MMI)
+#if defined(NEPTUNE_MMI)
+
+#define NVRAM_APP_PHNSET NVRAM_APP_RESERVED
+
+typedef enum
+{
+    NVRAM_APP_START = NVRAM_APP_RESERVED,
+    NVRAM_APP_CAMERAPP,
+    /* Add applition id above this */
+    NVRAM_APP_TOTAL,
+    NVRAM_APP_MAX = 65535
+} nvram_restore_app_id_enum;
+
+#define NVRAM_CACHE_ID_RESERVED    256
+
+#else
+
+typedef enum
+{
+    NVRAM_APP_START = NVRAM_APP_RESERVED,
+    /* Add applition id above this */
+    NVRAM_APP_TOTAL,
+    NVRAM_APP_MAX = 65535   /* kal_uint16 */
+}nvram_restore_app_id_enum;
+
+#endif
+#else   /*EMPTY_MMI*/
+#define NVRAM_APP_PHNSET NVRAM_APP_RESERVED
+
+typedef enum
+{
+    NVRAM_APP_START = NVRAM_APP_RESERVED,
+    /* Add applition id above this */
+    NVRAM_APP_TOTAL,
+    NVRAM_APP_MAX = 65535   /* kal_uint16 */
+}nvram_restore_app_id_enum;
+
+#define NVRAM_CACHE_ID_RESERVED    256
+#endif  /*EMPTY_MMI*/
+
+
+//***************************************************************************
+// External function for custom.lib
+//***************************************************************************
+extern kal_uint32 nvram_custom_max_clean_folder_size(void);
+extern kal_uint32 nvram_custom_max_record_size(void);
+
+extern nvram_lid_enum nvram_get_first_cust_lid(void);
+extern nvram_lid_enum nvram_get_first_core_lid(void);
+extern nvram_lid_enum nvram_get_last_core_lid(void);
+extern nvram_lid_enum nvram_get_first_comm_lid(void);
+extern nvram_lid_enum nvram_get_last_comm_lid(void);
+
+#ifdef NEPTUNE_MMI
+extern kal_uint16 nvram_get_total_byte(void);
+extern kal_uint16 nvram_get_total_short(void);
+extern kal_uint16 nvram_get_total_double(void);
+#endif
+
+extern kal_bool nvram_custom_lock_status(void);
+
+#endif
diff --git a/mcu/custom/middleware/common/custom_nvram_lid_prot.c b/mcu/custom/middleware/common/custom_nvram_lid_prot.c
new file mode 100644
index 0000000..a1b60d2
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_nvram_lid_prot.c
@@ -0,0 +1,114 @@
+#include "kal_general_types.h"
+#include "kal_public_api.h"
+#include "nvram_data_items.h"
+#include "l4_nvram_def.h"
+#include "sst_interface.h"
+
+const SST_PROTECTED_NVRAM_LID g_protected_nvram_lid_list[] = 
+{
+	{
+		NVRAM_EF_IMEI_IMEISV_LID,
+		SST_PROTECTED_NVRAM_LID_WRITE_LIMIT 
+	}
+	,{
+		NVRAM_EF_SML_LID,
+		SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+	}
+	,{
+		NVRAM_EF_SIM_LOCK_LID, // now used for TMO SML and equal to NVRAM_EF_SML_TMO_LID in smu_def.h
+		SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+	}	
+	,{
+		NVRAM_EF_SML_GBLOB_LID,
+		SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+	}    
+	,{
+		NVRAM_EF_SML_GBLOB_KEY_LID,
+		SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+	}   
+	,{
+		NVRAM_EF_SML_S_LID,
+		SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+	}   
+	,{
+		NVRAM_EF_SUBSIDY_LOCK_LID,
+		SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+	}   
+	,{
+		NVRAM_EF_SUBSIDY_LOCK_ODM_DATA_LID,
+		SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+	}
+	,{
+		NVRAM_EF_SML_NONCE_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+	,{
+		NVRAM_EF_SML_UNLOCK_CODE_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+        ,{
+		NVRAM_EF_SML_SIGNATURE_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+        ,{
+		NVRAM_EF_SML_MAX_RETRY_COUNT_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+#ifdef __CARRIER_RESTRICTION__
+        ,{
+		NVRAM_EF_L4_CARRIER_RESTRICTION_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+#endif
+#ifdef __ATT_RSU_NVRAM__
+        ,{
+		NVRAM_EF_L4_ATT_SIM_LOCK_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+#endif
+#ifdef __VZW_RSU_NVRAM__
+        ,{
+		NVRAM_EF_L4_SML_VZW_SIM_LOCK_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+        ,{
+		NVRAM_EF_L4_SML_VZW_SIM_LOCK_DEVICE_KEY_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+        ,{
+		NVRAM_EF_L4_SML_VZW_RSU_DELAY_TIMER_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+#endif
+#ifdef __OP129_RSU_NVRAM__
+        ,{
+		NVRAM_EF_L4_SML_OP129_LID,
+                SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+        }
+#endif
+};
+
+const unsigned int g_protected_nvram_lid_list_items = \
+    sizeof(g_protected_nvram_lid_list)/sizeof(SST_PROTECTED_NVRAM_LID);
+
+const SST_ALLOWED_TASK g_allowed_task_list[] = 
+{
+	{MOD_L4C},
+	{MOD_FT},
+	{MOD_FTC},
+	{MOD_NVRAM}
+};
+
+const unsigned int g_allowed_task_list_items = \
+    sizeof(g_allowed_task_list)/sizeof(SST_ALLOWED_TASK);
+
+const SST_PROTECTED_NVRAM_LID g_protected_lid_list_ilm[] =
+{
+	{
+		NVRAM_EF_SML_LID,
+		SST_PROTECTED_NVRAM_LID_READ_LIMIT | SST_PROTECTED_NVRAM_LID_WRITE_LIMIT
+	},
+};
+
+const unsigned int g_protected_lid_list_ilm_items = \
+	sizeof(g_protected_lid_list_ilm)/sizeof(SST_PROTECTED_NVRAM_LID);
diff --git a/mcu/custom/middleware/common/custom_nvram_lid_prot.h b/mcu/custom/middleware/common/custom_nvram_lid_prot.h
new file mode 100644
index 0000000..36863f8
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_nvram_lid_prot.h
@@ -0,0 +1,76 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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).
+*
+*****************************************************************************/
+
+/*******************************************************************************
+ *==============================================================================
+ * 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 PROT_NVRAM_LID_H
+#define PROT_NVRAM_LID_H
+
+#include "SST_secure.h"
+
+/* To Customer: For ELT tool after W1928, the LIDs in the enum table would be invisible from ELT NVRAM editor */
+/* For ELT tool before W1928, the LID in this enum table would still be visible */
+typedef enum
+{
+	NVRAM_EF_IMEI_IMEISV_LID_TABLE,
+	NVRAM_EF_SML_LID_TABLE,
+	NVRAM_EF_SIM_LOCK_LID_TABLE,
+	NVRAM_EF_SML_GBLOB_LID_TABLE,
+	NVRAM_EF_SML_GBLOB_KEY_LID_TABLE,
+	NVRAM_EF_SML_S_LID_TABLE
+}lid_tool_invis_table;
+
+/* ELT Tool needs to parse the enum to enable LID_TOOL_INVISIBLE feature */
+typedef enum
+{
+	LID_TOOL_INVISIBLE,
+	ILM_INJECT_CHECK,
+} nvram_protect_info;
+
+
+extern unsigned int g_protected_lid_list_ilm_items;
+
+extern SST_PROTECTED_NVRAM_LID g_protected_lid_list_ilm[];
+
+#endif
diff --git a/mcu/custom/middleware/common/custom_sec_key.c b/mcu/custom/middleware/common/custom_sec_key.c
new file mode 100644
index 0000000..865dba7
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_sec_key.c
@@ -0,0 +1,678 @@
+
+#include "custom_sec_key.h"
+#include "kal_public_api.h" 
+
+/* MTK internal usage key for customized feature */
+const CUST_SEC_KEY_ST g_CUST_SEC_KEY =
+{
+	
+	CUST_SEC_KEY_STRUCT_MAGIC,
+	
+	CUST_SEC_KEY_STRUCT_VER, 
+	
+	{
+		// TM PUBLIC KEY1
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+				0x00
+			},
+			{
+		                0x9f, 0x71, 0xdc, 0xd1, 0x02, 0xcf, 0x70, 0xa3, 0x88, 0xe9, 0xf1, 0x1a, 0x4e, 0xc6, 0xf4, 0x4a,
+                		0x3c, 0x35, 0x3a, 0xb4, 0x41, 0x6a, 0x26, 0x04, 0x5e, 0xfe, 0x19, 0xa6, 0x79, 0xa9, 0xb4, 0xa3,
+		                0xd1, 0x36, 0x78, 0xe7, 0x8a, 0x1c, 0x11, 0x3e, 0xf1, 0x92, 0xe6, 0xab, 0x97, 0xb7, 0x0d, 0xc8,
+		                0x3a, 0xde, 0xc8, 0x72, 0x23, 0xfd, 0x71, 0x7c, 0xe8, 0xe4, 0xd1, 0x04, 0x17, 0xda, 0x7d, 0x79,
+		                0x0d, 0x9b, 0x09, 0x3b, 0x07, 0x5f, 0xbf, 0x35, 0xca, 0x0d, 0x4f, 0x43, 0xa1, 0x4e, 0x1a, 0x6f,
+		                0xc1, 0x1b, 0x3a, 0xd1, 0x50, 0x56, 0x66, 0xb5, 0xd7, 0xa2, 0x3a, 0x86, 0x8d, 0x2e, 0x26, 0x6e,
+		                0xc6, 0xdd, 0x37, 0xf1, 0x51, 0xfc, 0x5c, 0xa4, 0x04, 0x18, 0x65, 0xda, 0xbb, 0xab, 0xcd, 0xef,
+		                0xb6, 0x06, 0x7c, 0x5a, 0xf7, 0x41, 0x2c, 0x99, 0x16, 0xfa, 0x75, 0xb7, 0x24, 0xaf, 0xe1, 0x1c,
+		                0x45, 0x97, 0xe8, 0x29, 0xe8, 0x7e, 0x0a, 0xa3, 0xb1, 0xcf, 0x73, 0x44, 0xbd, 0xcb, 0xa7, 0x37,
+		                0xff, 0xaf, 0x60, 0xe7, 0x24, 0xc5, 0xbf, 0x9a, 0xf6, 0xe8, 0xb5, 0xb0, 0xb8, 0x9c, 0x7e, 0x02,
+		                0x5e, 0xbe, 0x8d, 0x3d, 0x6a, 0xbc, 0x95, 0xc2, 0x0b, 0x9c, 0x62, 0x13, 0x8a, 0x06, 0xbc, 0x0f,
+		                0xd7, 0xd5, 0x1b, 0x85, 0x4a, 0xc1, 0x14, 0x53, 0xff, 0x56, 0xe7, 0xe0, 0x6c, 0x33, 0x55, 0xd6,
+		                0xbd, 0x56, 0x5a, 0x43, 0x2e, 0x5a, 0xf0, 0xaf, 0x0b, 0xa8, 0xdd, 0xda, 0x6f, 0xdc, 0x23, 0xc5,
+		                0x71, 0xe6, 0x30, 0x56, 0x14, 0x8c, 0x03, 0x1c, 0x36, 0xbe, 0x58, 0x6c, 0x6e, 0xb1, 0x75, 0xb9,
+		                0x58, 0x76, 0x1c, 0x50, 0x47, 0xa7, 0x91, 0x9d, 0x10, 0xbc, 0xc9, 0xa3, 0xb0, 0x0c, 0x27, 0x19,
+		                0xf2, 0x1f, 0x0a, 0x5f, 0x68, 0x90, 0x79, 0xa3, 0x3b, 0x11, 0xe6, 0x3f, 0xff, 0x01, 0x4e, 0x93
+			}
+		},
+	
+		// XM test root key
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+				0x00
+			},
+			{
+				0xc0, 0x76, 0x21, 0xf1, 0x95, 0x51, 0x14, 0x2d, 0x3d, 0x5d, 0x9d, 0xd5, 0x14, 0x05, 0xd5, 0xd8, 
+				0x34, 0x70, 0xd5, 0x41, 0x7e, 0x66, 0x1c, 0xb3, 0xf5, 0x47, 0x2d, 0x2e, 0x4a, 0x9a, 0xe5, 0x63, 
+				0x45, 0xbf, 0x41, 0x87, 0x16, 0xfe, 0x7f, 0xb5, 0xa5, 0xc0, 0x41, 0x0e, 0x0f, 0xb1, 0x06, 0x72, 
+				0x59, 0x23, 0x05, 0xac, 0x46, 0xc1, 0xb8, 0x01, 0x24, 0x06, 0xdd, 0x02, 0x8b, 0xf6, 0x68, 0x7f, 
+				0x39, 0xdc, 0x5c, 0xaf, 0x45, 0x82, 0x9a, 0xe0, 0x6f, 0x17, 0x58, 0x94, 0xc2, 0x0a, 0xe3, 0x5a, 
+				0x33, 0x3b, 0x71, 0x9d, 0x96, 0xa5, 0xd7, 0x7f, 0x85, 0x20, 0x66, 0xa8, 0xff, 0x17, 0xca, 0xfc, 
+				0x22, 0x53, 0x89, 0xc0, 0x15, 0x14, 0x92, 0xe0, 0x7f, 0x67, 0xc8, 0x82, 0xb8, 0x9d, 0x13, 0x97, 
+				0xf9, 0xb5, 0x6a, 0xc2, 0xe5, 0x72, 0xcb, 0x07, 0xc1, 0xcc, 0xf5, 0xd2, 0xfc, 0x59, 0x07, 0x04, 
+				0x37, 0xdc, 0xbb, 0x35, 0x1c, 0xe0, 0xb6, 0x3d, 0x6c, 0x76, 0x2b, 0x42, 0x7e, 0xb6, 0x6c, 0x90, 
+				0xd9, 0x3f, 0x6f, 0x2c, 0xcb, 0x66, 0xd4, 0xef, 0xf2, 0x63, 0xc0, 0xda, 0x77, 0x35, 0x5b, 0x9e, 
+				0xe4, 0x02, 0x6f, 0x0c, 0x80, 0x56, 0x9a, 0x19, 0xb8, 0x39, 0xd3, 0x98, 0x8f, 0x4b, 0x55, 0xb0, 
+				0x42, 0xe7, 0xb9, 0x77, 0x30, 0x84, 0x8f, 0xa6, 0x2d, 0xca, 0x42, 0x72, 0x02, 0x76, 0xc6, 0x1c, 
+				0xc3, 0xb6, 0x98, 0x16, 0x4e, 0xe7, 0x41, 0x9b, 0xd1, 0x38, 0xb8, 0x5c, 0xae, 0x04, 0x21, 0x74, 
+				0xa7, 0x49, 0x38, 0x19, 0xc8, 0x33, 0x95, 0x3a, 0x4f, 0x93, 0x06, 0x8f, 0xf5, 0x65, 0x1f, 0x31, 
+				0x63, 0x3a, 0x2a, 0xdb, 0xd1, 0xfb, 0x5f, 0xd8, 0xd6, 0xdd, 0x0e, 0xbf, 0xb3, 0x56, 0x16, 0x6e, 
+				0xb3, 0x31, 0xbd, 0xe5, 0x8d, 0x1e, 0x22, 0x84, 0xa0, 0x47, 0xc4, 0x42, 0x06, 0x2c, 0x1e, 0xb5
+			}
+		},
+		
+		/* SPRT UICC unlock test key */
+		{
+			4,
+			256,
+			256,
+			{
+				0x0, 0x01, 0x00, 0x01
+			},
+			{
+				0x0
+			},
+			{
+				0xb1, 0xbb, 0xab, 0xd9, 0x53, 0x06, 0xd0, 0xa8, 0x0a, 0x22, 0x4a, 0x1d, 0xbf, 0xb7, 0xdf, 0xea, 
+				0xc9, 0xe9, 0xa8, 0xbc, 0xd3, 0x4f, 0xcd, 0x78, 0xb5, 0x30, 0x57, 0x76, 0xc2, 0x72, 0x6e, 0x70, 
+				0x42, 0x85, 0xdf, 0x12, 0x86, 0xf8, 0x92, 0x71, 0xc9, 0xab, 0xec, 0x32, 0x96, 0xd5, 0x9e, 0xf5, 
+				0x40, 0x3b, 0x26, 0x52, 0xf7, 0x9f, 0x7b, 0xbb, 0xd8, 0x78, 0xf4, 0x05, 0xef, 0x84, 0x90, 0xdc, 
+				0x35, 0x0a, 0x32, 0x5a, 0x7b, 0x84, 0xc3, 0xfd, 0x7f, 0x4e, 0x0e, 0x3c, 0x59, 0xd9, 0xf8, 0xcc, 
+				0x1f, 0x76, 0xb3, 0x4b, 0xf0, 0xd3, 0x1d, 0x7a, 0x11, 0xce, 0xd0, 0x23, 0x13, 0xc9, 0xd9, 0x88, 
+				0x4c, 0xa9, 0xe7, 0x47, 0xc2, 0x5e, 0x77, 0x51, 0xcd, 0x70, 0xac, 0xcc, 0xa0, 0x5f, 0xd2, 0xcb, 
+				0x34, 0xaf, 0x66, 0xdd, 0x85, 0x27, 0x4f, 0xf8, 0xfc, 0xe7, 0x72, 0x38, 0x42, 0x67, 0xbe, 0xbf,
+				0x34, 0x18, 0x3a, 0x10, 0xfb, 0x6a, 0x62, 0x54, 0x01, 0x77, 0x5f, 0x6f, 0xe5, 0x51, 0x98, 0x3b, 
+				0xfa, 0x82, 0x64, 0x22, 0x01, 0x56, 0xf0, 0x43, 0x74, 0x2a, 0xb7, 0xcc, 0xee, 0x24, 0x7d, 0xc2, 
+				0x19, 0xdc, 0x77, 0x14, 0xff, 0x4a, 0x67, 0x66, 0x7c, 0x7a, 0x7e, 0xcc, 0x8c, 0x4e, 0xbb, 0x79, 
+				0x43, 0x74, 0x6f, 0x96, 0x9b, 0x30, 0x7a, 0x56, 0x8b, 0xcd, 0x7a, 0x14, 0xfa, 0xe8, 0x65, 0x7b, 
+				0x15, 0x54, 0x2f, 0x37, 0x2d, 0xa5, 0xc6, 0xbc, 0x74, 0x79, 0xea, 0x37, 0x9f, 0xdb, 0xab, 0x61, 
+				0xe1, 0xaf, 0x28, 0x5d, 0x91, 0xe8, 0x0b, 0x5b, 0xe1, 0xd9, 0x80, 0x57, 0x87, 0xe4, 0x22, 0xe8, 
+				0x98, 0x8a, 0xaf, 0x19, 0x48, 0xf6, 0xa2, 0xb9, 0x3c, 0x71, 0x76, 0xca, 0x69, 0x25, 0xda, 0xf0, 
+				0xbc, 0x02, 0x89, 0x95, 0x63, 0xf3, 0x4e, 0xfa, 0xce, 0x3b, 0x0c, 0x92, 0xa1, 0x19, 0x51, 0x11
+			}
+		},
+		
+		/* META SLA key */
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+				0x0
+			},
+ 
+			{			
+				0xf5, 0x95, 0x57, 0x62, 0x0e, 0x24, 0xed, 0x16, 0x0f, 0x73, 0xe5, 0x68, 0x1d, 0x64, 0x35, 0x55,
+				0x24, 0xac, 0xe3, 0x06, 0x70, 0x01, 0x56, 0x31, 0x71, 0xc9, 0x34, 0x3d, 0xce, 0x27, 0x69, 0x13,
+				0x97, 0xe0, 0x28, 0x8c, 0xd8, 0xde, 0x1e, 0xf3, 0xc9, 0x85, 0xd9, 0x8d, 0x57, 0xa7, 0x5c, 0xf0,
+				0x12, 0xcc, 0x93, 0x59, 0x30, 0x14, 0xaa, 0x1a, 0x4b, 0x91, 0xf5, 0x70, 0x67, 0x80, 0xd7, 0x32,
+				0x01, 0x49, 0x22, 0x18, 0xa3, 0xdd, 0xa8, 0x44, 0x92, 0x4e, 0x4d, 0x09, 0x68, 0x86, 0x07, 0xfa,
+				0x8f, 0x03, 0x5d, 0x80, 0xcd, 0x2f, 0x9f, 0x16, 0xe1, 0x8e, 0x6e, 0x8a, 0xa4, 0x14, 0x74, 0x88,
+				0xf0, 0x6f, 0x92, 0xb6, 0x06, 0xb1, 0x0f, 0x58, 0x25, 0x03, 0xa2, 0x3b, 0x02, 0x91, 0x85, 0xee,
+				0xfe, 0xba, 0x28, 0x44, 0xdc, 0x48, 0x81, 0x95, 0x01, 0x34, 0x0b, 0xec, 0x00, 0x36, 0xa3, 0xee,
+				0x54, 0xbf, 0xc4, 0xc7, 0x87, 0x9a, 0x23, 0xc3, 0x05, 0x34, 0x57, 0xc0, 0x58, 0xf4, 0xb3, 0x5d,
+				0x77, 0xe6, 0x57, 0x61, 0xb5, 0x38, 0x1a, 0x88, 0x65, 0x12, 0x7d, 0x24, 0xe7, 0x27, 0xb5, 0x52,
+				0xd1, 0x67, 0xef, 0x88, 0xe9, 0x40, 0x44, 0xae, 0xbc, 0x34, 0x64, 0xf0, 0xef, 0x75, 0xb2, 0x3d,
+				0xca, 0xe4, 0x50, 0x04, 0xe4, 0x0b, 0x89, 0xb1, 0xd1, 0x17, 0x0f, 0x12, 0xd6, 0x38, 0xa0, 0x20,
+				0x59, 0x36, 0x49, 0x23, 0x53, 0x29, 0x7d, 0xf3, 0xe8, 0xc4, 0x9b, 0x63, 0x9c, 0x5b, 0xf5, 0xfc,
+				0x23, 0x8d, 0xc2, 0x17, 0xbe, 0xb3, 0xe0, 0x6a, 0x37, 0x1e, 0x93, 0x5a, 0x11, 0x06, 0xa5, 0x23,
+				0x60, 0x5c, 0xef, 0xf0, 0xb6, 0x80, 0x95, 0x84, 0x45, 0x06, 0xeb, 0x7f, 0xda, 0x18, 0x5a, 0xd9,
+				0x05, 0x6f, 0x26, 0x1c, 0x85, 0xe1, 0x4a, 0xfc, 0x2f, 0x28, 0xcf, 0x6e, 0xea, 0x1a, 0xd5, 0x77 
+			}
+		}, 
+		
+		/* AT SLA key */
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{	
+				0x0
+			},
+			{		
+				0xd6, 0xd0, 0x4c, 0x04, 0xb4, 0x67, 0x12, 0xbf, 0x4c, 0xa1, 0x05, 0xdc, 0xdb, 0xf6, 0x6f, 0x43, 
+				0x50, 0xe1, 0x4a, 0xa1, 0x67, 0x7a, 0xe6, 0xce, 0x00, 0xf9, 0x4d, 0x9a, 0xe1, 0x51, 0x76, 0x0a, 
+				0x35, 0x34, 0x35, 0xab, 0x53, 0xfb, 0x4b, 0x53, 0x36, 0x9f, 0x73, 0xe4, 0x37, 0x30, 0xdd, 0x1b, 
+				0xf6, 0x81, 0x06, 0x67, 0xed, 0xcb, 0x77, 0x8d, 0xe2, 0x0c, 0xed, 0xf8, 0x63, 0xec, 0x13, 0x42, 
+				0x67, 0xb6, 0x2c, 0x5a, 0x52, 0x5f, 0x0f, 0x31, 0x05, 0xb7, 0xbb, 0xe7, 0xcc, 0xf2, 0xa6, 0x5d, 
+				0x35, 0x8c, 0x80, 0xed, 0xd7, 0xac, 0xb8, 0x85, 0xfb, 0xb7, 0x77, 0x2f, 0x75, 0x21, 0xae, 0x8c, 
+				0xde, 0xde, 0x5d, 0x97, 0xea, 0x39, 0x50, 0xbd, 0xb5, 0x8e, 0xae, 0xd2, 0x99, 0xd3, 0x89, 0xb4, 
+				0xb3, 0x83, 0x22, 0xa5, 0x2f, 0x46, 0x0d, 0xb1, 0xd7, 0x88, 0xb5, 0xd1, 0xd3, 0x3d, 0xf9, 0x68, 
+				0x7d, 0xdc, 0x34, 0x50, 0x28, 0x4b, 0x1d, 0x0f, 0x78, 0xb5, 0x29, 0x19, 0x08, 0xf8, 0x75, 0xa1, 
+				0x43, 0x2c, 0x80, 0x69, 0x3a, 0xd3, 0xe1, 0x27, 0xa3, 0x54, 0xec, 0x1a, 0xa6, 0x62, 0xf6, 0xbc, 
+				0xc0, 0xb2, 0x76, 0x02, 0xe7, 0xe7, 0xef, 0xe2, 0x56, 0x74, 0xe0, 0xcb, 0x01, 0x9a, 0x1f, 0x7f, 
+				0x57, 0xea, 0xf2, 0x71, 0x22, 0x60, 0x10, 0x80, 0xe1, 0xf8, 0x97, 0xf2, 0x6f, 0x34, 0x50, 0xd5, 
+				0xdd, 0x1a, 0x09, 0x84, 0x2e, 0xdf, 0xc0, 0x8e, 0x8a, 0x54, 0xf5, 0x5b, 0xd2, 0xb4, 0xe9, 0x70, 
+				0x7e, 0x2a, 0x4c, 0x8c, 0xf5, 0xb5, 0x5d, 0x0d, 0x31, 0xce, 0xdc, 0x3e, 0xa3, 0x04, 0xc8, 0x22, 
+				0x6d, 0x64, 0x81, 0x0a, 0xfd, 0x60, 0x60, 0x9a, 0xb2, 0x8d, 0xc4, 0x4c, 0xc1, 0x78, 0xc5, 0x8b, 
+				0x3c, 0x78, 0xf0, 0xff, 0x40, 0xd1, 0xde, 0x3c, 0xd7, 0x9e, 0x5b, 0xa1, 0x0c, 0x73, 0x09, 0x6f
+			}
+
+		},
+		// VzW PUBLIC KEY
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+				0x00
+			},
+			{
+				0x9e, 0x43, 0xf8, 0xa2, 0x1b, 0x17, 0x82, 0xbb, 0x14, 0x54, 0x7c, 0x21, 0x28, 0x2b, 0x1f, 0x0e,
+				0x3a, 0x4a, 0xdf, 0x19, 0x14, 0xd1, 0x7b, 0xcf, 0x29, 0x96, 0xc0, 0x3a, 0xfb, 0x4d, 0x9c, 0x78,
+				0xcc, 0x3a, 0x1a, 0xfa, 0xbc, 0xea, 0xb5, 0x5e, 0xac, 0xfd, 0x1e, 0xd8, 0x12, 0x72, 0x17, 0x42,
+				0x15, 0x71, 0xa3, 0x4a, 0xb3, 0x1f, 0xbf, 0xb4, 0x51, 0xcc, 0xa3, 0x91, 0x41, 0x41, 0x78, 0x44,
+				0x82, 0xc0, 0x93, 0x0c, 0x10, 0xe0, 0x56, 0xde, 0xd5, 0x93, 0x85, 0x9e, 0x3e, 0x3d, 0x80, 0x66,
+				0x7e, 0xf9, 0x5f, 0x50, 0x2d, 0x1e, 0x5b, 0xf8, 0xc4, 0x8c, 0x5f, 0x06, 0x02, 0xed, 0x18, 0x54,
+				0xbc, 0x10, 0x8e, 0x32, 0x18, 0x32, 0x40, 0x87, 0xb8, 0x7c, 0x31, 0xa1, 0xb7, 0x94, 0x1c, 0xea,
+				0x86, 0xf6, 0xa5, 0x3c, 0xf4, 0xc8, 0x09, 0x37, 0x48, 0xbf, 0x23, 0xb1, 0x34, 0xaf, 0x50, 0x0a,
+				0x55, 0xe4, 0xcf, 0x5b, 0x2c, 0x9e, 0x58, 0xd7, 0xe3, 0x44, 0xd8, 0x7b, 0x99, 0x3a, 0xe5, 0x2d,
+				0xd8, 0xff, 0xdd, 0x56, 0xb7, 0x90, 0x63, 0xd4, 0xc4, 0xcd, 0x9b, 0xe2, 0x9a, 0x69, 0x56, 0x01,
+				0x72, 0x14, 0x97, 0x3a, 0x57, 0x11, 0xbd, 0x7f, 0xd5, 0x85, 0x65, 0x86, 0x5c, 0x4b, 0x92, 0x56,
+				0x06, 0x05, 0x09, 0xf5, 0xc5, 0x1c, 0x0c, 0x96, 0x98, 0x2a, 0xe2, 0x74, 0x21, 0x79, 0xb5, 0xa2,
+				0xdc, 0xaa, 0x1e, 0x7b, 0x9e, 0x98, 0xee, 0xd2, 0x1d, 0xd0, 0x70, 0x1e, 0x20, 0xf6, 0x80, 0xa3,
+				0x4c, 0x0a, 0x1b, 0x37, 0x1d, 0xd5, 0x72, 0xbd, 0xaf, 0x93, 0x31, 0x4e, 0xb7, 0xf8, 0x70, 0x58,
+				0x90, 0x8f, 0xf6, 0x48, 0x85, 0xb8, 0xc4, 0xa5, 0x7f, 0xa4, 0xd9, 0x00, 0x11, 0x81, 0xfe, 0xdd,
+				0xde, 0x94, 0xe0, 0x44, 0x32, 0x8a, 0x02, 0xa2, 0xac, 0x6a, 0xcc, 0xd1, 0xc0, 0x69, 0xca, 0x0f
+			}
+		},
+
+		// KDDI 
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+                0x00
+                /*
+                0x98, 0xcd, 0x78, 0xda, 0x44, 0x09, 0x5a, 0xaa, 0xf9, 0xae, 0xb8, 0x04, 0xd7, 0xe2, 0x7c, 0xab, 
+                0x4b, 0xea, 0x9c, 0xee, 0x0f, 0x21, 0xd3, 0x26, 0x57, 0xea, 0x6f, 0x38, 0xca, 0x05, 0xd3, 0xff,
+                0x28, 0x3d, 0xcf, 0x8d, 0xda, 0x4e, 0x99, 0xf4, 0xb6, 0x2b, 0xd7, 0xd8, 0x10, 0xde, 0x55, 0x92,
+                0xa3, 0xcd, 0x2c, 0xc0, 0x0d, 0x48, 0x7a, 0x98, 0x06, 0xfb, 0xb0, 0x38, 0x37, 0x8b, 0x5c, 0x36,
+                0x56, 0x5b, 0x7f, 0x67, 0x7a, 0x40, 0x00, 0x35, 0xb1, 0x22, 0xb7, 0xa2, 0xf9, 0xee, 0x6b, 0xa1,
+                0x37, 0xb4, 0x5c, 0x11, 0xca, 0xb3, 0x44, 0x2e, 0x15, 0xaa, 0xca, 0xcb, 0x88, 0x4c, 0x94, 0xe9, 
+                0x06, 0x6a, 0x45, 0x2a, 0x53, 0x7c, 0xff, 0x30, 0x2d, 0x3e, 0xdd, 0x70, 0x98, 0xc3, 0x5c, 0xd7, 
+                0xf4, 0x27, 0xed, 0x6d, 0x5e, 0xf5, 0xf2, 0x19, 0x45, 0xf0, 0x56, 0xdc, 0x33, 0xee, 0xbb, 0xfc, 
+                0xce, 0xd1, 0xd0, 0xdd, 0x2e, 0x4b, 0x7a, 0xbb, 0xfb, 0x9b, 0x08, 0xd0, 0x05, 0x8f, 0xf3, 0x43, 
+                0xbe, 0xee, 0xda, 0x3b, 0x59, 0xe2, 0x49, 0x2a, 0x14, 0x65, 0x2a, 0xb8, 0xdd, 0x82, 0x3b, 0x97,
+                0xdd, 0x30, 0x33, 0x4e, 0xd8, 0xd7, 0xb6, 0xed, 0x28, 0x76, 0x86, 0x38, 0xdb, 0xd1, 0x37, 0xc0, 
+                0xe4, 0x28, 0x46, 0x8a, 0x18, 0x85, 0xca, 0x33, 0x8e, 0x9a, 0x4a, 0x40, 0x5a, 0x4f, 0x3e, 0x14, 
+                0x07, 0x49, 0x1c, 0xce, 0x15, 0x9a, 0xf4, 0xf3, 0x01, 0x21, 0x3d, 0x65, 0xeb, 0x6c, 0x89, 0x50, 
+                0x12, 0xff, 0x75, 0xa3, 0xa0, 0x81, 0x75, 0x96, 0x80, 0xef, 0x22, 0x69, 0xb6, 0x95, 0x75, 0x05, 
+                0xc5, 0x9c, 0xbb, 0x9e, 0xe2, 0x8e, 0x8c, 0xba, 0x5e, 0x4e, 0xf7, 0xcc, 0x12, 0xd4, 0xc0, 0xad, 
+                0x9a, 0xd5, 0xe8, 0xc2, 0xd0, 0x33, 0xf6, 0x1a, 0x36, 0xd9, 0xc6, 0xe7, 0xeb, 0x6b, 0xd7, 0x05
+                */
+			},
+			{
+                0xe3, 0xa2, 0x19, 0x29, 0x16, 0xe6, 0xb2, 0xe6, 0x78, 0xc1, 0x14, 0x12, 0xe3, 0x77, 0x13, 0xc9,
+                0x78, 0x89, 0x20, 0xbb, 0xd1, 0x75, 0x09, 0xc7, 0xbf, 0x9a, 0xa2, 0x89, 0x6c, 0x51, 0x67, 0xd3,
+                0xc0, 0x2a, 0xcd, 0x10, 0xeb, 0xff, 0x31, 0xd8, 0xe1, 0x59, 0x37, 0x3b, 0x58, 0xe3, 0x46, 0x14,
+                0x3a, 0x2f, 0x8a, 0x46, 0x80, 0x39, 0xe9, 0xe0, 0x0f, 0x91, 0x88, 0x30, 0x4e, 0x07, 0xc7, 0xec,
+                0x86, 0x91, 0x9b, 0xf2, 0x69, 0xba, 0x9d, 0x31, 0x13, 0x9c, 0x56, 0x47, 0xdc, 0x51, 0xa3, 0xa6,
+                0x4d, 0xa5, 0xc7, 0x10, 0x04, 0x1e, 0x57, 0xb7, 0xce, 0xef, 0x2b, 0x8a, 0x87, 0x6a, 0x47, 0xb0,
+                0xff, 0x27, 0xc8, 0x3a, 0x65, 0xb6, 0x18, 0xd9, 0xbd, 0x09, 0x11, 0xd1, 0x44, 0xf8, 0x9a, 0x1a,
+                0xb0, 0x15, 0x64, 0xcf, 0x3a, 0x3f, 0x51, 0x78, 0x1b, 0xc4, 0xd0, 0x00, 0x03, 0x89, 0x48, 0x48,
+                0x2e, 0xa0, 0x90, 0x22, 0xe3, 0x8c, 0xc3, 0x71, 0xd4, 0xb0, 0x17, 0x22, 0xf5, 0x3b, 0xdf, 0x18,
+                0xb4, 0x8b, 0x5b, 0x8f, 0x77, 0x4c, 0x89, 0x40, 0x68, 0xb3, 0xe5, 0xdb, 0x3c, 0x74, 0x2a, 0xf1,
+                0xcd, 0x4f, 0x54, 0x34, 0xe3, 0x46, 0x41, 0x08, 0xf3, 0x5b, 0x7e, 0x44, 0x7b, 0xb3, 0x35, 0xd5,
+                0xa9, 0xf7, 0x6d, 0xf0, 0x39, 0x03, 0x38, 0x7e, 0x74, 0xdb, 0x23, 0x8c, 0xe5, 0x01, 0x5e, 0x5e,
+                0xfd, 0x6f, 0x79, 0x8c, 0xe3, 0x2c, 0x13, 0x3c, 0x64, 0x3a, 0xf5, 0x1b, 0x88, 0x41, 0xbb, 0x2d,
+                0x5c, 0x90, 0x16, 0x08, 0x60, 0x95, 0xce, 0x15, 0x4d, 0xc8, 0x14, 0xaf, 0x5b, 0x03, 0xe9, 0xb7,
+                0xa8, 0xca, 0x8a, 0xec, 0xfa, 0x5d, 0x82, 0x46, 0x58, 0x37, 0x35, 0x53, 0x72, 0xfd, 0x71, 0x7c,
+                0xb9, 0x86, 0x3e, 0xa3, 0x16, 0xf9, 0x61, 0xee, 0x65, 0x37, 0x22, 0xa0, 0xfb, 0xb5, 0x65, 0xaf
+                /*
+				0xa3, 0x27, 0x68, 0x94, 0xf7, 0xe0, 0xba, 0xef, 0xdd, 0x56, 0xdd, 0x39, 0xe5, 0x03, 0x17, 0xc6,
+				0xe1, 0x0a, 0x2a, 0xf4, 0x2a, 0xec, 0xeb, 0x73, 0x7d, 0x6c, 0x71, 0x0a, 0xd6, 0x37, 0x1a, 0xd3, 
+				0x9a, 0x4d, 0x95, 0xa2, 0x79, 0x25, 0xad, 0x0e, 0x73, 0xcf, 0x17, 0xda, 0x3b, 0x6d, 0x65, 0xe0, 
+				0x44, 0x11, 0x1a, 0x44, 0xc8, 0xfc, 0x2e, 0xe6, 0x0f, 0x5b, 0x10, 0xf6, 0x57, 0xf5, 0xe7, 0xd7, 
+				0x67, 0x5b, 0x29, 0x0c, 0x8a, 0x48, 0xfd, 0xb5, 0x7d, 0x6e, 0x2e, 0xf6, 0x46, 0xaa, 0xea, 0xf9, 
+				0x33, 0xf6, 0x5b, 0x2c, 0xab, 0x1b, 0x8d, 0x46, 0x6a, 0x44, 0x7a, 0x6e, 0x65, 0xc2, 0x84, 0xdd, 
+				0x15, 0x56, 0xce, 0x26, 0x19, 0x50, 0x60, 0xe2, 0x68, 0xf1, 0x1e, 0x03, 0xda, 0xcb, 0xd5, 0x85, 
+				0x8a, 0x79, 0x78, 0x07, 0x5b, 0xe2, 0x5b, 0xba, 0xbf, 0x81, 0x53, 0xdb, 0x39, 0xa1, 0xc7, 0xf9, 
+				0x44, 0xb1, 0xc0, 0xe6, 0x12, 0xbc, 0xc7, 0x16, 0x13, 0x7b, 0x43, 0xe8, 0xc5, 0xab, 0x3d, 0xa8, 
+				0x3d, 0xb7, 0x81, 0x0a, 0xed, 0x74, 0x03, 0xd7, 0x9d, 0xe4, 0x7c, 0xab, 0x5b, 0xf5, 0xea, 0x60, 
+				0x93, 0xe7, 0xbf, 0xf2, 0xe5, 0x3a, 0x41, 0xd8, 0xb1, 0x69, 0x1e, 0x66, 0x94, 0xcb, 0x56, 0x27, 
+				0xdf, 0xc9, 0xdc, 0xec, 0x69, 0x6a, 0xe2, 0xfc, 0x33, 0x12, 0xc0, 0x57, 0xaa, 0xa8, 0x90, 0x9c, 
+				0x5d, 0xca, 0xaa, 0xd5, 0xed, 0x54, 0x8f, 0x8f, 0x5f, 0x5c, 0xf0, 0x08, 0xfc, 0x62, 0x4b, 0x9a, 
+				0x3f, 0x5b, 0x44, 0x91, 0x75, 0x1e, 0x36, 0x18, 0xdf, 0x98, 0x54, 0x9d, 0x3b, 0x57, 0x03, 0x73, 
+				0xc7, 0xa9, 0x00, 0x53, 0x24, 0xd7, 0xa9, 0x62, 0xb5, 0x46, 0x34, 0xf6, 0xa3, 0x5a, 0x1c, 0x5c, 
+				0xd5, 0xcb, 0x34, 0xa6, 0xff, 0x67, 0xb7, 0x31, 0x58, 0x2c, 0xb8, 0xc3, 0x48, 0x6b, 0x44, 0xb5
+                */
+			}
+		},  // ATT public key
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+				0x8e,0xb9,0x08,0x3a,0xe2,0x54,0x82,0x70,0x0b,0x43,0x63,0x97,0x52,0xb0,
+    0xf8,0x3d,0x33,0xa8,0x9d,0x42,0x84,0x66,0xd4,0x45,0x2d,0x2c,0xb7,0xe8,0x19,
+    0x78,0x18,0x1c,0x61,0x46,0x41,0x36,0x26,0x8e,0xbc,0xe9,0xbc,0xaf,0x90,0xde,
+    0x8f,0xe8,0xbf,0xc1,0xee,0x0f,0xed,0x54,0xae,0x49,0x81,0x58,0xdc,0x3d,0x9f,
+    0x95,0x44,0xe4,0xbf,0xd1,0x8c,0x4f,0x7b,0xe1,0xa4,0xbe,0xbd,0x6a,0x71,0x12,
+    0xce,0x0a,0xf7,0x56,0x34,0x87,0x20,0x28,0xd1,0x68,0x18,0x20,0xef,0xb8,0x74,
+    0x41,0x2a,0x7d,0x34,0xc4,0x47,0xa4,0xbb,0x2e,0xd8,0x62,0x0a,0x35,0x31,0xf9,
+    0x76,0xa9,0xcf,0x4e,0xdf,0xbe,0x73,0x4a,0x71,0x4f,0x53,0x72,0x82,0x7e,0x1f,
+    0x2c,0x07,0xb5,0x08,0xa9,0xa2,0xac,0xf1,0x64,0x69,0x93,0x98,0xb5,0x76,0x89,
+    0x01,0x1d,0x19,0x53,0x13,0x46,0xf2,0xe5,0x49,0xef,0xd9,0x11,0x97,0xca,0xfb,
+    0x8c,0xef,0x86,0x7d,0x27,0x8e,0xca,0x80,0x6c,0x43,0x55,0x7f,0x89,0xa1,0xb6,
+    0x9c,0xeb,0x9f,0xe4,0xa4,0x13,0x7c,0x54,0x77,0x5a,0x4e,0x21,0x74,0x68,0x65,
+    0x08,0x4a,0x81,0x07,0x31,0xc9,0xd3,0x62,0xaf,0xd2,0x7f,0x93,0x08,0x4b,0x19,
+    0xdc,0xbe,0xdb,0x93,0xe1,0x43,0xd6,0xa0,0x51,0x77,0xd4,0x1b,0x03,0xa5,0xf4,
+    0xe6,0xac,0x72,0x08,0xed,0xb8,0xdf,0x47,0x12,0x33,0x6d,0x08,0x24,0xe1,0xf0,
+    0x31,0x7a,0x94,0xa6,0x9b,0x3e,0xa0,0x5f,0x7d,0xa9,0xc1,0xba,0x37,0xc9,0x36,
+    0xf6,0x70,0x84,0xd2,0x39,0xe1,0x2f,0x25,0x1c,0xd9,0x7d,0x09,0xc7,0x0e,0x9f,
+    0x54,0x41
+			},
+			{
+				0xb2,0x7a,0x1d,0x17,0xd9,0x9f,0x58,0x24,0xa4,0xd9,0x08,0x9c,0x43,0xb9,
+    0x3e,0x7a,0x0f,0x44,0xd2,0x23,0x41,0xa8,0x59,0xf0,0x24,0x32,0x0b,0x6f,0x2f,
+    0x03,0x04,0x48,0x07,0x0c,0x02,0x53,0xbe,0x37,0x6d,0xf7,0xc3,0x29,0x73,0x27,
+    0x5a,0xf8,0x60,0xcf,0x2e,0x51,0x06,0x78,0x6a,0xc0,0x93,0x19,0xe5,0x9d,0x6c,
+    0xc4,0xa9,0x91,0xbe,0xb1,0x3d,0x29,0x80,0x74,0x74,0x9c,0x52,0x93,0xdd,0x21,
+    0x04,0x3f,0xa5,0x30,0x3d,0xba,0xee,0xd8,0x2f,0xea,0x01,0xaf,0x75,0xa1,0xaf,
+    0x63,0xd6,0x91,0xc1,0xdf,0x8c,0x37,0x81,0x2b,0x96,0xe2,0x6e,0x3c,0x3d,0x58,
+    0x8d,0xca,0x7e,0x07,0xa7,0x97,0xad,0x32,0xb4,0xe6,0x95,0x5d,0x76,0xea,0xdd,
+    0xef,0x3a,0xe5,0x4f,0xc0,0x6f,0xb7,0x91,0xbc,0x2a,0x62,0x9a,0x72,0xe6,0xe8,
+    0xb7,0x63,0x52,0x3e,0xd5,0x1c,0xc1,0xaf,0x5d,0xc4,0x65,0x68,0x25,0xc0,0xd7,
+    0xc6,0x4e,0x43,0x15,0x6c,0x28,0x24,0xde,0x05,0xc2,0xf4,0xe7,0x03,0x98,0x71,
+    0x24,0x2b,0xb3,0x69,0xb3,0x75,0x7d,0x3f,0xb2,0x70,0x28,0x9b,0x5a,0x60,0x37,
+    0x4b,0x0f,0xb6,0x0d,0x65,0xf7,0xfb,0x7a,0x61,0xbd,0xae,0x60,0x1d,0x3c,0x9d,
+    0xfe,0xba,0x77,0xf9,0x2d,0xaa,0x2a,0x8a,0xe8,0xd6,0x18,0x63,0xac,0x68,0xc3,
+    0x4b,0x9c,0x67,0x2c,0x22,0x33,0x19,0xce,0x55,0x7f,0x4c,0x88,0xc8,0x6a,0xff,
+    0x2d,0xa5,0xcc,0xd7,0xb0,0x72,0x2f,0x3c,0xbd,0x0b,0x8d,0x1f,0x46,0xbb,0x1b,
+    0x17,0x33,0x9e,0x8d,0x00,0xc3,0xf5,0xd4,0x44,0x10,0x6b,0x21,0xa3,0x4c,0xc8,
+    0x38,0x13	
+			}
+		},
+		/* CRK public key 1 */
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+				0x0
+			},
+			{
+	                    0x9b, 0x7d, 0xd2, 0xc2, 0x4c, 0x7d, 0x52, 0xa4, 0xc3, 0xf3, 0xbb, 0xdb, 0xf8, 0x37, 0x56, 0x55, 
+	                    0x4a, 0xfe, 0x20, 0x5b, 0x71, 0xeb, 0xea, 0x1f, 0x28, 0x88, 0x46, 0x70, 0x4f, 0x44, 0xdf, 0x70, 
+	                    0xa5, 0x22, 0xd9, 0xaf, 0xa6, 0x0d, 0x1c, 0x07, 0x4e, 0xdb, 0xf3, 0xe1, 0x58, 0xf7, 0xbe, 0xb0, 
+	                    0x6e, 0xbf, 0x04, 0x79, 0x05, 0x37, 0x55, 0x34, 0x5a, 0x17, 0xf6, 0x4f, 0xdb, 0x9a, 0x19, 0x9c, 
+	                    0x5e, 0xc1, 0x3b, 0x3e, 0x9e, 0xc1, 0xc9, 0x0c, 0x6a, 0xf9, 0xa7, 0x4a, 0x45, 0xd2, 0xc7, 0x01, 
+	                    0x0a, 0x36, 0x7e, 0xe3, 0x6a, 0x0e, 0xaa, 0x0d, 0x08, 0xbf, 0xbb, 0x07, 0xbf, 0xa4, 0x3d, 0x11, 
+	                    0x5d, 0x02, 0x9c, 0xe7, 0xf8, 0xc9, 0x1d, 0xe1, 0x90, 0xb1, 0x41, 0x33, 0x40, 0xea, 0x1e, 0xc9, 
+	                    0xbd, 0x94, 0xd1, 0x11, 0x98, 0x8b, 0x8b, 0xc3, 0xb7, 0x96, 0xa8, 0x98, 0xb9, 0x05, 0x70, 0xfc, 
+	                    0x4b, 0x83, 0xd6, 0x02, 0x2a, 0xd4, 0x08, 0xf0, 0xbb, 0x35, 0xc3, 0x5e, 0xfd, 0x7f, 0x6b, 0x64, 
+	                    0xf0, 0x95, 0xbd, 0x97, 0x7a, 0x07, 0x54, 0xa6, 0xf0, 0xe4, 0x45, 0x30, 0xeb, 0xb4, 0xcd, 0x0d, 
+	                    0x4e, 0xba, 0x9d, 0xbb, 0xcc, 0xae, 0x97, 0x6d, 0x71, 0xa9, 0xa2, 0x13, 0xfe, 0x3d, 0x83, 0x6f, 
+	                    0x85, 0x6d, 0xd5, 0x93, 0x9b, 0x0a, 0xc0, 0x9f, 0x82, 0xfa, 0xb3, 0xd3, 0xaa, 0x7e, 0xf6, 0x80, 
+	                    0x5a, 0x7e, 0xb2, 0xff, 0x81, 0x18, 0x78, 0x02, 0x71, 0xdb, 0x40, 0x95, 0x0c, 0xc2, 0xa1, 0xe8, 
+	                    0x0c, 0x32, 0x67, 0x4c, 0x5f, 0x4c, 0x7c, 0xd7, 0x69, 0x0f, 0xa1, 0xc2, 0xdd, 0x70, 0x7e, 0xfa, 
+	                    0xae, 0x78, 0xa9, 0xaa, 0x2a, 0x59, 0xd6, 0xe5, 0xac, 0xa5, 0xd7, 0x8f, 0x39, 0x3d, 0xc4, 0x14, 
+	                    0xcd, 0x51, 0x14, 0x0b, 0x67, 0x3b, 0x57, 0x8d, 0x6d, 0x0f, 0xc0, 0xb9, 0xd5, 0x23, 0x7e, 0x89
+			}
+		},
+		/* TMO encryption key */
+        	{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{	
+				0x0
+			},
+			{	
+                		0xfa, 0xec, 0x42, 0x26, 0x9f, 0x1b, 0xb5, 0xae, 0x0f, 0x17, 0xe1, 0x4b, 0xc1, 0x81, 0xad, 0x48, 
+		                0xed, 0x77, 0x42, 0xd3, 0xd4, 0x5a, 0xb5, 0xf9, 0x1d, 0x9a, 0x3a, 0xfd, 0xc0, 0xb1, 0x4e, 0x0d, 
+                		0xb2, 0x06, 0xd3, 0xe2, 0x5e, 0x0e, 0xb1, 0xa3, 0x2f, 0xda, 0x83, 0xa6, 0xd5, 0x4f, 0xc0, 0xe1, 
+		                0xcc, 0xf1, 0x51, 0x55, 0xa2, 0x3b, 0x6f, 0x5e, 0xdf, 0x67, 0xb9, 0x5d, 0x07, 0x06, 0x6a, 0x8f, 
+                		0x26, 0x49, 0xb0, 0x64, 0x89, 0xbc, 0x00, 0x36, 0x60, 0xf9, 0x35, 0x12, 0xdc, 0x82, 0x9e, 0x3a, 
+		                0x79, 0x23, 0x57, 0x2e, 0x95, 0x0b, 0x5e, 0xcf, 0xc2, 0x50, 0x8c, 0x7b, 0x50, 0xa3, 0x6b, 0x9a, 
+                		0xc7, 0xfe, 0x83, 0x64, 0x4f, 0x10, 0x6a, 0xab, 0x39, 0x96, 0xc1, 0x4d, 0x74, 0x18, 0x0f, 0xc5, 
+		                0x62, 0xc9, 0xc6, 0x90, 0xc3, 0xf7, 0x4f, 0xee, 0xfd, 0x43, 0x99, 0x5a, 0x6b, 0x81, 0x75, 0x3e,
+		                0xcc, 0xd2, 0xa5, 0xe5, 0x21, 0xd4, 0xc3, 0x84, 0x9d, 0x80, 0xb4, 0x9a, 0x4f, 0x2a, 0x8e, 0x09, 
+                		0xc0, 0xee, 0x8f, 0xab, 0x87, 0x60, 0xf7, 0xe2, 0xa3, 0xd7, 0xf5, 0xf4, 0xcf, 0xa0, 0x6d, 0xe5, 
+		                0x81, 0xf0, 0x35, 0x6e, 0x56, 0x9f, 0xcb, 0x0c, 0x06, 0xae, 0xf9, 0xf5, 0x7b, 0x06, 0xd9, 0x5d, 
+                		0x67, 0x5e, 0xdd, 0x4f, 0x02, 0x60, 0x9c, 0xe8, 0xa5, 0x19, 0x9c, 0x86, 0x6c, 0xed, 0xbd, 0x08, 
+		                0x3d, 0x1c, 0x59, 0xfd, 0x10, 0x1e, 0x04, 0x16, 0x38, 0xeb, 0xf7, 0x5b, 0x23, 0x56, 0xc4, 0x1c, 
+		                0x80, 0x4f, 0x71, 0xe0, 0x40, 0x28, 0xa8, 0xa9, 0x13, 0x4f, 0xb8, 0xab, 0x9a, 0x68, 0x64, 0x6f, 
+                		0xdc, 0x1b, 0x33, 0xef, 0x7f, 0xef, 0x22, 0x35, 0x5f, 0x8d, 0xc6, 0x75, 0xfe, 0x74, 0x18, 0x42, 
+		                0xd9, 0x17, 0xc8, 0x97, 0xb9, 0xa6, 0xfe, 0xd0, 0x43, 0x0c, 0xe0, 0xdb, 0x7b, 0x3d, 0xef, 0x93
+			}      
+        	}, 
+		/* MCF encryption key RSA2048 */
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+				0x0
+			},
+			{
+				0xb0, 0xf8, 0xed, 0x3f, 0x0c, 0x34, 0x8e, 0xa2, 0xae, 0xfd, 0xf3, 0x86, 0x85, 0x67, 0x39,
+                0x7e, 0xd7, 0x1f, 0xa4, 0x98, 0x22, 0xbf, 0xaa, 0xfe, 0xa1, 0x36, 0xe3, 0x2e, 0x91, 0x59,
+                0xb2, 0x99, 0xa3, 0x3c, 0xd6, 0x50, 0xde, 0xea, 0x36, 0x46, 0x37, 0x7f, 0x63, 0xc4, 0xa8,
+                0x0f, 0x9b, 0x23, 0xb9, 0x2d, 0x80, 0x57, 0xb3, 0xaa, 0xf0, 0xd8, 0x72, 0x85, 0xa2, 0xed,
+                0xf3, 0x53, 0xde, 0x35, 0xaf, 0x72, 0xb5, 0x2d, 0xc0, 0x1d, 0x23, 0xe4, 0xc5, 0xbc, 0x1c,
+                0x9e, 0xb1, 0xc4, 0xb5, 0x99, 0x5b, 0xd2, 0x1d, 0x26, 0x9e, 0x66, 0x38, 0x3a, 0xe5, 0x18,
+                0x5f, 0x86, 0x75, 0x61, 0x0b, 0xf7, 0x07, 0x59, 0xa0, 0x48, 0x76, 0xfa, 0x43, 0x21, 0x3d,
+                0xf0, 0x18, 0x88, 0xfc, 0xb6, 0x60, 0x6a, 0xb9, 0x22, 0xb7, 0x3d, 0xbc, 0xb1, 0x49, 0x6b,
+                0x04, 0x68, 0x62, 0xd3, 0x2e, 0x6a, 0x7a, 0x35, 0x76, 0x4f, 0xa5, 0x50, 0x3f, 0xa6, 0xd8,
+                0xde, 0xa7, 0x98, 0x97, 0xe0, 0xca, 0xd3, 0x16, 0xcb, 0x44, 0x55, 0xd5, 0x6c, 0x53, 0xce,
+                0xb1, 0x73, 0x63, 0x74, 0x4d, 0xf2, 0x38, 0xc2, 0x1a, 0x5f, 0xf7, 0x2d, 0xda, 0x29, 0xa3,
+                0x55, 0x7b, 0xa6, 0x59, 0xd2, 0xc7, 0xb4, 0xe1, 0x8d, 0xce, 0xd8, 0x56, 0xeb, 0x5f, 0x10,
+                0x1b, 0xd8, 0x1a, 0x6b, 0x02, 0x69, 0xb1, 0xbf, 0xd6, 0x50, 0x87, 0x62, 0x4c, 0x41, 0xff,
+                0x20, 0xd4, 0xc3, 0x04, 0x0b, 0x53, 0x44, 0xc1, 0x26, 0x2f, 0xf9, 0xf7, 0x09, 0xaf, 0xb7,
+                0xd4, 0x75, 0xfa, 0x55, 0x44, 0x92, 0x87, 0x2e, 0xc1, 0x34, 0x70, 0xc8, 0x4a, 0x77, 0xaa,
+                0x3d, 0x5c, 0x04, 0x84, 0x5a, 0x4e, 0xac, 0xcc, 0x9c, 0x81, 0xc0, 0x4a, 0xec, 0x6b, 0x3f,
+                0x30, 0x88, 0xcc, 0x51, 0x2d, 0x57, 0xab, 0xe9, 0xde, 0x97, 0x7a, 0x5a, 0x80, 0x23, 0x8c,
+                0x85
+			}
+		},
+		/* MCF encryption key RSA3072 */
+		{
+			4,
+			384,
+			384,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+				0x0
+			},
+			{
+				0xc5, 0x97, 0xd4, 0xf1, 0x96, 0x5d, 0x4c, 0xc5, 0x66, 0x88, 0x79, 0xeb, 0xa6, 0x09, 0x57,
+				0xc8, 0xcd, 0x6f, 0x40, 0xc6, 0x62, 0xeb, 0x31, 0x76, 0xb0, 0x7f, 0xcc, 0x4b, 0x14, 0x89,
+				0x04, 0x4c, 0x77, 0xb6, 0xff, 0x14, 0xe1, 0x69, 0xcc, 0xd5, 0x09, 0xdc, 0x3f, 0x4e, 0x15,
+				0xab, 0xdd, 0x2b, 0x5b, 0x62, 0x43, 0x94, 0xa8, 0x13, 0xb5, 0x31, 0x27, 0xec, 0x21, 0x65,
+				0x9f, 0x8d, 0xac, 0xe9, 0x17, 0xd1, 0xe8, 0xd6, 0xc3, 0xdc, 0x4d, 0x29, 0xc1, 0xce, 0x55,
+				0x9f, 0x9e, 0xfd, 0xa7, 0x23, 0x9a, 0xa9, 0x36, 0x40, 0x4e, 0xcc, 0x92, 0x29, 0x78, 0xaa,
+				0xa0, 0x11, 0x0f, 0x52, 0x50, 0x34, 0xf2, 0x67, 0x83, 0xf2, 0x1a, 0x22, 0x4b, 0x09, 0x54,
+				0x90, 0x31, 0x7d, 0xbe, 0x2b, 0x23, 0xa7, 0xfd, 0xf7, 0x81, 0xe8, 0x71, 0x96, 0x24, 0x4f,
+				0xff, 0xcc, 0x0d, 0x7f, 0x07, 0x24, 0x02, 0x15, 0x98, 0x0f, 0xed, 0xdd, 0xc5, 0xeb, 0x50,
+				0xa9, 0x6e, 0xfd, 0xf7, 0x3f, 0x39, 0xd8, 0x00, 0x2a, 0x95, 0x4e, 0xce, 0xa0, 0xd1, 0xce,
+				0x29, 0x2f, 0x06, 0x4c, 0xc4, 0xfe, 0x61, 0x94, 0x86, 0x1a, 0xe3, 0x06, 0xac, 0x5b, 0x63,
+				0xd3, 0x21, 0xa3, 0x79, 0x59, 0x46, 0xb0, 0x63, 0x04, 0xcb, 0x90, 0xcb, 0x7b, 0x20, 0xe1,
+				0xdb, 0x66, 0xa0, 0xc0, 0xa3, 0xf1, 0xeb, 0x44, 0x5d, 0x71, 0x56, 0xcf, 0xc1, 0xed, 0x54,
+				0x90, 0xa8, 0xd1, 0xa7, 0xc8, 0xe2, 0x4d, 0x58, 0x3b, 0x98, 0x20, 0xf6, 0x9c, 0xa0, 0xcd,
+				0x8a, 0x3c, 0x8d, 0xb6, 0x3e, 0xe1, 0x27, 0xe1, 0x81, 0x24, 0x44, 0xb6, 0xec, 0x55, 0x0a,
+				0x47, 0x29, 0x52, 0xc7, 0x3b, 0x6e, 0xa3, 0x8b, 0x85, 0x50, 0x46, 0xd9, 0x07, 0x18, 0xe0,
+				0x60, 0xce, 0x09, 0xa1, 0x39, 0x47, 0x4d, 0x10, 0x31, 0xa3, 0x1c, 0xf9, 0x5b, 0x69, 0x56,
+				0x05, 0x85, 0x6c, 0x35, 0x30, 0xbe, 0x4b, 0x52, 0x70, 0xb0, 0x26, 0x8b, 0xbd, 0x23, 0x40,
+				0xf0, 0x41, 0xde, 0x62, 0xb1, 0xce, 0xea, 0xa2, 0xc6, 0x99, 0xa6, 0xa9, 0x25, 0x25, 0xf7,
+				0xac, 0xe3, 0x9f, 0x74, 0xe5, 0x2c, 0x3c, 0xa7, 0x0a, 0x25, 0x62, 0x8f, 0xfb, 0x77, 0xf9,
+				0x6b, 0xb7, 0x67, 0x61, 0x65, 0xad, 0xf2, 0xa7, 0x2c, 0x7a, 0x9e, 0xad, 0xdf, 0xa6, 0xef,
+				0xef, 0xa3, 0x4b, 0x14, 0x87, 0xa5, 0xdb, 0x5b, 0xfb, 0x12, 0xdf, 0xb4, 0x6b, 0xfa, 0x3f,
+				0x95, 0xd6, 0x35, 0x50, 0x4b, 0x29, 0x1e, 0x56, 0x5c, 0xc2, 0x9a, 0x50, 0xfa, 0x1c, 0x98,
+				0xdd, 0x46, 0x74, 0x03, 0x1b, 0xcd, 0x7d, 0x63, 0xc6, 0x63, 0x76, 0xe6, 0xd6, 0x3d, 0xa6,
+				0x06, 0x9c, 0x02, 0xea, 0xd7, 0x5d, 0x81, 0xcd, 0x5c, 0x34, 0x68, 0xec, 0xf6, 0x95, 0x4b,
+				0xab, 0x96, 0xdd, 0xd1, 0xa0, 0xb2, 0xc6, 0x76, 0x91
+			}
+		},
+		/* MIPC SLA key */
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{	
+				0x0
+			},
+			{		
+                                0xbe, 0x7d, 0x3f, 0x0b, 0xf1, 0x11, 0xb3, 0x2a, 0x46, 0xe4, 0x5e, 0x29, 0x47, 0xa7, 0xda, 0x35,
+                                0xaf, 0x50, 0x34, 0xb8, 0xca, 0x0c, 0xae, 0xff, 0xc4, 0xb1, 0xad, 0x6d, 0x56, 0x4f, 0xb9, 0x8d,
+                                0x3c, 0x72, 0xe1, 0xb0, 0x27, 0xaf, 0x80, 0x70, 0xdd, 0xb1, 0xd5, 0x95, 0x97, 0xea, 0xe2, 0x99,
+                                0x30, 0x93, 0x56, 0xee, 0xf4, 0xcb, 0xcf, 0x4c, 0x3d, 0x32, 0x10, 0x5f, 0x89, 0x1c, 0x61, 0x0a,
+                                0xb3, 0xdc, 0x04, 0x60, 0x78, 0x99, 0x6c, 0xb5, 0x65, 0xe3, 0x3d, 0xc2, 0x61, 0xe7, 0xb2, 0x03,
+                                0x23, 0x28, 0xef, 0xcc, 0x04, 0x26, 0xf5, 0xfa, 0x83, 0x0a, 0xf9, 0xed, 0x1b, 0x98, 0xe4, 0x47,
+                                0xb7, 0x2d, 0x6a, 0x24, 0xbf, 0xee, 0x55, 0xb5, 0xdd, 0x57, 0xf7, 0xe5, 0x9b, 0x3d, 0x0a, 0x4d,
+                                0x99, 0xaf, 0xd1, 0x4c, 0x2f, 0xb8, 0x61, 0x0c, 0x30, 0x68, 0xc0, 0x74, 0xbc, 0xac, 0xe8, 0xf7,
+                                0x92, 0x64, 0x8c, 0xd9, 0x32, 0x3e, 0x6c, 0x99, 0xe6, 0xf8, 0xe6, 0x05, 0xda, 0x01, 0x0d, 0x2b,
+                                0xb3, 0x2a, 0x03, 0x4a, 0x5a, 0x7e, 0x97, 0x80, 0x08, 0x6d, 0x63, 0x26, 0xa2, 0x16, 0xc8, 0x63,
+                                0xcb, 0x1b, 0x7e, 0x95, 0x2c, 0x27, 0x66, 0xe7, 0x23, 0x22, 0xce, 0x8f, 0xa0, 0xf9, 0xcc, 0xa4,
+                                0xf2, 0x0d, 0x42, 0xe7, 0xac, 0x2d, 0x49, 0x79, 0x02, 0x8c, 0xf2, 0x35, 0xac, 0xa2, 0x03, 0x8c,
+                                0x54, 0x47, 0x3f, 0x57, 0xdc, 0x0d, 0x5b, 0x5c, 0xd5, 0x7d, 0x61, 0x7c, 0x21, 0x36, 0x60, 0x2c,
+                                0xb2, 0xb8, 0x85, 0x57, 0x43, 0x33, 0x02, 0x2f, 0x52, 0x1e, 0x3f, 0x2b, 0x73, 0x61, 0xea, 0x7c,
+                                0x8f, 0x54, 0xaf, 0xf8, 0xfb, 0x7f, 0x73, 0x6a, 0x64, 0x0c, 0x5a, 0xed, 0x22, 0xd6, 0x87, 0xab,
+                                0xbe, 0xcc, 0xb0, 0x09, 0x2a, 0x94, 0x06, 0xa0, 0xc6, 0x44, 0xbe, 0x7a, 0x15, 0x37, 0xba, 0xb1
+			}
+		},
+		/* MIPC SLA key2 */
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{	
+				0x0
+			},
+			{		
+                                0xaa, 0xb5, 0x87, 0xd8, 0x42, 0x8d, 0x1a, 0xd3, 0xd0, 0xb0, 0x14, 0x38, 0x91, 0xdb, 0xbc, 0x17, 
+                                0x81, 0xd9, 0x95, 0xeb, 0xcf, 0xb0, 0x20, 0x2f, 0x73, 0xf8, 0x2f, 0xea, 0x79, 0x10, 0x62, 0x93, 
+                                0x0b, 0xcd, 0xcd, 0x54, 0x0f, 0xd6, 0x39, 0x08, 0x44, 0x8c, 0x49, 0x4e, 0x92, 0x67, 0xf1, 0x5c, 
+                                0x27, 0x42, 0x6d, 0xec, 0xa9, 0xda, 0x94, 0xfe, 0xdf, 0x39, 0xef, 0x31, 0x99, 0xd3, 0xba, 0x9f, 
+                                0x2f, 0x56, 0x0e, 0x5c, 0xa6, 0x8e, 0x9c, 0xa5, 0xb6, 0x0f, 0xdd, 0xb1, 0x24, 0xff, 0x72, 0xa5, 
+                                0xed, 0xd1, 0xb7, 0xb3, 0x76, 0x99, 0x5d, 0xfd, 0xe9, 0x3c, 0xef, 0x3f, 0x91, 0x57, 0x55, 0x29, 
+                                0x75, 0xe3, 0xac, 0xf9, 0x42, 0x85, 0xf8, 0x08, 0xde, 0x67, 0x89, 0x0f, 0x96, 0xdf, 0x3d, 0xeb, 
+                                0xd3, 0xf7, 0xc1, 0x05, 0x08, 0x27, 0xe9, 0xd5, 0x13, 0xfc, 0xb9, 0x24, 0x25, 0xef, 0x9c, 0x58, 
+                                0x30, 0xe9, 0xec, 0xfc, 0x0b, 0x2a, 0x9b, 0xac, 0x29, 0x7b, 0x42, 0x76, 0xfa, 0x0e, 0x4a, 0xf2, 
+                                0xfc, 0x43, 0x4f, 0x54, 0xdd, 0xd1, 0x39, 0x59, 0x67, 0x01, 0x25, 0x04, 0xa4, 0xd6, 0x4b, 0x42, 
+                                0xd6, 0xff, 0x50, 0xe7, 0x4c, 0xcf, 0xa0, 0xd9, 0xe7, 0xc4, 0xb4, 0x53, 0xd8, 0x67, 0xe1, 0x77, 
+                                0xa8, 0xf8, 0xe7, 0xe3, 0xa2, 0xed, 0xce, 0x36, 0x83, 0x27, 0x99, 0xfb, 0x36, 0xad, 0xf7, 0x65, 
+                                0xf0, 0x12, 0x48, 0x6b, 0x46, 0xd8, 0xbf, 0x0e, 0x05, 0x91, 0xed, 0xf3, 0x91, 0xfa, 0xe4, 0x7a, 
+                                0xbb, 0x7c, 0x19, 0x4c, 0x11, 0x49, 0x79, 0x48, 0x8c, 0x0c, 0x51, 0xed, 0x38, 0x3a, 0x14, 0xa5, 
+                                0xaf, 0xe5, 0x86, 0x97, 0x79, 0x54, 0x28, 0x2a, 0xc7, 0xa7, 0x82, 0x61, 0xce, 0x86, 0xd3, 0x03, 
+                                0xc3, 0xa3, 0x5f, 0x46, 0x55, 0x61, 0xd5, 0xfb, 0x7c, 0x2d, 0xb0, 0x5f, 0x5b, 0xf4, 0xa3, 0x75
+			}
+		},
+		/* MIPC SLA key3 */
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{	
+				0x0
+			},
+			{		
+                                0xa2, 0x44, 0x69, 0xa8, 0xad, 0xd8, 0x08, 0xdc, 0x5c, 0xa9, 0xb3, 0x5a, 0xbd, 0x9b, 0x56, 0x39, 
+                                0xd1, 0xd1, 0x87, 0xc4, 0xa7, 0x2a, 0x6c, 0x56, 0x7e, 0x40, 0x70, 0xd9, 0x5a, 0x3a, 0xf4, 0x5b, 
+                                0x1a, 0x0d, 0xf1, 0x2a, 0x08, 0xf2, 0xde, 0x4a, 0x8c, 0x0a, 0x40, 0x47, 0x19, 0x62, 0x22, 0x4c, 
+                                0x49, 0x97, 0x4c, 0x59, 0xc7, 0x2b, 0xf4, 0x2a, 0x7b, 0x0c, 0x3a, 0x58, 0x85, 0x79, 0xe3, 0x3f, 
+                                0xc8, 0x6c, 0x3a, 0x02, 0x77, 0xeb, 0x8a, 0x38, 0x74, 0x5f, 0xc3, 0x29, 0x88, 0xbf, 0x0c, 0x3c, 
+                                0x95, 0x22, 0xf5, 0x98, 0x00, 0x2c, 0x4f, 0x97, 0x00, 0xa4, 0xf3, 0xeb, 0xaf, 0x8c, 0x14, 0x95, 
+                                0x42, 0x2e, 0x27, 0x76, 0xd5, 0x3f, 0x99, 0xb2, 0x5a, 0xc1, 0xc4, 0xa7, 0x4d, 0xff, 0x40, 0x1e, 
+                                0x96, 0x55, 0xb5, 0x30, 0xbe, 0xad, 0x17, 0x41, 0x63, 0xe8, 0x82, 0x5c, 0x84, 0xf3, 0x59, 0x0e, 
+                                0x67, 0x80, 0xb7, 0xa2, 0x39, 0xd6, 0xae, 0xc8, 0x6d, 0xc0, 0x7c, 0xc3, 0xe3, 0x01, 0x63, 0x57, 
+                                0xc5, 0xdc, 0x2d, 0xff, 0x53, 0xec, 0x72, 0x27, 0x5d, 0x57, 0x91, 0xb4, 0xf8, 0xf0, 0xe3, 0xbb, 
+                                0x77, 0xfe, 0x7d, 0xd3, 0xc4, 0x13, 0x25, 0x18, 0xc2, 0xa5, 0x8b, 0xd6, 0x1c, 0x58, 0x4b, 0x05, 
+                                0x14, 0x1e, 0x13, 0x95, 0x04, 0xbe, 0x75, 0xe3, 0xd9, 0x2d, 0x63, 0xad, 0x71, 0x78, 0xa3, 0x09, 
+                                0xbc, 0x8b, 0xcf, 0xa9, 0x10, 0x61, 0xb9, 0x72, 0x7e, 0xc5, 0xa1, 0xdb, 0x0b, 0x5c, 0xf2, 0x58, 
+                                0x55, 0xf2, 0xc6, 0x04, 0xd3, 0x7b, 0x9b, 0xd7, 0x7d, 0x1b, 0x8c, 0x65, 0xc0, 0x92, 0xda, 0x37, 
+                                0x39, 0x86, 0x4c, 0x5c, 0x36, 0x01, 0x78, 0x49, 0x75, 0x41, 0x21, 0x44, 0xd1, 0x1b, 0x32, 0xdf, 
+                                0xb7, 0xb6, 0xd7, 0x1c, 0xff, 0xbd, 0x7c, 0xb7, 0x34, 0xb6, 0xd3, 0x85, 0x9d, 0xbb, 0xbc, 0xcb
+			}
+		}
+	}
+};
+
+/*****************************************************************************
+ * FUNCTION
+ *  cust_sec_get_asym_key
+ * DESCRIPTION
+ *  This function is to get MTK internal usage key for customized feature
+ *  flash.
+ * PARAMETERS
+ *  key_index     [IN]        index of the key 
+ *  key			  [OUT]		  key content	
+ * RETURNS
+ *  void
+ * GLOBALS AFFECTED
+ *  void
+ *****************************************************************************/
+kal_uint32 cust_sec_get_asym_key(kal_uint32 key_index, t_cust_chl_asym_key * key)
+{
+	if(key_index >= CUST_SEC_MAX_PUB_KEY_LEN)
+	{
+		return 1;
+	}
+	if(key == NULL)
+	{
+		return 2;
+	}
+	
+	kal_mem_cpy(key, &g_CUST_SEC_KEY.m_key[key_index], sizeof(g_CUST_SEC_KEY.m_key[key_index]));
+	
+	return 0;
+}
+
+/* External usage key */
+const CUST_SEC_KEY_ST g_CUST_EXT_SEC_KEY =
+{
+	
+	CUST_SEC_KEY_STRUCT_MAGIC,
+	
+	CUST_SEC_KEY_STRUCT_VER, 
+	
+	{
+		// EXTERNAL PUBLIC KEY1
+		{
+			4,
+			256,
+			256,
+			{
+				0x00, 0x01, 0x00, 0x01
+			},
+			{
+				0x00
+			},
+			{
+				0x9e, 0x43, 0xf8, 0xa2, 0x1b, 0x17, 0x82, 0xbb, 0x14, 0x54, 0x7c, 0x21, 0x28, 0x2b, 0x1f, 0x0e,
+				0x3a, 0x4a, 0xdf, 0x19, 0x14, 0xd1, 0x7b, 0xcf, 0x29, 0x96, 0xc0, 0x3a, 0xfb, 0x4d, 0x9c, 0x78,
+				0xcc, 0x3a, 0x1a, 0xfa, 0xbc, 0xea, 0xb5, 0x5e, 0xac, 0xfd, 0x1e, 0xd8, 0x12, 0x72, 0x17, 0x42,
+				0x15, 0x71, 0xa3, 0x4a, 0xb3, 0x1f, 0xbf, 0xb4, 0x51, 0xcc, 0xa3, 0x91, 0x41, 0x41, 0x78, 0x44,
+				0x82, 0xc0, 0x93, 0x0c, 0x10, 0xe0, 0x56, 0xde, 0xd5, 0x93, 0x85, 0x9e, 0x3e, 0x3d, 0x80, 0x66,
+				0x7e, 0xf9, 0x5f, 0x50, 0x2d, 0x1e, 0x5b, 0xf8, 0xc4, 0x8c, 0x5f, 0x06, 0x02, 0xed, 0x18, 0x54,
+				0xbc, 0x10, 0x8e, 0x32, 0x18, 0x32, 0x40, 0x87, 0xb8, 0x7c, 0x31, 0xa1, 0xb7, 0x94, 0x1c, 0xea,
+				0x86, 0xf6, 0xa5, 0x3c, 0xf4, 0xc8, 0x09, 0x37, 0x48, 0xbf, 0x23, 0xb1, 0x34, 0xaf, 0x50, 0x0a,
+				0x55, 0xe4, 0xcf, 0x5b, 0x2c, 0x9e, 0x58, 0xd7, 0xe3, 0x44, 0xd8, 0x7b, 0x99, 0x3a, 0xe5, 0x2d,
+				0xd8, 0xff, 0xdd, 0x56, 0xb7, 0x90, 0x63, 0xd4, 0xc4, 0xcd, 0x9b, 0xe2, 0x9a, 0x69, 0x56, 0x01,
+				0x72, 0x14, 0x97, 0x3a, 0x57, 0x11, 0xbd, 0x7f, 0xd5, 0x85, 0x65, 0x86, 0x5c, 0x4b, 0x92, 0x56,
+				0x06, 0x05, 0x09, 0xf5, 0xc5, 0x1c, 0x0c, 0x96, 0x98, 0x2a, 0xe2, 0x74, 0x21, 0x79, 0xb5, 0xa2,
+				0xdc, 0xaa, 0x1e, 0x7b, 0x9e, 0x98, 0xee, 0xd2, 0x1d, 0xd0, 0x70, 0x1e, 0x20, 0xf6, 0x80, 0xa3,
+				0x4c, 0x0a, 0x1b, 0x37, 0x1d, 0xd5, 0x72, 0xbd, 0xaf, 0x93, 0x31, 0x4e, 0xb7, 0xf8, 0x70, 0x58,
+				0x90, 0x8f, 0xf6, 0x48, 0x85, 0xb8, 0xc4, 0xa5, 0x7f, 0xa4, 0xd9, 0x00, 0x11, 0x81, 0xfe, 0xdd,
+				0xde, 0x94, 0xe0, 0x44, 0x32, 0x8a, 0x02, 0xa2, 0xac, 0x6a, 0xcc, 0xd1, 0xc0, 0x69, 0xca, 0x0f
+			}
+		},
+	}		
+};	
+
+/* root cert */
+const CUST_SEC_CERT_ST g_ROOT_CERT = {
+	
+	CUST_SEC_ROOT_CERT_STRUCT_MAGIC,
+	
+	CUST_SEC_ROOT_CERT_STRUCT_VER,
+
+	{	
+		/* KDDI test data */
+		"-----BEGIN CERTIFICATE-----\n\
+MIIECjCCAvKgAwIBAgIBBDANBgkqhkiG9w0BAQsFADBUMQswCQYDVQQGEwJLUjET\n\
+MBEGA1UEBwwKU3V3b24gY2l0eTEXMBUGA1UECwwOU2Ftc3VuZyBNb2JpbGUxFzAV\n\
+BgNVBAMMDlNhbXN1bmdSb290S2V5MB4XDTE1MDEyNjA2NDYzN1oXDTM1MDEyMTA2\n\
+NDYzN1owWzELMAkGA1UEBhMCS1IxEzARBgNVBAcMClN1d29uIGNpdHkxFzAVBgNV\n\
+BAsMDlNhbXN1bmcgTW9iaWxlMR4wHAYDVQQDDBVTYW1zdW5nU2VydmljZVJvb3RL\n\
+ZXkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCu54QsPi725Hj60xh+\n\
+CDmEBIBEClSS5xgjvMpX2djzsduRL88ceWjr9HwEaQF76KnhB+QieP9kcRMIqaJ0\n\
+umP3BuUW1A5UrMMfdhGAuGzO+hK4OUGWXoSbXynoiNyt7KbW3UjrK8+X6InPXmRo\n\
+nmQQj4mZLIrI2Y2uzIZwMR0O6eb7aUgNAD5ATLIbCjoaRbuDoiGkj1qQWcf/GaK/\n\
+U5dGBcunA3V4CWsoXOvtY8PUfDOosD0XjDjQbXd18pBehulJpVrLgVF3cDJ8B/gt\n\
+jMrJc/2US6SuxpnhFoCzcQHQNKMQJ68S0FDTHNNv3oZHz7zEwrvjaQJ/06XUSGBv\n\
+2EiVAgMBAAGjgd8wgdwwHQYDVR0OBBYEFKqce8ML8g5gkFufZXF3+UE7UZ83MB8G\n\
+A1UdIwQYMBaAFBo4SVkuMiGCDHcmDcoRrd2cykN9MA8GA1UdEwQIMAYBAf8CAQAw\n\
+CwYDVR0PBAQDAgEGMD0GCCsGAQUFBwEBBDEwLzAtBggrBgEFBQcwAYYhaHR0cDov\n\
+L29jc3Auc2Ftc3VuZy5jb20vc2VjdXJpdHkvMD0GA1UdHwQ2MDQwMqAwoC6GLGh0\n\
+dHA6Ly9jcmwuc2Ftc3VuZy5jb20vc2VjdXJpdHkvcmRldmljZXMuY3JsMA0GCSqG\n\
+SIb3DQEBCwUAA4IBAQBKKZYm02IeHFkh2X0IeZUqfTUOqgZaq5QMx2KyctwIPBS4\n\
+BSE2FraDdE1fyfcaolob5/LyD5cJ1dPRWk/LxTnSx9h+6qUenIbCXAmPzPQ+iWbL\n\
+yqMN0WrJwR4yTBLc7pnHI2DuhPy/twe1ePDZvZcSYucEYSQep0v6RMoI7gn2hnNZ\n\
+tyQFVY8qI0eALQQpVhhYO/3POo3z4Xap1s3LUvs6pG3Q6aRv3xjrOwjKcsNbBIi2\n\
+/aQKo/Hyj7jXFkoNDKulPNrTBKXrrwgUrjTCjn5uUu1BeQ+op4Zpz/1jggmPTtTX\n\
+bqlWKkbZ23jlIx/yDDLoGYAhuEtecrsEr1NfS883\n\
+-----END CERTIFICATE-----"
+
+	},
+	
+};
+
+/*****************************************************************************
+ * FUNCTION
+ *  cust_ext_get_asym_key
+ * DESCRIPTION
+ *  This function is to get customer use key (MTK external)
+ *  flash.
+ * PARAMETERS
+ *  key_index     [IN]        index of the key 
+ *  key			  [OUT]		  key content	
+ * RETURNS
+ *  void
+ * GLOBALS AFFECTED
+ *  void
+ *****************************************************************************/
+kal_uint32 cust_ext_get_asym_key(kal_uint32 key_index, t_cust_chl_asym_key * key)
+{
+	if(key_index >= CUST_SEC_MAX_PUB_KEY_LEN)
+	{
+		return 1;
+	}
+	if(key == NULL)
+	{
+		return 2;
+	}
+	
+	kal_mem_cpy(key, &g_CUST_EXT_SEC_KEY.m_key[key_index], sizeof(g_CUST_EXT_SEC_KEY.m_key[key_index]));
+	
+	return 0;
+}
diff --git a/mcu/custom/middleware/common/custom_sec_key.h b/mcu/custom/middleware/common/custom_sec_key.h
new file mode 100644
index 0000000..090da95
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_sec_key.h
@@ -0,0 +1,64 @@
+
+#ifndef CUSTOM_SEC_KEY_H
+#define CUSTOM_SEC_KEY_H
+
+
+#include "kal_general_types.h"
+#include "cust_chl_interface.h"
+
+#define CUST_SEC_KEY_STRUCT_VER             1
+#define CUST_SEC_KEY_STRUCT_MAGIC           "CUS_KEY"
+#define CUST_SEC_MAX_PUB_KEY_LEN            15
+
+typedef struct
+{
+	/* a unique magic pattern to identify SEC_KEY_ST structure */
+	kal_char  m_magic[8];
+	
+	/* version of SEC_KEY_ST structure */
+	kal_uint32 m_sec_key_st_ver;
+	
+	t_cust_chl_asym_key m_key[CUST_SEC_MAX_PUB_KEY_LEN];  
+
+} CUST_SEC_KEY_ST;
+
+/* MTK internal-use key array index */
+typedef enum
+{
+	TM_PUBK_KEY0 = 0,
+	XM_PUBK_KEY1 = 1,
+	SP_PUBK_KEY2 = 2,
+	META_SLA_PUBK_KEY3 = 3,
+	AT_SLA_PUBK_KEY = 4,
+	VZ_PUBK_KEY	 = 5,
+	KDDI_PUBK_KEY = 6,
+        ATT_PUBK_KEY = 7,
+       	CRK_PUBK_KEY = 8,
+        TM_PUBK_KEY1 = 9,
+	MCF_PUBK_KEY1 = 10,
+	MCF_PUBK_KEY2 = 11,
+	MIPC_SLA_PUBK_KEY1 = 12,
+	MIPC_SLA_PUBK_KEY2 = 13,
+	MIPC_SLA_PUBK_KEY3 = 14
+}CUST_SEC_ASYM_KEY_E;
+
+#define CUST_SEC_ROOT_CERT_STRUCT_VER       1
+#define CUST_SEC_ROOT_CERT_STRUCT_MAGIC     "CUS_RCT"
+#define CUST_SEC_MAX_ROOT_CERT_LEN          1
+
+typedef struct
+{
+	/* a unique magic pattern to identify SEC_CERT_ST structure */
+	kal_char  m_magic[8];
+	
+	/* version of SEC_CERT_ST structure */
+	kal_uint32 m_sec_cert_st_ver;	
+
+	/* root cert, maximum size: 2048 byte */
+	unsigned char root_cert[CUST_SEC_MAX_ROOT_CERT_LEN][2048];
+	
+}CUST_SEC_CERT_ST;
+
+extern kal_uint32 cust_sec_get_asym_key(kal_uint32 key_index, t_cust_chl_asym_key * key);
+extern kal_uint32 cust_ext_get_asym_key(kal_uint32 key_index, t_cust_chl_asym_key * key);
+#endif /* CUSTOM_SEC_KEY_H */
diff --git a/mcu/custom/middleware/common/custom_sec_support.c b/mcu/custom/middleware/common/custom_sec_support.c
new file mode 100644
index 0000000..3b466e3
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_sec_support.c
@@ -0,0 +1,186 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ *   custom_sec_support.c
+ *
+ * Project:
+ * --------
+ *   UMOLYE
+ *
+ * Description:
+ * ------------
+ *   The customization file for security support
+ *
+ * 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+ 
+#include "kal_public_api.h"
+#include "kal_public_defs.h"
+#include "l4_nvram_def.h"
+
+#if defined(__AES256_SUPPORT__)
+    kal_uint32 g_AES256_support = 1;
+#else
+    kal_uint32 g_AES256_support = 0;
+#endif
+
+extern kal_bool SST_Is_Secure_BB(void);
+extern kal_bool SST_Is_AP_SBC_EN(void);
+
+kal_bool AtSLA_Is_Enabled(void)
+{
+#if defined(__ENGFACT_MODE__) && !defined(__MTK_INTERNAL_ENG_USER__) 
+
+#ifdef __AT_SLA_BIND_TO_AP_SBC__
+    return SST_Is_AP_SBC_EN();
+#else
+    return KAL_TRUE;
+#endif /* __AT_SLA_BIND_TO_AP_SBC__ */
+
+#else
+    return KAL_FALSE;
+#endif /* __ENGFACT_MODE__ && !__MTK_INTERNAL_ENG_USER__ */
+}
+
+kal_bool MetaSLA_Is_Enabled(void)
+{
+#ifdef __MTK_TARGET__
+
+#ifdef __META_SLA_ENHANCEMENT__
+
+#if defined(__META_SLA_BIND_TO_SBC__)
+    return SST_Is_Secure_BB();
+#elif defined(__META_SLA_BIND_TO_AP_SBC__)
+    return SST_Is_AP_SBC_EN();
+#else
+    return KAL_TRUE;
+#endif
+
+#else
+    return KAL_FALSE;
+#endif /* __META_SLA_ENHANCEMENT__ */
+
+#else /* !__MTK_TARGET__*/
+    return KAL_FALSE;
+#endif	
+}
+
+kal_bool Custom_META_IsSecureLid(kal_uint16 lid)
+{
+    kal_bool isSecureLid = KAL_FALSE;
+    switch(lid)
+    {
+#if !defined(MT6885) && !defined(MT6873) && !defined(MT6853)
+#if !defined(__MTK_INTERNAL_ENG_USER__)
+	case NVRAM_EF_IMEI_IMEISV_LID:
+#endif
+#endif
+        case NVRAM_EF_SML_LID:
+        case NVRAM_EF_SIM_LOCK_LID:
+        case NVRAM_EF_SML_GBLOB_LID:
+        case NVRAM_EF_SML_GBLOB_KEY_LID:
+        case NVRAM_EF_SML_S_LID:
+        case NVRAM_EF_SUBSIDY_LOCK_LID:
+        case NVRAM_EF_SUBSIDY_LOCK_ODM_DATA_LID:
+        case NVRAM_EF_SML_NONCE_LID:
+        case NVRAM_EF_SML_UNLOCK_CODE_LID:
+	case NVRAM_EF_SML_SIGNATURE_LID:
+	case NVRAM_EF_SML_MAX_RETRY_COUNT_LID:
+#ifdef __CARRIER_RESTRICTION__
+	case NVRAM_EF_L4_CARRIER_RESTRICTION_LID:
+#endif
+#ifdef __ATT_RSU_NVRAM__
+	case NVRAM_EF_L4_ATT_SIM_LOCK_LID:
+#endif
+#ifdef __VZW_RSU_NVRAM__
+	case NVRAM_EF_L4_SML_VZW_SIM_LOCK_LID:
+	case NVRAM_EF_L4_SML_VZW_SIM_LOCK_DEVICE_KEY_LID:
+	case NVRAM_EF_L4_SML_VZW_RSU_DELAY_TIMER_LID:
+#endif
+#ifdef __OP129_RSU_NVRAM__
+	case NVRAM_EF_L4_SML_OP129_LID:
+#endif
+            isSecureLid = KAL_TRUE;
+            break;
+
+        default:
+            isSecureLid = KAL_FALSE;
+    }
+
+    return isSecureLid;
+}
+
diff --git a/mcu/custom/middleware/common/custom_secure.c b/mcu/custom/middleware/common/custom_secure.c
new file mode 100644
index 0000000..e588a47
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_secure.c
@@ -0,0 +1,94 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * custom_secure.c
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   This file is intends for general security customization.
+ *
+ * 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!!
+ *==============================================================================
+ *******************************************************************************/
+#include "kal_general_types.h" 
+#include "custom_secure.h"
+
+
+/*****************************************************************************
+ * FUNCTION
+ *	custom_is_device_rooted
+ *
+ * DESCRIPTION
+ *	The function check if the device is rooted. 
+ *  (It is called by our logging/RAM dump logic. If it returns KAL_FALSE, the logging/RAM dump still work. Otherwise, they are disabled)
+ *
+ * PARAMETERS
+ *	[INPUT] N/A 
+ *	[OUTPUT] N/A
+ *
+ * RETURNS
+ *	KAL_TRUE  : Device is rooted
+ *	KAL_FALSE : Device is not rooted
+ *
+ * NOTES
+ *    N/A
+ *
+ *****************************************************************************/
+kal_bool custom_is_device_rooted(void)
+{    
+    /* --------------------------------------------------------------
+     * Please implement your logic to read KNOX warranty bit here
+     * -------------------------------------------------------------- */
+    return KAL_FALSE;
+}
diff --git a/mcu/custom/middleware/common/custom_secure.h b/mcu/custom/middleware/common/custom_secure.h
new file mode 100644
index 0000000..6e03a59
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_secure.h
@@ -0,0 +1,100 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * custom_secure.h
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   This file is intends for general security customization.
+ *
+ * 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 CUSTOM_SECURE_H
+#define CUSTOM_SECURE_H
+
+/* --------------------------------------------------------------
+ * Please define your fuse register base and KNOX bit mask here
+ * -------------------------------------------------------------- */
+ 
+/* --------------------------------------------------------------
+ * Please define your fuse register base and KNOX bit mask here
+ * -------------------------------------------------------------- */
+ 
+ 
+/*****************************************************************************
+ * FUNCTION
+ *	custom_is_device_rooted
+ *
+ * DESCRIPTION
+ *	The function check if the device is rooted. 
+ *  (It is called by our logging/RAM dump logic. If it returns KAL_FALSE, the logging/RAM dump still work. Otherwise, they are disabled)
+ *
+ * PARAMETERS
+ *	[INPUT] N/A 
+ *	[OUTPUT] N/A
+ *
+ * RETURNS
+ *	KAL_TRUE  : Device is rooted
+ *	KAL_FALSE : Device is not rooted
+ *
+ * NOTES
+ *    N/A
+ *
+ *****************************************************************************/
+extern kal_bool custom_is_device_rooted(void);
+
+
+
+#endif /* CUSTOM_SECURE_H */
diff --git a/mcu/custom/middleware/common/custom_sml_sec_verify.c b/mcu/custom/middleware/common/custom_sml_sec_verify.c
new file mode 100644
index 0000000..3401782
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_sml_sec_verify.c
@@ -0,0 +1,405 @@
+/*****************************************************************************
+*  Copyright Statement:
+*  --------------------
+*  This software is protected by Copyright and the information contained
+*  herein is confidential. The software may not be copied and the information
+*  contained herein may not be used or disclosed except with the written
+*  permission of MediaTek Inc. (C) 2012
+*
+*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+*  LAWS PRINIPLES.  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:
+ * ---------
+ *   custom_sml_sec_verify.c
+ *
+ * Project:
+ * --------
+ *   UMOLYA
+ *
+ * Description:
+ * ------------
+ *   This file is used to define the SML security verification.
+ *
+ * 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+
+#include "custom_sml_sec_verify.h"
+#include "che_ossl_api.h"
+#include "dhl_trace.h"
+#define __GBLOB_DEBUG__
+
+kal_uint32 cust_sec_hck_verify (TYPE_HCK_ALGO algo, kal_char *ck, kal_uint32 ck_len, kal_uint8 *salt, kal_uint32 iter, kal_uint8 *hck){
+	
+	int ret = ERR_SEC_CHECK_HCK_UNSUPPORT_ALGO;	
+	kal_uint8 hck_calc[64] = {0};
+	kal_uint32 i = 0;
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "ck_len: %x, algo: %x, ck: %x, hck: %x", ck_len, algo, ck, hck);
+	for(i=0;i<ck_len;i++)
+		dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "hck: %x", hck[i]);
+		
+	if( (ck == NULL) || (hck == NULL) )
+		return ERR_SEC_CHECK_HCK_INVALID_INOUT;
+			
+	switch(algo){
+		case TYPE_HCK_ALGO_NONE:
+			if(memcmp(ck, hck, ck_len) != 0){
+				return ERR_SEC_CHECK_HCK_NONE_CMP_FAIL;
+			}else{
+				return ERR_SEC_CHECK_HCK_SUCCESS;
+			}
+			break;
+		case TYPE_HCK_PBKDF2_HMAC_SHA256_SALT128:	//Fixed HCK: 32B, Salt: 16B
+			if( (salt == NULL) || (ck_len == 0) )
+				return ERR_SEC_CHECK_HCK_INVALID_INOUT;
+				
+			ret = PKCS5_PBKDF2_HMAC_SHA256(ck, ck_len, salt, 16, iter, 32, hck_calc);
+			
+			/* PKCS5_PBKDF2_HMAC_SHA256 if error occurs, internal hardcode return 1*/
+			if( ret != 1 )
+				return ERR_SEC_CHECK_PBKDF2_SHA256_SALT128;
+			else if(memcmp(hck_calc, hck, 32) != 0)	
+				return ERR_SEC_CHECK_PBKDF2_SHA256_SALT128_CMP_FAIL;
+			else
+				return ERR_SEC_CHECK_HCK_SUCCESS;	
+			break;	
+		default:
+				return ERR_SEC_CHECK_HCK_UNSUPPORT_ALGO;
+			break;	
+	}
+	return ret;	
+}
+
+kal_uint32 cust_sec_gblob_verify(sml_gblob_s_context_struct *data, void *key){
+
+	TYPE_SIG_ALGO 	sig_algo;
+	kal_uint32	  	ret = ERR_SEC_CHECK_SIG_UNSUPPORT_ALGO;
+	kal_uint32		data_len = sizeof(sml_gblob_s_context_struct) - sizeof(data->signature);
+	kal_uint32	  	data_start = (kal_uint32) data;
+	kal_uint8*		sig = data->signature;
+	kal_uint32		sig_len = sizeof(data->signature);
+	t_cust_chl_asym_key		asym_key;	/* We default use RSA as our asymmetric key */
+	gblob_rsa_pub_key_s*	rsa_pub_key_ptr;
+
+	if( (data == NULL) || (key == NULL) ){
+#if defined(__GBLOB_DEBUG__)		
+		dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "data: %x, key:%x", data, key);
+#endif		
+		return ERR_SEC_CHECK_SIG_INVALID_INOUT;
+	}
+
+#if defined(__GBLOB_DEBUG__)
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "sml_lock_rule: %x", data->sml_lock_type);
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "sml_lock_sub_rule: %x %x", data->sml_lock_sub_type[0], data->sml_lock_sub_type[1]);
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "dev_protection_algo: %x", data->dev_protection_algo);
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "device_interation_cnt: %x %x %x %x", data->device_interation_cnt[0], data->device_interation_cnt[1], data->device_interation_cnt[2], data->device_interation_cnt[3]);
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "device_salt: %x %x %x %x", data->device_salt[0], data->device_salt[1], data->device_salt[2], data->device_salt[3]);
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "device_hck: %x %x %x %x", data->device_hck[0], data->device_hck[1], data->device_hck[2], data->device_hck[3]);
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "sig_protection_algo: %x", data->sig_protection_algo);
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "sig_len: %x", sig_len);
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "signature: %x %x %x %x", data->signature[0], data->signature[1],data->signature[2],data->signature[3]);
+#endif
+		
+	
+	memcpy(&sig_algo, &(data->sig_protection_algo), sizeof(data->sig_protection_algo));
+	
+	switch(sig_algo){
+		case TYPE_SIG_NONE:
+			return ERR_SEC_CHECK_SIG_SUCCESS;
+			break;
+		case TYPE_SIG_RSA_PSS_SHA256:
+			rsa_pub_key_ptr = (gblob_rsa_pub_key_s*)key;
+			memcpy(asym_key.m_E_key, rsa_pub_key_ptr->m_E_key, sizeof(rsa_pub_key_ptr->m_E_key));
+			memcpy(asym_key.m_N_key, rsa_pub_key_ptr->m_N_key, sizeof(rsa_pub_key_ptr->m_N_key));
+			asym_key.m_E_len = rsa_pub_key_ptr->m_E_len;
+			asym_key.m_N_len = rsa_pub_key_ptr->m_N_len;
+			ret = CustCHL_Verify_RSA_Signature(CUST_CHL_ALG_RSA_PSS_SHA256,
+                                        (kal_uint8*) data_start, 
+                                        data_len,
+                                        sig,
+                                        sig_len,
+                                        &asym_key);
+            if( ret != ERR_SEC_CHECK_SIG_SUCCESS )
+				return ret;
+			else
+				return ERR_SEC_CHECK_SIG_SUCCESS;	
+			break;
+		default:
+				return ERR_SEC_CHECK_SIG_UNSUPPORT_ALGO;
+			break;		
+	}
+	return ret;
+}
+/*************************************************************************
+* FUNCTION
+*  cust_sec_calc_enc_auth
+*
+* DESCRIPTION
+*  This function encrypts then calculate specific data authentication pattern
+*  and return random iv according to the algorithm
+*
+* PARAMETERS
+*  prot_scheme_byte -     algorithm
+*  [input] in_data -    pointer to the buffer to store plaintext data
+*  [input] in_data_len -	plaintext length
+*  [output] iv -	the generated iv
+*  [output] iv_len -	length of the generated iv
+*  [output] cipher_out -	ciphertext 
+*  [output] cipher_len -	length of the ciphertext
+*  [output] tag -	MAC value of the (iv + cipher)
+*  [output] tag_len -	length of MAC value
+*  [input] param -		additional parameters needed for the algo
+* RETURNS
+*  KAL_TRUE/KAL_FALSE
+*
+*************************************************************************/
+kal_uint32 cust_sec_calc_enc_auth(BLOB_PROT_SCHEME prot_scheme_byte, 
+								  kal_uint8* in_data, kal_uint8 in_data_len, 
+								  kal_uint8* iv, kal_uint32* iv_len, 
+								  kal_uint8* cipher_out, kal_uint32* cipher_len, 
+								  kal_uint8* tag, kal_uint32* tag_len, void* param)
+{
+	t_cust_chl_sym_key	*hmac_key;
+	ALGO_AE_AES_HMAC_SHA256	*ptr_aes_hmac;
+	kal_uint32	result = ERR_SEC_ETM_UNSUPPORT_ALGO;
+	t_cust_chl_mac_u	hmac;
+	AES_PARAM	aes_param;
+	kal_uint8	tt_iv[16];
+	kal_uint32	tim = 0;
+	int rand_ret = 0;
+	kal_uint8	auth_blob[216];	//(16 + assumed blob length maximum = 200)
+	kal_uint8	auth_blob_len = 0;
+
+	/* error checking */
+	if((in_data == NULL) || (iv == NULL) || (iv_len == NULL) || (cipher_out == NULL) || (cipher_len == NULL) || (tag == NULL) || (tag_len == NULL) || (param == NULL)){
+		return ERR_SEC_INVALID_INOUT;
+	}
+	//Create random number and setup iv
+	memset(tt_iv, 0, sizeof(tt_iv));
+	tim = drv_get_current_time();
+	RAND_add(&tim,sizeof(tim),(double)tim);
+	
+	switch(prot_scheme_byte){
+		/* AES-GCM mode not supported */
+		case 0:
+			return result;
+		/* AES-CTR + HMAC 256 supported */
+		case 1:
+			ptr_aes_hmac = (ALGO_AE_AES_HMAC_SHA256*) param;
+			hmac_key = (t_cust_chl_sym_key *)(&(ptr_aes_hmac->hmac_key));
+
+			/* generate random iv */
+			rand_ret = RAND_bytes(tt_iv, 12);	
+			if(rand_ret != 1){
+				dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "random number - iv fail!");
+				ASSERT(0);	
+			}
+			bin_dump("tt_iv: ", tt_iv, sizeof(tt_iv));
+			aes_param.IV = tt_iv;
+			aes_param.IVLength = (*iv_len) = 16;	//OUTPUT iv_len
+			aes_param.counter_len = 4;	
+			CustCHL_AES_Encrypt_data(CUST_CHL_ALG_AES256, CUST_CHL_MODE_CTR, in_data_len, in_data, 
+									cipher_len, cipher_out, 
+									(t_cust_chl_sym_key *)(&(ptr_aes_hmac->enc_key)), &aes_param);	//OUTPUT cipher_out and cipher_len
+			auth_blob_len = (*cipher_len) + 16;
+			ASSERT(auth_blob_len <= 216);
+			memcpy(auth_blob, tt_iv, 16); 
+			memcpy((auth_blob+16), cipher_out, auth_blob_len); 
+			
+			result = CustCHL_Calculate_MAC(CUST_CHL_ALG_MAC_SHA256, auth_blob, auth_blob_len, hmac_key->m_key, hmac_key->m_key_len, &hmac);
+			//OUTPUT tag_len
+			*tag_len = hmac.m_len;
+			//OUTPUT tag
+			memcpy(tag, hmac.m_u8, (*tag_len));
+			//OUTPUT iv
+			memcpy(iv, tt_iv, (*iv_len));
+			
+			break;
+		default:
+			break;
+	}
+	return result;
+	
+}
+/*************************************************************************
+* FUNCTION
+*  cust_sec_eta_tt_blob
+*
+* DESCRIPTION
+*  This function encrypt then calculate specific data authentication pattern
+*  and return random iv according to Trustonic specification
+*
+* PARAMETERS
+*  [input] prot_scheme_byte -	encrypt then authenticate algorithm
+*  [input] in_data -    pointer to the buffer to store plaintext data
+*  [input] in_data_len -	plaintext length
+*  [output] iv -	the generated iv
+*  [output] iv_len -	length of the generated iv
+*  [output] cipher_out -	ciphertext 
+*  [output] cipher_len -	length of the ciphertext
+*  [output] tag -	MAC value of the (iv + cipher)
+*  [output] tag_len -	length of MAC value
+* RETURNS
+*  KAL_TRUE/KAL_FALSE
+*
+*************************************************************************/
+kal_uint32 cust_sec_eta_tt_blob(BLOB_PROT_SCHEME prot_scheme_byte, kal_uint32 key_id, 
+								kal_uint8* in_data, kal_uint32 in_data_len,
+								kal_uint8* cipher_out, kal_uint32* cipher_len,
+								kal_uint8* tag, kal_uint32* tag_len,
+								kal_uint8* iv, kal_uint32* iv_len)
+{
+
+	t_cust_chl_sym_key mod_key;
+	t_cust_chl_sym_key *p_mod_key;
+
+	kal_uint8 hash_key_data[64]; //Hash(32B AES key + 4 byte padding)
+
+	t_cust_chl_hash_u enc_key_hash;
+	t_cust_chl_hash_u int_key_hash;
+
+	ALGO_AE_AES_HMAC_SHA256 key_param;
+	
+	kal_uint8* p_enc_key_hash = &(key_param.enc_key.m_key[0]);
+	kal_uint8* p_int_key_hash = &(key_param.hmac_key.m_key[0]);
+
+	kal_uint32 ret = 0;
+	
+	/* error checking */
+	if((in_data == NULL) || (iv == NULL) || (iv_len == NULL) || (cipher_out == NULL) || (cipher_len == NULL) || (tag == NULL) || (tag_len == NULL) ){
+		return ERR_SEC_INVALID_INOUT;
+	}
+	//Generate encryption and HMAC key
+	memset(hash_key_data, 0, sizeof(hash_key_data));
+
+	p_mod_key = &mod_key;
+	ret = CustCHL_Get_Sym_Key(key_id, p_mod_key);
+	if(ret != CUST_CHL_ERROR_NONE){
+		dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "[CHL] CustCHL_Get_Sym_Key fail!!");
+	}	
+	//Specify the per-device unique random key
+	memcpy(hash_key_data, p_mod_key->m_key, 32);
+
+	//encryption key append: 0x41, 0x4C, 0x50, 0x53
+	hash_key_data[32] = 0x41;
+	hash_key_data[33] = 0x4C;
+	hash_key_data[34] = 0x50;
+	hash_key_data[35] = 0x53;
+
+	bin_dump("hash_key_data: ", hash_key_data, 36);		
+
+	//Calculate hash of encryption key
+	CustCHL_Calculate_Hash(CUST_CHL_ALG_SHA256, hash_key_data, 36, &enc_key_hash);
+
+	memcpy(p_enc_key_hash, &(enc_key_hash.m_u8[0]), 32);
+	key_param.enc_key.m_key_len = 32;
+
+	bin_dump("enc_key_hash: ", p_enc_key_hash, 32);		
+
+	memset(hash_key_data, 0, sizeof(hash_key_data));
+
+	//Specify the per-device unique random key
+	memcpy(hash_key_data, p_mod_key->m_key, 32);
+
+	//mac key append: 0x48, 0x4D, 0x41, 0x43
+	hash_key_data[32] = 0x48;
+	hash_key_data[33] = 0x4D;
+	hash_key_data[34] = 0x41;
+	hash_key_data[35] = 0x43;
+
+	bin_dump("hash_key_data: ", hash_key_data, 36);		
+
+	//Calculate hash of HMAC key
+	CustCHL_Calculate_Hash(CUST_CHL_ALG_SHA256, hash_key_data, 36, &int_key_hash);
+
+	memcpy(p_int_key_hash, &(int_key_hash.m_u8[0]), 32);
+	key_param.hmac_key.m_key_len = 32;
+
+	bin_dump("int_key_hash: ", p_int_key_hash, 32);		
+
+	ret = cust_sec_calc_enc_auth(prot_scheme_byte, in_data, in_data_len, 
+						   iv, iv_len, 
+						   cipher_out, cipher_len, 
+						   tag, tag_len, (void*) (&key_param));
+	
+	bin_dump("tag: ", tag, (*tag_len));
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "[CHL] tag_len: %d", *tag_len);
+
+	bin_dump("enc_data: ", cipher_out, *cipher_len);
+	dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_NVRAM, "[CHL] enc_len: %d", *cipher_len);
+	
+	return ret;
+}
diff --git a/mcu/custom/middleware/common/custom_sml_sec_verify.h b/mcu/custom/middleware/common/custom_sml_sec_verify.h
new file mode 100644
index 0000000..8b02ffc
--- /dev/null
+++ b/mcu/custom/middleware/common/custom_sml_sec_verify.h
@@ -0,0 +1,72 @@
+#ifndef __CUSTOM_SML_SEC_VERIFY_H__
+#define __CUSTOM_SML_SEC_VERIFY_H__
+
+#include "cust_chl_interface.h"
+#include "custom_nvram_sec.h"
+
+typedef enum{
+	TYPE_HCK_ALGO_NONE 					= 0,
+	TYPE_HCK_PBKDF2_HMAC_SHA256_SALT128	= 1,
+	TYPE_HCK_INTR_USE_END 				= 99,
+	TYPE_HCK_EXT_USE_START 				= 100,
+	/* Note for customer: please add customized enum value for HCK calculation algorithm here */ 
+	TYPE_HCK_EXT_USE_END 				= 255
+}TYPE_HCK_ALGO;
+
+typedef enum{
+	TYPE_SIG_NONE							= 0,
+	TYPE_SIG_RSA_PSS_SHA256					= 1,
+	TYPE_SIG_INTR_USE_END					= 99,
+	TYPE_SIG_EXT_USE_START					= 100,
+	/* Note for customer: please add customized enum value for signature verification algorithm here */
+	TYPE_SIG_RSA_END 						= 255
+}TYPE_SIG_ALGO;
+
+typedef enum{
+	ERR_SEC_CHECK_HCK_SUCCESS				= 0,
+	ERR_SEC_CHECK_SIG_SUCCESS				= 0,
+	ERR_SEC_CHECK_HCK_NONE_CMP_FAIL			= 1,
+	ERR_SEC_CHECK_HCK_INVALID_INOUT			= 2,
+	ERR_SEC_CHECK_HCK_UNSUPPORT_ALGO		= 3,
+	ERR_SEC_CHECK_SIG_INVALID_INOUT			= 4,
+	ERR_SEC_CHECK_PBKDF2_SHA256_SALT128		= 5,
+	ERR_SEC_CHECK_PBKDF2_SHA256_SALT128_CMP_FAIL = 6,
+	ERR_SEC_CHECK_SIG_VERIRY_FAIL			= 7,
+	ERR_SEC_CHECK_SIG_UNSUPPORT_ALGO		= 8,
+	ERR_SEC_ETM_UNSUPPORT_ALGO				= 9,
+	ERR_SEC_INVALID_INOUT					= 998,
+	ERR_SEC_INTR_USE_END					= 999,
+	ERR_SEC_EXT_USE_START					= 1000,
+	/* Note for customer: please add customized enum value for error code here */
+	ERR_SEC_CHECK_END						= 0xFFFFFFFF
+}TYPE_HCK_SIG_ERR;
+
+typedef struct{
+	kal_uint32		m_E_len;
+	kal_uint32		m_N_len;
+	kal_uint8		m_E_key[MAX_CUST_CHL_ASYM_KEY_LEN];
+	kal_uint8		m_N_key[MAX_CUST_CHL_ASYM_KEY_LEN];
+}gblob_rsa_pub_key_s;
+
+typedef enum{
+	ALGO_AE_AESGCM128 = 0,
+	ALGO_AE_AESCTR256_HMACSHA256 = 1,
+}BLOB_PROT_SCHEME;
+
+typedef struct{
+	t_cust_chl_sym_key	enc_key;
+	t_cust_chl_sym_key	hmac_key;
+}ALGO_AE_AES_HMAC_SHA256;
+
+kal_uint32 cust_sec_hck_verify (TYPE_HCK_ALGO algo, kal_char *ck, kal_uint32 ck_len, kal_uint8 *salt, kal_uint32 iter, kal_uint8 *hck);
+
+kal_uint32 cust_sec_gblob_verify(sml_gblob_s_context_struct *data, void *key);
+
+kal_uint32 cust_sec_eta_tt_blob(BLOB_PROT_SCHEME prot_scheme_byte, kal_uint32 key_id, kal_uint8* in_data, kal_uint32 in_data_len, kal_uint8* cipher_out, kal_uint32* cipher_len, kal_uint8* tag, kal_uint32* tag_len, kal_uint8* iv, kal_uint32* iv_len);
+
+extern void RAND_add(const void *buf,int num,double entropy);
+extern int RAND_bytes(unsigned char *buf, int num);
+extern kal_uint32 drv_get_current_time(void);
+extern void bin_dump(kal_char *title, kal_uint8 *pData, kal_uint16 len);
+#endif
+
diff --git a/mcu/custom/middleware/common/fs_quota.c b/mcu/custom/middleware/common/fs_quota.c
new file mode 100644
index 0000000..b83e0a3
--- /dev/null
+++ b/mcu/custom/middleware/common/fs_quota.c
@@ -0,0 +1,1259 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ *	fs_quota.c
+ *
+ * Project:
+ * --------
+ *   Maui
+ *
+ * Description:
+ * ------------
+ *    This file defines quota setting
+ *
+ * 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!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * 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_general_types.h"
+
+#include "fs_gprot.h"
+
+#ifdef __FS_QM_SUPPORT__
+
+#if defined(__MTK_TARGET__)
+
+#ifdef __J2ME__
+#include "j2me_custom_param.h"
+#endif /* __J2ME__ */
+
+#include "customer_ps_inc.h"
+
+#include "nvram_user_defs.h"
+
+#ifdef WAP_SUPPORT
+#include "custom_wap_config.h"
+#endif
+
+#ifdef __SYNCML_SUPPORT__
+#include "custom_mmi_default_value.h"
+#endif /* __SYNCML_SUPPORT__ */
+
+#ifdef __MMI_VUI_3D_CUBE_APP__
+#include "lcd_sw_inc.h"
+#endif
+
+#ifdef __MMI_BROWSER_2__
+#include "BrowserSrvBookmarkConfig.h"
+#endif
+/************************ Description of QuotaSet ************************************************
+QuotaStruct: {Path in bytes, Priority, Qmin in bytes, Qmax in bytes, Uint}
+Rule:
+1. Path
+   (1) Capital 'Z' in Path means the primary system drive
+   (2) The character unit of Path is in byte
+   (3) Except the default null end entry, path cannot be NULL and must be
+       ended with backslash
+   (4) The first char of each folder must be '@'
+       Example: "E:\\@Folder\\"
+   (5) Only support one level folder
+       Example: "E:\\@Folder1\\@SubFolder\\" is invalid
+2. Priority:
+   FS_QP_HIG_ENUM (1) - Cannot be removed anyway except over quota (version upgrade)
+   FS_QP_MID_ENUM (2) - Always removed entirely if over quota.
+                        Optional removed if RFS is not enough.
+   FS_QP_LOW_ENUM (3) - Always removed entirely if over quota.
+                        Optional removed if RFS is not enough.
+   FS_QP_DEL_ENUM (4) - Always removed entirely when booting up
+3. Qmin (lower bound - reserved space) & Qmax (upper bound - quota space)
+   (1) Qmax can set to be unlimited (FS_QMAX_NO_LIMIT)
+   (2) 0 <= Qmin <= Qmax < FS_QMAX_NO_LIMIT
+   (3) RFS (Required Free Space):
+       (Qnow, the space you have used, is internal data tracked inside File System)
+         for each entry
+         {
+            if(Qmin > Qnow)
+               RFS += (Qmin - Qnow);
+         }
+   (4) MRS (Minimum Reserved Space) =
+         (Qmin of FS_QP_DEL_ENUM) + (Qmin of FS_QP_LOW_ENUM) +
+         (Qmin of FS_QP_MID_ENUM) + (Qmin of FS_QP_HIG_ENUM)
+   (5) Note that NVRAM is a special case in Quota Management. File System will
+       reserve the space for NVRAM at runtime automatically. You don't have to
+       anything about NVRAM here.
+       If (MRS + NVRAM) is over drive size, assertion will be issued when boot up check
+   (6) Note that if you have 100 files under system drive and each one of them
+       is just 3 bytes, you have to reserve (100* ClusterSize),
+       not (100*3) bytes. Because the physical allocation unit in File System is in "cluster"
+   (7) If you don't know how to count the space, you can use FS_GetFolderSize()
+       in file system to help you evalute the size at development stage
+4. Uint:
+   FS_COUNT_IN_BYTE     : Indicate the Qmin and Qmax setting are counted in byte
+   FS_COUNT_IN_CLUSTER  : Indicate the Qmin and Qmax setting are counted in cluster
+*/
+
+/************************ SweepCheck Flow ************************
+1. Check each folder or file under root directory
+2. If folder with DEL priority (listed in the QuotaSet table) is found, remove it entirely
+3. If folder listed in the QuotaSet table is over quota, remove it entirely
+4. If RFS is not enough for QuotaSet, jump to step 6
+5. Return
+6. If memory is not enough (1K+ 0.5K control buffer), jump to step 5
+7. If file is found, remove it
+   Else jump to step 9
+8. If RFS is enough, jump to step 5
+   Else jump to step 7
+9. If folder not defined in the QuotaSet table is found, remove it entirely
+   Else jump to step 11
+10.If RFS is enough, jump to step 5
+   Else jump to step 9
+11.If folder with LOW priority (listed in the QuotaSet table) is found, remove it entirely
+   Else jump to step 14
+12.Update RFS to RFS' (because some space is freed by LOW)
+13.If RFS' is enough, jump to step 5
+   Else jump to step 11
+14.If folder with MID priority (listed in the QuotaSet table) is found, remove it entirely
+15.Jump to step 5
+*/
+
+/************************ QM Run Time Monitor ************************
+1. If deletion, Qnow will be updated then
+2. If need to allocate, check as step 3
+3. If (over quota) return FS_DISK_FULL
+   Else if (RFS for others is not enough) return FS_DISK_FULL
+   Else if (Drive free is not enough for the allocation)  return FS_DISK_FULL
+   Else update Qnow after allocation
+*/
+
+/************************ User Configuration ************************/
+//Set your entry below
+//Max quota set entry number is 40
+
+#ifdef SLIM_WAP_MMS
+#define FS_PUSH_QUOTA 2*1024
+	#define FS_WAP_QUOTA 65*1024
+#else
+#define FS_PUSH_QUOTA 10*1024
+	#define FS_WAP_QUOTA 80*1024
+#endif
+
+#ifdef __MMI_BROWSER_2__
+    #define FS_BROWSER_BOOKMARK_FOLDER_QUOTA ((SRV_BRW_BKM_BOOKMARK_ENTRY_SIZE * WAP_CUSTOM_CFG_BRW_BOOKMARK_MAX_COUNT) + 100)
+#endif
+
+FS_QuotaStruct gFS_ExtQuotaSet[] =
+{
+#ifdef __MMI_VUI_3D_CUBE_APP__
+    {"Z:\\@Cube\\", FS_QP_HIG_ENUM, LCD_WIDTH * LCD_HEIGHT * 2 * 4,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __MMI_VUI_3D_CUBE_APP__ */
+
+#if defined(__DRM_SUPPORT__) && defined(MAX_DRM_DB_SIZE)
+    {"Z:\\@DRM\\", FS_QP_HIG_ENUM, MAX_DRM_DB_SIZE,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_CLUSTER},
+#endif
+
+#ifdef WAP_SUPPORT
+#if (defined(__MMI_UNIFIED_COMPOSER__) || defined(__MMI_MMS_STANDALONE_COMPOSER__)) && defined (APP_STORAGE_IN_SYS_DRV)
+	{"Z:\\@UC000\\",  FS_QP_HIG_ENUM, 10 * 1024 , FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+    #ifdef OBIGO_Q03C
+        #ifdef OPERA_BROWSER
+            {"Z:\\@OperaMobile\\",      FS_QP_HIG_ENUM, 2434 * 1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif
+        #ifdef __MMI_BROWSER_2__
+            {"Z:\\@vbookmarks\\",       FS_QP_HIG_ENUM, FS_BROWSER_BOOKMARK_FOLDER_QUOTA,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif
+        #if defined(OBIGO_Q03C_MMS_V01)
+            #ifdef __MMI_WAP_DUAL_SIM__
+                {"Z:\\@wap\\",       FS_QP_HIG_ENUM, FS_WAP_QUOTA,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #else
+                {"Z:\\@wap\\",       FS_QP_HIG_ENUM, FS_WAP_QUOTA,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #endif /* __MMI_WAP_DUAL_SIM__ */
+            #ifndef MMS_IN_LARGE_STORAGE
+                {"Z:\\@mms\\",       FS_QP_HIG_ENUM,        0,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #endif
+            {"Z:\\@mmsv01obj1\\",       FS_QP_HIG_ENUM, 10*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #if defined(__MMI_MMS_DUAL_SIM__)
+            {"Z:\\@mmsv01obj2\\",       FS_QP_HIG_ENUM, 10*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #endif         
+            #if defined(__DRM_SUPPORT__)
+                {"Z:\\@MMS_DRM\\",   FS_QP_DEL_ENUM, 100*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #endif              
+        #else
+            {"Z:\\@wap\\",       FS_QP_HIG_ENUM,  FS_WAP_QUOTA,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif            
+        #if defined(OBIGO_Q03C_MMS_V02) && !defined (MMS_IN_LARGE_STORAGE)
+            {"Z:\\@mms\\",       FS_QP_HIG_ENUM, 0 , FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif
+        #ifdef __MMI_MMS_BGSR_SUPPORT__
+            {"Z:\\@bgsr\\",       FS_QP_HIG_ENUM, 2*1024 , FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif
+        #ifdef BROWSER_SUPPORT
+/* SLIM_R starts */
+/*
+        #ifdef SLIM_WAP_MMS
+            {"Z:\\@wcache\\",    FS_QP_DEL_ENUM,  25*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #else
+*/
+/* MAUI_03090343 starts */
+//        #ifndef SLIM_WAP_MMS  
+/* SLIM_R ends */
+        #if defined(SLIM_WAP_MMS) && (defined (__OP02__) || defined (__OP01__))
+            {"Z:\\@wcache\\",    FS_QP_DEL_ENUM,  25*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #elif !defined(SLIM_WAP_MMS)
+/* MAUI_03090343 ends */
+            {"Z:\\@wcache\\",    FS_QP_DEL_ENUM,  50*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif /* SLIM_WAP_MMS */            
+
+        #endif /* BROWSER_SUPPORT */
+            {"Z:\\@push\\",       FS_QP_HIG_ENUM, FS_PUSH_QUOTA,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+		#ifdef BROWSER_SUPPORT
+        #if defined(__DRM_SUPPORT__)
+            {"Z:\\@BRA_DRM\\",   FS_QP_DEL_ENUM,   4*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},            
+        #endif
+		#endif /* BROWSER_SUPPORT */
+        #ifdef __MMI_MMS_MMA_MMS_OBJECT_IND__
+            {"Z:\\@mmsobject\\",       FS_QP_HIG_ENUM, 10*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #if defined(__MMI_MMS_DUAL_SIM__)
+            /* Temporary removed for slim projects */    
+            //{"Z:\\@mmsobject2\\",       FS_QP_HIG_ENUM, 10*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #endif
+        #endif
+		#if defined(__MMI_MMS_2__) && defined(__MMI_MMS_SIGNATURE__)
+			{"Z:\\@signature\\",       FS_QP_HIG_ENUM, 4*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+		#endif 
+    #if defined(OBIGO_Q03C_MMS_V02) && defined(__MMI_MMS_UNLIMITED_USE_DETAILS_SUPPORT__) && !defined(MMS_IN_LARGE_STORAGE)
+			{"Z:\\@usedetail\\",       FS_QP_HIG_ENUM, 100*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+    #endif /*MMS_IN_LARGE_STORAGE*/
+	#if defined(__MMI_MMS_AUTO_DWNLD_IMMED_NOTI_IN_HOME_NETWORK__) && defined (__MMI_MMS_2__)
+			{"Z:\\@mms_notify\\",       FS_QP_HIG_ENUM, 1*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+	#endif
+    #elif defined(OBIGO_Q05A)
+            {"Z:\\@wap\\",       FS_QP_HIG_ENUM, 200*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            {"Z:\\@vbookmarks\\",       FS_QP_HIG_ENUM, FS_BROWSER_BOOKMARK_FOLDER_QUOTA,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            {"Z:\\@push\\",       FS_QP_HIG_ENUM, 10*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            {"Z:\\@ids\\",       FS_QP_HIG_ENUM, 15*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            {"Z:\\@stk\\",       FS_QP_HIG_ENUM, 50*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #if defined(OBIGO_Q05A_MMS) && !defined(MMS_IN_LARGE_STORAGE)
+            {"Z:\\@mms\\",       FS_QP_HIG_ENUM, 100*1024 , FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif
+        #if defined(OBIGO_Q05A_MMS)
+            {"Z:\\@mma\\",       FS_QP_HIG_ENUM, 200*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            {"Z:\\@umdb\\",       FS_QP_HIG_ENUM,130*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif
+        #if defined(OBIGO_Q03C_MMS_V02) && !defined (MMS_IN_LARGE_STORAGE)
+            {"Z:\\@mms\\",       FS_QP_HIG_ENUM, 0 , FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif
+        #ifdef __MMI_MMS_BGSR_SUPPORT__
+            {"Z:\\@bgsr\\",       FS_QP_HIG_ENUM, 2*1024 , FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif
+        #if defined(__MMI_MMS_MMA_MMS_OBJECT_IND__)
+            {"Z:\\@mmsobject1\\",       FS_QP_HIG_ENUM, 10*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #if defined(__MMI_MMS_DUAL_SIM__)
+            {"Z:\\@mmsobject2\\",       FS_QP_HIG_ENUM, 10*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            #endif
+        #endif
+		#if defined(__MMI_MMS_2__) && defined(__MMI_MMS_SIGNATURE__)
+			{"Z:\\@signature\\",       FS_QP_HIG_ENUM, 4*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+		#endif
+		#if defined(__MMI_MMS_AUTO_DWNLD_IMMED_NOTI_IN_HOME_NETWORK__) && defined (__MMI_MMS_2__)
+			{"Z:\\@mms_notify\\",       FS_QP_HIG_ENUM, 1*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+		#endif
+    #endif        
+#endif /* WAP_SUPPORT */
+
+#ifdef __MMI_PROV_MESSAGE_SUPPORT__
+    #if defined(__MMI_PROV_IN_UM__)  && defined(__UNIFIED_MESSAGE_ARCHIVE_SUPPORT__)
+   	  {"Z:\\@ProvBox\\", FS_QP_HIG_ENUM, 30 * 1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+    #else
+   	  {"Z:\\@ProvBox\\", FS_QP_HIG_ENUM, 15 * 1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+    #endif    
+#endif /* __MMI_PROV_MESSAGE_SUPPORT__ */
+
+#ifdef __EMAIL__
+         {"Z:\\@email_sys\\", FS_QP_HIG_ENUM, 1024 + 52 * 62, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __EMAIL__ */
+
+#ifdef __XML_SUPPORT__
+            {"Z:\\@Xml\\",     FS_QP_HIG_ENUM,   1024,         FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#ifdef __EMS_SUPPORT__
+            {"Z:\\@Image\\",     FS_QP_HIG_ENUM,       0,   FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+            {"Z:\\@Audio\\",     FS_QP_HIG_ENUM,       0,   FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __EMS_SUPPORT__ */
+
+#ifdef __J2ME__
+#ifndef _NAND_FLASH_BOOTING_
+            {"Z:\\@Java\\",      FS_QP_HIG_ENUM,200*1024,
+             (DEFAULT_MAX_STORAGE_SPACE ? DEFAULT_MAX_STORAGE_SPACE : FS_QMAX_NO_LIMIT), FS_COUNT_IN_BYTE},
+#else
+            {"Z:\\@Java\\",      FS_QP_HIG_ENUM,500*1024,
+             (DEFAULT_MAX_STORAGE_SPACE ? DEFAULT_MAX_STORAGE_SPACE : FS_QMAX_NO_LIMIT), FS_COUNT_IN_BYTE},
+#endif
+
+#endif  /* __J2ME__ */
+
+#ifdef VR_CYBERON
+            {"Z:\\@VRDB\\",      FS_QP_HIG_ENUM, 58*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},   // (2.85 * 20) + 1 = 58
+#elif defined( VR_ITRI )
+            {"Z:\\@VRDB\\",      FS_QP_HIG_ENUM, 85*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},   // (4.2 * 20) + 1 = 85
+#endif /* VR */
+
+#ifdef __IMPS__
+            {"Z:\\@imps\\",      FS_QP_HIG_ENUM, 80*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE}, //MMI 35K + IMPS 45K
+#endif /* __IMPS_ */
+
+#ifdef __XDM__
+            {"Z:\\@pocxdm\\",    FS_QP_HIG_ENUM, 30*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __XDM__ */
+
+#ifdef __POC__
+            {"Z:\\@poc\\",       FS_QP_HIG_ENUM, 30*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __POC__ */
+
+#ifdef __SIP__
+            {"Z:\\@sip\\",       FS_QP_HIG_ENUM, 30*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __SIP__ */
+
+#if defined (__MMI_FTC_SUPPORT__) && defined (__MMI_FTS_SUPPORT__)
+            {"Z:\\@ftp\\",       FS_QP_HIG_ENUM, 60*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#elif defined(__MMI_FTS_SUPPORT__)
+            {"Z:\\@ftp\\",       FS_QP_HIG_ENUM, 20*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#elif defined(__MMI_FTC_SUPPORT__)
+            {"Z:\\@ftp\\",       FS_QP_HIG_ENUM, 40*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#ifdef __MMI_AVATAR__
+            {"Z:\\@avatar\\",    FS_QP_HIG_ENUM,    200*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#ifdef SWFLASH_NEOMTEL
+            {"Z:\\@swflash\\",    FS_QP_HIG_ENUM,    300*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#ifdef __MMI_BARCODEREADER__
+#if defined(__MMI_OP11_BARCODEREADER__)
+            {"Z:\\@barcodereader\\",    FS_QP_HIG_ENUM,    60*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#if defined(__MMI_OP01_BARCODEREADER__) || defined(__MMI_BARCODEREADER_QR__)
+            {"Z:\\@barcode\\",    FS_QP_HIG_ENUM,    10*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#endif
+
+#if defined(__MMI_IME_USER_DATABASE__) || defined(__MMI_CSTAR_USER_DICT__)
+            {"Z:\\@ime\\",       FS_QP_HIG_ENUM,    32*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE}, // fixed size 32Kb
+#endif
+
+#ifdef __MMI_BPP_SUPPORT__
+            {"Z:\\@bpp\\",       FS_QP_HIG_ENUM, 10*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __MMI_BPP_SUPPORT__ */
+
+#ifdef __MRE_AM__
+            {"Z:\\@AM\\",       FS_QP_HIG_ENUM, 20*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __MRE_AM__ */
+
+#ifdef __COSMOS_MMI_PACKAGE__
+            {"Z:\\@mre\\",       FS_QP_HIG_ENUM, 200*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __COSMOS_MMI_PACKAGE__ */
+
+
+#ifdef __UNIFIED_MESSAGE_ARCHIVE_SUPPORT__
+            {"Z:\\@SMSArch\\",   FS_QP_HIG_ENUM, CM_SMS_MAX_ARMSG_NUM*100, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __UNIFIED_MESSAGE_ARCHIVE_SUPPORT__ */
+
+#ifdef __MMI_VIDEO_STREAM__
+            {"Z:\\@VideoStream\\", FS_QP_HIG_ENUM, 20*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __MMI_VIDEO_STREAM__ */
+
+#if defined (__MMI_VIDEO_RECORDER__) || defined(__MMI_CAMCORDER__)
+            {"Z:\\@Videos\\",     FS_QP_HIG_ENUM, 3*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* defined (__MMI_VIDEO_RECORDER__) && !defined(__MMI_CAMCORDER__) */
+
+#ifdef SYNCML_DM_SUPPORT
+            {"Z:\\@dm\\",       FS_QP_HIG_ENUM, 32*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* SYNCML_DM_SUPPORT */
+
+#ifdef __BTMTK__
+            {"Z:\\@bt\\",       FS_QP_HIG_ENUM, 3*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __BTMTK__ */
+
+#ifdef __BT_BIP_PROFILE__
+            {"Z:\\@bip\\",       FS_QP_HIG_ENUM, 60*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __BT_BIP_PROFILE__ */
+
+#ifdef __CERTMAN_SUPPORT__
+            {"Z:\\@certman\\",       FS_QP_HIG_ENUM, 100, FS_QMAX_NO_LIMIT, FS_COUNT_IN_CLUSTER},
+#endif /* __CERTMAN_SUPPORT__ */
+
+#ifdef __TCPIP__
+        #if (MMI_MAX_SIM_NUM == 4)
+            {"Z:\\@Dtcnt\\",       FS_QP_HIG_ENUM, 109*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #elif (MMI_MAX_SIM_NUM == 3)
+            {"Z:\\@Dtcnt\\",       FS_QP_HIG_ENUM, 106*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #elif (MMI_MAX_SIM_NUM == 2)
+            {"Z:\\@Dtcnt\\",       FS_QP_HIG_ENUM, 103*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #else
+            {"Z:\\@Dtcnt\\",       FS_QP_HIG_ENUM, 100*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+        #endif /* MMI_MAX_SIM_NUM */
+#endif /* __TCPIP__ */
+
+#ifdef __SSL_SUPPORT__
+    #ifdef OPERA_BROWSER
+    #ifdef __OCSP_SUPPORT__
+            {"Z:\\@tls\\",       FS_QP_HIG_ENUM, 66, FS_QMAX_NO_LIMIT, FS_COUNT_IN_CLUSTER},
+    #else /* !__OCSP_SUPPORT__ */
+            {"Z:\\@tls\\",       FS_QP_HIG_ENUM, 63, FS_QMAX_NO_LIMIT, FS_COUNT_IN_CLUSTER},
+    #endif /* !__OCSP_SUPPORT__ */
+
+    #else /* !OPERA_BROWSER */
+    #ifdef __OCSP_SUPPORT__
+            {"Z:\\@tls\\",       FS_QP_HIG_ENUM, 40, FS_QMAX_NO_LIMIT, FS_COUNT_IN_CLUSTER},
+    #else /* !__OCSP_SUPPORT__ */
+            {"Z:\\@tls\\",       FS_QP_HIG_ENUM, 37, FS_QMAX_NO_LIMIT, FS_COUNT_IN_CLUSTER},
+    #endif /* !__OCSP_SUPPORT__ */
+    #endif /* !OPERA_BROWSER */
+#endif /* __SSL_SUPPORT__ */
+
+#ifdef __WIFI_SUPPORT__
+            {"Z:\\@dhcp\\",      FS_QP_HIG_ENUM, 2*1024, 3*1024, FS_COUNT_IN_BYTE},
+#endif /* __WIFI_SUPPORT__ */
+
+#if (defined __MMI_OP01_DCD__)
+            {"Z:\\@dcd_sys\\",      FS_QP_HIG_ENUM, 4*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+			{"Z:\\@dcd\\",          FS_QP_HIG_ENUM, 200*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#elif (defined __MMI_OP01_DCD_V30__)
+            {"Z:\\@dcd_sys\\",      FS_QP_HIG_ENUM, 4*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+			{"Z:\\@dcd\\",          FS_QP_HIG_ENUM, 1536*1024, 6*1024*1024, FS_COUNT_IN_BYTE},
+#endif
+
+#ifdef __MMI_MOBILE_VIDEO__
+            {"Z:\\@MobileVideo\\",  FS_QP_HIG_ENUM, 4*1024*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __MMI_MOBILE_VIDEO__ */
+
+
+#ifdef SVG12_SUPPORT
+            {"Z:\\@svg\\",    FS_QP_DEL_ENUM,  0,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#ifdef PICTBRIDGE_SUPPORT
+            {"Z:\\@pictbridge\\", FS_QP_HIG_ENUM, 1*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+
+#ifdef __SYNCML_SUPPORT__
+
+#ifdef __MMI_SYNCML_SYNC_TASK_SUPPORT__
+#define MMI_SYNCML_NUM_OF_TASK  NUM_OF_TASK
+#else
+#define MMI_SYNCML_NUM_OF_TASK  (0)
+#endif /* __MMI_SYNCML_SYNC_TASK_SUPPORT__ */
+
+#ifdef __MMI_SYNCML_SYNC_CALENDAR_SUPPORT__
+#define MMI_SYNCML_NUM_OF_CAL  NUM_OF_CAL
+#else
+#define MMI_SYNCML_NUM_OF_CAL  (0)
+#endif /* __MMI_SYNCML_SYNC_CALENDAR_SUPPORT__ */
+
+#ifdef __MMI_SYNCML_SYNC_NOTE_SUPPORT__
+#define MMI_SYNCML_NUM_OF_NOTE  MMI_MAX_NOTE_ITEM
+#else
+#define MMI_SYNCML_NUM_OF_NOTE  (0)
+#endif /* __MMI_SYNCML_SYNC_NOTE_SUPPORT__ */
+
+/* total change log records */
+#define MMI_SYNCML_CHGLOG_REC_TOTAL  \
+            (MAX_PHB_PHONE_ENTRY + MMI_SYNCML_NUM_OF_CAL + MMI_SYNCML_NUM_OF_TASK + MMI_SYNCML_NUM_OF_NOTE)
+
+
+#ifdef __SYNCML_DEVICE_SYNC__
+/* MMI_SYNCML_DB_NUM and MMI_SYNCML_MAP_REC_TOTAL has no dependence 
+ * with __MMI_SYNCML_SYNC_***_SUPPORT__ ,
+ * it's always the total Database number supported by PS, because PS can not
+ * change among with MMI features.
+ */
+/* total map records */
+#define MMI_SYNCML_MAP_REC_TOTAL    \
+    (MAX_PHB_PHONE_ENTRY + NUM_OF_CAL + NUM_OF_TASK + MMI_MAX_NOTE_ITEM)
+#define MMI_SYNCML_DB_NUM   (4)  /* 1.phb + 2.cal + 3.task + 4.note */
+/* "12" is map record size. 132 is map header size. */
+#define MMI_SYNCML_MAX_DEV_MEMSIZE \
+            (MAX_SYNCML_DEV_NUM * (7 * MMI_SYNCML_CHGLOG_REC_TOTAL + 132 * MMI_SYNCML_DB_NUM + MMI_SYNCML_MAP_REC_TOTAL * 12))            
+#else /* __SYNCML_DEVICE_SYNC__ */
+#define MMI_SYNCML_MAX_DEV_MEMSIZE  (0)
+#endif /* __SYNCML_DEVICE_SYNC__ */
+
+            /* "10 * 1024" is the maxSize of sending file, "7" is a changelog rec size  */
+            {"Z:\\@SyncML\\", FS_QP_HIG_ENUM,  (10 * 1024) + (7 * MMI_SYNCML_CHGLOG_REC_TOTAL * MAX_SYNCML_SV_PROFILES) + MMI_SYNCML_MAX_DEV_MEMSIZE, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+
+#endif /* __SYNCML_SUPPORT__ */
+
+#if defined(__MMI_MOBILE_TV_CMMB_SUPPORT__)
+            {"Z:\\@mtv\\",    FS_QP_HIG_ENUM,    700*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#elif defined(__MMI_ATV_SUPPORT__)
+            {"Z:\\@mtv\\",    FS_QP_HIG_ENUM,    30*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#ifdef __MMI_AUTO_ANSWER_MACHINE__
+            {"Z:\\@AutoAM\\",       FS_QP_HIG_ENUM, 25*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif /* __MMI_AUTO_ANSWER_MACHINE__ */
+#ifdef __UCWEB6__
+            {"Z:\\@UCWebClient\\",       FS_QP_HIG_ENUM, 10*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif    
+#ifdef KUR_DECODE
+            {"Z:\\@kuro\\",       FS_QP_HIG_ENUM, 15*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif 
+#ifdef __QQIM_SLIM_SUPPORT__ 
+            {"Z:\\@qq\\",       FS_QP_HIG_ENUM, 1*1024,  FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#ifdef __SRV_SMS_SIM_CUST_DATA__
+#ifdef __MMI_DUAL_SIM_MASTER__
+            {"Z:\\@SMSSimCust\\",  FS_QP_HIG_ENUM, 4, FS_QMAX_NO_LIMIT, FS_COUNT_IN_CLUSTER},
+#else /* __MMI_DUAL_SIM_MASTER__ */
+            {"Z:\\@SMSSimCust\\",  FS_QP_HIG_ENUM, 2, FS_QMAX_NO_LIMIT, FS_COUNT_IN_CLUSTER},
+#endif /* __MMI_DUAL_SIM_MASTER__ */
+#endif /* __SRV_SMS_SIM_CUST_DATA__ */
+
+#ifdef __GADGET_SUPPORT__ 
+            {"Z:\\@gadget\\",  FS_QP_HIG_ENUM,  500 * 1024,  FS_QMAX_NO_LIMIT,  FS_COUNT_IN_BYTE},
+#ifdef __COSMOS_MMI_PACKAGE__
+            {"Z:\\@wgtmgr\\",  FS_QP_HIG_ENUM,  520 * 1024,  FS_QMAX_NO_LIMIT,  FS_COUNT_IN_BYTE},
+#else
+            {"Z:\\@wgtmgr\\",  FS_QP_HIG_ENUM,   20 * 1024,  FS_QMAX_NO_LIMIT,  FS_COUNT_IN_BYTE},
+#endif
+#endif
+
+#ifdef __NMC_SUPPORT__
+            {"Z:\\@nmc\\",  FS_QP_HIG_ENUM,  1024 * 1024,  FS_QMAX_NO_LIMIT,  FS_COUNT_IN_BYTE},
+#endif
+
+#if (defined(__MRE_PACKAGE_FULL__) || defined(__MRE_PACKAGE_NORMAL__))
+   {"Z:\\@mrestorage\\", FS_QP_HIG_ENUM, 10*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#ifdef __MMI_3D_GAME_INTERGRAFX__
+	  {"Z:\\@ig_save\\", FS_QP_HIG_ENUM, 1*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+#if defined(__COSMOS_MMI_PACKAGE__)
+#ifdef __MMI_COSMOS_DOWNLOADABLE_THEMES_SUPPORT__
+		{"Z:\\@Settings\\", FS_QP_HIG_ENUM, 2048 * 1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#else
+		{"Z:\\@Settings\\", FS_QP_HIG_ENUM, 1024 * 1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+#endif
+
+#if defined(__MRE_PACKAGE_SLIM__)
+    {"Z:\\@mresysfile\\", FS_QP_HIG_ENUM, 1*2*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+
+#elif defined(__MRE_PACKAGE_NORMAL__)
+    {"Z:\\@mresysfile\\", FS_QP_HIG_ENUM, 14*2*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+
+#elif defined(__MRE_PACKAGE_FULL__)
+    {"Z:\\@mresysfile\\", FS_QP_HIG_ENUM, 18*2*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+
+#endif
+
+#ifdef __ALIPAY_SUPPORT__
+    {"Z:\\@alipay\\", FS_QP_HIG_ENUM, 2*1024, FS_QMAX_NO_LIMIT, FS_COUNT_IN_BYTE},
+#endif
+
+};
+
+/************* Do not modify anything behind this line *************/
+
+void fs_quota_init(void)
+{
+    FS_QuotaInit(gFS_ExtQuotaSet, ((sizeof(gFS_ExtQuotaSet)/sizeof(FS_QuotaStruct)) - 1));
+}
+
+sys_indirect_init_func g_fs_quota_init = fs_quota_init;
+
+#else // !__FS_MODIS_FDM__ && !__MTK_TARTET__
+
+void fs_quota_init(void)
+{
+}
+
+sys_indirect_init_func g_fs_quota_init = fs_quota_init;
+
+#endif /* __FS_MODIS_FDM__ || __MTK_TARTET__ */
+
+#else   // !__FS_QM_SUPPORT__
+
+void fs_quota_init(void)
+{
+}
+
+sys_indirect_init_func g_fs_quota_init = fs_quota_init;
+
+#endif // __FS_QM_SUPPORT__
+
+
diff --git a/mcu/custom/middleware/common/ft_customize.h b/mcu/custom/middleware/common/ft_customize.h
new file mode 100644
index 0000000..1e97d34
--- /dev/null
+++ b/mcu/custom/middleware/common/ft_customize.h
@@ -0,0 +1,89 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ *  ft_customize.h
+ *
+ * Project:
+ * --------
+ *   Maui
+ *
+ * Description:
+ * ------------
+ *   This file contains ft task customized funcitons in META mode.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *==============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+#ifndef _FT_CUSTOMIZE_H_
+#define _FT_CUSTOMIZE_H_
+#include "kal_public_api.h" //MSBB change #include "kal_release.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */ 
+
+    /* customized initialization */
+    extern kal_uint8 FT_CustomInit(void);
+
+#ifdef __cplusplus
+}
+#endif 
+
+#endif /* _FT_CUSTOMIZE_H_ */ 
+
diff --git a/mcu/custom/middleware/common/meta_customize.c b/mcu/custom/middleware/common/meta_customize.c
new file mode 100644
index 0000000..1197c29
--- /dev/null
+++ b/mcu/custom/middleware/common/meta_customize.c
@@ -0,0 +1,648 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ *  meta_customize.c
+ *
+ * Project:
+ * --------
+ *   Maui
+ *
+ * Description:
+ * ------------
+ *   This file contains ft task customized bt funcitons in META mode.
+ *
+ * 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!
+ *
+ *
+ *
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+#if defined(__MTK_TARGET__)
+#if !defined(__MAUI_BASIC__)
+/****************************************************************************
+ * KAL
+ ***************************************************************************/
+#include "kal_general_types.h"
+#include "kal_public_api.h"
+#include "init.h"
+/****************************************************************************
+ * NVRAM
+ ***************************************************************************/
+#include "nvram_enums.h"
+#include "nvram_data_items.h"
+#include "ft_nvram_def.h"
+#include "nvram_interface.h"
+#include "adc_nvram_def.h"
+#include "ul1_nvram_def.h"
+#include "l4_nvram_def.h"
+extern kal_bool Custom_META_IsSecureLid(kal_uint16 lid);
+/****************************************************************************
+ * MODEM BSP
+ ***************************************************************************/
+#include "ft_msg.h"
+//#include "l1audio.h"
+#include "meta_customize.h"
+/****************************************************************************
+ * Non MODEM BSP
+ ***************************************************************************/
+nvram_lid_enum  meta_must_backup_lid_array[ ] =
+{
+#ifndef __MAUI_BASIC__
+#else
+    0  // at least one element
+#endif //#ifndef __MAUI_BASIC__
+};
+
+kal_uint16  custom_meta_check_must_backup_lid_array(kal_bool bCheckImeiFlag)
+{
+#ifndef __MAUI_BASIC__
+      kal_uint16 i;
+    kal_char *pcStrPrefix;
+      kal_char *pcStrVerNo;
+    kal_uint16 lid_num = custom_meta_get_check_lid_num();//sizeof(meta_must_backup_lid_array)/ sizeof(nvram_lid_enum);
+    kal_bool error_flag = KAL_FALSE;
+    kal_uint16 stop_index = 0;
+    
+#ifndef __TC01__	  
+	  for(i=0; i<lid_num-1; i++)  // imei exclusively
+#else
+    for(i=0; i<lid_num; i++)  // only focus calibration data.
+#endif
+    {
+        if(NVRAM_IO_ERRNO_OK != nvram_check_backup(meta_must_backup_lid_array[i], &pcStrPrefix, &pcStrVerNo))
+        {
+                 error_flag = KAL_TRUE;
+                 stop_index = i;
+                 break;
+        }
+
+    }
+#ifndef __TC01__
+    if(i==lid_num-1) // pass the all check except IMEI
+    {
+        if(bCheckImeiFlag)  // need to check imei
+        {
+        	 	if(NVRAM_IO_ERRNO_OK != nvram_check_backup(meta_must_backup_lid_array[i], &pcStrPrefix, &pcStrVerNo))
+        	 	  	   error_flag =KAL_TRUE;  	
+        }
+        stop_index = i;
+    }
+#endif
+    
+    if(error_flag == KAL_TRUE)
+    {
+          return stop_index;
+    }
+    else
+    {
+         return lid_num; // means success!
+    }
+#else
+    return 0;
+#endif // #ifndef __MAUI_BASIC__
+
+}
+
+kal_uint16  custom_meta_get_check_lid_num(void)
+{
+    return sizeof(meta_must_backup_lid_array)/sizeof(nvram_lid_enum);
+}
+
+kal_uint16  custom_meta_get_enum_by_index(kal_uint16 index)
+{
+    if(index < custom_meta_get_check_lid_num())
+        return (kal_uint16)meta_must_backup_lid_array[index];
+    else
+          return custom_meta_get_check_lid_num();
+}
+
+
+kal_bool custom_ft_util_check_if_isp_support()
+{
+      //#if defined(ISP_SUPPORT) && !defined(YUV_SENSOR_SUPPORT)
+      #if defined(ISP_SUPPORT)
+        return KAL_TRUE;
+      #else
+        return KAL_FALSE;
+      #endif
+}
+
+kal_bool custom_ft_util_check_if_usb_enable_support()
+{
+        return KAL_FALSE;
+}
+kal_uint16 custom_ft_get_calflag_enum(void)
+{
+#if !defined (NVRAM_NOT_PRESENT)	
+	 return NVRAM_EF_CAL_FLAG_LID;
+#else
+   return 0;
+#endif
+}
+/*******************************************************************************
+ * FUNCTION
+ *   Custom_META_IsAllowedLimitedStateOperation
+ *
+ * DESCRIPTION
+ *   Customizable limited state META mode operation check function
+ *
+ * CALLS
+ *   INT_GetMetaModeSrc
+ *
+ * PARAMETERS
+ *   ptrMsg the ilm_struct of the request message
+ *
+ * RETURNS
+ *   The indicator of the operation is allowed or denied
+ *
+ *******************************************************************************/
+kal_bool Custom_META_IsAllowedLimitedStateOperation(ilm_struct* ptrMsg)
+{
+    return KAL_TRUE;
+}
+
+kal_bool Custom_META_IsSecureOperation(ilm_struct* ptrMsg)
+{
+    kal_bool isSecureOp = KAL_FALSE;
+    FT_H *ft_header = NULL;
+
+    ft_header = (FT_H *)(ptrMsg->local_para_ptr);
+
+    /*******************************************************
+     * Add more secured operations below
+     * message type id defined in interface\meta\ft_msg.h
+     * enum type FT_MESSAGE_ID
+     *******************************************************/
+    if (FT_NVRAM_READ_REQ_ID == ft_header->ft_msg_id)
+    {
+        ft_nvram_read_req_struct_T *ptr_loc_para = (ft_nvram_read_req_struct_T*) ptrMsg->local_para_ptr;
+        if (Custom_META_IsSecureLid(ptr_loc_para->file_idx))
+        {
+            isSecureOp = KAL_TRUE;
+            FT_SendDeniedMsgIdCnf(ft_header->ft_msg_id, FT_CNF_NOT_ALLOWED);
+        }
+    }
+
+    else if (FT_NVRAM_WRITE_REQ_ID == ft_header->ft_msg_id)
+    {
+        ft_nvram_write_req_struct_T *ptr_loc_para = (ft_nvram_write_req_struct_T*) ptrMsg->local_para_ptr;
+        if (Custom_META_IsSecureLid(ptr_loc_para->file_idx))
+        {
+            isSecureOp = KAL_TRUE;
+            FT_SendDeniedMsgIdCnf(ft_header->ft_msg_id, FT_CNF_NOT_ALLOWED);
+        }
+    }
+
+    else
+    {
+        isSecureOp = KAL_FALSE;
+    }
+
+    return isSecureOp;
+}
+
+
+kal_bool Custom_META_GetSlaPara(kal_uint8* para, kal_uint32 para_len)
+{
+    return true;
+}
+
+kal_uint16 Custom_META_CheckSlaVer(kal_uint32 sla_ver_from_pc)
+{
+    return 0;
+}
+
+kal_uint16 custom_ft_get_rf_cal_env_enum(void)
+{
+#ifdef __TC01_CALIBRATION__
+    return NVRAM_EF_RF_CAL_ENV_LID;
+#else
+    return 0;
+#endif
+}
+kal_uint16 custom_ft_get_rf_loss_setting_enum(void)
+{
+#ifdef __TC01_CALIBRATION__
+    return NVRAM_EF_RF_CAL_LOSS_SETTING_LID;
+#else
+    return 0;
+#endif
+}
+kal_uint16 custom_ft_get_rf_test_power_result_enum(void)
+{
+#ifdef __TC01_CALIBRATION__
+    return NVRAM_EF_RF_TEST_POWER_RESULT_LID;
+#else
+    return 0;
+#endif
+}
+void Custom_META_USBVirtualComDisconnect(void)
+{
+}
+/**
+ * This function will return the result of SDS support.
+ *
+ * usage: Custom_META_SdsSupported();
+ * @return KAL_TRUE, support SDS; KAL_FALSE, does not support SDS
+ */
+kal_bool Custom_META_SdsSupported(void)
+{
+#if defined(__SECURE_DATA_STORAGE__)
+    return KAL_TRUE;
+#else // #if defined(__SECURE_DATA_STORAGE__)
+    return KAL_FALSE;
+#endif // #if !defined(__SECURE_DATA_STORAGE__)
+}
+/**
+ * This function is used for customization
+ * The return value will be used as the maximum size of
+ * control buffer used between META and target
+ *
+ * FT task will truncate the value to the actual
+ * maximum value if the return value is over the actual
+ * maximum value
+ * (eg. system maximum value is 8K and the custom parameter
+ * asks for 16K, the result is 8K)
+ *
+ * on the other hand, if the custom parameter asks fewer
+ * than 2K, the FT task will override the value to 2K to
+ * keep the legacy command compatible.
+ * (eg. custom parameter is 1K, the FT task will override
+ * the setting to 2K for backward compatible)
+ */
+kal_uint32 Custom_META_ControlBufferSize(void)
+{
+    return 8192;
+}
+/**
+ * This function query the FT custom memory pool size
+ * @return pool size
+ */
+#define META_CUSTOM_MEM_POOL_SIZE 16384
+#if defined(__MTK_TARGET__)
+__attribute__((aligned(4)))
+#endif
+ kal_uint8 ft_ext_mem[META_CUSTOM_MEM_POOL_SIZE];
+kal_uint32 Custom_META_GetCustomMemoryPoolSize(void)
+{
+    return META_CUSTOM_MEM_POOL_SIZE;
+}
+/**
+ * This function return the pool arrangement
+ */
+static const kal_uint32 ft_subpool_size[8] = { 16384, 32768, 65536, 131072, 262144, 524288, 0xffffffff, 0 };
+void* Custom_META_GetCustomMemoryPoolArrangement(void)
+{
+    if(Custom_META_GetCustomMemoryPoolSize() > 4096)
+    {
+        return (void*)ft_subpool_size;
+    }
+    else
+    {
+        return NULL;
+    }
+}
+/**
+ * This function get the custom memory pool address
+ */
+kal_uint8* Custom_META_GetCustomMemoryPool(void)
+{
+    return ft_ext_mem;
+}
+#endif // #if !defined(__MAUI_BASIC__)
+#endif // #if defined(__MTK_TARGET__)
diff --git a/mcu/custom/middleware/common/meta_customize.h b/mcu/custom/middleware/common/meta_customize.h
new file mode 100644
index 0000000..b7e7035
--- /dev/null
+++ b/mcu/custom/middleware/common/meta_customize.h
@@ -0,0 +1,230 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ *  meta_customize.h
+ *
+ * Project:
+ * --------
+ *   Maui
+ *
+ * Description:
+ * ------------
+ *   This file contains ft task customized funcitons in META mode.
+ *
+ * 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *==============================================================================
+ *******************************************************************************/
+#ifndef _META_CUSTOMIZE_H_
+#define _META_CUSTOMIZE_H_
+#if defined(__MTK_TARGET__)
+#if !defined(__MAUI_BASIC__)
+#include "kal_general_types.h"
+/********************************************************************************
+ * MODEM BSP API
+ *******************************************************************************/
+kal_uint16  custom_meta_check_must_backup_lid_array(kal_bool bCheckImeiFlag);
+kal_uint16  custom_meta_get_check_lid_num(void);
+kal_uint16  custom_meta_get_enum_by_index(kal_uint16 index);
+kal_bool custom_ft_util_check_if_isp_support(void);
+kal_bool custom_ft_util_check_if_usb_enable_support(void);
+kal_uint16 custom_ft_get_calflag_enum(void);
+/***********************************
+ * RF calibration history query API
+ **********************************/
+kal_uint16 custom_ft_get_rf_cal_env_enum(void);
+kal_uint16 custom_ft_get_rf_loss_setting_enum(void);
+kal_uint16 custom_ft_get_rf_test_power_result_enum(void);
+void Custom_META_USBVirtualComDisconnect(void);
+kal_bool Custom_META_SdsSupported(void);
+kal_uint32 Custom_META_ControlBufferSize(void);
+/****************************************************************************
+ * FT memory buffer
+ ****************************************************************************/
+kal_uint32 Custom_META_GetCustomMemoryPoolSize(void);
+kal_uint8* Custom_META_GetCustomMemoryPool(void);
+void* Custom_META_GetCustomMemoryPoolArrangement(void);
+/****************************************************************************
+ * META SLA
+ ****************************************************************************/
+kal_bool Custom_META_IsSecureOperation(ilm_struct* ptrMsg);
+kal_bool Custom_META_GetSlaPara(kal_uint8* para, kal_uint32 para_len);
+kal_uint16 Custom_META_CheckSlaVer(kal_uint32 sla_ver_from_pc);
+#endif // #if !defined(__MAUI_BASIC__)
+#endif // #if defined(__MTK_TARGET__)
+#endif /* _META_CUSTOMIZE_H_ */
diff --git a/mcu/custom/middleware/common/pki_common_config.h b/mcu/custom/middleware/common/pki_common_config.h
new file mode 100644
index 0000000..79bda6f
--- /dev/null
+++ b/mcu/custom/middleware/common/pki_common_config.h
@@ -0,0 +1,9 @@
+#include "kal_public_api.h" //MSBB change #include "kal_release.h"
+#ifndef _PKI_COMMON_CONFIG_H_
+#define _PKI_COMMON_CONFIG_H_
+
+/* PKCS7/12 max data size constraints */
+#define MAX_PKCS7_IMPORT_DATA_SIZE  (10 * 1024)
+#define MAX_PKCS12_IMPORT_DATA_SIZE (10 * 1024)
+
+#endif /* _PKI_COMMON_CONFIG_H_ */
diff --git a/mcu/custom/middleware/common/resource_audio.c b/mcu/custom/middleware/common/resource_audio.c
new file mode 100644
index 0000000..5df572e
--- /dev/null
+++ b/mcu/custom/middleware/common/resource_audio.c
@@ -0,0 +1,215 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * RESOURCE_AUDIO.C
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   This file is intends for audio resource database.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+/*
+**   Includes
+*/
+//#include "kal_release.h"
+
+#ifndef __L1_STANDALONE__
+
+#ifdef WIN32
+#define __align(X)
+#endif
+
+//#include "device.h"
+#include "resource_audio.h"
+//#include "MMI_features.h"
+
+static const device_tones_struct dtmf0[]           =  {  { 941, 1336, 0,  0,   0 }   };
+static const device_tones_struct dtmf1[]           =  {  { 697, 1209, 0,  0,   0 }   };
+static const device_tones_struct dtmf2[]           =  {  { 697, 1336, 0,  0,   0 }   };
+static const device_tones_struct dtmf3[]           =  {  { 697, 1477, 0,  0,   0 }   };
+static const device_tones_struct dtmf4[]           =  {  { 770, 1209, 0,  0,   0 }   };
+static const device_tones_struct dtmf5[]           =  {  { 770, 1336, 0,  0,   0 }   };
+static const device_tones_struct dtmf6[]           =  {  { 770, 1477, 0,  0,   0 }   };
+static const device_tones_struct dtmf7[]           =  {  { 852, 1209, 0,  0,   0 }   };
+static const device_tones_struct dtmf8[]           =  {  { 852, 1336, 0,  0,   0 }   };
+static const device_tones_struct dtmf9[]           =  {  { 852, 1477, 0,  0,   0 }   };
+static const device_tones_struct dtmfstar[]        =  {  { 941, 1209, 0,  0,   0 }   };
+static const device_tones_struct dtmfhash[]        =  {  { 941, 1477, 0,  0,   0 }   };
+static const device_tones_struct dtmfnormal[]        =  {  { 1200,  0, 100,  0,   0 }   };
+/* ref ETSI: 02.40 */
+static const device_tones_struct tone_dial_call_gsm[]       =  {  { 425,   0,   0,   0,   0 }   };
+static const device_tones_struct tone_dial_call_pcs[]       =  {  { 350, 440,   0,   0,   0 }   };
+static const device_tones_struct tone_busy_call_gsm[]       =  {  { 425,   0, 500, 500,   0 }   };
+static const device_tones_struct tone_busy_call_pcs[]       =  {  { 480, 620, 500, 500,   0 }   };
+static const device_tones_struct tone_congestion_gsm[]       =  {  { 425,   0, 200, 200,   0 }   };
+static const device_tones_struct tone_congestion_pcs[]       =  {  { 480, 620, 200, 200,   0 }   };
+static const device_tones_struct tone_radio_path[]           =  {  { 425,   0, 200,   0,   0 }   };
+static const device_tones_struct tone_radio_na[]           =  {  { 425,   0, 200, 200,   1 },
+                                                                  { 425,   0, 200, 200,   2 },
+                                                                  { 425,   0, 200,   0,   0 }   };
+static const device_tones_struct tone_error_info[]          =  {  { 950,   0, 330,1000,   0 }   };
+static const device_tones_struct tone_num_unobtain[]          =  {  {1400,   0, 330, 0,   0 }   };
+static const device_tones_struct tone_auth_error[]          =  {  { 950,   0, 330,1000,   0 }   };
+
+#ifndef __REPEAT_CALL_WAITING_TONE__ /* GSM */
+static const device_tones_struct tone_call_waiting[]           =  {  { 425,   0, 200, 600,   1 },
+                                                                     { 425,   0, 200,3000,   2 },
+                                                                     { 425,   0, 200, 600,   3 },
+                                                                     { 425,   0, 200,   0,   0 }   };
+#else /* __REPEAT_CALL_WAITING_TONE__ */
+static const device_tones_struct tone_call_waiting[]           =  {  { 440,   0, 200, 100,   1 },
+                                                                     { 440,   0, 200,3500,   0 }   };
+#endif /* __REPEAT_CALL_WAITING_TONE__ */
+                                                                        
+static const device_tones_struct tone_ring_tone_gsm[]           =  {  { 425,   0, 2000, 1000,   0 }   };
+static const device_tones_struct tone_ring_tone_pcs[]           =  {  { 425,   0, 2000, 4000,   0 }   };
+
+/* for SAT by brian */
+static const device_tones_struct tone_positive_ack[]           =  {  { 600,   0, 200, 100,   1 },
+                                                                     { 800,   0, 200, 100,   2 },
+                                                                     { 1000,   0, 200,   0,   0 }   };
+static const device_tones_struct tone_negative_ack[]           =  {  { 600,   0, 300, 100,   1 },
+                                                                     { 300,   0, 700,   0,   0 }   };
+
+static const device_tones_struct tone_mt_sms_in_call[]           =  {  { 852, 1209, 200,  0,   0 }   };
+
+static const device_tones_struct tone_warning1[]           =  {  { 852, 0, 200,  0,   0 }   };
+static const device_tones_struct tone_warning2[]           =  {  { 852, 0, 200,  0,   0 }   };
+static const device_tones_struct tone_error1[]           =  {  { 1209, 0, 200,  0,   0 }   };
+static const device_tones_struct tone_error2[]           =  {  { 1209, 0, 200,  0,   0 }   };
+static const device_tones_struct tone_general_beep[]           =  {  { 700, 0, 200,  0,   0 }   };
+
+static const device_tones_struct tone_key_click[]           =  {  { 1500, 0, 200,  0,   0 }   };
+static const device_tones_struct tone_call_connect[]           =  {  { 700, 0, 200,  0,   0 }   };
+static const device_tones_struct tone_battery_low[]           =  {  { 1100,   0, 300, 100,   1 },
+                                                                     { 900,   0, 300,   0,   0 }   };
+static const device_tones_struct tone_battery_warning[]       =  {  { 1400,   0, 300, 100,   1 },
+                                                                     { 1400,   0, 300, 100,   2 },
+                                                                     { 1400,   0, 300,   0,   0 }   };
+static const device_tones_struct tone_aux_ind[]                =  {  { 700, 0, 200,  0,   0 }   };
+static const device_tones_struct tone_data_call[]           =  {  { 425,   0, 2000, 1000,   0 }   };
+static const device_tones_struct tone_call_time_reminder[]     =  {  { 852, 0, 200,  0,   0 }   };
+#ifdef __OP01_FWPBW__
+static const device_tones_struct tone_continue_sound[]       =  {  { 400, 0, 0,  0,   0 }   };
+#endif
+
+const device_tones_struct *mtk_resource_tones[]=
+{
+   dtmf0, /* TONE_DTMF_0 */            	/* 0 */
+   dtmf1,                           	/* 1 */
+   dtmf2,                           	/* 2 */
+   dtmf3,                           	/* 3 */
+   dtmf4,                           	/* 4 */
+   dtmf5,                           	/* 5 */
+   dtmf6,                           	/* 6 */
+   dtmf7,                            	/* 7 */
+   dtmf8,                           	/* 8 */
+   dtmf9, /* TONE_DTMF_9 */            	/* 9 */
+   dtmfstar, /* TONE_KEY_STAR */        /* 10 */
+   dtmfhash, /* TONE_KEY_HASH */       /* 11 */
+   dtmfnormal, /* TONE_KEY_NORMAL */   /* 12 */
+   tone_key_click,       				/* 13 */
+
+   tone_call_connect,                  /* 14 */
+   tone_mt_sms_in_call,				/* 15 */
+   tone_call_time_reminder,			/* 16 */
+   
+   tone_dial_call_gsm,				/* 17 */
+   tone_dial_call_pcs, 				/* 18 */
+   tone_busy_call_gsm, 				/* 19 */
+   tone_busy_call_pcs,				/* 20 */
+   tone_congestion_gsm,				/* 21 */
+   tone_congestion_pcs, 			/* 22 */
+   tone_radio_path,					/* 23 */
+   tone_radio_na,					/* 24 */
+   tone_error_info, 				/* 25 */
+   tone_num_unobtain, 				/* 26 */
+   tone_auth_error,					/* 27 */
+   tone_call_waiting, 				/* 28 */
+   tone_ring_tone_gsm, 				/* 29 */
+   tone_ring_tone_pcs,				/* 30 */
+   tone_positive_ack, 				/* 31 */
+   tone_negative_ack,				/* 32 */
+
+   tone_dial_call_gsm,				/* 33 */
+   tone_dial_call_pcs,				/* 34 */
+   tone_busy_call_gsm,				/* 35 */
+   tone_busy_call_pcs,				/* 36 */
+   tone_congestion_gsm,				/* 37 */
+   tone_congestion_pcs,				/* 38 */
+   tone_radio_path,					/* 39 */
+   tone_radio_na,					/* 40 */
+   tone_error_info,	    			/* 41 */
+   tone_num_unobtain,				/* 42 */
+   tone_auth_error,					/* 43 */
+   tone_call_waiting,				/* 44 */
+   tone_ring_tone_gsm,				/* 45 */
+   tone_ring_tone_pcs,				/* 46 */
+   tone_positive_ack,				/* 47 */
+   tone_negative_ack,				/* 48 */
+
+   tone_warning1,					/* 49 */
+   tone_warning2,					/* 50 */
+   tone_error1,						/* 51 */
+   tone_error2,						/* 52 */
+   tone_general_beep, 				/* 53 */
+   tone_battery_low,    			/* 54 */
+   tone_battery_warning,			/* 55 */
+   tone_aux_ind,					/* 56 */
+   tone_data_call					/* 57 */
+#ifdef __OP01_FWPBW__
+   ,tone_continue_sound              /* 58 */
+#endif
+};
+#endif /* !__L1_STANDALONE__ */
\ No newline at end of file
diff --git a/mcu/custom/middleware/common/resource_audio.h b/mcu/custom/middleware/common/resource_audio.h
new file mode 100644
index 0000000..fbc9da4
--- /dev/null
+++ b/mcu/custom/middleware/common/resource_audio.h
@@ -0,0 +1,186 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * RESOURCE_AUDIO.H
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   This file is intends for audio resource database.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#ifndef _MMI_AUDIO_H
+#define _MMI_AUDIO_H
+
+//#include "MMI_features.h"
+
+//#include "custom_user_profiles_defs.h"
+
+#include "kal_general_types.h"
+
+typedef enum
+{
+   MIN_TONE_ID = 0,                         
+   TONE_DTMF_0 = MIN_TONE_ID,            	/* 0 */
+   TONE_DTMF_1,            					/* 1 */
+   TONE_DTMF_2,            					/* 2 */
+   TONE_DTMF_3,            					/* 3 */
+   TONE_DTMF_4,            					/* 4 */
+   TONE_DTMF_5,            					/* 5 */
+   TONE_DTMF_6,            					/* 6 */
+   TONE_DTMF_7,            					/* 7 */
+   TONE_DTMF_8,            					/* 8 */
+   TONE_DTMF_9,								/* 9 */
+   TONE_KEY_STAR,          					/* 10 */
+   TONE_KEY_HASH,          					/* 11 */
+   TONE_KEY_NORMAL,							/* 12 */
+   TONE_KEY_VOL_UP = TONE_KEY_NORMAL,     /* 12 */   
+   TONE_KEY_VOL_DOWN = TONE_KEY_NORMAL,  /* 12 */   
+   TONE_KEY_UP = TONE_KEY_NORMAL,         /* 12 */   
+   TONE_KEY_DOWN = TONE_KEY_NORMAL,      /* 12 */   
+   TONE_KEY_LEFT = TONE_KEY_NORMAL,       /* 12 */   
+   TONE_KEY_RIGHT = TONE_KEY_NORMAL,     /* 12 */    
+   TONE_KEY_MENU = TONE_KEY_NORMAL,      /* 12 */    
+   TONE_KEY_FUNCTION = TONE_KEY_NORMAL,  /* 12 */    
+   TONE_KEY_SK_LEFT = TONE_KEY_NORMAL,   /* 12 */    
+   TONE_KEY_SK_RIGHT = TONE_KEY_NORMAL,  /* 12 */    
+   TONE_KEY_SEND = TONE_KEY_NORMAL,      /* 12 */    
+   TONE_KEY_END = TONE_KEY_NORMAL,       /* 12 */    
+   TONE_KEY_POWER = TONE_KEY_NORMAL,     /* 12 */   
+
+   TONE_KEY_CLICK,						/* 13 */
+
+   TONE_CALL_CONNECT,					/* 14 */
+   TONE_MT_SMS_IN_CALL,					/* 15 */
+   TONE_CALL_TIME_REMINDER,				/* 16 */
+
+   TONE_DIAL_CALL_GSM,    				/* 17 */
+   TONE_DIAL_CALL_PCS,     				/* 18 */
+   TONE_BUSY_CALL_GSM,    				/* 19 */
+   TONE_BUSY_CALL_PCS,    				/* 20 */
+   TONE_CONGESTION_GSM,  				/* 21 */ 
+   TONE_CONGESTION_PCS,   				/* 22 */
+   TONE_RADIO_PATH,       				/* 23 */
+   TONE_RADIO_NA,         				/* 24 */
+   TONE_ERROR_INFO,        				/* 25 */
+   TONE_NUM_UNOBTAIN,     				/* 26 */
+   TONE_AUTH_ERROR,       				/* 27 */
+   TONE_CALL_WAITING,      				/* 28 */
+   TONE_RINGING_CALL_GSM, 				/* 29 */
+   TONE_RINGING_CALL_PCS, 				/* 30 */
+   TONE_POSITIVE_ACK,      				/* 31 */
+   TONE_NEGATIVE_ACK,     				/* 32 */   
+													
+   TONE_DIAL_CALL_GSM_STK,				/* 33 */
+   TONE_DIAL_CALL_PCS_STK,				/* 34 */
+   TONE_BUSY_CALL_GSM_STK,				/* 35 */
+   TONE_BUSY_CALL_PCS_STK,				/* 36 */
+   TONE_CONGESTION_GSM_STK,				/* 37 */
+   TONE_CONGESTION_PCS_STK,				/* 38 */
+   TONE_RADIO_PATH_STK,   				/* 39 */
+   TONE_RADIO_NA_STK,     				/* 40 */
+   TONE_ERROR_INFO_STK,   			    /* 41 */
+   TONE_NUM_UNOBTAIN_STK, 				/* 42 */
+   TONE_AUTH_ERROR_STK,   				/* 43 */
+   TONE_CALL_WAITING_STK, 				/* 44 */
+   TONE_RINGING_CALL_GSM_STK,			/* 45 */
+   TONE_RINGING_CALL_PCS_STK,			/* 46 */
+   TONE_POSITIVE_ACK_STK, 				/* 47 */
+   TONE_NEGATIVE_ACK_STK, 				/* 48 */
+			
+			
+   TONE_WARNING1,						/* 49 */
+   TONE_WARNING2,						/* 50 */
+   TONE_ERROR1,							/* 51 */
+   TONE_ERROR2,							/* 52 */
+   TONE_GENERAL_BEEP,					/* 53 */
+   TONE_BATTERY_LOW,					/* 54 */
+   TONE_BATTERY_WARNING,				/* 55 */
+   TONE_AUX_IND,						/* 56 */
+   TONE_DATA_CALL,						/* 57 */
+#ifdef __OP01_FWPBW__
+   TONE_CONTINUE_SOUND,		    		/* 58 */
+#endif
+   NUM_RESOURCE_TONES,
+
+   MAX_TONE_ID = 80
+}audio_id_enum;
+
+/*
+** Define the tone format: Keypad, DTMF, Call Tone.
+*/
+typedef struct {
+   kal_uint16   freq1;            /* First frequency                                    */
+   kal_uint16   freq2;            /* Second frequency                                   */
+   kal_uint16   on_duration;      /* Tone on duation, in ms unit, 0 for continuous tone */
+   kal_uint16   off_duration;     /* Tone off duation, in ms unit, 0 for end of playing */
+   kal_int8     next_operation;   /* Index of the next tone                             */
+} device_tones_struct;
+
+typedef struct {
+   const unsigned char *data;
+   kal_uint32  len;
+   kal_int32 format;
+}
+audio_resource_struct;
+
+typedef struct {
+	short start;
+	short end;
+}
+start_end_t;
+       
+extern device_tones_struct** resource_tones;
+
+#endif // _MMI_AUDIO_H
diff --git a/mcu/custom/middleware/common/usbc_custom.c b/mcu/custom/middleware/common/usbc_custom.c
new file mode 100644
index 0000000..ddf638d
--- /dev/null
+++ b/mcu/custom/middleware/common/usbc_custom.c
@@ -0,0 +1,713 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ *    usbc_custom.c
+ *
+ * Project:
+ * --------
+ *    MOLY
+ *
+ * Description:
+ * ------------
+ *   This file implements usb customer support
+ *
+ * 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!!
+ *============================================================================
+ ****************************************************************************/
+#ifdef  __HIF_USB_SUPPORT__
+
+#include "usbc_custom.h"
+#include "dcl.h"
+#include "usbc_custom_def.h"
+#include "kal_public_api.h"
+
+static kal_uint16 usb_manufacturer_string[] =
+{
+	0x031c,  /* bDescriptorType:0x03, bLength:0x1c */
+	'M',
+	'e',
+	'd',
+	'i',
+	'a',
+	'T',
+	'e',
+	'k',
+	' ',
+	'I',
+	'n',
+	'c',
+	'.'
+};
+
+static kal_uint16 usb_product_string[] =
+{
+#if defined(MT6880)
+	0x031c,
+	'U',
+	'S',
+	'B',
+	' ',
+	'D',
+	'A',
+	'T',
+	'A',
+	' ',
+	'C',
+	'A',
+	'R',
+	'D'
+#else
+	0x031a,
+	'L',
+	'T',
+	'E',
+	' ',
+	'U',
+	'S',
+	'B',
+	' ',
+	'C',
+	'A',
+	'R',
+	'D'
+#endif
+};
+
+static kal_uint16 usb_serial_num[] =
+{
+#ifdef __PRODUCTION_RELEASE__
+	0x0320,
+	'0',
+	'0',
+	'0',
+	'0',
+	'0',
+	'0',
+	'0',
+	'0',
+	'0',
+	'0',
+	'0',
+	'0',
+    '0',
+    '0',
+    '0'
+#else
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+};
+
+static usb_dev_param_t usb_dev_param =
+{
+    0x0001,     /* bcdDevice */
+
+    usb_manufacturer_string,
+    sizeof(usb_manufacturer_string)/sizeof(kal_uint16),
+    usb_product_string,
+    sizeof(usb_product_string)/sizeof(kal_uint16),
+    usb_serial_num,
+    sizeof(usb_serial_num)/sizeof(kal_uint16),
+
+    2, // morphing sub id
+
+    /* Mode Parameter: each mode is defined in a file of usbc_custom_mode folder */
+    /* And each mode will register to this structure array.*/
+    /* ========================================================== */
+    {{0}},
+
+    {
+    #ifdef BTT_STANDALONE_MODE
+        USB_MODE_BTT_STANDALONE, //USB_OS_WIN8
+        USB_MODE_BTT_STANDALONE, //USB_OS_WIN
+        USB_MODE_BTT_STANDALONE, //USB_OS_LINUX
+        USB_MODE_BTT_STANDALONE, //USB_OS_MAC
+        USB_MODE_BTT_STANDALONE  //USB_OS_OTHERS
+    #else   // #ifdef BTT_STANDALONE_MODE
+        USB_MODE_DEFAULT,       //USB_OS_WIN8
+        USB_MODE_DEFAULT,       //USB_OS_WIN
+        USB_MODE_DEFAULT,       //USB_OS_LINUX
+        USB_MODE_DEFAULT,       //USB_OS_MAC
+        USB_MODE_DEFAULT        //USB_OS_OTHERS
+    #endif // #ifdef BTT_STANDALONE_MODE
+    }
+};
+
+//
+// ACM1 String Descriptor
+//
+static kal_uint16 acm1_string_descr_interface[] =
+{
+	0x031A,  /* bDescriptorType:0x03, bLength:0x1A */
+	'U', 'S', 'B', ' ',
+	'C', 'O', 'M', ' ',
+	'P', 'o', 'r', 't',
+};
+static const usb_class_acm1_param_t usb_class_acm1_param_c =
+{
+    acm1_string_descr_interface,                                        // interface_string;
+    sizeof(acm1_string_descr_interface)/sizeof(kal_uint16),             // interface_string_size;
+};
+
+//
+// ACM2 String Descriptor
+//
+static kal_uint16 acm2_string_descr_comm_interface[] =
+{
+	0x0340,  /* bDescriptorType:0x03, bLength:0x40 */
+	'U', 'S', 'B', ' ',
+    'C', 'O', 'M', ' ',
+	'C', 'o', 'm', 'm', 'u', 'n', 'i', 'c', 'a', 't', 'i', 'o', 'n', ' ',
+	'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+static kal_uint16 acm2_string_descr_data_interface[] =
+{
+	0x032E,  /* bDescriptorType:0x03, bLength:0x2E */
+	'U', 'S', 'B', ' ',
+    'C', 'O', 'M', ' ',
+	'D', 'a', 't', 'a', ' ',
+	'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+static kal_uint16 acm2_string_descr_iad[] =
+{
+    0x031A,  /* bDescriptorType:0x03, bLength:0x1A */
+    'U', 'S', 'B', ' ',
+    'C', 'O', 'M', ' ',
+    'P', 'o', 'r', 't',
+};
+static const usb_class_acm2_param_t usb_class_acm2_param_c =
+{
+    acm2_string_descr_comm_interface,                                   // comm_interface_string;
+    sizeof(acm2_string_descr_comm_interface)/sizeof(kal_uint16),        // comm_interface_string_size;
+    acm2_string_descr_data_interface,                                   // data_interface_string;
+    sizeof(acm2_string_descr_data_interface)/sizeof(kal_uint16),        // data_interface_string_size;
+    acm2_string_descr_iad,                                              // iad_string;
+    sizeof(acm2_string_descr_iad)/sizeof(kal_uint16),                   // iad_string_size;
+};
+
+//
+// ACM3 String Descriptor
+//
+static kal_uint16 acm3_string_descr_interface[] =
+{
+    0x031A,  /* bDescriptorType:0x03, bLength:0x1A */
+    'U', 'S', 'B', ' ',
+    'C', 'O', 'M', ' ',
+    'P', 'o', 'r', 't',
+};
+static const usb_class_acm3_param_t usb_class_acm3_param_c =
+{
+    acm3_string_descr_interface,                                        // interface_string;
+    sizeof(acm3_string_descr_interface)/sizeof(kal_uint16),             // interface_string_size;
+};
+
+//
+// RNDIS String Descriptor
+//
+static kal_uint16 rndis_string_descr_comm_interface[] =
+{
+    0x033C,  /* bDescriptorType:0x03, bLength:0x3C */
+    'R', 'N', 'D', 'I', 'S', ' ',
+    'C', 'o', 'm', 'm', 'u', 'n', 'i', 'c', 'a', 't', 'i', 'o', 'n', ' ',
+    'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+static kal_uint16 rndis_string_descr_data_interface[] =
+{
+	0x032A,  /* bDescriptorType:0x03, bLength:0x2A */
+	'R', 'N', 'D', 'I', 'S', ' ',
+	'D', 'a', 't', 'a', ' ',
+	'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+static kal_uint16 rndis_string_descr_iad[] =
+{
+    0x0326,  /* bDescriptorType:0x03, bLength:0x26 */
+    'R', 'E', 'M', 'O', 'T', 'E', ' ',
+    'N', 'D', 'I', 'S', ' ',
+    'D', 'e', 'v', 'i', 'c', 'e',
+};
+static const usb_class_rndis_param_t usb_class_rndis_param_c =
+{
+    rndis_string_descr_comm_interface,                                  // comm_interface_string;
+    sizeof(rndis_string_descr_comm_interface)/sizeof(kal_uint16),       // comm_interface_string_size;
+    rndis_string_descr_data_interface,                                  // data_interface_string;
+    sizeof(rndis_string_descr_data_interface)/sizeof(kal_uint16),       // data_interface_string_size;
+    rndis_string_descr_iad,                                             // iad_string;
+    sizeof(rndis_string_descr_iad)/sizeof(kal_uint16),                  // iad_string_size;
+};
+
+//
+// ECM String Descriptor
+//
+static kal_uint16 ecm_string_descr_comm_interface[] =
+{
+    0x033A,  /* bDescriptorType:0x03, bLength:0x3A */
+    'E', 'C', 'M', ' ',
+    'C', 'o', 'm', 'm', 'u', 'n', 'i', 'c', 'a', 't', 'i', 'o', 'n', ' ',
+    'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+static kal_uint16 ecm_string_descr_null_data_interface[] =
+{
+	0x0330,  /* bDescriptorType:0x03, bLength:0x30 */
+	'E', 'C', 'M', ' ',
+	'N', 'U', 'L', 'L', ' ',
+	'D', 'a', 't', 'a', ' ',
+	'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+
+static kal_uint16 ecm_string_descr_data_interface[] =
+{
+	0x0326,  /* bDescriptorType:0x03, bLength:0x26 */
+	'E', 'C', 'M', ' ',
+	'D', 'a', 't', 'a', ' ',
+	'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+static kal_uint16 ecm_string_descr_iad[] =
+{
+    0x0328,  /* bDescriptorType:0x03, bLength:0x28 */
+    'U', 'S', 'B', ' ',
+    'E', 't', 'h', 'e', 'r', 'n', 'e', 't', ' ',
+    'D', 'e', 'v', 'i', 'c', 'e',
+};
+static kal_uint16 ecm_string_descr_mac_addr[3][13] =
+{
+    {0x031A,  /* bDescriptorType:0x03, bLength:0x1A */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
+
+    {0x031A,  /* bDescriptorType:0x03, bLength:0x1A */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
+
+    {0x031A,  /* bDescriptorType:0x03, bLength:0x1A */
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
+};
+static const usb_class_ecm_param_t usb_class_ecm_param_c =
+{
+    ecm_string_descr_comm_interface,                                  // comm_interface_string;
+    sizeof(ecm_string_descr_comm_interface)/sizeof(kal_uint16),       // comm_interface_string_size;
+    ecm_string_descr_null_data_interface,                              // null_data_interface_string;       -- Disable data interface
+    sizeof(ecm_string_descr_null_data_interface)/sizeof(kal_uint16),   // null_data_interface_string_size;
+    ecm_string_descr_data_interface,                                  // data_interface_string;     -- Enable data interface
+    sizeof(ecm_string_descr_data_interface)/sizeof(kal_uint16),       // data_interface_string_size;
+    ecm_string_descr_iad,                                             // iad_string;
+    sizeof(ecm_string_descr_iad)/sizeof(kal_uint16),                  // iad_string_size;
+    // mac_addr_string;
+    { ecm_string_descr_mac_addr[0], ecm_string_descr_mac_addr[1], ecm_string_descr_mac_addr[2] },
+    // mac_addr_string_size;
+    { sizeof(ecm_string_descr_mac_addr[0])/sizeof(kal_uint16), sizeof(ecm_string_descr_mac_addr[1])/sizeof(kal_uint16), sizeof(ecm_string_descr_mac_addr[2])/sizeof(kal_uint16) },
+};
+
+
+//
+// MBIM String Descriptor
+//
+static kal_uint16 mbim_string_descr_comm_interface[] =
+{
+    0x033A,  /* bDescriptorType:0x03, bLength:0x3A */
+    'M', 'B', 'I', 'M', ' ',
+    'C', 'o', 'm', 'm', 'u', 'n', 'i', 'c', 'a', 't', 'i', 'o', 'n', ' ',
+    'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+static kal_uint16 mbim_string_descr_null_data_interface[] =
+{
+	0x0332,  /* bDescriptorType:0x03, bLength:0x32 */
+	'M', 'B', 'I', 'M', ' ',
+	'N', 'U', 'L', 'L', ' ',
+	'D', 'a', 't', 'a', ' ',
+	'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+static kal_uint16 mbim_string_descr_data_interface[] =
+{
+	0x0328,  /* bDescriptorType:0x03, bLength:0x28 */
+	'M', 'B', 'I', 'M', ' ',
+	'D', 'a', 't', 'a', ' ',
+	'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e',
+};
+static kal_uint16 mbim_string_descr_iad[] =
+{
+    0x0330,  /* bDescriptorType:0x03, bLength:0x30 */
+    'M', 'o', 'b', 'i', 'l', 'e', ' ',
+    'B', 'r', 'o', 'a', 'd', 'b', 'a', 'n', 'd', ' ',
+    'D', 'e', 'v', 'i', 'c', 'e',
+};
+static const usb_class_mbim_param_t usb_class_mbim_param_c =
+{
+    mbim_string_descr_comm_interface,                                   // comm_interface_string;
+    sizeof(mbim_string_descr_comm_interface)/sizeof(kal_uint16),        // comm_interface_string_size;
+    mbim_string_descr_null_data_interface,                              // null_data_interface_string;       -- Disable data interface
+    sizeof(mbim_string_descr_null_data_interface)/sizeof(kal_uint16),   // null_data_interface_string_size;
+    mbim_string_descr_data_interface,                                   // data_interface_string;       -- Enable data interface
+    sizeof(mbim_string_descr_data_interface)/sizeof(kal_uint16),        // data_interface_string_size;
+    mbim_string_descr_iad,                                              // iad_string;
+    sizeof(mbim_string_descr_iad)/sizeof(kal_uint16),                   // iad_string_size;
+};
+
+//
+// ADB String Descriptor
+//
+static kal_uint16 adb_string_descr_interface[] =
+{
+	0x031C,  /* bDescriptorType:0x03, bLength:0x1A */
+	'A', 'D', 'B', ' ',
+	'I', 'n', 't', 'e',
+	'r', 'f', 'a', 'c', 'e'
+};
+static const usb_class_adb_param_t usb_class_adb_param_c =
+{
+    adb_string_descr_interface,                                        // interface_string;
+    sizeof(adb_string_descr_interface)/sizeof(kal_uint16),             // interface_string_size;
+};
+
+static kal_uint16 ms_string_descr_interface[] =
+{
+	0x031c,
+	'M',
+	'a',
+	's',
+	's',
+	' ',
+	'S',
+	't',
+	'o',
+	'r',
+	'a',
+	'g',
+	'e',
+	' '
+};
+static const usb_class_ms_param_t usb_class_ms_param_c =
+{
+    ms_string_descr_interface,                                        // interface_string;
+    sizeof(ms_string_descr_interface)/sizeof(kal_uint16),             // interface_string_size;
+};
+#if 0
+/* under construction !*/
+/* under construction !*/
+#if defined(__MTK_TARGET__)
+/* under construction !*/
+#else
+/* under construction !*/
+#endif
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#if defined(__MTK_TARGET__)
+	#if defined(__MSDC_SD_MMC__)
+/* under construction !*/
+	#endif
+/* under construction !*/
+#else
+/* under construction !*/
+#endif
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#if defined(__MTK_TARGET__)
+	#if defined(__MSDC_SD_MMC__)
+/* under construction !*/
+	#endif
+/* under construction !*/
+#else
+/* under construction !*/
+#endif
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#if defined(__MTK_TARGET__)
+	#if defined(__MSDC_SD_MMC__)
+/* under construction !*/
+	#endif
+/* under construction !*/
+#else
+/* under construction !*/
+#endif
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#if defined(__MTK_TARGET__)
+	#if defined(__MSDC_SD_MMC__)
+/* under construction !*/
+	#endif
+/* under construction !*/
+#else
+/* under construction !*/
+#endif
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#if defined(__MTK_TARGET__)
+/* under construction !*/
+#else
+/* under construction !*/
+#endif
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#if defined(__MTK_TARGET__)
+	#if defined(__MSDC_SD_MMC__)
+/* under construction !*/
+	#endif
+/* under construction !*/
+#else
+/* under construction !*/
+#endif
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+
+/*
+ * Public Function
+ */
+const usb_dev_param_t *usb_get_device_param(void)
+{
+    return (&usb_dev_param);
+}
+
+const usb_class_acm1_param_t *usb_get_acm1_param(void)
+{
+    return &usb_class_acm1_param_c;
+}
+
+const usb_class_acm2_param_t *usb_get_acm2_param(void)
+{
+    return &usb_class_acm2_param_c;
+}
+
+const usb_class_acm3_param_t *usb_get_acm3_param(void)
+{
+    return &usb_class_acm3_param_c;
+}
+
+const usb_class_mbim_param_t *usb_get_mbim_param(void)
+{
+    return &usb_class_mbim_param_c;
+}
+
+const usb_class_rndis_param_t *usb_get_rndis_param(void)
+{
+    return &usb_class_rndis_param_c;
+}
+
+const usb_class_ecm_param_t *usb_get_ecm_param(void)
+{
+    return &usb_class_ecm_param_c;
+}
+
+const usb_class_adb_param_t *usb_get_adb_param(void)
+{
+    return &usb_class_adb_param_c;
+}
+
+const usb_class_ms_param_t *usb_get_ms_param(void)
+{
+    return &usb_class_ms_param_c;
+}
+
+/* get USB custom parameter function*/
+static const usb_custom_func_t usb_custom_func =
+{
+	usb_get_device_param,
+	usb_get_ms_param,
+	usb_get_acm1_param,
+	usb_get_acm2_param,
+	usb_get_acm3_param,
+	usb_get_mbim_param,
+	usb_get_rndis_param,
+	usb_get_ecm_param,
+	usb_get_adb_param,	
+};
+
+const usb_custom_func_t *usb_get_custom_func(void)
+{
+	return(&usb_custom_func);
+}
+
+kal_uint32 usb_mode_register_index = 0;
+void usb_register_mode_param(usb_mode_param_t *mode_param)
+{
+    if(mode_param != NULL && usb_mode_register_index < (USB_MODE_MAX -1))
+        kal_mem_cpy(&(usb_dev_param.mode_param[usb_mode_register_index++]),  mode_param, sizeof(usb_mode_param_t));
+
+    return;
+}
+
+void usb_replace_mode_param(usb_mode_param_t *mode_param, kal_uint8 index)
+{
+    if(mode_param != NULL && index < (USB_MODE_MAX -1))
+    {
+        kal_mem_cpy(&(usb_dev_param.mode_param[index]),  mode_param, sizeof(usb_mode_param_t));
+    }
+    return;
+}
+#endif /* __HIF_USB_SUPPORT__ */
diff --git a/mcu/custom/middleware/common/usbc_custom_def.h b/mcu/custom/middleware/common/usbc_custom_def.h
new file mode 100644
index 0000000..6d44231
--- /dev/null
+++ b/mcu/custom/middleware/common/usbc_custom_def.h
@@ -0,0 +1,289 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ *   usbc_custom_def.h
+ *
+ * Project:
+ * --------
+ *   MOLY
+ *
+ * Description:
+ * ------------
+ *   This file declares usb customization definitions
+ *
+ * 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!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#ifndef _USBC_CUSTOM_DEF_H_
+#define _USBC_CUSTOM_DEF_H_
+
+#define USB_UNIQUE_SERIAL_NUM_ENABLE    (1)     /* 1: Set IMEI as the serial number. 0: do not report serial number in device descriptor */
+#define U3_CONF_BMAXPOWER               (896)   /* the iMaxPower of USB 3.0 configuration descriptor */
+#define U3_CONF_BMAXPOWER_META          (400)   /* the iMaxPower of USB 3.0 configuration descriptor in META mode */
+
+/*
+ * U2_TERM_VREF_DEF
+ * USBPHYACR1.BIT[10:8]
+ *  0 :  320mV
+ *  1 :  340mV
+ *  2 :  360mV
+ *  3 :  380mV
+ *  4 :  400mV
+ *  5 :  420mV
+ *  6 :  440mV
+ *  7 :  460mV
+ */
+#define U2_TERM_VREF_DEF                (7)
+
+/*
+ * U2_VRT_VREF_DEF
+ * USBPHYACR1.BIT[14:12]
+ *  0 :  700mV
+ *  1 :  720mV
+ *  2 :  740mV
+ *  3 :  760mV
+ *  4 :  770mV
+ *  5 :  780mV
+ *  6 :  800mV
+ *  7 :  820mV
+ */
+#define U2_VRT_VREF_DEF                (7)
+
+/*
+ * U2_ENHANCEMENT_STATE
+ * USBPHYACR6.BIT[31:30]  :  U2 eye enhancement
+ * 0 :  low
+ * 1 :  reserve
+ * 2 :  reserve
+ * 3 :  strongest
+ */
+#define  U2_ENHANCEMENT_STATE           (3)
+
+/*
+ * U2_SQ_THRESHOLD_DEF
+ * USBPHYACR6.BIT[3:0]
+ * 0 :  85mV
+ * 1 :  90mV
+ * 2 :  95mV
+ * 3 :  100mV
+ * 4 :  105mV
+ * 5 :  110mV
+ * 6 :  115mV
+ * 7 :  120mV
+ * 8 :  125mV
+ * 9 :  130mV
+ * 10 : 135mV
+ * 11 : 140mV
+ * 12 : 145mV
+ * 13 : 150mV
+ * 14 : 155mV
+ * 15 : 160mV
+ */
+#define U2_SQ_THRESHOLD_DEF              (2)
+
+/*
+ *  Not use
+ * U2_DISCONNECT_THRESHOLD_DEF 
+ *  * USBPHYACR6.BIT[7:4]
+ * 0 :  400mV
+ * 1 :  420mV
+ * 2 :  440mV
+ * 3 :  460mV
+ * 4 :  480mV
+ * 5 :  500mV
+ * 6 :  520mV
+ * 7 :  540mV
+ * 8 :  560mV
+ * 9 :  580mV
+ * 10 : 600mV
+ * 11 : 620mV
+ * 12 : 640mV
+ * 13 : 660mV
+ * 14 : 680mV
+ * 15 : 700mV
+ */
+#define U2_DISCONNECT_THRESHOLD_DEF      (0)
+
+
+
+
+
+
+
+typedef enum {
+    USB_MODE_BTT_STANDALONE = 0, /* BTT standlone */
+    USB_MODE_MSD_OSDRTY,
+    USB_MODE_META_DBG,
+    USB_MODE_1R3C,
+    USB_MODE_UFPM, /* USB fast path */
+    USBMODE_KS_IODT_1R3C_ENUM,
+    USBMODE_1R5C_ENUM,
+    USBMODE_1R4C_ENUM,
+    USBMODE_RNDIS_DBG_COM_ENUM,
+    USB_MODE_NUM,
+    USB_MODE_MAX = 16
+} usb_mode_e;
+
+typedef enum{
+    USB_MODE_NORMAL = 0,
+    USB_MODE_VENDER1,
+    USB_MODE_VENDER2,
+    USB_MODE_OWNER_NUM,
+}usb_mode_owner_e;
+
+#define USB_MODE_DEFAULT USBMODE_1R5C_ENUM
+
+#if defined(__USB_MSD_SUPPORT__)
+typedef enum
+{
+	USBMS_DISK_MSDC1,
+	USBMS_DISK_MSDC2,
+	USBMS_DISK_NOR,
+	USBMS_DISK_NAND,
+#if defined(__MTK_TARGET__)
+	USBMS_DISK_CDROM
+#else
+	USBMS_DISK_CDROM,
+	USBMS_DISK_RAMDISK
+#endif
+} MS_DISK_CONFIG_TYPE;//config type for ms adapter
+
+/*from spec SCSI-4 (6.4.2)*/
+#define MS_INQURIY_VENDOR_MAX_SIZE 8
+#define MS_INQURIY_PRODUCT_MAX_SIZE 16
+#define MS_INQURIY_REVISION_MAX_SIZE 4
+#endif
+
+#endif /* _USBC_CUSTOM_DEF_H_ */
diff --git a/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_base.c b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_base.c
new file mode 100644
index 0000000..2791dcc
--- /dev/null
+++ b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_base.c
@@ -0,0 +1,155 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * usbc_custom_mode_base.c
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   
+ *
+ * Author:
+ * -------
+ * 
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#include "usbc_custom.h"
+#include "usbc_custom_def.h"
+#include "dcl.h"
+
+// Applicaton COM only is one of the simplest mode
+static usb_mode_param_t usbmode_app_com_only = 
+{
+    0x0e8d, 
+    0x7101, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 1, {USB_CLASS_ACM2}, 
+            {(void*)uart_port_usb}, 
+            {0x11},
+            {USB_CLASS_OWNER_MD}
+        } 
+    } 
+};
+
+// Dual COM for META and DBG
+usb_mode_param_t usbmode_meta_dbg_com =
+{
+    0x0e8d, 
+    0x00AD, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 2, {USB_CLASS_ACM2, USB_CLASS_ACM2}, 
+             {(void*)uart_port_usb6, (void*)uart_port_usb2}, 
+             {0x22, 0x22},
+             {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } 
+};
+
+// 1R3C is used for legacy
+static usb_mode_param_t usbmode_1r3c =
+{ 
+#ifndef __USB_RNDIS_SUPPORT__
+    0x0e8d, 
+    0x00AD, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 2, {USB_CLASS_ACM2, USB_CLASS_ACM2}, 
+             {(void*)uart_port_usb6, (void*)uart_port_usb2}, 
+             {0x22, 0x22},
+             {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } 
+#else
+    0x0e8d, 
+    0x7104, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 4, {USB_CLASS_RNDIS, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1}, 
+            {(void*)0x100, (void*)uart_port_usb, (void*)uart_port_usb6, (void*)uart_port_usb2}, 
+            {0x55, 0x11, 0x11, 0x11},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD}
+        } 
+    } 
+#endif
+};
+
+void usb_mode_base_register()
+{
+    /* USB_MODE_BTT_STANDALONE */
+    usb_register_mode_param(&usbmode_app_com_only);
+    /* USB_MODE_MSD_OSDRTY */
+    usb_register_mode_param(&usbmode_1r3c);
+    /* USB_MODE_META_DBG_COM */
+    usb_register_mode_param(&usbmode_meta_dbg_com);
+    /* USB_MODE_1R3C */
+    usb_register_mode_param(&usbmode_1r3c);
+    return ;
+}
+
+void usb_mode_replace_metadbg_mode(kal_uint8 index)
+{
+    usb_replace_mode_param(&usbmode_meta_dbg_com, index);
+}
diff --git a/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_datacard.c b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_datacard.c
new file mode 100644
index 0000000..6c8824e
--- /dev/null
+++ b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_datacard.c
@@ -0,0 +1,204 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * usbc_custom_mode_datacard.c
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   
+ *
+ * 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!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#include "usbc_custom.h"
+#include "usbc_custom_def.h"
+#include "dcl.h"
+/*uart_port_usb3 uart_port_usb4 uart_port_usb5 for AP use*/
+static usb_mode_param_t usbmode_datacard_customized_mode1 = 
+{
+#ifndef __USB_RNDIS_SUPPORT__
+    0x0e8d, 
+    0x00AD, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 2, {USB_CLASS_ACM2, USB_CLASS_ACM2}, 
+             {(void*)uart_port_usb6, (void*)uart_port_usb2}, 
+             {0x22, 0x22},
+             {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } ,
+#elif defined __USB_MSD_SUPPORT__
+    0x0e8d, 
+    0x7127, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 10, {USB_CLASS_RNDIS, USB_CLASS_ACM1, USB_CLASS_ACM1, 
+USB_CLASS_ACM1, USB_CLASS_ADB, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1
+, USB_CLASS_ACM1, USB_CLASS_MS}, 
+            {(void*)0x100, (void*)uart_port_usb3, (void*)uart_port_usb4, (
+void*)uart_port_usb5,(void*)0x101,(void*)uart_port_usb, (void*)uart_port_usb6
+, (void*)uart_port_usb7, 
+            (void*)uart_port_usb2, (void*)0}, 
+            {0x33, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x22, 0x11},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,
+USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,
+USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD, USB_CLASS_OWNER_AP}
+        } 
+    },
+#else
+    0x0e8d, 
+    0x7127, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 9, {USB_CLASS_RNDIS, USB_CLASS_ACM1, USB_CLASS_ACM1, 
+USB_CLASS_ACM1 , USB_CLASS_ADB, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1
+, USB_CLASS_ACM1}, 
+            {(void*)0x100, (void*)uart_port_usb3, (void*)uart_port_usb4, (
+void*)uart_port_usb5,(void*)0x101,(void*)uart_port_usb, (void*)uart_port_usb6
+, (void*)uart_port_usb7, (void*)uart_port_usb2}, 
+            {0x33, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x22},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,
+USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,
+USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD}
+        } 
+    },
+#endif
+    USB_MODE_VENDER1,
+    0,
+};
+
+static usb_mode_param_t usbmode_datacard_customized_mode2 = 
+{
+#ifndef __USB_MBIM_SUPPORT__
+    0x0e8d, 
+    0x00AD, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 2, {USB_CLASS_ACM2, USB_CLASS_ACM2}, 
+             {(void*)uart_port_usb6, (void*)uart_port_usb2}, 
+             {0x22, 0x22},
+             {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } ,
+#elif defined __USB_MSD_SUPPORT__
+    0x0e8d, 
+    0x7129, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 10, {USB_CLASS_MBIM, USB_CLASS_ACM1, USB_CLASS_ACM1, 
+USB_CLASS_ACM1, USB_CLASS_ADB, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1
+, USB_CLASS_ACM1, USB_CLASS_MS}, 
+            {(void*)0x100, (void*)uart_port_usb3, (void*)uart_port_usb4, (
+void*)uart_port_usb5,(void*)0x101,(void*)uart_port_usb, (void*)uart_port_usb6
+, (void*)uart_port_usb7, 
+            (void*)uart_port_usb2, (void*)0}, 
+            {0x33, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x22, 0x11},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,
+USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,
+USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD, USB_CLASS_OWNER_AP}
+        } 
+    },
+#else
+    0x0e8d, 
+    0x7129, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 9, {USB_CLASS_MBIM, USB_CLASS_ACM1, USB_CLASS_ACM1, 
+USB_CLASS_ACM1 , USB_CLASS_ADB, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1
+, USB_CLASS_ACM1}, 
+            {(void*)0x100, (void*)uart_port_usb3, (void*)uart_port_usb4, (
+void*)uart_port_usb5,(void*)0x101,(void*)uart_port_usb, (void*)uart_port_usb6
+, (void*)uart_port_usb7, (void*)uart_port_usb2}, 
+            {0x33, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x22},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,
+USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,
+USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD}
+        } 
+    },
+#endif
+    USB_MODE_VENDER1,
+    1,
+
+};
+
+void usb_mode_customization_register()
+{
+#if defined(MT6880)
+    usb_register_mode_param(&usbmode_datacard_customized_mode1);
+    usb_register_mode_param(&usbmode_datacard_customized_mode2);
+#endif
+    return;
+}
+
+
diff --git a/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_factory.c b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_factory.c
new file mode 100644
index 0000000..27c957b
--- /dev/null
+++ b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_factory.c
@@ -0,0 +1,110 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * usbc_custom_mode_factory.c
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   
+ *
+ * Author:
+ * -------
+ * 
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#include "usbc_custom.h"
+#include "usbc_custom_def.h"
+#include "dcl.h"
+
+static usb_mode_param_t usbmode_factory_mode = 
+{
+#if defined(MT6880)
+    0x0e8d, 
+    0x7128, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 7, {USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1}, 
+            {(void*)uart_port_usb2, (void*)uart_port_usb3,(void*)uart_port_usb4, (void*)uart_port_usb5,(void*)uart_port_usb8, (void*)uart_port_usb, (void*)uart_port_usb6}, 
+            {0x22, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_AP,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD}
+        } 
+    },
+    0,0,
+#else
+    0
+#endif
+};
+
+void usb_mode_factory_register()
+{
+    usb_register_mode_param(&usbmode_factory_mode);
+    return ;
+}
+
+kal_uint16 usb_get_factory_mode_pid()
+{
+    return usbmode_factory_mode.product_id;
+}
+
+kal_bool usb_get_factory_mode_support()
+{
+#if defined(MT6880)
+    return KAL_TRUE;
+#else
+    return KAL_FALSE;
+#endif
+}
diff --git a/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_inusj.c b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_inusj.c
new file mode 100644
index 0000000..d098521
--- /dev/null
+++ b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_inusj.c
@@ -0,0 +1,109 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * usbc_custom_mode_inusj.c
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   
+ *
+ * Author:
+ * -------
+ * 
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#include "usbc_custom.h"
+#include "usbc_custom_def.h"
+#include "dcl.h"
+
+extern usb_mode_param_t usbmode_meta_dbg_com;
+
+static usb_mode_param_t usbmode_ks_iodt_1r3c = 
+{
+#ifndef __USB_RNDIS_SUPPORT__
+    0x0e8d, 
+    0x00AD, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 2, {USB_CLASS_ACM2, USB_CLASS_ACM2}, 
+             {(void*)uart_port_usb6, (void*)uart_port_usb2}, 
+             {0x22, 0x22},
+             {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } 
+#else
+    0x0e8d, 
+    0x7104, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 4, {USB_CLASS_RNDIS, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1}, 
+            {(void*)0x100, (void*)uart_port_usb, (void*)uart_port_usb5, (void*)uart_port_usb2}, 
+            {0x44, 0x11, 0x11, 0x11},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } 
+#endif
+};
+
+void usb_mode_inusj_register()
+{
+    usb_register_mode_param(&usbmode_ks_iodt_1r3c);
+    return ;
+}
+
diff --git a/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_qeznk.c b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_qeznk.c
new file mode 100644
index 0000000..52a9de1
--- /dev/null
+++ b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_qeznk.c
@@ -0,0 +1,169 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * usbc_custom_mode_qeznk.c
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   
+ *
+ * Author:
+ * -------
+ * 
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#include "usbc_custom.h"
+#include "usbc_custom_def.h"
+#include "dcl.h"
+
+extern usb_mode_param_t usbmode_meta_dbg_com;
+
+static usb_mode_param_t usbmode_rndis_dbg_com  = 
+{
+#ifndef __USB_RNDIS_SUPPORT__
+    0x0e8d, 
+    0x00AD, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 2, {USB_CLASS_ACM2, USB_CLASS_ACM2}, 
+             {(void*)uart_port_usb6, (void*)uart_port_usb2}, 
+             {0x22, 0x22},
+             {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } 
+#else
+    0x0e8d, 
+    0x7123, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 2, {USB_CLASS_RNDIS, USB_CLASS_ACM1}, 
+            {(void*)0x100, (void*)uart_port_usb2}, 
+            {0x55, 0x22},            
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } 
+#endif
+};
+
+static usb_mode_param_t usbmode_1r4c  = 
+{
+#ifndef __USB_RNDIS_SUPPORT__
+        0x0e8d, 
+        0x00AD, 
+        0xEF, 0x02, 0x01, 
+        1, 
+        { 
+            { 2, {USB_CLASS_ACM2, USB_CLASS_ACM2}, 
+                 {(void*)uart_port_usb6, (void*)uart_port_usb2}, 
+                 {0x22, 0x22},
+                 {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+            } 
+        } 
+#else
+    0x0e8d, 
+    0x7124, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 5, {USB_CLASS_RNDIS, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1}, 
+            {(void*)0x100, (void*)uart_port_usb, (void*)uart_port_usb4, (void*)uart_port_usb6, (void*)uart_port_usb2}, 
+            {0x45, 0x11, 0x11, 0x11, 0x22},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD}
+        } 
+    } 
+#endif
+};
+
+static usb_mode_param_t usbmode_1r5c  = 
+{
+#ifndef __USB_RNDIS_SUPPORT__
+        0x0e8d, 
+        0x00AD, 
+        0xEF, 0x02, 0x01, 
+        1, 
+        { 
+            { 2, {USB_CLASS_ACM2, USB_CLASS_ACM2}, 
+                 {(void*)uart_port_usb6, (void*)uart_port_usb2}, 
+                 {0x22, 0x22},
+                 {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+            } 
+        } 
+#else
+    0x0e8d, 
+    0x7125, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 6, {USB_CLASS_RNDIS, USB_CLASS_ACM3, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1, USB_CLASS_ACM1}, 
+            {(void*)0x100, (void*)uart_port_usb3, (void*)uart_port_usb, (void*)uart_port_usb4, (void*)uart_port_usb6, (void*)uart_port_usb2}, 
+            {0x22, 0x11, 0x11, 0x11, 0x11, 0x11},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } 
+#endif
+};
+
+void usb_mode_qeznk_register()
+{  
+    usb_register_mode_param(&usbmode_1r5c);
+    usb_register_mode_param(&usbmode_1r4c);
+    usb_register_mode_param(&usbmode_rndis_dbg_com);
+    return ;
+}
+
diff --git a/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_ufpm.c b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_ufpm.c
new file mode 100644
index 0000000..cffaf2e
--- /dev/null
+++ b/mcu/custom/middleware/common/usbc_custom_mode/usbc_custom_mode_ufpm.c
@@ -0,0 +1,109 @@
+/*****************************************************************************
+*  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) 2005
+*
+*  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:
+ * ---------
+ * usbc_custom_mode_ufpm.c
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   
+ *
+ * Author:
+ * -------
+ * 
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#include "usbc_custom.h"
+#include "usbc_custom_def.h"
+#include "dcl.h"
+
+extern usb_mode_param_t usbmode_meta_dbg_com;
+
+static usb_mode_param_t usbmode_ufpm = 
+{
+#ifndef __USB_RNDIS_SUPPORT__
+        0x0e8d, 
+        0x00AD, 
+        0xEF, 0x02, 0x01, 
+        1, 
+        { 
+            { 2, {USB_CLASS_ACM2, USB_CLASS_ACM2}, 
+                 {(void*)uart_port_usb6, (void*)uart_port_usb2}, 
+                 {0x22, 0x22},
+                 {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+            } 
+        } 
+#else
+    0x0e8d, 
+    0x0000, 
+    0xEF, 0x02, 0x01, 
+    1, 
+    { 
+        { 2, {USB_CLASS_RNDIS, USB_CLASS_ACM1}, 
+            {(void*)0x100, (void*)uart_port_usb_sp_direct}, 
+            {0x55, 0x12},
+            {USB_CLASS_OWNER_MD,USB_CLASS_OWNER_MD} 
+        } 
+    } 
+#endif
+};
+
+void usb_mode_ufpm_register()
+{
+    usb_register_mode_param(&usbmode_ufpm);
+    return ;
+}
+