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