| /***************************************************************************** |
| * 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) 2016 |
| * |
| * 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). |
| * |
| *****************************************************************************/ |
| /************************************************************* |
| * |
| * This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc. |
| * |
| * Any unauthorized use inconsistent with the terms of such license is strictly prohibited. |
| * |
| * Copyright (c) 2006-2010 VIA Telecom, Inc. All rights reserved. |
| * |
| *************************************************************/ |
| #ifndef _CLCIRATM_H_ |
| #define _CLCIRATM_H_ 1 |
| /***************************************************************************** |
| * |
| * FILE NAME : clciratm.h |
| * |
| * DESCRIPTION : This file includes the definition of OMP |
| * |
| * HISTORY : |
| * See Log at end of file |
| * |
| *****************************************************************************/ |
| |
| #ifdef MTK_DEV_C2K_IRAT |
| |
| /*---------------------------------------------------------------------------- |
| Include Files |
| ----------------------------------------------------------------------------*/ |
| #include "cpbuf.h" |
| #include "do_clcapi.h" |
| #include "clcomp.h" |
| #include "do_rupapi.h" |
| #include "do_idpapi.h" |
| #include "do_dsaapi.h" |
| #include "do_ompapi.h" |
| #include "clctimer.h" |
| |
| |
| /*---------------------------------------------------------------------------- |
| Global Defines and Macros |
| ----------------------------------------------------------------------------*/ |
| |
| #define IRATM_ERRC_MAX_INTER_FREQUENCY 8 |
| |
| #define IRATM_NUM_BARRED_CELLS 16 |
| |
| #define IRATM_ERRC_MAX_INTER_FREQ_CELL (16) |
| |
| #define IRATM_NUM_OF_TIMERS IRATM_ERRC_MAX_INTER_FREQUENCY * IRATM_ERRC_MAX_INTER_FREQ_CELL |
| |
| #define INVALID_EARFCN (0xFFFF) |
| |
| #define INVALID_EUTRA_PHYS_CELL_ID (0xFFFF) |
| |
| #define INVALID_RESELECTION_PRIORITY (0xFF) |
| |
| |
| /** Defines the scaling factors to be used for all dB and dBm measurements. */ |
| #define RRC_SYS_INFO_DB_SCALING_FACTOR 4 |
| |
| #define IRATM_MIN_RSRQ_VALUE (-255 * RRC_SYS_INFO_DB_SCALING_FACTOR) |
| #define IRATM_MAX_RSRQ_VALUE (255 * RRC_SYS_INFO_DB_SCALING_FACTOR) |
| #define IRATM_INVALID_RSRQ_VALUE (0xFF) |
| #define IRATM_INITIAL_RSRQ_VALUE (0) |
| |
| #define MAX_IRATM_TIMER_NUM (30) |
| #define MAX_OMP_PLMN_NUM 8 |
| #define MAX_EUTRA_FREQ_NUM 8 |
| |
| #define MAX_IRATM_NUM_HPLMN 26 |
| #define NWSEL_MAX_IRATM_NUM_PLMNS 300 |
| #define MAX_PREFER_PLMN_NUM 255 |
| |
| #define MAX_IRAT_CCELL_MEAS_MSG_QUEUE_LEN 2 |
| |
| /** Defines the RSRP measurement in 1/8dBm units. |
| * Range is -140 (x8) to -44 (x8). |
| */ |
| typedef kal_int16 EutraRsrp; |
| |
| /** Defines the RSRQ measurement in 1/8dB units. |
| * Range is -19.5 (x8) to -3 (x8). |
| */ |
| typedef kal_int16 EutraRsrq; |
| |
| extern RmcIratmCcellMeasReqT rmcIratmCcellMeasReq; |
| |
| /*---------------------------------------------------------------------------- |
| Global Typedefs |
| ----------------------------------------------------------------------------*/ |
| |
| typedef kal_uint8 /* 0 to 7 */ CellReselectionPriority; |
| |
| typedef kal_uint16 /* 0 to 16 */ Ecell_T_Reselection; |
| |
| typedef kal_uint16 /* 0 to 503 */ EutraPhysCellId; |
| |
| typedef enum { |
| BASE_PRIORITY, |
| BASE_MEASUREMENT, |
| BASE_RESERVED |
| } EutranMeasModeT; |
| |
| |
| /** Identifies the LTE physical cell */ |
| typedef struct |
| { |
| eas_target_cell_info target_cell; |
| |
| kal_uint8 TimerID; |
| } |
| ECellIdentifierT; |
| |
| typedef struct |
| { |
| kal_uint8 band; |
| kal_uint16 channel; |
| kal_uint16 pn; /* indicate the pilot number the measurement result belonged, range: 0..511 */ |
| kal_int16 phase; /* indicate CDMA pilot phase, represent in chips */ |
| kal_uint16 strength; /* indicate CDMA pilot strength, in -0.125db format |
| note: CAS will send the strength value calculated by formula [FLOOR(-2 x 10 x log10 Ec/Io)] |
| without adding negative sign, and EAS needs to multiply the strength value by (-1) |
| when it evaluates reselection criteria if fulfill: Srxlev > ThreshxHighP, ThreshxLowP */ |
| }IratmServingPilotMeasResultT; |
| |
| typedef struct |
| { |
| kal_uint8 tid; /* tid is used by EAS to filter the measurement report from CAS, range: 0..255 |
| the CCELL_MEAS_IND corresponding to this CCELL_MEAS_REQ should return the same tid |
| Note that (1) ERRC will maintain two tid. One is for HP_MODE. The other one is for LP_MODE/RESEL/CONNECTED. |
| (2) CAS also needs to maintain two tid like ERRC. */ |
| cas_meas_type_enum meas_type; /* indicate the measurement type of this CCELL_MEAS_REQ |
| - if 'RESEL' type is selected, the set of sectors indicated in this primitive should be a subset of the previously measured sectors |
| - if 'CONNECTED' type is selected, it means EAS is in connected mode and requests CAS to do measurement |
| (in order to distinguish from HP/LP/RESEL modes which used in idle mode) |
| - when this primitive is used to stop measurement, EAS should choose correct type to inform CAS which type of measurement should be stopped */ |
| kal_uint8 meas_period; /* indicate the absolute measurement period used by C2K to report the measurement results to LTE |
| this field is only valid if 'meas_type' = HP_MODE, represent in 'seconds' */ |
| kal_uint8 band_num; /* indicate the number of measurement bands, range: 0..MAX_NUM_MEAS_C2K_BAND |
| if band_num=0, CAS should stop the measurement specified in the 'meas_type' */ |
| cas_meas_band_info_struct band_list[MAX_NUM_MEAS_C2K_BAND]; /* indicate the measurement information */ |
| }EasCasConfigCcellMeasReqT; |
| |
| |
| |
| typedef struct |
| { |
| kal_bool bWaitProcessing; |
| kal_bool bStopMeasForMissMatchConfig; |
| EasCasConfigCcellMeasReqT cCellMeasConfig; |
| }IratCcellMeasConfigT; |
| |
| /* IRATM Timers */ |
| typedef enum |
| { |
| /* Barred Frequency timers */ |
| IRATM_FREQUENCY_BARRED_TIMER_0, |
| IRATM_FREQUENCY_BARRED_TIMER_1, |
| IRATM_FREQUENCY_BARRED_TIMER_2, |
| IRATM_FREQUENCY_BARRED_TIMER_3, |
| IRATM_FREQUENCY_BARRED_TIMER_4, |
| IRATM_FREQUENCY_BARRED_TIMER_5, |
| IRATM_FREQUENCY_BARRED_TIMER_6, |
| IRATM_FREQUENCY_BARRED_TIMER_7, |
| |
| /* Barred Cell timers */ |
| IRATM_CELL_BARRED_TIMER_0, |
| IRATM_CELL_BARRED_TIMER_1, |
| IRATM_CELL_BARRED_TIMER_2, |
| IRATM_CELL_BARRED_TIMER_3, |
| IRATM_CELL_BARRED_TIMER_4, |
| IRATM_CELL_BARRED_TIMER_5, |
| IRATM_CELL_BARRED_TIMER_6, |
| IRATM_CELL_BARRED_TIMER_7, |
| IRATM_CELL_BARRED_TIMER_8, |
| IRATM_CELL_BARRED_TIMER_9, |
| IRATM_CELL_BARRED_TIMER_10, |
| IRATM_CELL_BARRED_TIMER_11, |
| IRATM_CELL_BARRED_TIMER_12, |
| IRATM_CELL_BARRED_TIMER_13, |
| IRATM_CELL_BARRED_TIMER_14, |
| IRATM_CELL_BARRED_TIMER_15, |
| IRATM_DEPRIORITIZATION_TIMER, |
| |
| /* Base timer for inter-frequency T-Reselection */ |
| IRATM_INTER_F_T_RESELECTION_TIMER_BASE, |
| |
| /* NOTE: this is not a real timer and must be last in the list! */ |
| IRATM_MAX_NUM_OF_TIMERS = IRATM_INTER_F_T_RESELECTION_TIMER_BASE + IRATM_NUM_OF_TIMERS, |
| } |
| IratmTimerIndex; |
| |
| |
| typedef struct |
| { |
| kal_bool Active; |
| IratmTimerIndex timerIndex; |
| eventid eventid; |
| }IratmExeTimerT; |
| |
| typedef struct |
| { |
| kal_uint32 TimerId; |
| }IratmTimerExpiredMsgT; |
| |
| typedef struct |
| { |
| EARFCN earfcn; |
| kal_bool neverAllowed; |
| te_eval_activate_fail_type failType; |
| }IratmBarFrequencyT; |
| |
| /* Inter-frequency priority relative to serving-frequency */ |
| typedef enum |
| { |
| HIGH_PRIORITY_EARFCN, |
| EQUAL_PRIORITY_EARFCN, |
| LOW_PRIORITY_EARFCN |
| } |
| IratmPriorityRelativeToServFreq; |
| |
| /* E-UTRA cell information */ |
| typedef struct IratmCellEutraInfoTag |
| { |
| /* Indicated presence of this position */ |
| kal_bool cellPresent; |
| |
| /* Physical Cell Identity of the target cell */ |
| kal_uint16 physCellId; |
| |
| /* RSRP of the E-UTRA cell in 1/4dBm units */ |
| kal_int16 rsrp; |
| |
| /* RSRQ of the E-UTRA cell in 1/4dB units */ |
| kal_int16 rsrq; |
| |
| /* Srxlev of the E-UTRA cell in 1/4dB units */ |
| kal_int16 srxlev; |
| |
| /* Squal of the E-UTRA cell in 1/4dB units */ |
| kal_int16 squal; |
| |
| /* Ranking value of the E-UTRA cell in 1/4dB units */ |
| kal_int16 rankingValue; |
| |
| /* Indicated whether T-reselection timer has been expired or not */ |
| kal_bool tReselectionExpired; |
| } |
| IratmEutraCellInfo; |
| |
| |
| /* E-UTRA frequency information */ |
| typedef struct |
| { |
| /* E-UTRA Arfcn of the frequency */ |
| EARFCN earfcn; |
| |
| /* Cell Reselection Priority of this Carrier */ |
| kal_uint8 cellReselectionPriority; |
| |
| eas_bandwidth_enum measBandWidth; |
| |
| /* E-UTRA cell information on the carrier */ |
| IratmEutraCellInfo eutraCellInfo [IRATM_ERRC_MAX_INTER_FREQ_CELL]; |
| } |
| IratmEutraFreqInfo; |
| |
| typedef enum |
| { |
| Home_PLMN_Type, /*Contain at least one home or ehome Plmn*/ |
| Prefer_PLMN_Type, /*Contain no home or ehome Plmn, but at least one perfer Plmn*/ |
| Any_PLMN_Type /*Contain no home or ehome Plmn, no perfer Plmn*/ |
| } |
| IratmPlmnType; |
| |
| typedef enum |
| { |
| EHPLMN_Type, |
| UPLMN_Type, |
| OPLMN_Type |
| } |
| IratmSimPlmnType_enum; |
| |
| typedef struct |
| { |
| kal_uint8 NumPLMNIds; |
| cas_eas_plmn_id_struct PLMNID[MAX_OMP_PLMN_NUM]; |
| } |
| IratmEutranPlmnInfo; |
| |
| typedef struct |
| { |
| /* HOME+EHOME PLMN */ |
| kal_uint16 num_of_home_plmn; |
| cas_eas_plmn_id_struct hplmn[MAX_IRATM_NUM_HPLMN]; |
| kal_uint32 hplmnU32[MAX_IRATM_NUM_HPLMN]; |
| |
| /* PERFER PLMN, uplmn+oplmn from GMSS |
| For priority uplmn>oplmn, then the list include uplmn first, then oplmn*/ |
| kal_uint16 num_of_pref_plmn; |
| cas_eas_plmn_id_struct prefplmn[MAX_PREFER_PLMN_NUM]; |
| kal_uint32 prefplmnU32[MAX_PREFER_PLMN_NUM]; |
| } |
| IratmSimEutranPlmnInfo; |
| |
| |
| typedef struct |
| { |
| srlteRatTypeT curIratmState; |
| srlteRatTypeT SettingIratmState; |
| EutranMeasModeT currEutranMeasMode; |
| IratmServingPilotMeasResultT servingPilot; |
| kal_bool bIHOInProgress; |
| kal_bool bOmpUpdated; /* True: can start irat measurement |
| False: can't start irat measurement */ |
| kal_bool bStdByHPMeasIsDoing; |
| kal_bool bStdByReselMeasIsDoing; |
| kal_bool bStdByLPMeasIsDoing; |
| kal_bool bStdByConnMeasIsDoing; |
| kal_bool bStdByStopHPMeasIsDoing; |
| kal_bool bStdByStopReselMeasIsDoing; |
| kal_bool bStdByStopLPMeasIsDoing; |
| kal_bool bStdByStopConnMeasIsDoing; |
| kal_bool bStandBySuspendIsDoing; |
| kal_bool bStandByLtePowerOffIsDoing; |
| kal_bool bStandByLtePowerOffCgiStopIsDoing; |
| kal_bool bStandBySyncReceivingIsDoing; |
| kal_bool bStandByMeasCnfIsWaiting; |
| kal_bool bStandbyVirtualSuspendIsDoing; |
| kal_bool bActIratHpMeasIsDoing; |
| kal_bool bActIratQualifyMeasIsDoing; |
| kal_bool bActIratLpMeasIsDoing; |
| kal_bool bActIratAllMeasIsDoing; |
| kal_bool bActIratSuspendIsDoing; |
| kal_bool bActIratVirtualSuspendIsDoing; |
| kal_bool bActIratMeasStopIsDoing; |
| kal_bool bActIratDePriorityStopMeasIsDoing; |
| kal_bool bActIratMeasResultIsReceived; |
| kal_bool bCssMeasCtrl;/* True: start; False: stop */ |
| kal_bool bAbortMeas;/* True: abort; False: don't abort */ |
| kal_bool bAlmpMeasCtrl;/* True: start;False stop */ |
| kal_bool bDeprioritizationInfoValid;/* Indicate if deprioritization list exist */ |
| kal_bool bCgiIsDoing; |
| kal_bool bCgiStopIsDoing; |
| kal_bool bSpIsAcquired; |
| kal_bool bCssStopMeasIsDoing; |
| kal_bool bAlmpStopMeasIsDoing; |
| kal_bool bOmpStopMeasIsDoing; |
| kal_bool bReselectionIsDoing; |
| kal_bool bEvaluationIsDoing; |
| kal_bool bStopEvaluationIsDoing; |
| kal_bool bPlmnInfoIsChanged; |
| kal_bool bHighPrioritySearchMode; |
| kal_bool bToLteReselIsDoing; |
| kal_bool bCssSuspendReqWaitProcess; |
| kal_bool bLtePowerOffWaitProcess; |
| kal_bool bCssPowerOffWaitProcess; |
| kal_bool bCssSuspendResumeReqWaitProcess; |
| kal_bool bCssSetRatIsDoing; |
| kal_bool bCssSetRatNeedCnf; |
| kal_uint8 eCellMeasConfigTid; |
| OmpEUTRANNeigborListRecT eutranNeighborInfo; |
| kal_uint8 sectorID[OMP_SECTORID_LENGTH_IN_BYTE]; |
| /* Barred frequency list */ |
| IratmBarFrequencyT barredEutraArfcns [IRATM_ERRC_MAX_INTER_FREQUENCY]; |
| |
| /* Barred cell list */ |
| ECellIdentifierT barredCells [IRATM_NUM_BARRED_CELLS]; |
| |
| Ecell_T_Reselection tReselection; |
| |
| eas_cas_report_cgi_req_struct cgiInfo; |
| cgi_info_status_enum currentCgiDetectedState; |
| |
| eas_deprioritization_info_struct deprioritizationInfo; |
| |
| /* Number of inter frequency carrier */ |
| kal_uint8 numberOfLteInterFreq; |
| |
| /* Inter frequency information list */ |
| IratmEutraFreqInfo lteInterFreqInfoList [IRATM_ERRC_MAX_INTER_FREQUENCY]; |
| |
| kal_uint8 numberOfLtePlmnInterFreq; |
| |
| IratmEutraFreqInfo ltePlmnInterFreqInfoList [IRATM_ERRC_MAX_INTER_FREQUENCY]; |
| |
| kal_uint8 numHighLayer; |
| |
| cas_eas_lte_measurement_req_struct currentErrcFreqMeasReq; |
| cas_eas_evaluate_ecell_req_struct eCellEvaluateReq; |
| |
| cas_eas_lte_hps_qualify_cell_ind_struct hps_qualify_cell_ind; |
| |
| IratmSimEutranPlmnInfo SimPlmnInfo; |
| |
| }IratmInfoT; |
| |
| typedef struct |
| { |
| eas_cas_config_ccell_meas_req_struct data[MAX_IRAT_CCELL_MEAS_MSG_QUEUE_LEN]; |
| int front; |
| int rear; |
| }MsgQueue; |
| |
| |
| /*---------------------------------------------------------------------------- |
| Global Data |
| ----------------------------------------------------------------------------*/ |
| /*---------------------------------------------------------------------------- |
| Global Function Prototypes |
| ----------------------------------------------------------------------------*/ |
| void iratmInit(void); |
| void iratmInfoInit(kal_bool bResetPlmnInfo,kal_bool bResetBarInfo); |
| kal_bool IratmCheckCgiState (void); |
| kal_bool IratmCheckStandBySyncReceivingState (void); |
| void IratmResetStandBySyncReceivingState (void); |
| void IratmClearBarFreqForTaNotAllowed (void); |
| void IratmClearBarFreqForCellBarredResvOperatorFreq (void); |
| kal_bool IratmCheckStandByMeasState (void); |
| void IratmSendSyncMsgToRmc (kal_bool bMsgDecodeSuccess,kal_uint16 PilotPN, kal_uint32 Lower32, kal_uint8 Upper6, |
| kal_uint16 cCCycleStartTime); |
| void ProcessIratmRmcCgiFail(cgi_info_status_enum cgiFail); |
| OmpEUTRANNeigborListRecT *IratmGeteutranNeighborInfo (void); |
| void iratmTimerInit (void); |
| |
| void RunIratmStateMachine(kal_uint32 MsgId, void *MsgDataP); |
| void ProcessIratmCgiInfo(kal_uint8 *pInfo); |
| kal_bool isIratmProcessedMsg(kal_uint32 MsgId); |
| void ProcessIratmAlmpToLteMeasCtrlReq(void* pMsg); |
| kal_bool IratmGetAlmpMeasCtrlStatus(void); |
| void IratmSetOmpUpdateFlag (kal_bool flag); |
| void IratmSetActiveSetInfo(void); |
| kal_bool IratmCheckIfPriorityChange(OmpEUTRANNeigborListRecT *pEutranNLRec, |
| OmpEUTRANNeigborListRecT *pOmpOtherRatNLRec); |
| kal_bool IratmJudgeIfActiveRatState (void); |
| |
| |
| #endif |
| |
| /***************************************************************************** |
| * End of File |
| *****************************************************************************/ |
| #endif /*_CLCOMP_H_*/ |
| |
| |