[Feature]Upload Modem source code

Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/l1/interface/gl1/l1_dm.h b/mcu/l1/interface/gl1/l1_dm.h
new file mode 100644
index 0000000..c3cf840
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_dm.h
@@ -0,0 +1,1366 @@
+/*****************************************************************************
+*  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:
+ * ---------
+ *   l1_dm.h
+ *
+ * Project:
+ * --------
+ *   Maui_Software
+ *
+ * Description:
+ * ------------
+ *   This file is for the dual mode operation.
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *============================================================================
+ *             HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+ 
+#ifndef L1_DM_H
+#define L1_DM_H
+
+#include "l1_surround_private.h"
+#include "common_reg.h"
+#include "l1d_data_l1core.h"
+#include "l1d_cid.h"
+#include "l1_types.h"
+#include "l1_core_private.h"
+#include "mph_types.h"
+#include "tool.h"
+#include "kal_general_types.h"
+#include "mll1_gsm.h"
+#include "gmss_public.h"
+
+/****************************** enum begin ************************************/
+typedef enum
+{
+   UMTS_FDD_IDLE,
+   UMTS_FDD_FACH,
+   UMTS_FDD_EFACH_DRX,
+   UMTS_FDD_DCH,
+   UMTS_TDD_IDLE,
+   UMTS_TDD_FACH,
+   UMTS_TDD_DCH,
+   UMTS_C2K_IDLE,
+   LTE_IDLE,   
+   LTE_DCH,
+   LTE_DCH_DRX,
+   GSM_IDLE,
+   GSM_DCH,
+   NEWRADIO_IDLE,
+   NEWRADIO_DCH,
+   MM_NULL
+} mm_mode_enum;
+
+#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 !*/
+#endif
+
+/****************************** enum end **************************************/
+
+
+
+/****************************** define begin ************************************/
+#define  L1C_AG_AHEAD_FRAME 9
+#define  L1C_AG_LENGTH_EBIT 173333  /* 80ms for 2G active */
+#define  L1C_AG_NOT_CNF_LENGTH   (-1)  //
+
+
+#define  L1C_NORMAL_GAP_SERVICE  (0x1)
+#define  L1C_AUTO_GAP_SERVICE    (0x2)
+#define  L1C_GAP_STOP_TIME 3 
+
+#define GL1_GAP_NUM_IN_PERIOD GSM_SESSION_IN_PERIOD
+
+/* define database switch macros for 2G standby */
+#ifdef  __GERAN_R8__ 
+#define SIM_REG_BA_OFFSET                        ( L1C_SIM1 )  //0
+#define SIM_PRIO_BA_OFFSET                       ( L1C_SIM_NUM )  //L1C_SIM_NUM
+#define SWITCH_TO_PRIO_RESEL_STANDBY()           ( l1c_sim_prio_ba_offset = SIM_PRIO_BA_OFFSET )   /* be called only when the sim is in standby mode */
+#define SWITCH_TO_REG_RESEL_STANDBY()            ( l1c_sim_prio_ba_offset = SIM_REG_BA_OFFSET )
+#define SWITCH_TO_ASSIGNED_RESEL_STANDBY( mode ) ( l1c_sim_prio_ba_offset = (( mode == REG_RESEL_STANDBY )? SIM_REG_BA_OFFSET : SIM_PRIO_BA_OFFSET ) )
+#define L1C_RESEL_MODE_STANDBY                   ( (l1c_sim_prio_ba_offset == SIM_REG_BA_OFFSET)? REG_RESEL_STANDBY : PRIO_RESEL_STANDBY )
+#define IS_PRIO_RESEL_MODE_STANDBY               ( l1c_sim_prio_ba_offset == SIM_PRIO_BA_OFFSET )
+#define IS_REG_RESEL_MODE_STANDBY                ( l1c_sim_prio_ba_offset == SIM_REG_BA_OFFSET )
+#else
+#define L1C_RESEL_MODE_STANDBY                   ( REG_RESEL_STANDBY )
+#endif  /* __GERAN_R8__ */
+
+/* define L1C MM mode macros for 2G standby */
+#define L1C_IS_CONNECTED_STANDBY(mode)           ( mode == UMTS_FDD_FACH || mode == UMTS_TDD_FACH || mode == UMTS_FDD_DCH || mode == UMTS_TDD_DCH || mode == LTE_DCH )
+#define L1C_IS_IDLE_STANDBY(mode)                ( mode == UMTS_FDD_IDLE || mode == UMTS_TDD_IDLE || mode == UMTS_C2K_IDLE || mode == LTE_IDLE || mode == NEWRADIO_IDLE )
+#define L1C_IS_IDLE_OR_CON_DRX_STANDBY(mode)     ( mode == UMTS_FDD_IDLE || mode == UMTS_TDD_IDLE || mode == UMTS_FDD_EFACH_DRX || mode == UMTS_C2K_IDLE || mode == LTE_IDLE || mode == LTE_DCH_DRX || mode == NEWRADIO_IDLE )   
+
+/* this macro must be used in 2g standby */
+#define L1C_IS_UTRAN_TDD_MODE_STANDBY(mode)      ( mode == UMTS_TDD_FACH || mode == UMTS_TDD_DCH || mode == UMTS_TDD_IDLE )
+#define L1C_IS_UTRAN_TDD_MODE_CONNECTED_STANDBY(mode) 	 ( mode == UMTS_TDD_FACH || mode == UMTS_TDD_DCH )
+
+
+#define GL1_CHECK_BIT(a, mask) ( ((a)&(mask)) != 0 )
+#define GL1_SET_BIT(a, mask)   ( (a) |= (mask) )
+#define GL1_CLEAR_BIT(a, mask) ( (a) &= ~(mask) )
+
+
+
+#define DEFAULT_PM_PASS_PER_PERIOD_IDLE 1
+#define DEFAULT_PM_PASS_PER_PERIOD_EFACH_DRX 1
+#define DEFAULT_PM_PASS_PER_PERIOD_DCH_FACH 3
+#define DEFAULT_PM_PASS_PER_PERIOD_LTE_CONNECTED_DRX 1
+#define MAX_TRIES_FB_PLMN_2G_STANDBY         2
+#define MIN_3G_GAP_FRAME 8  /* 2 blocks, to avoid PCh norm/ext case. */
+#define RF_ADDITIONAL_MARGIN_FOR_SB_HEAD_EBITS (TQ_SBWIN_DSP_EXTEND1 * 2)
+#define RF_ADDITIONAL_MARGIN_FOR_SB_TAIL_EBITS (TQ_SBWIN_DSP_EXTEND2 * 2)
+#define FB_MAX_WINDOW_SLOTS (12*8+3)
+#define FB_MAX_SEARCH_TOTAL_SLOTS (FB_MAX_WINDOW_SLOTS*8)  /* use to stop FB search if UMTS_IDLE gap < FB_MAX_WINDOW_SLOTS */
+#define FRAME_IN_EBITS 10000
+#define SLOT_IN_EBITS  1250
+#define FB_MIN_WINDOW_EBITS 2176   //TDD gap use
+#define FB_MIN_WINDOW_SLOTS 3 //FDD/LTE gap use
+
+#ifdef __UMTS_RAT__  // TDD needs 106, FDD needs 36
+#define L1_MAX_GAP_HANDLER 106
+#endif
+
+#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
+
+#ifdef __UMTS_RAT__
+#define TD_SUBFRAME_TO_EBIT 10833  //10840
+#define TD_SLOT_TO_EBIT 1462
+#define LONG_GAP_LEN_FACH_DCH 10000 //10000
+#define MIN_SB_DELAY_ALLOW_FB_SEARCH  32502  /* # of ebit for 15ms */
+#define DEFALT_BSIC_RECONFIRM_TIME               5000  /* in unit of ms */
+#define DEFALT_BSIC_SEARCH_ABORT_TIME        (DEFALT_BSIC_RECONFIRM_TIME*10/46)  /* in unit of TDMA frames */
+#endif
+
+#ifdef __GL1_GEMINI__
+#if defined( __GL1_GEMINI_WCDMA__ ) || defined( __GEMINI__ ) || defined( __CDMA2000_RAT__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ )
+#define STANDBY_MEAS_LENGTH_ACTIVE_IDLE 2 //unit: frame
+#endif
+#endif
+
+#define SRVCC_USE_CGI_AUTO_GAPS 1
+
+#if (SRVCC_USE_CGI_AUTO_GAPS)
+#define SRVCC_BOOST_IN_QDBM  1
+#define SRVCC_MAX_BOOST_RANGE_IN_QDBM   12
+#define MAX_SRVCC_BSIC_ATTEMPTS 2
+#endif
+/****************************** define end **************************************/
+
+
+/****************************** struct begin ************************************/
+typedef struct Gap_Handler Gap_Handler;
+
+struct Gap_Handler
+{
+   Time                start_time;
+   bool                pm_period_start;
+   gsm_tgmp_enum       purpose;
+   kal_uint16          gap_num;
+   sGAP                gap[GL1_MAX_GAP_NUM_IN_ONE_FRAME];
+   kal_bool            gap_reschedule;
+   Gap_Handler*        prev;
+   Gap_Handler*        next;
+};
+
+typedef struct
+{
+   Gap_Handler     GAPPool[L1_MAX_GAP_HANDLER];
+   Gap_Handler*    unusedGAPs[L1_MAX_GAP_HANDLER];
+   Gap_Handler*    usedGAPs[L1_MAX_GAP_HANDLER];     
+   Gap_Handler*    running_gap;
+   Gap_Handler*    gapTimer_gap;
+   Gap_Handler*    bsic_gap;
+   kal_uint32      t_reconfirm; /* In unit of TDMA frames(4.6ms). used for fach/dch/lte connected */
+   kal_uint32      t_identify;  /* In unit of TDMA frames(4.6ms). used for fach/dch/lte connected*/
+   kal_uint32      bsic_reconfirm_para; /* In unit of msec. Used in FACH/DCH mode. */
+   Time            next_session_start_after;  //for FB gap in the end of period, the first session in the next session must >= this time
+   uint16          fb_search_cnt_down;
+   kal_uint8       unusedGAPCount;
+   kal_uint8       usedGAPCount;
+#ifdef __LTE_RAT__
+   kal_uint8       tds_lte_left_gap_idx;  //use for lte left pattern calculation
+#endif /*__LTE_RAT__*/
+} GapGlobal;
+
+typedef struct
+{
+   mm_mode_enum          mode;
+   Timer                 activeRATTimer;
+   Timer                 standbyRATTimer;  
+   /* 3G active, common parameters */
+   kal_bool              pm_meas_started;  
+   intx                  pm_cell_num[ NUM_RESEL_MODE_STANDBY ];    
+   kal_bool              lock_sm;  
+   bool                  Dedi3G;
+   kal_uint8             GAPStatus;  //bit0: normal gap, bit1: auto gap
+   kal_bool              gap_suspended;  // fmo_lock
+   kal_uint8             wait_HW_stop_count;  /* frame countdown to wait 2G FB/SB, PM stop  */
+   bool                  umts_hspa;  //TDS
+
+   /* Power Scan */
+   kal_bool              power_scan_started;
+   kal_bool              tempStopPSM;
+   /* RSSI measurement */
+   kal_uint8             pm_pass_per_period; /* Default=1. */
+   kal_uint8             pm_pass_this_period[ NUM_RESEL_MODE_STANDBY ]; 
+   kal_uint8             pm_tid[ NUM_RESEL_MODE_STANDBY ];
+   kal_uint8             pm_tid_new[ NUM_RESEL_MODE_STANDBY ];
+   bool                  pm_tid_done[ NUM_RESEL_MODE_STANDBY ];
+   bool                  next_pm_start_time_valid;
+   kal_uint8             next_pm_pass_per_period;   //FDD connected
+   Time                  next_pm_start_time;  //FDD connected
+   intx                  next_pm_cell_num;  //connected
+   kal_uint8             arfcn_count_measured; //the number of arfcn that have been measured; reset when ba is changed or avg is reset
+#if 1 //def __GL1_GEMINI__
+//   Timer                 idleSuspendPM;  //used to stop measurement at the end of idle gap
+#endif
+   bool                  stopAllMeas;  //only TDS use
+   //bool                  skip_next_gap;  //TDS         /* after long fb search gap in FACH/DCH, skip next gap to prevent conflict */
+   Timer                 pmSessionTimer;  //TDS 
+
+   /* BSIC search */ 
+   Timer                 sbTimer;
+   Timer                 fbTimer;
+   Timer                 bsicSCTimer;
+   Timer                 dummyFBTimer;
+   Timer                 SRVCCGapSetTimer;
+   Timer                 SRVCCGapResetTimer;
+   bool                  resetSRVCCGapMeas;
+   bool                  first_gap_notify;
+   uint16                default_sb_window_ebits;
+   TID                   fb_tid;
+   TID                   sb_tid;
+   bool                  fb_started;    
+   bool                  sb_started;      
+   bool                  retry_sb;
+   bool                  fb_max_window;
+   kal_uint16            fb_total_search_slot;  /* used to count total FB search slot in UMTS_IDLE */
+   intx                  fb_slot_count;  //slot for FDD, ebit for TDD
+   AGCCellData           bsic_agc_cell;
+   //AfcParams*            afc;
+   /*FDD*/
+   //kal_uint8             bsic_slot;  /* For FB window. */
+   //scCellBSIC*           bsic_cell;  /* For FB or SB. */
+   //AGCCellData           cell;
+   //ARFCN                 fb_arfcn;
+   /* Gap Handler and Timing sync. */ 
+   Timer                 gapTimer;  
+   Timer                 gapStopTimer_all;  //syy
+   Timer                 gapStopTimer_suspend;  //syy: fmo lock timer
+   Timer                 syncTimer;
+   TID                   sync_tid;
+   Time                  sync_offset;
+   //Time                  sync_start_time;  
+  
+
+   /* For 2G active */
+   Timer                 search_3gTimer;
+   kal_int8              GAPreservedFrames;  /* The gap reserved frames for 3G, ex Timer_3GSearch, TimerAutoGap. Only SIM1 need to check it. */
+   intx                  search_3g_FN26;
+   kal_uint8             search_3g_state_cnt;  /* Range: 0~7. If equals 7, it will be reset to 0, and enters CM state. */
+   kal_bool              gap_schedule_started;
+   /* For 2G active/PCH, assign DRX period to 3G. */
+   bool                  rf_checked;
+   bool                  l1i_checked;
+   bool                  rf_sleep;
+   kal_uint16            l1i_sleep_frame;
+   kal_uint16            l1i_sleep_ebit;
+   bool                  umts_gap_running;
+   Time                  umts_gap_start_time;
+   kal_uint32            umts_gap_len;
+   TID                   GAPtid;
+   TID                   SuspendGaptid;
+
+   /* Measurement priority */
+   MeasurementPriority meas_priority;
+   MeasurementPriority meas_priority_cgi;
+   MeasurementPriority meas_priority_scan;
+#ifdef  __GERAN_R8__
+   MeasurementPriority meas_priority_higher;
+#endif /* __GERAN_R8__ */
+
+#ifdef  __GERAN_R8__
+   kal_bool              pm_meas_started_higher;  
+#endif /* __GERAN_R8__ */
+
+#if defined ( __GL1_GEMINI__ )
+   Timer                 restartGAPtimer; // This variable is only used when active RAT is FDD or LTE.
+#endif
+
+/* TDS */
+   bool                  LockGAP;
+#if defined (__GL1_GEMINI__)
+   bool                  isChannelLock;   //used in TD MM Gemini lock and unlock mechanism
+   /*dm_global.isChannelLock only can be set as true when TDD is active RAT, it cannot be set as true when FDD is active RAT.*/
+#endif  /* defined (__GL1_GEMINI__) */
+
+   //kal_uint8             gapPurpose;
+   kal_bool              DRX_Tick;  //2G active, for drx tick in gap pattern
+
+   Timer                 autoGaptimer;    
+   Timer                 autoGapReportTimer;  
+   kal_int32             autoGaptimerLength;  //the length L1C uses, from the time that AG can be used
+   kal_int32             autoGapLengthGive;  //the length filled in report, from ST. If there's reservation after ST, this will be longer than autoGaptimerLength
+
+   kal_bool              standbyAGConfirm;
+   kal_int8              standbyAGUseCount;
+   Time                  standbyAGStartTime;
+   kal_int32             standbyAGLength;  //-1 means not confirmed
+   Timer                 standbyAGStopTimer;  //used to wait for L1D stop to send ReportGSMAutoGAPStop
+   Timer                 standbyAGEndTimer;  //used to send reportGapEnd when reportCGI is stopped by upper layer
+#ifdef __GL1_GEMINI__
+#if defined( __GL1_GEMINI_WCDMA__ ) || defined( __GEMINI__ ) || defined( __CDMA2000_RAT__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ )
+   Timer                 standbyMeasTimer;  // used to schedule standby measurement for standby meas
+   Timer                 standbyMeasTimerPowerScan;    // used to schedule standby measurement for manual power scan request
+#endif
+#endif
+#if defined( __GEMINI__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ )
+   uint32                scanPeriod;
+   uint32                scanLength;
+   uint32                scanPeriod_PM;
+   uint32                scanLength_PM;
+   uint16                BSICPeriod;
+   uint8                 rdrb_for_manualscan_standbymeas;
+   bool                  backup_meas;
+   bool                  backup_scan;
+#endif
+   intx                  arfcn_start_index_copy;  //To backup the value of arfcn_start_index
+#ifdef  __GL1_GEMINI__
+   Timer                 VirtualSuspendCnfTimer;
+#endif
+} DualModeGlobal;
+
+
+
+/****************************** struct end **************************************/
+
+
+
+
+/****************************** function prototype begin ************************************/
+/* for autonomous gap, common for FDD, TDD, LTE */
+void L1T_AutoGAPStart( Time starting_time );
+void L1T_AutoGAPEnd( void );
+void L1T_GSMAutoGAPStop( void );
+void L1T_GSMAutoGAPConfirm( kal_bool, kal_int32 );
+
+void L1I_Timer_AutoGap( Timer* timer );
+void L1I_Timer_ReportAutoGap( Timer* timer );
+void L1I_MMPutAutoGAP( void );
+intx L1I_GetGSMAutoGAPLengthEbit( void );
+void L1I_Timer_GSMAutoGAPStop(Timer* timer);
+void L1I_Timer_GSMAutoGAPEnd(Timer* timer);
+void L1T_ReRequestGSMAutoGAP( void );
+void L1I_ReRequestGSMAutoGAP( void );
+
+
+/* to suspend GL1 gap usage. to replace fach/fmo lock/unlock */
+void L1T_SuspendGAP( void );
+void L1T_ResumeGAP( void );
+
+void L1T_CancelGap_Lock_2G( void );
+void L1T_CancelGap_Unlock_2G( void );
+void L1T_SetGAPPurpose_idle(kal_uint16 gap_num, ll1_gsm_standby_gap_struct *gap);
+void L1I_Start_SACCh_Timer( bool delay );
+
+void L1T_SetModeInStandby( ll1_active_rat_mode_status_enum mode );
+void L1I_Internal_StopGAP(void);
+Gap_Handler* L1I_UpdateRunningGap( l1c_mm_sim_mode_enum local_sim_mode );
+
+void L1T_GAPStatus(gl1_gap_status_enum GAPStatus);
+void L1T_StartGAPSchedule( void );
+void L1T_StopGAPSchedule (void);
+void L1T_StopGAPPattern(void);
+void L1I_NextBSIC_GAP(void);
+void L1I_Update_HP_SB_UTRAN_TDD( Gap_Handler* gap );
+void L1I_StartBSIC_GAP(Gap_Handler* gap);
+void L1I_StartFB_GAP(Gap_Handler* gap);
+void L1I_StartSB_GAP(Gap_Handler* gap);
+void L1T_StandbyRAT(void);
+void L1T_ActiveRAT(void);
+void L1T_InterRATSyncGen(void);
+void L1T_InitMM( void );
+void L1I_Set_L1D_DM_State( void );
+void L1I_Set_L1D_DM_Query_State( void );
+void L1I_Start_GAP_Timer(void);
+void L1I_Init_GAPSchedule(void); // bool priority_low );
+void L1I_Timer_SB(Timer* timer);
+void L1I_Timer_FB(Timer* timer);
+#ifdef  __GL1_GEMINI__
+void L1I_Timer_VirtualSuspendCnf(Timer* timer);
+#endif
+
+void L1D_FCCh_DM( Report *report, ARFCN arfcn, int32 gap_len_ebit, AfcParams *afcParams, int16 repeat_cnt, L1D_APIcaller_id caller );
+void L1D_SCh_DM( Report *report, ARFCN arfcn, bool retry, intx ebitPosition, AfcParams *afcParams, L1D_APIcaller_id caller );
+
+void L1T_SetGAPPattern_NR(kal_uint16 session_num, ll1_gsm_standby_gap_struct* session, ll1_active_rat_mode_status_enum mode,
+   kal_bool pm_tick, kal_uint8 pm_tid, kal_bool pm_tick_higher, kal_uint8 pm_tid_higher );
+
+#ifdef  __LTE_RAT__  
+void L1T_SetGAPPattern_LTE(kal_uint16 session_num, ll1_gsm_standby_gap_struct* session, ll1_active_rat_mode_status_enum mode,
+   kal_uint32 t_reconfirm, kal_uint32 t_identify, kal_uint16 gap_expand_period, kal_uint8 n_freq,   
+   kal_bool pm_tick, kal_uint8 pm_tid,
+   kal_bool pm_tick_higher, kal_uint8 pm_tid_higher, kal_uint8 gap_set_num );
+
+void L1T_SetGAPPurpose_LTE_connected( kal_uint16 gap_num, ll1_gsm_standby_gap_struct *gap, kal_uint32 t_reconfirm_dch, kal_uint32 t_identify_dch, kal_uint16 gap_expand_period, kal_uint8 n_freq, kal_uint8 gap_set_num );
+#endif /*__LTE_RAT__*/
+
+#ifdef __CDMA2000_RAT__
+void L1T_SetGAPPattern_C2K( kal_uint16 gap_num, ll1_gsm_standby_gap_struct* gap, ll1_active_rat_mode_status_enum mode, 
+   kal_bool pm_tick, kal_uint8 pm_tid );
+#endif
+
+#ifdef  __GERAN_R8__ 
+void L1T_SetGAPPattern_FDD( kal_uint16 gap_num, ll1_gsm_standby_gap_struct* gap, ll1_active_rat_mode_status_enum mode, 
+   kal_uint32 t_reconfirm, kal_uint32 t_identify,
+   kal_bool pm_tick, kal_uint8 pm_tid, 
+kal_bool pm_tick_higher, kal_uint8 pm_tid_higher );
+//void L1T_GAPScheduleDone( kal_uint8 tid, kal_bool priority_search );
+#else
+void L1T_SetGAPPattern_FDD( kal_uint16 gap_num, Gap_Session*gap, ll1_active_rat_mode_status_enum mode, 
+   kal_uint32 t_reconfirm, kal_uint32 t_identify,
+   kal_bool pm_tick, kal_uint8 pm_tid );
+//void L1T_StartGAPSchedule( void );
+//void L1T_GAPScheduleDone( kal_uint8 tid );
+#endif  /* __GERAN_R8__ */
+
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+void L1T_StopALTGAPSchedule_2( void );
+void L1T_CancelGap_Lock_2G_2( void );
+bool L1I_QueryAny2GStandbyLockSM( void );
+bool L1I_QueryAnyDedicatedFlag( void );
+#endif
+
+void L1I_Timer_GAP(Timer* timer);
+void L1I_Schedule_GapPurpose_rssi( Gap_Handler* gap, Timer* timer );
+
+
+/* L1 internal function for DM. */
+void L1I_InternalFrameTick_DM (void);
+void L1I_StartSB_Timer(scCellBSIC* cell, kal_bool retry, intx sb_ebitDelay);
+void L1I_StartFB_Timer(scCellBSIC* cell, intx ebitDelay, intx slot_count);
+intx L1I_GetNormalGapFBLength( l1c_sim_mode_enum local_sim_mode );
+scCellBSIC* check_fb_position(Gap_Handler *gap, intx* ebitDelay, intx* slot_count);
+scCellBSIC* check_sb_position(Gap_Handler *gap, intx* ebitDelay);
+scCellBSIC* check_hp_sb_position(Gap_Handler *gap, intx* ebitDelay, bool* retry_sb, kal_uint16* sb_pos);
+void L1_Prepare_HP_SB_Data( SChData* p );
+kal_uint16 ebit_2_slot(intx ebit);
+void L1T_SetGAPPurpose_fach( kal_uint16 gap_num, ll1_gsm_standby_gap_struct *gap, kal_uint32 t_reconfirm_fach, kal_uint32 t_identify_fach);
+void L1T_SetGAPPurpose_dch( gsm_tgmp_enum change_purpose, kal_uint16 gap_num, ll1_gsm_standby_gap_struct *gap, kal_uint32 t_reconfirm_dch, kal_uint32 t_identify_dch);
+
+
+intx L1I_GetNext_SB_Position( Time servTime, int32 frameOffset, intx ebitOffset, intx gap_delay  );
+kal_bool check_bcch_gap_coincide(intx timer_schedule_delay, intx gap_len, intx bcch_ebitDelay);
+kal_bool check_sb_gap_coincide(intx gap_len, intx sb_ebitDelay);
+kal_uint8 check_hp_sb_gap_coincide(intx gap_ebitDelay, intx len, intx sb_ebitDelay, kal_bool retry);
+bool check_hp_sb_end(kal_uint16 hp_sb_pos);
+
+
+//void L1I_Start_GAP_Timer(void);
+#ifdef __GL1_GEMINI__
+#if defined( __GL1_GEMINI_WCDMA__ ) || defined( __GEMINI__ ) || defined( __CDMA2000_RAT__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ )
+void L1I_Timer_StandbyMeas( Timer* timer );
+void L1I_Timer_StandbyPowerScan (Timer* timer );
+bool L1I_IsNeedToDoStandbyMeas( void );
+void L1I_StartStandbyMeasTimer( void );
+#endif
+#endif
+#ifdef __GL1_GEMINI_WCDMA__
+void L1I_SetStandbyPwrScanPriority( bool is_PLMNList );
+#endif
+void L1I_Timer_Search_3g(Timer* timer);
+void L1I_Timer_BSICSC(Timer* timer);
+void L1I_Timer_DUMMYFB(Timer* timer);
+void L1I_Timer_SRVCCGapSet(Timer* timer);
+void L1I_Timer_SRVCCGapReset(Timer* timer);
+void L1I_BackupARFCNIndex(void);
+void L1I_RestoreARFCNIndex(void);
+
+void L1I_TimerStandby( Timer* timer );
+void L1T_Next_BSICSC(void);
+void L1T_StartStandby_Timer( void );
+void L1I_Timer_IRATSync(Timer* timer);
+void L1I_Timer_ActiveRAT(Timer* timer);
+
+void L1T_Search_3g_Start(void);
+void L1T_DM_SetMode( SurroundMode newMode );
+void L1T_DM_Set_search_3g_FN26(kal_uint8 search_3g_FN26);
+
+//void L1T_Init_GAPSchedule(void); // bool priority_low );
+void L1I_Init_3G_GAP_SimMode( l1c_mm_sim_mode_enum local_sim_mode );
+void L1I_Check_3G_GAP( l1c_mm_sim_mode_enum local_sim_mode );
+
+#ifdef MTK_SLEEP_ENABLE
+bool L1I_Assign_3G_GAP( kal_uint16 l1i_sleep_frame );
+#else
+bool L1I_Assign_3G_GAP(void);
+#endif
+
+bool L1I_Check_3G_GAP_From_Timer(int32 ebitDelay);
+void L1I_gsm_gap_cancel_req(void);
+
+void L1I_ReportFCCh_DM( Report* report );
+void L1T_ReportFCCh_DM( Report* report );
+void L1I_StopSCh_DM( void);
+void L1I_StopFCCh_DM( void );
+uint8 L1I_SChStop_DM( void );
+uint8 L1I_FCChStop_DM( void );
+void L1I_AbortReservationFCCh_DM( intx busyFrames, intx busyEBits );
+//void L1D_SCh_DM( Report* report, ARFCN arfcn, bool retry, AfcParams* afcParams );
+void L1I_ReportSCh_DM( Report* report );
+void L1T_ReportSCh_DM( Report* report );
+
+void L1I_ReportSyncTime( Report* report );
+void L1T_ReportSyncTime( Report* report );
+void L1T_ReportSuspendGap( Report* report );
+void L1T_Init_Gap(void);
+void L1I_Update_Gap(Gap_Handler* gap, intx remain_gap_len);
+Gap_Handler* L1I_NewGapHandler(void);
+void L1I_DeleteGapHandler(Gap_Handler* gap_handler);
+
+void L1T_ResetAFC_DM(void);
+
+intx L1_TimeDiff( Time timeA, Time timeB);
+void L1I_InsertGapHandler(Gap_Handler* gap);
+void L1I_RemoveGapHandler(Gap_Handler* gap_handler);
+void L1I_DebugGapHandler(void); /* Only for debug purpose. */
+void L1I_RemoveSuspend( void );
+
+void L1I_Schedule_GapPurpose_undefined(Gap_Handler* gap);
+
+void L1I_Consume_PM_DM(void);  /* Used to consume PM cells, and not to fill it into PM queue. This is used for FMO_Lock request. */
+void L1I_MeasurementsProcessDummyResults( void );
+void L1T_SurroundReportTickStandby(void);
+uint8 L1I_SurroundAbortReceive_DM( void );
+uint8 L1I_SurroundAbortBCChReceive_DM( void );
+intx  L1I_NBCChStop( void );
+void L1I_Timer_Tick(Timer* timer);
+void L1I_Timer_GAPStop_suspend(Timer* timer);
+void L1I_Timer_GAPStop_all(Timer* timer); //syy
+
+//void L1I_TimerSuspendPMforGAP( Timer* timer );  //syy
+
+#ifdef __GL1_GEMINI__
+void L1I_Timer_restartGAP(Timer* timer);
+kal_bool L1I_QueryIsContiFB( void );
+kal_uint32 L1I_QueryGAPReservedLength( void );
+#endif      
+
+#ifdef __GL1_GEMINI__
+#if defined( __GL1_GEMINI_WCDMA__ ) || defined( __GEMINI__ ) || defined( __CDMA2000_RAT__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ )
+kal_uint32 L1I_QueryGAPPMReservedLength(void);
+#endif /* defined( __GL1_GEMINI_WCDMA__ ) || defined( __GEMINI__ ) */
+#endif
+
+#if defined( __GEMINI__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ )
+void L1I_SetStandbyPwrScanParam( uint32 scanPeriod, uint32 scanLength );
+void L1I_SetStandbyBSICParam( uint16 scanPeriod );
+void L1I_AssignGAPinVirtualMode( void );
+
+#ifdef __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__
+void L1T_VStandbyMeasSetParam( uint32 MeasPeriod, uint32 MeasLength );
+#endif /* __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ */
+
+#endif /* defined( __GEMINI__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ ) */
+
+#ifdef __GL1_MULTI_MODE__
+bool L1I_QueryAnyActiveRATinDedicated( void );
+#endif
+
+/* Interface with L1D. */
+//void L1D_FCCh_DM(Report* report, ARFCN arfcn, int16 gap_len, AfcParams* afcParams);
+void L1D_Sync_To_3G_DM(Report* report);
+void L1D_Start_Next_PM_DM( void );
+void L1D_Skip_PM_DM(L1D_APIcaller_id caller);
+uint16 L1D_Get_SBWIN_LEN_DM(void);
+intx L1D_Cal_PM_Count_DM( sGAP *gap );
+intx L1D_Cal_FB_Slot_Length_DM(intx ebit_duration);
+void L1D_Sync_To_Multi_Mode( Report *report, L1D_APIcaller_id caller );
+bool L1D_check_3g_reli(void);
+#if IS_GL1_MULTI_MODE_SUPPORT
+void L1D_Set_GSM_RAT_Mode( L1D_MM_STATE L1D_DM_STATE, l1c_sim_mode_enum sim_idx, L1D_APIcaller_id caller);
+void L1D_Set_GSM_Query_RAT_Mode( L1D_MM_STATE L1D_DM_STATE );
+#endif
+
+void L1I_ResetAFC_DM( void );
+
+
+void L1T_Set_Timer_UTRAN_FDD_and_EUTRAN( void );
+void L1T_Set_Timer_UTRAN_TDD( void );
+void L1T_SetGAPPattern_TDD( kal_uint16 gap_num, ll1_gsm_standby_gap_struct* gap, ll1_active_rat_mode_status_enum mode,
+					             kal_bool pm_tick, kal_uint8 pm_tid
+#ifdef  __GERAN_R8__
+					            ,kal_bool pm_tick_higher, kal_uint8 pm_tid_higher
+#endif
+#ifdef  __LTE_RAT__
+					            ,kal_uint16 dmo_lte_period, kal_uint16 dmo_lte_length 
+#endif
+);
+
+/* L1C DM Internal Use. */
+Time L1I_GapEndTime( Gap_Handler* session );
+void L1I_Stop_BSIC_Schedule_UTRAN_TDD( void );
+void L1I_Measurement_Period_Start_UTRAN_TDD( void );
+void L1I_Schedule_GapPurpose_rssi_UTRAN_TDD( Gap_Handler* gap, sGAP* gap_pattern );
+void L1I_Schedule_GapPurpose_bsic_UTRAN_TDD( Gap_Handler* gap, sGAP* gap_pattern );
+void L1I_Timer_GAP_UTRAN_TDD(Timer* timer);
+void L1I_Timer_PM_Session_UTRAN_TDD( Timer* timer );
+void L1I_Reset_PM_Session( void );
+void L1T_SetGAPPurpose_fach_dch_UTRAN_TDD( kal_uint16 gap_num, ll1_gsm_standby_gap_struct* gap
+#ifdef  __LTE_RAT__
+                                          ,kal_uint16 dmo_lte_period, kal_uint16 dmo_lte_length 
+#endif
+);
+
+#ifdef __UMTS_TDD128_MODE__
+/* TDD DM *//* L1C/D Interface function for DM. */
+/* TDD DM *///void L1D_Sync_To_3G_DM( Report *report );
+   #if L1D_WT_COBIN_ARCHITECTURE_SUPPORT
+/* TDD DM */void L1D_Set_Gap_TDD( sGAP *gap, L1D_APIcaller_id caller );   /* set GAP pattern to L1D in 3G FACH and DCH state */
+   #else
+/* TDD DM */void L1D_Set_Gap( sGAP *gap );   /* set GAP pattern to L1D in 3G FACH and DCH state */
+   #endif
+/* TDD DM *///void L1D_Set_GSM_RAT_Mode( L1D_MM_STATE L1D_DM_STATE, L1D_APIcaller_id caller );	
+/* TDD DM *///bool L1D_IsTDStandby_DM(void);
+/* TDD DM *///void L1D_SCh_DM( Report *report, ARFCN arfcn, bool retry, intx ebitPosition, AfcParams *afcParams );
+/* TDD DM *///void L1D_FCCh_DM( Report *report, ARFCN arfcn, int32 gap_len_ebit, AfcParams *afcParams, int16 repeat_cnt );
+/* TDD DM *///void L1D_Sync_To_3G_DM( Report *report );
+/* TDD DM *///uint16 L1D_Get_SBWIN_LEN_DM( void );
+   #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+/* TDD DM */void  L1D_AFCSetDACValue_DM( AfcParams *p, int32 DacValue, L1D_APIcaller_id caller );
+   #else
+/* TDD DM */void  L1D_AFCSetDACValue_DM( AfcParams *p, int16 DacValue, L1D_APIcaller_id caller );
+   #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+/* TDD DM *///bool L1D_check_3g_reli( void );
+/* TDD DM */void L1D_AFCResetParams_DM( AfcParams *p, L1D_APIcaller_id caller );
+/* TDD DM */bool L1D_AFC_2G_ACTIVE_ASK_FreqCorrect( uint8 simIndex, kal_bool correction, kal_bool is_l1c, AfcParams *afcParams );
+/* TDD DM */void L1D_Start_Next_PM_DM( void );
+/* TDD DM *///void L1D_Skip_PM_DM( L1D_APIcaller_id caller );
+/* TDD DM *///intx L1D_Cal_PM_Count_DM( sGAP* gap );
+   #if L1D_WT_COBIN_ARCHITECTURE_SUPPORT
+      #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+/* TDD DM */kal_int32 L1D_AFCGetDAC_Value_DM_TDD(bool is_2g_2_3g);   
+      #else
+/* TDD DM */kal_int16 L1D_AFCGetDAC_Value_DM_TDD(bool is_2g_2_3g);   
+      #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+/* TDD DM */void L1D_FCCh_Update_rxTime_TDD(Time rxTime, L1D_APIcaller_id caller);
+/* TDD DM */void L1D_FBM_Update_left_times_TDD(int16 new_left_times, L1D_APIcaller_id caller);
+/* TDD DM */intx L1D_Cal_PM_Count_DM_Query_TDD( sGAP *gap );
+   #else
+   #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+   /* TDD DM */kal_int32 L1D_AFCGetDAC_Value_DM(bool is_2g_2_3g);
+   #else
+/* TDD DM */kal_int16 L1D_AFCGetDAC_Value_DM(bool is_2g_2_3g);   
+   #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+/* TDD DM */void L1D_FCCh_Update_rxTime(Time rxTime, L1D_APIcaller_id caller);
+/* TDD DM */void L1D_FBM_Update_left_times(int16 new_left_times, L1D_APIcaller_id caller);
+/* TDD DM */intx L1D_Cal_PM_Count_DM_Query( sGAP *gap );
+   #endif
+/* TDD DM */void L1D_Sync_To_Multi_Mode( Report *report, L1D_APIcaller_id caller );
+#endif /*__UMTS_TDD128_MODE__*/
+
+/****************************** function prototype end **************************************/
+
+
+
+
+
+
+/****************************** global variable begin ************************************/
+
+
+#ifdef __GL1_GEMINI_WCDMA__
+#define gap_global          gapGlobals_database[l1c_sim_mode]
+#define local_gap_global  gapGlobals_database[local_sim_mode]
+extern GapGlobal  gapGlobals_database[L1C_MM_SIM_NUM];
+#define dm_global          dmGlobals_database[l1c_sim_mode]
+#define local_dm_global  dmGlobals_database[local_sim_mode]
+extern DualModeGlobal  dmGlobals_database[L1C_MM_SIM_NUM];
+#define gap_base          gapBase_database[l1c_sim_mode]
+#define local_gap_base  gapBase_database[local_sim_mode]
+extern Gap_Handler  gapBase_database[L1C_MM_SIM_NUM];
+extern uint8 syncBitmap;
+#else
+#define local_gap_global  gap_global
+#define local_dm_global  dm_global
+#define local_gap_base  gap_base
+extern GapGlobal gap_global;
+extern DualModeGlobal dm_global;
+extern Gap_Handler gap_base;
+#endif
+bool L1I_QueryAllSIMInGSMIdle( void );
+
+/****************************** global variable end **************************************/
+
+
+EXTERN_TRACE_CLASS( tcDM ); /* For L1 simulation. */
+
+#endif
+#if IS_TXRX_GET_INFO
+kal_uint64 L1D_Rx_Active_Time();
+void L1D_Rx_Reset_Time();
+void L1I_CalculateFBRxTime(void);
+void L1I_QueryFBStartTime(void);
+Power L1I_QueryTxPowerInfo(void);
+void L1I_getTxinformationTime(Power txpower, int32 reservationMask);
+#endif