T_META_factory_calibration.h
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:33k
源码类别:
MTK
开发平台:
C++ Builder
- /*****************************************************************************
- * 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:
- * ---------
- * T_META_factory_calibration.h
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * Factory calibration thread 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 _T_META_FACTORY_CALIBRATION_H_
- #define _T_META_FACTORY_CALIBRATION_H_
- //---------------------------------------------------------------------------
- #include <Classes.hpp>
- #include "meta.h"
- #include "meta_msg.h"
- #include "rf_common.h"
- #include "META_factory_type.h"
- #include "META_factory_cfg.h"
- #include "meta_const.h"
- #include "crystal_afc.h"
- #ifndef _RF_PM_H_
- #include "rf_pm.h"
- #endif
- #ifndef _RF_APC_8PSK_H_
- #include "rf_apc_8psk.h"
- #endif
- #ifndef _RF_STOP_H_
- #include "rf_stop.h"
- #endif
- #ifndef _RF_MULTISLOTTX_H_
- #include "rf_multislottx.h"
- #endif
- #ifndef _RF_A60111A_REG_H_
- #include "rf_a60111a_reg.h"
- #endif
- // equipment
- #ifndef _RCT_CTRL_H_
- #include "rct_ctrl.h"
- #endif
- #ifndef _BTT_COMMON_H_
- #include "btt_common.h"
- #endif
- #ifndef _BTT_CTRL_H_
- #include "btt_ctrl.h"
- #endif
- #ifndef _WFT_CTRL_H_
- #include "wft_ctrl.h"
- #endif
- #ifndef _DCS_CTRL_H_
- #include "dcs_ctrl.h"
- #endif
- // calibration
- #ifndef _CAL_COMMON_H_
- #include "cal_common.h"
- #endif
- // AFC
- #ifndef _AFCCAL_COMMON_H_
- #include "afccal_common.h"
- #endif
- // TX IQ
- #ifndef _RF_TXIQ_RUN_H_
- #include "rf_txiq_run.h"
- #endif
- // APC calibration
- #ifndef _APCCAL_COMMON_H_
- #include "APCCal_common.h"
- #endif
- #ifndef _T_TXIQ_COMMON_H_
- #include "T_TxIq_common.h"
- #endif
- #ifndef _T_TXPCL_COMMON_H_
- #include "t_txpcl_common.h"
- #endif
- // ADC calibration
- #include "META_factory_ADC_type.h"
- // CV
- #ifndef _BB_CV_H_
- #include "bb_cv.h"
- #endif
- // WiFi TX power calibration
- #ifndef _WIFI_CPTX_H_
- #include "wifi_cptx.h"
- #endif
- #ifndef _WIFI_APC_2400M_H_
- #include "wifi_apc_2400m.h"
- #endif
- #ifndef _WIFI_STOP_H_
- #include "wifi_stop.h"
- #endif
- #ifndef _WIFI_ALC_H_
- #include "wifi_alc.h"
- #endif
- // BT
- #ifndef _BT_POWER_H_
- #include "bt_power.h"
- #endif
- #ifndef _BT_RF_H_
- #include "bt_rf.h"
- #endif
- #ifndef _BT_CON_H_
- #include "bt_con.h"
- #endif
- #ifndef _BT_INFO_MT6601_H_
- #include "bt_info_mt6601.h"
- #endif
- #ifndef _BT_INFO_MT6611_H_
- #include "bt_info_mt6611.h"
- #endif
- extern bool is_suspend_cal;
- //---------------------------------------------------------------------------
- class T_META_factory_calibration : public TThread
- {
- friend void ccb_write_agc_to_fdm();
- friend void ccb_write_afc_to_fdm();
- friend void ccb_write_apc_to_fdm();
- friend void ccb_rf_stop();
- private:
- // common
- // age1960
- ViInt16 MeasFcnDone;
- AnsiString m_asFreqBank;
- AnsiString as_AgeTaModel;
- // common
- // log
- //AnsiString ResultBuf;
- // equiment
- S_RCT *m_pRct;
- S_BTT *m_pBtt;
- S_WFT *m_pWft;
- S_DCS *m_pDcs;
- S_CAL *m_pCal;
- CRCTCTRL m_rct_ctrl;
- CDCSCTRL m_dcs_ctrl;
- CWFTCTRL m_wft_ctrl;
- CBTTCTRL m_btt_ctrl;
- // stop
- CRFSTOP MF_rf_stop;
- // Agilent power supply
- ViStatus vistat;
- TMETA_factory_cfg *cfg;
- TStringList *res;
- int i_current_band; // 0 ~ 4
- // token
- short MF_SelectBand_token;
- short MF_rf_pm_token;
- short MF_rf_afc_token;
- FT_NVRAM_WRITE_REQ MF_rf_pm_write_rec_req;
- FT_NVRAM_WRITE_CNF MF_rf_pm_write_rec_cnf;
- DWORD MF_rf_pm_write_rec_token;
- float MF_rf_pm_power[FrequencyBandCount][PLTABLE_SIZE];
- FT_NVRAM_WRITE_REQ MF_rf_afc_write_rec_req;
- FT_NVRAM_WRITE_CNF MF_rf_afc_write_rec_cnf;
- short MF_rf_afc_write_rec_token;
- short MF_rf_tx_level_token;
- FT_NVRAM_WRITE_REQ MF_rf_tx_level_write_rec_req;
- FT_NVRAM_WRITE_CNF MF_rf_tx_level_write_rec_cnf;
- short MF_rf_tx_level_write_rec_token;
- int i_MF_pm_buf_size, i_MF_AFC_buf_size, i_MF_ramp_table_buf_size;
- char *MF_fdm_write_buf;
- // common
- short m_sARFCN_C0_GSM850;
- short m_sARFCN_C0_GSM;
- short m_sARFCN_C0_DCS;
- short m_sARFCN_C0_PCS;
- // ----------------------------- AFC --------------------------
- // afc
- AnsiString m_asAFC_BAND;
- short m_sAFC_ARFCN;
- short m_sDAC1;
- short m_sDAC2;
- short m_sCRYSTAL_DAC1;
- short m_sCRYSTAL_DAC2;
- short m_sN_AFC;
- //ViStatus vis;
- //int vi_AFC_BAND;
- //long l_FreqOffset2;
- float f_Slope;
- int i_Slope_inv;
- short m_sDefault_value;
- short m_sMaxInitAfcDac;
- short m_sMinInitAfcDac;
- double d_max_AfcSlope;
- double d_min_AfcSlope;
- // --------------------------- crystal AFC ---------------------
- CRFMULTISLOTTX RF_MULTI_SLOT_TX_Obj;
- AnsiString as_CRYSTAL_AFC_BAND;
- short m_sCRYSTAL_AFC_ARFCN;
- double d_CRYSTAL_AFC_TCH_P_DL;
- int i_CRYSTAL_AFC_GSM900_PCL;
- int i_CRYSTAL_AFC_DCS1800_PCL;
- int i_CRYSTAL_AFC_PCS1900_PCL;
- int i_CRYSTAL_AFC_GSM850_PCL;
- short m_sCRYSTAL_AFC_CAL_DAC;
- short m_sCHECK_DAC[2];
- RfSetCrystalCfg_Req CrystalCfg_req;
- //AnsiString as_CRYSTAL_AFC_MIN_FREQ_ERR_PPM;
- //AnsiString as_CRYSTAL_AFC_MIN_FREQ_ERR_PPM;
- double d_CRYSTAL_AFC_MIN_FREQ_ERR_PPM;
- double d_CRYSTAL_AFC_MAX_FREQ_ERR_PPM;
- double m_dCRYSTAL_AFC_MAX_AFC_TRACK_INIT_FREQ_ERR;
- short m_sCRYSTAL_AFC_FREQ_ERR_MEASUSE_COUNT;
- short m_sCRYSTAL_AFC_RECURSIVE_TIMES;
- // CCRYSTALAFC CRYSTAL_AFC_Object;
- ViInt32 PFERIntegrity;
- ViReal64 PFERRMSError;
- ViReal64 PFERPeakError;
- ViReal64 PFERFreqError;
- ViReal64 FreqError[CAP_ID_NUM];
- double d_CAL_Center_Freq;
- double FreqErrorPPM;
- //int init_cap_id;
- //int first_cap_id;
- //int last_cap_id;
- S_CAPID_FREQ_ERR min_CapIdFreqErr;
- S_CAPID_FREQ_ERR cal_CapIdFreqErr;
- S_CAPID_FREQ_ERR chk_CapIdFreqErr[2];
- bool m_bBypassCapIDCal;
- bool m_bFreqErrIncrease;
- bool m_bFirstAfcTracking;
- // ----------------------- RX path loss -------------------------
- short iN_PM;
- char cM_PM;
- AnsiString as_gsm850_max_rx_loss_p, as_gsm850_min_rx_loss_p;
- AnsiString as_gsm900_max_rx_loss_p, as_gsm900_min_rx_loss_p;
- AnsiString as_dcs1800_max_rx_loss_p, as_dcs1800_min_rx_loss_p;
- AnsiString as_pcs1900_max_rx_loss_p, as_pcs1900_min_rx_loss_p;
- // ---------------------- IP2 ------------------------------------
- short m_sIP2_arfcn_C0_GSM;
- short m_sIP2_arfcn_C0_DCS;
- short m_sIP2_arfcn_C0_PCS;
- short m_sIP2_arfcn_C0_GSM850;
- //short m_sIP2_arfcn_TCH_GSM;
- //short m_sIP2_arfcn_TCH_DCS;
- //short m_sIP2_arfcn_TCH_PCS;
- //short m_sIP2_arfcn_TCH_GSM850;
- double d_IP2_CAL_P_DL_ON_SKY;
- double d_IP2_CAL_P_DL_ON_MT;
- double d_IP2_CAL_P_DL_OFF_SKY;
- double d_IP2_CAL_P_DL_OFF_MT;
- double d_IP2_CHECK_P_DL_ON;
- double d_IP2_CHECK_P_DL_OFF;
- double d_IP2_GAIN;
- short i_IP2_N_PM;
- char c_IP2_M_PM;
- int m_iIP2_MAX_IDC_SKY74045;
- int m_iIP2_MAX_QDC_SKY74045;
- int m_iIP2_MAX_IDC_SKY74117;
- int m_iIP2_MAX_QDC_SKY74117;
- int m_iIP2_MAX_IDC_MT6139;
- int m_iIP2_MAX_QDC_MT6139;
- // sky
- int i_IP2_ICORRECTION1_SKY74045;
- int i_IP2_QCORRECTION1_SKY74045;
- int i_IP2_ICORRECTION2_SKY74045;
- int i_IP2_QCORRECTION2_SKY74045;
- int i_IP2_ICORRECTION1_SKY74117;
- int i_IP2_QCORRECTION1_SKY74117;
- int i_IP2_ICORRECTION2_SKY74117;
- int i_IP2_QCORRECTION2_SKY74117;
- int i_IP2_ICORRECTION[2];
- int i_IP2_QCORRECTION[2];
- signed char EvalPmrcx_I_sky[2];
- signed char EvalPmrcx_Q_sky[2];
- unsigned int EvalPmcx_I_sky[2];
- unsigned int EvalPmcx_Q_sky[2];
- int EvalMDC1_I_sky[2];
- int EvalMDC2_I_sky[2];
- int EvalMDC1_Q_sky[2];
- int EvalMDC2_Q_sky[2];
- unsigned int Evalcx_I_sky;
- unsigned int Evalcx_Q_sky;
- c_RFMod_Sky74045_Coef_T mc_sky74045_coef;
- c_RFMod_Sky74117_Coef_T mc_sky74117_coef;
- // RF_SKY74045_Coef_T sky74045_coef;
- // int final_rfid;
- // MT6139
- uc_RFMod_MT6139_Coef_T uc_mt6139_coef;
- // RF_MT6139B_Coef_T mt6139_coef;
- S_MT6139_CW7 m_mt6139_cw7;
- int i_IP2_AMCODEI1;
- int i_IP2_AMCODEQ1;
- int i_IP2_AMCODEI2;
- int i_IP2_AMCODEQ2;
- int i_IP2_AMCODEI[2];
- int i_IP2_AMCODEQ[2];
- int EvalMDC1_I_mt6139[2];
- int EvalMDC2_I_mt6139[2];
- int EvalMDC1_Q_mt6139[2];
- int EvalMDC2_Q_mt6139[2];
- //----------------------------- phase error ----------------------
- // AnsiString as_PHASE_ERROR_BAND;
- // int vi_PHASE_ERROR_BAND;
- // short m_sPHASE_ERROR_ARFCN;
- // int i_PHASE_ERROR_PCL;
- // int i_PHASE_ERROR_MEASUSE_COUNT;
- // double d_PHASE_ERROR_RMS_ERROR;
- // short MF_rf_tx_level_token_TrOff;
- // short MF_rf_setbbtx_cfg_token_TrOff;
- // ViInt32 IQTIntegrity;
- // ViReal64 IQTSpurFreq;
- // ViReal64 IQTSpurLevel;
- // ViReal64 IQTResultsArray[age1960_IQ_ARRAY_MIN];
- // ViReal64 IQTFreqsArray[age1960_IQ_ARRAY_MIN];
- // ViInt32 IQTTuningCount;
- // ViReal64 d_OOS[4];
- // ViReal64 d_POOS[4];
- // ViReal64 d_SBS[3];
- // ViReal64 d_PSBS[3];
- // ViReal64 CheckPhaseErr;
- //
- // int begin_Offset_IQ;
- // int end_Offset_IQ;
- // int last_Off_IQ[2];
- // sIQ Offset_IQ;
- // sOffsetIQPhaseErr min_OffIPhErr;
- // sOffsetIQPhaseErr min_OffQPhErr;
- // sOffsetIQPhaseErr cal_OffIQPhErr[2];
- //----------------------------- TX IQ ----------------------
- CRFTXIQRUN m_cTXIQ_RUN_Obj;
- unsigned int m_uiTX_IQ_MEASUREMENT_COUNT;
- AnsiString m_asTX_IQ_BAND;
- int m_viTX_IQ_BAND;
- short m_sTX_IQ_ARFCN;
- short m_sTX_IQ_PCL;
- double m_dTX_IQ_DC_OFFSET_MAX;
- double m_dTX_IQ_GAIN_IMBALANCE_MAX;
- AnsiString m_asTX_IQ_BAND_HIGH;
- int m_viTX_IQ_BAND_HIGH;
- short m_sTX_IQ_ARFCN_HIGH;
- short m_sTX_IQ_PCL_HIGH;
- double m_dTX_IQ_DC_OFFSET_MAX_HIGH;
- double m_dTX_IQ_GAIN_IMBALANCE_MAX_HIGH;
- // RfBBTXCfg2 m_sRfBbTxCfg2Req;
- // RfBBTXCfg2 m_sRfBbTxCfg2Cnf;
- //----------------------------- TX IQ imbalance ----------------------
- // AnsiString as_TX_IQ_IMBALANCE_BAND;
- // int vi_TX_IQ_IMBALANCE_BAND;
- // short m_sTX_IQ_IMBALANCE_ARFCN;
- // int i_TX_IQ_IMBALANCE_PCL;
- // double d_TX_IQ_IMBALANCE_MAX;
- // ----------------------------------- TX -------------------
- char chTXPowerON[100], chTXPowerOFF[100];
- AnsiString TxdBmStr;
- double d_P_DL;
- int i_TX_level_count;
- int i_TX_level_index_high, i_TX_level_index_mid, i_TX_level_index_low;
- int i_N_TX ; // TX frames
- int i_TXlevelRecusiveTimes;
- int CheckIndex;
- #ifdef _MYDEBUG_
- unsigned short hr,min,sec,ms;
- #endif
- TNotifyEvent neSuccess;
- TNotifyEvent neByUser;
- //------------------------------ APC -------------------------
- int m_iApcDcOffset;
- AnsiString m_as_gsm400_tx_cal_pcl, m_as_gsm400_tx_2cal_pcl, m_as_gsm400_tx_pcl, m_as_gsm400_tx_check_pcl, m_as_gsm400_max_p, m_as_gsm400_wanted_p, m_as_gsm400_min_p, m_as_gsm400_c, m_as_gsm400_correction;
- AnsiString m_as_gsm850_tx_cal_pcl, m_as_gsm850_tx_2cal_pcl, m_as_gsm850_tx_pcl, m_as_gsm850_tx_check_pcl, m_as_gsm850_max_p, m_as_gsm850_wanted_p, m_as_gsm850_min_p, m_as_gsm850_c, m_as_gsm850_correction;
- AnsiString m_as_gsm900_tx_cal_pcl, m_as_gsm900_tx_2cal_pcl, m_as_gsm900_tx_pcl, m_as_gsm900_tx_check_pcl, m_as_gsm900_max_p, m_as_gsm900_wanted_p, m_as_gsm900_min_p, m_as_gsm900_c, m_as_gsm900_correction;
- AnsiString m_as_dcs1800_tx_cal_pcl, m_as_dcs1800_tx_2cal_pcl, m_as_dcs1800_tx_pcl, m_as_dcs1800_tx_check_pcl, m_as_dcs1800_max_p, m_as_dcs1800_wanted_p, m_as_dcs1800_min_p, m_as_dcs1800_c, m_as_dcs1800_correction;
- AnsiString m_as_pcs1900_tx_cal_pcl, m_as_pcs1900_tx_2cal_pcl, m_as_pcs1900_tx_pcl, m_as_pcs1900_tx_check_pcl, m_as_pcs1900_max_p, m_as_pcs1900_wanted_p, m_as_pcs1900_min_p, m_as_pcs1900_c, m_as_pcs1900_correction;
- AnsiString m_as_gsm850_tx_4cal_pcl;
- AnsiString m_as_gsm900_tx_4cal_pcl;
- AnsiString m_as_dcs1800_tx_4cal_pcl;
- AnsiString m_as_pcs1900_tx_4cal_pcl;
- AnsiString m_as_gsm850_tx_6cal_pcl;
- AnsiString m_as_gsm900_tx_6cal_pcl;
- AnsiString m_as_dcs1800_tx_6cal_pcl;
- AnsiString m_as_pcs1900_tx_6cal_pcl;
- AnsiString m_as_gsm850_tx_6cal_dac;
- AnsiString m_as_gsm900_tx_6cal_dac;
- AnsiString m_as_dcs1800_tx_6cal_dac;
- AnsiString m_as_pcs1900_tx_6cal_dac;
- short m_s_gsm850_epsk_tx_1cal_pcl;
- short m_s_gsm900_epsk_tx_1cal_pcl;
- short m_s_dcs1800_epsk_tx_1cal_pcl;
- short m_s_pcs1900_epsk_tx_1cal_pcl;
- AnsiString m_as_gsm400_epsk_tx_cal_pcl, m_as_gsm400_epsk_tx_2cal_pcl, m_as_gsm400_epsk_tx_pcl, m_as_gsm400_epsk_tx_check_pcl, m_as_gsm400_epsk_max_p, m_as_gsm400_epsk_wanted_p, m_as_gsm400_epsk_min_p, m_as_gsm400_epsk_c, m_as_gsm400_epsk_correction;
- AnsiString m_as_gsm850_epsk_tx_cal_pcl, m_as_gsm850_epsk_tx_2cal_pcl, m_as_gsm850_epsk_tx_pcl, m_as_gsm850_epsk_tx_check_pcl, m_as_gsm850_epsk_max_p, m_as_gsm850_epsk_wanted_p, m_as_gsm850_epsk_min_p, m_as_gsm850_epsk_c, m_as_gsm850_epsk_correction;
- AnsiString m_as_gsm900_epsk_tx_cal_pcl, m_as_gsm900_epsk_tx_2cal_pcl, m_as_gsm900_epsk_tx_pcl, m_as_gsm900_epsk_tx_check_pcl, m_as_gsm900_epsk_max_p, m_as_gsm900_epsk_wanted_p, m_as_gsm900_epsk_min_p, m_as_gsm900_epsk_c, m_as_gsm900_epsk_correction;
- AnsiString m_as_dcs1800_epsk_tx_cal_pcl, m_as_dcs1800_epsk_tx_2cal_pcl, m_as_dcs1800_epsk_tx_pcl, m_as_dcs1800_epsk_tx_check_pcl, m_as_dcs1800_epsk_max_p, m_as_dcs1800_epsk_wanted_p, m_as_dcs1800_epsk_min_p, m_as_dcs1800_epsk_c, m_as_dcs1800_epsk_correction;
- AnsiString m_as_pcs1900_epsk_tx_cal_pcl, m_as_pcs1900_epsk_tx_2cal_pcl, m_as_pcs1900_epsk_tx_pcl, m_as_pcs1900_epsk_tx_check_pcl, m_as_pcs1900_epsk_max_p, m_as_pcs1900_epsk_wanted_p, m_as_pcs1900_epsk_min_p, m_as_pcs1900_epsk_c, m_as_pcs1900_epsk_correction;
- AnsiString m_as_gsm400_epsk_tx_4cal_pcl;
- AnsiString m_as_gsm850_epsk_tx_4cal_pcl;
- AnsiString m_as_gsm900_epsk_tx_4cal_pcl;
- AnsiString m_as_dcs1800_epsk_tx_4cal_pcl;
- AnsiString m_as_pcs1900_epsk_tx_4cal_pcl;
- short m_sMAX_APC_DAC;
- char m_cTSC;
- ViReal64 m_virTX; // double
- ViInt32 m_viPowerInteg;
- AnsiString m_asTSC;
- AnsiString m_asAPC_Check;
- double m_dAPC_Delta;
- unsigned short real_support_band_num;
- unsigned short m_usPCLDacValue[MAX_SUPPORT_BAND_NUM][RF_TX_LEVEL_6_CAL_COUNT];
- unsigned short m_usPCLDacValue_EPSK[MAX_SUPPORT_BAND_NUM][RF_TX_LEVEL_6_CAL_COUNT];
- unsigned short m_usPCLDacValue_ideal[MAX_SUPPORT_BAND_NUM][RF_RAMP_TABLE_TX_LEVEL_COUNT];
- unsigned short m_usPCLDacValue_ideal_EPSK[MAX_SUPPORT_BAND_NUM][RF_RAMP_TABLE_TX_LEVEL_COUNT];
- double m_dPCL_dBm[MAX_SUPPORT_BAND_NUM][RF_TX_LEVEL_6_CAL_COUNT];
- double m_dPCL_dBm_EPSK[MAX_SUPPORT_BAND_NUM][RF_TX_LEVEL_6_CAL_COUNT];
- double m_dPCL_power[MAX_SUPPORT_BAND_NUM][RF_TX_LEVEL_6_CAL_COUNT];
- double m_dPCL_power_EPSK[MAX_SUPPORT_BAND_NUM][RF_TX_LEVEL_6_CAL_COUNT];
- double m_dPCL_power_ideal[MAX_SUPPORT_BAND_NUM][RF_RAMP_TABLE_TX_LEVEL_COUNT];
- double m_dPCL_dbm_ideal[MAX_SUPPORT_BAND_NUM][RF_RAMP_TABLE_TX_LEVEL_COUNT];
- double m_dV_set[MAX_SUPPORT_BAND_NUM][RF_TX_LEVEL_6_CAL_COUNT];
- double m_dV_set_EPSK[MAX_SUPPORT_BAND_NUM][RF_TX_LEVEL_6_CAL_COUNT];
- double m_dRload_high[MAX_SUPPORT_BAND_NUM], Rload_low[MAX_SUPPORT_BAND_NUM];
- double m_dK1_high[MAX_SUPPORT_BAND_NUM], K1_low[MAX_SUPPORT_BAND_NUM];
- double m_dV_set_ideal[MAX_SUPPORT_BAND_NUM][RF_RAMP_TABLE_TX_LEVEL_COUNT];
- // bool TX_PCL_OUT_OF_RANGE_FLAG;
- // Skyworks 77328
- double m_dSKY77328_GSM850_MAX_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM850_WANTED_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM850_MIN_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM900_MAX_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM900_WANTED_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM900_MIN_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_DCS1800_MAX_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_DCS1800_WANTED_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_DCS1800_MIN_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_PCS1900_MAX_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_PCS1900_WANTED_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_PCS1900_MIN_HIGH_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM850_MAX_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM850_WANTED_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM850_MIN_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM900_MAX_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM900_WANTED_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_GSM900_MIN_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_DCS1800_MAX_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_DCS1800_WANTED_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_DCS1800_MIN_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_PCS1900_MAX_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_PCS1900_WANTED_LOW_APC_DC_OFFSET_P;
- double m_dSKY77328_PCS1900_MIN_LOW_APC_DC_OFFSET_P;
- int i_SKY77328_DAC_Delta;
- double d_SKY77328_GSM850_M;
- double d_SKY77328_GSM900_M;
- double d_SKY77328_DCS1800_M;
- double d_SKY77328_PCS1900_M;
- int i_SKY77328_GSM850_TARGET_PCL;
- int i_SKY77328_GSM900_TARGET_PCL;
- int i_SKY77328_DCS1800_TARGET_PCL;
- int i_SKY77328_PCS1900_TARGET_PCL;
- AnsiString m_asAXIOM502_GSM850_SWITCH_PCL;
- AnsiString m_asAXIOM502_GSM900_SWITCH_PCL;
- AnsiString m_asAXIOM502_DCS1800_SWITCH_PCL;
- AnsiString m_asAXIOM502_PCS1900_SWITCH_PCL;
- // EPSK APC
- CRFAPC8PSK RF_APC_8PSK_Obj;
- CRFA60111AREG m_RF_A60111A_REG_Obj;
- //------------------------- ADC calibration -----------------------
- int i_ADC_V1;
- int i_ADC_V2;
- int i_ADC_CHECK_VOLTAGE;
- int i_NORMAL_VOLTAGE;
- int i_CURRENT_LIMIT;
- int i_MAX_BATTERY_ADC_SLOPE;
- int i_MIN_BATTERY_ADC_SLOPE;
- int i_MAX_BATTERY_ADC_OFFSET;
- int i_MIN_BATTERY_ADC_OFFSET;
- int i_BATTERY_CHANNEL;
- int i_CHARGER_CHANNEL;
- double d_ADC_RESISTANCE;
- double d_MAX_VOLTAGE_DIFFERENCE;
- double d_MAX_CURRENT_DIFFERENCE;
- int i_ADC_MEASUREMENT_COUNT;
- META_RESULT MetaResult;
- short BBID_ADC;
- AnsiString as_ID;
- float ADC_Measure_Voltage[3];
- float BATTERY_ADC_Output[3];
- float CHARGER_ADC_Output[3];
- float BATTERY_ADC_Predict_Voltage;
- float CHARGER_ADC_Predict_Voltage;
- // sub-function result
- bool result;
- // CV
- char m_cMAX_CV_STEP;
- char m_cMIN_CV_STEP;
- CBBCV m_cBB_CV_Obj;
- // WiFi common
- AnsiString m_asWiFi_Support;
- //------------------------ WiFi TX power calibration ----------------
- CWIFICPT m_cWIFI_CPT_Obj;
- CWIFISTOP m_cWIFI_STOP_Obj;
- double m_dCCK_MAX_P;
- double m_dCCK_WANTED_P;
- double m_dCCK_MIN_P;
- double m_dCCK_Delta;
- int m_iCCK_C;
- AnsiString m_as802_11B_CAL_CHANNEL;
- AnsiString m_as802_11B_CHECK_CHANNEL;
- double m_dCCK_CAL_RATE;
- WiFi_TestRate_E m_eCCK_CAL_RATE;
- double m_dCCK_CHECK_RATE;
- WiFi_TestRate_E m_eCCK_CHECK_RATE;
- double m_dOFDM_MAX_P;
- double m_dOFDM_WANTED_P;
- double m_dOFDM_MIN_P;
- double m_dOFDM_Delta;
- int m_iOFDM_C;
- AnsiString m_as802_11G_CAL_CHANNEL;
- AnsiString m_as802_11G_CHECK_CHANNEL;
- double m_dOFDM_CAL_RATE;
- WiFi_TestRate_E m_eOFDM_CAL_RATE;
- double m_dOFDM_CHECK_RATE;
- WiFi_TestRate_E m_eOFDM_CHECK_RATE;
- int m_iWiFiTxPRecursive_Times;
- // BT common
- CBTCT m_cBT_CT_Obj;
- CBTPOWER m_cBT_POWER_Obj;
- CBTRF m_cBT_RF_Obj;
- AnsiString m_asBD_Address;
- AnsiString m_asInquiry_Enable;
- double m_dBT_DOWNLINK_POWER;
- // BT crystal CAP ID
- unsigned char m_ucBT_CRYSTAL_CAP_ID1;
- unsigned char m_ucBT_CRYSTAL_CAP_ID2;
- unsigned short m_usBT_CRYSTAL_CHANNEL;
- double m_dBT_CRYSTAL_MAX_FREQ_ACCURACY;
- unsigned int m_uiMIN_POLL_COUNT;
- unsigned int m_uiMAX_POLL_COUNT;
- protected:
- void __fastcall Execute();
- public:
- TYPE_META_FACTORY_CONTROL ctrl;
- TYPE_META_FACTORY_ADC_CONTROL ADC_ctrl;
- TStringList *log;
- __fastcall T_META_factory_calibration(
- bool CreateSuspended,
- TYPE_META_FACTORY_CONTROL MF_ctrl,
- TYPE_META_FACTORY_ADC_CONTROL MF_ADC_ctrl, // for ADC calibration
- TMETA_factory_cfg *MF_cfg,
- TStringList *st_Log,
- TNotifyEvent ne_onTermSuccess,
- TNotifyEvent ne_onTermByUser,
- AnsiString as_ID_par,
- AnsiString as_TaModel,
- S_RCT *p_Rct,
- S_BTT *p_Btt,
- S_WFT *p_Wft,
- S_DCS *p_Dcs,
- S_CAL *p_Cal
- );
- __fastcall ~T_META_factory_calibration();
- bool WriteCalResultFile(void);
- // Agilent power supply
- bool __fastcall SetNormalVoltageAndCloseAgilentPowerSupply(void);
- bool __fastcall SetAgilentPowerSupplyToV1Voltage(void);
- bool __fastcall SetAgilentPowerSupplyToV2Voltage(void);
- bool __fastcall SetAgilentPowerSupplyToCheckVoltage(void);
- bool __fastcall AgilentPowerSupplyMeasureVoltage(ViReal64 *measvoltage_par);
- // timer
- bool __fastcall RestartTimerADCCal(int TimeoutID);
- bool __fastcall RestartTimerCal(int TimeoutID);
- // calibration procedure
- bool __fastcall WriteInitValueToNVRAM(void);
- bool __fastcall AFCCal(void);
- bool __fastcall AFCSlopeCal(int vi_band, short bch, float &slope, unsigned short &init_value);
- bool __fastcall CrystalAFCCapIDCommon(void);
- bool __fastcall CrystalAFCCapIDPreCheck(void);
- bool __fastcall CrystalAFCCapIDCalInc(void);
- bool __fastcall CrystalAFCCapIDCalDec(void);
- bool __fastcall CrystalAFCCapIDCheck_Normal(void);
- bool __fastcall CrystalAFCCapIDCheck_BypassCapIDCal(void);
- bool __fastcall CrystalAFCMeasureRxFreqErr(void);
- bool __fastcall CrystalTXAfcOffsetCal(void);
- int __fastcall Get_CRYSTAL_AFC_PCL(AnsiString as_band);
- bool __fastcall RxPathLossCal(void);
- bool __fastcall IP2Cal(void);
- bool __fastcall IP2Cal_sky74045_cal(void);
- bool __fastcall IP2Cal_sky74045_check(void);
- bool __fastcall IP2Cal_sky74117_cal(void);
- bool __fastcall IP2Cal_sky74117_check(void);
- bool __fastcall IP2Cal_mt6139b_cal(void);
- bool __fastcall IP2Cal_mt6139c_cal(void);
- bool __fastcall IP2Cal_mt6139_check(void);
- bool __fastcall TXPCLCal(void);
- bool __fastcall TXPCLCal_FullCal(void);
- bool __fastcall TXPCLCal_EPSK_FullCal(void);
- bool __fastcall TXPCLCal_EPSK_FullCal_A60111A(void);
- bool __fastcall TXPCLCal_EPSK_1cal(void);
- bool __fastcall TXPCLCal_2cal(void);
- bool __fastcall TXPCLCal_EPSK_2cal(void);
- bool __fastcall TXPCLCal_3cal(void);
- bool __fastcall TXPCLCal_EPSK_3cal(void);
- bool __fastcall TXPCLCal_4cal(void);
- bool __fastcall TXPCLCal_6cal_DAC(void);
- bool __fastcall TXPCLCal_EPSK_4cal(void);
- bool __fastcall TXPCLCal_RFMD3140_3PCLEvalDac(void);
- bool __fastcall TXPCLCal_EvalDac_RenesasPF08155B(void);
- bool __fastcall TXPCLCal_EvalDac_RenesasPF09016B(void);
- bool __fastcall TXPCLCal_CalApcDcOffset_Skyworks77328(void);
- bool __fastcall TXPCLCal_EvalDac_Skyworks77328(void);
- bool __fastcall TXPCLCal_EPSK_Skyworks77316_cal(void);
- bool __fastcall TXPCLCal_EvalDac_Skyworks77316_GMSK(void);
- bool __fastcall TXPCLCal_EvalDac_Skyworks77316_EPSK(void);
- bool __fastcall TXPCLCal_EvalDac_RFMD3159_FixedPaBias(void);
- bool __fastcall TXPCLCal_Axiom502_3PCLEvalDac(void);
- bool __fastcall TXPCLCal_EvalDac_A60111A_EPSK(void);
- bool __fastcall TXPCLCal_check(void);
- bool __fastcall TXPCLCal_EPSK_check(void);
- bool __fastcall TXIqCal(void);
- bool __fastcall TXIqCal_EPSK(void);
- bool __fastcall TXIqCheck_EPSK(bool low_band, int stage, S_TXIQ iq, S_TXIQ_RESULT &result);
- ViReal64 __fastcall get_TX_Original_Offset(ViReal64 *p_IQTFreqs, ViReal64 *p_IQTResults, ViInt32 IQTTuningCount);
- ViReal64 __fastcall get_TX_IQ_Imbalance(ViReal64 *p_IQTFreqs, ViReal64 *p_IQTResults, ViInt32 IQTTuningCount);
- bool __fastcall EquConfigPFER( void );
- bool __fastcall FetchAverageFreqErr( ViReal64& AvgFreqErr );
- bool __fastcall FetchSigAverageFreqErr( ViReal64& AvgFreqErr );
- bool __fastcall FetchRMSPhaseErr( ViReal64* RMSPhaseErr );
- bool __fastcall ADCCal(void);
- bool __fastcall CVCal_cal(void);
- bool __fastcall CVCal_check(void);
- bool __fastcall WiFiTxPclCal_cal(void);
- bool __fastcall WiFiTxPclCal_check(void);
- bool __fastcall WiFiTxDcOffsetCal(void);
- bool __fastcall BTCrystalCapIDCal_MT6601(void);
- bool __fastcall BTCrystalCapIDCheck_MT6601(void);
- bool __fastcall BTCrystalCapIDCal_MT6611(void);
- bool __fastcall BTCrystalCapIDCheck_MT6611(void);
- //------------------------------- CFG -------------------------------
- // GSM/GPRS/EDGE CFG
- void __fastcall Read_Common_CFG(void);
- void __fastcall Read_AFC_CFG(void);
- void __fastcall Read_CrystalAFC_CFG(void);
- void __fastcall Read_RxPathLoss_CFG(void);
- void __fastcall Read_TXPCL_CFG(void);
- void __fastcall Read_EPSK_TXPCL_CFG(void);
- void __fastcall Read_IP2_CFG(void);
- void __fastcall Read_TxIq_CFG(void);
- void __fastcall Read_ADC_CFG(void);
- void __fastcall Read_CV_CFG(void);
- // WiFi CFG
- void __fastcall Read_WiFi_Common_CFG(void);
- void __fastcall Read_WiFi_IQviewInit_CFG(void);
- void __fastcall Read_WiFi_AgeN4010aInit_CFG(void);
- void __fastcall Read_WiFi_TxPcl_CFG(void);
- // BT CFG
- void __fastcall Read_BT_CMU200_CFG(void);
- void __fastcall Read_BT_CBT_CFG(void);
- void __fastcall Read_BT_Common_CFG(void);
- void __fastcall Read_BT_CrystalCapID_CFG(void);
- //------------------------------ cal file ----------------------------
- bool __fastcall Get_CalFilePathName(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath, AnsiString& asPathName);
- bool __fastcall WriteIP2CalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath, unsigned int rfmod_id, int band);
- bool __fastcall WriteIP2RxAmCalModeToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath, unsigned int rfmod_id);
- bool __fastcall WriteAFCCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath);
- bool __fastcall WriteCrystalAFCCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath);
- bool __fastcall WriteAGCCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath, FrequencyBand freqband);
- bool __fastcall WriteTxDcOffsetCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath);
- bool __fastcall WriteAPCCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath, int band);
- bool __fastcall WriteEpskAPCCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath, int band);
- bool __fastcall WriteTxPhaseErrCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath);
- bool __fastcall WriteADCCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath);
- bool __fastcall WriteBtCapIDCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath, BT_ModuleID_S bt_module);
- bool __fastcall WriteWiFiAPCCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath, E_WIFI_GENERATION e_802_11_idx);
- bool __fastcall WriteWiFiALCCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath);
- bool __fastcall WriteWiFiTxDcOffsetCalResultToFile(AnsiString asCalFile, AnsiString asExeName, bool b_CalResultPath);
- // msg
- void PostErrorMsg( ErrorMsg error_msg );
- void CalErrorHandler( ErrorMsg error_msg );
- //
- };
- //---------------------------------------------------------------------------
- #endif