blob: c76bbcac63da03cc216c49c7ff41a11b06eb92db [file] [log] [blame]
/*******************************************************************************
* 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*/