[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/l1/interface/gl1/common_reg.h b/mcu/l1/interface/gl1/common_reg.h
new file mode 100644
index 0000000..a9278be
--- /dev/null
+++ b/mcu/l1/interface/gl1/common_reg.h
@@ -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) 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:
+ * ---------
+ * common_reg.h
+ *
+ * Project:
+ * --------
+ * MT6208
+ *
+ * Description:
+ * ------------
+ * Definition of common H/W register address used in L1D/UL1D
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *------------------------------------------------------------------------------
+ * $Revision: $
+ * $Modtime: $
+ * $Log: $
+ *
+ * removed!
+ * removed!
+ * All HW register read/write should use volatile
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ * add to source control recursely
+ *
+ * removed!
+ * removed!
+ * Solve compile error
+ *******************************************************************************/
+
+#ifndef _COMMON_REG_H_
+#define _COMMON_REG_H_
+
+/*=============================================================================*/
+
+typedef volatile unsigned short* SRAMADDR; /* SRAM addr is 16 bits */
+typedef volatile unsigned short SRAMDATA; /* SRAM data is 16 bits */
+typedef volatile unsigned short* APBADDR; /* APB addr is 32 bits */
+typedef volatile unsigned short APBDATA; /* APB data is 16 bits */
+typedef volatile unsigned long* APBADDR32; /* APB addr is 32 bits */
+typedef volatile unsigned long APBDATA32; /* APB data is 16 bits */
+typedef volatile unsigned short* DPRAMADDR; /* DPRAM addr is 16 bits */
+typedef volatile signed short* DPRAMADDR_S; /* DPRAM addr is 16 bits */
+typedef volatile unsigned short DPRAMDATA; /* DPRAM data is 16 bits */
+
+#endif
+
diff --git a/mcu/l1/interface/gl1/fcs.h b/mcu/l1/interface/gl1/fcs.h
new file mode 100644
index 0000000..441bb36
--- /dev/null
+++ b/mcu/l1/interface/gl1/fcs.h
@@ -0,0 +1,130 @@
+/*****************************************************************************
+* 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:
+ * ---------
+ * fcs.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * This file is for FCS driver.
+ *
+ * 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!
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#ifndef L1_FCS_H
+#define L1_FCS_H
+
+#include "reg_base.h"
+#include "kal_general_types.h"
+
+//#define FCS_CG_SET2 ((volatile kal_uint32*)(BASE_MADDR_CLK_CTRL+0x0004))/* FCS gate clock */
+//#define FCS_CG_CLR2 ((volatile kal_uint32*)(BASE_MADDR_CLK_CTRL+0x0008))/* FCS ungate clock */
+
+#define FCS_DATA ((volatile kal_uint16*)(FCS2G_base+0x0000))/* FCS data */
+#define FCS_DLEN ((volatile kal_uint16*)(FCS2G_base+0x0004))/* FCS data length */
+#define FCS_PAR1 ((volatile kal_uint16*)(FCS2G_base+0x0008))/* FCS parity MSB part */
+#define FCS_PAR2 ((volatile kal_uint16*)(FCS2G_base+0x000C))/* FCS parity LSB part */
+#define FCS_STAT ((volatile kal_uint16*)(FCS2G_base+0x0010))/* FCS codec status register */
+#define FCS_RST ((volatile kal_uint16*)(FCS2G_base+0x0014))/* FCS codec reset register */
+
+extern void fcs_feed_stream(kal_uint8* data,kal_uint16 len,kal_uint8 BIT_ORDER,kal_uint8 PAR_ORDER,kal_uint8 EN_DEC);
+extern void get_fcs_parity(kal_uint8* parity);
+extern kal_bool get_fcs_result(void);
+
+#define FCS_CLK_OFF() PDN_SET(PDN_FCS_SLV_DBCLK)//HW_WRITE(FCS_CG_CLR2,(1 << 15))
+#define FCS_CLK_ON() PDN_CLR(PDN_FCS_SLV_DBCLK)//HW_WRITE(FCS_CG_SET2,(1 << 15))
+
+#endif
+
diff --git a/mcu/l1/interface/gl1/internal/l1d_interface_l1core.h b/mcu/l1/interface/gl1/internal/l1d_interface_l1core.h
new file mode 100644
index 0000000..2bda2c1
--- /dev/null
+++ b/mcu/l1/interface/gl1/internal/l1d_interface_l1core.h
@@ -0,0 +1,120 @@
+/*****************************************************************************
+* 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:
+ * ---------
+ * l1d_pcore_interface.h
+ *
+ * Project:
+ * --------
+ * MT6291
+ *
+ * Description:
+ * ------------
+ * RF Interface for MD internal
+ *
+ * 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!
+ *
+ *----------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#ifndef _L1D_INTERFACE_L1CORE_H_
+#define _L1D_INTERFACE_L1CORE_H_
+/*===============================================================================*/
+
+/*******************************************************************************
+ * #include
+ ******************************************************************************/
+
+/*******************************************************************************
+ * #define
+ ******************************************************************************/
+
+/*******************************************************************************
+ * typedef
+ ******************************************************************************/
+/** Structure Prototypes can be seen by other files**/
+
+/*******************************************************************************
+ * Global Functions Prototype (Interface)
+ ******************************************************************************/
+/** Function Prototypes can be used by other files **/
+
+kal_uint32 L1D_GetBandSupport_L1Core( void );
+void GL1D_CDF_UPDATE_RXD_ENABLE_FLAG(RASPublicParams* L1_RAS_Custom);
+
+#if IS_GSM_TX_DETECTOR_SUPPORT
+void GL1D_TxD_Start();
+#endif
+
+
+#endif /* End of #ifndef _L1D_INTERFACE_L1CORE_H_ */
diff --git a/mcu/l1/interface/gl1/l1_afc.h b/mcu/l1/interface/gl1/l1_afc.h
new file mode 100644
index 0000000..5924338
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_afc.h
@@ -0,0 +1,257 @@
+/*****************************************************************************
+* 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_afc.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * Multi-mode AFC control interface
+ *
+ * Author:
+ * -------
+ *
+ * $Log$
+ *
+ * 05 21 2021 shrikant.nandagawali
+ * [MOLY00665438] [Colgin][MT2735][New feature][MD] Wide temperature.[EWSP0000255811]
+ *
+ * 06 08 2018 dinesh.kumar
+ * [MOLY00315229][6295][cotms]UL1D FPU removing
+ *
+ * 05 14 2018 tim.tsai
+ * [MOLY00324757] [MMRFD] remove legacy option
+ * .
+ *
+ * 03 28 2018 dinesh.kumar
+ * [MOLY00315229][6295][cotms]UL1D FPU removing
+ *
+ * 06 06 2017 sj.cheng
+ * [MOLY00254832] [MMRF]xl1sim single mode trigger MMRF task
+ *
+ * 03 29 2017 aman.singh
+ * [MOLY00237873] [6293][EL1] Gemini L+L
+ *
+ * 10 04 2016 aman.singh
+ * [MOLY00186076] [L1D][Modify] Changes for warning removal
+ *
+ * .
+ *
+ * 09 12 2016 yi-ying.lin
+ * [MOLY00202968] [MMRF] move multi-afc share memory definition to mml1_rf_afc.h
+ * .
+ *
+ * 08 25 2016 yi-ying.lin
+ * [MOLY00199309] [MMRF] remove mmafc cross-core structure definition
+ * .
+ *
+ * 10 06 2015 ola.lee
+ * [MOLY00144115] [L1D] Update RF Conflict Dispatch API for SRLTE
+ * .
+ *
+ * 09 07 2015 glen.hua
+ * [MOLY00140544] [Jade][L+W]AFC change for L+W project
+ * .
+ *
+ * 09 07 2015 glen.hua
+ * [MOLY00140544] [Jade][L+W]AFC change for L+W project
+ * .
+ *
+ * 07 21 2015 yi-ying.lin
+ * [MOLY00130526] [L1D][Modify] Move MMAFC MD1/MD3 afc database structure definition to cross-core folder
+ * .
+ *
+ * 07 06 2015 my.tu
+ * [MOLY00109555] [TK6291][EL1D] Update the latest code (AFC)
+ * [EL1D RX] sync afc code from EL1S (UMOLY).
+ *
+ * 07 06 2015 yi-ying.lin
+ * [MOLY00123233] [L1D][Modify] Fix the MD3 query API
+ * .
+ *
+ * 07 04 2015 my.tu
+ * [MOLY00109555] [TK6291][EL1D] Update the latest code (AFC)
+ * [EL1D RX] cotsx development. Merging from //UMOLY/DEV/TK6291_DEV/mcu/l1core/modem/...1403997
+ *
+ * 06 18 2015 yi-ying.lin
+ * [MOLY00122572] [L1D][Modify] fix build error for multi-afc api to accesss the SHM
+ * .
+ *
+ * 06 18 2015 yi-ying.lin
+ * [MOLY00122410] [L1D][Modify] fix multi-afc api
+ * .
+ *
+ * 06 16 2015 yi-ying.lin
+ * [MOLY00121452] [L1D][Modify] Add multi-afc update and query share-memory API
+ * .
+ *
+ * 10 06 2014 ola.lee
+ * [MOLY00080299] [L1D] Check in 2G Fix AFC for MT6169
+ * .
+ *
+ * 04 11 2013 yi-ying.lin
+ * [MOLY00013948] [MT6290 PO admit] Check in AST3002 & protocol code for 6290 MULTI_MODE_TDS project
+ * .
+ *
+ * 03 19 2013 ola.lee
+ * [MOLY00012185] [Fix-AFC] Check-in Fix-AFC related modification(L1D/UL1D/SM) into WR8 & MOLY
+ * .
+ *
+ * 03 11 2013 ij.chang
+ * [MOLY00011276] [UL1D][Modify] Merge Code From WR8.W1248.MD.WG.MP to MOLY for MT6290 SB
+ * .
+ *
+ * 09 28 2012 ziv.tsai
+ * [MOLY00004274] [L1D][Modify] Multi_Mode AFC control TDD part
+ * .
+ *
+ * 08 30 2012 ziv.tsai
+ * [MOLY00002838] [Need Patch][Build Error] WR8 build error for MT6583_MD2_TDD128HSPA(DEFAULT)
+ * .Add TDD support for multi-mode afc
+ *
+ * 06 28 2012 ziv.tsai
+ * [MOLY00000052] [MT6280] Some coding improvement for multi-mode afc and cell search
+ * .
+ *
+ * 05 25 2012 ziv.tsai
+ * removed!
+ * .
+ *
+ ****************************************************************************/
+
+#ifndef _L1_AFC_H_
+#define _L1_AFC_H_
+
+
+#include "l1_core_private.h"
+
+#include "l1_types.h"
+#include "kal_general_types.h"
+
+#include "mml1_rf_afc.h"
+
+/* Status update function*/
+extern void L1_MULTI_AFC_UPDATE_MODE(kal_uint8 sim_num, kal_uint8 rat /*0:2G,1:3G,2:LTE*/, kal_uint8 new_mode);
+extern void L1_MULTI_AFC_SWITCH_CONTROL_MODE(kal_uint8 sim_num, kal_uint8 rat, kal_uint8 mode );
+
+/* Interface Query function*/
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+extern void L1_MULTI_AFC_QUERY_PREVIOUS_ACTIVE_RAT(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 *return_rat, kal_int32 *return_Dac );
+extern void L1_MULTI_AFC_QUERY_ACTIVE_RAT(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 *return_rat, kal_int32 *return_Dac );
+#else
+extern void L1_MULTI_AFC_QUERY_PREVIOUS_ACTIVE_RAT(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 *return_rat, kal_int16 *return_Dac );
+extern void L1_MULTI_AFC_QUERY_ACTIVE_RAT(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 *return_rat, kal_int16 *return_Dac );
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+#if IS_MULTI_MODE_AFC_IN_32BITS
+extern void L1_MULTI_AFC_QUERY_LATEST_UPDATE_RAT(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 *return_rat, kal_int32 *return_dac, kal_uint16 *return_temp, kal_int32 *return_time_diff);
+#else
+extern void L1_MULTI_AFC_QUERY_LATEST_UPDATE_RAT(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 *return_rat, kal_int16 *return_dac, kal_uint16 *return_temp, kal_int32 *return_time_diff);
+#endif
+extern kal_uint8 L1_MULTI_AFC_QUERY_MODE(kal_uint8 src_sim, kal_uint8 src_ask);
+extern kal_bool L1_MULTI_AFC_QUERY_OTHER_RAT_DEDICATE(kal_uint8 src_sim, kal_uint8 src_rat);
+extern kal_uint8 L1_MULTI_AFC_QUERY_LATEST_AFC_MODE_OWNER(kal_uint8 src_sim, kal_uint8 src_rat);
+extern kal_uint8 L1_MULTI_AFC_QUERY_MD_LATEST_ACTIVE_RAT(kal_uint8 src_md, kal_uint8 src_sim, kal_uint8 src_rat);
+
+/*---> Interface Query function with GEMINI Integraded*/
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+extern void L1_MULTI_AFC_QUERY_PREVIOUS_ACTIVE_RAT_GEMINI(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 dest_sim, kal_uint8 *return_rat, kal_int32 *return_Dac );
+#else
+extern void L1_MULTI_AFC_QUERY_PREVIOUS_ACTIVE_RAT_GEMINI(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 dest_sim, kal_uint8 *return_rat, kal_int16 *return_Dac );
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+extern void L1_MULTI_AFC_QUERY_ACTIVE_RAT_GEMINI(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 dest_sim, kal_uint8 *return_rat, kal_int16 *return_Dac );
+extern kal_bool L1_MULTI_AFC_QUERY_OTHER_RAT_DEDICATE_GEMINI(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 dest_sim);
+
+/* Internal Query function*/
+#if IS_MULTI_MODE_AFC_IN_32BITS
+kal_int32 L1_MULTI_AFC_QUERY_DAC(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 dest_sim, kal_uint8 dest_rat);
+#else
+kal_int16 L1_MULTI_AFC_QUERY_DAC(kal_uint8 src_sim, kal_uint8 src_rat, kal_uint8 dest_sim, kal_uint8 dest_rat);
+#endif
+/* SHM update function*/
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+void L1_MULTI_AFC_UPDATE_AFC_IN_SHM(kal_uint8 src_sim, kal_uint8 src_rat, kal_int32 afc_dac, kal_uint16 temper);
+#else
+void L1_MULTI_AFC_UPDATE_AFC_IN_SHM(kal_uint8 src_sim, kal_uint8 src_rat, kal_int16 afc_dac, kal_uint16 temper);
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+/*---------------------------------------*/
+/* API function which shall provided by each rat*/
+
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+extern kal_int32 L1D_AFC_Query_DacValue(kal_uint8 query_sim);
+extern kal_int32 UL1D_AFC_Query_DacValue(kal_uint8 sim_idx);
+extern kal_int32 TL1D_AFC_Query_DacValue(void);
+extern kal_int32 EL1D_AFC_Query_DacValue(kal_uint8 sim_index);
+#else
+extern kal_int16 L1D_AFC_Query_DacValue(kal_uint8 query_sim);
+extern kal_int16 UL1D_AFC_Query_DacValue(kal_uint8 sim_idx);
+extern kal_int16 TL1D_AFC_Query_DacValue(void);
+extern kal_int16 EL1D_AFC_Query_DacValue(kal_uint8 sim_index);
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+
+extern void L1D_AFC_Set_ControlMode(void);
+extern void UL1D_AFC_Set_ControlMode(kal_uint8 mode);
+//extern void TL1D_AFC_Set_ControlMode(); /* 3G_TD use L1D_AFC_Control_Switch_DM(false) to set control mode */
+extern kal_uint32 EL1D_RxAfc_Multi_Tms_Read_Auxadc_Latest_Temperature(void);
+
+/* API function when Fix AFC enabled */
+typedef enum
+{
+ dac_2_ppb = 0 , /* 0 */
+ ppb_2_dac , /* 1 */
+} afc_convert_type;
+
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+extern kal_int32 L1_MULTI_AFC_CONVERT_AFC_DATA(kal_int32 afc_data_ori, kal_uint8 convert_type);
+#else
+extern kal_int16 L1_MULTI_AFC_CONVERT_AFC_DATA(kal_int16 afc_data_ori, kal_uint8 convert_type);
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+extern kal_int32 L1_MULTI_AFC_QUERY_FREQ_TO_DAC_STEP(void);
+extern kal_int32 EL1D_RxAfc_Multi_Tms_Interp_Calc(kal_uint32 tfc_u);
+#if defined ( MT6293 ) || defined ( __MD93__ ) || defined ( __MD97__ )
+extern void EL1D_RxAfc_Multi_Tms_Fac_Scurve_Generation_Proc(kal_uint32 fac_c0, kal_uint32 fac_c1, kal_uint32 fac_c2, kal_uint32 fac_c3);
+#else
+extern void EL1D_RxAfc_Multi_Tms_Fac_Scurve_Generation_Proc(kal_int32 fac_c0, kal_int32 fac_c1, kal_int32 fac_c2, kal_int32 fac_c3);
+#endif
+
+
+#endif
+
diff --git a/mcu/l1/interface/gl1/l1_core.h b/mcu/l1/interface/gl1/l1_core.h
new file mode 100644
index 0000000..687adcf
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_core.h
@@ -0,0 +1,1293 @@
+/*******************************************************************************
+* Modification Notice:
+* --------------------------
+* This software is modified by MediaTek Inc. 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_core.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * Layer1 core interface to stack adaptation layer
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *------------------------------------------------------------------------------
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ *
+ *******************************************************************************/
+
+/******************************************************************************
+ *
+ * File: %P%
+ * -----
+ *
+ * SCCS Version: %I%
+ * -------------
+ *
+ * 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 Communications Consultants Worldwide Limited (C) 2001
+ *
+ * Project:
+ * --------
+ *
+ * Software Unit: Layer1 core interface to stack adaptation layer.
+ * --------------
+ *
+ * Description:
+ * ------------
+ *
+ *
+ * Modification History:
+ * ---------------------
+ * Date Vers Auth Details
+ * ---- ---- ---- -------
+ * 28-Mar-01 2.1 VKL Initial version
+ * 17-Apr-01 2.2 VKL split report period setting for scan list and power
+ * control flag
+ * added functions for PTCCh and PBCCh
+ * moved protitypes for surround cell engine to and
+ * from other files
+ * 27-Apr-01 2.3 VKL changed prototypes for PTCChStart and PBCChStart
+ * 01-May-01 2.4 VKL add prototypes for TBF start and stop
+ * 21-May-01 2.5 VKL added functions to set NBCCh, BCCh and PBCCh
+ * priority.
+ * added functions for PCh, PAGCh, PRACh, and
+ * interference measurements.
+ * surround cell power measurements now done in
+ * separate module, not in report period any more.
+ * change parameters of L1T_CBChStart
+ * 15-Jul-01 2.6 VKL Added multiband support to power scan
+ * Changed mode param to PCh and PPCh handlers
+ * Change type of tx power params to PowerControlLevel
+ * Moved PTCCh handler to other file
+ * PPCh supports extended paging mode now
+ * PAGCh now has additional syncTimeSlot parameter
+ * Changed interface to set up TBF
+ * Added interface for interference measurements
+ * Added interface for extended easurements
+ * Changed interface for surround cell measurements
+ * Added interface for BCCh power measurements
+ * Added interface for handling of power level C
+ * Added interface for uplink power control
+ * Added interface to reset timing advance
+ * Added burstLength parameter to L1T_RAChSetParams()
+ * and L1T_PRAChSetParams()
+ * 08-Aug-01 2.7 VKL Added L1T_SetServingBCChARFCN()
+ * Added startTimeSlot parameter to L1T_FCChTStart()
+ * Changed params to L1T_CSetParams()
+ *
+ * 02-Sep-01 2.8 VKL Modify CBCh functions, replace L1T_ReportPeriodSetPowerControl()
+ * by L1T_ReportPeriodSetParams(), frameOffset and ebitOffset now
+ * passed through DChParams instead of being arguments of L1T_DChStart(),
+ * ...Handover() and ...Back(), add timing advance parameter to
+ * L1T_DChStopHandover(), add L1T_TBFRepeatAllocation(),
+ * L1T_TBFSetPowerControl(), L1T_TBFSetTimingAdvance(), remove priority
+ * parameter from L1T_ExtendedMeasurementStartDedi(), remove
+ * L1T_TimingCorrectionStart() and L1T_TimingCorrectionStop(), remove
+ * L1T_PowerControlSetParams() and L1T_PowerControlClearParams(), add mode
+ * parameter to L1T_SurroundGetBestSix(), L1T_SurroundUpdateBCCh() gets
+ * mask parameter instead of allSysInfos flag, cleanup BSIC vs. TSC usage
+ * 04-Sep-01 2.9 APB Fix merge errors
+ * 12-Sep-01 2.10 VKL L1T_PBCChStart() now gets mode, correct spelling of L1T_PPChSetExtenedPaging
+ * Add L1T_TBFSetHoppingSequence(), L1T_TBFReleaseTimeSlots(),
+ * L1T_SurroundSuspend() and L1T_SurroundResume()
+ * 13-Sep-01 2.11 VKL Add functions for neighbour PBCCh receive
+ * 26-Sep-01 2.12 VKL Added L1T_ListPowerScanStart(), L1T_AGChXXX()
+ * Added L1I_CBChSkip(), L1T_PollRespXXX()
+ * Remove surround and BCCh measurement prototypes
+ * Added L1T_SurroundHandleReport()
+ * Removed L1T_SurroundReadBCChExt()
+ * 01-Oct-01 2.13 VKL Remove 'ndrx' parameter from L1T_CSetParams()
+ * 03-Oct-01 2.14 VKL Add restart parameter to L1T_SurroundSetBAList()
+ * 08-Oct-01 2.15 VKL Add L1T_GetTimingAdvance()
+ * 09-Oct-01 2.16 VKL Add parameters to L1T_NPBCChStart() for AGC
+ * 10-Oct-01 2.17 VKL Add per cell AFC support
+ * 12-Oct-01 2.18 VKL Add L1T_GetCurrentAfcParams()
+ * 17-Oct-01 2.19 VKL Add mode parameter to L1T_CBChSetParams()
+ * 26-Oct-01 2.20 VKL Change surround cell functions to support enhanced
+ * measurement reporting.
+ * 05-Nov-01 2.21 VKL Add startTimeSlot parameter to L1T_SChTStart
+ * 06-Nov-01 2.22 VKL Add inteface for NC and ext measurements
+ * 08-Nov-01 2.23 VKL Added L1T_SurroundSetPPCh() and L1T_SurroundSetPCh()
+ * 09-Oct-01 2.24 VKL Add param to L1T_SChTStart().
+ * Add functions to control BCCh receive by SCE in
+ * packet transfer mode
+ * 17-Oct-01 2.25 VKL Add L1T_AGCReset()
+ * Remove L1T_CResetCounter()
+ * 21-Nov-01 2.26 VKL Pass flag 'gprs' to L1T_FCChT()
+ * Make PRACh aware of syncTimeSlot
+ * Add L1T_GetC()
+ * 04-Dec-01 2.27 VKL Change CBCh interface for separate norm/ext handling
+ * Add startFrameNumber to L1T_TBFSetPowerControl()
+ *
+ *****************************************************************************/
+#ifndef l1_generic_l1_core_h
+#define l1_generic_l1_core_h
+
+#include "l1_types.h"
+
+#include "mph_types.h"
+#include "kal_general_types.h"
+#include "gmss_public.h"
+
+/* --- init ----------------------------------------------------------------- */
+
+void L1T_Init( void );
+void L1T_Exit( void );
+void L1T_SelectFrequencyBand1900( bool selected );
+
+/* --- report dispatch ------------------------------------------------------ */
+
+void L1T_DispatchReports( void );
+
+/* --- callbacks called from within the core -------------------------------- */
+/* --- implemented elsewhere ------------------------------------------------ */
+
+void L1A_DispatchReport( Report* report );
+void L1I_WakeTask( void );
+void L1T_internal_wake_up_task( void );
+#if !(IS_DUAL_CORE_GL1AC_MODEM_SUPPORT)
+void L1I_HandleL2Uplink( void );
+#endif
+
+bool L1I_CheckSendMessage( l1c_sim_mode_enum );
+void L1I_SetHisrRunning(bool);
+
+#ifdef __GL1_GEMINI__
+void L1A_DispatchReport_2( Report* report );
+#endif
+#if (GEMINI_PLUS_GSM >= 3)
+void L1A_DispatchReport_3( Report* report );
+#endif
+#if (GEMINI_PLUS_GSM >= 4)
+void L1A_DispatchReport_4( Report* report );
+#endif
+
+#if defined(__GL1_MULTI_MODE__) && defined(__GL1_GEMINI__)
+FCChPriority L1A_GetFCChPriority( uint8 sim_idx );
+#endif
+
+/* --- resetting the AGC when everything is lost ---------------------------- */
+
+/* L1A should call this when entering scan mode */
+void L1T_AGCReset( void );
+
+/* --- changing serving cell ------------------------------------------------ */
+
+void L1T_SetServingBCChARFCN( ARFCN arfcn );
+void L1T_SetServingBCChBSIC( BSIC bsic );
+AfcParams* L1T_GetCurrentAfcParams( void );
+AfcParams* L1T_GetManualAfcParams( void );
+AfcParams* L1I_AFCGetParams( uint8 simIndex );
+void L1I_BackupCurrentAfcParams( AfcParams* CurrentAfcParams );
+#ifdef __GL1_MULTI_MODE__
+AfcParams* L1I_AFCGetStandbyParams( uint8 simIndex );
+#endif
+
+/* --- synchronisation ------------------------------------------------------ */
+
+void L1T_SetSync( int32 frameOffset, intx ebitOffset );
+#ifdef __GL1_GEMINI__
+void L1T_ModifySetSync( ARFCN arfcn, BSIC bsic, int32* frameOffset, intx* ebitOffset );
+void L1T_SetSIMStatus(bool is_SIM1);
+bool L1I_GetSIMStatus(l1c_sim_mode_enum);
+void L1T_SetSIMConfigBitmap(uint8 bitmap);
+#endif
+/* --- power scan ----------------------------------------------------------- */
+
+void L1T_PowerScanStart( intx bands, PowerScanResults* results );
+void L1T_ListPowerScanStart( intx arfcnCount, ARFCN* arfcns, PowerScanResults* results, kal_bool isCGIPowerScan );
+void L1T_PowerScanStop( void );
+void L1I_PowerScanStop( void );
+
+#ifdef __GL1_GEMINI__
+void L1T_PowerScanSetInitData(
+ int8 sampleNo,
+ VirtualPowerScanState virtual_powerscan_state
+#ifdef __GL1_GEMINI_WCDMA__
+ ,PowerScanPurpose purpose
+#endif /* __GL1_GEMINI_WCDMA__ */
+#ifdef __GL1_QUICK_MCC_SEARCH__
+ ,bool is_quick_mcc_search
+#endif
+);
+
+#ifdef __GEMINI__
+void L1T_PowerScanSetParam( uint32 scanPeriod, uint32 scanLength );
+#endif
+
+#ifdef __GL1_GEMINI__
+void L1T_ReceiveVirtualSuspendCnf(void);
+#endif
+//PowerScanParamStruct* L1T_PowerScanGetParamBuffer(void);
+#endif
+#if defined(__GL1_GEMINI__) && defined(__GL1_MULTI_MODE__)
+void L1T_PowerScanRestart(void);
+bool L1T_Check_IfNeed_PowerScanRestart(void);
+bool L1T_Check_IfNeed_PowerScanRestart_VNull(void);
+void L1T_ResetPowerScanRestartedCount(kal_bool is_reset);
+#endif
+
+
+/* --- FCCh ----------------------------------------------------------------- */
+#ifdef __LTE_RAT__
+void L1T_FCChStartWithOffset( ARFCN arfcn, bool isSrvccTimingValid, int32 frameOffset, intx ebitOffset, bool frequencyCorrect, AfcParams* afc, bool newcell, bool manual );
+#endif
+void L1T_FCChStart( ARFCN arfcn, bool frequencyCorrect, AfcParams* afc, bool newcell, bool manual );
+void L1T_FCChStop( void );
+#ifdef __GL1_GEMINI__
+void L1T_FCChSetPriority( FCChPriority priority );
+void L1T_FCChPriorityRestart( ARFCN arfcn, bool frequencyCorrect, AfcParams* afc, bool newcell, bool manual );
+#endif
+#if defined( __GEMINI__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ )
+void L1T_FCChSetInitData( uint16 interval );
+/*TBD: L1C maintains two-element arrays; one for mode, and another for SIM*/
+#endif /* defined( __GEMINI__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ )*/
+
+/* --- SCh ------------------------------------------------------------------ */
+
+void L1T_SChStart( ARFCN arfcn, int32 frameOffset, intx ebitOffset, AfcParams* afc, bool manual );
+void L1T_SChStop( void );
+#ifdef __GL1_GEMINI__
+void L1T_SChSetPriority( SChPriority priority );
+#endif
+
+/* --- Serving SCh -------------------------------------------------------------- */
+#ifdef __ADDITIONAL_SERVING_SB_TRACKING__
+void L1T_ServingSChStart( void );
+#endif
+
+/* --- neighbour cell BCCh -------------------------------------------------- */
+
+void L1T_NBCChStart( ARFCN arfcn, BSIC bsic, int32 frameOffset, intx ebitOffset, intx mask, AfcParams* afc, bool adjacent );
+void L1T_NBCChSetPriority( NBCChPriority priority );
+void L1T_NBCChStop( void );
+bool L1T_NBCChSCStop( void );
+void L1T_NBCChReportStop( void );
+
+#ifdef __GL1_GEMINI__
+void L1T_NBCChSetPriorityIndex( uint16 priority_index);
+#endif
+
+
+/* --- BCCh ----------------------------------------------------------------- */
+
+void L1T_BCChStart( ARFCN arfcn, BSIC bsic, TimeSlot timeSlot, intx mask );
+void L1T_BCChSetMask( intx mask );
+void L1T_BCChSetPriority( bool high );
+void L1T_BCChStop( void );
+
+/* --- PCh ------------------------------------------------------------------ */
+
+void L1T_PChSetParams( ARFCN arfcn, BSIC bsic, TimeSlot timeSlot, bool combinedCCCh, bool extendedPaging, intx pagingIndex, intx pagingMultiFrame, intx pagingPeriod, intx agchBlocksReserved, bool gprs, bool nom3withPPCh );
+void L1T_PChSetExtendedPaging( bool extendedPaging );
+void L1T_PChStart( void );
+void L1T_PChStop( void );
+void L1T_PChSetSCIdleMode( bool active );
+#if defined (__MONITOR_PAGE_DURING_TRANSFER__) || defined(__GL1_GEMINI__)
+void L1T_PChSetPriority( bool high );
+void L1T_QueryNextPChFN(uintx* NextPChFN);
+bool L1I_QueryPChStatus(l1c_sim_mode_enum);
+#endif /* __MONITOR_PAGE_DURING_TRANSFER__ || __GEMINI__ */
+
+#ifdef __SMART_PAGING_IN_IDLE__
+void L1T_SetSmartPaging(bool);
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+void L1T_SetMSIdentity(kal_bool is_imsi_present, l1_imsi_struct imsi, kal_bool is_tmsi_present, kal_uint8* tmsi, kal_bool is_ptmsi_present, kal_uint8* ptmsi );
+#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+#endif /*__SMART_PAGING_IN_IDLE__*/
+
+/* --- AGCh ----------------------------------------------------------------- */
+
+void L1T_AGChStart( ARFCN arfcn, BSIC bsic, TimeSlot timeSlot, bool combinedCCCh );
+void L1T_AGChStop( void );
+
+/* --- CBCh ----------------------------------------------------------------- */
+
+#ifdef __L1_CB__
+void L1T_CBChSetParams( HoppingSequence* hs, TSC tsc, bool combinedCCCh, TimeSlot timeSlot, TimeSlot syncTimeSlot );
+void L1T_CBChStart( bool ext );
+void L1T_CBChStop( bool ext );
+void L1T_CBChSkip( bool ext, intx blocks );
+void L1T_CBChSetPriority( bool top );
+#endif
+/* ------------ tx power limit for DCH and RACH ------------------------------*/
+void L1T_SetMaxTxPower(Power power);
+Power L1T_GetMaxTxPower( void );
+
+/* --- RACh ----------------------------------------------------------------- */
+
+void L1T_RAChSetParams( ARFCN arfcn, BSIC bsic, TimeSlot timeSlot, bool combinedCCCh, PowerControlLevel txPower, intx burstLength, TSC tsc );
+FrameNumber L1T_RAChStart( FrameNumber startFrameNumber, RAChData rachData );
+void L1T_RAChStop( void );
+
+/* --- report period -------------------------------------------------------- */
+
+void L1T_ReportPeriodSetParams( bool powerControl, bool dtxAllowed );
+void L1T_DChULDTX( bool dtxAllowed );
+
+/* --- hopping sequence management ------------------------------------------ */
+
+HoppingSequence* L1T_AllocHoppingSequence( void );
+
+/* --- DCh ------------------------------------------------------------------ */
+
+DChParams* L1T_DChGetParamsBuffer( void );
+void L1T_DChStart( FrameNumber startFrameNumber );
+
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+void L1T_DChHandover( FrameNumber startFrameNumber,kal_uint8* SABMData );
+#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+void L1T_DChHandover( FrameNumber startFrameNumber );
+#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+
+#ifdef __GL1_MULTI_MODE__
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+void L1T_InterRATDChStart( FrameNumber startFrameNumber ,kal_uint8* SABMData );
+#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+void L1T_InterRATDChStart( FrameNumber startFrameNumber );
+#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+void L1I_InterRATDChEnterStandby( void );
+#endif /* __GL1_MULTI_MODE__ */
+
+void L1T_DChBack( FrameNumber startFrameNumber );
+void L1T_DChRestart( FrameNumber startFrameNumber, FrameNumber frameOffset, intx ebitOffset );
+void L1T_DChStop( bool isHandover );
+#if defined(__GL1_MULTI_MODE__) || defined(__BLIND_HANDOVER__)
+void L1T_DChStopPendingHS(void);
+#endif
+void L1T_DChSetHoppingSequence( HoppingSequence* hs, FrameNumber startFrameNumber );
+void L1T_DChSetCiphering( bool enable, int8 algorithm, uint8 key[ ] );
+void L1T_AsyncHandoverStart(void);
+void L1T_AsyncHandoverEnd(void);
+#if defined(__AMR_SUPPORT__) || defined(__AMRWB_LINK_SUPPORT__)
+void L1T_DChSetChannelMode( TChMode channelMode, TChAMRConfig *amrConfig );
+#else
+void L1T_DChSetChannelMode( TChMode channelMode );
+#endif
+void L1T_DChStopHandover( TimingAdvance timingAdvance );
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+kal_uint8 L1T_DChSetLoopMode( LoopMode mode );
+#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+void L1T_DChSetLoopMode( LoopMode mode );
+#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+
+TimingAdvance L1T_GetTimingAdvance( void );
+
+#ifdef __BLIND_HANDOVER__
+
+void L1T_SetBlindHOPhase(BlindHO_Phase new_phase);
+
+#endif /* end of __BLIND_HANDOVER__ */
+
+void L1T_AFC_Update_Resume_Mode(kal_uint8 new_mode);
+
+
+
+/* --- FCChT ---------------------------------------------------------------- */
+
+void L1T_FCChTStart( ARFCN arfcn, TimeSlot syncTimeSlot, TimeSlot startTimeSlot, bool gprs, AfcParams* afc, bool newcell , intx sacchPosition, bool manual);
+void L1T_FCChTStop( void );
+
+/* --- SChT ----------------------------------------------------------------- */
+
+void L1T_SChTStart( ARFCN arfcn, int32 frameOffset, intx ebitOffset, TimeSlot syncTimeSlot, TimeSlot startTimeSlot, bool gprs, AfcParams* afc , intx sacchPosition, bool manual);
+void L1T_SChTStop( void );
+
+
+/* --- PBCCh ---------------------------------------------------------------- */
+
+void L1T_PBCChSetParams( HoppingSequence* hs, TSC tsc, TimeSlot timeSlot, TimeSlot syncTimeSlot, intx pbcchBlocks, intx psiRepeatPeriod, intx psiCountHR, PBCChMode mode, bool decodeUSF );
+void L1T_PBCChSetPriority( PBCChPriority high );
+void L1T_PBCChStart( void );
+void L1T_PBCChStop( void );
+
+/* --- neighbour cell PBCCh ------------------------------------------------- */
+
+void L1T_NPBCChStart( HoppingSequence* hs, ARFCN bcchARFCN, intx pb, TSC tsc, FrameNumber frameOffset, intx ebitOffset, TimeSlot timeSlot, intx pbcchBlocks, intx psiRepeatPeriod, PBCChMode mode );
+void L1T_NPBCChSetPriority( bool high );
+void L1T_NPBCChStop( void );
+
+/* --- PPCh ----------------------------------------------------------------- */
+
+void L1T_PPChSetParams( HoppingSequence* hs, TSC tsc, TimeSlot timeSlot, TimeSlot syncTimeSlot, bool extendedPaging, intx nonPagingBlocks, intx splitPagingCycle, uint32 imsi, intx kc );
+void L1T_PPChSetExtendedPaging( bool extendedPaging );
+void L1T_PPChStart( void );
+void L1T_PPChStop( void );
+
+/* --- PAGCh ---------------------------------------------------------------- */
+
+void L1T_PAGChStart( HoppingSequence* hs, TSC tsc, TimeSlot syncTimeSlot, TimeSlot timeSlot );
+void L1T_PAGChStop( void );
+
+/* --- PRACh ---------------------------------------------------------------- */
+
+void L1T_PRAChSetParams( HoppingSequence* hoppingSequence, BSIC bsic, TimeSlot timeSlot, TimeSlot syncTimeSlot, intx burstLength, TSC tsc );
+void L1T_PRAChStart( intx skip, RAChData rachData, bool isFirst );
+void L1T_PRAChStop( void );
+
+/* --- Polling response in pakcet idle mode --------------------------------- */
+
+void L1T_PollRespABStart( FrameNumber startFrameNumber, HoppingSequence* hoppingSequence, BSIC bsic, TimeSlot timeSlot, PowerControl* powerControl, intx burstLength, RAChData rachData );
+void L1T_PollRespNBStart( FrameNumber startFrameNumber, HoppingSequence* hoppingSequence, TSC tsc, TimeSlot timeSlot, TimingAdvance timingAdvance, PowerControl* powerControl, BlockData blockData[23] );
+void L1T_PollRespStop( void );
+
+/* --- Single uplink block without TBF -------------------------------------- */
+
+void L1T_SingleULWithoutTBFStart( FrameNumber startFrameNumber, HoppingSequence* hoppingSequence, TSC tsc, TimeSlot timeSlot, TimingAdvance timingAdvance, PowerControl* powerControl, BlockData blockData[23] );
+void L1T_SingleULWithoutTBFStop( void );
+
+/* --- Single downlink block receiving -------------------------------------- */
+
+void L1T_SingleDLStart( FrameNumber startFrameNumber, HoppingSequence* hs, TSC tsc, TimeSlot timeSlot);
+void L1T_SingleDLStop( void );
+
+/* --- Single/multi uplink block allocation in two phase access ------------------- */
+
+void L1T_SingleULTwoPhaseStart( FrameNumber startFrameNumber, HoppingSequence* hs, TSC tsc, TimeSlot timeSlot, TimingAdvance timingAdvance, PowerControl* powerControl, BTSPowerControl* btsPowerControl, BlockData blockData[23], BlockData blockData2[23], SingleBlockType singleBlkType );
+void L1T_SingleULTwoPhaseStop( void );
+
+/* --- PDTCh ---------------------------------------------------------------- */
+
+TBFParams* L1T_TBFGetParamsBuffer( void );
+void L1T_TBFStart( TBFParams* p );
+
+#ifdef __NEW_TBF_ARCH__
+void L1T_TBFStop( uint8 dl, uint8 ul, uint8 stopTid );
+#else
+void L1T_TBFStop( bool dl, bool ul, uint8 stopTid );
+#endif
+
+#ifdef __NEW_TBF_ARCH__
+#ifndef __REMOVE_FA__
+void L1T_TBFRepeatAllocation( bool repeat, TimeSlotMask timeSlotOverrideMask, FrameNumber startFrameNumber );
+#endif
+#else
+void L1T_TBFRepeatAllocation( bool repeat, TimeSlotMask timeSlotOverrideMask, FrameNumber startFrameNumber );
+#endif
+
+void L1T_TBFSetPowerControl( PowerControl* powerControl, FrameNumber startFrameNumber );
+void L1T_TBFSetTimingAdvance( PacketTimingAdvance* ta );
+void L1T_TBFSetTAValue( TimingAdvance timingAdvance );
+void L1T_TBFSetHoppingSequence( HoppingSequence* hs, FrameNumber startFrameNumber );
+void L1T_TBFReleaseTimeSlots( TimeSlotMask timeSlotsKept, bool bothActivePending );
+#ifdef __EGPRS_MODE__
+void L1T_EgprsSetLoopMode( bool isOn, uint8 modeFlag );
+#ifdef __NEW_TBF_ARCH__
+void L1T_EgprsResetIR( uint8 isResetIR );
+#else
+void L1T_EgprsResetIR( bool isResetIR );
+#endif
+#endif /*__EGPRS_MODE__*/
+
+/* --- extended power measurements ------------------------------------------ */
+
+void L1T_ExtendedMeasurementStartDedi( ScanList* list );
+void L1T_ExtendedMeasurementStopDedi( void );
+
+#ifdef __PKT_EXT_MEAS__
+void L1T_ExtendedMeasurementStartPacketIdle( ScanList* list );
+void L1T_ExtendedMeasurementStopPacketIdle( void );
+#endif
+/* --- interference measurements -------------------------------------------- */
+
+void L1T_InterferenceStart( ARFCN servingBCChARFCN, HoppingSequence* hoppingSequence, TimeSlot syncTimeSlot, bool contiguous, uint8 assign_ref );
+void L1T_InterferenceStop( void );
+
+/* --- calculating receive power level C ------------------------------------ */
+
+void L1T_CSetParams( Power pb, intx tavgw, intx tavgt, bool measurePDTCh );
+void L1T_CSetPb( Power pb );
+intx L1T_GetC( void );
+
+/* --- GPRS transmit power control ------------------------------------------ */
+
+void L1T_PowerControlSetMaximumOutputPower( Power pmax );
+void L1T_PowerControlSetParams( uint8 alpha );
+
+/* --- surround cell handling ----------------------------------------------- */
+
+bool L1T_SurroundHandleReport( Report* report );
+
+void L1T_SurroundSetMode( SurroundMode mode );
+void L1T_SurroundSuspend( void );
+void L1T_SurroundResume( void );
+
+void L1T_SurroundSetServingCell( ARFCN arfcn, BSIC bsic );
+#ifdef __GL1_GEMINI__
+void L1T_SurroundGetServingCell( ARFCN *arfcn, BSIC *bsic, l1c_sim_mode_enum sim_idx );
+void L1T_SetVirtualMode( bool IsVirtual, l1c_sim_mode_enum local_sim_mode );
+bool L1T_QueryIsVirtualMode( l1c_sim_mode_enum local_sim_mode );
+bool L1I_QueryIsVirtualMode( l1c_sim_mode_enum local_sim_mode );
+#endif
+void L1T_SurroundSetBAList( SurroundBAList* BAList );
+void L1T_SurroundSetSync( int32 frameDecrease, intx qbit_decrease );
+void L1T_SurroundSetTimeSlot( TimeSlot timeSlot );
+bool L1T_SurroundGetTimeSlotDiff( void );
+
+#ifdef __GL1_MULTI_MODE__
+kal_bool L1T_SurroundCheckBsicQueueEmpty( l1c_sim_mode_enum local_sim_mode, bool isManual );
+kal_bool L1T_SurroundCheckIfUnknownBsicInQueue( l1c_sim_mode_enum local_sim_mode, kal_bool isManual );
+#endif
+
+/* Set serving BSIC for AGPS check ----- */
+#if ( defined( __L1_GPS_AUTO_TIMING_SYNC_SUPPORT__ ) || defined( __L1_GPS_REF_TIME_SUPPORT__ ) )
+void L1T_SurroundSetServingCellBsic( BSIC bsic );
+#endif
+
+void L1T_SurroundSetPChIdle( intx pagingPeriod ); /* needed in idle mode with SI13 only */
+void L1T_SurroundSetPCh( intx pagingPeriod ); /* needed in packet idle mode only */
+void L1T_SurroundSetPPCh( intx splitPagingCycle ); /* needed in packet idle mode only */
+
+void L1T_SurroundBSICReq( const SCBsicInfo* sc );
+void L1T_SurroundBCChReq( const SCBcchInfo* sc );
+void L1T_SurroundBSICStop( const SCBsicStopInfo* sc );
+void L1T_SurroundBCChStop( const SCBcchStopInfo* sc );
+void L1T_SurroundBCChPriorAcquireReq( ARFCN arfcn, bool is_prior_to_acquire );
+#ifdef __PKT_EXT_MEAS__
+void L1T_SurroundBSICExtReq( const SCBsicInfo* sc );
+void L1T_SurroundBSICExtStop( const SCBsicStopInfo* sc );
+#endif
+void L1T_SurroundChangeCell( void );
+
+void L1T_SurroundClearManualList( void ); /* for BlindHO from l1t_surround_private.h*/
+
+/* network controlled measurements */
+
+void L1T_SurroundSetNCMeasParams( SuroundNCMeasParams* params );
+void L1T_SurroundStartNCMeas( void );
+void L1T_SurroundStopNCMeas( void );
+void L1T_SurroundUpdateNCMeas( bool isPTMtoPIM );
+bool L1T_IsNcActive( void );
+/* extended measurements */
+#ifdef __PKT_EXT_MEAS__
+void L1T_SurroundSetExtMeasParams( SuroundExtMeasParams* params );
+void L1T_SurroundStartExtMeas( void );
+void L1T_SurroundStopExtMeas( void );
+#endif
+/* -------------------------------------------------------------------------- */
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+void L1T_SetRATStop(void);
+#endif
+/* -------------------------------------------------------------------------- */
+
+void L1T_PutUplinkSACCh( BlockData* data );
+void L1T_PutUplinkCCh( BlockData* data );
+
+/* -------------------------------------------------------------------------- */
+
+FrameNumber L1T_GetFN( void );
+void L1T_GetTime( Time* time );
+void L1T_GetTime_after_SleepMode_Recovery( Time* time );
+#ifdef __GL1_GEMINI__
+void L1T_GetTime_SIMx( Time* time,l1c_sim_mode_enum local_sim_mode);
+#endif
+/* -------------------------------------------------------------------------- */
+
+void L1T_GetBatteryMeasurementSetting( SBATMEASARG *meas_args );
+void L1T_SetBatteryVoltage( int volt );
+void L1T_SetBatteryTemperature( int temp );
+void L1T_SetRFTemperature( int temp );
+void L1T_SIM_Notify( uint8 status );
+uint8 L1T_IS_GetRFTemperatureFromADC( void );
+uint8 L1T_IS_GetBatteryInfoFromADC( void );
+
+/* --- PS Handover ----------------------------------------------------------- */
+#ifdef __PS_SERVICE__
+TimingAdvance L1T_GetPacketTimingAdvance (void);
+#endif
+
+/* --- L1 AGPS ----------------------------------------------------------- */
+#if ( defined( __L1_GPS_AUTO_TIMING_SYNC_SUPPORT__ ) || defined( __L1_GPS_REF_TIME_SUPPORT__ ) )
+void L1T_GpsTimeSyncReq( ARFCN arfcn, BSIC bsic, l1_agps_frame_sync_app_E type, kal_bool maintain_phase );
+#endif
+
+#ifdef __GL1_MULTI_MODE__
+void L1T_MMGetAutoGAP( Time starting_time );
+void L1T_MMPutAutoGAP( void );
+#endif
+
+/* free HS */
+#ifdef __L1_CB__
+void L1T_FreeHsCBCh( void );
+#endif
+
+void L1T_FreeHsDCh( void );
+
+#ifdef __PS_SERVICE__
+void L1T_FreeHsPDTCh( void );
+void L1T_FreeHsSingleULTwoPhase( void );
+void L1T_FreeHsPTCCh( void );
+void L1T_FreeHsIM( void );
+void L1T_FreeHsPollResp( void );
+
+void L1T_FreeHsSingleDL( void );
+void L1T_FreeHsSingleULWithoutTBF( void );
+#endif
+
+void L1T_FreeHoppingSequence( SurroundMode newmode );
+/* free HS */
+
+/* --- Channel Protection (GEMINI2.0)------------------------------------- */
+#ifdef __GL1_GEMINI__
+void L1T_ChannelProtection(ProtectionParamStruct* param);
+#endif /*__GEMINI__*/
+
+/* Rick 20121119: Switch VAMOS1/2 load by editting NVRAM
+ vamos_level 0x00 means non-VAMOS
+ vamos_level 0x01 means VAMOS1
+ vamos_level 0x02 means VAMOS2 */
+void L1T_UpdateVAMOSLevel(uint8 vamos_level);
+
+/* CCCI callback function for thermal issue */
+#ifdef __MTK_TARGET__
+void L1_CrystalThermalChangeNotify( kal_uint32 ap_param);
+#endif /* __MTK_TARGET__ */
+
+/* for ReportCGI scan/bsic/bcch */
+#ifdef __GL1_MULTI_MODE__
+void L1T_CGIPowerScanStart( intx arfcnCount, ARFCN* arfcns, PowerScanResults* results, kal_bool use_auto_gap );
+void L1T_CGIPowerScanStop( kal_bool use_auto_gap );
+void L1T_InitPowerScanCGIData( void );
+intx L1I_IsCGIPowerScanStarted( void );
+intx L1I_CGIPowerScanStop( void );
+
+void L1I_ScheduleSRVCCBSIC( void );
+void L1T_StopSRVCCBSICSchedule( void );
+void L1T_CGIBSICStart( ARFCN arfcn, TID tid, kal_bool is_SRVCC );
+void L1T_CGIBSICStop( void );
+intx L1I_IsCGIBSICStarted( void );
+intx L1I_CGIBSICStop( void );
+void L1T_InitFCChCGIData( void );
+void L1T_SetFCChCGIPriority( bool reset );
+
+
+void L1T_CGIBCCHStart( ARFCN arfcn, BSIC bsic, uint16 bcchMask, FrameNumber frameoffset, intx ebitOffset );
+void L1T_CGIBCCHStop( void );
+intx L1I_IsCGIBCChStarted( void );
+intx L1I_CGIBCCHStop( void );
+void L1T_InitNBCChCGIData( void );
+#endif /* __GL1_MULTI_MODE__ */
+
+/* after l1c move to normal domain, ct1 can use this api to queue func to sisr */
+void L1I_h_QFUNC_TO_SISR( GL1C_SISRQ_FUNC_TYPE type, ... );
+
+#endif
diff --git a/mcu/l1/interface/gl1/l1_core_private.h b/mcu/l1/interface/gl1/l1_core_private.h
new file mode 100644
index 0000000..64703a8
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_core_private.h
@@ -0,0 +1,3483 @@
+/*******************************************************************************
+* Modification Notice:
+* --------------------------
+* This software is modified by MediaTek Inc. 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_core_private.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * Layer1 core private stuff
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *------------------------------------------------------------------------------
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ *
+ *******************************************************************************/
+
+/******************************************************************************
+ *
+ * File: %P%
+ * -----
+ *
+ * SCCS Version: %I%
+ * -------------
+ *
+ * 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 Communications Consultants Worldwide Limited (C) 2001
+ *
+ * Project:
+ * --------
+ *
+ * Software Unit: Layer1 core private stuff.
+ * --------------
+ *
+ * Description:
+ * ------------
+ *
+ *
+ * Modification History:
+ * ---------------------
+ * Date Vers Auth Details
+ * ---- ---- ---- -------
+ * 28-Mar-01 2.1 VKL Initial version
+ * 17-Apr-01 2.2 VKL added new init functions
+ * split L1I_StopReportPeriods() into two alternative
+ * functions
+ * added new delay calculation functions
+ * removed most prototypes for surround cell engine
+ * added ring buffer macros
+ * 27-Apr-01 2.3 VKL Added transmit power control manager and removed
+ * transmit power handling from report periods
+ * Changed handling of received SACCh to feed transmit
+ * power control manager.
+ * Moved ring buffer handling from
+ * generic/l1_core_private.h to generic/l1_tool.h
+ * 01-May-01 2.4 VKL Add prototypes for L1T_InitTBFData() and
+ * L1T_InitEXTData()
+ * Add new timer mask TIMER_MASK_SUSPEND_PDTCH
+ * add prototypes for PDTCh functions
+ * 21-May-01 2.5 VKL added new init functions.
+ * changed definitions of timer priorities.
+ * added comments
+ * added L1I_UpdatePRAChUSF
+ * added power measurement manager
+ * surround cell power measurements now done in
+ * separate module, not in report period any more.
+ * 15-Jul-01 2.6 VKL Added new init functions
+ * StopTimer returns value now
+ * Added L1I_DelayTimerEBits()
+ * Replaced monitoring functions to properly handle
+ * half rate and data.
+ * Added L1I_GetTimingAdvance()
+ * Removed monResult parameter from AllocRxReport()
+ * Moved in PTCCh functions from other header file
+ * Add fields to Chan struct for handling SID frames.
+ * Added some tool functions
+ * Added functions for handling of power level C
+ * Added functions for uplink power control
+ * Added various interconnection functions
+ * Removed obsolete prototypes
+ * Added MAC functions
+ * 08-Aug-01 2.7 VKL Added L1T_GetServingBCChARFCN()
+ * Added powerControl flag to L1I_StartReportPeriods()
+ * Added powerControl flag to L1I_AllocRxReport()
+ * Removed obsolete fields from structure Channel
+ * Added L1I_DChReportingPeriodBegin()
+ * Added timeSlot parameter to L1I_PowerControlSetC()
+ * Added txPower parameter to L1I_MACBlockTick()
+ * 02-Sep-01 2.8 VKL Introduce separate timer priorities for receive & transmit
+ * remove RESERVERMASK_R, add RESERVERMASK_RTM4, add time stamp
+ * functions, change Timer from singly linked to doubly linked list
+ * remove return value from L1I_StopTimer(), add L1I_FindTimerDelay()
+ * add dtxAllowed parameter to L1I_StartReportPeriods(),
+ * add L1T_AllocReport(), change L1T_ResetTiming() to L1I_ResetTiming()
+ * add sacchPosition field to Channel structure, change PTCCh functions
+ * add parameters to L1I_PDTChStart() and L1I_PDTChStop()
+ * remove L1I_DChPowerControlGetUsedPower(), add dtxAllowed parameter
+ * to L1I_DChReportingPeriodBegin(), add L1I_SetReportedPower() and
+ * L1I_SetReportedTimingAdvance(), add L1I_PowerControlSetParams()
+ * and L1I_PowerControlClearParams(), move BCCh and surround cell
+ * power measurement prototypes from l1_core.h to this file.
+ * change MAC function prototypes,remove Frame data structure,
+ * remove frame reservation macros and unused reservation masks
+ * add L1I_ClearReservation() and L1I_AbortReserveExtendAbortable()
+ * remove obsolete parameter from L1I_AbortReserveExtendMasked()
+ * remove L1I_GetFN51(), split handling of monitoring and reporting
+ * change function prefixes for some functions from L1T_ to L1I_
+ * 12-Sep-01 2.9 VKL Add funtions for hopping sequence memory management,
+ * add L1I_MACReleaseTimeSlots()
+ * 13-Sep-01 2.10 VKL Add RESERVEMASK_RTM4 again
+ * 26-Sep-01 2.11 VKL Added new prototypes.
+ * Added tsc parameter to L1I_PTCChSetParams()
+ * Removed pagingPeriod from L1T_SurroundMeasurementStartIdle()
+ * Added lastInPeriod parameter to
+ * L1I_SurroundMeasurementPacketPagingBlock() and
+ * L1I_ExtenededMeasurementPacketPagingBlock()
+ * Added syncTmieSlot parameter to L1I_MACBlockTick()
+ * 01-Oct-01 2.12 VKL Add new parameter to L1I_UpdateCFromPPCh()
+ * 09-Oct-01 2.13 VKL Add new AGC prototypes
+ * 09-Oct-01 2.14 VKL Add new AGC init functions
+ * 10-Oct-01 2.15 VKL Add per cell AFC support
+ * 12-Oct-01 2.16 VKL Add L1_PrepareSChData()
+ * Split L1I_MACBlockTick() into rx and tx block tick
+ * 12-Oct-01 2.17 SY Add timertype structure
+ * 26-Oct-01 2.18 VKL Removed lastInPeriod from L1I_SurroundMeasurementPagingBlock()
+ * 05-Nov-01 2.19 VKL Add TimerPPChNorm and TimerPPChExt and TimerTBF
+ * 07-Nov-01 2.20 VKL Use one value for C instead of one per timeslot
+ * 08-Nov-01 2.21 VKL Additional param to L1I_ClearReservation()
+ * 09-Nov-01 2.22 VKL Add return value to L1T_SurroundMeasurementStartDedi()
+ * and L1T_SurroundMeasurementStartPacketTransfer()
+ * 11-Nov-01 2.23 VKL Change params of L1T_SurroundMeasurementStartPacketIdle()
+ * SY Add syncTimeSlot to L1I_PDTChStart()
+ * 08-Nov-01 2.24 SY Add complete timertype for GPRS
+ * 17-Nov-01 2.25 VKL Add L1T_GetServingBCChARFCN()
+ * Change params to L1I_PDTChStart()
+ * Modify AGC interface
+ * 21-Nov-01 2.26 VKL Add parameter 'slot' to L1I_UpdateCFromPPCh()
+ * Add L1I_CResetCounter()
+ * 28-Nov-01 2.27 SY Move TimeStamp to l1_type.h
+ * 04-Dec-01 2.27 VKL Add arfcn to L1I_AllocRxReport()
+ * Add L1I_AllocMultislotRxReport()
+ * L1I_PDTChStop() now always fully stops PDTCh and
+ * add L1I_PDTChRestart() instead.
+ * Add L1T_CalcBlockPower()
+ * Change monitoring interface
+ *
+ *****************************************************************************/
+#ifndef l1_generic_l1_core_private_h
+#define l1_generic_l1_core_private_h
+#include "l1_private.h"
+
+#include "kal_public_api.h"
+#include "kal_hrt_api.h"
+#include "l1_const.h"
+#include "l1_types.h"
+#include "kal_general_types.h"
+#include "mph_types.h"
+#include "l1_public.h"
+#include "event_info_utility.h" // for MODEM_WARNING_MESSAGE
+#ifdef __MTK_TARGET__
+#include "dcxo_div.h" // for 32KHz-less
+#endif
+#include "mmrf_cc_public.h" // for MMRF query func
+#if TRACING_SUPPORT
+#ifdef __GL1_GEMINI__
+#include "tool.h"
+#endif
+#endif
+#ifdef __GL1_MULTI_MODE__
+#include "l1sm_modem_public.h"
+#define MAX_3G_GAP_FRAME MAX_SLEEP_FRAMES
+#endif
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+#include "l1_rtb.h"
+#endif
+
+#if defined(__MTK_TARGET__) && !defined(__L1_STANDALONE__)
+#if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+#include "em_l1_public_struct.h"
+#include "em_struct.h"
+#include "em_l4_public_struct.h"
+#include "em_gas_public_struct.h"
+#endif /* IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 ) */
+#endif
+
+#if defined(__MTK_TARGET__) && !defined(__L1_STANDALONE__)
+#define GL1_EM_IDLE_MODE_INFO_SUPPORT 1
+#else
+#define GL1_EM_IDLE_MODE_INFO_SUPPORT 0
+#endif
+
+
+/* --- assert functions -----------------------------------------------------*/
+/* [MAUI_02899879] for SLIM projects, ASSERT will be defined as NULL.
+ So if the assertion is quite important, please use L1C_EXT_ASSERT_Reboot.*/
+#define L1C_ASSERT_Bypass( st ) (void)0
+#define L1C_ASSERT_Bypass_Trace( st ) if(!(st)) MODEM_WARNING_MESSAGE( 0, "[L1C]" )
+#define L1C_ASSERT_Reboot( st ) if(!(st)) ASSERT( 0 )
+#define L1C_EXT_ASSERT_Bypass( st, d1, d2, d3 ) (void)0
+#define L1C_EXT_ASSERT_Bypass_Trace( st, d1, d2, d3 ) if(!(st)) MODEM_WARNING_MESSAGE( 0, "[L1C] var1:%d, var2:%d, var3:%d", d1, d2, d3 )
+#define L1C_EXT_ASSERT_Reboot( st, d1, d2, d3 ) if(!(st)) EXT_ASSERT( 0, d1, d2, d3 )
+
+#ifdef __MTK_INTERNAL__
+ #undef L1C_ASSERT_Bypass
+ #undef L1C_ASSERT_Reboot
+ #undef L1C_EXT_ASSERT_Bypass
+ #define L1C_ASSERT_Bypass( st ) if(!(st)) EXT_ASSERT( 0, 0, 0, 0 )
+ #define L1C_ASSERT_Reboot( st ) if(!(st)) EXT_ASSERT( 0, 0, 0, 0 )
+ #define L1C_EXT_ASSERT_Bypass( st, d1, d2, d3 ) if(!(st)) EXT_ASSERT( 0, d1, d2, d3 )
+#endif
+
+#ifdef L1_SIM
+ #undef L1C_ASSERT_Bypass_Trace
+ #undef L1C_EXT_ASSERT_Bypass_Trace
+ #define L1C_ASSERT_Bypass_Trace( st ) if(!(st)) ASSERT( 0 )
+ #define L1C_EXT_ASSERT_Bypass_Trace( st, d1, d2, d3 ) if(!(st)) EXT_ASSERT( 0, d1, d2, d3 )
+#endif
+
+/* --- init functions -------------------------------------------------------*/
+#ifdef __ADDITIONAL_SERVING_SB_TRACKING__
+void L1T_InitServingSChData( void );
+#endif
+void L1T_InitFramerData( void );
+void L1T_InitUplinkData( void );
+void L1T_InitPowerScanData( void );
+void L1T_InitFCChData( void );
+void L1T_InitSChData( void );
+void L1T_InitNBCChData( void );
+void L1T_InitBCChData( void );
+void L1T_InitPChData( void );
+void L1T_InitAGChData( void );
+#ifdef __L1_CB__
+void L1T_InitCBChData( void );
+#endif
+void L1T_InitMonitoringData( void );
+void L1T_InitReportPeriodData( void );
+void L1T_InitTimingData( void );
+void L1T_InitRAChData( void );
+void L1T_InitDChData( void );
+void L1T_InitSDCChData( void );
+void L1T_InitTChData( void );
+void L1T_InitFCChTData( void );
+void L1T_InitSChTData( void );
+void L1T_InitRATSCChData( void );
+void L1T_InitPBCChData( void );
+void L1T_InitPPChData( void );
+void L1T_InitPTCChData( void );
+void L1T_InitPDTChData( void );
+void L1T_InitTBFData( void );
+void L1T_InitTxPowerControlData( void );
+void L1T_InitTimingAdvanceData( void );
+void L1T_InitNCOData( void );
+void L1T_InitEXTData( void );
+void L1T_InitInterferenceData( void );
+void L1T_InitPAGChData( void );
+void L1T_InitPRAChData( void );
+void L1T_InitDChPowerControlData( void );
+void L1T_InitMeasurementDataIdle( void );
+void L1T_InitMeasurementDataDedi( void );
+void L1T_InitMeasurementDataPacketIdle( void );
+void L1T_InitMeasurementDataPacketTransfer( void );
+void L1T_InitMeasurementsData( void );
+void L1T_InitMACData( void );
+void L1T_InitPollRespData( void );
+void L1T_InitSingleDLData( void );
+void L1T_InitSingleULTwoPhaseData( void );
+void L1T_InitSingleULWithoutTBFData( void );
+void L1T_InitNCReport( void );
+void L1T_Reset( void );
+void L1T_ResetIdleRxChannel( void );
+void L1T_StopAllChannel( void );
+#ifdef __2G_TX_VOLTAGE_COMPENSATION_SUPPORT__
+void L1T_InitTxComp( void );
+#endif
+#ifdef __MTK_TARGET__
+void L1T_InitCrystalThermalChangeNotify( void );
+#endif /* __MTK_TARGET__ */
+#ifdef __GL1_GEMINI__
+void L1T_Suspend( void );
+#endif
+#if defined ( __GL1_GEMINI__ ) && defined ( __UMTS_RAT__ )
+void L1T_ActiveSIMx( void );
+void L1T_DeactivateSIMx( void );
+#endif
+
+#if ( defined( __L1_GPS_AUTO_TIMING_SYNC_SUPPORT__ ) || defined( __L1_GPS_REF_TIME_SUPPORT__ ) )
+void L1T_InitAGpsData( void );
+#endif
+/* --- stop functions --------------------------------------------------------*/
+void L1I_PPChStop( void );
+void L1I_PAGChStop( void );
+void L1I_SingleULTwoPhaseStop( void );
+
+/* --- frame interupt global data ------------------------------------------- */
+
+void L1I_FrameTick(void);
+
+/* --- timer masks for finding timers --------------------------------------- */
+
+/* --- priorities of timers --- */
+#ifdef __GL1_GEMINI__
+#define TIMER_PRIORITY_GEMINI 0x1000
+#endif
+#if (GEMINI_PLUS_GSM >= 3)
+#define TIMER_PRIORITY_SIM3 0x2000
+#endif
+#if (GEMINI_PLUS_GSM >= 4)
+#define TIMER_PRIORITY_SIM4 0x4000
+#endif
+
+#define TIMER_SIM_MASK 0x7000 /*bit[14:12]*/
+#define TIMER_PRIORITY_MASK 0x00FF /*bit[7:0]*/
+
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+//#define TIMER_PRIORITY_DM 0x10000 /*bit[16]*/
+void GL1_AssertFunction( RTB_ASSERT_CAUSE cause, RTB_SIM_INDEX SIM_Index, uint32 para1, uint32 para2 );
+/* The resolution of FRC on MOLY is micro second. */
+#define GL1_FRAME ( 4615 )
+#define GL1_FRAME2RTB( x ) ( (x)*GL1_FRAME )
+#define GL1_EBIT2RTB( x ) ( ((x)*6)/13 )
+#define RTB2GL1_EBIT( x ) ( ((x)*13)/6 )
+
+#endif
+
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+/* L1D confirm frequency correction will be finished within 91 frames for worst case.
+ We add some margin for this value. */
+#define FREQUENCYCORRECTION MAX_FBCORRECTION_SEARCH_TIME
+#else
+#define FREQUENCYCORRECTION 32767
+#endif
+
+#define FIND_SELF_PRIORITY_OFFSET 1
+#define TIMER_PRIORITY_0 0
+#define TIMER_PRIORITY_2 2
+#define TIMER_PRIORITY_3 3
+#define TIMER_PRIORITY_4 4
+#define TIMER_PRIORITY_5 5
+#define TIMER_PRIORITY_6 6
+#define TIMER_PRIORITY_7 7
+#define TIMER_PRIORITY_8 8
+#define TIMER_PRIORITY_9 9
+#define TIMER_PRIORITY_10 10
+#define TIMER_PRIORITY_20 20
+#define TIMER_PRIORITY_30 30
+#define TIMER_PRIORITY_40 40
+#define TIMER_PRIORITY_42 42
+#define TIMER_PRIORITY_45 45
+#define TIMER_PRIORITY_50 50
+#define TIMER_PRIORITY_55 55
+
+/* synchronous receive only */
+#define TIMER_RX_MASK 0x0100 /* bit[8] */
+#define TIMER_PRIORITY_RX_10 ( TIMER_PRIORITY_10 | TIMER_RX_MASK )
+#define TIMER_PRIORITY_RX_20 ( TIMER_PRIORITY_20 | TIMER_RX_MASK )
+#define TIMER_PRIORITY_RX_30 ( TIMER_PRIORITY_30 | TIMER_RX_MASK )
+#define TIMER_PRIORITY_RX_40 ( TIMER_PRIORITY_40 | TIMER_RX_MASK )
+#define TIMER_PRIORITY_RX_50 ( TIMER_PRIORITY_50 | TIMER_RX_MASK )
+
+/* synchronous transmit only */
+#define TIMER_TX_MASK 0x0200 /* bit[9] */
+#define TIMER_PRIORITY_TX_10 ( TIMER_PRIORITY_10 | TIMER_TX_MASK )
+#define TIMER_PRIORITY_TX_20 ( TIMER_PRIORITY_20 | TIMER_TX_MASK )
+#define TIMER_PRIORITY_TX_30 ( TIMER_PRIORITY_30 | TIMER_TX_MASK )
+#define TIMER_PRIORITY_TX_40 ( TIMER_PRIORITY_40 | TIMER_TX_MASK )
+
+/* synchronous receive+transmit or asynchronous */
+#define TIMER_TX_RX_MASK ( TIMER_RX_MASK | TIMER_TX_MASK ) /* bit[9:8] */
+#define TIMER_PRIORITY_TX_RX_0 ( TIMER_PRIORITY_0 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_2 ( TIMER_PRIORITY_2 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_3 ( TIMER_PRIORITY_3 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_4 ( TIMER_PRIORITY_4 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_5 ( TIMER_PRIORITY_5 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_6 ( TIMER_PRIORITY_6 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_7 ( TIMER_PRIORITY_7 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_8 ( TIMER_PRIORITY_8 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_9 ( TIMER_PRIORITY_9 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_10 ( TIMER_PRIORITY_10 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_20 ( TIMER_PRIORITY_20 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_30 ( TIMER_PRIORITY_30 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_40 ( TIMER_PRIORITY_40 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_42 ( TIMER_PRIORITY_42 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_45 ( TIMER_PRIORITY_45 | TIMER_TX_RX_MASK )
+#define TIMER_PRIORITY_TX_RX_55 ( TIMER_PRIORITY_55 | TIMER_TX_RX_MASK )
+
+#define TIMER_TX_RX_PRIORITY_MASK ( TIMER_TX_RX_MASK | TIMER_PRIORITY_MASK ) /* bit[9:0] */
+/* --- finding timers by priority --- */
+
+/* special flag used by PDTCh timer to signal timeslot 0 is not available for BSIC */
+#define TIMER_FLAG_TIMESLOT0_6_MASK 0xC0000 /* bit[18:19] */
+#define TIMER_FLAG_NOBSIC_TIMESLOT0 0x80000 /* bit[19]. marks timers using timeslot 0 */
+#define TIMER_FLAG_BSIC_TIMESLOT6 0x40000 /* bit[18]. marks BSIC timers needing timeslot 6 */
+
+#ifdef __GL1_GEMINI_WCDMA__
+#define TIMER_FLAG_RAISE_PRIORITY_IN_RTB 0x100000 /* bit[20] is used to raise the timer priority in RTB but has the same priority in GL1C. */
+#endif
+
+#ifdef __GL1_GEMINI__
+//#define TIMER_FLAG_FINDNOTIMER 0x20000 /* bit[17]. marks if Pch timer is TOP and find no timer*/
+#endif
+
+/* --- reservation of frames ------------------------------------------------ */
+
+/*
+ Reservation masks are used to determine which slots of the following frames are used.
+ A reservation mask contains 6 bits for each frame and therefore its possible to reserve
+ up to 5 frames using a reservation mask (plus the first timeslots of another frame).
+
+ The bits correspond to the frames as follows:
+
+ 31 24 18 12 6 0
+ | | | | | |
+ 55444444333333222222111111000000
+
+ For each frame, each bit reserves one or two timeslots.
+ The bits in each frame correspond to the timeslots like this:
+
+ bit 0: timeslot 0
+ bit 1: timeslots 1 and 2
+ bit 2: timeslot 3
+ bit 3: timeslots 4 and 5
+ bit 4: timeslot 6
+ bit 5: timeslot 7
+
+ Receives or transmits do need some time to setup the hardware (e.g.PLL).
+ This has to be accounted for in the reservation mask. The convention here is to
+ reserve the next timeslot to lock out others from using it.
+
+ Example: Receive in timeslot 2
+
+ Timeslot | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+ Receive --XXX
+
+ The mask used is 0x06 because
+ receive in timeslot 2 -> bit 1 = 0x02
+ next timeslot -> bit 2 = 0x04
+
+ This mask would excludes a transmit in timeslot 3 (mask 0x0C) because
+ combining both masks with the bitwise OR operator yields a non null result.
+
+ Operations not related to the serving cell must always reserve complete frames
+ (timeslots 0 to 6). These operation change the synchronisation of the mobile
+ and therefore render the whole frame unusable for other operations.
+*/
+
+#define RESERVE_TS0 0x01
+#define RESERVE_TS1 0x02
+#define RESERVE_TS2 0x02
+#define RESERVE_TS3 0x04
+#define RESERVE_TS4 0x08
+#define RESERVE_TS5 0x08
+#define RESERVE_TS6 0x10
+#define RESERVE_TS7 0x20
+
+#define RESERVE_FRAME 0x03F
+
+#define MAKERESERVEMASK(f0,f1,f2,f3) (((f3)<<18)|((f2)<<12)|((f1)<<6)|(f0))
+
+/*
+ Convenient masks for standard receive and transmit
+ The following #defines for the masks already reserve the next timeslot.
+*/
+
+/* reserve the transmit slot for one frame (RACh and PRACh) */
+#define RESERVEMASK_R (RESERVE_TS0|RESERVE_TS1)
+
+/* reserve the transmit slot for one frame (RACh and PRACh) */
+#define RESERVEMASK_T (RESERVE_TS3|RESERVE_TS4)
+
+/* reserve the receive and transmits slots for one frame (SACChT) */
+#define RESERVEMASK_RT (RESERVEMASK_R|RESERVEMASK_T)
+
+/* reserve the receive slot for four frames (BCCh, PCh, AGCh, SDCChDown, SACChCDown, PBCCh, PPCh, PAGCh) */
+#define RESERVEMASK_R4 MAKERESERVEMASK(RESERVEMASK_R,RESERVEMASK_R,RESERVEMASK_R,RESERVEMASK_R)
+
+/* reserve the transmit slot for four frames (SDCChUp, SACChCUp) */
+#define RESERVEMASK_T4 MAKERESERVEMASK(RESERVEMASK_T,RESERVEMASK_T,RESERVEMASK_T,RESERVEMASK_T)
+
+/* reserve the receive and transmit slots for four frames (TCh) */
+#define RESERVEMASK_RT4 MAKERESERVEMASK(RESERVEMASK_RT,RESERVEMASK_RT,RESERVEMASK_RT,RESERVEMASK_RT)
+
+/* reserve four frames completely (NPBCCh) */
+#define RESERVEMASK_RTM4 MAKERESERVEMASK(RESERVE_FRAME,RESERVE_FRAME,RESERVE_FRAME,RESERVE_FRAME)
+
+#ifdef __ADDITIONAL_SERVING_SB_TRACKING__
+#define TACMINIMUM (-116)
+#endif
+#define TAC_MAXIMUM 128 // The maximum timing error of SB is 16 bits.
+
+/* reserve the receive and transmit slots for four frames (TCh), except the shifted SACCHT frame */
+#define RESERVEMASK_RT4_SHIFTED_TCH_EVEN (((RESERVEMASK_RT)<<24)|((RESERVEMASK_RT)<<18)|((RESERVEMASK_RT)<<12)|(RESERVEMASK_RT))
+#define RESERVEMASK_RT4_SHIFTED_TCH_ODD (((RESERVEMASK_RT)<<24)|((RESERVEMASK_RT)<<12)|((RESERVEMASK_RT)<< 6)|(RESERVEMASK_RT))
+#define RESERVEMASK_RT4_SHIFTED_TCH ( IS_ODD(currentDCh->sacchPosition)? RESERVEMASK_RT4_SHIFTED_TCH_ODD : RESERVEMASK_RT4_SHIFTED_TCH_EVEN )
+
+#ifdef __GL1_GEMINI__
+#define PRIORITY_INDEX_LOWEST 65535 //maximum value for uint16, larger priority_index means lower priority
+#endif /* __GL1_GEMINI__ */
+#if TRACING_SUPPORT
+#ifdef __GL1_GEMINI__
+#ifdef L1_SIM
+unsigned char L1I_PrintFN( TraceHeader* h, char** buf );
+unsigned char L1I_PrintFNModN( TraceHeader* h, char** buf, intx n );
+unsigned char L1I_PrintTC( TraceHeader* h, char** buf );
+unsigned char L1I_PrintTC52( TraceHeader* h, char** buf );
+#else
+bool L1I_PrintFN( TraceHeader* h, char** buf );
+bool L1I_PrintFNModN( TraceHeader* h, char** buf, intx n );
+bool L1I_PrintTC( TraceHeader* h, char** buf );
+bool L1I_PrintTC52( TraceHeader* h, char** buf );
+#endif
+#endif
+#endif
+
+/* Power scan related*/
+#if defined(__GL1_GEMINI__) && defined(__GL1_MULTI_MODE__)
+VirtualPowerScanState L1I_QueryVirtualPowerScanState( void );
+//void L1I_VirtualPowerScanRestart(void);
+#endif
+
+#ifdef __GL1_MULTI_MODE__ //#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+void L1I_BackupL1DSuspendPMFlag( bool SuspendPM );
+bool L1I_GetL1DSuspendPMFlag( void );
+#endif
+
+#ifdef __GL1_MULTI_MODE__ //#if defined(__GL1_GEMINI__) && defined(__GL1_MULTI_MODE__)
+void L1I_L1D_SuspendPM( bool SuspendL1DPM );
+#endif
+
+//#if defined(__GL1_MULTI_MODE__) && defined (__GL1_GEMINI__)
+//void L1I_AbortFB( intx reserveFrames, intx frameExtendEBits );
+//#endif
+
+void L1I_UpdateBasebandTime_In_IRATSync( void );
+bool L1I_AbortReserveExtendMasked( int32 mask, intx frameExtendEBits );
+extern l1c_sim_mode_enum L1I_L1D_SIM_mode(void);
+bool L1I_AbortReserveExtend( intx reserveFrames, intx frameExtendEBits );
+void L1I_UpdateTimingParam(intx reserveFrames);
+
+bool L1I_AbortReserveExtendAbortable( intx reserveFrames, intx frameExtendEBits, void ( *abort )( intx busyFrames, intx busyEBits ) );
+intx L1I_GetReservedFrames_2G( void );
+#ifdef __GL1_MULTI_MODE__
+intx L1I_GetReservedFrames_All( void );
+void L1I_GapReserveExtend( intx reserveFrames, intx frameExtendEBits );
+#endif /* __GL1_MULTI_MODE__ */
+void L1I_ClearReservation( void ( *abort )( intx, intx ) );
+void L1I_ClearReservationMasked( int32 mask );
+
+bool L1I_AbortReserveExtend_DM( intx reserveFrames, intx frameExtendEBits, bool *reserved );
+
+#if defined (__GL1_GEMINI__) && defined(__WEIGHTING_ROUND_ROBIN__)
+bool L1I_QueryHwExecute(void);
+void L1I_SetHwExecute(bool);
+#endif
+
+/* --- synchronisation ------------------------------------------------------ */
+
+void L1I_SetSyncFromTimer( int32 frameOffset, intx ebitOffset );
+void L1I_ExtendFrame( intx ebits );
+/* For MT6268 2G/3G or 2G Single project: Change method to call Dual/Single OS Tick I/F in L1I_ExtendFrame() */
+#ifdef __NEW_OS_TICK__
+extern void RTOS_TickFromGsm( uint16 FN_delay, kal_bool need_compensate );
+#endif
+
+/* --- serving cell ARFCN --------------------------------------------------- */
+
+void L1I_SetServingBCChARFCN( ARFCN arfcn, bool interRATHO );
+ARFCN L1I_GetServingBCChARFCN( l1c_sim_mode_enum);
+ARFCN L1T_GetServingBCChARFCN( void );
+#if ( defined( __L1_GPS_AUTO_TIMING_SYNC_SUPPORT__ ) || defined( __L1_GPS_REF_TIME_SUPPORT__ ) )
+void L1I_SetServingBCChBSIC( BSIC bsic );
+#endif
+BSIC L1I_GetServingBCChBSIC( l1c_sim_mode_enum );
+#ifdef __GL1_GEMINI__
+bool L1I_CheckServingBCChARFCN(uint8* mask);
+bool L1I_CheckSameServingARFCN( Report* report, uint8* mask );
+#endif
+
+bool L1I_Query_SetSyncBCChInNullMode(l1c_sim_mode_enum local_sim_mode);
+
+#if defined ( __GL1_MULTI_MODE__ ) && defined ( __GL1_GEMINI__ )
+void L1I_SetServingARFCNforStandby( void );
+void L1I_ResetTimingerrorforStandby( void );
+#endif
+/* --- time inquiry --------------------------------------------------------- */
+#define L1T_BlockFramer() L1T_BLOCKFRAMER(__LINE__)
+void L1T_BLOCKFRAMER( int32 line_no );
+void L1T_UnblockFramer( void );
+
+#ifdef __ADDITIONAL_SERVING_SB_TRACKING__
+void L1_ServingSChStop(void);
+void L1T_ServingSChStop(void);
+void L1I_ServingSChStop( l1c_sim_mode_enum local_sim_mode );
+void L1I_ServingSChThermalReschedule ( l1c_sim_mode_enum local_sim_mode );
+#endif
+
+FrameNumber L1I_GetFN( l1c_sim_mode_enum local_sim_mode);
+FrameNumber L1I_GetFNByTimeSlot( TimeSlot timeSlot );
+FrameNumber L1I_GetNextFN( TimeSlot timeSlot, intx* syncEBits );
+void L1I_GetTime( Time* time, l1c_sim_mode_enum);
+#ifdef __GL1_GEMINI_WCDMA__
+void L1I_GetTimeOffset( Time* time, l1c_sim_mode_enum local_sim_mode);
+#endif /* __GL1_GEMINI_WCDMA__ */
+FrameNumber L1I_GetNextNeighbourFN( int32 frameOffset, intx ebitOffset, intx* syncEBits );
+#if defined (__GL1_GEMINI__) && defined(__BSIC_SEARCH_IN_PEER_IDLE_FRAME__)
+FrameNumber L1I_GetNextFN_Peer( TimeSlot timeSlot, intx* syncEBits, l1c_sim_mode_enum local_sim_mode);
+l1c_sim_mode_enum L1I_GetMainSIM(void);
+#endif /*__GL1_GEMINI__ && __BSIC_SEARCH_IN_PEER_IDLE_FRAME__*/
+#ifdef __GL1_MULTI_MODE__
+Time L1I_GetNeighbourTime( Time servTime, int32 frameOffset, intx ebitOffset );
+#endif
+
+/* For Dual Mode Chips, 2G L1 use "internal" GetTimeStamp, while other module use USC API. */
+TimeStamp L1I_InternalGetTimeStamp( void );
+/* Only used for TST module trace trigger inside 2G L1 */
+TimeStamp L1I_GetTimeStamp( void );
+intx L1I_GetFramesSince( TimeStamp timeStamp );
+
+/* --- timers --------------------------------------------------------------- */
+
+#define L1_TIMER_TYPE(x) x
+typedef enum
+{
+ #include "l1_timertype.h"
+}TimerType;
+#undef L1_TIMER_TYPE
+
+//#ifndef L1_SIM
+#if defined ( __MTK_TARGET__ ) && !defined ( GEN_FOR_PC )
+// This causes custom build error of ul1sim_preproc.c in l1 sim environment.
+typedef struct TimerNode TimerNode;
+#endif /* defined ( __MTK_TARGET__ ) && !defined ( GEN_FOR_PC ) */
+typedef struct Timer Timer;
+
+struct Timer
+{
+ Timer* next;
+ Timer* prev;
+ void ( *code )( Timer* );
+ int32 ebitDelay;
+ intx searchMask; /* used by L1I_FindTimer() */
+ TimerType type;
+ bool started;
+ bool insertInFront; /* if true, timer is inserted before timers with same time */
+#ifdef __GL1_GEMINI__
+ bool unadjustedTimer;
+ uint8 shareBitmap; /* for PCH/BCCH sharing. Record the report need to send to which SIM */
+#ifdef __WEIGHTING_ROUND_ROBIN__
+ bool fgRoundboin;
+#endif
+ uint8 rdrbn_index; /* internal priority, default = 0 */
+// uint8 top_priority_level; /* internal priority, default = 0 */
+ uint16 priority_index; /* internal priority */ // Fiona 07/11/04
+#ifdef __GL1_MULTI_MODE__
+ bool timerRTB; /* True: the timer shall insert to RTB */
+#endif
+ TimerType sharing; /* for PCH/BCCH sharing. */
+ int32 timingError; /* for unadjusted timing error */
+#endif /*__GL1_GEMINI__*/
+};
+
+#define L1C_NUM_TX_POWER_LEVELS 5
+
+typedef struct
+{
+ kal_uint32 tx_mode_time_ebit[L1C_NUM_TX_POWER_LEVELS];
+ kal_uint32 rx_mode_time_ebit;
+ Time getRXinfoTime;
+ bool ignoreRxtime;
+
+
+}txrx_active_info_struct;
+
+extern txrx_active_info_struct gl1_txrx_active_info;
+#define txrx_active_info gl1_txrx_active_info
+
+extern l1c_sim_mode_enum l1t_sim_mode;
+extern l1c_sim_mode_enum l1i_sim_mode;
+#define l1c_sim_mode (kal_if_lisr()? l1i_sim_mode:l1t_sim_mode)
+
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+/* Bit 0: SIM1 2G, Bit 1: SIM1 FDD 3G, Bit 2: SIM1 TDD 3G, Bit 3: SIM1 4G, Bit 4:C2K 1xRTT, Bit 5: C2K EVDO , Bit 6: 5G */
+#define IS_OTHER_RAT_ACTIVE( status ) ( status & 0xFFFEEEE )
+#endif /* defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ ) */
+#define IS_HIGHER_2G_TIMER_EXIST( timer ) ( timer != NULL && timer != (Timer*)-1 )
+
+/* Rick: Cast L1C_MM_SIM_NUM to l1c_sim_mode_enum to fix build warning.
+Remember that L1C_MM_SIM_NUM will never be larger than L1C_SIM_NUM */
+#define IS_MM_SIM_MODE ( l1c_sim_mode < (l1c_sim_mode_enum)L1C_MM_SIM_NUM )
+
+#ifdef __GL1_GEMINI__ // Fiona 07/10/31
+#define RST_WT (0)
+#define BASE_SIM_IDX (15)
+
+/*Round robin type enumeration*/
+typedef enum
+{
+ RDRBN_RXHIGH,
+ RDRBN_RXMID,
+ RDRBN_MID,
+ RDRBN_TOP,
+ RDRBN_LOW,
+ RDRBN_NUM
+} rdrbn_type_enum;
+
+/*Report sharing type enumeration*/
+typedef enum
+{
+ RP_SHARING_INIT,
+ RP_SHARING_PCHNORM = RP_SHARING_INIT,
+ RP_SHARING_PCHEXT,
+ RP_SHARING_BCCNORM,
+ RP_SHARING_BCCEXT,
+ RP_SHARING_NUM
+} report_sharing_type_enum;
+
+/*Roound robin node*/
+typedef struct RdrbnNode RdrbnNode;
+struct RdrbnNode
+{
+ RdrbnNode* next;
+ RdrbnNode* prev;
+ l1c_sim_mode_enum sim_idx;
+#ifdef __WEIGHTING_ROUND_ROBIN__
+ intx weighting;
+#endif
+};
+
+/*Round robin data*/
+typedef struct
+{
+ Timer *currentTimer;
+ TimerType reserved;
+ l1c_sim_mode_enum reservedisSIMx;
+ TimerType highestConflict;
+ RdrbnNode rdrbn_base[RDRBN_NUM];
+ RdrbnNode rdrbn_heap[RDRBN_NUM][L1C_SIM_NUM];
+ /*@param To determine the last sharing timer (ReportSharingCnt=0 => The LAST) */
+ intx ReportSharingCnt[RP_SHARING_NUM];
+ /*@param If one of the sharing timers executes, set true. Otherwise, set false. */
+ bool alignedTimerExecute[RP_SHARING_NUM];
+} geminiTimers;
+
+#endif /* __GL1_GEMINI__*/
+
+
+typedef enum
+{
+ WAKEUP_L1_TASK =0, /* for normal l1 task wakeup */
+ RESUME_SW_WAKEUP, /* for non-blocking sw wakeup */
+ PCORE_UPLINK_DATA /* for p-core uplink data :[MOLY00215713]Integrate L1HISR and PCORE_HISR */
+} L1_HISR_OP_CODE;
+
+extern void L1I_ActivateHISR(L1_HISR_OP_CODE);
+
+/* ------------- timer handling ------------------------------- */
+
+#ifdef __GL1_GEMINI__
+void L1I_InitRoundRobinData( void);
+#endif
+
+#if defined(SM_WAKEUP_COMPENSATION) || defined(IS_2G_TAS_SUPPORT)
+bool L1I_Query_SCMode_Is_Idle(l1c_sim_mode_enum local_sim_mode);
+#endif
+
+#ifdef __ADDITIONAL_SERVING_SB_TRACKING__
+bool L1I_IsTimerServingSBStarted(l1c_sim_mode_enum mode);
+void L1I_ServingSChPeekStart( void );
+bool L1I_IsLowPriorityTimerServingSBThermalStarted(l1c_sim_mode_enum mode);
+bool L1I_IsLowPriorityTimerServingSBStarted(l1c_sim_mode_enum mode);
+void L1I_ServingSChAdditionalStart( void );
+void L1I_ServingSChThermalStart( int32 delayPeriod ); //delay period shall be the multiple of 51 frames
+void L1I_AdjustFrame(Report* report );
+#endif
+
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+extern void L1_ExtendFrame( kal_uint32 ExtendQuantity );
+extern void L1I_Increase2GTime( Time* time );
+extern void L1I_Set2GTime( Time* time );
+extern void L1I_Print2G_FRC( void );
+extern kal_uint32 L1I_2GFRCConversion( kal_int32 ChannelDelay );
+#endif /* defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ ) */
+
+void L1I_InsertForwards( Timer* prev, Timer* timer, int32 ebitDelay );
+void L1I_InsertBackwards( Timer* next, Timer* timer, int32 ebitDelay );
+void L1I_Remove( Timer* timer );
+int32 L1I_FindTimerEBitsAbsolute( intx searchMask, int32 ebitDelayEnd );
+bool L1I_FindTimerTypeEBits( TimerType timerType, int32 ebitDelayEnd, int32 *absoluteDelay );
+bool L1I_FindTimerTypeEBitsSkip( TimerType timerType, int32 skipDelay, int32 ebitDelayEnd, int32 *absoluteDelay );
+Timer* L1I_FindTimerType_ReturnAddress( TimerType timerType, intx frameDelayEnd, intx ebitDelayEnd );
+void L1I_StartTimer( Timer* timer, intx frameDelay, intx ebitDelay );
+void L1I_StartTimerEBits( Timer* timer, int32 ebitDelay );
+void L1I_StartTimerWithinFrame( Timer* timer, int32 ebitDelay );
+/* unused yet
+void L1I_StartTimerRelativeEBits( Timer* reference, Timer* timer, int32 ebitDelay ); */
+void L1I_StopTimer( Timer* timer );
+void L1I_DelayTimerEBits( Timer* timer, int32 ebitDelay );
+
+Timer* L1I_GetNextTimer( void );
+Timer* L1I_FindTimer( intx searchMask, intx frameDelayEnd, intx ebitDelayEnd );
+int32 L1I_FindTimerAbsolute( intx searchMask, intx frameDelayEnd, intx ebitDelayEnd );
+Timer* L1I_FindTimerEBits( intx searchMask, int32 ebitDelayEnd, int32 *absoluteDelay, bool OnlyFindSpecificPriority, bool Only2G );
+Timer* L1I_FindOnlySpecificPriorityTimer( intx searchMask, intx frameDelayEnd, intx ebitDelayEnd );
+int32 L1I_FindTimerDelay( intx searchMask, int32 ebitDelayEnd );
+bool L1I_FindTimerType( TimerType timerType, intx frameDelayEnd, intx ebitDelayEnd );
+Timer* L1I_FindSelfTimerType( TimerType timerType, intx frameDelayEnd, intx ebitDelayEnd);
+Timer* L1I_FindSelfTimerTypeEBits( TimerType timerType, int32 ebitDelayEnd, int32 *absoluteDelay );
+void L1I_AdvanceTimersEBits( int32 ebitDelay );
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+void L1I_CallTimers( void );
+#else
+void L1I_CallTimers( bool beenpostphoned );
+#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+l1c_sim_mode_enum L1I_GetSimModeFromTimer(Timer* timer);
+void L1I_AdjustReserveMask(int32 burstCount);
+void L1I_SetTimerMask(Timer *timer, intx searchMask);
+#ifdef __GL1_GEMINI__ //mtk01431 Dual SIM
+void L1I_SetTimerMask_SimMode( Timer *timer, intx searchMask, l1c_sim_mode_enum local_sim_mode );
+void L1I_SetTimerGeminiMask(Timer *timer);
+void L1I_SetTimerGeminiMask_SimMode(Timer *timer, l1c_sim_mode_enum local_sim_mode );
+void L1I_SwitchRoundRobin(void);
+void L1I_DelayTimer_Gemini( int32 ebitDelay, uint8 mask );
+void L1I_GeminiInsertForwards( Timer* prev, Timer* timer, int32 ebitDelay );
+void L1I_GeminiDelayTimerEBits( Timer* timer, int32 ebitDelay );
+void L1I_AdjustTimingError(Timer* timer, Report* report );
+l1c_sim_mode_enum L1I_QueryAbortSimMode(void);
+void L1I_ResetReportSharing(Timer *timer);
+void L1I_SetReportAligned(Timer *timer, Report *report, TID (*L1I_GetTid)(l1c_sim_mode_enum) );
+void L1I_SetSharingReportAligned(Timer *timer, Report *report, TID (*L1I_GetTid)(l1c_sim_mode_enum) );
+void L1I_SetPChSharingTid(l1c_sim_mode_enum local_sim_mode);
+void L1I_SetBCChSharingTid(l1c_sim_mode_enum local_sim_mode);
+bool L1I_IsShareConflictReport(Timer *timer);
+void L1I_StopReportSharingCnt(Timer* timer);
+bool L1I_TimerIsProtected(Timer *timer);
+extern intx L1I_GetReservedFrames_Gemini(void);
+extern int32 L1I_GetReservationMask(void);
+extern TimerType L1I_GetGeminiReserved(void);
+extern ConflictType L1I_GetConflictType_RTB( RTBConflictType conflictType );
+extern TimerType L1I_GetGeminiHighestConflict(void);
+extern ConflictType L1I_GetConflictType_Gemini( TimerType );
+extern void L1I_PrintConflictType_Gemini( TimerType type, ConflictType c, l1c_sim_mode_enum);
+#endif /*__GL1_GEMINI__*/
+#if defined( __GEMINI__ ) || defined( __IRAT_MEAS_SUPPORT_IN_VIRTUAL_MODE__ )
+uint32 L1I_FindNextSelfTimer( l1c_mm_sim_mode_enum local_sim_mode );
+#endif
+/* --- sending function pointers to interrupt ------------------------------- */
+
+void L1I_QueueFunction( void ( *code )( void ) );
+void L1I_QueueFunction_SimMode( void ( *code )( void ), l1c_sim_mode_enum);
+
+/* --- monitoring ----------------------------------------------------------- */
+
+void L1I_MonitoringStart( void );
+void L1I_MonitoringStop( void );
+void L1I_MonitoringBeginNewPeriod( void );
+Report* L1I_MonitoringLockReport( void );
+void L1I_MonitoringUnlockReport( Report* report );
+
+void L1I_ReportIsMonitored( Report* report );
+void L1I_ReportIsNoLongerMonitored( Report* report );
+
+#define MON_NO_DTX TCH_NODTXD /* if not set, power and quality go to FULL always */
+#define MON_QUAL TCH_BLOCK /* if set, quality is monitored */
+#define MON_QUAL_SUB TCH_QSUB /* if set and TCH_NODTXD is set,
+ quality for normal blocks goes to SUB */
+#define MON_QUAL_FACCH_SUB TCH_QFACCHSUB /* if set and TCH_NODTXD is set,
+ quality for FACCh blocks goes to SUB */
+
+/* For Rel 99 - enhanced mesaurement */
+#define MON_CV_BEP 0x100 /* if set, goes to CV_BEP */
+#define MON_NBR_BLOCKS 0x200 /* if set, goes to NBR_RCVD_BLOCKS */
+#define MON_TCH 0x400 /* if set, means it's TCH, then we have to see if it is fully received and correctly decoded */
+#define MON_SACCH 0x800 /* if set, means it's SACCH */
+#define MON_TCH_SIG 0x1000 /* if set, it's TCHFsig, TCHHsig, */
+
+
+void L1T_MonitorAccumulateEnhanced ( uint8 blkCnt, l1c_sim_mode_enum local_sim_mode);
+
+void L1I_MonitorReport( Report* report, intx flags /* set of MON_xxx flags */, bool isSACCH );
+
+/* --- reporting periods ---------------------------------------------------- */
+
+void L1I_StartReportPeriods( intx durationFrames, intx durationEBits, intx period, TimingAdvance timingAdvance, bool powerControl, bool dtxAllowed );
+void L1I_StopReportPeriods( void );
+
+void L1I_ReportPeriodCommandTA( TimingAdvance timingAdvance );
+TimingAdvance L1I_ReportPeriodGetTA( void );
+
+/* --- GPRS timing advance -------------------------------------------------- */
+
+void L1I_SetOrderedTimingAdvance( TimingAdvance timingAdvance );
+bool L1I_GetTimingAdvance( TimingAdvance* timingAdvance );
+
+/* --- report handling ------------------------------------------------------ */
+
+void L1T_InitReportData( void );
+
+Report* L1I_AllocReport( ReportType type, TID tid, void ( *callback )( Report* ) );
+Report* L1I_AllocRxReport( ReportType type, TID tid, void ( *callback )( Report* ), ARFCN arfcn, bool powerControl );
+Report* L1I_AllocMultislotRxReport( ReportType type, TID tid, void ( *callback )( Report* ), ARFCN arfcn, bool powerControl, intx slotCount );
+
+void L1I_DispatchReports( void );
+void L1I_FreeReport( Report* report );
+void L1I_SendReport( Report* report, void ( *callback )( Report* ) );
+
+Report* L1T_AllocReport( ReportType type, void ( *callback )( Report* ) );
+void L1T_FreeReport( Report* report );
+void L1T_SendReport( Report* report, void ( *callback )( Report* ) );
+#ifdef __GL1_MULTI_MODE__
+bool L1I_CheckPChReport(void);
+#endif
+
+bool L1I_CheckPPChExtend(Report* report);
+
+#ifdef __GL1_GEMINI__
+l1c_sim_mode_enum L1I_GetSimModeFromReport(Report *report);
+#endif
+
+/* --- hopping sequence management ------------------------------------------ */
+
+void L1I_SetHoppingSequencePtr( HoppingSequence** ptr, HoppingSequence* hs );
+void L1T_SetHoppingSequencePtr( HoppingSequence** ptr, HoppingSequence* hs );
+
+/* --- timing adjust -------------------------------------------------------- */
+
+void L1I_ResetTiming( l1c_sim_mode_enum );
+void L1I_ResetTiming_In_Timer( l1c_sim_mode_enum );
+int8 L1I_GetTimingTag( l1c_sim_mode_enum);
+void L1I_AccumulateTiming( Report* report );
+void L1I_L1D_AdjustFrame( intx *adjustFrameEBits );
+#if IS_FAST_TIMING_ADJUST_SUPPORT
+void L1I_FastAdjustTiming( kal_bool AdjustTiming );
+#endif
+#ifdef __GL1_GEMINI__
+intx L1I_QueryTimingErr(Timer *timer);
+void L1I_AdjustFrameWhenTimerExpire(intx extendEbits);
+uint8 L1I_GetSIMConfigBitmap(void);
+intx L1I_GetTimingErr ( l1c_sim_mode_enum local_sim_mode );
+void L1I_SetTimingErr ( l1c_sim_mode_enum local_sim_mode, intx TimingErr );
+#endif
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+void L1I_SetExtendEbits(intx ExtendEBits);
+void L1I_ClearExtendEbits(void);
+#endif
+#if defined( __GL1_GEMINI__) && defined(__BSIC_SEARCH_IN_PEER_IDLE_FRAME__)
+bool L1I_Check_TimerType_Is_Virtual_FCBT_SBT( Timer *timer );
+#endif
+
+/* --- L1C internal reset channels----------------------------------------------*/
+
+void L1_ResetIdleRxChannel( void );
+void L1_AGChStop( void );
+void L1_PChStop( void );
+void L1_CBChStop_Norm( void );
+void L1_CBChStop_Ext( void );
+void L1_NBCChStop( void );
+void L1_BCChStop( void );
+void L1_FCChStop( void );
+void L1T_ResetIdleRxChannelTid( void );
+void L1T_ResetAGChTid( void );
+void L1T_ResetPChTid( void );
+void L1T_ResetCBChNormTid( void );
+void L1T_ResetCBChExtTid( void );
+void L1T_ResetNBCChTid( void );
+void L1T_ResetBCChTid( void );
+void L1T_ResetFCChTid( void );
+
+/* --- SDCCh and TCh handling ----------------------------------------------- */
+typedef struct
+{
+ bool isTCh;
+ TID pendingHSTid;
+ FrequencyBand band;
+ HoppingSequence* pendingHS;
+ intx reportPeriodStart;
+ intx reportPeriodLength;
+ intx sacchPosition; /* position of the SACCh. 0=>12, 1=>25, 2=>38 ... */
+ DChParams params;
+ Timer hsTimer;
+ bool isVamosTSC2; /* true: shifted sacch */
+} Channel;
+
+typedef struct
+{
+ int32 g_l1i_ul_cb;
+ int32 g_l1t_dl_cb;
+} l1c_ptm_global_struct;
+
+typedef struct
+{
+ Channel* g_ptr_currentDCh; /*Orginal currentDch */
+ TID g_dchTID;
+ LoopMode g_setLoopMode;
+ uint8 g_csd_tra_mode;
+ bool g_csd_uplink_dtx_allow;
+ bool g_nt_uplink_in_dtx_mode;
+
+} l1c_dedi_global_struct;
+
+
+#ifdef __GL1_GEMINI__
+#define currentDCh (dediGlobals_database[l1c_sim_mode].g_ptr_currentDCh)
+#define local_currentDCh (dediGlobals_database[local_sim_mode].g_ptr_currentDCh)
+#define dchTID (dediGlobals_database[l1c_sim_mode].g_dchTID)
+#define setLoopMode (dediGlobals_database[l1c_sim_mode].g_setLoopMode)
+#define l1i_ul_cb (ptmGlobals_database[l1c_sim_mode].g_l1i_ul_cb)
+#define local_l1i_ul_cb (ptmGlobals_database[local_sim_mode].g_l1i_ul_cb)
+#define l1t_dl_cb (ptmGlobals_database[l1c_sim_mode].g_l1t_dl_cb)
+#define csd_tra_mode (dediGlobals_database[l1c_sim_mode].g_csd_tra_mode)
+#define local_csd_tra_mode (dediGlobals_database[local_sim_mode].g_csd_tra_mode)
+#define csd_uplink_dtx_allow (dediGlobals_database[l1c_sim_mode].g_csd_uplink_dtx_allow)
+#define local_csd_uplink_dtx_allow (dediGlobals_database[local_sim_mode].g_csd_uplink_dtx_allow)
+#define nt_uplink_in_dtx_mode (dediGlobals_database[l1c_sim_mode].g_nt_uplink_in_dtx_mode)
+#define local_nt_uplink_in_dtx_mode (dediGlobals_database[local_sim_mode].g_nt_uplink_in_dtx_mode)
+ #ifdef __PS_SERVICE__
+extern l1c_ptm_global_struct ptmGlobals_database[L1C_SIM_NUM];
+ #endif
+extern l1c_dedi_global_struct dediGlobals_database[L1C_SIM_NUM];
+extern SNRAverager PSSnr_database[L1C_SIM_NUM];
+#define PS_Snr PSSnr_database[l1c_sim_mode]
+#else /*__GL1_GEMINI__*/
+#define currentDCh (dediGlobals.g_ptr_currentDCh)
+#define dchTID (dediGlobals.g_dchTID)
+#define setLoopMode (dediGlobals.g_setLoopMode)
+#define l1i_ul_cb (ptmGlobals.g_l1i_ul_cb)
+#define l1t_dl_cb (ptmGlobals.g_l1t_dl_cb)
+#define csd_tra_mode (dediGlobals.g_csd_tra_mode)
+#define csd_uplink_dtx_allow (dediGlobals.g_csd_uplink_dtx_allow)
+#define nt_uplink_in_dtx_mode (dediGlobals.g_nt_uplink_in_dtx_mode)
+ #ifdef __PS_SERVICE__
+extern l1c_ptm_global_struct ptmGlobals;
+ #endif
+extern l1c_dedi_global_struct dediGlobals;
+extern SNRAverager PS_Snr;
+#define local_currentDCh (currentDCh)
+#define local_l1i_ul_cb (l1i_ul_cb)
+#define local_csd_tra_mode (csd_tra_mode)
+#define local_csd_uplink_dtx_allow (csd_uplink_dtx_allow)
+#define local_nt_uplink_in_dtx_mode (nt_uplink_in_dtx_mode)
+#endif /*__GL1_GEMINI__*/
+//extern l1c_sim_mode_enum l1c_sim_mode; // global variable
+
+void L1I_StartSDCCh( void );
+void L1I_StopSDCCh( void );
+void L1I_StopSACCHT( void );
+void L1I_StartTCh( void );
+void L1I_StopTCh( void );
+void L1I_AdjustTChTimer( void );
+void L1I_StartTChAB( void );
+void L1I_StartSDCChAB( void );
+
+void L1I_ReportSACCh( Report* report );
+
+void L1I_TChSetChannelMode( void );
+void L1I_StartSetChannelModeTimer( void );
+void L1I_SetChannelMode( void );
+
+void L1T_DChStopHandoverUpdateTA( void );
+void L1I_TChSetSmallHs(bool smallHS);
+void L1I_PChStop( void );
+bool L1I_CheckPChExtend(Report* report);
+intx L1I_Get_PagingPeriod(void);
+bool L1I_Get_ExtendedPaging(void);
+#ifdef __PS_SERVICE__
+#if IS_2G_TAS_SUPPORT || IS_2G_RXD_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+int8 L1T_GetPDTChTid( void );
+int8 L1T_GetPACChTid( void );
+int8 L1T_GetPTCChTid( void );
+#endif /*IS_2G_TAS_SUPPORT || IS_2G_RXD_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )*/
+#ifdef __GERAN_R5__
+intx L1I_Get_SplitPagingCycle(void);
+#endif
+#endif
+#ifdef __GL1_GEMINI__
+intx L1I_QueryPchPriority(void);
+bool L1I_IsSBTMachineStarted( void );
+#endif /*__GL1_GEMINI__*/
+
+#if defined (__GL1_GEMINI__) || defined (__ADDITIONAL_SERVING_SB_TRACKING__)
+bool L1I_IsSBMachineStarted( void );
+#endif
+void L1I_BCChStop( void );
+void L1I_FCChTStop( void );
+void L1I_SChTStop( void );
+
+#ifdef __GL1_GEMINI__
+void L1I_Immediate_FCChTRestart(l1c_sim_mode_enum sim_idx);
+bool L1I_CheckFCChTStarted(l1c_sim_mode_enum );
+bool L1I_CheckProtectedFCChTStarted( l1c_sim_mode_enum );
+#ifdef __GL1_MULTI_MODE__
+kal_bool L1I_QueryFCChStarted( void );
+int32 L1I_QueryFCChTReserveMask( void );
+int32 L1I_QuerySChTReserveMask( void );
+void L1I_FCChWinOffReStart( l1c_sim_mode_enum local_sim_mode, int32 ebitDelay );
+void L1I_TimerGAPSuspendReStart( l1c_sim_mode_enum local_sim_mode, int32 ebitDelay );
+void L1I_TimerGAPStopReStart( l1c_sim_mode_enum local_sim_mode, int32 ebitDelay );
+void L1I_TimerGSMAutoGAPStopReStart( l1c_sim_mode_enum local_sim_mode, int32 ebitDelay );
+#endif
+#endif /*__GL1_GEMINI__*/
+
+void L1C_SIM_Notify( uint8 status );
+
+#ifdef __BLIND_HANDOVER__
+BlindHO_Phase L1T_QueryBlindHOPhase( void );
+#endif
+
+#define IS_EVEN(n) ( ((n)&1) == 0 )
+#define IS_ODD(n) ( ((n)&1) != 0 )
+#define SHIFTED_SACCH_OFFSET ( (currentDCh->isVamosTSC2)? ( IS_ODD(currentDCh->sacchPosition)? (-1):1 ) : 0 )
+//#define SHIFTED_SACCH_OFFSET_CH(ch) ( (ch->isVamosTSC2)? ( IS_ODD(ch->sacchPosition)? (-1):1 ) : 0 )
+#define IS_TCH_SHIFTED ( (currentDCh->isVamosTSC2) && ( IS_EVEN(currentDCh->sacchPosition) ) ) /* only VAMOS TSC2 && even sacch position will shift tch position */
+#define L1_FrameNumberModX_TCh( fn ) ( IS_TCH_SHIFTED? L1_FrameNumberMod26(fn) : L1_FrameNumberMod13(fn) )
+#define L1_FrameNumberModX_SHIFTED(fn) ( currentDCh->isVamosTSC2? L1_FrameNumberMod26( fn ) : L1_FrameNumberMod13( fn ) )
+#define IS_SHIFTED_TCH_BLOCK(fn26) ( currentDCh->isVamosTSC2 && ( ( IS_EVEN(currentDCh->sacchPosition) && fn26 == 12 ) || ( IS_ODD(currentDCh->sacchPosition) && fn26 == 21 ) ) )
+#define IS_CHMODE_VAMOS(mode) ( TChModeFS_VAMOS <= mode && mode <= TChModeAFS_WB_VAMOS )
+#define IS_CHMODE_FS_AMR(mode) ( mode == TChModeAFS || mode == TChModeAFS_WB || mode == TChModeAFS_VAMOS || mode == TChModeAFS_WB_VAMOS )
+#define IS_CHMODE_HS_AMR(mode) ( mode == TChModeAHS || mode == TChModeAHS_VAMOS )
+#define IS_CHMODE_HS(mode) ( mode == TChModeHS || mode == TChModeAHS || mode == TChModeHS_VAMOS || mode == TChModeAHS_VAMOS)
+#define IS_CHMODE_AMR(mode) ( ( TChModeAFS <= mode && mode <= TChModeAFS_WB ) || ( TChModeAFS_VAMOS <= mode && mode <= TChModeAFS_WB_VAMOS ) )
+#define IS_CHMODE_FS_AMR_WB(mode) ( mode == TChModeAFS_WB || mode == TChModeAFS_WB_VAMOS )
+
+/* --- PTCCh ---------------------------------------------------------------- */
+#if defined(__EGPRS_MODE__) && defined(__GERAN_RTTI__)
+void L1I_PTCChSetParams( HoppingSequence* hs, BSIC bsic, TSC tsc, TimeSlot dlTimeSlot, TimeSlot ulTimeSlot, SubChannel subChannel, intx burstLength );
+#else
+void L1I_PTCChSetParams( HoppingSequence* hs, BSIC bsic, TSC tsc, TimeSlot timeSlot, SubChannel subChannel, intx burstLength );
+#endif /* end of __EGPRS_MODE__ && __GERAN_RTTI__ */
+void L1I_PTCChSetSyncTimeSlot( TimeSlot syncTimeSlot );
+void L1I_PTCChStart( void );
+void L1I_PTCChStop( void );
+
+/* --- PDTCh handling ------------------------------------------------------- */
+
+#ifdef __NEW_TBF_ARCH__
+#if defined(__EGPRS_MODE__) && defined(__GERAN_RTTI__)
+void L1I_PDTChStart( TBFCommonParams* commonParams, PdtchConfigMode pdtchCfgMod );
+void L1I_PDTChRestart( TBFCommonParams* commonParams, PdtchConfigMode old_pdtchCfgMod, PdtchConfigMode new_pdtchCfgMod );
+#else
+void L1I_PDTChStart( TBFCommonParams* commonParams );
+void L1I_PDTChRestart( TBFCommonParams* commonParams );
+#endif /* end of __EGPRS_MODE__ && __GERAN_RTTI__ */
+#else /* __NEW_TBF_ARCH__ */
+void L1I_PDTChStart( TBFParams* params );
+void L1I_PDTChRestart( TBFParams* params );
+#endif /* __NEW_TBF_ARCH__ */
+void L1I_PDTChStop( uint8 stopTid );
+#if defined(__EGPRS_MODE__) && defined(__GERAN_RTTI__)
+void L1I_PDTChUpdateTimerMask( PdtchConfigMode pdtchCfgMod );
+#else
+void L1I_PDTChUpdateTimerMask( void );
+#endif /* end of __EGPRS_MODE__ && __GERAN_RTTI__ */
+bool L1I_PDTChCheckNoRRBP( int32 ebitDelay, mpal_gl1_query_priority_enum query_type );
+bool L1I_PDTChCheckRestart( void );
+
+#ifdef __NEW_TBF_ARCH__
+#ifdef __EGPRS_MODE__
+void L1T_DnPDTChStop( uint8 toStopDnPdtch );
+void L1T_PDTCHSetResetIR( int8 index );
+void L1I_PDTCHSetIRParams( MACDownlinkParams* macDownParams, int8 index );
+
+#ifdef __GERAN_RTTI__
+uint8 L1I_SlotTransferRxToTx( int8 tbfIdx, intx rxTimeSlot, PdtchConfigMode *pdtchCfgMod, UsfMode *usfMode, uint8 *lowTS );
+void L1I_MACSetPdtchMode( PdtchConfigMode pdtchCfgMode );
+void L1I_MACBlockPreTick( TimeSlot minTxTimeSlot );
+#endif /* end of __GERAN_RTTI__ */
+#endif /*__EGPRS_MODE__*/
+void L1I_GetDnTBFTid( uint8 reportTBFTid[8] );
+TimeSlot L1I_PeekTBFSyncTimeSlot( void );
+uint8 L1I_QueryTBFActiveStatus( bool isDownLink );
+
+#else /* __NEW_TBF_ARCH__ */
+#ifdef __EGPRS_MODE__
+void L1T_DnPDTChStop( void );
+void L1T_PDTCHSetResetIR( bool );
+#endif /*__EGPRS_MODE__*/
+
+uint8 L1I_GetDnTBFTid( void );
+
+#endif /* __NEW_TBF_ARCH__ */
+
+#if defined(__EGPRS_MODE__) && defined(__GERAN_RTTI__)
+uint8 L1_SlotTransferRxToTx( int8 tbfIdx, intx rxTimeSlot, PdtchConfigMode *pdtchCfgMod );
+#endif /* end of __EGPRS_MODE__ && __GERAN_RTTI__ */
+
+void L1T_ReportPDTChDebugCtrlBlock( int8 msgType, BlockData* data, int8 rrbp, int8 DD, int8 tfi );
+
+/* --- power control on the DCh and RACH ------------------------------------ */
+
+Power L1I_GetCurrentTxPower( void );
+Power L1I_DChPowerControlStart( FrequencyBand band, PowerControlLevel txPower );
+void L1I_DChPowerControlStop( void );
+void L1I_DChPowerControlCommandPower( PowerControlLevel txPower );
+void L1I_DChPowerControlBeginSACChPeriod( void );
+void L1I_DChPowerControlUpdateUsedPower( intx frames );
+void L1T_RAChSetMaxTxPower(Power power);
+
+/* --- updating DCh every report period ------------------------------------- */
+
+void L1I_DChReportingPeriod( bool powerControl, bool dtxAllowed );
+
+void L1I_SetReportedPower( PowerControlLevel power );
+void L1I_SetReportedTimingAdvance( TimingAdvance timingAdvance );
+void L1I_SetUplinkMode( TChMode mode , LogChannel log );
+
+/* --- decoding of GSM blocks ----------------------------------------------- */
+
+void L1_DecodeSCh( BlockData* data, BSIC* bsic, FrameNumber* frame );
+bool L1_ExtractPageMode( BlockData* data, intx* mode );
+bool L1_ExtractPPChPageMode( BlockData* data, intx* mode );
+
+/* --- tool ----------------------------------------------------------------- */
+
+intx L1_CountBits8( uint8 mask );
+
+intx L1_GetLSB( uint32 mask );
+intx L1_GetMSB( uint32 mask );
+intx L1_GetNextEnabledBlock( intx startBlock, uint32 mask );
+intx L1_GetReservationMaskDuration( int32 mask );
+
+intx L1_CalcDelay( FrameNumber fn, intx pos, intx period );
+
+intx L1_CalcDelayMasked( FrameNumber fn, intx blockPos, intx blockSpacing, uint32 mask, intx maskSize, intx* blockNo );
+intx L1_CalcNextBlockMasked( intx* blockNo, intx blockSpacing, uint32 mask, intx maskSize );
+uint32 Slow_Clk_32bits_Register_Read( void );
+/* TODO these two are obsolete and should be replaced by their implementation */
+intx L1_CalcBCChDelay( FrameNumber fn, intx fn51, intx mask, intx* ptc );
+intx L1_CalcNBCChDelay( FrameNumber fn, intx mask, intx* ptc );
+
+intx L1_CalcNextBCChBlock( intx tc, intx mask, intx* ptc );
+
+void L1_ClearScanListPower( ScanList* scanList );
+void L1_NormalisePreProcess( Power *power, intx cnt, bool enabledownscale );
+void L1_NormalisePreProcessSC( PowerSum32 *power, intx cnt, bool enabledownscale );
+void L1_NormaliseScanListPower( ScanList* scanList, bool downscale );
+
+#ifdef __GERAN_R6__
+void L1T_SetLBpowerLevelStatus(bool SIwithLBpowerLevel);
+#endif /*__GERAN_R6__ */
+Power L1_ConvertPowerControlLevelTodBm( FrequencyBand band, PowerControlLevel txPower );
+PowerControlLevel L1_ConvertdBmToPowerControlLevel( FrequencyBand band, Power power, PowerControlLevel commandedPCL );
+
+void L1_PrepareSChData( SChData* p );
+
+Power L1T_CalcBlockPower( RxData* rx );
+intx L1_CalcPDChBlockPower( Report* report, intx slot, bool usePb );
+
+void L1I_LowSignalCompensate(Power* antenna);
+
+/* --- frame interrupt ------------------------------------------------------ */
+
+void L1T_FrameInterruptInit( void );
+void L1T_FrameInterruptExit( void );
+void L1I_FrameInterrupt( kal_uint32 irq_id );
+
+void L1I_WakeTaskRequested(l1c_sim_mode_enum);
+#if !(IS_DUAL_CORE_GL1AC_MODEM_SUPPORT)
+void L1I_SetPostponeTimer( void );
+#endif
+/* --- AGC ------------------------------------------------------------------ */
+
+void L1T_AGCInit( void );
+
+void L1I_AGCSetServingBCChARFCN( ARFCN arfcn );
+void L1I_AGCSetPb( intx pb );
+void L1I_AGCSetPTCCh( bool pbcchExists );
+
+void L1I_AGCSetupServingBCCh( Report* report );
+void L1I_AGCSetupBCCh( Report* report, AGCCellData* cell );
+void L1I_AGCSetupDediNoDTX( Report* report, FrequencyBand band, TimeSlot syncTimeSlot );
+void L1I_AGCSetupDediDTX( Report* report, FrequencyBand band, TimeSlot syncTimeSlot );
+void L1I_AGCSetupDediNoDTX_SmallHS( Report* report, FrequencyBand band, TimeSlot syncTimeSlot );
+void L1I_AGCSetupDediDTX_SmallHS( Report* report, FrequencyBand band, TimeSlot syncTimeSlot );
+void L1I_AGCSetupServingPBCCh( Report* report, FrequencyBand band );
+void L1I_AGCSetupNeighbourPBCCh( Report* report, AGCCellData* cell, FrequencyBand band );
+void L1I_AGCSetupInterference( Report* report, FrequencyBand band );
+void L1I_AGCSetupPDTCh( Report* report, AGCDataPDTCh* pdtch, FrequencyBand band, TimeSlot syncTimeSlot );
+void L1I_AGCSetupPTCCh( Report* report, FrequencyBand band );
+void L1I_AfterBlockPDTChPowerControl( Report* report );
+void L1I_SetAGCHighSetpoint(void);
+void L1I_SetAGCLowSetpoint(void);
+void L1I_RAS_UpdateMode(bool needChange);
+
+
+/* --- AFC ------------------------------------------------------------------ */
+void L1T_AFCInit( uint8 simIndex );
+void L1I_AFCClearParams( AfcParams* afc );
+void L1I_AFCHandoverSuspend( uint8 simIndex );
+void L1I_AFCEnableSlowTrack( uint8 simIndex );
+void L1I_AFCDisableSlowTrack( uint8 simIndex );
+
+extern int32 AFCTrackingCountDown; //Used for AFC tracking thermal issue
+
+/* --- calculating receive power level C ------------------------------------ */
+
+void L1I_UpdateCFromPCh( Report* report, intx slot, intx ndrx );
+void L1I_UpdateCFromPPCh( Report* report, intx slot, intx ndrx );
+void L1I_UpdateCFromBCCh( Power power, l1c_sim_mode_enum);
+void L1I_UpdateCFromPDTCh( Report* report );
+void L1I_SetTimeSlotC( intx slotToUse );
+void L1I_CResetCounter( Power power );
+intx L1I_GetC(l1c_sim_mode_enum);
+#ifdef __GERAN_R5__
+void L1I_UpdateCFromAGCh( Report* report, intx slot, intx ndrx );
+void L1I_UpdateCFromPAGCh( Report* report, intx slot, intx ndrx );
+#endif
+
+/* --- GPRS transmit power control ------------------------------------------ */
+
+void L1I_PowerControlSetParams( FrequencyBand band, uint8 alpha, uint8 gamma[8] );
+void L1I_PowerControlClearParams( void );
+void L1I_PowerControlSetC( intx c, l1c_sim_mode_enum local_sim_mode);
+Power* L1I_PowerControlGetTxPower( void );
+void L1I_PowerControlSetMaximumOutputPower( Power pmax );
+Power L1I_PowerControlGetMaximumOutputPower( void );
+#ifdef __EPSK_TX__
+Power* L1I_PowerControlGetTxPowerEPSK( void );
+void L1I_PowerControlSetMaximumOutputPowerEPSK( Power pmaxEPSK );
+#endif
+
+/* --- surround cell handling ----------------------------------------------- */
+
+void L1T_SurroundInit( void );
+void L1T_SurroundExit( void );
+
+AfcParams* L1T_SurroundGetAfcData( ARFCN arfcn );
+kal_int16 L1T_SurroundGetDACData( ARFCN arfcn );
+void L1T_SurroundAssignAfcFromManual( ARFCN arfcn );
+SurroundBS* L1T_SurroundGetBSByARFCN( ARFCN arfcn );
+extern SurroundMode L1I_Query_SCMode(l1c_sim_mode_enum);
+#ifdef __GL1_MULTI_MODE__
+bool L1I_IsAnySIMinStandbyMode( void );
+#endif /* __GL1_MULTI_MODE__ */
+
+#ifdef __GL1_MULTI_MODE__
+void Updatel1machTimeslot(TimeSlotMask *timeSlotsUp, TimeSlotMask *timeSlotsDown);
+#endif
+/* --- power measurements - session management ------------------------------ */
+#ifdef __GL1_GEMINI__
+ #if (GEMINI_PLUS_GSM >= 4)
+typedef enum
+{
+ MeasurementPriorityBCCh, /* highest priority */
+ MeasurementPriorityBCCh_2, /* highest priority */
+ MeasurementPriorityBCCh_3,
+ MeasurementPriorityBCCh_4,
+ MeasurementPriorityExtHigh,
+ MeasurementPriorityExtHigh_2,
+ MeasurementPriorityExtHigh_3,
+ MeasurementPriorityExtHigh_4,
+#ifdef __GL1_GEMINI__
+ MeasurementPriorityVirtualScan,
+ MeasurementPriorityVirtualScan_2,
+ MeasurementPriorityVirtualScan_3,
+ MeasurementPriorityVirtualScan_4,
+#endif /*__GL1_GEMINI__*/
+ MeasurementPriorityDEDICATESurround,
+ MeasurementPriorityDEDICATESurround_2,
+ MeasurementPriorityDEDICATESurround_3,
+ MeasurementPriorityDEDICATESurround_4,
+ MeasurementPriorityIDLESurround,
+ MeasurementPriorityIDLESurround_2,
+ MeasurementPriorityIDLESurround_3,
+ MeasurementPriorityIDLESurround_4,
+#ifdef __PKT_EXT_MEAS__
+ MeasurementPriorityExtLow,
+ MeasurementPriorityExtLow_2,
+ MeasurementPriorityExtLow_3,
+ MeasurementPriorityExtLow_4,
+#endif
+ MeasurementPriorityScan, /* lowest priority */
+ MeasurementPriorityScan_2, /* lowest priority */
+ MeasurementPriorityScan_3,
+ MeasurementPriorityScan_4,
+#ifdef __GL1_MULTI_MODE__
+ MeasurementPriorityScanCGI,
+ MeasurementPriorityScanCGI_2,
+ MeasurementPriorityScanCGI_3,
+ MeasurementPriorityScanCGI_4,
+ MeasurementPriorityStandbyRSSI,
+ MeasurementPriorityStandbyRSSI_2,
+ MeasurementPriorityStandbyRSSI_3,
+ MeasurementPriorityStandbyRSSI_4,
+#ifdef __GERAN_R8__
+ MeasurementPriorityStandbyPRIORSSI,
+ MeasurementPriorityStandbyPRIORSSI_2,
+ MeasurementPriorityStandbyPRIORSSI_3,
+ MeasurementPriorityStandbyPRIORSSI_4,
+#endif
+#ifdef __GL1_GEMINI_WCDMA__
+ MeasurementPriorityStandbyPLMN,
+ MeasurementPriorityStandbyPLMN_2,
+ MeasurementPriorityStandbyPLMN_3,
+ MeasurementPriorityStandbyPLMN_4,
+#endif
+#endif
+ MeasurementPriorityCount /* end marker */
+} MeasurementPriority;
+ #elif (GEMINI_PLUS_GSM >= 3)
+typedef enum
+{
+ MeasurementPriorityBCCh, /* highest priority */
+ MeasurementPriorityBCCh_2, /* highest priority */
+ MeasurementPriorityBCCh_3,
+ MeasurementPriorityExtHigh,
+ MeasurementPriorityExtHigh_2,
+ MeasurementPriorityExtHigh_3,
+#ifdef __GL1_GEMINI__
+ MeasurementPriorityVirtualScan,
+ MeasurementPriorityVirtualScan_2,
+ MeasurementPriorityVirtualScan_3,
+#endif /*__GL1_GEMINI__*/
+ MeasurementPriorityDEDICATESurround,
+ MeasurementPriorityDEDICATESurround_2,
+ MeasurementPriorityDEDICATESurround_3,
+ MeasurementPriorityIDLESurround,
+ MeasurementPriorityIDLESurround_2,
+ MeasurementPriorityIDLESurround_3,
+#ifdef __PKT_EXT_MEAS__
+ MeasurementPriorityExtLow,
+ MeasurementPriorityExtLow_2,
+ MeasurementPriorityExtLow_3,
+#endif
+ MeasurementPriorityScan, /* lowest priority */
+ MeasurementPriorityScan_2, /* lowest priority */
+ MeasurementPriorityScan_3,
+#ifdef __GL1_MULTI_MODE__
+ MeasurementPriorityScanCGI,
+ MeasurementPriorityScanCGI_2,
+ MeasurementPriorityScanCGI_3,
+ MeasurementPriorityStandbyRSSI,
+ MeasurementPriorityStandbyRSSI_2,
+ MeasurementPriorityStandbyRSSI_3,
+#ifdef __GERAN_R8__
+ MeasurementPriorityStandbyPRIORSSI,
+ MeasurementPriorityStandbyPRIORSSI_2,
+ MeasurementPriorityStandbyPRIORSSI_3,
+#endif
+#ifdef __GL1_GEMINI_WCDMA__
+ MeasurementPriorityStandbyPLMN,
+ MeasurementPriorityStandbyPLMN_2,
+ MeasurementPriorityStandbyPLMN_3,
+#endif
+
+#endif
+ MeasurementPriorityCount /* end marker */
+} MeasurementPriority;
+ #else /*GEMINI_PLUS_GSM = 2*/
+typedef enum
+{
+ MeasurementPriorityBCCh, /* highest priority */
+ MeasurementPriorityBCCh_2, /* highest priority */
+ MeasurementPriorityExtHigh,
+ MeasurementPriorityExtHigh_2,
+#ifdef __GL1_GEMINI__
+ MeasurementPriorityVirtualScan,
+ MeasurementPriorityVirtualScan_2,
+#endif /*__GL1_GEMINI__*/
+ MeasurementPriorityDEDICATESurround,
+ MeasurementPriorityDEDICATESurround_2,
+ MeasurementPriorityIDLESurround,
+ MeasurementPriorityIDLESurround_2,
+#ifdef __PKT_EXT_MEAS__
+ MeasurementPriorityExtLow,
+ MeasurementPriorityExtLow_2,
+#endif /*__PKT_EXT_MEAS__*/
+ MeasurementPriorityScan, /* lowest priority */
+ MeasurementPriorityScan_2, /* lowest priority */
+#ifdef __GL1_MULTI_MODE__
+ MeasurementPriorityScanCGI,
+ MeasurementPriorityScanCGI_2,
+ MeasurementPriorityStandbyRSSI,
+ MeasurementPriorityStandbyRSSI_2,
+#ifdef __GERAN_R8__
+ MeasurementPriorityStandbyPRIORSSI,
+ MeasurementPriorityStandbyPRIORSSI_2,
+#endif
+#ifdef __GL1_GEMINI_WCDMA__
+ MeasurementPriorityStandbyPLMN,
+ MeasurementPriorityStandbyPLMN_2,
+#endif
+#endif
+ MeasurementPriorityCount /* end marker */
+} MeasurementPriority;
+ #endif /*ENDIF of GEMINI_PLUS_GSM*/
+#else /*__GL1_GEMINI__*/
+typedef enum
+{
+ MeasurementPriorityBCCh, /* highest priority */
+ MeasurementPriorityExtHigh,
+ MeasurementPriorityDEDICATESurround,
+ MeasurementPriorityIDLESurround,
+#ifdef __PKT_EXT_MEAS__
+ MeasurementPriorityExtLow,
+#endif
+ MeasurementPriorityScan, /* lowest priority */
+#ifdef __GL1_MULTI_MODE__
+ MeasurementPriorityScanCGI,
+ MeasurementPriorityStandbyRSSI,
+#ifdef __GERAN_R8__
+ MeasurementPriorityStandbyPRIORSSI,
+#endif /*__GERAN_R8__*/
+#ifdef __GL1_GEMINI_WCDMA__
+ MeasurementPriorityStandbyPLMN,
+#endif
+#endif /*__GL1_MULTI_MODE__*/
+ MeasurementPriorityCount /* end marker */
+} MeasurementPriority;
+#endif /*__GL1_GEMINI__*/
+
+//if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+#ifdef __GL1_MULTI_MODE__
+typedef enum
+{
+ PMIdle,
+ PMPTM
+}PMTypes;
+
+typedef enum
+{
+ GAP2G,
+ PowerScan,
+ BA,
+ PowerScanCGI,
+ Dedi2G
+}SuspendTypes;
+
+typedef enum
+{
+ NoPM,
+ OnePMBypass,
+ AllPM
+}PMReturnTypes;
+
+PMReturnTypes L1I_IsPMAvailable( void );
+void L1I_CentralizedSuspendPM( void );
+void L1I_CentralizedMeasurementsDoSession( intx priority, intx count, SuspendTypes suspend_type, intx frameDelay, intx ebitDelay, l1c_sim_mode_enum local_sim_mode );
+//void L1I_StartCentralizedSuspendTimerforBA( intx frameDelay, intx ebitDelay );
+void L1I_SetSuspendPMBitmapforGAP( uint8 index, bool suspend, l1c_sim_mode_enum sim_index );
+void L1I_SetSuspendPMBitmapforPowerScan ( uint8 index, bool suspend, l1c_sim_mode_enum sim_index );
+void L1I_SetSuspendPMBitmapforBA( uint8 index, bool suspend, l1c_sim_mode_enum sim_index );
+void L1I_SetSuspendPMBitmapforPowerScanCGI( uint8 index, bool suspend, l1c_sim_mode_enum sim_index );
+//void L1I_SetSuspendPMBitmapforDedi2G( uint8 index, bool suspend );
+void L1I_TimerSuspendPMforGAP( Timer* timer );
+void L1I_TimerSuspendPMforPowerScan( Timer* timer );
+void L1I_TimerSuspendPMforBA( Timer* timer );
+void L1I_TimerSuspendPMforPowerScanCGI( Timer* timer );
+//void L1I_TimerSuspendPMforDedi2G( Timer* timer );
+void L1I_ResetSuspendPMBitmap( uint8 index );
+bool L1I_IsTimerSuspendPMforGAPStarted( void );
+void L1I_SuspendPMforBA( void );
+void L1I_StopTimerSuspendPMforGAP( void );
+uint8 L1I_QueryMeasurementsRunIndex( intx priority );
+#endif
+void L1I_MeasurementsStart( Measurements* meas, intx priority );
+void L1I_MeasurementsStop( intx priority , bool ignore_when_changed_mode);
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+//void L1I_MeasurementsStopAll( void );
+#endif
+#ifdef __GL1_MULTI_MODE__
+void L1I_MeasurementsSuspendStandby( intx priority );
+void L1I_MeasurementsSuspendAll( void );
+void L1I_MeasurementsSuspend( intx priority );
+bool L1I_MeasurementsisCompleted( void );
+bool L1I_MeasurementsisActive( intx priority );
+bool L1I_MeasurementsisCompletedStandby( void );
+#endif
+void L1I_MeasurementsDoSession( intx priority, intx count );
+void L1I_MeasurementsDoFinalSession( intx priority, intx count );
+
+void L1I_MeasurementsStartScanListMeasurements( Report* report, ScanList* list, intx passes, intx priority );
+
+void L1I_MeasurementsProcessResults( void );
+
+void L1TST_PowerScanIQOffset( PMResult *pmResult );
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+void L1I_SurroundMeasurement ( intx ExtendEBits );
+void L1I_SurroundMeasurementConsume( void );
+void L1I_SetSurroundMeasurement ( PMTypes type, bool start, l1c_sim_mode_enum sim_index );
+#endif
+/* --- BCCh power measurements ---------------------------------------------- */
+
+/* TODO this could be derived from the paging blocks */
+/*
+void L1T_BCChMeasurementStartIdle( ARFCN arfcn, intx pagingPeriod );
+void L1T_BCChMeasurementStopIdle( void );
+*/
+
+void L1I_BCChMeasurementStartPacketTransfer( ARFCN arfcn );
+void L1I_BCChMeasurementStopPacketTransfer( void );
+
+/* --- surround cell power measurements ------------------------------------- */
+
+void L1T_SurroundMeasurementStartIdle( ScanList* list );
+void L1T_SurroundMeasurementStopIdle( void );
+
+#if defined( __GL1_MULTI_MODE__ ) && defined( __GERAN_R8__ )
+extern l1c_sim_mode_enum l1c_sim_prio_ba_offset;
+//Gap_service_2G_enum L1T_SetGAPServiceGSM( kal_bool isAll ); /* gapservice will be decided by L1A */
+void L1I_SurroundMeasurementStopHPSearchStandby(void);
+#endif /* __GL1_MULTI_MODE__ && __GERAN_R8__ */
+
+#ifdef __GL1_MULTI_MODE__
+#ifdef __GERAN_R8__
+void L1T_SurroundMeasurementStopStandby( kal_bool is_higher_priority );
+//#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+#if 1
+void L1I_SurroundMeasurementPagingBlockHPSearchStandby( kal_uint16 pm_session_num, intx frameDelay, intx ebitDelay );
+#else
+/* under construction !*/
+#endif
+#else
+void L1T_SurroundMeasurementStopStandby( void );
+#endif /* __GERAN_R8__ */
+void L1I_SurroundMeasurementStopStandby( void );
+void L1T_SurroundMeasurementStartStandby( ScanList* list );
+void L1I_SurroundMeasurementStartStandby( ScanList* list );
+void L1T_SurroundEnterStandby( void );
+void L1T_SurroundLeaveStandby( void );
+//#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+#if 1
+void L1I_SurroundMeasurementPagingBlockStandby( kal_uint16 pm_session_num, intx frameDelay, intx ebitDelay );
+#else
+/* under construction !*/
+#endif
+void L1T_SurroundMeasurementsDoneStandby( ScanList* scanList );
+void L1I_SurroundMeasurementStopGAPSuspended( void );
+#endif
+
+ScanList* L1T_SurroundMeasurementStartDedi( ScanList* list );
+void L1T_SurroundMeasurementStopDedi( void );
+
+void L1T_SurroundMeasurementStartPacketIdle( ScanList* list, bool usePPCh, intx duration );
+void L1T_SurroundMeasurementStopPacketIdle( void );
+
+ScanList* L1T_SurroundMeasurementStartPacketTransfer( ScanList* list );
+void L1T_SurroundMeasurementStopPacketTransfer( void );
+
+void L1T_StartNCReport( intx period , bool useT3158 );
+void L1T_StopNCReport( void );
+
+#if 0
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#ifdef __GERAN_R8__
+/* under construction !*/
+/* under construction !*/
+#endif /* __GERAN_R8__ */
+#endif
+
+/* --- ticking the measurements --------------------------------------------- */
+
+void L1I_SurroundMeasurementPagingBlockIdle( void ); /* idle mode */
+void L1I_SurroundMeasurementReportingPeriod( void ); /* dedicated */
+void L1I_ExtendedMeasurementReportingPeriod( void ); /* dedicated */
+void L1I_SurroundMeasurementPacketPagingBlock( void ); /* packet idle */
+void L1I_SurroundMeasurementPagingBlockPacketIdle( void ); /* packet idle */
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+#if 1
+void L1I_SurroundMeasurementPagingBlock_PIdle( kal_uint16 pm_session_num, l1c_sim_mode_enum local_sim_mode, bool start_suspend_timer, intx frameDelay,intx ebitDelay );
+void L1I_SurroundMeasurementPagingBlockRTB( kal_uint16 pm_session_num, l1c_sim_mode_enum local_sim_mode, bool start_suspend_timer, intx frameDelay,intx ebitDelay );
+void L1I_SurroundMeasurementPTMRTBAllow( uint32 PMNumber, intx frameDelay, intx ebitDelay );
+#else
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+#endif
+#ifdef __PKT_EXT_MEAS__
+void L1I_ExtendedMeasurementPacketPagingBlock( void ); /* packet idle */
+bool L1I_IsPktExtendedMeasurementActive( void );
+#endif
+void L1I_BCChMeasurementBlockTick( void ); /* packet transfer */
+void L1I_SurroundTickMeasurementDedi(l1c_sim_mode_enum);
+void L1I_SurroundTickMeasurementPT( l1c_sim_mode_enum );
+
+/* --- MAC ------------------------------------------------------------------ */
+
+void L1I_MACStart( void );
+void L1I_MACStop( void );
+
+#ifdef __NEW_TBF_ARCH__
+void L1I_MACSetUplink( int8 index, MACUplinkParams* up, FrameNumber startingTime );
+void L1I_MACSetDownlink( int8 index, MACDownlinkParams* down );
+void L1I_MACUpdateTimeSlotsAll( TimeSlotMask* timeSlotsDown, TimeSlotMask* timeSlotsUp );
+TimeSlotMask L1I_MACGetTimeSlotsUp( void );
+TimeSlotMask L1I_MACGetTimeSlotsDown( void );
+void L1I_MACRxBlockTick( TimeSlot syncTimeSlot );
+void L1I_MACBlockTick( TimeSlot syncTimeSlot, Power txPower[8] );
+#else /* __NEW_TBF_ARCH__ */
+void L1I_MACSetUplink( MACUplinkParams* up, FrameNumber startingTime );
+void L1I_MACSetDownlink( MACDownlinkParams* down );
+void L1I_MACRxBlockTick( TimeSlot syncTimeSlot );
+void L1I_MACTxBlockTick( void );
+#endif /* __NEW_TBF_ARCH__ */
+
+void L1I_MACDropBlock( void );
+void L1I_MACDropTimeslot6( void );
+bool L1I_MACIsTS0Free( intx syncTimeSlot );
+TimeSlot L1I_UpdateStartTimeSlotFBSB( void );
+bool L1I_MACGetAllocationExhausted( void );
+void L1I_MACSetTimingAdvance( TimingAdvance timingAdvance );
+
+#ifdef __PS_SERVICE__
+TimingAdvance L1I_MACGetTimingAdvance (void);
+#endif
+
+void L1I_PRAChSetFreeUSFMask( intx freeUSFMask, l1c_sim_mode_enum local_sim_mode);
+void L1I_MACRepeatAllocation( bool repeat, TimeSlotMask timeSlotOverrideMask, FrameNumber startFrameNumber);
+void L1I_MACReleaseTimeSlots( TimeSlotMask timeSlotsKept );
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+void L1I_PreGetUplinkPDTChFail( l1c_sim_mode_enum local_sim_mode );
+void L1I_Internal_PreGetUplinkPDTCh (l1c_sim_mode_enum local_sim_mode, kal_uint32 ul_data_index);
+kal_bool l1_detect_paging_block_ind_hdlr(kal_uint8 *pch_data
+ #ifdef __GL1_GEMINI__
+ , module_id_enum mod_indx
+ #endif
+ );
+#ifdef __GL1_GEMINI__
+void l1a_paging_param_assign_req_handler(ilm_struct* ptr_ilm);
+#endif /* __GL1_GEMINI__ */
+#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+void L1I_Internal_PreGetUplinkPDTCh (PrePacketUplinkSpec *ppus, l1c_sim_mode_enum local_sim_mode);
+#endif
+bool L1I_Internal_PRAChCheckUSFFree(void);
+void L1I_Internal_MACSetReceivedUSF( TimeSlot timeSlot, intx usf, l1c_sim_mode_enum local_sim_mode);
+bool L1I_Internal_MACFrameTick( PacketTransferSpec* pts, l1c_sim_mode_enum local_sim_mode);
+
+
+#ifdef __NEW_TBF_ARCH__
+MACDownlinkParams* L1I_MACGetDownParameters( int8 index );
+MACUplinkParams* L1I_MACGetUpParameters( int8 index );
+#endif /* __NEW_TBF_ARCH__ */
+
+#ifdef __EGPRS_MODE__
+void L1I_MACSetEgprsLoopMode( bool isOn );
+#endif /*__EGPRS_MODE__*/
+
+/* --- other ticks ---------------------------------------------------------- */
+
+void L1I_PRAChBlockTick( void );
+void L1I_BCChMeasurementBlockTick( void );
+
+/* --- Decode USF for PPCH/PAGC fast decoding ------------------------------- */
+
+void L1I_PPChDecodeUSF( bool decodeUSF );
+void L1I_PAGChDecodeUSF( bool decodeUSF );
+
+/* ----- L1C Sleep Mode function ------------------------------------------- */
+
+bool L1I_CheckReportIsEmpty( void );
+bool L1I_CheckPSMResultIsEmpty( void );
+void L1I_DisableTurboSleep( void );
+void L1I_EnableTurboSleep( void );
+void L1I_DisableSleepMode( void );
+void L1I_ReEnableSleepMode( void );
+void L1SM_SW_WakeUp(void);
+kal_bool L1SM_Leave_Polling( void );
+
+/* ----- For fix allocation ------------------------------------------- */
+
+#ifdef __NEW_TBF_ARCH__
+#ifndef __REMOVE_FA__
+void L1I_MACRepeatAllocation( bool repeat, TimeSlotMask timeSlotOverrideMask, FrameNumber startFrameNumber);
+void L1I_MACResetRepeatParams( void );
+bool L1I_MACGetAllocationExhausted( void );
+#endif
+#else
+void L1I_MACRepeatAllocation( bool repeat, TimeSlotMask timeSlotOverrideMask, FrameNumber startFrameNumber);
+void L1I_MACResetRepeatParams( void );
+bool L1I_MACGetAllocationExhausted( void );
+#endif
+
+/* ----- For AMR ------------------------------------------------------------ */
+
+void L1T_CalculateAMRQICompensated( Report* report );
+void L1I_InitAMRQICompensated( uint8 tchMode, bool isHopping );
+void L1T_InitAMRQICompensated(Report* report);
+
+void L1I_StartAMR( void );
+void L1I_StopAMR( bool applyPendingRATCCh );
+
+void L1I_RATSCChStart( void );
+void L1I_RATSCChStop( bool applyPendingRATCCh );
+void L1I_RATSCChDownlink( RxData *rx );
+BlockData* L1I_RATSCChUplink( TChMode tchMode, l1c_sim_mode_enum local_sim_mode);
+void L1I_RATSCChAndFACCh( TChMode tchMode, l1c_sim_mode_enum local_sim_mode );
+/*For task print out l1c/l1d information*/
+extern void L1SM_Print_FMresult(void);
+extern void L1_Task_Level_Info(void);
+//#endif //l1_generic_l1_core_private_h
+
+/* ----- For smart paging--------------------------------------------------------- */
+#ifdef __SMART_PAGING_IN_IDLE__
+bool L1I_QuerySmartPaging(l1c_sim_mode_enum);
+#endif /*__SMART_PAGING_IN_IDLE__*/
+
+
+/* ----- For SIM MODE--------------------------------------------------------- */
+//extern l1c_sim_mode_enum l1c_sim_mode;
+
+#ifdef __GL1_GEMINI__
+void L1T_SetSimMode(l1c_sim_mode_enum mode, sim_mode_from_enum from);
+void L1I_SetSimMode(l1c_sim_mode_enum mode, sim_mode_from_enum from);
+l1c_sim_mode_enum L1I_RestoreTaskSimMode(sim_mode_from_enum from);
+
+void L1I_SaveHisrSimMode(void);
+l1c_sim_mode_enum L1I_RestoreHisrSimMode(void);
+
+#define IS_SIM1 (l1c_sim_mode == L1C_SIM1)
+#define IS_NOT_SIM1 (l1c_sim_mode != L1C_SIM1)
+#define GET_RP_TYPE(type) (ReportType)(type + l1c_sim_mode * REPORT_SIM_SIZE)
+#define GET_LOCAL_RP_TYPE(type,sim_index) (ReportType)((type) + (sim_index) * REPORT_SIM_SIZE)
+#define GEN_MEAS_PRIORITY(_priority) ((MeasurementPriority)(_priority + l1c_sim_mode))
+#ifdef __GL1_GEMINI_WCDMA__
+/* LTG will also use this macro. Since L1C_MM_SIM_NUM is always one in LTG, the assert is still available. */
+/* Rick: Cast L1C_MM_SIM_NUM to l1c_sim_mode_enum to fix build warning.
+Remember that L1C_MM_SIM_NUM will never be larger than L1C_SIM_NUM */
+#define SIM_MODE_ASSERT_REBOOT(mode) L1C_ASSERT_Reboot( mode < (l1c_sim_mode_enum)L1C_MM_SIM_NUM )
+#else
+#define SIM_MODE_ASSERT_REBOOT(mode) L1C_ASSERT_Reboot(l1c_sim_mode == mode)
+#endif /*__GL1_GEMINI_WCDMA__*/
+
+#else /*__GL1_GEMINI__*/
+#define IS_SIM1 (true)
+#define IS_NOT_SIM1 (false)
+#define GET_RP_TYPE(type) (type)
+#define GET_LOCAL_RP_TYPE(type,sim_index) (type)
+#define GEN_MEAS_PRIORITY(_priority) (_priority)
+#define SIM_MODE_ASSERT_REBOOT(mode)
+#endif /*__GL1_GEMINI__*/
+
+#define CHK_REPORT_TYPE(_rp_type) (_rp_type & REPORT_TYPE_MASK)
+
+/* ------ Suspend notification in Gemini for AGPS ----- */
+#if ( defined( __L1_GPS_AUTO_TIMING_SYNC_SUPPORT__ ) || defined( __L1_GPS_REF_TIME_SUPPORT__ ) )
+void L1I_InternalGpsSuspendNotify( void );
+Timer* L1I_agpsFindTimer( void );
+#endif
+
+/* ----- GEMINI2.0----------------------------------------------------- */
+#ifdef __GL1_GEMINI__
+#define V_MASK(mode) (SurroundMode)(mode & (L1SCModeVirtual-1) )
+#define IS_VMODE(mode) ( (mode & L1SCModeVirtual)? (true): (false) )
+#define PROTECT_STR(timer) ( L1I_TimerIsProtected(timer) )
+#else
+#define V_MASK(mode) mode
+#define IS_VMODE(mode) ( false )
+#define PROTECT_STR(timer) ( 2 )
+#endif
+
+#if defined( __GL1_GEMINI__) && defined(__BSIC_SEARCH_IN_PEER_IDLE_FRAME__)
+#define SET_TIMER_RDRBN_INDEX(_timer_ptr, _idx) {(_timer_ptr)->rdrbn_index = _idx;}
+#else
+#define SET_TIMER_RDRBN_INDEX(_timer_ptr, _idx)
+#endif
+
+/* Constant */
+#ifdef __GL1_GEMINI__
+#define PROTECT_NONE_STATE 0xFF
+#endif
+
+/* ----- For GEMINI1.2 -------------------------------------------------------- */
+#ifdef __GL1_GEMINI__
+/*General: pass fn from function paramter*/
+#define SET_SIM2_FN_FOR_RX(fn, num) \
+{\
+ if (IS_NOT_SIM1)\
+ {\
+ L1D_SetSIM2FrameNumber_ForRx((uint8)l1c_sim_mode, fn, num);\
+ }\
+}
+/*Get currunt time*/
+#define SET_SIM2_CURRENT_FN_FOR_RX(num) \
+{\
+ if (IS_NOT_SIM1)\
+ {\
+ L1D_SetSIM2FrameNumber_ForRx((uint8)l1c_sim_mode, L1I_GetFN(l1c_sim_mode), num);\
+ }\
+}
+/*Get currunt time*/
+#define SET_SIM2_CURRENT_FN_FOR_TX(num) \
+{\
+ if (IS_NOT_SIM1)\
+ {\
+ L1D_SetSIM2FrameNumber_ForTx((uint8)l1c_sim_mode, L1I_GetFN(l1c_sim_mode), num);\
+ }\
+}
+#else /*__GL1_GEMINI__*/
+#define SET_SIM2_FN_FOR_RX(fn, num)
+#define SET_SIM2_CURRENT_FN_FOR_RX(num)
+#define SET_SIM2_CURRENT_FN_FOR_TX(num)
+#endif /*__GL1_GEMINI__*/
+
+
+#ifdef __GL1_GEMINI__
+/*SIM1 may also be adjusted.*/
+#define L1I_ADJUST_TIMING_ERR(timer, rp)\
+{\
+ L1I_AdjustTimingError(timer, rp);\
+}
+#else
+#define L1I_ADJUST_TIMING_ERR(t, r)
+#endif
+
+#if defined (__GL1_GEMINI__) && defined(__WEIGHTING_ROUND_ROBIN__)
+#define L1I_SET_HW_EXECUTE(_flag) L1I_SetHwExecute(_flag)
+#else
+#define L1I_SET_HW_EXECUTE(_flag)
+#endif
+extern uint16 L1D_Get_MinTqWrap();
+void L1I_L1D_PDTCh( Report *report, bool ccReset, bool egprs );
+void L1I_L1D_PTCChDown( Report *report, intx subBlock, TimeSlot timeSlotPosition );
+void L1I_L1D_PTCChUp( Power txPower, TimeSlot timeSlotPosition );
+void L1I_L1D_Interference( Report *report, ARFCN arfcn );
+void L1I_L1D_SDCChDown( Report *report );
+void L1I_L1D_SDCChUp( bool handover );
+void L1I_L1D_SACChCDown( Report *report );
+void L1I_L1D_SACChCUp( bool handover );
+void L1I_L1D_DChAB( bool isTCh );
+void L1I_L1D_TCh( Report *report, intx flags, HandoverState handover_state );
+void L1I_L1D_SACChT( Report *report, intx subBlock, bool handover );
+#ifdef __L1_CB__
+void L1I_L1D_BCCh( Report *report, ARFCN arfcn, BSIC bsic );
+#endif
+void L1I_L1D_PCh( Report *report, ARFCN arfcn, BSIC bsic );
+void L1I_L1D_CBCh( Report *report );
+void L1I_L1D_NBCCh( Report *report, ARFCN arfcn, BSIC bsic, AfcParams *afcParams );
+void L1I_L1D_PBCCh( Report *report, bool decodeUSF );
+void L1I_L1D_NPBCCh( Report *report, FrameNumber frameNumber );
+void L1I_L1D_PPCh( Report *report, bool decodeUSF );
+void L1I_L1D_PAGCh( Report *report, HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition, bool decodeUSF );
+void L1I_L1D_PACChDown( Report *report, HoppingSequence *hoppingSequence, TSC tsc );
+#if IS_GSM_INCREASE_RACH_TX_POWER_SUPPORT
+void L1I_L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc, int8 rachTxCount );
+#else
+void L1I_L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc );
+#endif
+void L1I_L1D_PRACh( ARFCN arfcn, BSIC bsic, TimeSlot timeSlot, TimeSlot timeSlotPosition, Power txPower, RAChData rachData, intx burstLength, TSC tsc );
+void L1I_L1D_PollResp( HoppingSequence *hoppingSequence, BSIC bsicOrTSC, Power txPower, TimingAdvance timingAdvance, BlockData *blockData, int burstLength );
+
+void L1I_L1D_FCChT(void);
+void L1I_L1D_SChT( Report *report, ARFCN arfcn, intx ebitPosition, AfcParams *afcParams );
+
+#ifdef __GL1_MULTI_MODE__
+void L1I_L1D_FCCh_DM( Report *report, ARFCN arfcn, int32 len_ebit, AfcParams *afcParams, int16 repeat_cnt );
+void L1I_2GCheckReport (Report* report);
+void L1I_FCChWinOffStart( uint8 frames );
+#endif /* __GL1_MULTI_MODE__ */
+
+extern void L1I_L1D_SCDedicateModeStart( void );
+extern void L1I_L1D_SCDedicateModeEnd( void );
+extern void L1I_L1D_SCAccessModeStart( void );
+extern void L1I_L1D_SCAccessModeEnd( void );
+extern void L1I_L1D_PM_ConsumePMQueue( void );
+extern void L1I_L1D_DChStopHandoverASAP( void );
+
+#if 0
+/* under construction !*/
+#ifndef __L1_TIMING_DEBUG__
+/* under construction !*/
+#endif
+#ifndef __LEVEL3_DEBUG__
+/* under construction !*/
+#endif
+/* under construction !*/
+#ifdef __L1_TIMING_DEBUG__
+/* under construction !*/
+#endif
+#endif
+
+#if (defined(__L1_TIMING_DEBUG__) && defined(__LEVEL1_DEBUG__))
+#define L1_TimingDebug_Level1(_id) L1_TimingDebug(_id)
+#define L1_TimingDebug_Level2(_id)
+#define L1_TimingDebug_Level3(_id)
+#elif (defined(__L1_TIMING_DEBUG__) && defined(__LEVEL2_DEBUG__))
+#define L1_TimingDebug_Level1(_id) L1_TimingDebug(_id)
+#define L1_TimingDebug_Level2(_id) L1_TimingDebug(_id)
+#define L1_TimingDebug_Level3(_id)
+#elif (defined(__L1_TIMING_DEBUG__) && defined(__LEVEL3_DEBUG__))
+#define L1_TimingDebug_Level1(_id) L1_TimingDebug(_id)
+#define L1_TimingDebug_Level2(_id) L1_TimingDebug(_id)
+#define L1_TimingDebug_Level3(_id) L1_TimingDebug(_id)
+#else
+#define L1_TimingDebug_Level1(_id)
+#define L1_TimingDebug_Level2(_id)
+#define L1_TimingDebug_Level3(_id)
+#endif
+
+#ifdef __2G_TX_VOLTAGE_COMPENSATION_SUPPORT__
+/* Tx-Volt compensation.*/
+void L1I_TriggerTxComp(void);
+void L1T_TxCompRequestGetPeriodTrigger(bool request);
+bool L1T_IsTxCompRequested(void);
+#endif
+
+/*HW CLK/MIPI CLK switch support*/
+#if IS_2G_DYNAMIC_HW_CLOCK_SUPPORT
+
+typedef enum{
+ MIPINeighbourARFCN = 0,
+ MIPIBcchARFCN,
+ MIPIHoppingARFCN
+}mipi_arfcn_source;
+
+void L1T_UpdateMIPIClkTable(ARFCN* ARFCNList, intx arfcnCount, mipi_arfcn_source source);
+
+void L1T_HWClockSpecificSyncFlag( kal_bool syncFlag );
+
+void L1T_InformDynHWClkOff( void );
+
+#endif /* end of IS_2G_DYNAMIC_HW_CLOCK_SUPPORT */
+
+/* For channel lock and unlock mechanism */
+#if defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ )
+#define MAX_2G_USECOUNT 5
+void L1I_ChannelsUnlock( void );
+void L1I_ChannelDelayUnlock( void );
+void L1I_ChannelsLock( void );
+void L1I_SetClearTXHW( uint8 FrameNumber );
+void L1I_SetClearRXHW( uint8 FrameNumber );
+intx L1I_GetRTBPriority ( TimerType Channel_Type, intx ChannelPriority);
+bool L1I_IsGapStopTimer_all_Started ( void );
+#endif /* defined ( __GL1_GEMINI__ ) && defined ( __GL1_MULTI_MODE__ ) */
+
+#define QUERY_CURRENT_UMTS_RAT
+#define CURRENT_UMTS_RAT_IS_TDD(sim_mode) MMRF_UBIN_isTdscdmaModeActivated(sim_mode)
+#define CURRENT_UMTS_RAT_IS_FDD(sim_mode) MMRF_UBIN_isWcdmaModeActivated(sim_mode)
+
+#ifdef __MTK_TARGET__
+#ifndef __L1_STANDALONE__
+void l1a_send_em_rf_test_gsm_rx_test_ind( Report *report );
+void l1a_get_current_tx_ant_handler( ilm_struct *ptr_ilm );
+ #if IS_2G_RXD_SUPPORT
+ void l1a_send_em_rf_test_gsm_rx_test_two_path_ind( Report *report );
+ #endif
+#if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void l1a_em_update_req_handler( ilm_struct* ptr_ilm );
+void L1T_TAS_SendCurrentAntMsg( l1c_sim_mode_enum local_sim_mode );
+#if IS_2G_TAS_SUPPORT
+kal_uint8 L1T_TAS_Get_Current_Ant( l1c_sim_mode_enum local_sim_mode );
+void L1T_TAS_SetMonitorAntChangeFlag(l1c_sim_mode_enum local_sim_mode, kal_bool monitor_ant_flag);
+#endif
+#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+kal_uint8 L1T_UTAS_Get_Current_Tx_Ant( l1c_sim_mode_enum local_sim_mode );
+void L1T_UTAS_SetMonitorAntChangeFlag(l1c_sim_mode_enum local_sim_mode, kal_bool monitor_ant_flag);
+#endif
+#endif /* IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT */
+void l1a_get_rf_temperature_req_handler ( ilm_struct* ptr_ilm );
+#endif /*__L1_STANDALONE__*/
+#endif /*__MTK_TARGET__*/
+
+bool L1I_IsBCChStopInQueue( void );
+
+#if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1T_SetPowerScanAntenna( bool isReset );
+void L1T_SetTASTxPowerDecrementTable( bool valid, uint8 tx_reduction_table[4][2][4], uint8 tx_reduction_table_tas[4][2][4] );
+void L1I_CheckTASEnableInfo( ARFCN arfcn );
+void L1T_KeepPowerScanAntenna( void );
+void L1I_TASInformC0Dominate( bool dominate );
+void L1T_TASDisable( void );
+void L1I_ChangeAntennaStatus( void );
+
+#if IS_2G_TAS_INHERIT_4G_ANT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1T_QueryForLTEAntennaInherit( bool isISR );
+void L1T_IsSRVCCHandInfoUpdate( bool value, l1c_sim_mode_enum local_sim_mode );
+#endif /* Endof IS_2G_TAS_INHERIT_4G_ANT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 ) */
+
+/*****************************************************************/
+#if IS_2G_TAS_SUPPORT || IS_2G_RXD_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+int8 L1T_GetPChTid( void );
+int8 L1T_GetAGChTid( void );
+#endif /* IS_2G_TAS_SUPPORT || IS_2G_RXD_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT */
+/*****************************************************************/
+/*****************************************************************/
+#if IS_2G_TAS_ANT_IDX_FOR_PM_WINDOW_SUPPORT
+extern void L1I_SelectBestAntennaForScan(Measurements* meas);
+extern void L1I_ChangeAntennaStatusDuringScan(l1c_sim_mode_enum local_sim_mode);
+extern int32 L1T_QueryMaxSupportAnt( void );
+#endif
+
+/*****************************************************************/
+#if defined(__MTK_TARGET__) && !defined(__L1_STANDALONE__)
+
+#define EM_BACKUP_RXLEVEL_DEFAULT_VALUE -116
+#define EM_BACKUP_SNR_DEFAULT_VALUE 32
+
+/* Engineering Mode */
+typedef enum
+{
+ /* Bit-map format */
+ TAS_EM_SOURCE_NONE = 0x0,
+ TAS_EM_SOURCE_AP = 0x1, /* AP side EM mode */
+ TAS_EM_SOURCE_TOOL = 0x2, /* Catcher or ELT */
+ TAS_EM_SOURCE_BOTH = 0x3 /* Both AP and Tool*/
+}tas_em_source_enum;
+
+void L1I_UpdateMaxTxpReductionInfo(bool);
+extern void L1T_TAS_SendMsg( void );
+tas_em_source_enum L1T_Get_EM_Source( void );
+void L1T_Set_EM_Source( tas_em_source_enum src );
+#if IS_2G_TAS_SUPPORT
+void L1T_Get_TAS_Info( em_gsm_tas_info_ind_struct* em_info );
+#endif
+
+bool L1T_Need_Send_Report( void );
+#if GL1_EM_IDLE_MODE_INFO_SUPPORT
+void L1T_Idle_Mode_SendEMInfo(void);
+#endif
+
+#endif /*defined(__MTK_TARGET__) && !defined(__L1_STANDALONE__)*/
+#endif /*IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )*/
+
+#if IS_2G_TAS_SUPPORT
+void L1T_InitTASParameters( void );
+void L1T_ResetTASInternalParameters( bool isAntennaChange );
+void L1T_DecreaseTASCountDown(void);
+void L1I_TASInformTXPower( Power power );
+void L1T_TASInformRXLevel( Power power );
+void L1T_CheckTASCriterion( Report* report );
+void L1T_ForceAntInfoUpdate( void );
+#endif /* IS_2G_TAS_SUPPORT */
+
+
+#if defined(__MD93__)
+#if IS_2G_RXD_SUPPORT
+AntennaStatus L1I_QueryAntennaStatus( FrequencyBand band, l1c_sim_mode_enum local_sim_mode, uint8 *rxd_mode);
+#elif IS_2G_TAS_SUPPORT
+AntennaStatus L1I_QueryAntennaStatus( FrequencyBand band, l1c_sim_mode_enum local_sim_mode);
+#endif /*IS_2G_RXD_SUPPORT*/
+#endif /* !__MD95__ */
+
+#if IS_GSM_EM_TX_POWER_CONTROL_SUPPORT
+
+void L1T_SetGsmTxPower( kal_bool* flag, kal_int8* mode);
+void L1T_GetCurrentPowerCtrlInfo(kal_int8* CurrentPCL, kal_uint8* band, kal_int16* apc_dac, kal_uint8* mod_type);
+void L1T_InitForcePclData(void);
+FrequencyBand L1T_GetServingBandInfo(void);
+FrequencyBand L1T_GetUserBandInfo(void);
+PowerControlLevel L1T_GetUserPCLInfo(void);
+void l1a_gsm_em_tx_power_ctrl_req_handler( ilm_struct *ptr_ilm );
+void L1T_SetServingBandInfo(FrequencyBand Band);
+void L1T_SetCurrentGSMKPower(Power MaxPower);
+void L1T_SetCurrentEPSKPower(Power MaxPower);
+extern short L1D_RF_UpdateTxInfo( short sc_mode, int rf_band, short power_dbm, short *mod_type);
+extern int L1D_RF_UpdateTXBackoffInfo( void);
+
+#endif
+#ifdef __EM_MAX_TX_POWER_SUPPORT__
+void L1T_UpdateMaxTxDACValue( FrequencyBand band, kal_uint16 dac_value );
+kal_uint16 L1I_RequestMaxTxDACValue( FrequencyBand band );
+void L1T_InitMaxTxDACValue(void);
+#endif
+
+/* move L1C to normal domain begin */
+//define SISR code number
+#if (CUR_GEN >= MD_GEN95)
+#define GL1C_CT1_NORMAL_DOMAIN_LISR_CODE IRQ_SW_LISR17_CODE /* id 166 for Gen 95 */
+#else
+#define GL1C_CT1_NORMAL_DOMAIN_LISR_CODE IRQ_SW_LISR24_CODE /* id 166 for Gen 92 and 93 */
+#endif
+
+#define GL1C_H2N_BUF_SIZE 2
+
+//#define GL1C_IS_NORMAL_DOMAIN ((kal_get_current_vpe_id()%2)==0)
+//#define GL1C_IS_HRT_DOMAIN ((kal_get_current_vpe_id()%2)==1)
+
+#define GL1C_IS_NORMAL_DOMAIN (kal_get_current_domain()==KAL_DOMAIN_NORMAL)
+#define GL1C_IS_HRT_DOMAIN (kal_get_current_domain()==KAL_DOMAIN_HRT)
+
+//#define FRC_WRAP_CHECK(f) ( (f)<0? (f)+USCNT_WRAP : (f) )
+
+#define GL1C_RB_SIZE(rb) ( sizeof((rb).buf)/sizeof(*((rb).buf)) )
+#define GL1C_RB_INIT(rb) ( (rb).write = (rb).read = 0 )
+#define GL1C_RB_EMPTY(rb) ( (rb).write == (rb).read )
+#define GL1C_RB_FULL(rb) ( ((rb).write - (rb).read) >= GL1C_RB_SIZE((rb)))
+#define GL1C_RB_MASK(rb) ( GL1C_RB_SIZE((rb)) - 1 )
+#define GL1C_RB_CNT(rb) ( (rb).write - (rb).read )
+#define GL1C_GET_READ_BUF(rb, buf) \
+{ \
+ L1C_ASSERT_Reboot( !GL1C_RB_EMPTY(rb) ); \
+ buf = &((rb).buf[(rb).read & GL1C_RB_MASK((rb))]); \
+}
+#define GL1C_GET_WRITE_BUF(rb, buf) \
+{ \
+ L1C_ASSERT_Reboot( !GL1C_RB_FULL(rb) ); \
+ buf = &((rb).buf[(rb).write & GL1C_RB_MASK((rb))]); \
+}
+
+/* main func for L1C sisr */
+void L1I_SISR_normal_domain( kal_uint32 irq_id );
+
+/* func for SISR to handle queue function from ct1 */
+void L1I_StopPchExtTimer(l1c_sim_mode_enum sim_mode);
+kal_bool L1I_h_ignore_timertype(TimerType type, l1c_sim_mode_enum sim_mode);
+Timer* L1I_h_GetNextValidTimer(int32 *ebitDelay );
+kal_bool L1I_h_check_sisr_sleep_condition(void);
+/* move L1C to normal domain end */
+
+/* Deepti start */
+extern kal_bool L1I_CheckHRTFailure( void );
+/* Deepti end */
+
+#define FCCH_INTERVAL_FRAME_NUM ( 18 )
+kal_bool L1I_Query_OtherRat_Active(void);
+
+void L1I_Send_TxPower_To_SM(Power txpower);
+
+#if defined(__MD97__) && defined( __MTK_TARGET__ )
+#define MAX_EFUSE_RAND 10
+extern void l1a_mode_utility_gemini_feature_start_random_timer( void );
+#endif
+
+#endif //l1_generic_l1_core_private_h
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
diff --git a/mcu/l1/interface/gl1/l1_private.h b/mcu/l1/interface/gl1/l1_private.h
new file mode 100644
index 0000000..1af361a
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_private.h
@@ -0,0 +1,141 @@
+/*******************************************************************************
+* Modification Notice:
+* --------------------------
+* This software is modified by MediaTek Inc. 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_private.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * Layer1 private stuff
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *------------------------------------------------------------------------------
+ * $Revision: 1.2 $
+ * $Modtime: May 16 2005 23:14:06 $
+ * $Log: //mtkvs01/vmdata/Maui_sw/archives/mcu/l1/common/l1_private.h-arc $
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ * add to source control recursely
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * Rev 1.2 May 17 2005 00:33:10 BM_Trunk
+ * Karlos:
+ * add copyright and disclaimer statement
+ *
+ * Rev 1.1 Jan 18 2005 00:37:12 BM
+ * append new line in W05.04
+ *
+ * Rev 1.0 Nov 30 2002 19:50:14 admin
+ * Initial revision.
+ *
+ * Rev 1.0 Sep 06 2002 11:18:58 admin
+ * Initial revision.
+ *
+ * Rev 1.2 Jan 03 2002 11:52:26 mtk00210
+ * merge the branch B.L1.20011225
+ *
+ * Rev 1.1.1.1 Dec 27 2001 10:52:46 mtk00210
+ * correct author
+ *
+ * Rev 1.1.1.0 Dec 25 2001 16:40:38 mtk00210
+ * revise L1 for RSSI, multiband AFC, new L1D/L1C interface,
+ * and new CBCH handler
+ *
+ * Rev 1.1 Dec 21 2001 12:17:40 admin
+ * add copyright
+ *
+ *
+ *******************************************************************************/
+
+/******************************************************************************
+ *
+ * File: /MTKteam/source/gprsmtk/l1/generic/SCCS/s.l1_private.h
+ * -----
+ *
+ * SCCS Version: 2.1
+ * -------------
+ *
+ * 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 Communications Consultants Worldwide Limited (C) 2000
+ *
+ * Project:
+ * --------
+ *
+ * Software Unit: Layer1 private stuff.
+ * --------------
+ *
+ * Description:
+ * ------------
+ *
+ *
+ * Modification History:
+ * ---------------------
+ * Date Vers Auth Details
+ * ---- ---- ---- -------
+ * 28-Mar-01 2.1 VKL Initial version
+ *
+ *****************************************************************************/
+
+#ifndef l1_generic_l1_private_h
+#define l1_generic_l1_private_h
+
+
+#include "l1_public.h"
+#include "l1_core.h"
+
+#endif
+
diff --git a/mcu/l1/interface/gl1/l1_public.h b/mcu/l1/interface/gl1/l1_public.h
new file mode 100644
index 0000000..c76bbca
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_public.h
@@ -0,0 +1,1625 @@
+/*******************************************************************************
+* Modification Notice:
+* --------------------------
+* This software is modified by MediaTek Inc. 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_public.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * Layer1 public interface
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *------------------------------------------------------------------------------
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ *
+ *
+ *******************************************************************************/
+
+/******************************************************************************
+ *
+ * File: /MTKteam/source/gprsmtk/l1/generic/SCCS/s.l1_public.h
+ * -----
+ *
+ * SCCS Version: 2.21
+ * -------------
+ *
+ * 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 Communications Consultants Worldwide Limited (C) 2001
+ *
+ * Project:
+ * --------
+ *
+ * Software Unit: Layer1 public interface.
+ * --------------
+ *
+ * Description:
+ * ------------
+ *
+ *
+ * Modification History:
+ * ---------------------
+ * Date Vers Auth Details
+ * ---- ---- ---- -------
+ * 28-Mar-01 2.1 VKL Initial version
+ * 25-Apr-01 2.2 APB Add prototype for strdup
+ * 27-Apr-01 2.3 VKL Added AGCGroupPTCCh and AGCGroupMax.
+ * Changed prototypes of L1D_ReportPeriod() and
+ * L1D_PTCChStart().
+ * Added prototypes for L1D_DChSetTxPower() and
+ * L1D_PDTChSetHoppingSequence()
+ * 01-May-01 2.4 VKL Renames PSM functions
+ * 01-May-01 2.5 DBT Fix merge errors
+ * Change prototype for PDTCh drivers
+ * 21-May-01 2.6 VKL removed ifdef WIN32 ( now in l1_const.h)
+ * replaces L1_PSM* functions by new power measurement
+ * manager functions
+ * renamed parameter to L1D_CBChStart and
+ * L1D_PBCChStart
+ * change parameters to L1D_PTCChStart
+ * surround cell power measurements now done in
+ * separate module, not in report period any more.
+ * L1D_ReportPeriod therfore no longer gets scan list
+ * added functions for PCh, PAGCh, PRACh, and
+ * interference measurements.
+ * 15-Jul-01 2.7 VKL Added ARFCN conversion functions
+ * Added L1I_GetUplinkPDTCh()
+ * Added MAC functions
+ * Added driver to adjust frequency
+ * TCh drv now get param to mark if a blk can be DTXed
+ * PAGCh driver now gets time slot parameters
+ * PDTCh driver no longer gets time slot allocation.
+ * MAC now handles this.
+ * Add burstLength param to L1D_RACh() and L1D_PRACh()
+ * Removed rachData parameter from L1D_PTCChUp()
+ * 08-Aug-01 2.8 VKL Added L1I_ReportRxBurstData()
+ * Added startTimeSlot parameter to L1D_FCChTStart()
+ * and L1D_FCChT()
+ * 02-Sep-01 2.9 VKL Change params to L1I_GetUplinkPDTCh(), add dtxAllowed
+ * parameter to L1D_ReportPeriod(), pass DChParams
+ * structure to L1D_DChStart() instead of individual ones
+ * pass timeSlotPosition to L1D_PTCChUp(), ..Down() instead
+ * add L1D_PDTChStart() and L1D_PDTChStop()
+ * change L1D_PTDCh() params, cleanup BSIC vs. TSC usage,
+ * add bsic field to TBFParams, add subBlock field to RxData
+ * replace reportPeriodLock field by monitorReport field
+ * 12-Sep-01 2.10 VKL Add ARFCN2INDEX for backward compatibility, add AGC parameter
+ * structure and variable declaration
+ * 13-Sep-01 2.11 VKL Add drivers for neighbour PBCCh receive
+ * 26-Sep-01 2.12 VKL Added tsc parameter to L1D_PTCChStart()
+ * Added L1D_PollResp() and L1D_PDTChSetHoppingSequence()
+ * 28-Sep-01 2.13 VKL Changed parameters of L1I_GetUplinkPDTCh()
+ * Changed AGC completely.
+ * Added prototype for L1D_GetHardwareGain()
+ * 28-Sep-01 2.14 SGB Add temporary OLD_AGC conditional compile option
+ * 09-Oct-01 2.15 VKL Add new AGC constants
+ * 09-Oct-01 2.16 VKL Add new AGC constant
+ * 09-Oct-01 2.17 VKL Add AGC algorithm for NPBCCh and interference
+ * measurements
+ * 10-Oct-01 2.18 VKL Add per cell AFC support
+ * 12-Oct-01 2.19 VKL Add sacchPosition parameter to L1D_DChStart
+ * 11-Oct-01 2.20 SY Revise AGC interface and add paramter of L1D_DChStart
+ * 26-Oct-01 2.21 VKL Remove L1D_AdjustFrequency() prototype
+ * Increse size of agcScaleBetaServingCell array
+ * 26-Oct-01 2.21 SGB Correct File history
+ * 17-Nov-01 2.22 VKL Change AGC interface
+ * Replace AGCGroup values by #defines to temporarily
+ * patch in new AGC
+ * Move AGCParams to l1_types.h
+ * 21-Nov-01 2.23 VKL Make PRACh aware of syncTimeSlot
+ * Remove frequencyError param from L1I_ReportRxBurstData
+ * 04-Dec-01 2.24 VKL Add flags parameter to L1I_GetUplinkFACCh()
+ * Replace L1D_TChF() by L1D_TCh().
+ * Add fn parameter to L1D_NPBCCh()
+ *
+ *****************************************************************************/
+
+#ifndef l1_generic_l1_public_h
+#define l1_generic_l1_public_h
+
+#if !defined(GEN_FOR_PC)
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#endif // GEN_FOR_PC
+
+#include "l1_const.h"
+#include "l1_types_public.h"
+#include "l1_tool.h"
+#include "l1_types.h"
+
+#if !defined(IC_BURNIN_TEST) && !defined(GEN_FOR_PC) && !defined(__NO_L1TRC_GEN__)
+#include "TrcMod.h"
+#endif
+
+#include "mph_types.h"
+#include "l1d_cid.h"
+#include "kal_general_types.h"
+#include "l1d_public.h"
+#ifdef __MTK_TARGET__
+#include "perf_api.h"
+#endif
+
+/* -------------------------------------------------------------------------- */
+/* --- layer1 functions accessible by hardware driver ----------------------- */
+/* -------------------------------------------------------------------------- */
+
+#define ARFCN2INDEX L1_ARFCNToIndex /* backward compatibility */
+
+intx L1_ARFCNToIndex( ARFCN arfcn );
+ARFCN L1_IndexToARFCN( intx index );
+FrequencyBand L1_ARFCNToFrequencyBand( ARFCN arfcn );
+
+#if IS_DYNAMICAL_NOISE_FLOOR_AND_SATURATION_SUPPORT
+intx L1_PowerToIndex( Power power );
+#endif
+
+
+typedef enum
+{
+ caller_l1c,
+ caller_tst,
+ caller_l1d,
+}L1D_APIcaller_id;
+
+/* --- getting uplink data -------------------------------------------------- */
+
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+void L1I_GetUplinkSACCh( kal_uint32 ul_data_index, QueryTxDataCallback* callback);
+#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+BlockData* L1I_GetUplinkSACCh( void );
+#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+void L1I_GetUplinkFACCh( intx flags, kal_uint32 ul_data_index, QueryTxDataCallback* callback);
+#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+BlockData* L1I_GetUplinkFACCh( intx flags );
+#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+/*AMR_ENABLE*/
+BlockData* L1I_GetUplinkRATSCCh( intx flags );
+/*end of AMR_ENABLE*/
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+void L1I_GetUplinkSDCCh( kal_uint32 ul_data_index, QueryTxDataCallback* callback);
+#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+BlockData* L1I_GetUplinkSDCCh( void );
+#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT*/
+BlockData* L1I_GetUplinkCSD( intx flags );
+
+/* --- replying reports ----------------------------------------------------- */
+#if defined(__2G_RX_DIVERSITY_PATH_SUPPORT__)
+ #if IS_2G_C_VALUE_SUPPORT
+ #if IS_2G_RAS_DECISION_INCLUDE_DSP_POW_SUPPORT
+ void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, Power power_dBm_rxd, Power dspPower_dBm, Power dspPower_dBm_drx, int16 dsp_c_value, int16 dsp_c_value_drx, int16 snr );
+ #else
+ void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, Power power_dBm_rxd, int16 dsp_c_value, int16 dsp_c_value_drx, int16 snr );
+ #endif /* IS_2G_RAS_DECISION_INCLUDE_DSP_POW_SUPPORT */
+ #else
+ #if IS_2G_RAS_DECISION_INCLUDE_DSP_POW_SUPPORT
+ void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, Power power_dBm_rxd, Power dspPower_dBm, Power dspPower_dBm_drx, int16 snr );
+ #else
+ void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, Power power_dBm_rxd, int16 snr );
+ #endif /* IS_2G_RAS_DECISION_INCLUDE_DSP_POW_SUPPORT */
+ #endif /* IS_2G_C_VALUE_SUPPORT */
+#else
+void L1I_ReportRxBurstData( Report *report, ARFCN arfcn, intx rxSlotIndex, intx subBlock, intx timingError_ebits, Power power_dBm, int16 snr );
+#endif
+void L1I_PutReport( Report *report );
+
+/* --- hopping -------------------------------------------------------------- */
+
+ARFCN L1_CalcHoppingARFCN( HoppingSequence *hs, FrameNumber frame );
+
+/* --- power scan ----------------------------------------------------------- */
+
+#if IS_2G_TAS_ANT_IDX_FOR_PM_WINDOW_SUPPORT
+#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+bool L1I_MeasurementsGetARFCN( ARFCN* arfcn, l1c_sim_mode_enum* sim_mode, GL1_AntennaInfo *antenna_assigned);
+#else
+bool L1I_MeasurementsGetARFCN( ARFCN* arfcn, l1c_sim_mode_enum* sim_mode);
+#endif /* IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 ) */
+#endif
+
+void L1I_MeasurementsPutResult( PMResult pmResult );
+
+/* --- MAC ------------------------------------------------------------------ */
+
+void L1I_MACSetReceivedUSF(TimeSlot timeSlot, intx usf, Report* report);
+bool L1I_MACFrameTick( PacketTransferSpec *pts );
+#if IS_DUAL_CORE_GL1AC_MODEM_SUPPORT
+void L1I_PreGetUplinkPDTCh( Report* report, kal_uint32 ul_data_index, QueryTxDataCallback *callback );
+#else /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+void L1I_PreGetUplinkPDTCh(PrePacketUplinkSpec *ppus, Report* report);
+#endif /* IS_DUAL_CORE_GL1AC_MODEM_SUPPORT */
+bool L1I_PRAChCheckUSFFree( void );
+
+/* --- AFC ------------------------------------------------------------------ */
+typedef struct
+{
+ Power burstpower;
+ uint16 snr;
+ int16 freq_offset;
+
+#if IS_SAIC_CHIP_MT6223_AND_LATTER_VERSION
+ int16 tx_freq_offset;
+ int16 c_value;
+ #if IS_2G_C_VALUE_SUPPORT
+ int16 c_value_drx;
+ #endif
+ bool isSAIC;
+ #if IS_EGPRS
+ bool isEPSK;
+ #endif
+#endif /* End of "IS_SAIC_CHIP_MT6223_AND_LATTER_VERSION" */
+
+} BurstAfcDB;
+
+typedef struct
+{
+ BurstAfcDB burstafc[4];
+
+#if IS_ACC_NC_AFC_DB_UPDATE_SUPPORT
+ bool AfcForNbcch;
+#endif /* IS_ACC_NC_AFC_DB_UPDATE_SUPPORT */
+
+} AfcUpdateParams;
+
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+int32 L1I_AFCGetFBSBFreqSetting( AfcParams *p, bool beginfreqcorrection );
+int32 L1I_AFCAdjustFBSBFreqSetting( AfcParams *p, uint8 sub_stage );
+#else
+uint16 L1I_AFCGetFBSBFreqSetting( AfcParams *p, bool beginfreqcorrection );
+
+uint16 L1I_AFCAdjustFBSBFreqSetting( AfcParams *p, uint8 sub_stage );
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+void L1I_AFCFBSBUpdate( AfcParams *p, intx freq_offset, int8 freqcorrectionstepcnt, bool decodeOk, FrequencyBand band );
+
+void L1I_AFCBeforeTick( AfcParams *p );
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+int32 L1I_AFCGetNBFreqSetting( void );
+#else
+uint16 L1I_AFCGetNBFreqSetting( void );
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+void L1I_AFCNBUpdate( AfcUpdateParams *p, TimeSlotMask timeSlots, FrequencyBand band );
+void L1I_AFCAfterTick( void );
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+void L1I_SetAFcData( int32 calibrated_dac_default, intx calibrated_int_slope );
+#else
+void L1I_SetAFcData( int16 calibrated_dac_default, intx calibrated_int_slope );
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+
+#if IS_GEMINI_SUPPORT
+void L1I_AFCSetDatabaseToSIMx( uint8 simIndex );
+#endif
+
+//extern intx afc_inv_slope;
+//extern int16 afc_dac_default; /* move to l1d_public.h */
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+extern int32 onek_hz_dac;
+#else
+extern int16 onek_hz_dac;
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+
+#if IS_TDD_DUAL_MODE_SUPPORT
+extern int16 GSM_afc_inv_slope;
+extern intx GSM_afc_dac_default;
+#endif
+
+extern Power agc_gainoffset_h2l;
+extern Power agc_gprs_gainoffset;
+#if IS_EGPRS
+extern Power agc_edge_gainoffset;
+#endif
+
+/*XO*//* --XO AFC------------------------------------------------------------ */
+/*XO*/ void L1IXO_PrepareTuneSlope( bool freq_crt );
+/*XO*/ void L1DXO_PrepareTuneSlope( Report *report );
+/*XO*/ void L1DXO_TuneSlope( void );
+/*XO*/ bool L1DXO_IsSlopeCorrected( void );
+
+/* --- AGC ------------------------------------------------------------------ */
+
+typedef Report* AGCGroup;
+
+#define AGCGroupPowerMeasurement NULL
+#define AGCGroupFCCh report
+#define AGCGroupSCh report
+#define AGCGroupNBCCh report
+#define AGCGroupBCCh report
+#define AGCGroupPCh report
+#define AGCGroupCBCh report
+#define AGCGroupSACChC report
+#define AGCGroupSDCCh report
+#define AGCGroupTCh report
+#define AGCGroupSACChT report
+#define AGCGroupFCChT report
+#define AGCGroupSChT report
+#define AGCGroupPTCCh report
+#define AGCGroupPBCCh report
+#define AGCGroupNPBCCh report
+#define AGCGroupPPCh report
+#define AGCGroupPAGCh report
+#define AGCGroupPDTCh report
+#define AGCGroupInterference imm.params.report
+
+/*
+ first beta (forgetting factor) in the table. This is used if the delay
+ between the measurements is zero after scaling the delay.
+ This is a floating point number used to init the AGCs internal tables.
+*/
+#define BETA0 (0.1)
+
+/*
+ The AGC uses fixed point arithmetic for scales and forgetting factors (beta).
+ This constant defines the number of bits after the decimal point.
+*/
+#define AGC_PRECISION 10
+
+/*
+ Convert a floating point number to the AGCs internal fixed point format
+*/
+#define AGC_TOFIX(n) ((int16)((1<<AGC_PRECISION)*(n)))
+
+extern const AGCParams agcParams[ FrequencyBandCount ];
+#if IS_DYNAMICAL_NOISE_FLOOR_AND_SATURATION_SUPPORT
+extern AGCParams_T agcParams_p[];
+#endif
+
+
+void L1I_AGCBeforeBlock( Report *report, TimeSlotMask timeSlots );
+Gain L1I_AGCGetGain( Report *report, ARFCN arfcn, TimeSlot timeSlot );
+#if defined(__2G_RX_DIVERSITY_PATH_SUPPORT__)
+L1D_RX_POWER L1I_AGCGetInputPower( Report *report, ARFCN arfcn, TimeSlot timeSlot );
+ #if IS_2G_EXTERNAL_LNA_SUPPORT
+L1D_RX_POWER L1I_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, BurstAfcDB *pBurstData, L1D_RX_ELNA_TYPE elna_status );
+L1D_RX_POWER L1I_AGCMeasurementUpdate( ARFCN arfcn, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, L1D_RX_ELNA_TYPE elna_status );
+ #else
+L1D_RX_POWER L1I_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, BurstAfcDB *pBurstData );
+L1D_RX_POWER L1I_AGCMeasurementUpdate( ARFCN arfcn, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain );
+ #endif
+L1D_RX_POWER L1I_AGCMeasurementGetInputPower( ARFCN arfcn );
+#else
+ #if IS_2G_EXTERNAL_LNA_SUPPORT
+Power L1I_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, Power observedDSPOutputPower, Gain usedGain, BurstAfcDB *pBurstData, MMRF_ELNA_TYPE_E elna_status );
+Power L1I_AGCMeasurementUpdate( ARFCN arfcn, Power observedDSPOutputPower, Gain usedGain, MMRF_ELNA_TYPE_E elna_status );
+ #else
+Power L1I_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, Power observedDSPOutputPower, Gain usedGain, BurstAfcDB *pBurstData );
+Power L1I_AGCMeasurementUpdate( ARFCN arfcn, Power observedDSPOutputPower, Gain usedGain );
+ #endif
+Gain L1I_AGCMeasurementGetGain( ARFCN arfcn );
+#endif
+void L1I_AGCAfterBlock( Report *report, TimeSlotMask timeSlots );
+
+
+
+
+
+/* -------------------------------------------------------------------------- */
+/* --- hardware driver functions -------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+
+/* --- starting and stopping ------------------------------------------------ */
+
+void L1D_Init0( void );
+void L1D_Init( void );
+void L1D_Init2(void);
+void L1D_Exit( L1D_APIcaller_id caller );
+void L1D_Meta_Init( void );
+
+void L1D_Start( void );
+void L1D_Stop( L1D_APIcaller_id caller );
+
+/* --- ticking and sleeping ------------------------------------------------- */
+
+void L1D_FrameTick( void );
+
+bool L1D_PowerDown( intx frames );
+void L1D_PowerUp( void );
+
+/* --- drivers -------------------------------------------------------------- */
+
+#if IS_TDD_DUAL_MODE_SUPPORT
+/*TDD*/ /*--------------------------- GSM Using Only ------------------------------*/
+ #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+/*TDD*/ void L1D_AFCSetDACValue_DM( AfcParams *p, int32 DacValue, L1D_APIcaller_id caller );
+ #else
+/*TDD*/ void L1D_AFCSetDACValue_DM( AfcParams *p, int16 DacValue, L1D_APIcaller_id caller );
+ #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+/*TDD*/ bool L1D_check_3g_reli( void );
+/*TDD*/ void L1D_AFCResetParams_DM( AfcParams *p, L1D_APIcaller_id caller );
+/*TDD*/ /*--------------------------- TDD Using Only ------------------------------*/
+/*TDD*/ kal_uint16 L1D_GetInitMode( void );
+/*TDD*/ void L1D_ErrorCheck_DM_RF_Conflict( uint32 start_subfn, uint16 start_chip, uint32 end_subfn, uint16 end_chip );
+/*TDD*/ /*--------------------------- GSM/TDD Using ------------------------------*/
+ #if L1D_WT_COBIN_ARCHITECTURE_SUPPORT
+ #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+/*TDD*/ kal_int32 L1D_AFCGetDAC_Value_DM_TDD( bool is_2g_2_3g );
+ #else
+/*TDD*/ kal_int16 L1D_AFCGetDAC_Value_DM_TDD( bool is_2g_2_3g );
+ #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+ #else
+ #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+/*TDD*/ kal_int32 L1D_AFCGetDAC_Value_DM( bool is_2g_2_3g );
+ #else
+/*TDD*/ kal_int16 L1D_AFCGetDAC_Value_DM( bool is_2g_2_3g );
+ #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+ #endif
+/*TDD*/ void L1D_AFCChangeTDReliable_DM( bool is_afc_reliable );
+#endif
+void L1D_AFC_Control_Switch_DM( kal_bool is_2G_control );
+
+void L1D_AFC_Update_Mode(kal_uint8 sim_num, kal_uint8 new_mode, L1D_APIcaller_id caller );
+void L1D_AFC_Update_Gap_Start(kal_uint8 sim_num, L1D_APIcaller_id caller);
+#ifdef __UMTS_FDD_MODE__
+/*FDD*/ bool L1D_AFC_2G_ACTIVE_ASK_FreqCorrect( uint8 simIndex, kal_bool correction, kal_bool is_l1c, AfcParams *afcParams );
+#endif
+
+#if !IS_MultiMode_AFC_Support
+ #ifdef __UMTS_FDD_MODE__
+ #if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+/*FDD*/ void L1D_AFCSetDACValue_DM( AfcParams *p, int32 DacValue, L1D_APIcaller_id caller );
+ #else
+/*FDD*/ void L1D_AFCSetDACValue_DM( AfcParams *p, int16 DacValue, L1D_APIcaller_id caller );
+ #endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+/*FDD*/ int16 L1D_AFCGetServingDACValue_DM( void );
+/*FDD*/ void L1D_AFCResetParams_DM( AfcParams *p, L1D_APIcaller_id caller );
+ #endif
+#endif
+
+void L1D_Update_DSP_2G_TimeStamp( kal_uint32 timestamp );
+void L1D_Update_DSP_3G_TimeStamp( kal_uint16 timestamp );
+
+void L1D_AFCSetParams( uint8 simIndex, AfcParams *afc, L1D_APIcaller_id caller );
+bool L1D_AFCGetServingReliable( uint8 simIndex );
+
+#if IS_GEMINI_SUPPORT
+kal_bool L1D_AFC_Ask_FreqCorrection_2( uint8 simIndex, kal_bool correction, AfcParams *afcParams);
+#endif
+
+void L1D_SCDedicateModeStart( L1D_APIcaller_id caller );
+void L1D_SCDedicateModeEnd( L1D_APIcaller_id caller );
+void L1D_SCAccessModeStart( L1D_APIcaller_id caller );
+void L1D_SCAccessModeEnd( L1D_APIcaller_id caller );
+void L1D_SetInitMode( int16 mode );
+int L1D_CheckIfMetaMode( void );
+uint8 L1D_IRDMA_Power_GetHandle( void );
+void L1D_IRDMA_Power_On( uint8 handle );
+void L1D_IRDMA_Power_Off( uint8 handle );
+
+Gain L1D_SetHardwareGain( FrequencyBand band, Gain gain );
+void L1D_AGCControl( void *privateData );
+
+void L1D_ExtendFrame( intx extendFrameEBits, L1D_APIcaller_id caller );
+void L1D_AdjustFrame( intx adjustFrameEBits, L1D_APIcaller_id caller );
+void L1D_SetSync( FrameNumber setSyncFrame, intx setSyncEBits, L1D_APIcaller_id caller );
+void L1D_Write_HW_TQWRAP( uint16 tq );
+
+#if IS_GEMINI_SUPPORT
+void L1D_SetSIM2FrameNumber( FrameNumber setSyncFrame );
+void L1D_SetSIM2FrameNumber_ForRx( uint8 simIndex, FrameNumber setSyncFrame, int8 burstCnt );
+void L1D_SetSIM2FrameNumber_ForTx( uint8 simIndex, FrameNumber setSyncFrame, int8 burstCnt );
+#endif
+
+void L1D_FCCh( Report *report, ARFCN arfcn, bool frequencyCorrect, AfcParams *afc, L1D_APIcaller_id caller );
+void L1D_FCChStop( L1D_APIcaller_id caller );
+
+void L1D_SCh( Report *report, ARFCN arfcn, AfcParams *afc, L1D_APIcaller_id caller );
+void L1D_SChStop( uint8 simIndex, L1D_APIcaller_id caller );
+
+void L1D_NBCCh( Report *report, ARFCN arfcn, BSIC bsic, AfcParams *afc, L1D_APIcaller_id caller );
+
+void L1D_BCCh( Report *report, ARFCN arfcn, BSIC bsic, L1D_APIcaller_id caller );
+
+void L1D_PCh( Report *report, ARFCN arfcn, BSIC bsic, L1D_APIcaller_id caller );
+#ifdef __L1_CB__
+void L1D_CBChStart( HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition, L1D_APIcaller_id caller );
+void L1D_CBCh( Report *report, L1D_APIcaller_id caller );
+void L1D_CBChStop( L1D_APIcaller_id caller );
+#endif
+#if IS_GSM_INCREASE_RACH_TX_POWER_SUPPORT
+ #if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || IS_2G_Gen97_UTAS_SUPPORT
+void L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc ,l1c_d_intf_params* l1c_d_intf_params, int8 rachTxCount, L1D_APIcaller_id caller );
+ #else
+void L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc, int8 rachTxCount, L1D_APIcaller_id caller );
+ #endif
+#else
+ #if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || IS_2G_Gen97_UTAS_SUPPORT
+void L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc ,l1c_d_intf_params* l1c_d_intf_params, L1D_APIcaller_id caller );
+ #else
+void L1D_RACh( ARFCN arfcn, BSIC bsic, Power txPower, RAChData rachData, intx burstLength, TSC tsc, L1D_APIcaller_id caller );
+ #endif
+#endif
+void L1D_ReportPeriod( Report *report, TimingAdvance timingAdvance, int8 dtxsetting, L1D_APIcaller_id caller );
+void L1D_ReportPeriodStop( L1D_APIcaller_id caller );
+
+#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1D_DChAB( bool isTCh, l1c_d_intf_params* l1c_d_intf_params, L1D_APIcaller_id caller);
+#else
+void L1D_DChAB( bool isTCh, L1D_APIcaller_id caller );
+#endif /* IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )*/
+void L1D_DChStart( DChParams *params, intx sacchPosition, L1D_APIcaller_id caller );
+void L1D_DChStop( bool releaseDCh, L1D_APIcaller_id caller );
+void L1D_DChStopHandoverASAP( L1D_APIcaller_id caller );
+void L1D_DChSetHoppingSequence( HoppingSequence *hoppingSequence, L1D_APIcaller_id caller );
+void L1D_DChSetCiphering( bool enable, int8 algorithm, uint8 key[ 8 ], L1D_APIcaller_id caller );
+void L1D_DChSetChannelMode( TChMode channelMode, SubChannel subChannel, bool dtxAllowed, L1D_APIcaller_id caller );
+void L1D_DChSetAMRChannelMode( TChMode channelMode, SubChannel subChannel, bool dtxAllowed, TChAMRConfig *amrConfig, L1D_APIcaller_id caller );
+void L1D_DChSetAMRConfig( TChAMRConfig *amrConfig, L1D_APIcaller_id caller );
+void L1D_DChSetAMRQICompensated( uint16 amrCompensated );
+void L1D_DChInitAMRQICompensated( void );
+void L1D_DChSetLoopMode( LoopMode mode, L1D_APIcaller_id caller );
+void L1D_DChSetTxPower( Power txPower, L1D_APIcaller_id caller );
+#ifdef __EGPRS_MODE__
+void L1D_EGPRSSetSRBMode( bool isOn, TimeSlot dnTsOffset, bool mBit, L1D_APIcaller_id caller );
+#endif /*__EGPRS_MODE__*/
+
+void L1D_SDCChDown( Report *report, L1D_APIcaller_id caller );
+#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1D_SDCChUp( bool handover ,l1c_d_intf_params* intf_params, L1D_APIcaller_id caller);
+#else
+void L1D_SDCChUp( bool handover , L1D_APIcaller_id caller);
+#endif
+void L1D_SACChCDown( Report *report, L1D_APIcaller_id caller );
+#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1D_SACChCUp( bool handover, l1c_d_intf_params* intf_params, L1D_APIcaller_id caller );
+#else
+void L1D_SACChCUp( bool handover, L1D_APIcaller_id caller );
+#endif /* IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 ) */
+#if IS_DUAL_CORE_MODEM_SUPPORT
+void L1D_SetSABMData( BlockData *data, L1D_APIcaller_id caller );
+#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
+
+#define TCH_BLOCK 0x01 /* interleaved block starts and other one ends */
+#define TCH_FACCHU 0x02 /* uplink FACCh block start */
+#define TCH_FACCHD 0x04 /* downlink FACCh block end */
+#define TCH_NODTXD 0x08 /* no downlink DTX allowed on this block */
+#define TCH_NODTXU 0x10 /* no uplink DTX allowed on this block */
+#define TCH_QSUB 0x20 /* monitor block quality to sub for normal block */
+#define TCH_QFACCHSUB 0x40 /* monitor block quality to sub for FACCh block */
+#define TCH_FORCEFACCH 0x80 /* interleaved block starts and other one ends */
+
+#define SACCH_NONE_SHIFT 0x0000
+#define SACCH_RIGHT_SHIFT 0x0100
+#define SACCH_LEFT_SHIFT 0x0200
+
+#if IS_DUAL_LOOP_AFC_CONTROL_SUPPORT
+#define MAX_FBCORRECTION_SEARCH_TIME (110) //(110+52) // FB Search time increase 13*4 caused by USE_3_SUBSTAGES_FB_STAGE1=1
+#else
+#define MAX_FBCORRECTION_SEARCH_TIME (110)
+#endif
+
+void L1D_TCh( Report *report, intx flags, HandoverState handover, L1D_APIcaller_id caller );
+void L1D_SACChT( Report *report, intx subBlock, bool handover, L1D_APIcaller_id caller );
+void L1D_DChGetCsdASAP( Report *report , Report *oldreport, L1D_APIcaller_id caller );
+
+void L1D_FCChTStart( Report *report, ARFCN arfcn, TimeSlot startTimeSlot, AfcParams *afc, L1D_APIcaller_id caller );
+void L1D_FCChT( L1D_APIcaller_id caller );
+void L1D_FCChTStop( L1D_APIcaller_id caller );
+
+void L1D_SChT( Report *report, ARFCN arfcn, intx ebitPosition, AfcParams *afc, L1D_APIcaller_id caller );
+
+void L1D_PTCChStart( HoppingSequence *hoppingSequence, BSIC bsic, TSC tsc, intx burstLength, L1D_APIcaller_id caller );
+void L1D_PTCChSetHoppingSequence( HoppingSequence *hoppingSequence );
+void L1D_PTCChStop( L1D_APIcaller_id caller );
+void L1D_PTCChDown( Report *report, intx subBlock, TimeSlot timeSlotPosition, L1D_APIcaller_id caller );
+#if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1D_PTCChUp( Power txPower, TimeSlot timeSlotPosition, l1c_d_intf_params* intf_params, L1D_APIcaller_id caller);
+ #else
+void L1D_PTCChUp( Power txPower, TimeSlot timeSlotPosition , L1D_APIcaller_id caller);
+ #endif
+
+void L1D_PBCChStart( HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition );
+void L1D_PBCCh( Report *report, bool decodeUSF, L1D_APIcaller_id caller );
+void L1D_PBCChStop( L1D_APIcaller_id caller );
+
+void L1D_NPBCChStart( HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition, AfcParams *afc, L1D_APIcaller_id caller );
+void L1D_NPBCCh( Report *report, FrameNumber fn, L1D_APIcaller_id caller );
+void L1D_NPBCChStop( L1D_APIcaller_id caller );
+
+void L1D_PPChStart( HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition, L1D_APIcaller_id caller );
+void L1D_PPCh( Report *report, bool decodeUSF, L1D_APIcaller_id caller );
+void L1D_PPChStop( L1D_APIcaller_id caller );
+
+void L1D_PAGCh( Report *report, HoppingSequence *hoppingSequence, TSC tsc, TimeSlot timeSlotPosition, bool decodeUSF, L1D_APIcaller_id caller );
+
+#if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1D_PRACh( ARFCN arfcn, BSIC bsic, TimeSlot timeSlot, TimeSlot timeSlotPosition, Power txPower, RAChData rachData, intx burstLength, TSC tsc , l1c_d_intf_params* intf_params, L1D_APIcaller_id caller );
+#else
+void L1D_PRACh( ARFCN arfcn, BSIC bsic, TimeSlot timeSlot, TimeSlot timeSlotPosition, Power txPower, RAChData rachData, intx burstLength, TSC tsc, L1D_APIcaller_id caller );
+#endif
+
+ #if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1D_PollResp( HoppingSequence *hoppingSequence, BSIC bsicOrTSC, Power txPower, TimingAdvance timingAdvance, BlockData *blockData, int burstLength , l1c_d_intf_params *intf_params, L1D_APIcaller_id caller);
+ #else
+void L1D_PollResp( HoppingSequence *hoppingSequence, BSIC bsicOrTSC, Power txPower, TimingAdvance timingAdvance, BlockData *blockData, int burstLength , L1D_APIcaller_id caller);
+ #endif
+
+void L1D_PDTChStart( HoppingSequence *hoppingSequence, TSC tsc, BSIC bsic, bool egprs, L1D_APIcaller_id caller );
+#if IS_RTTI_EDGE_SUPPORT
+void L1D_PDTCh( Report *report, bool ccReset, bool egprs, bool isEven, L1D_APIcaller_id caller );
+#else
+void L1D_PDTCh( Report *report, bool ccReset, bool egprs, L1D_APIcaller_id caller );
+#endif
+void L1D_PDTChSetHoppingSequence( HoppingSequence *hoppingSequence );
+void L1D_PDTChStop( bool released, L1D_APIcaller_id caller );
+void L1D_PDTChS_StopTxProcess( int16 forceDSPTXNoProcess );
+
+void L1D_PACChDown( Report *report, HoppingSequence *hs, TSC tsc, L1D_APIcaller_id caller );
+
+void L1D_Interference( Report *report, ARFCN arfcn, L1D_APIcaller_id caller );
+
+void L1D_DChUpdateTA( uint8 timingAdvance, L1D_APIcaller_id caller );
+
+void L1D_PM_FillPMQueue( void );
+
+kal_bool L1D_FBSB_Status_Querry(char querry_mode, char SIM_index);
+
+void L1D_Suspend_PM( bool suspend, L1D_APIcaller_id caller );
+void L1D_PM_ConsumePMQueue( void );
+#if defined(__GEMINI__) && defined(__UMTS_RAT__)
+extern kal_bool UL1D_UMTS_Is_In_Dedi_Mode( void );
+#endif
+
+void L1D_GetCurrentTime( uint32 *frame_number, uint16 *tq_count );
+void L1D_MeasureMaxDuration_Start( sMTMAXTIME *data );
+void L1D_MeasureMaxDuration_Stop( sMTMAXTIME *data );
+#if IS_DUAL_CORE_MODEM_SUPPORT
+void L1D_MeasureMaxDuration_SetStopTime( sMTMAXTIME *data, int16 stop_time );
+#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
+void L1D_MeasureMaxEnd_Start( sMTMAXTIME *data );
+void L1D_MeasureMaxEnd_Stop( sMTMAXTIME *data );
+void L1D_MeasureTime_L1I_Start( void );
+void L1D_MeasureTime_L1I_Stop( void );
+void L1D_MeasureTime_L1I_Skip( void );
+
+/* --- sleep mode manager --------------------------------------------------- */
+
+void L1SM_FrameTick( uint16 *frames, uint16 *ebit );
+void L1SM_BeginCalibration( void );
+
+/* --- test mode ------------------------------------------------------------ */
+
+void L1ITST_AGCBeforeBlock( Report *report, TimeSlotMask timeSlots );
+Gain L1ITST_AGCGetGain( Report *report, ARFCN arfcn, TimeSlot timeSlot );
+#if defined(__2G_RX_DIVERSITY_PATH_SUPPORT__)
+L1D_RX_POWER L1ITST_AGCGetInputPower( Report *report, ARFCN arfcn, TimeSlot timeSlot );
+ #if IS_2G_EXTERNAL_LNA_SUPPORT
+L1D_RX_POWER L1ITST_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, BurstAfcDB *pBurstData, L1D_RX_ELNA_TYPE elna_status);
+ #else
+L1D_RX_POWER L1ITST_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, L1D_RX_POWER observedDSPOutputPower, L1D_RX_GAIN usedGain, BurstAfcDB *pBurstData );
+ #endif
+#else
+ #if IS_2G_EXTERNAL_LNA_SUPPORT
+Power L1ITST_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, Power observedDSPOutputPower, Gain usedGain, BurstAfcDB *pBurstData, MMRF_ELNA_TYPE_E elna_status );
+ #else
+Power L1ITST_AGCUpdate( Report *report, ARFCN arfcn, TimeSlot timeSlot, Power observedDSPOutputPower, Gain usedGain, BurstAfcDB *pBurstData );
+ #endif
+#endif
+void L1ITST_AGCAfterBlock( Report *report, TimeSlotMask timeSlots );
+
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+int32 L1ITST_AFCGetFBSBFreqSetting( AfcParams *p, bool beginfreqcorrection );
+#else
+uint16 L1ITST_AFCGetFBSBFreqSetting( AfcParams *p, bool beginfreqcorrection );
+#endif
+void L1ITST_AFCFBSBUpdate( AfcParams *p, intx freq_offset, intx freqcorrectionstepcnt, bool decodeOk, FrequencyBand band );
+
+void L1ITST_AFCBeforeTick( AfcParams *p );
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+int32 L1ITST_AFCGetNBFreqSetting( void );
+#else
+uint16 L1ITST_AFCGetNBFreqSetting( void );
+#endif
+void L1ITST_AFCNBUpdate( AfcUpdateParams *afcupdate, TimeSlotMask timeSlots, FrequencyBand band );
+void L1ITST_AFCAfterTick( void );
+
+bool L1ITST_MACFrameTick( PacketTransferSpec *pts );
+#if IS_DUAL_CORE_MODEM_SUPPORT
+void L1ITST_PreGetUplinkPDTCh( Report* report, kal_uint32 ul_data_index, QueryTxDataCallback *callback );
+#else
+void L1ITST_PreGetUplinkPDTCh( PrePacketUplinkSpec *ppus, Report *report );
+#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
+void L1ITST_MACSetReceivedUSF( TimeSlot timeSlot, intx usf, Report *report );
+bool L1ITST_PRAChCheckUSFFree( void );
+
+#if IS_DUAL_CORE_MODEM_SUPPORT
+void L1ITST_GetUplinkSACCh( kal_uint32 ul_data_index, QueryTxDataCallback *callback );
+void L1ITST_GetUplinkFACCh( intx flags, kal_uint32 ul_data_index, QueryTxDataCallback *callback );
+#else
+BlockData* L1ITST_GetUplinkSACCh( void );
+BlockData* L1ITST_GetUplinkFACCh( intx flags );
+#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
+BlockData* L1ITST_GetUplinkRATSCCh( intx flags ); /*AMR_ENABLE*/
+#if IS_DUAL_CORE_MODEM_SUPPORT
+void L1ITST_GetUplinkSDCCh( kal_uint32 ul_data_index, QueryTxDataCallback *callback );
+#else
+BlockData* L1ITST_GetUplinkSDCCh( void );
+#endif /* IS_DUAL_CORE_MODEM_SUPPORT */
+BlockData* L1ITST_GetUplinkCSD( intx flags );
+
+void L1D_RXWin_On( ARFCN arfcn );
+void L1D_RXWin_Off( void );
+#if defined(__EPSK_TX__)
+void L1D_RF_SetRampApcLevelEPSK( int rf_band, int power_in_dBm, int apc_dac );
+#endif
+void L1D_TXWin_On( ARFCN arfcn, uint8 modtype, uint8 powerlev );
+void L1D_TXWin_Off( void );
+void L1D_SetBBTXCfg( const sBBTXCfg *bbtx );
+void L1D_ReadBBTXCfg( sBBTXCfg *bbtx );
+intx L1D_ReadBBTXCfgVer( void );
+void L1D_RF_SetBBTXParameters( void *table );
+void L1D_RF_SetRampApcLevel( int rf_band, int power_in_dBm, int apc_dac );
+
+#if IS_EGPRS
+ #if !defined(__NEW_TBF_ARCH__)
+void L1D_SetIRParams( TFI tfi, bool dnRlcAckMode, int16 WS, bool resetIR, L1D_APIcaller_id caller );
+ #else
+void L1D_SetIRParams( uint8 idx, TFI tfi, IRParams *ir, L1D_APIcaller_id caller );
+void L1D_BackupRestore_AllVQ( uint8 ctrl, bool isNextTbfEdge, L1D_APIcaller_id caller ); // 0: restore, 1: backup
+ #endif
+ #if IS_RTTI_EDGE_SUPPORT || IS_FANR_EDGE_SUPPORT
+#define __2G_R7_L1_WORKAROUND__
+void L1D_SetULTBFParams( UpSpecParams *up, uint8 idx2 );
+ #endif
+#endif
+
+void L1D_GetBatteryMeasurementSetting( SBATMEASARG *meas_args );
+void L1D_SetBatteryVoltage( int volt );
+void L1D_SetBatteryTemperature( int temp );
+void L1D_SetRFTemperature( int temp );
+#if IS_2G_TAS_SUPPORT || IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1D_SetRFTxPowerDecrementTable_TAS( bool valid, uint8 op_code, uint8 tx_reduction_table[4][2][4], uint8 tx_reduction_table_tas[4][2][4]);
+#else
+void L1D_SetRFTxPowerDecrementTable( bool valid, uint8 op, uint8 tx_reduction_table[4][2][4] );
+#endif
+void L1D_SIM_Notify_DSP( uint8 simIndex );
+void L1D_SIM_Notify( uint8 simIndex, uint8 status, L1D_APIcaller_id caller );
+uint8 L1D_IS_GetRFTemperatureFromADC( void );
+uint8 L1D_IS_GetBatteryInfoFromADC( void );
+int32 L1D_UpdateVoltInfoPeriod( void );
+
+void L1D_VOLTCOM_Enable_in_Meta( void *data );
+void L1D_VOLTCOM_Disable_in_Meta( void *data );
+
+#if IS_TX_POWER_CONTROL_SUPPORT
+void L1D_TXPC_Enable_in_Meta( void *data );
+void L1D_TXPC_Disable_in_Meta( void *data );
+#endif
+
+#define CHECK_PM_AVAILABLE 0x00
+#define CHECK_FBM_IN_QUEUE 0x01
+#define CHECK_SBM_IN_QUEUE 0x02
+#define CHECK_IMM_IN_QUEUE 0x04
+#define CHECK_FSIWIN_USING 0x08
+#define CHECK_PM_SUSPENDED 0x10
+#define CHECK_PM_SKIPPED 0x20
+#define CHECK_ONE_PM_BYPASS 0x40
+
+/* --- Feature of Modem Hard Real Time Recovery --------------------------------------------------------- */
+
+typedef enum
+{
+ MDTR_MSG_PENDING_FLAG, /* 0*/
+ MDTR_MSG_TIMER_CONFLICT, /* 1*/
+ MDTR_MSG_L1C_TR_COMPLETE, /* 2*/
+ MDTR_MSG_32K_WRAP, /* 3*/
+ MDTR_MSG_PRE_EQ_ASSERT, /* 4*/
+ MDTR_MSG_POST_EQ_ASSERT, /* 5*/
+ MDTR_MSG_CD_DONE_ASSERT, /* 6*/
+ MDTR_MSG_PENDING_PARAMS, /* 7*/
+ MDTR_MSG_TIMING_PARAMS, /* 8*/
+ MDTR_MSG_DLY_RESUME_SET, /* 9*/
+ MDTR_MSG_DLY_RESUME_CLR, /*10*/
+ MDTR_MSG_ALIGN_FRAME /*11*/
+} MDTR_DBG_MSG;
+
+bool L1D_MDTR_TimingAbnormal(void);
+void L1D_MDTR_DebugMessage(MDTR_DBG_MSG msgID, int32 param1, int32 param2);
+void L1I_MDTR_RaisePendingFlag(void);
+void L1I_MDTR_RaiseRecoverFlag(intx frames, intx ebits);
+
+void L1_Get_Cal_Data_Download_Info( void );
+void L1T_UpdateCalibrationData( kal_uint32 cal_lid, L1dOperationMode mode );
+uint16 L1D_Check_PM_Window_Is_Available( void );
+#if IS_FORCE_ENHENCE_PM_SUPPORT
+void L1D_Set_Force_Enhence_PM(bool enable, L1D_APIcaller_id caller);
+#endif
+int16 L1D_Get_RFOnTime( void );
+
+#ifdef __SGTDS_STANDBY_AFC_TRACKING__
+Standby_AfcParams_list* L1I_GetStandbyAFCList_TDD( void );
+bool L1I_IsTDDinDedicate( void );
+bool L1I_IsSpecialGAPHandlingStarted( void );
+#ifdef __GL1_GEMINI__
+void L1I_ClearReservation_SGTDS( void );
+#endif
+#endif
+
+#ifdef __GL1_GEMINI_WCDMA__
+bool L1I_QueryAnyPLMN_BSIC_NBCCh( void );
+#endif
+
+#if IS_2G_RXD_SUPPORT
+uint16 L1D_RAS_NVRAM_LID_QUERY(void);
+#endif /* IS_2G_RXD_SUPPORT */
+
+#if IS_2G_TAS_SUPPORT||IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+ #if IS_2G_Gen95_UTAS_SUPPORT || ( CUR_GEN > MD_GEN95 )
+void L1I_AssignUTASParameters( TASPublicParams* custom_param, MMRFD_ANT_HW_LAYOUT_INFO_T* ant_hw_layout_info);
+#if IS_GSM_TX_DETECTOR_SUPPORT
+void L1I_UpdateTxDValue( Power avg_txPower_det ); //L1C->L1D
+#endif /* End of IS_GSM_TX_DETECTOR_SUPPORT*/
+ #elif IS_2G_TAS_SUPPORT
+void L1I_AssignTASParameters( TASPublicParams* public ); //L1C->L1D
+ #else
+ #endif
+uint16 L1D_TAS_NVRAM_LID_QUERY(void); //L1D->L1C
+bool L1_CheckSimMode(l1c_sim_mode_enum local_sim_mode); //L1C->L1D
+ #if IS_2G_TAS_INHERIT_4G_ANT
+bool L1I_QueryInheritAntennaFromLteBand(kal_uint8 g_band,kal_uint8* l_band); //L1C->L1D
+ #endif
+#endif
+
+#if defined(__MD93__)
+#if IS_2G_RXD_SUPPORT
+AntennaStatus L1I_QueryAntennaStatus( FrequencyBand band, l1c_sim_mode_enum local_sim_mode, uint8 *rxd_mode);
+#elif IS_2G_TAS_SUPPORT
+AntennaStatus L1I_QueryAntennaStatus( FrequencyBand band, l1c_sim_mode_enum local_sim_mode);
+#endif /*IS_2G_RXD_SUPPORT*/
+#endif /* __MD93__*/
+
+#if IS_2G_RXD_SUPPORT
+void L1I_AssignRASParameters( RASPublicParams* public ); /* for l1d to assign RAS public parameter from NVRAM */
+#endif
+
+#if IS_2G_DYNAMIC_HW_CLOCK_SUPPORT
+void L1I_AssignParameters_HW_CLOCK( L1D_RF_INTERFERENCE_ARFCN_INDICATION_T* HWClockParams );
+#endif
+
+void L1D_CheckAllGl1dActDone( Report *report, L1D_APIcaller_id caller );
+
+#if IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT
+uint8 L1D_Apply_Frequent_Wakeup(void);
+#endif /* IS_AFC_CAPABILITY_ENHANCEMENT_SUPPORT */
+
+#if IS_FAST_TIMING_ADJUST_SUPPORT
+void L1I_Set_TCh_timing_adjustment(l1c_sim_mode_enum local_sim_mode, int16 timing_adj);
+#endif
+
+/****************************************************************************
+ FUNCTION NAME: GL1_FLIGHT_MODE_SWITCH
+
+ DESCRIPTION: GL1 PERF recovery API
+
+ PARAMETERS: None
+
+ RETURNED VALUES: None
+
+*****************************************************************************/
+#define GL1_ASSERT_Reboot( st ) if(!(st)) ASSERT( 0 )
+
+#ifdef __MTK_TARGET__
+#define GL1_WARNING(expr) MODEM_WARNING_MESSAGE( expr )
+
+#if defined(__GL1_GEMINI__)
+#define GL1_FLIGHT_MODE_SWITCH \
+{ \
+ protocol_exception_recovery_info_struct info; \
+ info.protocol_id = l1c_sim_mode; \
+ info.disable_escalate_recovery = KAL_TRUE; \
+ info.debug.p_buf = NULL; \
+ info.debug.size = 0; \
+ PROTOCOL_EXCEPTION_RECOVERY( MOD_L1, RECOVERY_TYPE_FLIGHT_MODE, &info );\
+}
+#else
+#define GL1_FLIGHT_MODE_SWITCH \
+{ \
+ protocol_exception_recovery_info_struct info; \
+ info.protocol_id = 0; \
+ info.disable_escalate_recovery = KAL_TRUE; \
+ info.debug.p_buf = NULL; \
+ info.debug.size = 0; \
+ PROTOCOL_EXCEPTION_RECOVERY( MOD_L1, RECOVERY_TYPE_FLIGHT_MODE, &info );\
+}
+#endif /* End of defined(__GL1_GEMINI__)*/
+#else /* XlSIM*/
+#define GL1_WARNING(expr) GL1_ASSERT_Reboot( expr )
+#define GL1_FLIGHT_MODE_SWITCH (void)0
+#endif /* __MTK_TARGET__ */
+
+#endif /*l1_generic_l1_public_h*/
diff --git a/mcu/l1/interface/gl1/l1_rtb_timertype.h b/mcu/l1/interface/gl1/l1_rtb_timertype.h
new file mode 100644
index 0000000..5f227ba
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_rtb_timertype.h
@@ -0,0 +1,105 @@
+/*****************************************************************************
+* 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_rtb_timertype.h
+ *
+ * Project:
+ * --------
+ * Umoly_Software
+ *
+ * Description:
+ * ------------
+ * Real Time Base for MM Gemini project
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ * $Log$
+ *
+ * 05 30 2019 priyanshi.jain
+ * [MOLY00402003] [VMOLY] GEMINI N+L DSDS
+ * DSDS Phase-1 changes
+ *
+ * 07 03 2015 terence.chen
+ * [MOLY00124313] Change the path of l1_rtb.h and check-in the code of SRLTE
+ * <saved by Perforce>
+ *
+ * 06 05 2015 arkadeep.sett
+ * Created header file to move RTB timer definitions
+ */
+#ifndef L1_RTB_TIMERTYPE_H
+#define L1_RTB_TIMERTYPE_H
+
+
+#define MERGE_STR(x,y) x##y /* ex : if x=123 and y=456, then MERGE_STR(x,y)=123456 */
+#define L1_TIMER_TYPE(x) MERGE_STR(rG,x) /* ex : if x=TimerNone, then MERGE_STR(rG,x)=rGTimerNone */
+#define UL1_TIMER_TYPE(x) MERGE_STR(r,x)
+#define TL1_TIMER_TYPE(x) MERGE_STR(r,x)
+#define EL1_TIMER_TYPE(x) MERGE_STR(r,x)
+#define CL1_TIMER_TYPE(x) MERGE_STR(r,x)
+#define NL1_TIMER_TYPE(x) MERGE_STR(r,x)
+
+/* Define timertype in l1_rtb.c; otherwise, the module which included l1_rtb.h may have build error. */
+typedef enum
+{
+ rTimerInit = -1,
+ #include "l1_timertype.h"
+ #include "ul1_timertype.h"
+ #include "tl1_timertype.h"
+ #include "el1_timertype.h"
+ #include "cl1_timertype.h"
+#if defined(__NR_RAT__)
+ #include "nl1_rx_timertype_public.h"
+#else
+ NL1_TIMER_TYPE( NTIMER_NONE ), // NTIMER_NONE must be the first timer name. (RTB interface requirement)
+ NL1_TIMER_TYPE( NTIMER_END ), // NTIMER_END must be the last timer name. (RTB interface requirement)
+#endif
+ rTimerNum
+}rTimerType;
+
+#undef MERGE_STR
+#undef L1_TIMER_TYPE
+#undef UL1_TIMER_TYPE
+#undef TL1_TIMER_TYPE
+#undef EL1_TIMER_TYPE
+#undef CL1_TIMER_TYPE
+#undef NL1_TIMER_TYPE
+
+#endif
diff --git a/mcu/l1/interface/gl1/l1_surround_private.h b/mcu/l1/interface/gl1/l1_surround_private.h
new file mode 100644
index 0000000..f4119d8
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_surround_private.h
@@ -0,0 +1,740 @@
+/*****************************************************************************
+* 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_surround_private.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * Surround cell handling private stuff.
+ *
+ * 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!
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#ifndef l1_generic_l1_surround_private_h
+#define l1_generic_l1_surround_private_h
+
+#include "l1_core_private.h"
+#include "tool.h"
+#include "l1_types.h"
+#include "mph_types.h"
+#include "l1d_cid.h"
+#include "kal_general_types.h"
+
+#if 1 //__NORMAL_NW_SEARCH__
+
+#define MAX_MANUAL_IDLE_CELLS 12
+#define MAX_TRIES_FB_PLMN 2
+
+#else
+/* under construction !*/
+/* under construction !*/
+/* under construction !*/
+#endif
+
+#if IS_GSM_EM_TX_POWER_CONTROL_SUPPORT
+
+typedef struct
+{
+ PowerControlLevel UserPCLevel ;
+ FrequencyBand UserBand;
+ uint8 mode;
+ bool valid;
+ FrequencyBand Serving_band;
+ PowerControlLevel NetworkPCLevel;
+ Power CurrentPower;
+ #ifdef __EPSK_TX__
+ Power CurrentPowerEPSK;
+ #endif
+ uint32 apc_dac;
+} force_pcl_struct;
+
+#endif
+
+#define MAX_BSIC_QUEUE_COUNT 32
+#define MAX_IDLE_QUEUE_CELLS MAX_MANUAL_IDLE_CELLS + 6
+#ifdef __GL1_MULTI_MODE__
+#define MAX_STANDBY_QUEUE_CELLS MAX_IDLE_QUEUE_CELLS
+#endif
+#ifdef __GL1_MULTI_MODE__
+//#define MAX_TRIES_FB 2 // for sim1
+#define MAX_TRIES_FB ((IS_SIM1)?(2):(1))
+#else
+#define MAX_TRIES_FB 1
+#endif
+#define MAX_TRIES_SB 3
+#define MAX_TRIES_EXT_FB 1
+
+EXTERN_TRACE_CLASS( tcSC );
+EXTERN_TRACE_CLASS( tcSC_FB );
+EXTERN_TRACE_CLASS( tcSC_SB );
+EXTERN_TRACE_CLASS( tcSC_SI );
+
+typedef struct
+{
+ bool bsicKnown;
+ bool queueing;
+ bool manual;
+ bool retry_FB_SB;
+ bool short_FB;
+ bool extended;
+#if 1 //__NORMAL_NW_SEARCH__
+ bool FreqCorrect;
+#endif
+ /* number of current try when receiving (starts with zero) */
+ uint8 tryNo;
+ /* add this to distinguish from different req but for internal */
+ uint8 tid;
+
+ SurroundBS* bs;
+ Time lag; /* only valid if bsicKnown == true */
+
+#ifdef __GL1_MULTI_MODE__ // Only for SIM1
+ bool hp_sb_valid;
+ kal_uint16 hp_sb_pos;
+ /* For 3G in DCH/FACH mode, 25.133 defines Treconf_FACH, Tidentify_FACH, Treconf_DCH.
+ For 3G in PCH mode, we will use tryNo, MAX_TRIES_FB, MAX_TRIES_SB. */
+ TimeStamp start_timeStamp;
+ bool use_reconfirm_drop_cell_criterion; /* For init BSIC, it is false. For reconfirm BSIC, its is true. This field is only valid for DCH/FACH mode. */
+ TimeStamp timeStamp;
+#endif
+#ifdef __GL1_MULTI_MODE__
+ bool is_cgi;
+ bool is_enhanced_bsic;
+#ifdef __GL1_GEMINI_WCDMA__
+ bool is_PLMNList;
+#endif
+#endif
+} scCellBSIC;
+
+#ifdef __GL1_MULTI_MODE__
+typedef struct
+{
+ bool hp_sb_valid;
+ kal_uint16 hp_sb_pos;
+ TimeStamp start_timeStamp;
+ Time lag;
+ uint8 tryNo;
+} scCellBSICHpSBInfo;
+#endif
+
+typedef struct
+{
+ BSIC bsic; /* only valid if bsicKnown == true */
+
+ bool bsicKnown;
+
+ bool queueing;
+ bool manual;
+ bool is_prior_to_acquire;
+ /* number of current try when receiving (starts with zero) */
+ uint8 bcchTryNo;
+#ifdef __GL1_GEMINI__
+ uint16 priority_index;
+#else
+ uint8 priority_index;
+#endif
+ /* mask specifying which BCCh blocks to receive. Only valid in idle mode */
+ uint16 bcchMask; /* bit 0..7: BCCh normal, bit 8..15: BCCh ext */
+ uint16 penalty;
+
+ SurroundBS* bs;
+ Time lag; /* only valid if bsicKnown == true */
+#ifdef __GL1_MULTI_MODE__
+ bool is_cgi;
+#endif
+#ifdef __GL1_GEMINI_WCDMA__
+ bool is_PLMNList;
+#endif
+} scCellBCCH;
+
+typedef struct
+{
+ uint8 queueCnt;
+ scCellBSIC queue[32];
+} BsicCellQueue;
+
+
+typedef struct
+{
+ bool use_priority_index_order;
+ uint8 queueCnt;
+ scCellBCCH queue[MAX_IDLE_QUEUE_CELLS];
+} BcchCellQueue;
+
+
+typedef struct
+{
+ /* true if suspended and not allowed to receive FCB, SB or BCCh */
+ bool suspended;
+
+ /* MAUI_02615979: Clear ncPower when the first ReportSurroundMeasurement after NC meas. report sent is received */
+ bool ncReportCanClear; // True: after NC meas. report sent
+
+ /* the serving cell */
+
+ bool GPRSFlag; /* distinguish TCH or Packet transfer mode*/
+#ifdef __GL1_GEMINI__
+ bool IsVirtualMode;
+#endif
+
+ SurroundMode mode;
+ SurroundMode oldmode;
+ SurroundMode FreeHSmode; /* used to trigger HS free procedure, Reset is default mode */
+
+//#if ( defined( __L1_GPS_AUTO_TIMING_SYNC_SUPPORT__ ) || defined( __L1_GPS_REF_TIME_SUPPORT__ ) )
+ BSIC servingCellBSIC;
+//#endif
+
+ TimeSlot timeSlot;
+ TimeSlot startTimeSlot;
+ bool slotDiff;
+ bool SetSyncBCChinNull; /* Rick: To distinguish if SIM did the specific sync BCCh in null mode or not */
+
+ ARFCN servingCellARFCN;
+ intx sacchPosition; /* position of the SACCh. 0=>12, 1=>25, 2=>38 ... */
+
+
+ /* set while a receive is in progress */
+
+ scCellBSIC* receivingCell; /* NULL if no receive active */
+ scCellBCCH* bcchReceivingCell; /* NULL if no receive active */
+ void ( *abortReceive )( void ); /* function to abort receive, only valid if receivingCell != NULL */
+
+#ifdef __GL1_MULTI_MODE__ // Only for SIM1
+ uint8 ( *abortReceive_dm )( void ); /* function to abort receive, only valid if receivingCell != NULL */
+ bool gapfor3g;
+ uint8 RLAcount;
+ bool dmResetMode;
+ bool marginForTD;
+
+#ifdef __GERAN_R8__
+ SurroundBAList* BAList_higher;
+#endif /* __GERAN_R8__ */
+#endif
+
+ /* BA list for this reporting period */
+ SurroundBAList* BAList;
+
+ BsicCellQueue bsic;
+ BcchCellQueue bcch;
+
+ PowerAverager servingAvg;
+#if (IS_CHIP_MT6227_AND_LATTER_VERSION || IS_EDGE_CHIP_MT6229_AND_LATTER_VERSION)
+ uint8 dcmHandle;
+#endif
+} SurroundGlobals;
+
+#ifdef __GL1_GEMINI__
+#define scGlobals scGlobals_database[l1c_sim_mode]
+#define local_scGlobals scGlobals_database[local_sim_mode]
+extern SurroundGlobals scGlobals_database[L1C_SIM_NUM];
+ #ifdef __BSIC_SEARCH_IN_PEER_IDLE_FRAME__
+#define mainSIM_scGlobals scGlobals_database[mainSimIdx]
+extern l1c_sim_mode_enum mainSimIdx; /*In Gemini2.0, it is the SIM which is in PTM. */
+ #endif /*__BSIC_SEARCH_IN_PEER_IDLE_FRAME__*/
+#else
+#define local_scGlobals scGlobals
+extern SurroundGlobals scGlobals;
+#endif
+
+/* m11280.c */
+#if defined (__GL1_GEMINI__) && defined(__BSIC_SEARCH_IN_PEER_IDLE_FRAME__)
+FrameNumber L1I_GetNextFN_MainSIM( TimeSlot timeSlot, intx* syncEBits);
+void L1I_GetTime_MainSIM(Time* time);
+bool L1I_QueryBsicSearchInPeerIdleFrame(void);
+void L1T_SurroundBSICRestart_SIMx(l1c_sim_mode_enum sim_idx);
+#endif /*__GL1_GEMINI__ && __BSIC_SEARCH_IN_PEER_IDLE_FRAME__*/
+
+/* m11281.c */
+#if defined( __GL1_MULTI_MODE__ ) && defined( __GERAN_R8__ )
+void L1T_SurroundBAlistInit( kal_bool is_higher_priority );
+#else
+void L1T_SurroundBAlistInit( void );
+#endif /* __GL1_MULTI_MODE__ && __GERAN_R8__ */
+void L1T_SurroundBAlistExit( void );
+void L1T_SurroundClearBAList( void );
+void L1T_SurroundClearQueue( void );
+
+ScanList* L1T_SurroundGetScanList( void );
+ScanList* L1T_SurroundGetNewScanList( void );
+ScanList* L1I_CreateScanList_SISR( void );
+
+
+bool L1T_SurroundSetPendingBAList( SurroundBAList* BAList );
+void L1T_SurroundUsePendingBAList( void );
+
+void L1T_SurroundResetPowerAveragers( void );
+void L1T_SurroundUpdateAveragers( ScanList* scanList );
+
+void L1T_SurroundAveragersAverageWithLast( ScanList* scanList );
+void L1T_SurroundUpdateRxPower( ScanList* scanList );
+void L1T_SurroundUpdateRxPowerFromAveragers( void );
+
+void L1T_SurroundClearNCPower( void );
+void L1T_SurroundNormaliseNCPower( void );
+void L1T_SurroundSendRLAReport( void );
+void L1T_SurroundSendNCReport( void );
+
+/* m11282.c */
+
+void L1T_SurroundEnterIdle( void );
+void L1T_SurroundLeaveIdle( bool stopMeas );
+void L1T_SurroundMeasurementsDoneIdle( ScanList* scanList );
+void L1T_SurroundSetBAListIdle( SurroundBAList* BAList );
+#ifdef __GL1_MULTI_MODE__
+void L1T_SurroundSendGSMRSSIReport( void );
+void L1T_SurroundSetBAListStandby( SurroundBAList* BAList );
+void L1T_SurroundResetBSICSearchTime( bool ResetInitBSIC, bool ResetReconfBSIC );
+void L1T_SurroundSChDoneStandby( scCellBSIC* cell, SChData* sch );
+void L1T_SurroundBCChDoneStandby( scCellBCCH* cell, RxData* bcch, bool next );
+void L1T_SurroundResumeStandby( void );
+#endif
+void L1T_SurroundSChDoneIdle( scCellBSIC* cell, SChData* sch );
+void L1T_SurroundBCChDoneIdle( scCellBCCH* cell, RxData* bcch, bool next );
+void L1T_SurroundReportTickIdle( void );
+void L1T_SurroundResumeIdle( void );
+void L1T_SurroundBSICIdleReq( const SCBsicInfo* sc );
+void L1T_SurroundBCChIdleReq( const SCBcchInfo* sc );
+void L1T_SurroundBSICIdleStop( const SCBsicStopInfo* sc );
+void L1T_SurroundBCChIdleStop( const SCBcchStopInfo* sc );
+#ifdef __GL1_MULTI_MODE__
+void L1T_SurroundBSICStandbyReq( const SCBsicInfo* sc );
+void L1T_SurroundBSICStandbyStop( const SCBsicStopInfo* sc );
+void L1T_NextBSICStandby( void );
+void L1T_NextBSICStandby_Report( Report* report );
+void L1I_NextBSICStandby(void);
+void L1T_Next_BSICSC_Report(Report* report);
+void L1T_SurroundBCChStandbyReq( const SCBcchInfo* sc );
+void L1T_SurroundBCChStandbyStop( const SCBcchStopInfo* sc );
+void L1T_NextBCChStandby( void );
+void L1T_NextBCChStandby_Report( Report* report );
+void L1I_NextBCChStandby( void );
+#endif
+void L1T_NextBSICIdle( void );
+int32 L1T_SurroundPagingBlocksPerPeriodIdle( int32 framesPerPeriod );
+//void L1T_SurroundClearManualList( void ); /* move to l1_core.h for BLindHO*/
+/* m11284.c */
+
+void L1T_SurroundEnterDedi( void );
+void L1T_SurroundLeaveDedi( void );
+void L1T_SurroundMeasurementsDoneDedi( ScanList* scanList );
+void L1T_SurroundSetBAListDedi( SurroundBAList* BAList );
+void L1T_SurroundUpdateCellFlagsDedi( void );
+void L1T_SurroundNextBSICDedi( void );
+void L1T_SurroundSChDoneDedi( scCellBSIC* cell, SChData* sch );
+void L1T_SurroundResumeDedi( void );
+void L1T_SurroundReportTickDedi( void );
+void L1T_SurroundSChDoneDedi( scCellBSIC* cell, SChData* sch );
+void L1T_SurroundBSICDediReq( const SCBsicInfo* sc );
+void L1T_SurroundBSICDediStop( const SCBsicStopInfo* sc );
+bool L1I_QueryAnyBSIC( void );
+
+/* m11285.c */
+
+void L1T_SurroundEnterDediSDCCh( void );
+void L1T_SurroundLeaveDediSDCCh( void );
+void L1T_SurroundMeasurementsDoneDediSDCCh( ScanList* scanList );
+
+/* m11286.c */
+
+void L1T_SurroundEnterDediTCh( void );
+void L1T_SurroundLeaveDediTCh( void );
+#ifdef __GL1_MULTI_MODE__
+void L1T_SurroundStopDediSC( void );
+void L1T_SurroundStopPacketTransferSC( void );
+#endif
+void L1T_SurroundMeasurementsDoneDediTCh( ScanList* scanList );
+
+/* m11287.c */
+#ifdef __PS_SERVICE__
+void L1T_StartMeasurement( void );
+void L1T_SurroundEnterPacketIdle( SurroundMode oldMode );
+void L1T_SurroundLeavePacketIdle( void );
+void L1T_SurroundMeasurementsDonePacketIdle( ScanList* scanList );
+void L1T_SurroundSetBAListPacketIdle( SurroundBAList* BAList );
+void L1T_SurroundSChDonePacketIdle( scCellBSIC* cell, SChData* sch );
+void L1T_SurroundReportTickPacketIdle( void );
+void L1T_SurroundResumePacketIdle( void );
+void L1T_SurroundPagingBlockTickPacketIdle( bool isPPCh );
+void L1T_SurroundNextBSICPacketIdle( void );
+int32 L1T_SurroundPagingBlocksPerPeriodPacketIdle( int32 framesPerPeriod );
+void L1T_SurroundFramesPerPeriodPacketIdle( int32 period );
+void L1T_UpdateMeasurementDuration( void );
+
+/* m11288.c */
+
+void L1T_SurroundEnterPacketTransfer( void );
+void L1T_SurroundLeavePacketTransfer( void );
+void L1T_SurroundMeasurementsDonePacketTransfer( ScanList* scanList );
+void L1T_SurroundSetBAListPacketTransfer( SurroundBAList* BAList );
+void L1T_SurroundSChDonePacketTransfer( scCellBSIC* cell, SChData* sch );
+void L1T_SurroundBCChDonePacketTransfer( scCellBCCH* cell, RxData* bcch );
+#endif
+/* m11289.c */
+
+void L1T_SurroundReceiveFCCh( scCellBSIC* cell );
+void L1T_SurroundReceiveSCh( scCellBSIC* cell );
+void L1T_SurroundAbortReceive( void );
+void L1T_SurroundReceiveBCCh( scCellBCCH* cell, NBCChPriority priority );
+void L1T_SurroundAbortBCChReceive( void );
+FrameNumber L1T_SurroundGetFN( void );
+void L1T_SurroundAbortReceiveOfRemovedCells( void );
+
+
+/* m11291.c */
+#ifdef __PS_SERVICE__
+#ifdef __PKT_EXT_MEAS__
+void L1T_SurroundNextBSICExtMeas( void );
+void L1T_SurroundReportExtendedMeasurement( void );
+void L1T_SurroundSChDoneExtendedMeasurement( SChData* sch );
+#endif
+void L1T_SurroundNCReport( void );
+void L1T_SurroundTickExtMeas( void );
+#endif
+#endif
diff --git a/mcu/l1/interface/gl1/l1_timertype.h b/mcu/l1/interface/gl1/l1_timertype.h
new file mode 100644
index 0000000..9bac4ad
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_timertype.h
@@ -0,0 +1,231 @@
+/*******************************************************************************
+* Modification Notice:
+* --------------------------
+* This software is modified by MediaTek Inc. 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_timertype.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * Define 2G L1 timertype
+ *
+ * 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!
+ *
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+L1_TIMER_TYPE(TimerNone),
+L1_TIMER_TYPE(TimerFullScan),
+L1_TIMER_TYPE(TimerFCBSearch),
+L1_TIMER_TYPE(TimerBCChNorm),
+L1_TIMER_TYPE(TimerBCChExt),
+L1_TIMER_TYPE(TimerPChNorm),
+L1_TIMER_TYPE(TimerPChExt),
+L1_TIMER_TYPE(TimerCBChNorm),
+L1_TIMER_TYPE(TimerCBChExt),
+L1_TIMER_TYPE(TimerSB),
+L1_TIMER_TYPE(TimerNBCChNorm),
+L1_TIMER_TYPE(TimerNBCChExt),
+L1_TIMER_TYPE(TimerNBCChSC),
+L1_TIMER_TYPE(TimerAGCh),
+L1_TIMER_TYPE(TimerRACh),
+L1_TIMER_TYPE(TimerDChStart),
+L1_TIMER_TYPE(TimerDChStop),
+L1_TIMER_TYPE(TimerHs),
+L1_TIMER_TYPE(TimerTCh),
+L1_TIMER_TYPE(TimerSACChT),
+L1_TIMER_TYPE(TimerSDCChUp),
+L1_TIMER_TYPE(TimerSDCChDn),
+L1_TIMER_TYPE(TimerSACChUp),
+L1_TIMER_TYPE(TimerSACChDn),
+L1_TIMER_TYPE(TimerFCBT),
+L1_TIMER_TYPE(TimerSBT),
+L1_TIMER_TYPE(TimerPwrCtrl),
+L1_TIMER_TYPE(TimerReportPeriod),
+L1_TIMER_TYPE(TimerCM),
+L1_TIMER_TYPE(TimerPBCCh),
+L1_TIMER_TYPE(TimerNPBCCh),
+L1_TIMER_TYPE(TimerPPChNorm),
+L1_TIMER_TYPE(TimerPPChExt),
+L1_TIMER_TYPE(TimerSurroundMeasurement),
+L1_TIMER_TYPE(TimerPAGCh),
+L1_TIMER_TYPE(TimerPRACh),
+L1_TIMER_TYPE(TimerTBFStart),
+L1_TIMER_TYPE(TimerTBFStop),
+L1_TIMER_TYPE(TimerPDCh),
+L1_TIMER_TYPE(TimerReportPDCh),
+L1_TIMER_TYPE(TimerPTCChDown),
+L1_TIMER_TYPE(TimerPTCChUp),
+L1_TIMER_TYPE(TimerIM),
+L1_TIMER_TYPE(TimerPOLLRESP),
+L1_TIMER_TYPE(TimerSingleDL),
+L1_TIMER_TYPE(TimerSingleULTwoPhase),
+L1_TIMER_TYPE(TimerSingleULWithoutTBF),
+L1_TIMER_TYPE(TimerRATSCChDL),
+L1_TIMER_TYPE(TimerRATSCChUL),
+L1_TIMER_TYPE(TimerReset),
+L1_TIMER_TYPE(TimerTickL2),
+L1_TIMER_TYPE(TimerPeek), //SM_WAKEUP_COMPENSATION
+L1_TIMER_TYPE(TimerNCReport),
+L1_TIMER_TYPE(TimerStopAllChannel),
+L1_TIMER_TYPE(TimerSuspend),
+L1_TIMER_TYPE(TimerGAP),
+L1_TIMER_TYPE(TimerSB_DM),
+L1_TIMER_TYPE(TimerFB_DM),
+L1_TIMER_TYPE(TimerTick),
+L1_TIMER_TYPE(Timer3G_Search),
+L1_TIMER_TYPE(TimerGAP_Stop),
+L1_TIMER_TYPE(TimerBSICSC_DM), /* For L1C/SC internal use. */
+L1_TIMER_TYPE(TimerStandbyDone),
+L1_TIMER_TYPE(TimerIRATSYNC_DM),
+L1_TIMER_TYPE(TimerDTS),
+L1_TIMER_TYPE(TimerUTS),
+L1_TIMER_TYPE(TimerNSFT),
+L1_TIMER_TYPE(TimerLoopback),
+L1_TIMER_TYPE(TimerL1AGps),
+L1_TIMER_TYPE(TimerServingSB),
+L1_TIMER_TYPE(TimerSendGapEnd),
+L1_TIMER_TYPE(TimerActiveRAT),
+L1_TIMER_TYPE(TimerStandby),
+L1_TIMER_TYPE(TimerSuspendPM),
+L1_TIMER_TYPE(TimerGapReport),
+L1_TIMER_TYPE(TimerTickGAP),
+L1_TIMER_TYPE(TimerSuspendGAPPM),
+L1_TIMER_TYPE(TimerSuspnedPwrScan),
+L1_TIMER_TYPE(TimerSuspendBA),
+L1_TIMER_TYPE(TimerSuspendPwrScanCGI),
+L1_TIMER_TYPE(TimerSuspendDedi2G),
+L1_TIMER_TYPE(TimerFCChWinOff),
+L1_TIMER_TYPE(TimerAutoGAP), //for GSM active auto gap
+L1_TIMER_TYPE(TimerReportAutoGAP), //for GSM active auto gap start report
+L1_TIMER_TYPE(TimerCGIPowerScan), //for CGI scan in GSMAutoGAP
+L1_TIMER_TYPE(TimerCGIFCBSearch), //for BSIC in GSMAutoGAP
+L1_TIMER_TYPE(TimerCGINBCChNorm), //for NBCCh in GSMAutoGAP
+L1_TIMER_TYPE(TimerCGINBCChExt), //for NBCCh in GSMAutoGAP
+L1_TIMER_TYPE(TimerGSMAutoGAPStop), //to stop GSM auto gap
+L1_TIMER_TYPE(TimerGSMAutoGAPEnd), //to send auto gap end
+L1_TIMER_TYPE(TimerGAP_PM),
+L1_TIMER_TYPE(TimerGAP_Suspend),
+L1_TIMER_TYPE(TimerUTSStop),
+L1_TIMER_TYPE(TimerTSTSDCChUp),
+L1_TIMER_TYPE(TimerTSTSDCChPauseDTIRQ),
+L1_TIMER_TYPE(TimerTSTDChStop),
+L1_TIMER_TYPE(TimerMetaPDCh),
+L1_TIMER_TYPE(TimerMetaPdtchPauseDTIRQ),
+L1_TIMER_TYPE(TimerMetaPdtchStop),
+L1_TIMER_TYPE(TimerGAP_PowerScan),
+L1_TIMER_TYPE(TimerDUMMYFB_DM),
+L1_TIMER_TYPE(TimerSRVCCGapSet),
+L1_TIMER_TYPE(TimerSRVCCGapReset),
+L1_TIMER_TYPE(TimerVirtualSuspendCnf),
+L1_TIMER_TYPE(TimerEnd),
diff --git a/mcu/l1/interface/gl1/l1_tool.h b/mcu/l1/interface/gl1/l1_tool.h
new file mode 100644
index 0000000..a21f9d2
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1_tool.h
@@ -0,0 +1,509 @@
+/*******************************************************************************
+* Modification Notice:
+* --------------------------
+* This software is modified by MediaTek Inc. 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_tool.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * Layer1 core global tools
+ *
+ * Author:
+ * -------
+ * -------
+ * -------
+ *
+ *------------------------------------------------------------------------------
+ * $Revision: 1.11 $
+ * $Modtime: Jul 19 2005 17:19:28 $
+ * $Log: //mtkvs01/vmdata/Maui_sw/archives/mcu/l1/common/l1_tool.h-arc $
+ *
+ * 06 04 2018 priyanshi.jain
+ * [MOLY00330249] ELT????-???? GSM?????? SNR?
+ *
+ * UMOLYE Real SNR
+ *
+ * 12 18 2015 terence.chen
+ * [MOLY00153957] [UMOLY] Sync code from LR11 to UMOLY
+ * Sync GL1A/C and RTB code from LR11.
+ *
+ * 12 04 2014 rick.wu
+ * [MOLY00083549] [MT6291] Merge GL1 codes from MT6291_DEV to UMOLY
+ * Fix build error
+ *
+ * 05 23 2014 rick.wu
+ * [MOLY00063424] [TK6291][L1S][GL1AC] U3G code check in for L1S load
+ * .
+ *
+ * 01 23 2014 rick.wu
+ * [MOLY00054324] [4G Gemini][Merge] MOLY.MM.GEMINI.DEV Merge back to MOLY
+ * .
+ *
+ * 01 22 2014 hsin-chun.chen
+ * [MOLY00054353] Mapping GAS_n to GL1_n in SGLTE and SGLTE DSDS in accordance with MM.GEMINI check in
+ * <saved by Perforce>
+ *
+ * 03 19 2012 william.lin
+ * removed!
+ * .
+ *
+ * 03 13 2012 william.lin
+ * removed!
+ * .
+ *
+ * 03 12 2012 william.lin
+ * removed!
+ * .
+ *
+ * 01 17 2012 william.lin
+ * removed!
+ * .
+ *
+ * 06 08 2011 samuel.yang
+ * removed!
+ * .
+ *
+ * 06 08 2011 jp.lien
+ * removed!
+ * .
+ *
+ * 04 12 2011 sy.yeh
+ * removed!
+ * .
+ *
+ * 02 07 2011 yr.chiang
+ * removed!
+ * .
+ *
+ * 12 15 2010 jp.lien
+ * removed!
+ * .
+ *
+ * 12 15 2010 chang-kuan.lin
+ * removed!
+ * .
+ *
+ * 08 08 2010 yr.chiang
+ * removed!
+ * .
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ * Fix L1D build warnings for RVCT31
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ * For L1D code revision
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ * add to source control recursely
+ *
+ * removed!
+ * removed!
+ * Seperate l1_tool.h to l1_tool.h + tool.h
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * removed!
+ * removed!
+ * Checkin L1C dual mode source codes
+ *
+ * removed!
+ * removed!
+ *
+ *
+ * Rev 1.11 Jul 19 2005 17:24:20 mtk00674
+ * Fix compile error in simulation for AMR to add MT6228 / MT6227 compile option
+ * Resolution for 12011: [L1C][update] For AMR simulation tp add MT6228 / MT6227 compile option
+ *
+ * Rev 1.10 May 17 2005 00:33:12 BM_Trunk
+ * Karlos:
+ * add copyright and disclaimer statement
+ *
+ * Rev 1.9 Jan 26 2005 17:47:16 mtk00248
+ * Add ScanInt8 and ScanInt8Range.
+ *
+ * Rev 1.8 Jan 18 2005 00:37:12 BM
+ * append new line in W05.04
+ *
+ * Rev 1.7 May 03 2004 17:41:38 mtk00474
+ * Reason:
+ * for L1A simulation environment
+ * Solution:
+ * Add ASSERT before kal_mem_cpy to avoid copy the non-sense freq. list members to L1C
+ * Sync. some parameters of some sub-routines of simulated-files to real files.
+ * Verify:
+ * Run the simulation tool
+ *
+ * Resolution for 5259: update L1A simulation environment
+ *
+ * Rev 1.6 May 22 2003 17:25:56 mtk00274
+ * Add L1_PowerAveragerPutPt to calculate one second running average in packet transfer mode.
+ * Resolution for 1606: [L1C][Update]Add TA value debug code on PTCCH channel handler.
+ *
+ * Rev 1.5 05 Mar 2003 14:42:42 mtk00276
+ * Not to use "__HW_DIVIDER__" compile option.
+ * Resolution for 1125: Dividers checkin
+ *
+ * Rev 1.4 03 Mar 2003 17:52:48 mtk00276
+ * Divider checkin
+ * Resolution for 1125: Dividers checkin
+ *
+ * Rev 1.3 03 Mar 2003 17:26:04 mtk00276
+ * Divider checkin
+ * Resolution for 1125: Dividers checkin
+ *
+ * Rev 1.2 03 Mar 2003 17:23:08 mtk00276
+ * Divider checkin.
+ * Resolution for 1125: Dividers checkin
+ *
+ * Rev 1.1 28 Jan 2003 10:54:06 mtk00276
+ * Add check SIM function for turbo sleep mode and smart HO mechanism. If test SIM presents(or SIM type unknown), we
+ * shall disable turbo sleep mode(not to delay report handling),
+ * and shall not enable smart HO mechanism.
+ * Resolution for 774: Add check SIM function for turbo sleep mode and smart HO mechanism
+ *
+ * Rev 1.0 Nov 30 2002 19:50:14 admin
+ * Initial revision.
+ *
+ * Rev 1.2 20 Sep 2002 14:54:48 mtk00248
+ * Add compile option to the following code:
+ * void ConsolePrintf( const char* format, ... );
+ * void ConsoleVPrintf( const char* format, va_list args );
+ * void ConsoleFlush( void );
+ * void ConsolePutchar( char c );
+ *
+ * Rev 1.1 11 Sep 2002 16:02:08 mtk00274
+ * Merge Albert's code.
+ *
+ * Rev 1.0 Sep 06 2002 11:18:58 admin
+ * Initial revision.
+ *
+ * Rev 1.5 Jul 04 2002 23:35:00 mtk00210
+ * Enhance L1 assert and display message on LCD on target environment
+ *
+ * Rev 1.4 Apr 29 2002 08:58:28 mtk00274
+ * Send ReportReportPeriodDone when first PCH is received to resolve GSM11.10 test case 20.6
+ *
+ * Rev 1.3 Jan 24 2002 15:21:12 mtk00274
+ * Fix the data type of L1_PowerAveragerGet() from int16 to int32
+ *
+ * Rev 1.2 Jan 03 2002 11:52:26 mtk00210
+ * merge the branch B.L1.20011225
+ *
+ * Rev 1.1.1.1 Dec 27 2001 10:52:48 mtk00210
+ * correct author
+ *
+ * Rev 1.1.1.0 Dec 25 2001 16:40:20 mtk00210
+ * revise L1 for RSSI, multiband AFC, new L1D/L1C interface,
+ * and new CBCH handler
+ *
+ * Rev 1.1 Dec 21 2001 12:17:42 admin
+ * add copyright
+ *
+ *
+ *******************************************************************************/
+
+/******************************************************************************
+ *
+ * File: /MTKteam/source/gprsmtk/l1/generic/SCCS/s.l1_tool.h
+ * -----
+ *
+ * SCCS Version: 2.14
+ * -------------
+ *
+ * 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 Communications Consultants Worldwide Limited (C) 2001
+ *
+ * Project:
+ * --------
+ *
+ * Software Unit: Layer1 core global tools.
+ * --------------
+ *
+ * Description:
+ * ------------
+ *
+ *
+ * Modification History:
+ * ---------------------
+ * Date Vers Auth Details
+ * ---- ---- ---- -------
+ * 28-Mar-01 2.1 VKL Initial version
+ * 17-Apr-01 2.2 VKL added L1_FrameNumberMod52 and L1_FrameNumberDiv
+ * 25-Apr-01 2.3 APB Add PromoteScriptHandler()
+ * 27-Apr-01 2.4 VKL Moved ring buffer handling from
+ * generic/l1_core_private.h to generic/l1_tool.h
+ * Moved hardware read and write macros from
+ * simulation/generic/simul_public.h to
+ * generic/l1_tool.h
+ * Fixed L1_FrameNumberDiv1326()
+ * 01-May-01 2.5 VKL Simplify RB_COUNT
+ * 21-May-01 2.6 VKL added L1_FrameNumberDiv52
+ * 1-May-01 2.7 APB Add ScanPrintChk() reference
+ * 15-Jul-01 2.8 VKL Added L1_FrameNumberMod104()
+ * 21-Sep-01 2.9 VKL Added RB_PEEK and RB_CONSUME
+ * 1-Oct-01 2.10 SGB Fix merge error
+ * 1-Oct-01 2.11 VKL Add ScanTSC()
+ * 11-Oct-01 2.12 SY Add ScanUlTxPower()
+ * 12-Oct-01 2.13 SGB Fix merge error
+ * 26-Oct-01 2.14 VKL Add power averager
+ * 9-Nov-01 2.15 APB Add TRACEC7 - 11
+ * 9-Nov-01 2.16 VKL Add L1_PowerAveragerAverageWithLast()
+ * 15-Nov-01 2.17 APB Add ScanEOL
+ * 04-Dec-01 2.18 VKL Make rinbuffer members volatile
+ * Fix non simulated HW_WRITE and HW_READ
+ *
+ *****************************************************************************/
+
+#ifndef l1_generic_l1_tool_h
+#define l1_generic_l1_tool_h
+
+//#include "divider_public.h" Remove from U3G
+#include "mph_types.h"
+#include "l1_types.h"
+#include "l1_types_public.h"
+#include "l1_core_private.h"
+#include "kal_general_types.h"
+
+#include "event_info_utility.h"
+/* --- frame numbers arithmetic -------------------------------------------- */
+
+FrameNumber L1_FrameNumberAdd( FrameNumber a, int32 b );
+FrameNumber L1_FrameNumberSub( FrameNumber a, int32 b );
+int32 L1_FrameNumberDiff( FrameNumber a, FrameNumber b );
+
+#define L1_FrameNumberMod(a,b) ((intx)((a)%(b)))
+#define L1_FrameNumberMod13( a ) ((intx)((a)%13))
+#define L1_FrameNumberMod26( a ) ((intx)((a)%26))
+#define L1_FrameNumberMod51( a ) ((intx)((a)%51))
+#define L1_FrameNumberMod52( a ) ((intx)((a)%52))
+#define L1_FrameNumberMod102( a ) ((intx)((a)%102))
+#define L1_FrameNumberMod104( a ) ((intx)((a)%104))
+
+#define L1_FrameNumberDiv( a, b ) ((a)/(b))
+#define L1_FrameNumberDiv26( a ) ((a)/26)
+#define L1_FrameNumberDiv51( a ) ((a)/51)
+#define L1_FrameNumberDiv52( a ) ((a)/52)
+#define L1_FrameNumberDiv1326( a ) ((a)/1326)
+
+/* --- time arithmetic ----------------------------------------------------- */
+
+void L1_TimeAddWhileEBits( Time* time, intx ebits );
+void L1_TimeAddEBits( Time *time, intx ebits );
+void L1_TimeSubEBits( Time *time, intx ebits );
+void L1_TimeAdd( Time *time, FrameNumber frame, intx ebits );
+void L1_TimeSub( Time *time, FrameNumber frame, intx ebits );
+void L1_TimeNormalise( Time *time );
+bool L1_TimeOutCheck ( uint32 startTime, uint32 duartion );
+/* --- calculation of RLA_C ------------------------------------------------ */
+
+void L1_PowerAveragerReset( PowerAverager *a , SurroundMode mode );
+void L1_PowerAveragerPut( PowerAverager *a, Power power, kal_uint8 min_sample );
+void L1_PowerAveragerPutPt( PowerAverager *a, Power power );
+void L1_PowerAveragerAverageWithLast( PowerAverager *a, Power power );
+void L1_PowerAveragerGet( PowerAverager *a, PowerSum32 *power, kal_uint8 min_sample );
+void L1_SNRAveragerGet(SNRAverager *s,kal_int16 *snr);
+void L1_SNRAveragerPut(SNRAverager *s,kal_int16 snr);
+/* --- Idenify SIM1/SIM2 report -------------------------------------------- */
+
+#if !defined(__GL1_GEMINI__)
+#define GET_SIM_X_FROM_REPORT(_report) (0) /*0->SIM1*/
+#define GET_SIM_X_FROM_HS(hs) (0)
+#else
+#define GET_SIM_X_FROM_REPORT(_report) (uint8)((_report->type & REPORT_SIM_MASK)>> 7) /*0->SIM1, 1->SIM2, 2->SIM3, 3->SIM4 */
+#define GET_SIM_X_FROM_HS(hs) (hs->simIndex)
+#endif
+
+/*For show trace in catcher, SIM1: "[SIM1]xxxx" */
+#define SIM_MODE_STR(_mode) (_mode + 1)
+#define RTB_MODE_STR (L1C_SIM1 + 1)
+#define DEFAULT_SIM_MODE_STR (L1C_SIM1 + 1)
+
+/* --- Dispatch L1C trace message---------------------- */
+#ifdef __GL1_GEMINI__
+#define L1C_MSG_14(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14)\
+ { msg( SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14); }
+
+#define L1C_MSG_13(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13)\
+ { msg( SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13); }
+
+#define L1C_MSG_12(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12)\
+ { msg( SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v12); }
+
+#define L1C_MSG_11(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11)\
+ { msg( SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11); }
+
+#define L1C_MSG_10(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10); }
+
+#define L1C_MSG_9(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5, v6, v7, v8, v9); }
+
+#define L1C_MSG_8(msg, v1, v2, v3, v4, v5, v6, v7, v8)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5, v6, v7, v8); }
+
+#define L1C_MSG_7(msg, v1, v2, v3, v4, v5, v6, v7)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5, v6, v7); }
+
+#define L1C_MSG_6(msg, v1, v2, v3, v4, v5, v6)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5, v6); }
+
+#define L1C_MSG_5(msg, v1, v2, v3, v4, v5)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4, v5); }
+
+#define L1C_MSG_4( msg, v1, v2, v3, v4)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1, v2, v3, v4); }
+
+#define L1C_MSG_3( msg, v1, v2, v3)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1, v2, v3); }
+
+#define L1C_MSG_2( msg, v1, v2)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1, v2); }
+
+#define L1C_MSG_1( msg, v1)\
+ { msg(SIM_MODE_STR(l1c_sim_mode), v1); }
+
+#define L1C_MSG_0( msg)\
+ { msg(SIM_MODE_STR(l1c_sim_mode)); }
+#else /*__GL1_GEMINI__*/
+#define L1C_MSG_14(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14);}
+#define L1C_MSG_13(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13);}
+#define L1C_MSG_12(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12);}
+#define L1C_MSG_11(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11);}
+#define L1C_MSG_10(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5, v6, v7, v8, v9, v10);}
+#define L1C_MSG_9(msg, v1, v2, v3, v4, v5, v6, v7, v8, v9) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5, v6, v7, v8, v9);}
+#define L1C_MSG_8(msg, v1, v2, v3, v4, v5, v6, v7, v8) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5, v6, v7, v8);}
+#define L1C_MSG_7(msg, v1, v2, v3, v4, v5, v6, v7) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5, v6, v7);}
+#define L1C_MSG_6(msg, v1, v2, v3, v4, v5, v6) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5, v6);}
+#define L1C_MSG_5(msg, v1, v2, v3, v4, v5) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4, v5);}
+#define L1C_MSG_4(msg, v1, v2, v3, v4) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3, v4);}
+#define L1C_MSG_3(msg, v1, v2, v3) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2, v3);}
+#define L1C_MSG_2(msg, v1, v2) {msg(SIM_MODE_STR(L1C_SIM1), v1, v2);}
+#define L1C_MSG_1(msg, v1) {msg(SIM_MODE_STR(L1C_SIM1), v1);}
+#define L1C_MSG_0(msg) {msg(SIM_MODE_STR(L1C_SIM1));}
+#endif /*__GL1_GEMINI__*/
+
+/* --- Utility Macro ------------------------------------------------------- */
+
+/*Please be careful about the datatype of the input parameter!! */
+#define L1_CHK_BIT(a, bit) ( (a) & (1 << bit))
+#define L1_SET_BIT(a, bit) ( (a) |= (1 << bit))
+#define L1_CLR_BIT(a, bit) ( (a) &= ~(1 << bit))
+
+/* --- Original stuff move to tool.h for 3G to include---------------------- */
+
+#include "tool.h"
+
+/* --- specialities ------------------------------------------------------- */
+
+bool ScanPrintChk( void );
+bool ScanCommand( const char *value );
+bool ScanPower( Power *power );
+bool ScanTA( TimingAdvance *ta );
+bool ScanTimeSlot( TimeSlot *timeSlot );
+bool ScanARFCN( ARFCN *arfcn );
+bool ScanFrameOffset( FrameNumber *frameOffset );
+bool ScanEBitOffset( intx *ebitOffset );
+bool ScanBSIC( BSIC *bsic );
+bool ScanTSC( TSC *tsc );
+bool ScanFrame( FrameNumber *frame, int32 min );
+bool ScanUlTxPower( Power *power );
+
+/*------------------- L1A ASSERT --------------------------------------*/
+/*[MAUI_03118234] L1 ASSERT Review
+ A. L1A(_EXT)_ASSERT_Reboot: reboot in both MTK internal & customer release
+ (L1A_ASSERT_Reboot will be ignored in slim, L1A_EXT_ASSERT_Reboot will reboot in slim)
+ B. L1A(_EXT)_ASSERT_Bypass_Trace: no reboot, but output warning message in system trace
+ C. L1A(_EXT)_ASSERT_Bypass: reboot in MTK internal, ignore in customer release
+*/
+
+#define L1A_ASSERT_Bypass( st ) (void)0
+#define L1A_ASSERT_Bypass_Trace( st ) if(!(st)) MODEM_WARNING_MESSAGE(0, "[L1A]")
+#define L1A_ASSERT_Reboot( st ) if(!(st)) ASSERT(0)
+#define L1A_EXT_ASSERT_Bypass( st, d1, d2, d3 ) (void)0
+#define L1A_EXT_ASSERT_Bypass_Trace( st, d1, d2, d3 ) if(!(st)) MODEM_WARNING_MESSAGE(0, "[L1A] var1:%d, var2:%d, var3:%d", d1, d2, d3)
+#define L1A_EXT_ASSERT_Reboot( st, d1, d2, d3 ) if(!(st)) EXT_ASSERT(0, d1, d2, d3 )
+
+#ifdef __MTK_INTERNAL__
+ #undef L1A_ASSERT_Bypass
+ #undef L1A_EXT_ASSERT_Bypass
+ #define L1A_ASSERT_Bypass( st ) if(!(st)) ASSERT(0)
+ #define L1A_EXT_ASSERT_Bypass( st, d1, d2, d3 ) if(!(st)) EXT_ASSERT(0, d1, d2, d3 )
+#endif
+
+#ifdef L1_SIM
+ #undef L1A_ASSERT_Bypass_Trace
+ #undef L1A_EXT_ASSERT_Bypass_Trace
+ #define L1A_ASSERT_Bypass_Trace( st ) if(!(st)) ASSERT(0)
+ #define L1A_EXT_ASSERT_Bypass_Trace( st, d1, d2, d3 ) if(!(st)) EXT_ASSERT(0, d1, d2, d3 )
+#endif
+
+#endif // l1_generic_l1_tool_h
+
diff --git a/mcu/l1/interface/gl1/l1a_dm_private.h b/mcu/l1/interface/gl1/l1a_dm_private.h
new file mode 100644
index 0000000..883d578
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1a_dm_private.h
@@ -0,0 +1,792 @@
+/*****************************************************************************
+* 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:
+ * ---------
+ * l1a_dm_private.h
+ *
+ * Project:
+ * --------
+ * Maui_Software
+ *
+ * Description:
+ * ------------
+ * This file contains definitions used by L1A dual mode
+ *
+ * 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!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#if defined(__UMTS_RAT__) || defined(__LTE_RAT__)
+
+#ifndef _L1A_DM_PRIVATE_H
+#define _L1A_DM_PRIVATE_H
+
+#include "kal_public_api.h"
+#include "mph_types.h"
+#include "mph_cs_def.h"
+#include "l1_types.h"
+#include "kal_public_api.h"
+#include "kal_general_types.h"
+#include "mll1_gsm.h"
+#include "mph_dm_msg.h"
+
+/* define gl1_ll1_measure_req meas_purpose_bitmap and tick_bitmap begin */
+#define L1A_MEAS_PURPOSE_ONLY (0x01) //this bit is set when tick is need
+#define L1A_MEAS_PURPOSE_ALL (0x02)
+#define L1A_MEAS_TICK_REG (0x01)
+#define L1A_MEAS_TICK_PRIO (0x02)
+#define L1A_MEAS_OOS_BEGIIN (0x04) //used in gl1_ll1_measure_req to inform OOS is ongoing to shorten meas period
+#define L1A_IS_REG_TICK_ON(bitmap) ( ((bitmap&L1A_MEAS_TICK_REG ) != 0)? KAL_TRUE : KAL_FALSE )
+#define L1A_IS_PRIO_TICK_ON(bitmap) ( ((bitmap&L1A_MEAS_TICK_PRIO) != 0)? KAL_TRUE : KAL_FALSE )
+
+
+/* define for 2G standby gap service type check begin */
+/* set if GSM has started standby GSM measurement (RSSI) */
+#define L1A_STANDBY_GSM_MEAS_START (0x0001)
+#ifdef __GERAN_R8__
+/* set if GSM has started Priority standby GSM measurement (RSSI) */
+#define L1A_STANDBY_GSM_PRIO_MEAS_START (0x0002)
+#endif /*__GERAN_R8__*/
+
+#define L1A_STANDBY_GAP_ALL_BOUNDARY (0x00FF)
+/* set if GSM has started standby GSM BSIC measurement */
+#define L1A_STANDBY_GSM_BSIC_READ_START (0x0100)
+/* set if GSM has started power scan in standby */
+#define L1A_STANDBY_MANUAL_POWER_SCAN_START (0x0200)
+/* set if GSM has started cell_bsic read in standby */
+#define L1A_STANDBY_CELL_BSIC_READ_START (0x0400)
+/* set if GSM has started cell_sys_info read in standby */
+#define L1A_STANDBY_CELL_SYS_INFO_READ_START (0x0800)
+
+#define L1A_STANDBY_GAP_REPORT_CGI_BOUNDARY (0x0FFF)
+/* set if GSM has started reportCGI pwrscan */
+#define L1A_STANDBY_REPORT_CGI_PWRSCAN_START (0x1000)
+/* set if GSM has started reportCGI bsic pwrscan */
+#define L1A_STANDBY_REPORT_CGI_BSIC_READ_START (0x2000)
+/* set if GSM has started reportCGI sys info pwrscan */
+#define L1A_STANDBY_REPORT_CGI_SYS_INFO_READ_START (0x4000)
+
+#define L1A_CHECK_GAP_TYPE_ON(A) (( (l1a_standby_gap_info.l1a_standby_gap_type & A) !=0 ) ? KAL_TRUE : KAL_FALSE)
+#define L1A_CHECK_GAP_TYPE_OFF(A) (( (l1a_standby_gap_info.l1a_standby_gap_type & A) ==0 ) ? KAL_TRUE : KAL_FALSE)
+#define L1A_SET_GAP_TYPE_ON(A) (l1a_standby_gap_info.l1a_standby_gap_type |= A)
+#define L1A_SET_GAP_TYPE_OFF(A) (l1a_standby_gap_info.l1a_standby_gap_type &= (~A))
+
+#define L1A_IS_STB_GAP_SERVICE_ON() ( (l1a_standby_gap_info.l1a_meas_purpose_bitmap !=0)? KAL_TRUE : KAL_FALSE )
+#define L1A_IS_STB_GAP_SERVICE_OFF() (!L1A_IS_STB_GAP_SERVICE_ON() )
+/* define for 2G standby gap service type check end */
+
+
+
+#define DEFAULT_T_HIGH_PRIO_SEARCH (-1)
+#ifndef GEN_FOR_PC
+#define IMMEDIATELY (-1)
+#endif
+
+typedef enum
+{
+ L1A_EVENT_GAP_SERVICE_REQ_ACTIVE_GAP = 0,
+ L1A_EVENT_REPORT_GAP_PATTERN_ACTIVE_GAP,
+ L1A_EVENT_ACTIVE_REQ_ACTIVE_GAP, /* SM/FLIGHT -> DM */
+ L1A_EVENT_STANDBY_REQ_ACTIVE_GAP,
+ L1A_EVENT_DEACTIVATE_REQ_ACTIVE_GAP,
+ L1A_EVENT_TEMP_STOP_MSG_ACTIVE_GAP, //from l1_main
+ L1A_EVENT_TEMP_RESUME_MSG_ACTIVE_GAP, //from l1_main
+ L1A_EVENT_REPORT_GAP_CANCEL_ACTIVE_GAP,
+ L1A_EVENT_IMMED_ASSIGN_ACTIVE_GAP,
+ L1A_EVENT_CHANNEL_ASSIGN_ACTIVE_GAP = L1A_EVENT_IMMED_ASSIGN_ACTIVE_GAP,
+ L1A_EVENT_UPLINK_ASSIGN_ACTIVE_GAP = L1A_EVENT_IMMED_ASSIGN_ACTIVE_GAP,
+ L1A_EVENT_DOWNLINK_ASSIGN_ACTIVE_GAP = L1A_EVENT_IMMED_ASSIGN_ACTIVE_GAP,
+ L1A_EVENT_PDCH_FAIL_RECONNECT_ACTIVE_GAP = L1A_EVENT_IMMED_ASSIGN_ACTIVE_GAP,
+ L1A_EVENT_HANDOVER_ACTIVE_GAP = L1A_EVENT_IMMED_ASSIGN_ACTIVE_GAP,
+ L1A_EVENT_CHANNEL_RECONNECT_ACTIVE_GAP = L1A_EVENT_IMMED_ASSIGN_ACTIVE_GAP,
+ L1A_EVENT_PKT_UNASSIGN_TO_TBF_PEND_ACTIVE_GAP = L1A_EVENT_IMMED_ASSIGN_ACTIVE_GAP,
+ L1A_EVENT_CHANNEL_RELEASE_ACTIVE_GAP,
+ L1A_EVENT_UNASSIGNMENT_ALL_TBF_REL_ACTIVE_GAP,
+ L1A_EVENT_SPECIFIC_SYNC_REQ_ACTIVE_GAP,
+ L1A_EVENT_IDLE_CCCH_START_REQ_ACTIVE_GAP = L1A_EVENT_SPECIFIC_SYNC_REQ_ACTIVE_GAP,
+ L1A_EVENT_PACKET_IDLE_CCCH_START_REQ_ACTIVE_GAP = L1A_EVENT_SPECIFIC_SYNC_REQ_ACTIVE_GAP,
+ L1A_EVENT_PACKET_IDLE_PCCCH_START_REQ_ACTIVE_GAP = L1A_EVENT_SPECIFIC_SYNC_REQ_ACTIVE_GAP,
+ L1A_EVENT_RANDOM_ACCESS_REQ_ACTIVE_GAP = L1A_EVENT_SPECIFIC_SYNC_REQ_ACTIVE_GAP,
+ L1A_EVENT_CELL_SELECTION_INIT_REQ_ACTIVE_GAP = L1A_EVENT_SPECIFIC_SYNC_REQ_ACTIVE_GAP,
+ L1A_EVENT_BSIC_SYNC_REQ_ACTIVE_GAP = L1A_EVENT_SPECIFIC_SYNC_REQ_ACTIVE_GAP,
+ L1A_EVENT_HANDOVER_FROM_UMTS_ACTIVE_GAP,
+ L1A_EVENT_INTER_RAT_HANDOVER_ACTIVE_GAP,
+ L1A_EVENT_CHANNEL_RECONNECT_FROM_UMTS_ACTIVE_GAP,
+ L1A_EVENT_REPORT_DCH_STARTED_ACTIVE_GAP,
+ L1A_EVENT_REPORT_NEW_TBF_STARTED_ACTIVE_GAP = L1A_EVENT_REPORT_DCH_STARTED_ACTIVE_GAP,
+ L1A_EVENT_REPORT_DCH_STOPPED_ACTIVE_GAP,
+#ifdef __BLIND_HANDOVER__
+ L1A_EVENT_REPORT_FCCH_BLIND_CS_HANDOVER_ACTIVE_GAP = L1A_EVENT_REPORT_DCH_STOPPED_ACTIVE_GAP,
+#endif /* end of __BLIND_HANDOVER__ */
+ L1A_EVENT_REPORT_TBF_RECONFIG_ACTIVE_GAP,
+#if defined (__BLIND_HANDOVER__)
+ L1A_EVENT_BLIND_HANDOVER_BSIC_REQ_ACTIVE_GAP,
+#endif
+ L1A_EVENT_GAP_STOP_CNF_ACTIVE_GAP,
+ L1A_ACTIVE_GAP_EVENT_NUM
+}l1a_active_gap_handler_event_enum;
+
+
+/* standby GAP FSM event */
+typedef enum
+{
+ L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP , /* 0 */
+ L1A_EVENT_STANDBY_GSM_PRIO_MEAS_START_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_STANDBY_GSM_BSIC_READ_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_MANUSEL_PWRSCAN_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_CELL_BSIC_START_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_CELL_SYS_INFO_READ_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_REPORT_CGI_PWRSCAN_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_REPORT_CGI_BSIC_START_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_REPORT_CGI_SYS_INFO_READ_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_STANDBY_GSM_MEAS_STOP_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_STANDBY_GSM_PRIO_MEAS_STOP_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_STANDBY_GSM_BSIC_STOP_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_STANDBY_CELL_BSIC_RES_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_MANUSEL_PWRSCAN_STOP_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_CELL_BSIC_STOP_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_CELL_SYS_INFO_STOP_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_REPORT_CGI_PWRSCAN_STOP_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_REPORT_CGI_BSIC_STOP_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_REPORT_CGI_SYS_INFO_STOP_REQ_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_REPORT_GSM_BSIC_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_REPORT_POWER_SCAN_DONE_STB_GAP = L1A_EVENT_STANDBY_GSM_MEAS_START_REQ_STB_GAP,
+ L1A_EVENT_GAP_NOTIFY_IND_STB_GAP, /* 1 */
+ L1A_EVENT_GAP_STOP_REQ_STB_GAP, /* 2 */
+ L1A_EVENT_REPORT_GAP_STOP_STB_GAP, /* 3 */
+ L1A_EVENT_GAP_SUSPEND_REQ_STB_GAP, /* 4 */
+ L1A_EVENT_REPORT_GAP_SUSPEND_STB_GAP, /* 5 */
+ L1A_EVENT_GAP_RESUME_REQ_STB_GAP, /* 6 */
+ L1A_EVENT_ACTIVE_REQ_STB_GAP, /* 7 */
+ L1A_STB_GAP_EVENT_NUM
+}l1a_standby_gap_handler_event_enum;
+
+
+/* active autoGAP FSM event */
+typedef enum
+{
+ L1A_EVENT_AUTO_GAP_START_REQ_ACTIVE_AG,
+ L1A_EVENT_AUTO_GAP_IND_ACTIVE_AG,
+ L1A_EVENT_REPORT_AUTO_GAP_START_ACTIVE_AG,
+ L1A_EVENT_AUTO_GAP_END_IND_ACTIVE_AG,
+ L1A_EVENT_AUTO_GAP_STOP_REQ_ACTIVE_AG,
+ L1A_EVENT_AUTO_GAP_STOP_CNF_ACTIVE_AG,
+ L1A_ACTIVE_AG_EVENT_NUM
+}l1a_active_auto_gap_handler_event_enum;
+
+/* standby autoGAP FSM event */
+typedef enum
+{
+ L1A_EVENT_AG_AVAILABLE_IND_STB_AG,
+ L1A_EVENT_AG_UNAVAILABLE_IND_STB_AG,
+ L1A_EVENT_REPORT_AG_START_STB_AG,
+ L1A_EVENT_REPORT_AG_END_STB_AG,
+ L1A_EVENT_AG_CNF_STB_AG,
+ L1A_EVENT_AG_STOP_IND_STB_AG,
+ L1A_EVENT_REPORT_AG_STOP_STB_AG,
+ L1A_EVENT_CGI_PWRSCAN_START_STB_AG,
+ L1A_EVENT_CGI_PWRSCAN_STOP_STB_AG,
+ L1A_EVENT_REPORT_PWRSCAN_CGI_STB_AG,
+ L1A_EVENT_CGI_BSIC_START_STB_AG,
+ L1A_EVENT_CGI_BSIC_STOP_STB_AG,
+ L1A_EVENT_REPORT_BSIC_CGI_STB_AG,
+ L1A_EVENT_CGI_BCCH_START_STB_AG,
+ L1A_EVENT_CGI_BCCH_STOP_STB_AG,
+ L1A_EVENT_SRVCC_BSIC_START_STB_AG,
+ L1A_EVENT_SRVCC_BSIC_STOP_STB_AG,
+ L1A_EVENT_REPORT_BSIC_SRVCC_STB_AG,
+ L1A_EVENT_REPORT_GSMBSIC_STB_AG,
+ L1A_EVENT_REPORT_RE_REQ_CGI_STB_AG,
+ L1A_STB_AUTO_GAP_EVENT_NUM
+}l1a_standby_auto_gap_handler_event_enum;
+
+
+/* active GAP FSM state*/
+typedef enum
+{
+ L1A_ACTIVE_GAP_NULL = 0, /* 00 */
+ L1A_ACTIVE_GAP_REQUIRED, /* 01 */
+ L1A_ACTIVE_GAP_PROCESS, /* 02 */
+ L1A_ACTIVE_GAP_SUSPENDED, /* 03 */
+ L1A_ACTIVE_GAP_WAIT_LL1, /* 04 */
+ L1A_ACTIVE_GAP_WAIT_RPT, /* 05 */
+ L1A_ACTIVE_GAP_STATE_NUM
+}l1a_active_gap_state_enum;
+
+
+/* standby GAP FSM state*/
+typedef enum
+{
+ L1A_STB_GAP_IDLE = 0, /* 00 */
+ L1A_STB_GAP_REQUIRED, /* 01 */
+ L1A_STB_GAP_PROCESS, /* 02 */
+ L1A_STB_GAP_SELF_STOP, /* 03 */
+ L1A_STB_GAP_IRT_STOP, /* 04 */
+ L1A_STB_GAP_STATE_NUM
+}l1a_standby_gap_state_enum;
+
+/* active autoGAP FSM state*/
+typedef enum
+{
+ L1A_ACTIVE_AG_OFF = 0, /* 00 */
+ L1A_ACTIVE_AG_ON, /* 01 */
+ L1A_ACTIVE_AG_REQ, /* 02 */
+ L1A_ACTIVE_AG_PROCESS, /* 03 */
+ L1A_ACTIVE_AG_STOPPING, /* 04 */
+ L1A_ACTIVE_AG_STATE_NUM
+}l1a_active_auto_gap_state_enum;
+
+/* autoGAP required in standby state*/
+typedef enum
+{
+ L1A_AG_REQ_IN_STB_IDLE = 0, /* 00 */
+ L1A_AG_REQ_IN_STB_REQ, /* 01 */
+ L1A_AG_REQ_IN_STB_GIVEN, /* 02 */
+ L1A_AG_REQ_IN_STB_STATE_NUM
+}l1a_auto_gap_required_in_standby_state_enum;
+
+
+/* standby autoGAP FSM state*/
+typedef enum
+{
+ L1A_STB_AG_IDLE = 0, /* 00 */
+ L1A_STB_AG_STARTED, /* 01 */
+ L1A_STB_AG_REQUIRING, /* 02 */
+ L1A_STB_AG_PROCESSING, /* 03 */
+ L1A_STB_AG_STOPPING, /* 04 */
+ L1A_STB_AG_STATE_NUM
+}l1a_standby_auto_gap_state_enum;
+
+
+/*Shihyao 20090601, used to group gap-related variables into a structure*/
+typedef enum
+{
+ L1A_STATE_NULL_FOR_GAP = 0, /* 00 */
+ L1A_STATE_RESCHEDULE_GAP_FOR_GAP, /* 01 */
+ L1A_STATE_WAIT_CCCH_START_FOR_GAP, /* 02 */
+ L1A_STATE_IRT_HANDOVER_FOR_GAP, /* 03 */
+ L1A_STATE_BLIND_HANDOVER_BSIC_FOR_GAP, /* 04 */
+ L1A_CHANNEL_STATE_FOR_GAP_NUM
+}l1a_channel_state_for_gap_enum;
+
+typedef enum
+{
+ L1A_WAIT_GSM_GAP_STOP_CNF_NULL = 0,
+ L1A_WAIT_GSM_GAP_STOP_CNF_STOPPING,
+ L1A_WAIT_GSM_GAP_STOP_CNF_RPT_STANDBY,
+ L1A_WAIT_GSM_GAP_STOP_CNF_RPT_DEACTIVATE,
+ L1A_WAIT_GSM_GAP_STOP_CNF_NUM
+}l1a_wait_gsm_gap_stop_cnf_enum;
+
+
+/* record gap suspend state, used by standby GAP FSM*/
+typedef enum
+{
+ L1A_GAP_NOT_SUSPENDED = 0, /* 00 */
+ L1A_GAP_SUSPENDED, /* 01 */
+ L1A_GAP_SUSPENDED_NO_GAP, /* 02 */
+ L1A_GAP_SUSPEND_NUM
+}l1a_gap_suspend_state_enum;
+
+
+/*================ for ACTIVE GAP FSM usage ====================*/
+typedef struct
+{
+ kal_bool l1a_gap_service_enable; //ON or OFF
+ kal_uint8 tid; //from mll1 and gl1 fill in gap_pattern
+ l1a_channel_state_for_gap_enum l1a_channel_state_for_gap;
+}l1a_active_gap_database_struct;
+
+/*================ for STANDBY GAP FSM usage ====================*/
+typedef struct
+{
+ /* bitmap of gap service type*/
+ kal_uint32 l1a_standby_gap_type;
+ /* current standby gap service type bitmaps */
+ kal_uint8 l1a_meas_purpose_bitmap; //bit0(meas), bit1(cell search)
+ kal_uint8 l1a_tick_bitmap; //bit0(rank), bit1(prio)
+ /* if(HPS on) # of higer BA. else if(meas on) # of BA. */
+ kal_uint8 l1a_carrier_num;
+ kal_uint8 l1a_carrier_num_old;
+#ifdef __GERAN_R8__
+ kal_int16 l1a_current_t_high_prio_search;
+ kal_int16 l1a_old_t_high_prio_search;
+#endif /*__GERAN_R8__*/
+ kal_uint8 l1a_period_reset_bitmap; //bit0(rank), bit1(prio)
+ /*LL1 might send gap_suspend_req with gl1's gap service. To prevent waking 2G frequently,
+ L1A will not inform L1C until gap is given. */
+ l1a_gap_suspend_state_enum l1a_is_gap_suspended;
+ /* fast standby plmn list enhancement */
+ kal_bool l1a_standby_cell_bsic_res_req;
+#if (SRVCC_USE_CGI_AUTO_GAPS)
+ kal_bool is_meas_req_sent_without_boost_gap_allocation;
+#endif
+}l1a_standby_gap_database_struct;
+
+/*================ Flags used in 2G active ======================*/
+typedef struct
+{
+ /* syy: to check if sc_mode is changed */
+ ll1_active_rat_mode_status_enum l1a_sc_mode_old;
+ /* syy: for standby and deactivate cnf after gap_stop_cnf */
+ l1a_wait_gsm_gap_stop_cnf_enum l1a_wait_gsm_gap_stop_cnf_for_cnf;
+}l1a_dm_active_database_struct;
+
+/*================ Flags used in 2G standby ======================*/
+typedef struct
+{
+ /* william: to record the system mode to be set after gap stop cnf */
+ mph_system_mode_enum l1a_system_mode_set;
+ /* william: for active cnf after report gap stop*/
+ kal_bool l1a_wait_report_gap_stop_for_active_cnf;
+}l1a_dm_standby_database_struct;
+
+/*================ for ACTIVE AUTO GAP FSM usage ====================*/
+typedef struct
+{
+ kal_bool l1a_is_ag_started; //only for assert check
+}l1a_active_auto_gap_database_struct;
+
+/*================ for STANDBY AUTO GAP FSM usage ====================*/
+typedef struct
+{
+ kal_bool is_started;
+ kal_uint8 scan_id;
+ ARFCN arfcn;
+} l1a_report_cgi_pwrscan_req_struct;
+
+typedef struct
+{
+ kal_bool is_started;
+ kal_uint8 bsic_tid;
+ ARFCN arfcn;
+ kal_bool is_srvcc; //to distinguish cgi or srvcc
+ kal_bool need_trigger_at_end; //when srvcc_bsic is stopped and started in proc state, need to trigger at RptEnd
+} l1a_report_cgi_bsic_start_req_struct;
+
+typedef struct
+{
+ kal_bool is_started;
+ ARFCN arfcn;
+ BSIC bsic;
+ kal_uint16 bcch_mask;
+ FrameNumber frame_offset;
+ kal_int32 ebit_offset;
+} l1a_report_cgi_sys_info_start_req_struct;
+
+#if (SRVCC_USE_CGI_AUTO_GAPS)
+typedef struct
+{
+ Power b2_threshold_in_qdbm; //B2 value from ERRC
+ kal_uint8 num_of_bsic_attempts; //bsic attempt count
+ kal_bool is_srvcc; //srvcc flag from MLL1
+ kal_bool is_srvcc_backup; //backup srvcc flag
+}l1a_srvcc_perf_improvement_data_struct;
+#endif
+
+typedef struct
+{
+ l1a_report_cgi_pwrscan_req_struct pwrscan_req; //for ReportCGI
+ l1a_report_cgi_bsic_start_req_struct bsic_req; //for ReportCGI
+ l1a_report_cgi_sys_info_start_req_struct bcch_req; //for ReportCGI
+#if (SRVCC_USE_CGI_AUTO_GAPS)
+ l1a_srvcc_perf_improvement_data_struct srvcc_data;//for srvcc perf improvements
+#endif
+}l1a_standby_auto_gap_database_struct;
+
+/* from m11150.c */
+kal_bool l1a_standby_gap_check_if_service_on(void);
+kal_bool l1a_standby_gap_external_check_if_type_on( kal_uint32 standby_gap_type );
+kal_bool l1a_standby_gap_external_check_if_type_off( kal_uint32 standby_gap_type );
+kal_bool l1a_standby_gap_external_set_type_on( kal_uint32 standby_gap_type );
+kal_bool l1a_standby_gap_external_set_type_off( kal_uint32 standby_gap_type );
+kal_bool l1a_standby_gap_external_check_cell_bsic_res_req_off(void);
+kal_uint8 l1a_standby_gap_external_read_state(void);
+kal_bool l1a_standby_gap_check_if_service_on(void);
+void l1a_standby_gap_handler_init(void);
+void l1a_standby_gap_handler(kal_uint8 event, void* ptr_ilm_rpt);
+kal_uint8 l1a_gap_external_read_active_gap_state(void);
+kal_bool l1a_external_read_active_gap_stopping(void);
+kal_bool l1a_external_read_active_gap_service_enable(void);
+void l1a_active_gap_handler_init(void);
+void l1a_active_gap_handler(kal_uint8 event, void* ptr_ilm_rpt);
+void l1a_update_standby_meas_purpose( mphm_standby_meas_purpose_enum purpose, void* ptr_ilm_rpt );
+#if (SRVCC_USE_CGI_AUTO_GAPS)
+void l1a_send_meas_req_for_srvcc(void);
+void l1a_set_meas_req_sent_without_boost_gap_allocation(kal_bool boost_gap_allocation);
+kal_bool l1a_get_meas_req_sent_without_boost_gap_allocation(void);
+#endif
+
+
+
+/* from m11151.c */
+void l1a_gsm_active_data_init(void);
+void l1a_gsm_standby_data_init(void);
+void l1a_external_set_wait_gsm_gap_stop_cnf_cause( l1a_wait_gsm_gap_stop_cnf_enum cause );
+l1a_wait_gsm_gap_stop_cnf_enum l1a_external_read_wait_gsm_gap_stop_cnf_cause( void );
+ll1_active_rat_mode_status_enum l1a_external_read_old_sc_mode( void );
+void l1a_external_set_wait_report_gap_stop_for_active_req( kal_bool wait_report_gap_stop);
+kal_bool l1a_external_read_wait_report_gap_stop_for_active_req( void );
+void l1a_dm_active_req(void* ptr_ilm);
+void l1a_set_gsm_sm_active_to_dm_active(void* ptr_ilm);
+void l1a_dm_standby_req(void* ptr_ilm);
+void l1a_standby_gsm_bsic_read_req(void* ptr_ilm);
+void l1a_standby_gsm_bsic_stop_req(void* ptr_ilm);
+void l1a_standby_gsm_meas_start_req(void* ptr_ilm);
+void l1a_standby_gsm_meas_stop_req(void* ptr_ilm);
+#ifdef __GERAN_R8__
+void l1a_standby_gsm_prio_meas_start_req(void* ptr_ilm);
+void l1a_standby_gsm_prio_meas_stop_req(void* ptr_ilm);
+#endif /*__GERAN_R8__*/
+void l1a_standby_cell_bsic_start_req(void* ptr_ilm);
+void l1a_standby_cell_bsic_stop_req(void* ptr_ilm);
+void l1a_standby_cell_sys_info_start_req(void* ptr_ilm);
+void l1a_standby_cell_sys_info_stop_req(void* ptr_ilm);
+
+void l1a_temporarily_stop_gsm_gap_req( void* ptr_ilm );
+void l1a_resume_gsm_gap_schedule( void* ptr_ilm );
+kal_bool l1a_inform_gl1_mode_status( kal_bool timing_changed, ll1_active_rat_mode_status_enum new_mode );
+void l1a_receive_report_gappattern(void* ptr_rpt);
+void l1a_receive_report_gsm_rssi(void* ptr_rpt);
+void l1a_receive_report_gsm_bsic(void* ptr_rpt);
+void l1a_receive_report_bsic_cgi(void* ptr_rpt);
+#if !(SRVCC_USE_CGI_AUTO_GAPS)
+kal_bool l1a_receive_report_bsic_srvcc(void* ptr_rpt);
+#else
+void l1a_receive_report_bsic_srvcc(void* ptr_rpt);
+#endif /* SRVCC_USE_CGI_AUTO_GAPS */
+void l1a_receive_report_gap_stop( void );
+void l1a_receive_ll1_gl1_gap_notify_ind(void* ptr_ilm);
+void l1a_receive_mphm_gap_stop_req( void );
+void l1a_receive_report_standby_done(void* ptr_rpt);
+void l1a_receive_report_active_done(void* ptr_rpt);
+void l1a_receive_gsm_gap_stop_cnf();
+void l1a_receive_mphm_sync_req( void );
+void l1a_receive_report_sync_time( void* ptr_rpt );
+void l1a_receive_report_pm_done( void* ptr_rpt );
+void l1a_receive_mphm_gap_suspend_req( void );
+void l1a_receive_report_gap_suspend( void );
+void l1a_receive_mphm_gap_resume_ind( void );
+void l1a_receive_ll1_gl1_mode_status_update_ind(void* ptr_ilm);
+void l1a_send_gl1_ll1_gap_stop_cnf( void );
+void l1a_send_gl1_ll1_gap_stop_req( void );
+void l1a_send_mphm_standby_cnf( void );
+void l1a_send_inter_rat_handover_cnf( void );
+void l1a_send_gl1_ll1_measure_req( l1a_standby_gap_service_req_struct standby_gap_service_req );
+void l1a_send_gl1_ll1_irat_sync_cnf(kal_int32 frame, kal_int32 ebit, kal_uint32 ustime);
+void l1a_send_gl1_ll1_gap_suspend_cnf(void);
+void l1a_send_gl1_ll1_standby_measure_done_ind( kal_uint8 tid, kal_uint8 tick_bitmap );
+void l1a_send_gl1_ll1_rat_status_ind( gl1_ll1_rat_status_enum rat );
+void l1a_send_gl1_ll1_gap_pattern_ind(void* ptr_rpt);
+void l1a_send_mphm_standby_gsm_bsic_ind( SChData* ptr_sch_data );
+void l1a_send_mphm_standby_gsm_report_cgi_bsic_ind( SChData* ptr_sch_data );
+void l1a_send_mphm_standby_gsm_report_srvcc_bsic_ind( SChData* ptr_sch_data );
+void l1a_send_mphm_standby_gsm_report_cgi_pwrscan_cnf( PowerScanData* ptr_scan_data, kal_uint8 scan_id, ARFCN arfcn );
+void l1a_enter_umts_fail_reconnect(void);
+
+
+#ifdef __SGTDS_STANDBY_AFC_TRACKING__
+void l1a_receive_report_gap_tick( void* ptr_rpt );
+void l1a_stop_report_gap_tick( void );
+#endif /*__SGTDS_STANDBY_AFC_TRACKING__*/
+#ifdef __GL1_GEMINI__
+void l1a_update_alt_l1_gsm_gap_service_init(void);
+void l1a_update_alt_l1_gsm_gap_service (kal_bool is_need);
+void l1a_send_mphc_alt_l1_gsm_gap_service_update_req (kal_bool enable);
+void l1a_receive_mphc_alt_l1_gsm_gap_resume_req(void);
+#endif /* end of __GL1_GEMINI__ */
+
+/* from m11152.c, for auto gap */
+void l1a_active_auto_gap_handler_init(void);
+void l1a_active_auto_gap_handler(kal_uint8 event, void* ptr_ilm_rpt);
+void l1a_standby_auto_gap_handler_init(void);
+void l1a_standby_auto_gap_handler(kal_uint8 event, void* ptr_ilm_rpt);
+void l1a_auto_gap_in_standby_init(void);
+void l1a_auto_gap_ind_in_standby(void* ptr_ilm);
+void l1a_report_auto_gap_start_in_standby( void* ptr_rpt );
+void l1a_auto_gap_end_ind_in_standby(void* ptr_ilm);
+kal_uint8 l1a_get_srvcc_bsic_tid( void );
+
+#if (SRVCC_USE_CGI_AUTO_GAPS)
+kal_bool l1a_srvcc_perf_get_is_srvcc_flag( void );
+void l1a_srvcc_perf_set_is_srvcc_flag( kal_bool flag, kal_bool is_srvcc_backup_flag );
+void l1a_srvcc_perf_update_b2_thd( Power b2_threshold_in_qdbm);
+kal_bool l1a_srvcc_perf_is_backup_and_current_srvcc_flag_diff( void );
+void l1a_srvcc_perf_update_bsic_attempt_count( kal_bool is_reset );
+void l1a_srvcc_perf_calculate_boost_value( SChData* ptr_sch_data, mphm_standby_gsm_report_srvcc_bsic_ind_struct *ptr_para );
+void l1a_srvcc_perf_reset_bsic_attempt_count(void);
+#endif
+
+/* from m11127.c */
+void l1a_report_cgi_pwrscan_start( ARFCN arfcn, kal_uint8 scan_id, kal_bool use_auto_gap );
+void l1a_report_cgi_pwrscan_stop(kal_bool use_auto_gap);
+void l1a_report_cgi_report_scan_done(Report* ptr_rpt);
+
+
+/* from other files */
+extern mph_system_mode_enum l1a_get_system_mode(void);
+
+extern kal_int32 l1a_external_read_paing_period( void );
+
+#ifdef __GL1_GEMINI__
+extern mph_system_mode_enum l1a_get_sim1_system_mode(void);
+#endif /* end of __GL1_GEMINI__ */
+
+#endif /* end of _L1A_DM_PRIVATE_H */
+
+#endif /* __UMTS_RAT__ || __LTE_RAT__ */
diff --git a/mcu/l1/interface/gl1/l1d_2g_interface.h b/mcu/l1/interface/gl1/l1d_2g_interface.h
new file mode 100644
index 0000000..d514ba0
--- /dev/null
+++ b/mcu/l1/interface/gl1/l1d_2g_interface.h
@@ -0,0 +1,145 @@
+/*****************************************************************************
+* 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:
+ * ---------
+ * l1d_2g_interface.h
+ *
+ * Project:
+ * --------
+ *
+ *
+ * Description:
+ * ------------
+ * L1 interface provided by 2G
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *------------------------------------------------------------------------------
+ *
+ * $Revision: 1.7 $
+ * $Modtime: May 16 2005 23:14:12 $
+ * $Log: //mtkvs01/vmdata/Maui_sw/archives/mcu/l1/l1d/m12150.h-arc $
+ *
+ * 10 25 2018 yungshian.lai
+ * [MOLY00353514] [Gen97] VMOLY xL1SIM GL1TST Part- modify seamless META [ERS00018830].
+ *
+ * 06 03 2014 yi-ying.lin
+ * [MOLY00067365] [L1D][Modify] MT6752 L1D driver developement
+ * .
+ *
+ * 12 16 2013 hosen.chen
+ * [MOLY00046159] [L1D][Modify] Check in code of MT6595 2G modem driver modification
+ * .
+ *
+ * 04 12 2013 hosen.chen
+ * [MOLY00012945] [MT6290 Bring-up] Check in code of MT6290
+ * .
+ *
+ * 03 28 2013 hosen.chen
+ * [MOLY00012945] [L1D][Modify] Check in code of MT6290
+ * .
+ *
+ * 08 30 2012 ij.chang
+ * [MOLY00002884] [UL1D][Modify] 32K-Less Feature Check In
+ * .
+ *
+ * 05 08 2012 samuel.yang
+ * removed!
+ * .
+ *
+ * 11 08 2011 jason.lai
+ * removed!
+ * .
+ *
+ * 10 03 2011 jason.lai
+ * removed!
+ * .
+ *
+ *******************************************************************************/
+
+#ifndef _L1D_2G_INTERFACE_H_
+#define _L1D_2G_INTERFACE_H_
+
+/*===============================================================================*/
+/*---------------------------------------------*/
+/* Type definition provided by 2G */
+/*---------------------------------------------*/
+
+/*****************************************************************************
+* Typedef : L1CalDataDlStatusQueryResult
+* Group : Real target, Internals, L1D/UL1D common operation
+* Type : enumeration
+* Description : Define the constant value of return value for calibration
+* data item download status query function
+*****************************************************************************/
+typedef enum
+{
+ L1_CAL_DATA_CHECK_CODE_NOT_DOWNLOADED = 0,
+ L1_CAL_DATA_CHECK_CODE_SUCCESS_DOWNLOADED,
+ L1_CAL_DATA_CHECK_CODE_NO_NVRAM_LID_MATCHED,
+ L1_CAL_DATA_CHECK_CODE_MAX
+
+} L1CalDataDLStatusQueryResult;
+
+/*===============================================================================*/
+/*---------------------------------------------*/
+/* Interface provided by 2G */
+/*---------------------------------------------*/
+
+extern void L1D_IS_3G_START( void );
+extern void L1D_CalibrateGainMismatch( int _rat ); // 0: GSM, 1: WCDMA //
+extern void L1D_ABB_HWCalibration( int _rat ); // 0: GSM, 1: WCDMA
+extern void L1D_ABB_HWCalibration_Restore( void );
+extern void L1D_RF_Init_ABB( void );
+extern short L1D_GCMachine_Done( void );
+extern void L1D_Update_DSP_3G_TimeStamp( kal_uint16 timestamp );
+
+/*===============================================================================*/
+extern long XO_CapID;
+
+ #if IS_CHIP_MT6595 || IS_CHIP_MT6752_MD1 || IS_CHIP_MT6752_MD2
+extern unsigned short lte_rc_cal_result[2];
+ #elif IS_CHIP_MT6290
+extern unsigned short lte_rc_cal_result[9];
+ #elif IS_CHIP_MT6572
+extern unsigned short rc_cal_result[5];
+ #endif
+#endif
+