rf_apc.h
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:11k
- /*****************************************************************************
- * 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:
- * ---------
- * rf_apc.h
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * RF APC header
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- #ifndef _RF_APC_H_
- #define _RF_APC_H_
- #include <vcl.h>
- #include <IniFiles.hpp>
- // common
- #ifndef _METAAPP_COMMON_H_
- #include "metaapp_common.h"
- #endif
- #ifndef META_DLL_H
- #include "meta.h"
- #endif
- #ifndef _MAN_HANDLE_H_
- #include "man_handle.h"
- #endif
- // RF
- #ifndef _RF_COMMON_H_
- #include "rf_common.h"
- #endif
- /*---------------------------------------------------------------------------*/
- #define LOW_VOLTAGE_INDEX 0
- #define MID_VOLTAGE_INDEX 1
- #define HIGH_VOLTAGE_INDEX 2
- #define LOW_TEMPERATURE_INDEX 0
- #define MID_TEMPERATURE_INDEX 1
- #define HIGH_TEMPERATURE_INDEX 2
- #define MAX_RENESAS_BV_WORD_NUM 4
- #define BATTERY_COMPENSATE_SCALE 16384
- #define ADDR_WORD_C3 0x03
- #define ADDR_BV_WORD_6_4_0 0x26
- #define ADDR_BV_WORD_6_5_0 0x2E
- #define ADDR_BV_WORD_6_6_0 0x36
- #define ADDR_BV_WORD_6_7_0 0x3E
- #define RENESAS_W640_INDEX 0
- #define RENESAS_W650_INDEX 1
- #define RENESAS_W660_INDEX 2
- #define RENESAS_W670_INDEX 3
- #define RAMP_UP_INDEX 0
- #define RAMP_DN_INDEX 1
- /*---------------------------------------------------------------------------*/
- #define WEIGHT_SCALE (1<<14)
- /*---------------------------------------------------------------------------*/
- typedef struct
- {
- bool TadoSupport;
- bool valid;
- }
- sRFTADO;
- typedef struct
- {
- bool SetRampTableSupport;
- bool valid;
- }
- sRFSETRAMP;
- //--------------------------------------------------------------------------
- class CRFAPC
- {
- private:
- // common
- bool m_bDownloadTrigger;
- CMETAHANDLE m_META_HANDLE_Obj;
- unsigned int m_uiRfModId;
- E_METAAPP_RESULT_T m_eConfirmState;
- bool m_bTADOSupport;
-
- // band
- //RFBandSupport_S band_support;
-
- // APC
- int CurWRBand;
- short RampApcLevelToken;
- int ApcBufSize;
- char *ApcBuf;
- // Word3
- // int Word3BufSize;
- // char *Word3Buf;
- // B5P
- int B5PBufSize;
- char *B5PBuf;
- RF_BRIGHT5P_Coef_T b5p_coef;
- unsigned int W6S;
- unsigned short m_usHighApcDcOffset[MAX_SUPPORT_BAND_NUM];
- unsigned short m_usLowApcDcOffset[MAX_SUPPORT_BAND_NUM];
- int m_iApcLowestPower[MAX_SUPPORT_BAND_NUM];
- l1cal_rampTable_T m_sApcProfile[MAX_SUPPORT_BAND_NUM];
- bool m_bSingleBand;
- RfSetRampApcLevel_Req RampApcLevelReq;
- // query
- bool *p_rf_set_ramp_table_support;
- bool *pb_TwoApcDcOffsetSupport;
- protected:
- public:
- void Confirm(E_METAAPP_RESULT_T confirm_state);
- CRFAPC(void);
- ~CRFAPC();
- void REQ_Finish(void);
- void REQ_TimeOut(void);
- void REQ_ReadApcFromNVRAM(void);
- void CNF_ReadApcFromNVRAM(void);
- void REQ_WriteApcToNVRAM(void);
- void CNF_WriteApcToNVRAM(void);
- void CNF_ReadWord3FromNVRAM(void);
- void CNF_WriteWord3ToNVRAM(void);
- void CNF_ReadB5PFromNVRAM(void);
- void CNF_WriteB5PToNVRAM(void);
- // BV
- void Compose_word6_4_0(sBVW0 &bvw0, unsigned int &word6_4_0);
- void Compose_word6_5_0(sBVW0 &bvw0, unsigned int &word6_5_0);
- void Compose_word6_6_0(sBVW0 &bvw0, unsigned int &word6_6_0);
- void Compose_word6_7_0(sBVW0 &bvw0, unsigned int &word6_7_0);
- void DeCompose_word6_x_0(unsigned int &word6_x_0, sBVW0 &bvw6x0);
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
- // Public member
- void (*ConfirmCallback)(void);
- // Public interface
- void REQ_Stop(void);
- void REQ_Read_APC_From_NVRAM_Start(unsigned int rf_id, bool b_tapo_support);
- void REQ_Read_APC_From_NVRAM_Single_Band_Start(unsigned int rf_id, int band, bool b_tapo_support);
- void REQ_Write_APC_To_NVRAM_Start(unsigned int rf_id, bool b_tapo_support);
- void REQ_Write_APC_To_NVRAM_Single_Band_Start(unsigned int rf_id, int band, bool b_tapo_support);
- void REQ_Read_B5P_From_NVRAM(void);
- void REQ_Write_B5P_To_NVRAM(void);
- // ini
- bool ApcGSM850SectionExist(char *filename);
- bool ApcGSM900SectionExist(char *filename);
- bool ApcDCS1800SectionExist(char *filename);
- bool ApcPCS1900SectionExist(char *filename);
- bool ApcSectionExist(char *filename, int band);
- bool AnyApcSectionExist(char *filename);
- bool RenesasWord3SectionExist(char *filename);
- bool RenesasWord6sSectionExist(char *filename);
- bool REQ_Read_APC_From_File_Single_Band(char *filename, unsigned int rf_id, int band, bool b_tapo_support);
- bool REQ_Read_APC_From_File(char *filename, unsigned int rf_id, bool b_tapo_support);
- bool REQ_Read_TX_AFC_DAC_offset_From_File(char *filename);
- bool REQ_Read_TX_AFC_DAC_offset_From_File_Single_Band(char *filename, int band);
- bool REQ_Read_Word3_From_File(char *filename);
- bool REQ_Read_Word6s_From_File(char *filename);
- bool REQ_Read_W64_From_File(TIniFile *ini_file);
- bool REQ_Read_W65_From_File(TIniFile *ini_file);
- bool REQ_Read_W66_From_File(TIniFile *ini_file);
- bool REQ_Read_W67_From_File(TIniFile *ini_file);
- bool REQ_Write_APC_To_File_Single_Band(char *filename, unsigned int rf_id, int band, bool b_tapo_support);
- bool REQ_Write_APC_To_File(char *filename, unsigned int rf_id, bool b_tapo_support);
- bool REQ_Write_Word3_To_File(char *filename);
- bool REQ_Write_Word6s_To_File(char *filename);
- bool REQ_Write_W64_To_File(TIniFile *ini_file);
- bool REQ_Write_W65_To_File(TIniFile *ini_file);
- bool REQ_Write_W66_To_File(TIniFile *ini_file);
- bool REQ_Write_W67_To_File(TIniFile *ini_file);
- bool REQ_Write_To_M12193(char *filename, unsigned int rf_id);
- //bool Req_SetWord3ToReg( RF_BRIGHT5P_Coef_T &rf_mod_coef );
- bool Req_SetB5PToReg(RF_BRIGHT5P_Coef_T &rf_mod_coef);
- bool Set_RenesasCoef(RF_BRIGHT5P_Coef_T &rf_mod_coef);
- bool Get_RenesasCoef(RF_BRIGHT5P_Coef_T &rf_mod_coef);
- void Set_W6sImmediateBSI(unsigned int w6s);
- bool Get_BvMode(void);
- void Set_BvMode(unsigned int bvmode);
- void Compose_wordC3(sC3Mode c3mode, unsigned int &wordC3);
- void DeCompose_wordC3(unsigned int wordC3, sC3Mode & c3mode);
- void REQ_SetW6sImmediateBSI_Start(unsigned int w6s);
- void REQ_SetW6sImmediateBSI(void);
- void Req_Rf_SetRampApcLevel(FrequencyBand rf_band, int power_level, int apc_dac);
- // APC calibration
- bool Get_RealApcDcOffset(bool b_tadosupport, int band_idx, int pcl, int &apc_dc_offset);
- bool Set_RealApcDcOffset(bool b_tadosupport, int band_idx, int pcl, int apc_dc_offset);
- bool Get_SubBandWeighting(l1cal_rampTable_T apc_profile, int arfcn, unsigned short pcl, unsigned short &weight);
- bool Get_RightTopRampUpValue(l1cal_rampTable_T apc_profile, E_BANDSEL band_idx, int pcl, unsigned short &ramp_value);
- bool Get_BatteryCompensate(l1cal_rampTable_T apc_profile, int voltage_idx, int temp_idx, unsigned short &battery_compensate);
- // callback
- void __stdcall CNF_RfSetRampApcLevl(const unsigned char cnf, const short token, void *usrData);
- // runtime settting
- void REQ_RfSetRampTable_Start(unsigned int rf_id, bool b_tapo_support, int band_idx);
- bool REQ_RfSetRampTable(void);
- // query
- void Query_RfSetRampTable_Start(bool &RfSetRampTableSupport);
- bool Query_RfSetRampTable(void);
- void Query_TwoApcDcOffset_Start(bool &b_two_apc_dc_offset_support);
- bool Query_TwoApcDcOffset(void);
- // Global information
- E_METAAPP_RESULT_T Get_ConfirmState(void);
- unsigned short Get_HighApcDcOffset(int band_idx);
- void Set_HighApcDcOffset(int band_idx, unsigned short ApcDcOffset);
- unsigned short Get_LowApcDcOffset(int band_idx);
- void Set_LowApcDcOffset(int band_idx, unsigned short ApcDcOffset);
- int Get_ApcLowestPower(int band_idx);
- void Set_ApcLowestPower(int band_idx, int apc_lowest_power);
- short Get_TxAfcOffset(int band_idx);
- void Set_TxAfcOffset(int band_idx, short tx_afc_offset);
- l1cal_rampTable_T* Get_ApcProfile(int band_idx);
- void Set_ApcProfile(int band_idx, l1cal_rampTable_T apc_profile);
- unsigned short Get_ApcProfilePower(int band_idx, int pcl_idx);
- void Set_ApcProfilePower(int band_idx, int pcl_idx, unsigned short power);
- };
- /*---------------------------------------------------------------------------*/
- #endif