blob: 5924338accb0dd26ce8526419f3224f1fadb37e0 [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_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