[Feature]Upload Modem source code
Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/custom/modem/common/custom_ecc.c b/mcu/custom/modem/common/custom_ecc.c
new file mode 100644
index 0000000..8018658
--- /dev/null
+++ b/mcu/custom/modem/common/custom_ecc.c
@@ -0,0 +1,1362 @@
+/*****************************************************************************
+* 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) 2009
+*
+* 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_ecc.c
+ *
+ * Project:
+ * --------
+ * MAUI
+ *
+ * Description:
+ * ------------
+ * This file contains ECC function.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *==============================================================================
+ *******************************************************************************/
+
+#include "kal_public_api.h"
+#include "kal_general_types.h"
+#include "kal_public_defs.h" //MSBB change #include "stack_config.h"
+#include "string.h"
+#include "sim_common_enums.h" /* SIM data type */
+#include "smu_common_enums.h"
+#include "sim_public_api.h"
+#include "custom_ecc.h"
+#include "ps_public_utility.h"
+#include "phb_utils.h"
+
+#define MAX_DIAL_PAD (81)
+#define ENCODING_LENGTH 2
+
+extern kal_uint8 phb_map_sim(kal_uint8 sim);
+
+//extern sim_interface_enum l4c_gemini_get_switched_sim_id(sim_interface_enum simId);
+
+
+/* ECC buffers */
+/* The last word means whether this entry should be regarded as emergency call if SIM card is present */
+/* 0: ECC only if no SIM, 1: ECC always */
+const kal_uint16 ecc_default_num[ ][ECC_CUSTOM_DEFAULT_ECC_LENGTH + 1] =
+{
+ {0x0031, 0x0031, 0x0032, 0x0000, 1}, /* 112 */
+ {0x0039, 0x0031, 0x0031, 0x0000, 1}, /* 911 */
+#ifdef __MEXICO_ECC__
+ {0x0030, 0x0038, 0x0030, 0x0000, 1}, /* 080 */
+ {0x0030, 0x0036, 0x0030, 0x0000, 1}, /* 060 */
+#endif /* __MEXICO_ECC__ */
+#ifdef __RUSSIA_ECC__
+ {0x0030, 0x0031, 0x0000, 0x0000, 1}, /* 01 */
+ {0x0030, 0x0032, 0x0000, 0x0000, 1}, /* 02 */
+ {0x0030, 0x0033, 0x0000, 0x0000, 1}, /* 03 */
+ {0x0030, 0x0030, 0x0031, 0x0000, 1}, /* 001 */
+ {0x0030, 0x0030, 0x0032, 0x0000, 1}, /* 002 */
+ {0x0030, 0x0030, 0x0033, 0x0000, 1}, /* 003 */
+#endif /* __RUSSIA_ECC__ */
+#ifdef __PHILIPPINES_ECC__
+ {0x0031, 0x0031, 0x0037, 0x0000, 1}, /* 117 */
+#endif /* __PHILIPPINES_ECC__ */
+#ifdef __BRAZIL_ECC__
+ {0x0031, 0x0039, 0x0030, 0x0000, 1}, /* 190 */
+#endif /* __BRAZIL_ECC__ */
+#ifdef __PAKISTAN_ECC__
+ {0x0031, 0x0035, 0x0000, 0x0000, 0}, /* 15 */
+ {0x0031, 0x0031, 0x0035, 0x0000, 0}, /* 115 */
+#endif /* __PAKISTAN_ECC__ */
+#if defined(__OP01__) || defined(__OP02__) || defined(__OP09__) || defined(__CTA_ECC_SUPPORT__)
+ {0x0031, 0x0032, 0x0030, 0x0000, 0}, /* 120 */
+ {0x0031, 0x0032, 0x0032, 0x0000, 0}, /* 122 */
+#endif
+#if defined(__CPHS__) && defined(__CPHS_NUM_999_AS_ECC__)
+ {0x0039, 0x0039, 0x0039, 0x0000, 1}, /* 999 */
+#else
+ {0x0039, 0x0039, 0x0039, 0x0000, 0}, /* 999 */
+#endif
+ {0x0030, 0x0030, 0x0030, 0x0000, 0}, /* 000 */
+ {0x0031, 0x0031, 0x0030, 0x0000, 0}, /* 110 */
+ {0x0031, 0x0031, 0x0038, 0x0000, 0}, /* 118 */
+ {0x0031, 0x0031, 0x0039, 0x0000, 0}, /* 119 */
+ {0x0030, 0x0038, 0x0000, 0x0000, 0}, /* 08 */
+ {0x0000, 0x0000, 0x0000, 0x0000, 0}
+};
+
+const kal_uint16 ecc_3gpp_num[ ][ECC_CUSTOM_DEFAULT_ECC_LENGTH + 1] =
+{
+ {0x0031, 0x0031, 0x0032, 0x0000, 1}, /* 112 */
+ {0x0039, 0x0031, 0x0031, 0x0000, 1}, /* 911 */
+ {0x0039, 0x0039, 0x0039, 0x0000, 0}, /* 999 */
+ {0x0030, 0x0030, 0x0030, 0x0000, 0}, /* 000 */
+ {0x0031, 0x0031, 0x0030, 0x0000, 0}, /* 110 */
+ {0x0031, 0x0031, 0x0038, 0x0000, 0}, /* 118 */
+ {0x0031, 0x0031, 0x0039, 0x0000, 0}, /* 119 */
+ {0x0030, 0x0038, 0x0000, 0x0000, 0}, /* 08 */
+ {0x0000, 0x0000, 0x0000, 0x0000, 0}
+};
+
+const fdn_ecc_struct fdn_ecc_as_normal[] =
+{
+ // ecc number is encode as BCD format
+ // {length of ecc string, BCD[0], BCD[1], BCD[2], MCCMNC string}
+ // example: 123
+ // length of 123 --> 3
+ // BCD[0] = 0x21
+ // BCD[1] = 0xf3
+ // BCD[2] = 0xff
+ // MCCMNC = "46000"
+#ifdef __UMTS_TDD128_MODE__
+ {3, 0x00, 0xF0, 0xFF, "46000"},
+ {2, 0x80, 0xFF, 0xFF, "46000"},
+ {3, 0x11, 0xF0, 0xFF, "46000"},
+ {3, 0x21, 0xF0, 0xFF, "46000"},
+ {3, 0x11, 0xF8, 0xFF, "46000"},
+ {3, 0x11, 0xF9, 0xFF, "46000"},
+ {3, 0x99, 0xF9, 0xFF, "46000"},
+ {3, 0x11, 0xF1, 0xFF, "46000"},
+ {3, 0x11, 0xF7, 0xFF, "46000"},
+ {0, 0xFF, 0xFF, 0xFF, "00000"} // do not modify this row
+#else
+ {3, 0x11, 0xF7, 0xFF, "46000"},
+ {0, 0xFF, 0xFF, 0xFF, "00000"} // do not modify this row
+#endif
+};
+
+const kal_uint16 * ecc_default_num_p = (kal_uint16 *)ecc_default_num;
+
+static ecc_record_struct ecc_sim1_number[ECC_CUSTOM_MAX_SIM_RECORD];
+static ecc_record_struct ecc_nw1_number[ECC_CUSTOM_MAX_NW_RECORD];
+#if defined(__GEMINI__)
+static ecc_record_struct ecc_sim2_number[ECC_CUSTOM_MAX_SIM_RECORD];
+static ecc_record_struct ecc_nw2_number[ECC_CUSTOM_MAX_NW_RECORD];
+#if (GEMINI_PLUS >= 3) // Gemini+
+static ecc_record_struct ecc_sim3_number[ECC_CUSTOM_MAX_SIM_RECORD];
+static ecc_record_struct ecc_nw3_number[ECC_CUSTOM_MAX_NW_RECORD];
+#if (GEMINI_PLUS >= 4) // Gemini+
+static ecc_record_struct ecc_sim4_number[ECC_CUSTOM_MAX_SIM_RECORD];
+static ecc_record_struct ecc_nw4_number[ECC_CUSTOM_MAX_NW_RECORD];
+#endif
+#endif
+#endif /* __GEMINI__ */
+static ecc_record_struct ecc_nvram_number[ECC_CUSTOM_MAX_NVRAM_RECORD];
+
+static kal_uint8 ecc_empty_display_buffer[ENCODING_LENGTH] = {0};
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_decode_bcd_2_ansii
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ *
+ * RETURNS
+ * void
+ *****************************************************************************/
+void ecc_custom_decode_bcd_2_ansii(kal_uint8 *ecc_asnii, kal_uint8 *ecc_bcd)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ //if (length >= 1) refer to MOLY00295103
+ {
+ *(ecc_asnii + 0) = (*(ecc_bcd + 0) & 0x0F) == 0x0F ? 0 : (kal_uint8) (0x30 + ( *(ecc_bcd + 0) & 0x0F));
+ *(ecc_asnii + 1) = (*(ecc_bcd + 0) & 0xF0) == 0xF0 ? 0 : (kal_uint8) (0x30 + ((*(ecc_bcd + 0) & 0xF0) >> 4));
+ }
+
+ //if (length >= 2)
+ {
+ *(ecc_asnii + 2) = (*(ecc_bcd + 1) & 0x0F) == 0x0F ? 0 : (kal_uint8) (0x30 + ( *(ecc_bcd + 1) & 0x0F));
+ *(ecc_asnii + 3) = (*(ecc_bcd + 1) & 0xF0) == 0xF0 ? 0 : (kal_uint8) (0x30 + ((*(ecc_bcd + 1) & 0xF0) >> 4));
+ }
+
+ //if (length >= 3)
+ {
+ *(ecc_asnii + 4) = (*(ecc_bcd + 2) & 0x0F) == 0x0F ? 0 : (kal_uint8) (0x30 + ( *(ecc_bcd + 2) & 0x0F));
+ *(ecc_asnii + 5) = (*(ecc_bcd + 2) & 0xF0) == 0xF0 ? 0 : (kal_uint8) (0x30 + ((*(ecc_bcd + 2) & 0xF0) >> 4));
+ }
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_bcd_digit_2_char
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ *
+ * RETURNS
+ * char
+ *****************************************************************************/
+static char ecc_custom_bcd_digit_2_char(kal_uint8 digit)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ /* Re-assign the value of BCD encoding numbers */
+ if (digit < 0xa)
+ {
+ return ('0' + digit);
+ }
+ else if (digit == 0xa)
+ {
+ return '*';
+ }
+ else if (digit == 0xb)
+ {
+ return '#';
+ }
+ else if (digit == 0xc)
+ {
+ return 'p';
+ }
+ else if (digit == 0xd)
+ {
+ return 'w';
+ }
+ else
+ {
+ return (char)0xFF;
+ }
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_bcd_2_string
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ *
+ * RETURNS
+ * void
+ *****************************************************************************/
+static void ecc_custom_bcd_2_string(kal_uint8 *bcd_array, kal_uint16 size, char *buf, kal_uint16 buf_size)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ kal_uint8 i, j = 0;
+ char digit;
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ if (bcd_array == NULL || size == 0 || buf == NULL || buf_size == 0)
+ {
+ return;
+ }
+
+ memset(buf, 0x0, buf_size);
+ if ((bcd_array[0] & 0xF0) == 0x90)
+ {
+ buf[j++] = '+';
+ }
+
+ for (i = 1; i < size && j < buf_size - 1; i++)
+ {
+ if (j < buf_size - 1)
+ {
+ digit = ecc_custom_bcd_digit_2_char((kal_uint8)(bcd_array[i] & 0x0F));
+ if (digit == (char)0xFF)
+ {
+ return;
+ }
+ buf[j] = digit;
+ j++;
+ }
+ if (j < buf_size - 1)
+ {
+ digit = ecc_custom_bcd_digit_2_char((kal_uint8)((bcd_array[i] >> 4) & 0x0F));
+ if (digit == (char)0xFF)
+ {
+ return;
+ }
+ buf[j] = digit;
+ j++;
+ }
+ }
+
+ buf[j] = 0;
+}
+
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_str_n_to_ucs2_str
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ *
+ * RETURNS
+ * kal_uint16
+ *****************************************************************************/
+static kal_uint16 ecc_custom_str_n_to_ucs2_str(kal_int8 *pOutBuffer, kal_int8 *pInBuffer, kal_uint32 len)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ kal_int16 count = -1;
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ while (len)
+ {
+ pOutBuffer[++count] = *pInBuffer;
+ pOutBuffer[++count] = 0;
+
+ if (*pInBuffer == '\0')
+ {
+ break;
+ }
+ else
+ {
+ len--;
+ pInBuffer++;
+ }
+ }
+
+ return count + 1;
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_prepare_number
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ *
+ * RETURNS
+ * void
+ *****************************************************************************/
+static void ecc_custom_prepare_number(kal_uint8 *ecc_out, kal_uint8 *ecc_in, ecc_num_encoding_enum ecc_encoding)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ kal_uint8 ecc_tmp[ECC_CUSTOM_MAX_BCD_LENGTH * 2 + 1] = {0};
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ memset(ecc_out, 0, (ECC_CUSTOM_MAX_BCD_LENGTH * 2 + 1) * ENCODING_LENGTH);
+
+ switch (ecc_encoding)
+ {
+ case ECC_ENCODING_ANSII:
+ ecc_custom_str_n_to_ucs2_str((kal_int8*) ecc_out, (kal_int8*) ecc_in, ECC_CUSTOM_MAX_BCD_LENGTH * 2);
+ break;
+ case ECC_ENCODING_UCS2:
+ kal_dchar_strncpy((char*) ecc_out, (char*) ecc_in, ECC_CUSTOM_MAX_BCD_LENGTH * 4);
+ break;
+ case ECC_ENCODING_BCD:
+ ecc_custom_decode_bcd_2_ansii(ecc_tmp, ecc_in);
+ ecc_custom_str_n_to_ucs2_str((kal_int8*) ecc_out, (kal_int8*) ecc_tmp, ECC_CUSTOM_MAX_BCD_LENGTH * 2);
+ break;
+ default:
+ break;
+ }
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_get_sim_context
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ *
+ * RETURNS
+ * ecc_record_struct *
+ *****************************************************************************/
+static ecc_record_struct *ecc_custom_get_sim_context(kal_uint8 entry_index, kal_uint8 sim_index)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ sim_index = ECC_SIM1_CALL + phb_map_sim(sim_index - ECC_SIM1_CALL);
+
+ if (sim_index == ECC_SIM1_CALL)
+ {
+ return &(ecc_sim1_number[entry_index]);
+ }
+#if defined(__GEMINI__)
+ else if (sim_index == ECC_SIM2_CALL)
+ {
+ return &(ecc_sim2_number[entry_index]);
+ }
+#if (GEMINI_PLUS >= 3) // Gemini+
+ else if (sim_index == ECC_SIM3_CALL)
+ {
+ return &(ecc_sim3_number[entry_index]);
+ }
+#if (GEMINI_PLUS >= 4) // Gemini+
+ else if (sim_index == ECC_SIM4_CALL)
+ {
+ return &(ecc_sim4_number[entry_index]);
+ }
+#endif
+#endif
+#endif /* __GEMINI__ */
+ else
+ {
+ return NULL;
+ }
+}
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_get_nw_context
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ *
+ * RETURNS
+ * ecc_record_struct *
+ *****************************************************************************/
+static ecc_record_struct *ecc_custom_get_nw_context(kal_uint8 entry_index, kal_uint8 sim_index)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ sim_index = ECC_SIM1_CALL + phb_map_sim(sim_index - ECC_SIM1_CALL);
+
+ if (sim_index == ECC_SIM1_CALL)
+ {
+ return &(ecc_nw1_number[entry_index]);
+ }
+#if defined(__GEMINI__)
+ else if (sim_index == ECC_SIM2_CALL)
+ {
+ return &(ecc_nw2_number[entry_index]);
+ }
+#if (GEMINI_PLUS >= 3) // Gemini+
+ else if (sim_index == ECC_SIM3_CALL)
+ {
+ return &(ecc_nw3_number[entry_index]);
+ }
+#if (GEMINI_PLUS >= 4) // Gemini+
+ else if (sim_index == ECC_SIM4_CALL)
+ {
+ return &(ecc_nw4_number[entry_index]);
+ }
+#endif
+#endif
+#endif /* __GEMINI__ */
+ else
+ {
+ return NULL;
+ }
+}
+
+static kal_bool ecc_custom_is_sim_inserted(sim_interface_enum sim_id)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+#if defined(__GEMINI__)
+ if (check_sim_card_status(sim_id) == SIM_CARD_NOT_INSERTED)
+#else
+ if (check_sim_card_status() == SIM_CARD_NOT_INSERTED)
+#endif
+ {
+ return KAL_FALSE;
+ }
+ else if (l4csmu_get_pending_password_id_ext(sim_id) == ID_SIM_PIN1 || l4csmu_get_pending_password_id_ext(sim_id) == ID_SIM_PUK1)
+ {
+ return KAL_FALSE;
+ }
+ else
+ {
+ return KAL_TRUE;
+ }
+}
+
+
+static kal_uint8 ecc_custom_is_sim_with_ecc_num(ecc_call_type_enum call_type, kal_bool ecc_always)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ kal_uint8 sim_with_ecc_num_case = 0;
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+#if defined(__GEMINI__)
+ if (call_type == ECC_SIM1_CALL && ecc_custom_is_sim_inserted(SIM1) && !ecc_always)
+ {
+ sim_with_ecc_num_case = 1;
+ }
+ if (call_type == ECC_SIM2_CALL && ecc_custom_is_sim_inserted(SIM2) && !ecc_always)
+ {
+ sim_with_ecc_num_case = 1;
+ }
+#if (GEMINI_PLUS >= 3) // Gemini+
+ if (call_type == ECC_SIM3_CALL && ecc_custom_is_sim_inserted(SIM3) && !ecc_always)
+ {
+ sim_with_ecc_num_case = 1;
+ }
+#if (GEMINI_PLUS >= 4) // Gemini+
+ if (call_type == ECC_SIM4_CALL && ecc_custom_is_sim_inserted(SIM4) && !ecc_always)
+ {
+ sim_with_ecc_num_case = 1;
+ }
+#endif
+#endif
+ if (call_type == ECC_ALL_CALL &&
+ ecc_custom_is_sim_inserted(SIM1) &&
+ ecc_custom_is_sim_inserted(SIM2) &&
+ #if (GEMINI_PLUS >= 3) // Gemini+
+ ecc_custom_is_sim_inserted(SIM3) &&
+ #if (GEMINI_PLUS >= 4) // Gemini+
+ ecc_custom_is_sim_inserted(SIM4) &&
+ #endif
+ #endif
+ !ecc_always)
+ {
+ sim_with_ecc_num_case = 1;
+ }
+#else /* __GEMINI__ */
+ if (ecc_custom_is_sim_inserted(SIM1) && !ecc_always)
+ {
+ sim_with_ecc_num_case = 1;
+ }
+#endif /* __GEMINI__ */
+
+ return sim_with_ecc_num_case;
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_verify_emergency_number_with_suffix
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ *
+ * RETURNS
+ * kal_bool
+ *****************************************************************************/
+static kal_bool ecc_custom_verify_emergency_number_with_suffix(kal_uint8 *in_number, kal_uint8 *ecc_number)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ kal_uint8 ecc_default_num_ext[16];
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ if (kal_dchar_strlen((char*) ecc_number) == 0)
+ {
+ return KAL_FALSE;
+ }
+
+ /* Additional check for p or w after emergency call */
+ kal_dchar_strcpy((char*) ecc_default_num_ext, (char*) ecc_number);
+ kal_dchar_strcat((char*) ecc_default_num_ext, (char*) L"p");
+ if (kal_dchar_strncmp((char*) in_number, (char*) ecc_default_num_ext, kal_dchar_strlen((char*) ecc_default_num_ext)) == 0)
+ {
+ return KAL_TRUE;
+ }
+
+ kal_dchar_strcpy((char*) ecc_default_num_ext, (char*) ecc_number);
+ kal_dchar_strcat((char*) ecc_default_num_ext, (char*) L"w");
+ if (kal_dchar_strncmp((char*) in_number, (char*) ecc_default_num_ext, kal_dchar_strlen((char*) ecc_default_num_ext)) == 0)
+ {
+ return KAL_TRUE;
+ }
+
+ /* diamond, 2006/05/12 Additional check for + after emergency call */
+ kal_dchar_strcpy((char*) ecc_default_num_ext, (char*) ecc_number);
+ kal_dchar_strcat((char*) ecc_default_num_ext, (char*) L"+");
+ if (kal_dchar_strncmp((char*) in_number, (char*) ecc_default_num_ext, kal_dchar_strlen((char*) ecc_default_num_ext)) == 0 &&
+ kal_dchar_strncmp((char*) (in_number + (kal_dchar_strlen((char*) in_number) - 2)), (char*) L"#", 2) != 0)
+ {
+ return KAL_TRUE;
+ }
+
+ return KAL_FALSE;
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_verify_emergency_number
+ * DESCRIPTION
+ * Verify calling number from ECC pool
+ * PARAMETERS
+ * number [IN] verified ECC number
+ * num_length [IN] verified ECC number length
+ * num_encoding [IN] verified ECC number coding scheme
+ * call_type [IN] verified ECC number call type
+ * ecc_category [OUT] returned verified ECC number category (REL5 only)
+ * ecc_display [OUT] returned verified ECC number display string (REL5 only)
+ * verify_detail [OUT] returned match detail
+ * RETURNS
+ * kal_bool
+ *****************************************************************************/
+kal_bool ecc_custom_verify_emergency_number(
+ kal_uint8 *number,
+ kal_uint8 num_length,
+ ecc_num_encoding_enum num_encoding,
+ ecc_call_type_enum call_type,
+ kal_uint8 *ecc_category,
+ kal_uint8 **ecc_display,
+ kal_uint8 *verify_detail)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+#if 0
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+ kal_uint16 ecc_additional_check_number[2][4] =
+ {
+ {0x002A, 0x0033, 0x0031, 0x0023}, /* prefix = *31# */
+ {0x0023, 0x0033, 0x0031, 0x0023} /* prefix = #31# */
+ };
+
+ kal_uint16 ecc_sat_number[] = {0x0031, 0x0031, 0x0032, 0x0000};
+
+ kal_uint8 ecc_buffer[MAX_DIAL_PAD * ENCODING_LENGTH] = {0};
+ kal_uint8 ecc_tmp[MAX_DIAL_PAD] = {0};
+ kal_uint8 *ecc_verify;
+ kal_uint8 i, j;
+ kal_uint8 sim_with_ecc_num_case = 0;
+ sim_interface_enum sim_id;
+
+#ifdef GEMINI_PLUS
+ kal_uint8 loop_count = GEMINI_PLUS;
+#else
+ kal_uint8 loop_count = 1;
+#endif
+
+ ecc_record_struct *sim_context;
+ ecc_record_struct *nw_context;
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+
+ /* default response data */
+ if (ecc_category != NULL)
+ {
+ *ecc_category = 0;
+ }
+
+ if (ecc_display != NULL)
+ {
+ *ecc_display = &ecc_empty_display_buffer[0];
+ }
+
+ if (verify_detail != NULL)
+ {
+ *verify_detail = ECC_NOT_MATCH;
+ }
+
+ switch (num_encoding)
+ {
+ case ECC_ENCODING_ANSII:
+ ecc_custom_str_n_to_ucs2_str((kal_int8*) ecc_buffer, (kal_int8*) number, MAX_DIAL_PAD - 1);
+ break;
+ case ECC_ENCODING_UCS2:
+ kal_dchar_strncpy((char*) ecc_buffer, (char*) number, (MAX_DIAL_PAD - 1) * ENCODING_LENGTH);
+ break;
+ case ECC_ENCODING_BCD:
+ ecc_custom_bcd_2_string(number, num_length, (char*) ecc_tmp, MAX_DIAL_PAD);
+ ecc_custom_str_n_to_ucs2_str((kal_int8*) ecc_buffer, (kal_int8*) ecc_tmp, MAX_DIAL_PAD - 1);
+ break;
+ default:
+ return KAL_FALSE;
+ }
+
+ if (kal_dchar_strlen((char*) ecc_buffer) == 0)
+ {
+ return KAL_FALSE;
+ }
+
+ /* Additional check for *31# and #31# before emergency call */
+ /* Additional check for + before emergency call */
+#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 !*/
+#endif
+ if ((kal_dchar_strncmp((char*) ecc_buffer, (char*) ecc_additional_check_number[0], 8) == 0) ||
+ (kal_dchar_strncmp((char*) ecc_buffer, (char*) ecc_additional_check_number[1], 8) == 0))
+ {
+ ecc_verify = ecc_buffer + 8;
+ }
+ else
+ {
+ ecc_verify = ecc_buffer;
+ }
+
+ if (kal_dchar_strlen((char*) ecc_verify) == 0)
+ {
+ return KAL_FALSE;
+ }
+
+ if (call_type == ECC_SAT_CALL)
+ {
+ if (kal_dchar_strcmp((char*) ecc_verify, (char*) ecc_sat_number) == 0)
+ {
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ return KAL_TRUE;
+ }
+ else
+ {
+ return KAL_FALSE;
+ }
+ }
+
+ if(sbp_query_md_feature_by_ps(SBP_KOR_CUSTOMIZATION, (protocol_id_enum)phb_which_sim_ex()) == KAL_TRUE)
+ {
+ /* Korea Operator Requirements : NW_ECC is as 1st priority */
+ /* verify NW record second */
+ for (j = ECC_SIM1_CALL; j < loop_count; j++)
+ {
+ if (call_type != j && call_type != ECC_ALL_CALL)
+ {
+ continue;
+ }
+
+ for (i = 0; i < ECC_CUSTOM_MAX_NW_RECORD; i++)
+ {
+ //#ifdef __GEMINI_3G_SWITCH__
+ // sim_id = l4c_gemini_get_switched_sim_id(j);
+ //#else
+ sim_id = j;
+ //#endif
+ nw_context = ecc_custom_get_nw_context(i, sim_id);
+
+ if (kal_dchar_strcmp((char*) ecc_verify, (char*) nw_context->ecc_number) == 0)
+ {
+ if (ecc_category != NULL) *ecc_category = nw_context->ecc_category;
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ return KAL_TRUE;
+ }
+
+ if (ecc_custom_verify_emergency_number_with_suffix(ecc_verify, nw_context->ecc_number))
+ {
+ if (ecc_category != NULL) *ecc_category = nw_context->ecc_category;
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ return KAL_TRUE;
+ }
+
+ if (verify_detail != NULL && kal_dchar_strncmp((char*) nw_context->ecc_number, (char*) ecc_verify, kal_dchar_strlen((char*) ecc_verify)) == 0)
+ {
+ *verify_detail = ECC_PARTIALLY_MATCH;
+ }
+ }
+ }
+
+ /* verify SIM record first */
+ for (j = ECC_SIM1_CALL; j < loop_count; j++)
+ {
+ if (call_type != j && call_type != ECC_ALL_CALL)
+ {
+ continue;
+ }
+
+ for (i = 0; i < ECC_CUSTOM_MAX_SIM_RECORD; i++)
+ {
+ //#ifdef __GEMINI_3G_SWITCH__
+ // sim_id = l4c_gemini_get_switched_sim_id(j);
+ //#else
+ sim_id = j;
+ //#endif
+ sim_context = ecc_custom_get_sim_context(i, sim_id);
+
+ if (kal_dchar_strcmp((char*) ecc_verify, (char*) sim_context->ecc_number) == 0)
+ {
+ if (ecc_category != NULL) *ecc_category = sim_context->ecc_category;
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ return KAL_TRUE;
+ }
+
+ if (ecc_custom_verify_emergency_number_with_suffix(ecc_verify, sim_context->ecc_number))
+ {
+ if (ecc_category != NULL) *ecc_category = sim_context->ecc_category;
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ return KAL_TRUE;
+ }
+
+ if (verify_detail != NULL && kal_dchar_strncmp((char*) sim_context->ecc_number, (char*) ecc_verify, kal_dchar_strlen((char*) ecc_verify)) == 0)
+ {
+ *verify_detail = ECC_PARTIALLY_MATCH;
+ }
+ }
+ }
+ }
+ else
+ {
+ /* verify SIM record first */
+ for (j = ECC_SIM1_CALL; j < loop_count; j++)
+ {
+ if (call_type != j && call_type != ECC_ALL_CALL)
+ {
+ continue;
+ }
+
+ for (i = 0; i < ECC_CUSTOM_MAX_SIM_RECORD; i++)
+ {
+ //#ifdef __GEMINI_3G_SWITCH__
+ // sim_id = l4c_gemini_get_switched_sim_id(j);
+ //#else
+ sim_id = j;
+ //#endif
+ sim_context = ecc_custom_get_sim_context(i, sim_id);
+
+ if (kal_dchar_strcmp((char*) ecc_verify, (char*) sim_context->ecc_number) == 0)
+ {
+ if (ecc_category != NULL) *ecc_category = sim_context->ecc_category;
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ return KAL_TRUE;
+ }
+
+ if (ecc_custom_verify_emergency_number_with_suffix(ecc_verify, sim_context->ecc_number))
+ {
+ if (ecc_category != NULL) *ecc_category = sim_context->ecc_category;
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ return KAL_TRUE;
+ }
+
+ if (verify_detail != NULL && kal_dchar_strncmp((char*) sim_context->ecc_number, (char*) ecc_verify, kal_dchar_strlen((char*) ecc_verify)) == 0)
+ {
+ *verify_detail = ECC_PARTIALLY_MATCH;
+ }
+ }
+ }
+
+ /* verify NW record second */
+ for (j = ECC_SIM1_CALL; j < loop_count; j++)
+ {
+ if (call_type != j && call_type != ECC_ALL_CALL)
+ {
+ continue;
+ }
+
+ for (i = 0; i < ECC_CUSTOM_MAX_NW_RECORD; i++)
+ {
+ //#ifdef __GEMINI_3G_SWITCH__
+ // sim_id = l4c_gemini_get_switched_sim_id(j);
+ //#else
+ sim_id = j;
+ //#endif
+ nw_context = ecc_custom_get_nw_context(i, sim_id);
+
+ if (kal_dchar_strcmp((char*) ecc_verify, (char*) nw_context->ecc_number) == 0)
+ {
+ if (ecc_category != NULL) *ecc_category = nw_context->ecc_category;
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ return KAL_TRUE;
+ }
+
+ if (ecc_custom_verify_emergency_number_with_suffix(ecc_verify, nw_context->ecc_number))
+ {
+ if (ecc_category != NULL) *ecc_category = nw_context->ecc_category;
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ return KAL_TRUE;
+ }
+
+ if (verify_detail != NULL && kal_dchar_strncmp((char*) nw_context->ecc_number, (char*) ecc_verify, kal_dchar_strlen((char*) ecc_verify)) == 0)
+ {
+ *verify_detail = ECC_PARTIALLY_MATCH;
+ }
+ }
+ }
+ }
+
+ /* verify NVRAM record next */
+ for (i = 0; i < ECC_CUSTOM_MAX_NVRAM_RECORD; i++)
+ {
+ if (kal_dchar_strcmp((char*) ecc_verify, (char*) ecc_nvram_number[i].ecc_number) == 0)
+ {
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ if (ecc_category != NULL) *ecc_category = ecc_nvram_number[i].ecc_category;
+
+ sim_with_ecc_num_case = ecc_custom_is_sim_with_ecc_num(call_type, ecc_nvram_number[i].ecc_always);
+
+ if (sim_with_ecc_num_case != 0)
+ {
+ sim_with_ecc_num_case = 0;
+ return KAL_FALSE;
+ }
+ return KAL_TRUE;
+ }
+
+ if (ecc_custom_verify_emergency_number_with_suffix(ecc_verify, ecc_nvram_number[i].ecc_number))
+ {
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+ if (ecc_category != NULL) *ecc_category = ecc_nvram_number[i].ecc_category;
+
+ sim_with_ecc_num_case = ecc_custom_is_sim_with_ecc_num(call_type, ecc_nvram_number[i].ecc_always);
+
+ if (sim_with_ecc_num_case != 0)
+ {
+ sim_with_ecc_num_case = 0;
+ return KAL_FALSE;
+ }
+ return KAL_TRUE;
+ }
+
+ if (verify_detail != NULL && kal_dchar_strncmp((char*) ecc_nvram_number[i].ecc_number, (char*) ecc_verify, kal_dchar_strlen((char*) ecc_verify)) == 0)
+ {
+ *verify_detail = ECC_PARTIALLY_MATCH;
+ }
+ }
+
+ /* Korea Operator Requirements not use default number */
+ if(sbp_query_md_feature_by_ps(SBP_KOR_CUSTOMIZATION, (protocol_id_enum)phb_which_sim_ex()) == KAL_TRUE)
+ {
+ return KAL_FALSE;
+ }
+
+ /* verify default record finally */
+ for (i = 0; ecc_default_num_p[i * (ECC_CUSTOM_DEFAULT_ECC_LENGTH + 1)] != 0x00; i++)
+ {
+ sim_with_ecc_num_case = ecc_custom_is_sim_with_ecc_num(call_type, (kal_bool) ecc_default_num_p[i * (ECC_CUSTOM_DEFAULT_ECC_LENGTH + 1 ) + ECC_CUSTOM_DEFAULT_ECC_LENGTH]);
+
+ if (sim_with_ecc_num_case != 0)
+ {
+ sim_with_ecc_num_case = 0;
+ continue;
+ }
+
+ if (kal_dchar_strcmp((char*) ecc_verify, (char*) (ecc_default_num_p + i * (ECC_CUSTOM_DEFAULT_ECC_LENGTH + 1))) == 0)
+ {
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+
+ return KAL_TRUE;
+ }
+
+ if (ecc_custom_verify_emergency_number_with_suffix(ecc_verify, (kal_uint8*) (ecc_default_num_p + i * (ECC_CUSTOM_DEFAULT_ECC_LENGTH + 1))))
+ {
+ if (verify_detail != NULL) *verify_detail = ECC_FULLY_MATCH;
+
+ return KAL_TRUE;
+ }
+
+ if (verify_detail != NULL && kal_dchar_strncmp((char*) (ecc_default_num_p + i * (ECC_CUSTOM_DEFAULT_ECC_LENGTH + 1)), (char*) ecc_verify, kal_dchar_strlen((char*) ecc_verify)) == 0)
+ {
+ *verify_detail = ECC_PARTIALLY_MATCH;
+ }
+ }
+
+ return KAL_FALSE;
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_update_emergency_number
+ * DESCRIPTION
+ * Update ECC pool from applications
+ * PARAMETERS
+ * number [IN] input ECC number
+ * num_encoding [IN] input ECC number coding scheme
+ * ecc_src [IN] input ECC number source
+ * ecc_category [IN] input ECC number category (REL5 only)
+ * ecc_display [IN] input ECC number display string (REL5 only)
+ * index [IN] input ECC number index (ex: 1 ~ 5)
+ * total [IN] input ECC number total (ex: 5)
+ * RETURNS
+ * void
+ *****************************************************************************/
+void ecc_custom_update_emergency_number(
+ kal_uint8 *number,
+ ecc_num_encoding_enum num_encoding,
+ ecc_src_type_enum ecc_src,
+ kal_uint8 ecc_category,
+ kal_uint8 *ecc_display,
+ kal_uint8 index,
+ kal_uint8 total)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ ecc_record_struct *sim_context;
+ ecc_record_struct *nw_context;
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ if (index <= 0 || index > total)
+ {
+ return;
+ }
+
+ if (number != NULL && *number == 0xFF)
+ {
+ return; /* skip invalid entry */
+ }
+
+ switch (ecc_src)
+ {
+ case ECC_SRC_SIM1:
+ #if defined(__GEMINI__)
+ case ECC_SRC_SIM2:
+ #if (GEMINI_PLUS >= 3) // Gemini+
+ case ECC_SRC_SIM3:
+ #if (GEMINI_PLUS >= 4) // Gemini+
+ case ECC_SRC_SIM4:
+ #endif
+ #endif
+ #endif /* __GEMINI__ */
+ sim_context = ecc_custom_get_sim_context(index - 1, ecc_src - ECC_SRC_SIM1);
+ if (number != NULL)
+ {
+ ecc_custom_prepare_number(sim_context->ecc_number, number, num_encoding);
+ sim_context->ecc_category = ecc_category;
+ }
+ break;
+
+ case ECC_SRC_NW1:
+ #if defined(__GEMINI__)
+ case ECC_SRC_NW2:
+ #if (GEMINI_PLUS >= 3) // Gemini+
+ case ECC_SRC_NW3:
+ #if (GEMINI_PLUS >= 4) // Gemini+
+ case ECC_SRC_NW4:
+ #endif
+ #endif
+ #endif /* __GEMINI__ */
+ if (number != NULL)
+ {
+ nw_context = ecc_custom_get_nw_context(index - 1, ecc_src - ECC_SRC_NW1);
+ ecc_custom_prepare_number(nw_context->ecc_number, number, num_encoding);
+ nw_context->ecc_category = ecc_category;
+ }
+ break;
+
+ case ECC_SRC_NVRAM:
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_update_emergency_number
+ * DESCRIPTION
+ * Update ECC pool from applications
+ * PARAMETERS
+ * number [IN] input ECC number
+ * num_encoding [IN] input ECC number coding scheme
+ * ecc_src [IN] input ECC number source
+ * ecc_category [IN] input ECC number category (REL5 only)
+ * ecc_display [IN] input ECC number display string (REL5 only)
+ * index [IN] input ECC number index (ex: 1 ~ 5)
+ * total [IN] input ECC number total (ex: 5)
+ * RETURNS
+ * void
+ *****************************************************************************/
+ecc_update_result_enum ecc_custom_update_emergency_number_ex(
+ kal_uint8 *number,
+ ecc_num_encoding_enum num_encoding,
+ kal_uint8 ecc_category,
+ kal_bool ecc_always)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ kal_uint8 index;
+ kal_uint8 ecc_buffer[(ECC_CUSTOM_MAX_BCD_LENGTH * 2 + 1) * ENCODING_LENGTH] = {0};
+ kal_uint8 ecc_tmp[ECC_CUSTOM_MAX_BCD_LENGTH * 2 + 1] = {0};
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ if (number == NULL)
+ {
+ return ECC_RESULT_INVALID_ENTRY;
+ }
+
+ // for backward compatible
+ ecc_default_num_p = (kal_uint16 *)ecc_3gpp_num;
+
+ switch (num_encoding)
+ {
+ case ECC_ENCODING_ANSII:
+ ecc_custom_str_n_to_ucs2_str((kal_int8*) ecc_buffer, (kal_int8*) number, ECC_CUSTOM_MAX_BCD_LENGTH * 2);
+ break;
+ case ECC_ENCODING_UCS2:
+ kal_dchar_strncpy((char*) ecc_buffer, (char*) number, ECC_CUSTOM_MAX_BCD_LENGTH * 4);
+ break;
+ case ECC_ENCODING_BCD:
+ ecc_custom_decode_bcd_2_ansii(ecc_tmp, number);
+ ecc_custom_str_n_to_ucs2_str((kal_int8*) ecc_buffer, (kal_int8*) ecc_tmp, ECC_CUSTOM_MAX_BCD_LENGTH * 2);
+ break;
+ default:
+ return ECC_RESULT_INVALID_ENTRY;
+ }
+
+ if (kal_dchar_strlen((char*) ecc_buffer) == 0)
+ {
+ return ECC_RESULT_INVALID_ENTRY;
+ }
+
+ for (index = 0; index < ECC_CUSTOM_MAX_NVRAM_RECORD; index++)
+ {
+ if (kal_dchar_strlen((char*) ecc_nvram_number[index].ecc_number) == 0 || kal_dchar_strcmp((char*) ecc_buffer, (char*) ecc_nvram_number[index].ecc_number) == 0)
+ {
+ break;
+ }
+ }
+
+ if (index >= ECC_CUSTOM_MAX_NVRAM_RECORD)
+ {
+ return ECC_RESULT_CAPACITY_EXCEEDED;
+ }
+
+ ecc_custom_prepare_number(ecc_nvram_number[index].ecc_number, number, num_encoding);
+ ecc_nvram_number[index].ecc_category = ecc_category;
+ ecc_nvram_number[index].ecc_always = ecc_always;
+
+ return ECC_RESULT_OK;
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_get_first_2_default_num
+ * DESCRIPTION
+ * Get ECC pool first 2 default items
+ * PARAMETERS
+ * ecc_num1 [IN] return ECC number
+ * ecc_num2 [IN] return ECC number
+ * RETURNS
+ * void
+ *****************************************************************************/
+void ecc_custom_get_first_2_default_num(
+ kal_uint8 **ecc_num1,
+ kal_uint8 **ecc_num2)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ *ecc_num1 = (kal_uint8*) (&ecc_default_num[0][0]);
+ *ecc_num2 = (kal_uint8*) (&ecc_default_num[1][0]);
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_support_enhance_retry
+ * DESCRIPTION
+ * if support ECC enhancement retry, return true
+ * PARAMETERS
+ * RETURNS
+ * kal_bool
+ *****************************************************************************/
+kal_bool ecc_custom_support_enhance_retry(void)
+{
+ kal_bool support;
+
+#ifdef __ECC_RETRY_ENHANCEMENT__
+ support = KAL_TRUE;
+#else
+ support = KAL_FALSE;
+#endif
+
+ return support;
+}
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_reset_sim_context
+ * DESCRIPTION
+ * Update ECC pool from applications
+ * PARAMETERS
+ * ecc_src [IN] input ECC number source
+ * RETURNS
+ * void
+ *****************************************************************************/
+void ecc_custom_reset_sim_context(ecc_src_type_enum ecc_src)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ ecc_record_struct *sim_context;
+ kal_uint8 i;
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ for(i = 0; i < ECC_CUSTOM_MAX_SIM_RECORD; i++)
+ {
+ sim_context = ecc_custom_get_sim_context(i, ecc_src - ECC_SRC_SIM1);
+ kal_mem_set(sim_context, 0, sizeof(ecc_record_struct));
+ }
+
+}
+
+/*****************************************************************************
+ * FUNCTION
+ * ecc_custom_reset_nw_context
+ * DESCRIPTION
+ * Update ECC pool from applications
+ * PARAMETERS
+ * ecc_src [IN] input ECC number source
+ * RETURNS
+ * void
+ *****************************************************************************/
+void ecc_custom_reset_nw_context(ecc_src_type_enum ecc_src)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ ecc_record_struct *nw_context;
+ kal_uint8 i;
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ for(i = 0; i < ECC_CUSTOM_MAX_NW_RECORD; i++)
+ {
+ nw_context = ecc_custom_get_nw_context(i, ecc_src - ECC_SRC_NW1);
+ kal_mem_set(nw_context, 0, sizeof(ecc_record_struct));
+ }
+
+}
+
+void ecc_custom_swap_nw_context(void)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+ ecc_record_struct *nw_context1, *nw_context2, temp;
+ kal_uint8 i;
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ for(i = 0; i < ECC_CUSTOM_MAX_NW_RECORD; i++)
+ {
+ nw_context1 = ecc_custom_get_nw_context(i, ECC_SIM1_CALL);
+ nw_context2 = ecc_custom_get_nw_context(i, ECC_SIM2_CALL);
+
+ memcpy(&temp, nw_context1, sizeof(ecc_record_struct));
+ memcpy(nw_context1, nw_context2, sizeof(ecc_record_struct));
+ memcpy(nw_context2, &temp, sizeof(ecc_record_struct));
+ }
+}
+
+void* phb_get_fdn_ecc_as_normal_tbl(void)
+{
+ return (void*)&fdn_ecc_as_normal[0];
+}
+
+/* __KOR_CUSTOMIZATION__ */
+/*****************************************************************************
+ * FUNCTION
+ * is_ecc_custom_kor_operator_barred_num
+ * DESCRIPTION
+ * KOR operator requirements - skip 127 in SIM EFecc
+ * PARAMETERS
+ * number [IN] input ECC number
+ * num_encoding [IN] input ECC number coding scheme
+ * RETURNS
+ * boolean
+ *****************************************************************************/
+kal_bool is_ecc_custom_kor_operator_barred_num(
+ kal_uint8 * number,
+ ecc_num_encoding_enum num_encoding )
+{
+ kal_uint8 ecc_number[(ECC_CUSTOM_MAX_BCD_LENGTH * 2 + 1) * 2 /*ENCODING_LENGTH*/]; /* in UCS2, max bytes: 14 */
+ kal_uint16 ecc_barred_number[] = {0x0031, 0x0032, 0x0037, 0x0000 }; /* KOR operator requirement barring 127 */
+
+ if (number != NULL )
+ {
+ ecc_custom_prepare_number(ecc_number, number, num_encoding);
+ if (kal_dchar_strcmp((char*) ecc_number, (char*) ecc_barred_number) == 0)
+ {
+ return KAL_TRUE;
+ }
+ }
+ return KAL_FALSE;
+}
+/* __KOR_CUSTOMIZATION__ */
\ No newline at end of file
diff --git a/mcu/custom/modem/common/custom_ecc.h b/mcu/custom/modem/common/custom_ecc.h
new file mode 100644
index 0000000..ac36546
--- /dev/null
+++ b/mcu/custom/modem/common/custom_ecc.h
@@ -0,0 +1,183 @@
+/*****************************************************************************
+* 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) 2009
+*
+* 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_ecc.h
+ *
+ * Project:
+ * --------
+ * MAUI
+ *
+ * Description:
+ * ------------
+ * This file defines ECC function prototype.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *==============================================================================
+ *******************************************************************************/
+#ifndef _APP_ECC_H
+#define _APP_ECC_H
+
+#include "kal_general_types.h"
+
+#define ECC_CUSTOM_MAX_BCD_LENGTH 3
+
+#define ECC_CUSTOM_MAX_SIM_RECORD 16
+
+#define ECC_CUSTOM_MAX_NW_RECORD 16
+#define ECC_CUSTOM_MAX_NVRAM_RECORD 16
+
+#define ECC_CUSTOM_DEFAULT_ECC_LENGTH 4 /* including 0x00 */
+
+typedef enum
+{
+ ECC_SIM1_CALL, /* verifying SIM1 ECC for call */
+ ECC_SIM2_CALL, /* verifying SIM2 ECC for call */
+// Gemini+
+ ECC_SIM3_CALL, /* verifying SIM3 ECC for call */
+ ECC_SIM4_CALL, /* verifying SIM4 ECC for call */
+ ECC_ALL_CALL, /* verifying all ECC for call */
+ ECC_SAT_CALL
+} ecc_call_type_enum;
+
+typedef enum
+{
+ ECC_SRC_SIM1, /* update ECC number of SIM1 */
+ ECC_SRC_SIM2, /* update ECC number of SIM2 */
+// Gemini+
+ ECC_SRC_SIM3, /* update ECC number of SIM3 */
+ ECC_SRC_SIM4, /* update ECC number of SIM4 */
+ ECC_SRC_NW1, /* update ECC number of NW1 */
+ ECC_SRC_NW2, /* update ECC number of NW2 */
+// Gemini+
+ ECC_SRC_NW3, /* update ECC number of NW3 */
+ ECC_SRC_NW4, /* update ECC number of NW4 */
+ ECC_SRC_NVRAM, /* update ECC number of NVRAM1 */
+ ECC_SRC_PREDEFINED /* pre-defined ECC */
+} ecc_src_type_enum;
+
+typedef enum
+{
+ ECC_ENCODING_ANSII, /* ex: 112 => 0x31, 0x31, 0x32 */
+ ECC_ENCODING_UCS2, /* ex: 112 => 0x0031, 0x0031, 0x0032 */
+ ECC_ENCODING_BCD /* ex: 112 => 0x11, 0xF2 */
+} ecc_num_encoding_enum;
+
+typedef enum
+{
+ ECC_NOT_MATCH,
+ ECC_PARTIALLY_MATCH,
+ ECC_FULLY_MATCH
+} ecc_verify_detail_enum;
+
+typedef enum
+{
+ ECC_RESULT_OK,
+ ECC_RESULT_INVALID_ENTRY = -1,
+ ECC_RESULT_CAPACITY_EXCEEDED = -2
+} ecc_update_result_enum;
+
+typedef struct
+{
+ kal_uint8 ecc_number[(ECC_CUSTOM_MAX_BCD_LENGTH * 2 + 1) * 2 /*ENCODING_LENGTH*/]; /* in UCS2, max bytes: 14 */
+ /*
+ * Emergency Service Category Value
+ * Bit 1 Police
+ * Bit 2 Ambulance
+ * Bit 3 Fire Brigade
+ * Bit 4 Marine Guard
+ * Bit 5 Mountain Rescue
+ * Bits 6,7,8 are spare and set to "0"
+ */
+ kal_uint8 ecc_category; /* supported in protocol but no icon in MMI */
+ kal_bool ecc_always; /* 1: ECC always, 0: ECC only when no SIM */
+} ecc_record_struct;
+
+extern kal_bool ecc_custom_verify_emergency_number(
+ kal_uint8 *number, /* number (with null terminator) to verify */
+ kal_uint8 num_length, /* number length */
+ ecc_num_encoding_enum num_encoding, /* ANSII, UCS2, or BCD */
+ ecc_call_type_enum call_type, /* SIM1, SIM2, or ALL */
+ kal_uint8 *ecc_category, /* Returned ECC category */
+ kal_uint8 **ecc_display, /* Returned ECC display name (in UCS2) */
+ kal_uint8 *verify_detail); /* Returned ECC verify detail (only for idle) */
+
+extern void ecc_custom_update_emergency_number(
+ kal_uint8 *number, /* number (with null terminator) to configure */
+ ecc_num_encoding_enum num_encoding, /* ANSII, UCS2, or BCD */
+ ecc_src_type_enum ecc_src, /* SIM1, SIM2, NW1, NW2, or NVRAM */
+ kal_uint8 ecc_category, /* ECC category */
+ kal_uint8 *ecc_display, /* ECC display name (in UCS2) */
+ kal_uint8 index, /* index, if total = 5, index = 1 ~ 5 */
+ kal_uint8 total); /* total */
+
+extern ecc_update_result_enum ecc_custom_update_emergency_number_ex(
+ kal_uint8 *number, /* number (with null terminator) to configure */
+ ecc_num_encoding_enum num_encoding, /* ANSII, UCS2, or BCD */
+ kal_uint8 ecc_category, /* ECC category */
+ kal_bool ecc_always); /* 1: ECC always, 0: ECC only when no SIM */
+
+extern void ecc_custom_get_first_2_default_num(
+ kal_uint8 **ecc_num1,
+ kal_uint8 **ecc_num2);
+
+extern kal_bool ecc_custom_support_enhance_retry(void);
+extern void ecc_custom_decode_bcd_2_ansii(kal_uint8 *ecc_asnii, kal_uint8 *ecc_bcd);
+extern void ecc_custom_reset_sim_context(ecc_src_type_enum ecc_src);
+extern void ecc_custom_reset_nw_context(ecc_src_type_enum ecc_src);
+extern void ecc_custom_swap_nw_context(void);
+
+/* __KOR_CUSTOMIZATION__ */
+extern kal_bool is_ecc_custom_kor_operator_barred_num(kal_uint8 * number, ecc_num_encoding_enum num_encoding );
+/* __KOR_CUSTOMIZATION__ */
+
+typedef struct
+{
+ kal_uint8 length;
+ kal_uint8 bcd1;
+ kal_uint8 bcd2;
+ kal_uint8 bcd3;
+ kal_uint8 mccmnc_str[7];
+} fdn_ecc_struct;
+
+void* phb_get_fdn_ecc_as_normal_tbl(void);
+
+#endif /* _APP_ECC_H */
+
diff --git a/mcu/custom/modem/common/custom_led_patterns.c b/mcu/custom/modem/common/custom_led_patterns.c
new file mode 100644
index 0000000..60d533c
--- /dev/null
+++ b/mcu/custom/modem/common/custom_led_patterns.c
@@ -0,0 +1,623 @@
+/*****************************************************************************
+* 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_led_patterns.c
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * The file contains definition of custom component module configuration
+ * variables, and routines handle for equipment device.
+ *
+ * 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#ifndef __L1_STANDALONE__
+
+/*
+ * Includes
+ */
+#include "kal_public_api.h" //MSBB change #include "kal_release.h"
+#include "stack_types.h"
+#include "syscomp_config.h"
+//MSBB remove #include "custom_config.h"
+#include "stack_buff_pool.h"
+#include "ctrl_buff_pool.h"
+#include "device.h"
+#include "custom_led_patterns.h"
+
+/*
+ * LED pattern
+ */
+#define LED_LEVEL_0 0
+#define LED_LEVEL_1 1
+#define LED_LEVEL_2 2
+#define LED_LEVEL_3 3
+#define LED_LEVEL_4 4
+#define LED_LEVEL_5 5
+
+/* Power On */
+const LED_PATTERN_STRUCT led_gpio_ptn1[] =
+{
+ /* red ligth 1, green ligth 2, blue light 3, duration time */
+ {{LED_LEVEL_5, LED_LEVEL_0, LED_LEVEL_0}, 500},
+ {{LED_LEVEL_0, LED_LEVEL_5, LED_LEVEL_0}, 500},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_5}, 500},
+ {{LED_LEVEL_5, LED_LEVEL_5, LED_LEVEL_0}, 500},
+ {{LED_LEVEL_0, LED_LEVEL_5, LED_LEVEL_5}, 500},
+ {{LED_LEVEL_5, LED_LEVEL_0, LED_LEVEL_5}, 500},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Power Off */
+const LED_PATTERN_STRUCT led_gpio_ptn2[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_5, LED_LEVEL_5}, 500},
+ {{LED_LEVEL_5, LED_LEVEL_0, LED_LEVEL_5}, 500},
+ {{LED_LEVEL_5, LED_LEVEL_5, LED_LEVEL_0}, 500},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_5}, 500},
+ {{LED_LEVEL_0, LED_LEVEL_5, LED_LEVEL_0}, 500},
+ {{LED_LEVEL_5, LED_LEVEL_0, LED_LEVEL_0}, 500},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Battery Warning */
+const LED_PATTERN_STRUCT led_gpio_ptn3[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_5, LED_LEVEL_0, LED_LEVEL_0}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 2000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Battery Low */
+const LED_PATTERN_STRUCT led_gpio_ptn4[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 7000},
+ {{LED_LEVEL_1, LED_LEVEL_0, LED_LEVEL_0}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Camp on 900 */
+const LED_PATTERN_STRUCT led_gpio_ptn5[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 7000},
+ {{LED_LEVEL_0, LED_LEVEL_1, LED_LEVEL_0}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Camp on 1800 */
+const LED_PATTERN_STRUCT led_gpio_ptn6[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 7000},
+ {{LED_LEVEL_0, LED_LEVEL_1, LED_LEVEL_0}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Power Off Charging */
+const LED_PATTERN_STRUCT led_gpio_ptn7[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 7000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_2}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Power Off Charging, Full Charge */
+const LED_PATTERN_STRUCT led_gpio_ptn8[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_2, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Message In */
+const LED_PATTERN_STRUCT led_gpio_ptn9[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_5, LED_LEVEL_5, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Message Remain */
+const LED_PATTERN_STRUCT led_gpio_ptn10[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_5, LED_LEVEL_5, LED_LEVEL_0}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 7000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Caller Group 1 */
+const LED_PATTERN_STRUCT led_gpio_ptn11[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_5, LED_LEVEL_0, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Caller Group 2 */
+const LED_PATTERN_STRUCT led_gpio_ptn12[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_5, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Caller Group 3 */
+const LED_PATTERN_STRUCT led_gpio_ptn13[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_5}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Caller Group 4 */
+const LED_PATTERN_STRUCT led_gpio_ptn14[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_5, LED_LEVEL_0, LED_LEVEL_5}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Caller Group 5 */
+const LED_PATTERN_STRUCT led_gpio_ptn15[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_5, LED_LEVEL_5, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Caller Group 6 */
+const LED_PATTERN_STRUCT led_gpio_ptn16[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_5, LED_LEVEL_5}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 1000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Limit Service */
+const LED_PATTERN_STRUCT led_gpio_ptn17[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 7000},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_1}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* No Service */
+const LED_PATTERN_STRUCT led_gpio_ptn18[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 7000},
+ {{LED_LEVEL_1, LED_LEVEL_0, LED_LEVEL_0}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Connect 1900 */
+const LED_PATTERN_STRUCT led_gpio_ptn19[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 7000},
+ {{LED_LEVEL_0, LED_LEVEL_1, LED_LEVEL_0}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+/* Roaming */
+const LED_PATTERN_STRUCT led_gpio_ptn20[] =
+{
+ /* ligth 1, ligth 2, light 3, duration time */
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 7000},
+ {{LED_LEVEL_1, LED_LEVEL_1, LED_LEVEL_1}, 100},
+ {{LED_LEVEL_0, LED_LEVEL_0, LED_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+const LED_PATTERN_STRUCT *led_gpio_patterns[] =
+{
+ led_gpio_ptn1,
+ led_gpio_ptn2,
+ led_gpio_ptn3,
+ led_gpio_ptn4,
+ led_gpio_ptn5,
+ led_gpio_ptn6,
+ led_gpio_ptn7,
+ led_gpio_ptn8,
+ led_gpio_ptn9,
+ led_gpio_ptn10,
+ led_gpio_ptn11,
+ led_gpio_ptn12,
+ led_gpio_ptn13,
+ led_gpio_ptn14,
+ led_gpio_ptn15,
+ led_gpio_ptn16,
+ led_gpio_ptn17,
+ led_gpio_ptn18,
+ led_gpio_ptn19,
+ led_gpio_ptn20
+};
+
+/*
+ * LCD pattern
+ */
+#define LCD_LEVEL_0 0
+#define LCD_LEVEL_1 1
+
+const LCD_PATTERN_STRUCT lcd_gpio_ptn1[] =
+{
+ /* lcd, duration time */
+ {{LCD_LEVEL_1}, 1000},
+ {{LCD_LEVEL_0}, 1000}, /* duration timer is zero to terminate it */
+ {{LCD_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+const LCD_PATTERN_STRUCT lcd_gpio_ptn2[] =
+{
+ /* lcd, duration time */
+ {{LCD_LEVEL_1}, 0} /* duration timer is zero to terminate it */
+};
+const LCD_PATTERN_STRUCT *lcd_gpio_patterns[] =
+{
+ lcd_gpio_ptn1,
+ lcd_gpio_ptn2
+};
+
+/*
+ * VIB pattern
+ */
+#define VIB_LEVEL_0 0
+#define VIB_LEVEL_1 1
+
+const VIB_PATTERN_STRUCT vib_gpio_ptn1[] =
+{
+ /* vib, duration time */
+ {{VIB_LEVEL_1}, 1000},
+ {{VIB_LEVEL_0}, 1000},
+ {{VIB_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+const VIB_PATTERN_STRUCT vib_gpio_ptn2[] =
+{
+ /* vib duration time */
+ {{VIB_LEVEL_1}, 0} /* duration timer is zero to terminate it */
+};
+
+const VIB_PATTERN_STRUCT vib_gpio_ptn3[] =
+{
+ /* Incomming SMS */
+ {{VIB_LEVEL_1}, 500}, /* duration timer is zero to terminate it */
+ {{VIB_LEVEL_0}, 500}, /* duration timer is zero to terminate it */
+ {{VIB_LEVEL_1}, 500}, /* duration timer is zero to terminate it */
+ {{VIB_LEVEL_0}, 1500}, /* duration timer is zero to terminate it */
+ {{VIB_LEVEL_1}, 500}, /* duration timer is zero to terminate it */
+ {{VIB_LEVEL_0}, 500}, /* duration timer is zero to terminate it */
+ {{VIB_LEVEL_1}, 500}, /* duration timer is zero to terminate it */
+ {{VIB_LEVEL_0}, 0} /* duration timer is zero to terminate it */
+};
+
+const VIB_PATTERN_STRUCT vib_gpio_ptn4[] =
+{
+ /* FTE feedback */
+ {{VIB_LEVEL_1}, 100},
+ {{VIB_LEVEL_0}, 0}
+};
+
+const VIB_PATTERN_STRUCT *vib_gpio_patterns[] =
+{
+ vib_gpio_ptn1,
+ vib_gpio_ptn2,
+ vib_gpio_ptn3,
+ vib_gpio_ptn4
+};
+
+
+/*****************************************************************************
+ * FUNCTION
+ * custom_get_led_patterns
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ * led_pattern_id [IN]
+ * RETURNS
+ *
+ *****************************************************************************/
+LED_PATTERN_STRUCT *custom_get_led_patterns(PATTERN_ID led_pattern_id)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ /* out of pattern number */
+ if (led_pattern_id - LED_PATTERN_BEGIN >= (sizeof(led_gpio_patterns) / sizeof(led_gpio_patterns[0])))
+ {
+ ASSERT(0);
+ }
+
+ /* based index from 0 */
+ return (LED_PATTERN_STRUCT*)(led_gpio_patterns[led_pattern_id - LED_PATTERN_BEGIN]);
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * custom_get_lcd_patterns
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ * lcd_pattern_id [IN]
+ * RETURNS
+ *
+ *****************************************************************************/
+LCD_PATTERN_STRUCT *custom_get_lcd_patterns(PATTERN_ID lcd_pattern_id)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ /* out of pattern number */
+ if (lcd_pattern_id - LCD_PATTERN_BEGIN >= (sizeof(lcd_gpio_patterns) / sizeof(lcd_gpio_patterns[0])))
+ {
+ ASSERT(0);
+ }
+
+ /* based index from 0 */
+ return (LCD_PATTERN_STRUCT*)(lcd_gpio_patterns[lcd_pattern_id - LCD_PATTERN_BEGIN]);
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * custom_get_vib_patterns
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ * vib_pattern_id [IN]
+ * RETURNS
+ *
+ *****************************************************************************/
+VIB_PATTERN_STRUCT *custom_get_vib_patterns(PATTERN_ID vib_pattern_id)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ /* out of pattern number */
+ if (vib_pattern_id - VIB_PATTERN_BEGIN >= (sizeof(vib_gpio_patterns) / sizeof(vib_gpio_patterns[0])))
+ {
+ ASSERT(0);
+ }
+
+ /* based index from 0 */
+ return (VIB_PATTERN_STRUCT*)(vib_gpio_patterns[vib_pattern_id - VIB_PATTERN_BEGIN]);
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * custom_get_led_label
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ * id [IN]
+ * RETURNS
+ *
+ *****************************************************************************/
+kal_uint8 custom_get_led_label(kal_uint8 id)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ switch (id)
+ {
+ case 0:
+ return GPIO_DEV_LED_STATUS_1;
+
+ case 1:
+ return GPIO_DEV_LED_STATUS_2;
+
+ case 2:
+ return GPIO_DEV_LED_STATUS_3;
+
+ default:
+ return GPIO_DEV_LED_STATUS_1;
+ }
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * custom_get_lcd_label
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ * id [IN]
+ * RETURNS
+ *
+ *****************************************************************************/
+kal_uint8 custom_get_lcd_label(kal_uint8 id)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ switch (id)
+ {
+ case 0:
+ return GPIO_DEV_LED_SUBLCD;
+
+ case 1:
+ return GPIO_DEV_LED_MAINLCD;
+
+ default:
+ return GPIO_DEV_LED_SUBLCD;
+ }
+
+}
+
+
+/*****************************************************************************
+ * FUNCTION
+ * custom_get_vib_label
+ * DESCRIPTION
+ *
+ * PARAMETERS
+ * id [IN]
+ * RETURNS
+ *
+ *****************************************************************************/
+kal_uint8 custom_get_vib_label(kal_uint8 id)
+{
+ /*----------------------------------------------------------------*/
+ /* Local Variables */
+ /*----------------------------------------------------------------*/
+
+ /*----------------------------------------------------------------*/
+ /* Code Body */
+ /*----------------------------------------------------------------*/
+ return GPIO_DEV_VIBRATOR;
+}
+
+#endif /* __L1_STANDALONE__ */
+
diff --git a/mcu/custom/modem/common/custom_led_patterns.h b/mcu/custom/modem/common/custom_led_patterns.h
new file mode 100644
index 0000000..c252ca0
--- /dev/null
+++ b/mcu/custom/modem/common/custom_led_patterns.h
@@ -0,0 +1,207 @@
+/*****************************************************************************
+* 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_led_patterns.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * The file contains definition of custom component module configuration
+ * variables, and routines handle for equipment device.
+ *
+ * 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#ifndef _UEM_LED_PATTERNS_H
+#define _UEM_LED_PATTERNS_H
+
+#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 !*/
+/* 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 !*/
+#else
+
+#include "device.h"
+
+#endif
+
+#endif /* _UEM_LED_PATTERNS_H */
+
diff --git a/mcu/custom/modem/common/custom_port.c b/mcu/custom/modem/common/custom_port.c
new file mode 100644
index 0000000..42587d7
--- /dev/null
+++ b/mcu/custom/modem/common/custom_port.c
@@ -0,0 +1,275 @@
+#include "custom_port.h"
+
+#include "kal_public_defs.h"
+#include "kal_general_types.h"
+#include "kal_public_api.h"
+#include "fs_general_types.h"
+#include "fs_general_api.h"
+
+#if defined(__MTK_TARGET__) && defined(__HIF_PCIE_SUPPORT__)
+extern kal_uint32 pcie_get_link_state(void);
+#else
+#define pcie_get_link_state(...) (-1)
+#define index(...) (NULL)
+#endif
+
+// 76543210 76543210 76543210 76543210
+// XXX YY AZ
+//
+// XXX (MODE) ==> PORT_MODE_NONE or PORT_MODE_USB or PORT_MODE_PCIE or PORT_MODE_USB_AND_PCIE or PORT_MODE_AP
+// YY (DIPC configuration) ==> PORT_DIPC_MODE_NOT_SUPPORT or PORT_DIPC_MODE_PCIE_ONLY or PORT_DIPC_MODE_PCIE_ADVANCE or PORT_DIPC_MODE_DUAL_IPC
+// A (port enable/disable on PCIE) ==> PORT_PCIE_DISABLE or PORT_PCIE_ENABLE
+// Z (pcie link status) ==> PORT_PCIE_STATUS_LINK_DOWN or PORT_PCIE_STATUS_LINK_UP
+
+#if !defined(__DHL_TRACE_ENABLED__)
+ #define kal_prompt_trace(...)
+#endif
+
+#define FILEPATH_SIZE (128)
+#define BUFFER_SIZE (1024)
+kal_uint32 custom_port(custom_port_user_enum port)
+{
+ kal_uint32 ret = 0;
+#if defined(__HIF_USB_SUPPORT__) && defined(__HIF_PCIE_SUPPORT__)
+ //DUAL IPC load
+ static kal_bool first = KAL_TRUE;
+ FS_HANDLE file_handle;
+ static kal_uint32 config_dual_ipc_mode = PORT_DIPC_MODE_NOT_SUPPORT;
+ static kal_uint32 config_md_logging_interface = PORT_MODE_NONE;
+ static kal_uint32 config_md_at_interface = PORT_MODE_PCIE;
+ static kal_uint32 config_md_pcie_port = 0xffffffff;
+ kal_uint32 pcie_link_ready = (pcie_get_link_state() == 0) ? 1 : 0;
+
+ if (first) {
+ kal_wchar *filepath = NULL;
+ kal_uint8 *buffer = NULL;
+ do {
+ filepath = (kal_wchar *)get_ctrl_buffer(FILEPATH_SIZE);
+ buffer = (kal_uint8 *)get_ctrl_buffer(BUFFER_SIZE);
+
+ if (filepath == NULL || buffer == NULL) {
+ //cannot allocate memory for operation
+ break;
+ }
+
+ kal_wsprintf(filepath, "%s", DIPC_CONFIG_PATH);
+ if ((file_handle = FS_Open(filepath, FS_READ_ONLY | FS_OPEN_NO_DIR)) >= FS_NO_ERROR) {
+ kal_uint32 read_size;
+ memset(buffer, 0, BUFFER_SIZE);
+ if (FS_Read(file_handle, buffer, BUFFER_SIZE - 1, &read_size) >= FS_NO_ERROR) {
+ kal_prompt_trace(MOD_NIL, "XXXX %s:%d read_size=%d", __FILE__, __LINE__, read_size);
+ kal_uint8 *cur_ptr = &buffer[0];
+ kal_uint8 *tail_ptr = &buffer[read_size];
+ while (cur_ptr < tail_ptr) {
+ kal_uint8 key[32];
+ kal_uint32 val;
+ kal_uint8 *next_ptr = (kal_uint8 *)index((char *)cur_ptr, '\n');
+ kal_uint8 *delim_ptr;
+ if (next_ptr == NULL) {
+ break;
+ }
+ *next_ptr = '\0';
+ delim_ptr = (kal_uint8 *)index((char *)cur_ptr, ':');
+ if (delim_ptr == NULL) {
+ break;
+ }
+ *delim_ptr++ = '\0';
+
+ sscanf((char *)cur_ptr, "%s\n", (char *)key);
+ sscanf((char *)delim_ptr, "%u\n", &val);
+
+ cur_ptr = next_ptr + 1;
+ kal_prompt_trace(MOD_NIL, "[%s][%x]", key, val);
+ if (strcmp(KEY_DUAL_IPC_MODE, (char *)key) == 0) {
+ switch(val) {
+ case DIPC_MODE_NOT_CONFIG:
+ config_dual_ipc_mode = PORT_DIPC_MODE_NOT_SUPPORT;
+ break;
+ case DIPC_MODE_PCIE_ADV:
+ config_dual_ipc_mode = PORT_DIPC_MODE_PCIE_ADVANCE;
+ break;
+ case DIPC_MODE_PCIE_ONLY:
+ config_dual_ipc_mode = PORT_DIPC_MODE_PCIE_ONLY;
+ break;
+ case DIPC_MODE_DUAL_IPC:
+ config_dual_ipc_mode = PORT_DIPC_MODE_DUAL_IPC;
+ break;
+ case DIPC_MODE_USB_ONLY:
+ config_dual_ipc_mode = PORT_DIPC_MODE_USB_ONLY;
+ break;
+ }
+ } else if (strcmp(KEY_MD_LOGGING_INTERFACE, (char *)key) == 0) {
+ switch(val) {
+ case DIPC_INTF_USB:
+ config_md_logging_interface = PORT_MODE_USB;
+ break;
+ case DIPC_INTF_PCIE:
+ config_md_logging_interface = PORT_MODE_PCIE;
+ break;
+#if 0
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+ default:
+ config_md_logging_interface = PORT_MODE_NONE;
+ break;
+ }
+ } else if (strcmp(KEY_MD_AT_INTERFACE, (char *)key) == 0) {
+ switch(val) {
+ case DIPC_INTF_USB:
+ config_md_at_interface = PORT_MODE_USB;
+ break;
+ case DIPC_INTF_PCIE:
+ config_md_at_interface = PORT_MODE_PCIE;
+ break;
+ default:
+ config_md_at_interface = PORT_MODE_PCIE;
+ break;
+ }
+ } else if (strcmp(KEY_MD_PCIE_PORT_CONFIG, (char *)key) == 0) {
+ if ((val & DIPC_CONFIG_MD_PORT_LOGGING) == 0) {
+ config_md_pcie_port &= ~(1 << CUSTOM_PORT_USER_LOG);
+ }
+ if ((val & DIPC_CONFIG_MD_PORT_META) == 0) {
+ config_md_pcie_port &= ~(1 << CUSTOM_PORT_USER_META);
+ }
+ if ((val & DIPC_CONFIG_MD_PORT_BINARY_TOOL) == 0) {
+ config_md_pcie_port &= ~(1 << CUSTOM_PORT_USER_BINARY_TOOL);
+ config_md_pcie_port &= ~(1 << CUSTOM_PORT_USER_MIPC);
+ }
+ if ((val & DIPC_CONFIG_MD_PORT_AT) == 0) {
+ config_md_pcie_port &= ~(1 << CUSTOM_PORT_USER_AT);
+ }
+ }
+ }
+ }
+ FS_Close(file_handle);
+ }
+ first = KAL_FALSE;
+ } while(0);
+
+ if (filepath) {
+ free_ctrl_buffer(filepath);
+ filepath = NULL;
+ }
+ if (buffer) {
+ free_ctrl_buffer(buffer);
+ buffer = NULL;
+ }
+ }
+
+ if (config_md_pcie_port & (1 << port)) {
+ ret |= (1 << PORT_PCIE_ENABLE_SHIFT);
+ }
+
+ switch (config_dual_ipc_mode) {
+ case PORT_DIPC_MODE_PCIE_ADVANCE:
+ if (pcie_link_ready) {
+ if (config_md_pcie_port & (1 << port)) {
+ ret |= (PORT_MODE_PCIE << PORT_MODE_SHIFT);
+ } else {
+ ret |= (PORT_MODE_NONE << PORT_MODE_SHIFT);
+ }
+ } else {
+ ret |= (PORT_MODE_USB << PORT_MODE_SHIFT);
+ }
+ ret |= (config_dual_ipc_mode << PORT_DIPC_MODE_SHIFT);
+ ret |= (pcie_link_ready << PORT_PCIE_STATUS_SHIFT);
+ return ret;
+ case PORT_DIPC_MODE_PCIE_ONLY:
+ if (config_md_pcie_port & (1 << port)) {
+ ret |= (PORT_MODE_PCIE << PORT_MODE_SHIFT);
+ } else {
+ ret |= (PORT_MODE_NONE << PORT_MODE_SHIFT);
+ }
+ ret |= (config_dual_ipc_mode << PORT_DIPC_MODE_SHIFT);
+ ret |= (pcie_link_ready << PORT_PCIE_STATUS_SHIFT);
+ return ret;
+ case PORT_DIPC_MODE_DUAL_IPC:
+ if (pcie_link_ready) {
+ switch (port) {
+ case CUSTOM_PORT_USER_AT:
+ ret |= (config_md_at_interface << PORT_MODE_SHIFT);
+ break;
+ case CUSTOM_PORT_USER_LOG:
+ if (config_md_logging_interface == PORT_MODE_USB) {
+ ret |= (PORT_MODE_USB << PORT_MODE_SHIFT);
+ } else if ((config_md_logging_interface == PORT_MODE_PCIE) && (config_md_pcie_port & (1 << port))) {
+ ret |= (PORT_MODE_PCIE << PORT_MODE_SHIFT);
+ } else {
+ ret |= (PORT_MODE_NONE << PORT_MODE_SHIFT);
+ }
+ break;
+ case CUSTOM_PORT_USER_META:
+ ret |= (PORT_MODE_USB << PORT_MODE_SHIFT);
+ break;
+ default:
+ ret |= (PORT_MODE_PCIE << PORT_MODE_SHIFT);
+ break;
+ }
+ } else {
+ ret |= (PORT_MODE_USB << PORT_MODE_SHIFT);
+ }
+ ret |= (config_dual_ipc_mode << PORT_DIPC_MODE_SHIFT);
+ ret |= (pcie_link_ready << PORT_PCIE_STATUS_SHIFT);
+ return ret;
+ case PORT_DIPC_MODE_USB_ONLY:
+ ret |= (PORT_MODE_USB << PORT_MODE_SHIFT);
+ ret |= (config_dual_ipc_mode << PORT_DIPC_MODE_SHIFT);
+ ret |= (pcie_link_ready << PORT_PCIE_STATUS_SHIFT);
+ return ret;
+ case PORT_DIPC_MODE_NOT_SUPPORT:
+ if (port == CUSTOM_PORT_USER_LOG) {
+#if defined(__ELT_SET_PORT_TO_USB__)
+ ret |= (PORT_MODE_USB << PORT_MODE_SHIFT);
+#elif defined(__ELT_SET_PORT_TO_PCIE__)
+ ret |= (PORT_MODE_PCIE << PORT_MODE_SHIFT);
+#elif defined(__ELT_SET_PORT_TO_DUAL_IPC__)
+ ret |= (PORT_MODE_NONE << PORT_MODE_SHIFT);
+#else
+ ret |= (PORT_MODE_NONE << PORT_MODE_SHIFT);
+#endif
+ } else if (port == CUSTOM_PORT_USER_META) {
+#if defined(__META_SET_PORT_TO_USB__)
+ ret |= (PORT_MODE_USB << PORT_MODE_SHIFT);
+#elif defined(__META_SET_PORT_TO_PCIE__)
+ ret |= (PORT_MODE_PCIE << PORT_MODE_SHIFT);
+#elif defined(__META_SET_PORT_TO_DUAL_IPC__)
+ ret |= (PORT_MODE_NONE << PORT_MODE_SHIFT);
+#else
+ ret |= (PORT_MODE_NONE << PORT_MODE_SHIFT);
+#endif
+ } else {
+ ret |= (PORT_MODE_NONE << PORT_MODE_SHIFT);
+ }
+ ret |= (config_dual_ipc_mode << PORT_DIPC_MODE_SHIFT);
+ ret |= (1 << PORT_PCIE_ENABLE_SHIFT);
+ ret |= (pcie_link_ready << PORT_PCIE_STATUS_SHIFT);
+ return ret;
+ default:
+ ret |= (PORT_MODE_PCIE << PORT_MODE_SHIFT);
+ ret |= (config_dual_ipc_mode << PORT_DIPC_MODE_SHIFT);
+ ret |= (1 << PORT_PCIE_ENABLE_SHIFT);
+ ret |= (pcie_link_ready << PORT_PCIE_STATUS_SHIFT);
+ return ret;
+ }
+#elif defined(__HIF_USB_SUPPORT__)
+ //support USB only
+ ret |= (PORT_MODE_USB << PORT_MODE_SHIFT);
+ return ret;
+#elif defined(__HIF_PCIE_SUPPORT__)
+ //support PCIE only
+ ret |= (PORT_MODE_PCIE << PORT_MODE_SHIFT);
+ return ret;
+#else
+#if defined(__ANDROID_MODEM__)
+ //SP
+ ret |= (PORT_MODE_AP << PORT_MODE_SHIFT);
+ return ret;
+#else
+ ret |= (PORT_MODE_NONE << PORT_MODE_SHIFT);
+ return ret;
+#endif
+#endif
+}
diff --git a/mcu/custom/modem/common/custom_port.h b/mcu/custom/modem/common/custom_port.h
new file mode 100644
index 0000000..67f7bc1
--- /dev/null
+++ b/mcu/custom/modem/common/custom_port.h
@@ -0,0 +1,100 @@
+#ifndef _CUSTOM_PORT_H_
+#define _CUSTOM_PORT_H_
+
+#include "kal_public_api.h"
+#include "kal_public_defs.h"
+
+//
+#define PORT_MODE_BITS (3)
+#define PORT_MODE_MASK ((1 << PORT_MODE_BITS) - 1)
+#define PORT_MODE_SHIFT (29)
+
+#define PORT_MODE_NONE (0) //slave mode NONE
+#define PORT_MODE_USB (1) //slave mode USB
+#define PORT_MODE_PCIE (2) //slave mode PCIE
+#define PORT_MODE_USB_AND_PCIE (3) //slave mode USB & PCIE
+#define PORT_MODE_AP (7) //master mode
+
+//
+#define PORT_DIPC_MODE_BITS (3)
+#define PORT_DIPC_MODE_MASK ((1 << PORT_DIPC_MODE_BITS) - 1)
+#define PORT_DIPC_MODE_SHIFT (8)
+
+#define PORT_DIPC_MODE_NOT_SUPPORT (0)
+#define PORT_DIPC_MODE_PCIE_ONLY (1)
+#define PORT_DIPC_MODE_PCIE_ADVANCE (2)
+#define PORT_DIPC_MODE_DUAL_IPC (3)
+#define PORT_DIPC_MODE_USB_ONLY (4)
+
+//only valid when PCIE only mode
+#define PORT_PCIE_ENABLE_BITS (1)
+#define PORT_PCIE_ENABLE_MASK ((1 << PORT_PCIE_ENABLE_BITS) - 1)
+#define PORT_PCIE_ENABLE_SHIFT (1)
+
+#define PORT_PCIE_DISABLE (0) //port is not enabled on PCIE
+#define PORT_PCIE_ENABLE (1) //port is enabled on PCIE
+
+//
+#define PORT_PCIE_STATUS_BITS (1)
+#define PORT_PCIE_STATUS_MASK ((1 << PORT_PCIE_STATUS_BITS) - 1)
+#define PORT_PCIE_STATUS_SHIFT (0)
+
+#define PORT_PCIE_STATUS_LINK_DOWN (0) //pcie link is down (if no PCIE, it's default)
+#define PORT_PCIE_STATUS_LINK_UP (1) //pcie link is up
+
+#define CUSTOM_PORT_GET_MODE(x) ((custom_port(x) >> PORT_MODE_SHIFT) & PORT_MODE_MASK)
+#define CUSTOM_PORT_GET_DIPC_MODE(x) ((custom_port(x) >> PORT_DIPC_MODE_SHIFT) & PORT_DIPC_MODE_MASK)
+#define CUSTOM_PORT_GET_PCIE_ENABLE(x) ((custom_port(x) >> PORT_PCIE_ENABLE_SHIFT) & PORT_PCIE_ENABLE_MASK)
+#define CUSTOM_PORT_GET_PCIE_STATUS(x) ((custom_port(x) >> PORT_PCIE_STATUS_SHIFT) & PORT_PCIE_STATUS_MASK)
+
+typedef enum {
+ CUSTOM_PORT_USER_UNKNOWN = 0,
+ CUSTOM_PORT_USER_LOG = 1,
+ CUSTOM_PORT_USER_META = 2,
+ CUSTOM_PORT_USER_MIPC = 3,
+ CUSTOM_PORT_USER_BINARY_TOOL = 4,
+ CUSTOM_PORT_USER_MBIM = 5,
+ CUSTOM_PORT_USER_AT = 6,
+ CUSTOM_PORT_USER_MAX
+} custom_port_user_enum;
+
+kal_uint32 custom_port(custom_port_user_enum port);
+
+//defintions from AP
+#define DIPC_CONFIG_PATH "V:\\dipc_config"
+
+#define KEY_DUAL_IPC_MODE "dual_ipc_mode"
+#define KEY_MD_LOGGING_INTERFACE "md_logging_interface"
+#define KEY_MD_AT_INTERFACE "md_at_interface"
+#define KEY_MD_PCIE_PORT_CONFIG "md_pcie_port_config"
+
+#define DIPC_CONFIG_PORT_START (uint32_t)0x00000001
+
+// MD Ports
+typedef enum {
+ DIPC_CONFIG_MD_PORT_LOGGING = (DIPC_CONFIG_PORT_START << 0),
+ DIPC_CONFIG_MD_PORT_META = (DIPC_CONFIG_PORT_START << 1),
+ DIPC_CONFIG_MD_PORT_BINARY_TOOL = (DIPC_CONFIG_PORT_START << 2),
+ DIPC_CONFIG_MD_PORT_AT = (DIPC_CONFIG_PORT_START << 3),
+} dipc_config_md_port_enum;
+
+typedef enum {
+ DIPC_MODE_NOT_CONFIG,
+ DIPC_MODE_PCIE_ADV,
+ DIPC_MODE_PCIE_ONLY,
+ DIPC_MODE_DUAL_IPC,
+ DIPC_MODE_USB_ONLY,
+ DIPC_MODE_END = DIPC_MODE_DUAL_IPC,
+} dipc_mode_enum;
+
+typedef enum {
+ DIPC_INTF_NOT_CONFIG,
+ DIPC_INTF_USB,
+ DIPC_INTF_PCIE,
+ DIPC_INTF_USB_AND_PCIE,
+ DIPC_INTF_CLOSED,
+} dipc_port_intf_enum;
+
+
+
+#endif
diff --git a/mcu/custom/modem/common/custom_uem.h b/mcu/custom/modem/common/custom_uem.h
new file mode 100644
index 0000000..2658438
--- /dev/null
+++ b/mcu/custom/modem/common/custom_uem.h
@@ -0,0 +1,112 @@
+/*****************************************************************************
+* 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_uem_config.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * 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!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+#ifndef CUSTOM_UEM_CONFIG_H
+#define CUSTOM_UEM_CONFIG_H
+
+#include "kal_general_types.h"
+
+#if 0
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#ifdef __VIBRATION_SPEAKER_SUPPORT__
+/* under construction !*/
+/* under construction !*/
+#endif
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#else
+#include "device.h"
+
+#endif
+
+#endif /* CUSTOM_UEM_CONFIG_H*/
diff --git a/mcu/custom/modem/common/customer_ps_inc.h b/mcu/custom/modem/common/customer_ps_inc.h
new file mode 100644
index 0000000..f3a29a7
--- /dev/null
+++ b/mcu/custom/modem/common/customer_ps_inc.h
@@ -0,0 +1,227 @@
+/*****************************************************************************
+* 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:
+ * ---------
+ * customer_ps_inc.h
+ *
+ * Project:
+ * --------
+ * MAUI
+ *
+ * Description:
+ * ------------
+ * This file is intends for include file of PS customization parameters.
+ *
+ * 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!
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#ifndef _CUSTOMER_PS_INC_H
+#define _CUSTOMER_PS_INC_H
+#ifdef __UNIFIED_MESSAGE_ARCHIVE_SUPPORT__
+#define CM_SMS_MAX_ARMSG_NUM 100
+#endif
+/* For customer define SMS message box number. */
+/* This parameter means total number of SMS stored in SIM and NVRAM can be read. */
+
+/* This value is to define the maximun segment number of EMS short message. */
+#ifdef __EMS_REL5__
+#define MMI_SMS_MAX_MSG_SEG 8
+#else
+#define MMI_SMS_MAX_MSG_SEG 4
+#endif
+
+/* In later branch, each entry costs (46 + 2* MMI_SMS_MAX_MSG_SEG) bytes. */
+#define CM_SMS_MAX_MSG_NUM SMS_TOTAL_ENTRY
+
+/* From 3GPP 23.040, if __EMS_REL5__ is NOT turned ON, segment number shall be */
+/* larger than 8 segments. */
+#ifdef __EMS_REL5__
+#if MMI_SMS_MAX_MSG_SEG < 8
+#error segment number shall be larger than 8 for EMS 5.0
+#endif
+
+#endif
+
+/* The value defines the buffer size for EMS objects, such as pre-defined animation. */
+/* The more of buffer size would support more objects numbers. */
+#define EMS_OBJ_BUFF_SIZE_PER_SEG 300
+
+/* For EMS 5.1, the buffer for raw data of objects is separated to another memory pool. */
+/* The pool size is (MMI_SMS_MAX_MSG_SEG * 140 * EMS_RATIO_OF_OBJ_PDU_BUFF). */
+/* 140 is the max size of a SMS */
+
+/* The more of EMS_RATIO_OF_OBJ_PDU_BUFF value will support */
+/* the larger objects which is compressed in higher compression ratio. */
+
+/* The ratio can be a float value, for example, 1.5, 2.5 */
+
+#ifdef __EMS_REL5__
+#define EMS_RATIO_OF_OBJ_PDU_BUFF 2
+#endif
+
+
+/* TOTAL memory cost in EMS library : */
+/* If __EMS_REL5__ is NOT turned ON : */
+/* memory costs = 2 * CM_SMS_MAX_MSG_NUM * (EMS_OBJ_BUFF_SIZE_PER_SEG + 310) bytes */
+
+/* If __EMS_REL5__ is turned ON : */
+/* memory costs = 2 * CM_SMS_MAX_MSG_NUM * (EMS_OBJ_BUFF_SIZE_PER_SEG + 310 + */
+/* 140 *EMS_RATIO_OF_OBJ_PDU_BUFF) bytes */
+
+/* ps: 310 bytes per segment are for text string buffer */
+
+
+/* display when concatenated segment missed */
+/* for example: a 3-segment concatenated message, but 2nd segment misses. */
+/* MMI would show : "content of seg1(.....)content of seg3 " */
+/* Note :DO NOT use the UCS2 coding string . */
+#define EMS_MISS_SEG_DELIMIT_STR "(.....)"
+
+//#include "customer_email_num.h"
+
+#ifndef __OPTR_NONE__
+ #include "op_custom_ps_inc.h"
+#endif
+
+/* =========================================================================== */
+
+#endif /* _CUSTOMER_PS_INC_H */
+