[Feature][Modem]Update MTK MODEM V1.6 baseline version: MOLY.NR15.R3.MD700.IVT.MP1MR3.MP.V1.6
MTK modem version: MT2735_IVT_MOLY.NR15.R3.MD700.IVT.MP1MR3.MP.V1.6.tar.gz
RF modem version: NA
Change-Id: I45a4c2752fa9d1a618beacd5d40737fb39ab64fb
diff --git a/mcu/service/mtf/base/mt_dispatcher.c b/mcu/service/mtf/base/mt_dispatcher.c
new file mode 100644
index 0000000..d9a37dd
--- /dev/null
+++ b/mcu/service/mtf/base/mt_dispatcher.c
@@ -0,0 +1,154 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of MediaTek Inc. (C) 2012
+*
+* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ * mt_task.c
+ *
+ * Project:
+ * --------
+ * UMOLYA
+ *
+ * Description:
+ * ------------
+ * MT_Framework task implement
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *
+ * ==========================================================================
+ * $Log$
+ *
+ *
+ ****************************************************************************/
+
+/*****************************************************************************/
+/* Includes */
+/*****************************************************************************/
+
+#include "mt.h"
+#include "mt_dispatcher.h"
+
+/*****************************************************************************/
+/* Define */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Global variables */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* External functions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Internal functions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Function Body */
+/*****************************************************************************/
+
+int
+mt_dispatcher_entry_init(void* entry, kal_uint16 magic, kal_uint32 dispatch_key, kal_uint32 dispatch_key_mask)
+{
+ mt_dispatcher_entry_head_t *h = entry;
+ if (h->inited) {
+ return -1;
+ }
+
+ h->magic = magic;
+ h->inited = KAL_TRUE;
+ h->dispatch_key = dispatch_key;
+ h->next = NULL;
+ h->dispatch_key_mask= dispatch_key_mask;
+
+ return 0;
+}
+
+int
+mt_dispatcher_add_entry(mt_dispatcher_list_t *list, kal_uint32 code, void* entry)
+{
+ mt_dispatcher_entry_head_t *e = entry;
+ e->next = NULL;
+ e->dispatch_key = code;
+ if (list->tail == NULL) {
+ list->head = list->tail = e;
+ } else {
+ list->tail = ((mt_dispatcher_entry_head_t *)list->tail)->next = e;
+ }
+
+ return 0;
+}
+
+void*
+mt_dispatcher_find_entry(mt_dispatcher_list_t *list, kal_uint32 code, void* last_entry)
+{
+ mt_dispatcher_entry_head_t *e = (last_entry?((mt_dispatcher_entry_head_t *)last_entry)->next:list->head);
+ while(e) {
+ if (e->dispatch_key_mask == RULE_CODE_MASK_FLAG_ALL_ON && e->dispatch_key == code)
+ {
+ return e;
+ }
+ else if (e->dispatch_key_mask == RULE_CODE_MASK_FLAG_ALL_OFF)
+ {
+ return e;
+ }
+ else if(((e->dispatch_key_mask & RULE_CODE_MASK_ICD_TYPE_FLAG_ON)?(GET_ICD_TYPE_FROM_RULE_CODE(e->dispatch_key) == GET_ICD_TYPE_FROM_RULE_CODE(code)):KAL_TRUE)
+ && ((e->dispatch_key_mask & RULE_CODE_MASK_ICD_CODE_FLAG_ON)?(GET_ICD_CODE_FROM_RULE_CODE(e->dispatch_key) == GET_ICD_CODE_FROM_RULE_CODE(code)):KAL_TRUE)
+ && ((e->dispatch_key_mask & RULE_CODE_MASK_ICD_PROTOCOL_FLAG_ON)?(GET_ICD_PROTOCOL_FROM_RULE_CODE(e->dispatch_key) == GET_ICD_PROTOCOL_FROM_RULE_CODE(code)):KAL_TRUE))
+ {
+ return e;
+ }
+ e = e->next;
+ }
+ return NULL;
+}
+void
+mt_dispatcher_verify(void* d, kal_uint16 magic)
+{
+ mt_dispatcher_entry_head_t *e = d;
+ EXT_ASSERT(e->magic == magic, e->magic, magic, 0);
+}
+
+void
+mt_dispatcher_init()
+{
+ EXT_ASSERT(MT_DISPATCHER_ENTRY_RESERVED_SIZE >= sizeof(mt_dispatcher_entry_head_t), MT_DISPATCHER_ENTRY_RESERVED_SIZE, sizeof(mt_dispatcher_entry_head_t), 0);
+}
diff --git a/mcu/service/mtf/base/mt_task.c b/mcu/service/mtf/base/mt_task.c
new file mode 100644
index 0000000..0947dcd
--- /dev/null
+++ b/mcu/service/mtf/base/mt_task.c
@@ -0,0 +1,294 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of MediaTek Inc. (C) 2012
+*
+* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ * mt_task.c
+ *
+ * Project:
+ * --------
+ * UMOLYA
+ *
+ * Description:
+ * ------------
+ * MT_Framework task implement
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *
+ * ==========================================================================
+ * $Log$
+ *
+ *
+ ****************************************************************************/
+
+/*****************************************************************************/
+/* Includes */
+/*****************************************************************************/
+#include "mt.h"
+#include "mte_if.h"
+#include "mt_dispatcher.h"
+#include "mtf_msgid.h"
+#include "em_msgid.h"
+#include "dhl_trace.h"
+#include "dhl_def.h"
+
+#include "srv_modid.h"
+
+#include "tst_msgid.h"
+#include "tst_sap.h"
+
+#include "nvram_defs.h"
+#include "nvram_interface.h"
+#include "nvram_msgid.h"
+
+
+/*****************************************************************************/
+/* Define */
+/*****************************************************************************/
+
+#define MT_MAGIC_FORMATTER (0x8877)
+#define MT_MAGIC_ELEMENT (0x5566)
+
+#define MT_FORMATTER_MASK (0x1111)
+
+/*****************************************************************************/
+/* Global variables */
+/*****************************************************************************/
+mt_context_t mt;
+event_scheduler *mtf_event_scheduler;
+/*****************************************************************************/
+/* External functions */
+/*****************************************************************************/
+extern nvram_ltable_entry_struct logical_data_item_table_mtf[];
+
+/*****************************************************************************/
+/* Internal functions */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Function Body */
+/*****************************************************************************/
+
+
+void
+mt_register_formatter(mt_formatter_t *formatter)
+{
+ int result;
+ EXT_ASSERT(formatter, 0, 0, 0);
+ EXT_ASSERT(formatter->fmt_id < MT_FMT_MAX, formatter->fmt_id, MT_FMT_MAX, 0);
+
+ result = mt_dispatcher_entry_init(formatter, MT_MAGIC_FORMATTER, formatter->ilm_msg_id, MT_FORMATTER_MASK);
+ EXT_ASSERT(result == 0, result, 0, formatter->ilm_msg_id);
+
+ mt.formatter[formatter->fmt_id] = formatter;
+
+ if (formatter->fmt_id != MT_FMT_ILM) {
+ result = mt_dispatcher_add_entry(&mt.formatter_list, formatter->ilm_msg_id, formatter);
+ EXT_ASSERT(result == 0, result, formatter->fmt_id, 0);
+ }
+}
+
+void
+mt_register_mte_rule(mte_rule_t *mte_rule)
+{
+ mt_register_mte_rule_with_mask(mte_rule, RULE_CODE_MASK_FLAG_ALL_ON);
+}
+
+void
+mt_register_mte_rule_with_mask(mte_rule_t *mte_rule, kal_uint32 rule_code_mask)
+{
+ int result;
+ mt_formatter_t *f;
+
+ EXT_ASSERT(mte_rule, 0, 0, 0);
+ EXT_ASSERT(mte_rule->fmt_id < MT_FMT_MAX, mte_rule, mte_rule->fmt_id, mte_rule->code);
+ EXT_ASSERT(mte_rule->execute, mte_rule, mte_rule->fmt_id, mte_rule->code);
+
+ result = mt_dispatcher_entry_init(mte_rule, MT_MAGIC_ELEMENT, mte_rule->code, rule_code_mask);
+ EXT_ASSERT(result == 0, result, mte_rule->fmt_id, mte_rule->code);
+
+ f = mt.formatter[mte_rule->fmt_id];
+ EXT_ASSERT(f, mte_rule->fmt_id, mte_rule, 0);
+
+ result = mt_dispatcher_add_entry(&f->element_list, mte_rule->code, mte_rule);
+ EXT_ASSERT(result == 0, result, mte_rule->code, mte_rule);
+}
+
+
+kal_bool mt_send_to_framework(ilm_struct *ilm_ptr)
+{
+ if(ilm_ptr->msg_id == MSG_ID_DHL_MT_ICD_IND ||
+ ilm_ptr->msg_id == MSG_ID_DHL_MT_PEER_TRACE_IND ||
+#ifdef __IMS_SUPPORT__
+ ilm_ptr->msg_id == MSG_ID_EM_IMC_SIP_INFO_IND ||
+#endif
+ ilm_ptr->msg_id == MSG_ID_EM_RRCE_NW_PEER_MSG_INFO_IND)
+ {
+ //ICD or PEER_TRACE formatter would use Peer buffer
+ hold_peer_buff(ilm_ptr->peer_buff_ptr);
+ }
+
+ hold_local_para(ilm_ptr->local_para_ptr);
+ ilm_ptr->dest_mod_id = MOD_MT;
+ ilm_ptr->sap_id = MTF_SAP;
+ //provide temp solution wariting for DMF confirm how to handle peer_buff == NULL
+ if(ilm_ptr->msg_id == MSG_ID_DHL_MT_ICD_IND && NULL == ilm_ptr->peer_buff_ptr){
+ dhl_print(TRACE_INFO, DHL_USER_FLAG_NONE, MOD_MT, "[MT][Warning] cancel to DMF: null ICD info");
+ return KAL_FALSE;
+ }
+ msg_send(ilm_ptr);
+ return KAL_TRUE;
+}
+
+kal_bool
+mt_task_init()
+{
+ mtf_event_scheduler = evshed_create("MTFEvs", MOD_MT, 0, MAX_DELAY_UNLIMITED);
+ evshed_set_index(mtf_event_scheduler, MTF_USER_TIMER_ID);
+
+ mt_dispatcher_init();
+ mt_formatters_init();
+ mt_elements_init();
+
+ nvram_ltable_register(logical_data_item_table_mtf);
+ return KAL_TRUE;
+}
+
+kal_bool
+mt_task_reset(void)
+{
+ evshed_delete_all_events(mtf_event_scheduler);
+ mt_elements_reset();
+ return KAL_TRUE;
+}
+
+
+extern void mte_att_set_em_filters();
+extern void mte_att_set_icd_filters();
+void mt_tst_inject_string_hdlr(ilm_struct *ilm_ptr)
+{
+ tst_module_string_inject_struct *msg_ptr;
+
+ msg_ptr = (tst_module_string_inject_struct*) ilm_ptr->local_para_ptr;
+
+ switch(msg_ptr->index)
+ {
+
+ default:
+ break;
+ }
+}
+
+void
+mt_task_main(task_entry_struct* task_entry_ptr)
+{
+ ilm_struct current_ilm;
+
+ kal_set_active_module_id(MOD_MT);
+ dhl_print(TRACE_STATE, DHL_USER_FLAG_NONE, MOD_MT, "enter mt_task_main");
+
+ mt_elements_init_proc();
+
+ while(1) {
+ mt_formatter_t *f;
+ mt_msginfo_t m;
+ mte_rule_t *r = NULL;
+
+ msg_receive_extq(¤t_ilm);
+
+
+ if (current_ilm.msg_id == MSG_ID_TST_INJECT_STRING)
+ {
+ mt_tst_inject_string_hdlr(¤t_ilm);
+ continue;
+ }
+
+ if(current_ilm.msg_id == MSG_ID_TIMER_EXPIRY)
+ {
+ kal_uint16 timer_indx = evshed_get_index(¤t_ilm);
+ if(timer_indx == MTF_USER_TIMER_ID)
+ {
+ evshed_timer_handler(mtf_event_scheduler);
+ }
+ continue;
+ }
+ if(current_ilm.msg_id == MSG_ID_NVRAM_WRITE_CNF)
+ {
+ mt_nvram_write_cnf_hdlr(¤t_ilm);
+ destroy_ilm(¤t_ilm);
+ continue;
+ }
+
+ if (!(f = mt_dispatcher_find_entry(&mt.formatter_list, current_ilm.msg_id, NULL))) {
+ f = mt.formatter[MT_FMT_ILM];
+ }
+ if (!f) {
+ continue;
+ }
+ mt_dispatcher_verify(f, MT_MAGIC_FORMATTER);
+
+
+ f->extract_msginfo(¤t_ilm, &m);// put current ilm content to msginfo
+
+
+ while ((r = mt_dispatcher_find_entry(&f->element_list, m.code, r))) {
+ mt_dispatcher_verify(r, MT_MAGIC_ELEMENT);
+ r->code = m.code;// for masking code user to get current code
+ r->execute(r, m.msg, m.msg_size);
+ }
+ destroy_ilm(¤t_ilm);
+ }
+}
+
+#ifndef STANDALONE_TEST
+kal_bool
+mt_create(comptask_handler_struct **handle)
+{
+ static const comptask_handler_struct task_handler_info =
+ {
+ mt_task_main, /* task entry function */
+ mt_task_init, /* task initialization function */
+ mt_task_reset /* task reset handler */
+ };
+
+ *handle = (comptask_handler_struct *)&task_handler_info;
+ return KAL_TRUE;
+}
+#endif
diff --git a/mcu/service/mtf/base/mt_task_clean.c b/mcu/service/mtf/base/mt_task_clean.c
new file mode 100644
index 0000000..a6a5a75
--- /dev/null
+++ b/mcu/service/mtf/base/mt_task_clean.c
@@ -0,0 +1,100 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of MediaTek Inc. (C) 2012
+*
+* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ * mt_task_clean.c
+ *
+ * Project:
+ * --------
+ * UMOLYA
+ *
+ * Description:
+ * ------------
+ * implementation for cleanning of MT_Framework task
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *
+ * ==========================================================================
+ * $Log$
+ *
+ *
+ ****************************************************************************/
+
+/*****************************************************************************/
+/* Includes */
+/*****************************************************************************/
+#include "kal_public_defs.h"
+#include "kal_general_types.h"
+#include "kal_public_api.h"
+
+
+/*****************************************************************************/
+/* Define */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* Global variables */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/* External functions */
+/*****************************************************************************/
+extern void dmf_module_clean(void);
+
+/*****************************************************************************/
+/* Internal functions */
+/*****************************************************************************/
+void mt_task_clean_handler(void);
+
+/*****************************************************************************/
+/* Function Body */
+/*****************************************************************************/
+
+
+void mt_task_clean_handler(void)
+{
+
+#ifdef __DMF_SUPPORT__
+ dmf_module_clean();
+#endif
+
+}
+