[Feature]Upload Modem source code

Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/interface/protocol/general/sim_public_struct.h b/mcu/interface/protocol/general/sim_public_struct.h
new file mode 100644
index 0000000..30aa030
--- /dev/null
+++ b/mcu/interface/protocol/general/sim_public_struct.h
@@ -0,0 +1,460 @@
+/*****************************************************************************
+*  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).
+*
+*****************************************************************************/
+ /*******************************************************************************
+ *  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) 2001
+ *
+ *******************************************************************************/
+
+ /*******************************************************************************
+ * Filename:
+ * ---------
+ *   sim_public_struct.h
+ *
+ * Project:
+ * --------
+ *   MAUI
+ *
+ * Description:
+ * ------------
+ *   SIM related message structure (outside PS)
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *==============================================================================
+ *******************************************************************************/
+#ifndef SIM_PUBLIC_STRUCT_H
+#define SIM_PUBLIC_STRUCT_H
+
+#include "kal_general_types.h"
+#include "kal_public_defs.h"
+#include "sim_public_enum.h"
+#include "ps_public_struct.h"
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8  ef_imsi[9];
+} sim_ready_ind_struct;
+
+/* MAUI_01949579 mtk02374 20090903 for CTA GEMINI new bootup*/
+typedef struct {
+   LOCAL_PARA_HDR
+   kal_uint8 src_id;
+} sim_reset_req_struct;
+
+typedef struct {
+   LOCAL_PARA_HDR
+   kal_uint8 src_id;
+   kal_bool is_sim_inserted;
+   kal_bool is_sim_exist;  // For C2K fatcory mode detect SIM insert or not
+                           // Because for C2K project, UIM only or CSIM only or 3G CT card is_sim_inserted will be KAL_FALSE
+   kal_bool is_ct3g_sim_inserted;
+} sim_reset_cnf_struct;
+
+/*mtk01612:  [MAUI_02023545] BT_SIM_Profile for MAUI and DUMA*/
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+} bt_sim_connect_req_struct;
+
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint16 result;
+    kal_uint8 current_transport_protocol_type;
+    kal_uint8 supported_transport_protocol_type_capability;
+    kal_uint16 atr_len;
+    kal_uint8 atr[ATR_MAX_LEN];
+    kal_uint8 src_id;    
+} bt_sim_connect_cnf_struct;
+
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint8 transport_protocol_type;
+    kal_uint8 src_id;    
+} bt_sim_reset_req_struct;
+
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint16 result;
+    kal_uint8 current_transport_protocol_type;
+    kal_uint16 atr_len;
+    kal_uint8 atr[ATR_MAX_LEN];
+    kal_uint8 src_id;        
+    kal_uint8 supported_transport_protocol_type_capability;
+} bt_sim_reset_cnf_struct;
+
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint8 transport_protocol_type;
+    kal_uint16 apdu_req_len;
+    kal_uint8 apdu_req[APDU_REQ_MAX_LEN];
+    kal_uint8 src_id;    
+} bt_sim_apdu_req_struct;
+
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint16 result;
+    kal_uint16 apdu_rsp_len;
+    kal_uint8 apdu_rsp[APDU_RSP_MAX_LEN];
+    kal_uint8 src_id;    
+} bt_sim_apdu_cnf_struct;
+
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+} bt_sim_disconnect_req_struct;
+
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint16 result;
+    kal_uint8 src_id;
+} bt_sim_disconnect_cnf_struct;
+
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+} bt_sim_power_off_req_struct;
+
+typedef struct
+{
+    LOCAL_PARA_HDR
+    kal_uint16 result;
+    kal_uint8 src_id;    
+} bt_sim_power_off_cnf_struct;
+
+typedef bt_sim_reset_req_struct bt_sim_power_on_req_struct;
+typedef bt_sim_reset_cnf_struct bt_sim_power_on_cnf_struct;
+
+/* MAUI_02953154 */
+typedef struct
+{
+   LOCAL_PARA_HDR
+   kal_uint16 file_idx;
+   kal_uint16 para; /* Low byte(P1) is record index. High byte(P2) indicate search mode but now it's RFU, only support search forward from index P1 */
+   kal_uint8 access_id;
+   kal_uint8 path[6];   
+   kal_uint8 src_id;
+   kal_uint8 pattern_len; /* pattern data size is MAX_SUPPORT_RECORD_SIZE at most */
+   kal_uint8 data[MAX_SUPPORT_RECORD_SIZE+6];  /* max pattern data size + 6 bytes space for command header */
+   kal_uint8 sfi;
+} sim_search_record_req_struct;
+    
+typedef struct
+{
+   LOCAL_PARA_HDR
+   kal_uint16 file_idx;   
+   kal_uint16 para;        
+   kal_uint8 access_id;  
+   kal_uint8 src_id;
+   kal_uint16 result; 
+   kal_uint16 status_word;   
+   kal_uint8 record_num;  /* number of pattern matched records. MAX_SUPPORT_RECORD_NUM at most */
+   kal_uint8 record[258]; /* max APDU response data size 256 + 2 bytes preserved for SIM dirver */
+} sim_search_record_cnf_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8   rand[16];
+    kal_bool    is_auth_present;
+    kal_uint8   auth[16];
+    kal_uint8   src_id; /*[MAUI_02602650] mtk01612: AT+EAUTH authentication through AT cmd*/
+    kal_uint8   trans_id; /*[ALPS02825711] NAS shall only use the CNF with the same trans_id of REQ.*/
+    uicc_auth_mode_enum mode;
+    kal_uint8   channel_id;
+    kal_uint8   command_len;
+    kal_uint8   command_data[256];
+} sim_authenticate_req_struct, sim_app_authenticate_req_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    sim_cmd_result_enum result;
+    kal_uint16 status_word;
+    kal_uint8   kc[8];
+    kal_uint8   sres[4];
+    kal_uint8   ck[16];
+    kal_uint8   ik[16];
+    kal_uint8   res[16];
+    kal_uint8   res_len;
+    kal_uint8   auts[16];
+    kal_uint8   auts_len;
+    kal_uint8   auth_res[256]; /*[MAUI_02602650] mtk01612: AT+EAUTH authentication through AT cmd. This should be the same as USIM_MAX_AUTHENTICATE_RSP_LEN */
+    kal_uint16  auth_res_len;  /*[MAUI_02602650] mtk01612: AT+EAUTH authentication through AT cmd.*/
+    kal_uint8   src_id; /*[MAUI_02602650] mtk01612: AT+EAUTH authentication through AT cmd.*/
+    kal_uint8   trans_id; /*[ALPS02825711] NAS shall only use the CNF with the same trans_id of REQ.*/
+} sim_authenticate_cnf_struct, sim_app_authenticate_cnf_struct;
+
+typedef struct{
+    kal_uint8 length;
+    kal_uint8 atr[ATR_MAX_LEN];
+}sim_atr_struct;
+
+typedef struct{
+    kal_bool is_sim_inserted;
+    kal_bool is_df_gsm_existed;
+    kal_bool is_df_cdma_existed;
+    kal_bool is_csim_app_existed;
+    kal_bool is_usim_app_existed;
+    kal_bool is_isim_app_existed;
+    kal_bool try_usim_success;
+    kal_bool try_sim_success;
+    kal_uint8 csim_aid_len;
+    kal_uint8 csim_aid[16];
+    kal_uint8 usim_aid_len;
+    kal_uint8 usim_aid[16];
+    kal_uint8 isim_aid_len;
+    kal_uint8 isim_aid[16];
+}sim_cdma_struct;
+
+typedef struct{
+    LOCAL_PARA_HDR
+    kal_uint16 card_type;
+    usim_logic_channel_enum USIMchan;
+    usim_logic_channel_enum ISIMchan;
+    kal_uint8 atr_length;
+    kal_uint8 atr[ATR_MAX_LEN];
+    kal_uint8 remote_sim_protocol_task;
+    kal_uint8 sim_slot_id;
+    kal_bool is_imsi_valid;
+    kal_uint8 imsi[9];
+    kal_bool sim_start_req;
+    kal_bool is_ad_valid;
+    kal_uint8 ad[4];
+    kal_bool is_iccid_valid;
+    kal_uint8 iccid[10];
+    kal_uint8 iccid_fcp_len;
+    kal_uint8 iccid_fcp[50];
+    kal_bool is_pl_valid;
+    kal_uint8 pl_len;
+    kal_uint8 pl[10];
+    kal_uint8 pl_fcp_len;
+    kal_uint8 pl_fcp[50];
+    kal_uint8 dir_record_size; // size of 1 record
+    kal_uint8 dir_record_num;
+    kal_uint8 dir_content[255];
+    sim_chv_info_struct chv_info;
+    kal_uint8 imsi_m_fcp_len;
+    kal_uint8 imsi_m_fcp[50];
+    // Is there valid PIN DO in the application USIM?
+    kal_bool is_usim_valid_pin_do;
+    // To info the task UIM if  the STARTUP_READ_FINISH_IND and APP INIT have to be sent in the task UIM or not
+    // KAL_TRUE: UIM DOESN'T NEED to send STARTUP_READ_FINISH_IND
+    // KAL_FALE: Default value. the task UIM keep the original logic
+    kal_bool is_start_finish_ind_noneeded;
+}sim_status_ind_struct;
+
+/* <modem_status>: 
+   0: only MD1 active 
+   1: MD1's RF is closed, but MD1's SIM task is still working only for MD3 SIM remote access and MD3 active 
+   2: both MD1 and MD3 active, but there is at least USIM application existed on the MD1's card 
+   <remote_sim_protocol_task>: 
+   0: MD3 access local card 
+   1: MD3 access MD1's SIM task1 
+   2: MD3 access MD1's SIM task2 */
+typedef struct{
+    LOCAL_PARA_HDR
+    kal_uint8 modem_status;
+    kal_uint8 remote_sim_protocol_task;
+}sim_mdstatus_update_req_struct;
+
+typedef union {
+    sim_atr_struct atr;
+    sim_cdma_struct cdma;
+	kal_uint8 sim_reset_volt; /* 1 = 5V, 2 = 3V. 3 = 1.8V */
+    kal_uint8 command_header[CMD_HEADER_LEN]; /* 5 bytes header information: CLA,INS,P1,P2,P3 */
+} sim_query_info_field;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+    sim_query_info_enum info_id;
+} sim_query_info_req_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+    sim_cmd_result_enum result;
+    sim_query_info_enum info_id;
+    sim_query_info_field info_data;
+} sim_query_info_cnf_struct;
+
+/* Skyroam Start */
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+    kal_bool  is_apvsim_on;
+    kal_bool  is_apvsim_ready;
+} sim_set_apvsim_mode_req_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+    sim_cmd_result_enum result;
+} sim_set_apvsim_mode_cnf_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+    kal_uint8 atr_status;
+    kal_uint32 atr_length;
+    kal_uint8 atr[ATR_MAX_LEN];
+} sim_rsa_atr_req_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+    sim_cmd_result_enum result;
+} sim_rsa_atr_cnf_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+} sim_rsa_reset_ind_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint32 apdu_len;
+    kal_uint8 apdu[APDU_REQ_MAX_LEN];
+} sim_rsa_apdu_ind_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+    //kal_uint8 apdu_status;
+    kal_uint32 rsp_len;
+    kal_uint8 rsp[APDU_RSP_MAX_LEN];
+} sim_rsa_apdu_rsp_req_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id; 
+    sim_cmd_result_enum result;
+} sim_rsa_apdu_rsp_cnf_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+} sim_rsa_hot_plug_out_req_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+    sim_cmd_result_enum result;
+} sim_rsa_hot_plug_out_cnf_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+} sim_rsa_hot_plug_in_req_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 src_id;
+    sim_cmd_result_enum result;
+} sim_rsa_hot_plug_in_cnf_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 mode;
+} sim_rsa_power_down_ind_struct;
+/* Skyroam End */
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 config_bin_name[30];
+} sim_ut_set_config_bin_req_struct;
+
+typedef struct
+{
+    kal_bool repeat_mode;
+    kal_uint16 prefix_len;
+    kal_uint8 c_apdu_prefix[256];
+    kal_bool is_sw0000;
+} sim_ut_monitor_apdu_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 num_prefix;
+    sim_ut_monitor_apdu_struct monitor_capdu[5];
+} sim_ut_config_ind_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint8 which_prefix;
+    kal_uint16 apdu_len;
+    kal_uint8 apdu[APDU_REQ_MAX_LEN];
+} sim_ut_capdu_ind_struct;
+
+typedef struct {
+    LOCAL_PARA_HDR
+    kal_uint16 rsp_len;
+    kal_uint8 rsp[256];
+    kal_uint16 status_word;
+} sim_ut_rapdu_rsp_struct;
+
+typedef struct
+{
+	LOCAL_PARA_HDR
+	kal_uint16	src_id;		/* source module to send this request */
+	kal_uint8	mode;		/* 0 - query, 1 - set */
+	kal_uint8 	control;	/* 0 - disable multiple SIM, 1 - enable multiple SIM */
+	sim_restrict_card_type_enum card_type;
+} sim_restrict_card_type_req_struct;
+
+typedef struct
+{
+	LOCAL_PARA_HDR
+	kal_uint16	src_id;		/* same to the value in request message */
+	kal_uint8	mode;		/* 0 - query, 1 - set */
+	kal_uint8 	control;	/* 0 - disable multiple SIM, 1 - enable multiple SIM */
+	sim_restrict_card_type_enum card_type;
+	kal_bool	result;
+} sim_restrict_card_type_cnf_struct;
+
+#endif
+