[Feature]Upload Modem source code

Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/custom/protocol/common/ps/custom_ssds.h b/mcu/custom/protocol/common/ps/custom_ssds.h
new file mode 100644
index 0000000..2b7424d
--- /dev/null
+++ b/mcu/custom/protocol/common/ps/custom_ssds.h
@@ -0,0 +1,313 @@
+/*****************************************************************************
+*  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) 2006
+*
+*  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_ssds.h
+ *
+ * Project:
+ * --------
+ *
+ * Description:
+ * ------------
+ *    *
+ * Author:
+ * -------
+ * -------
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#ifndef __CUSTOM_SSDS_H__
+#define __CUSTOM_SSDS_H__
+
+#include "sim_exported_enum.h"
+#include "l3_inc_enums_public.h"
+
+typedef enum
+{
+    CUSTOM_SSDS_ATCMD_TYPE_SET_CALL_FORWARDING,
+    CUSTOM_SSDS_ATCMD_TYPE_GET_CALL_FORWARDING,
+    CUSTOM_SSDS_ATCMD_TYPE_SET_CALL_WAITING,
+    CUSTOM_SSDS_ATCMD_TYPE_GET_CALL_WAITING,
+    CUSTOM_SSDS_ATCMD_TYPE_SET_CALL_BARRING,
+    CUSTOM_SSDS_ATCMD_TYPE_GET_CALL_BARRING,
+    CUSTOM_SSDS_ATCMD_TYPE_SET_CLIR,
+    CUSTOM_SSDS_ATCMD_TYPE_GET_CLIR,
+    CUSTOM_SSDS_ATCMD_TYPE_SET_CLIP,
+    CUSTOM_SSDS_ATCMD_TYPE_GET_CLIP,
+    CUSTOM_SSDS_ATCMD_TYPE_SET_COLP,
+    CUSTOM_SSDS_ATCMD_TYPE_GET_COLP,
+    CUSTOM_SSDS_ATCMD_TYPE_SET_COLR,
+    CUSTOM_SSDS_ATCMD_TYPE_GET_COLR,
+    CUSTOM_SSDS_ATCMD_TYPE_UNKNOWN
+
+}custom_ssds_atcmd_type;
+
+typedef enum
+{
+    CUSTOM_SSDS_PATH_TYPE_PS_PREFER,          /*Support XCAP and CS. And with PS prefer*/
+    CUSTOM_SSDS_PATH_TYPE_PS_ONLY,            /*XCAP only*/
+    CUSTOM_SSDS_PATH_TYPE_CS_ONLY,            /*CS only*/
+    CUSTOM_SSDS_PATH_TYPE_NOT_SUPPORT_409,        /*not support: return error 409*/
+    CUSTOM_SSDS_PATH_TYPE_NOT_SUPPORT_832,        /*not support: return error 832*/
+    CUSTOM_SSDS_PATH_TYPE_NOT_SUPPORT_CCWA,        /*not support: return +CCWA:0xff,0, then OK*/
+    CUSTOM_SSDS_PATH_TYPE_NOT_SUPPORT_403,        /*not support: return error 403*/
+    CUSTOM_SSDS_PATH_TYPE_NOT_SUPPORT_100,        /*not support: return error 100*/
+    CUSTOM_SSDS_PATH_TYPE_PS_ONLY_SET_TO_QUERY,           /*XCAP only, Specail for call waiting: change to query operation*/
+    CUSTOM_SSDS_PATH_TYPE_PS_ONLY_SET_TO_QUERY_PDN, /* XCAP only, return the status of PDN establishment successful or not */
+	CUSTOM_SSDS_PATH_TYPE_NOT_SUPPORT_31,         /*no csfb, return error 31*/
+    CUSTOM_SSDS_PATH_TYPE_CS_ONLY_ALWAYS,         /*CS  even if IMS call exist*/
+    CUSTOM_SSDS_PATH_TYPE_OPERATION_NOT_SUPPORTED_4,  /* return error 4 */
+    CUSTOM_SSDS_PATH_TYPE_OPR_DTR_BARRING_8,          /* return error 8 */
+    CUSTOM_SSDS_PATH_TYPE_CALL_BARRED_10,             /* return error 10 */
+    CUSTOM_SSDS_PATH_TYPE_SIM_PIN_REQUIRED_11,        /* return error 11 */
+    CUSTOM_SSDS_PATH_TYPE_SIM_PUK_REQUIRED_12,        /* return error 12 */
+    CUSTOM_SSDS_PATH_TYPE_NOT_FOUND_404,              /* return error 404 */
+    CUSTOM_SSDS_PATH_TYPE_PRECONDITION_FAILED_412,    /* return error 412 */
+    CUSTOM_SSDS_PATH_TYPE_PHB_FDN_BLOCKED_2600,       /* return error 2600 */
+    CUSTOM_SSDS_PATH_TYPE_TB_SOLUTION,                /* CLIR/CW terminal based solution */
+    CUSTOM_SSDS_PATH_TYPE_NO_CONN_845                 /* Report no connection when data off */
+
+}custom_ssds_path_type;
+
+typedef enum
+{
+    CUSTOM_SSDS_USSD_PATH_TYPE_INVALID,
+    CUSTOM_SSDS_USSD_PATH_TYPE_IMS,                 /*Support IMS and VoPS*/
+    CUSTOM_SSDS_USSD_PATH_TYPE_CS,
+    CUSTOM_SSDS_USSD_PATH_TYPE_NOT_SUPPORT
+
+}custom_ssds_ussd_path_type;
+
+
+typedef enum
+{
+    CUSTOM_SSDS_CSFB_TYPE_ALWAYS,               /*csfb: from now on till reboot*/
+    CUSTOM_SSDS_CSFB_TYPE_ONCE,                 /*csfb: but only this time*/
+    CUSTOM_SSDS_CSFB_TYPE_NO_CCWA,              /*no csfb, return +CCWA:0xff,0, then OK*/
+    CUSTOM_SSDS_CSFB_TYPE_NO_832,               /*no csfb, return error 832*/
+    CUSTOM_SSDS_CSFB_TYPE_NO_403,               /*no csfb, return error 403*/
+    CUSTOM_SSDS_CSFB_TYPE_NO_4,               /*no csfb, return error 409*/
+    CUSTOM_SSDS_CSFB_TYPE_NO_409,               /*no csfb, return error 409*/
+    CUSTOM_SSDS_CSFB_TYPE_NO_31,               /*no csfb, return error 31*/
+    CUSTOM_SSDS_CSFB_TYPE_NO                    /*csfb: no*/
+
+}custom_ssds_csfb_type;
+
+typedef enum
+{
+    CUSTOM_SSDS_PDN_TYPE_XCAP,                 /*Need to setup XCAP PDN*/
+    CUSTOM_SSDS_PDN_TYPE_INTERNET,             /*Need to setup internet PDN*/
+    CUSTOM_SSDS_PDN_TYPE_NO,                   /*No need to setup PDN*/
+    CUSTOM_SSDS_PDN_TYPE_NOT_MATCH,            /*The condition of setup PDN is not matched*/
+
+}custom_ssds_pdn_type;
+
+typedef enum
+{
+    CUSTOM_SSDS_ROAMING_TYPE_NO,               /*No roaming*/
+    CUSTOM_SSDS_ROAMING_TYPE_UNKNOWN,          /*roaming, but can not tell if its domestic or international*/
+    CUSTOM_SSDS_ROAMING_TYPE_DOMESTIC,         /*Domistic roaming*/
+    CUSTOM_SSDS_ROAMING_TYPE_INTERNATIONAL,    /*International roaming*/
+
+}custom_ssds_roaming_type;
+
+typedef enum
+{
+    CUSTOM_SSDS_IMS_DOMAIN_TYPE_NONE,
+    CUSTOM_SSDS_IMS_DOMAIN_TYPE_WFC,
+    CUSTOM_SSDS_IMS_DOMAIN_TYPE_LTE,
+    CUSTOM_SSDS_IMS_DOMAIN_TYPE_OTHERS
+
+}custom_ssds_ims_domain_type;
+
+typedef enum
+{
+    CUSTOM_SSDS_PDN_FAIL_PATH_TYPE_NO_CSFB,          /*No need CSFB,return error to AP*/
+    CUSTOM_SSDS_PDN_FAIL_PATH_TYPE_CSFB_ONCE,        /*Need CSFB once*/
+    CUSTOM_SSDS_PDN_FAIL_PATH_TYPE_CSFB_ALWAYS,      /*CSFB always*/
+    CUSTOM_SSDS_PDN_FAIL_PATH_TYPE_NO_CSFB_31,       /*For CT No need CSFB,return error to AP*/
+
+}custom_ssds_pdn_fail_path_type;
+
+typedef enum
+{
+    CUSTOM_SSDS_ALL_OUTGOING_CALL_BARRING,
+    CUSTOM_SSDS_OUTGOING_CALL_BARRING,
+    CUSTOM_SSDS_INCOMING_CALL_BARRING,
+
+}custom_ssds_call_barring_type;
+
+typedef enum{
+CUSTOM_SSDS_RF_OFF,
+CUSTOM_SSDS_RF_ON,
+}custom_ssds_rf_status;
+
+typedef enum
+{
+	CUSTOM_SSDS_STATUS_NOT_CHECKED,
+	CUSTOM_SSDS_STATUS_USER_VOLTE_SUBSCRIBED,
+	CUSTOM_SSDS_STATUS_USER_VOLTE_NOT_SUBSCRIBED
+
+}custom_ssds_user_volte_subscription_status;
+
+typedef struct
+{
+    kal_int8                *atcmd_buff;
+    kal_uint16              atcmd_len;
+    custom_ssds_atcmd_type  atcmd_type;
+}custom_ssds_atcmd_info;
+
+typedef struct
+{
+	sim_interface_enum	sim_id;
+	kal_uint8			sim_type;
+    kal_char    mccmnc[7];
+
+    kal_bool    is_ct_volte_enabled;
+    kal_bool    is_ct_card;
+    rat_enum    preferred_network_type;
+    kal_bool    is_data_roaming_setting_enabled;
+    kal_bool    is_mobile_data_setting_enabled;
+	kal_bool    only_use_real_error_code;
+
+}custom_ssds_info_struct;
+
+typedef enum {
+	CUSTOM_SSDS_XCAP_NW_ERROR_NONE = 0,
+	CUSTOM_SSDS_XCAP_NW_ERROR_NW_NO_RESPONSE = 1,
+	CUSTOM_SSDS_XCAP_NW_ERROR_GEMINI_ISSUE = 2,
+	CUSTOM_SSDS_XCAP_NW_ERROR_CANNOT_CONNECT_TO_SERVER = 3,
+	CUSTOM_SSDS_XCAP_NW_ERROR_PS_ALWAYS_FAIL = 4,
+	CUSTOM_SSDS_XCAP_NW_EEROR_SERVICE_NOT_SUPPORTED = 5, // network not support this sim do xcap
+}custom_ssds_xcap_nw_error_info;
+
+typedef struct
+{
+    kal_uint32                        error_code;
+	kal_uint32                        real_error_code;
+	custom_ssds_xcap_nw_error_info    error_info;
+}custom_ssds_xcap_error_info_struct;
+
+typedef enum {
+    CUSTOM_SSDS_CFG_TYPE_MCF_OTA,
+    CUSTOM_SSDS_CFG_TYPE_MCF_OTA_BY_OP,
+    CUSTOM_SSDS_CFG_TYPE_NVRAM,
+    CUSTOM_SSDS_CFG_TYPE_MAX
+}custom_ssds_config_type;
+
+typedef enum {
+    CUSTOM_SSDS_RAT_MODE_CHANGE_TIMER_TYPE_TRIGGER = 0,
+    CUSTOM_SSDS_RAT_MODE_CHANGE_TIMER_TYPE_WAIT = 1,
+    CUSTOM_SSDS_RAT_MODE_CHANGE_TIMER_TYPE_CS_REG = 2
+}custom_ssds_rat_mode_change_timer_type;
+
+/********new design begin***********/
+//condition
+typedef struct
+{
+    sim_interface_enum	               sim_id;
+    kal_uint8                          ps_id;
+    kal_uint8			               sim_type;
+    kal_char                           mccmnc[7];
+    kal_char                           mcc[4];
+    kal_char                           mnc[4];
+    kal_uint32                         op_id;
+    custom_ssds_atcmd_type             atcmd_type;//Duplicate with atcmd_type in the atcmd_info;remove atcmd_info 
+    custom_ssds_call_barring_type      cb_type;//The type of call barring 
+    kal_bool                           is_cfu;//is call forwarding uncondition
+    kal_bool                           is_ct_volte_enabled;
+    kal_bool                           is_ct_card;
+    kal_bool                           is_ims_registered;
+    custom_ssds_ims_domain_type        ims_domain;
+    kal_bool                           ps_attached;
+    kal_bool                           lte_attached;
+	kal_bool                           nr_attached;
+    custom_ssds_rf_status              rf_status;
+    rat_enum                           preferred_network_type;
+    custom_ssds_roaming_type           roaming_status;
+    kal_bool                           is_data_roaming_setting_enabled;
+    kal_bool                           is_mobile_data_setting_enabled;
+	kal_bool                           is_imsvops_support;//for ussd
+
+    kal_uint32                         rsp_id;//only used for rsp domain selection
+    kal_uint32                         real_rsp_id;
+    custom_ssds_xcap_error_info_struct *ssds_xcap_error_info;//only used for getting disable_ut_timer vaule
+	custom_ssds_user_volte_subscription_status user_volte_subscription_status;
+
+    //the output parameter
+    kal_bool                           only_use_real_error_code;//in case of set_to_query, this value will be true
+
+}custom_ssds_params_info_struct;
+
+/********new design end*************/
+
+custom_ssds_ussd_path_type  custom_ssds_get_ussd_req_path_variable ( custom_ssds_params_info_struct *params_info );
+void custom_ssds_need_send_409_err_string_variable(module_type module,kal_bool *need_send,kal_uint32 op_id,kal_char *mccmnc);
+void custom_ssds_need_sync_cw_in_234g_variable(module_type module,kal_bool *need_sync,kal_uint32 op_id,kal_char *mccmnc);
+void custom_ssds_need_send_test_cmd(module_type module,kal_bool *need_send,kal_uint32 op_id,kal_char *mccmnc);
+void custom_ssds_ussd_is_csfb_retry_allowed(custom_ssds_params_info_struct  *params_info,kal_bool *is_ussd_csfb_allowed);
+
+kal_bool custom_ssds_need_sync_to_cs(custom_ssds_atcmd_type ss_type,kal_uint32 rsp_code);
+kal_bool custom_ssds_is_csfb_allowed(kal_uint32 op_id, kal_char *mccmnc, custom_ssds_roaming_type roaming_type);
+kal_bool custom_ssds_is_ussi_allowed_during_ims_call(custom_ssds_params_info_struct  *params_info);
+kal_bool custom_ssds_is_csfb_during_imsCall_allowed(kal_uint32 op_id,
+                                                    kal_char *mccmnc,
+                                                    custom_ssds_roaming_type roaming_type,
+                                                    custom_ssds_ims_domain_type ims_domain,
+                                                    kal_bool is_wfc_call);
+													
+custom_ssds_path_type  custom_ssds_get_req_path(custom_ssds_params_info_struct *params_info);
+custom_ssds_csfb_type  custom_ssds_get_rsp_path(custom_ssds_params_info_struct *params_info);
+kal_uint32 custom_ssds_get_disable_ut_timer_value(custom_ssds_params_info_struct *params_info);
+kal_bool custom_ssds_is_rat_mode_change_allowed(custom_ssds_params_info_struct  *params_info);
+kal_uint32 custom_ssds_get_rat_mode_change_timer_value(custom_ssds_rat_mode_change_timer_type timer_type);
+
+kal_bool custom_only_ps_supported_atcmd( custom_ssds_params_info_struct  *params_info,
+                                                              custom_ssds_path_type           *atcmd_req_type);
+
+kal_bool custom_only_cs_supported_atcmd(custom_ssds_params_info_struct  *params_info,
+                                                              custom_ssds_path_type           *atcmd_req_type);
+#endif
+