T_TXPCL_Skyworks77328.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:71k
源码类别:
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_TXPCL_Skyworks77328.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * Skyworks 77328 TX PCL source
- *
- * 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!!
- *============================================================================
- ****************************************************************************/
- #include <assert.h>
- #include <math.h>
- #pragma hdrstop
- #ifndef _T_META_FACTORY_CALIBRATION_H_
- #include "T_META_factory_calibration.H"
- #endif
- #ifndef _CAL_COMMON_H_
- #include "cal_common.h"
- #endif
- #ifndef _APCCAL_COMMON_H_
- #include "apccal_common.h"
- #endif
- #ifndef _RF_APC_H_
- #include "rf_apc.h"
- #endif
- // callback
- #ifndef _META_FACTORY_RF_CB_H_
- #include "meta_factory_rf_cb.h"
- #endif
- #ifndef _META_FACTORY_NVRAM_CB_H_
- #include "meta_factory_nvram_cb.h"
- #endif
- // form
- #ifndef _META_FACTORY_H_
- #include "META_Factory.h"
- #endif
- // equipment
- #ifndef _AGECOMMON_H_
- #include "agecommon.h"
- #endif
- #ifndef _AGE_MISC_H_
- #include "age_misc.h"
- #endif
- // misc
- #ifndef _FT_UTILS_H_
- #include "ft_utils.h"
- #endif
- #ifndef _BAND_UTILS_H_
- #include "band_utils.h"
- #endif
- #ifndef _GSM_UTILS_H_
- #include "gsm_utils.h"
- #endif
- #ifndef _TIME_UTILS_H_
- #include "time_utils.h"
- #endif
- //const double SKYWORKS_77328_CONST = 3.1303;
- //const double SKYWORKS_77328_GSM850_SWITCH_LOSS = 1.2;
- //const double SKYWORKS_77328_GSM_SWITCH_LOSS = 1.2;
- //const double SKYWORKS_77328_DCS1800_SWITCH_LOSS = 1.3;
- //const double SKYWORKS_77328_PCS1900_SWITCH_LOSS = 1.3;
- //const double SKYWORKS_77328_GSM850_M = 16.8;
- //const double SKYWORKS_77328_GSM_M = 16.8;
- //const double SKYWORKS_77328_DCS1800_M = 17.78;
- //const double SKYWORKS_77328_PCS1900_M = 17.78;
- //----------------------------------------------------------------------------
- extern CRFAPC* MF_rf_apc_ptr;
- extern RfNbtx_Req *MF_rf_tx_level_req;
- extern bool MF_rf_tx_level_cnf;
- extern bool is_suspend_cal; // in T_META_factory_calibration.cpp
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ///////////////////////////// Skyworks 77328 ///////////////////////
- //---------------------------------------------------------------------------
- bool __fastcall T_META_factory_calibration::TXPCLCal_CalApcDcOffset_Skyworks77328( void )
- {
- //AnsiString as_cal_flag = read_Sky77328_APC_DC_Offset_cal("MF_setup.txt", Application->ExeName);
- //if( as_cal_flag.AnsiCompareIC("yes") != 0 ) return true;
- short s_FIRST_PCL=0;
- short s_LAST_PCL=0;
- short s_first_pcl_idx;
- short s_last_pcl_idx;
- double M;
- unsigned short target_pcl;
- unsigned short us_original_first_pcl_apc_dac;
- unsigned short us_original_last_pcl_apc_dac;
- int i_original_first_pcl_apc_dc_offset;
- int i_original_last_pcl_apc_dc_offset;
- int i_min_nominal_tx_power;
- double d_max_low_apc_dc_offset_p;
- double d_max_high_apc_dc_offset_p;
- double d_wanted_low_apc_dc_offset_p;
- double d_wanted_high_apc_dc_offset_p;
- double d_min_low_apc_dc_offset_p;
- double d_min_high_apc_dc_offset_p;
- AnsiString as_c;
- AnsiString as_sub_c;
- log->Add( "n" +DateToStr(Date()) + " " + CurrentTimeStr() +
- " =============== Calibrate APC DC offset value begin ============== "
- );
- if( TX_SLOT_SINGLE == m_pCal->e_tx_slot )
- {
- if( ! m_rct_ctrl.RCT_operatingMode( m_pRct, OPERATING_MODE_GSM_BCH_TCH ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_OPERATION_MODE_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: " +
- m_pRct->as_RCT + " < Operation mode = GSM BCH+TCH"
- );
- return false;
- }
- }
- else
- {
- if( ! m_rct_ctrl.RCT_operatingMode( m_pRct, OPERATING_MODE_GPRS_BCH_PDTCH) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_OPERATION_MODE_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: " +
- m_pRct->as_RCT + " < Operation mode = GPRS BCH+PDTCH"
- );
- return false;
- }
- }
- short s_ARFCN;
- i_N_TX = -99; // TX frames
- FrequencyBand eFreqBand = FrequencyBand850;
- E_BANDSEL band_index;
- int vi_Band;
- while (eFreqBand < FrequencyBandCount)
- {
- switch (eFreqBand)
- {
- case FrequencyBand850:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_GSM850_BAND;
- s_ARFCN = m_sARFCN_C0_GSM850;
- band_index = BANDSEL_GSM850;
- s_FIRST_PCL = GSM850_FIRST_PCL;
- s_LAST_PCL = GSM850_LAST_PCL;
- as_c = m_as_gsm850_c;
- i_min_nominal_tx_power = GSM850_MIN_NOMINAL_TX_POWER;
- d_max_low_apc_dc_offset_p = m_dSKY77328_GSM850_MAX_LOW_APC_DC_OFFSET_P;
- d_wanted_low_apc_dc_offset_p = m_dSKY77328_GSM850_WANTED_LOW_APC_DC_OFFSET_P;
- d_min_low_apc_dc_offset_p = m_dSKY77328_GSM850_MIN_LOW_APC_DC_OFFSET_P;
- d_max_high_apc_dc_offset_p = m_dSKY77328_GSM850_MAX_HIGH_APC_DC_OFFSET_P;
- d_wanted_high_apc_dc_offset_p = m_dSKY77328_GSM850_WANTED_HIGH_APC_DC_OFFSET_P;
- d_min_high_apc_dc_offset_p = m_dSKY77328_GSM850_MIN_HIGH_APC_DC_OFFSET_P;
- }
- break;
- case FrequencyBand900:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_EGSM_BAND;
- s_ARFCN = m_sARFCN_C0_GSM;
- band_index = BANDSEL_GSM900;
- s_FIRST_PCL = GSM900_FIRST_PCL;
- s_LAST_PCL = GSM900_LAST_PCL;
- as_c = m_as_gsm900_c;
- i_min_nominal_tx_power = GSM900_MIN_NOMINAL_TX_POWER;
- d_max_low_apc_dc_offset_p = m_dSKY77328_GSM900_MAX_LOW_APC_DC_OFFSET_P;
- d_wanted_low_apc_dc_offset_p = m_dSKY77328_GSM900_WANTED_LOW_APC_DC_OFFSET_P;
- d_min_low_apc_dc_offset_p = m_dSKY77328_GSM900_MIN_LOW_APC_DC_OFFSET_P;
- d_max_high_apc_dc_offset_p = m_dSKY77328_GSM900_MAX_HIGH_APC_DC_OFFSET_P;
- d_wanted_high_apc_dc_offset_p = m_dSKY77328_GSM900_WANTED_HIGH_APC_DC_OFFSET_P;
- d_min_high_apc_dc_offset_p = m_dSKY77328_GSM900_MIN_HIGH_APC_DC_OFFSET_P;
- }
- break;
- case FrequencyBand1800:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_DCS1800_BAND;
- s_ARFCN = m_sARFCN_C0_DCS;
- band_index = BANDSEL_DCS1800;
- s_FIRST_PCL = DCS1800_FIRST_PCL;
- s_LAST_PCL = DCS1800_LAST_PCL;
- as_c = m_as_dcs1800_c;
- i_min_nominal_tx_power = DCS1800_MIN_NOMINAL_TX_POWER;
- d_max_low_apc_dc_offset_p = m_dSKY77328_DCS1800_MAX_LOW_APC_DC_OFFSET_P;
- d_wanted_low_apc_dc_offset_p = m_dSKY77328_DCS1800_WANTED_LOW_APC_DC_OFFSET_P;
- d_min_low_apc_dc_offset_p = m_dSKY77328_DCS1800_MIN_LOW_APC_DC_OFFSET_P;
- d_max_high_apc_dc_offset_p = m_dSKY77328_DCS1800_MAX_HIGH_APC_DC_OFFSET_P;
- d_wanted_high_apc_dc_offset_p = m_dSKY77328_DCS1800_WANTED_HIGH_APC_DC_OFFSET_P;
- d_min_high_apc_dc_offset_p = m_dSKY77328_DCS1800_MIN_HIGH_APC_DC_OFFSET_P;
- }
- break;
- case FrequencyBand1900:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_PCS1900_BAND;
- s_ARFCN = m_sARFCN_C0_PCS;
- band_index = BANDSEL_PCS1900;
- s_FIRST_PCL = PCS1900_FIRST_PCL;
- s_LAST_PCL = PCS1900_LAST_PCL;
- as_c = m_as_pcs1900_c;
- i_min_nominal_tx_power = PCS1900_MIN_NOMINAL_TX_POWER;
- d_max_low_apc_dc_offset_p = m_dSKY77328_PCS1900_MAX_LOW_APC_DC_OFFSET_P;
- d_wanted_low_apc_dc_offset_p = m_dSKY77328_PCS1900_WANTED_LOW_APC_DC_OFFSET_P;
- d_min_low_apc_dc_offset_p = m_dSKY77328_PCS1900_MIN_LOW_APC_DC_OFFSET_P;
- d_max_high_apc_dc_offset_p = m_dSKY77328_PCS1900_MAX_HIGH_APC_DC_OFFSET_P;
- d_wanted_high_apc_dc_offset_p = m_dSKY77328_PCS1900_WANTED_HIGH_APC_DC_OFFSET_P;
- d_min_high_apc_dc_offset_p = m_dSKY77328_PCS1900_MIN_HIGH_APC_DC_OFFSET_P;
- }
- break;
- default:
- {
- assert(false);
- }
- break;
- } // switch
- if (! getAnsiStrSubItem( as_c, 1, DEFAULT_SEP_CHAR, as_sub_c) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(c)."
- );
- return false;
- }
- if (IsFreqBankSupported( m_asFreqBank, eFreqBand))
- {
- unsigned char selectPCS1900;
- selectPCS1900 = (FrequencyBand1900 == eFreqBand) ? 1 : 0;
- log->Add("n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target < set Band1900 flag = " + IntToStr(selectPCS1900)
- );
- if (META_Rf_SelectFrequencyBand1900_r( m_pCal->i_MainMETAHandle, selectPCS1900, MF_SelectBand_cnf_cb, &MF_SelectBand_token, NULL) != META_SUCCESS)
- {
- CalErrorHandler(WM_MF_RF_SELECTBAND_CNF_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < set Band1900 flag = " + IntToStr(selectPCS1900)
- );
- return false;
- }
- is_suspend_cal = true;
- this->Suspend();
- is_suspend_cal = false;
- }
- if( ! m_rct_ctrl.RCT_cellBand( m_pRct, vi_Band ) )
- {
- CalErrorHandler(WM_MF_AGE8960_SET_BAND_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : " +
- m_pRct->as_RCT + " < Band = " + ViBand_To_Str(vi_Band)
- );
- return false;
- }
- // Sleep(100);
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " < Band = " + ViBand_To_Str( vi_Band )
- );
- short bch_arfcn = ::Get_SeperateChannel(vi_Band, s_ARFCN);
- if( ! m_rct_ctrl.RCT_BCHARFCN(m_pRct, bch_arfcn))
- {
- CalErrorHandler(WM_MF_AGE8960_SET_BCH_ARFCN_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : "+
- m_pRct->as_RCT + " < BCH ARFCN = " + IntToStr(bch_arfcn)
- );
- return false;
- }
- if (!m_rct_ctrl.RCT_TCHARFCN(m_pRct, s_ARFCN))
- {
- CalErrorHandler(WM_MF_AGE8960_SET_TCH_ARFCN_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : "+
- m_pRct->as_RCT + " < TCH ARFCN = " + IntToStr( s_ARFCN )
- );
- return false;
- }
- if (this->Terminated)
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- m_pRct->as_RCT + " < TCH ARFCN = " + IntToStr(s_ARFCN)
- );
- if (!m_rct_ctrl.RCT_ConfigTSC(m_pRct, m_cTSC))
- {
- CalErrorHandler(WM_MF_AGE8960_SET_TSC_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- "FAIL : " + m_pRct->as_RCT + " < set TSC fail."
- );
- return false;
- }
- if (this->Terminated)
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " < TSC = " + IntToStr(m_cTSC)
- );
- RestartTimerCal(WM_MF_AGE8960_CONFIG_TX_POWER_FAIL);
- if (!m_rct_ctrl.RCT_confTXPower(m_pRct))
- {
- CalErrorHandler(WM_MF_AGE8960_CONFIG_TX_POWER_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : " + m_pRct->as_RCT + " < config TX power 1."
- );
- return false;
- }
- PCL_To_PCLIndex(band_index, s_FIRST_PCL, s_first_pcl_idx);
- PCL_To_PCLIndex(band_index, s_LAST_PCL, s_last_pcl_idx);
- us_original_first_pcl_apc_dac = MF_rf_apc_ptr->Get_ApcProfilePower(band_index, s_first_pcl_idx);
- us_original_last_pcl_apc_dac = MF_rf_apc_ptr->Get_ApcProfilePower(band_index, s_last_pcl_idx);
- MF_rf_apc_ptr->Get_RealApcDcOffset(m_pCal->b_TADOSupport, band_index, s_FIRST_PCL, i_original_first_pcl_apc_dc_offset);
- MF_rf_apc_ptr->Get_RealApcDcOffset(m_pCal->b_TADOSupport, band_index, s_LAST_PCL, i_original_last_pcl_apc_dc_offset);
- MF_rf_apc_ptr->Set_ApcProfilePower(band_index, s_first_pcl_idx, 0);
- MF_rf_apc_ptr->Set_ApcProfilePower(band_index, s_last_pcl_idx, 0);
- // MF_rf_apc_ptr->Req_Rf_SetRampApcLevel(eFreqBand, s_FIRST_PCL, 0);
- // MF_rf_apc_ptr->Req_Rf_SetRampApcLevel(eFreqBand, s_LAST_PCL, 0);
- int i_apc_lowest_power = MF_rf_apc_ptr->Get_ApcLowestPower(band_index);
- int i_apc_dc_offset_count;
- if (m_pCal->b_TADOSupport && (i_apc_lowest_power > i_min_nominal_tx_power))
- {
- i_apc_dc_offset_count = 2;
- }
- else
- {
- i_apc_dc_offset_count = 1;
- }
- unsigned short us_original_pcl_apc_dac[2];
- int i_original_pcl_apc_dc_offset[2];
- double d_max_apc_dc_offset_p[2];
- double d_wanted_apc_dc_offset_p[2];
- double d_min_apc_dc_offset_p[2];
- us_original_pcl_apc_dac[0] = us_original_last_pcl_apc_dac;
- us_original_pcl_apc_dac[1] = us_original_first_pcl_apc_dac;
- i_original_pcl_apc_dc_offset[0] = i_original_last_pcl_apc_dc_offset;
- i_original_pcl_apc_dc_offset[1] = i_original_first_pcl_apc_dc_offset;
- d_max_apc_dc_offset_p[0] = d_max_high_apc_dc_offset_p;
- d_max_apc_dc_offset_p[1] = d_max_low_apc_dc_offset_p;
- d_wanted_apc_dc_offset_p[0] = d_wanted_high_apc_dc_offset_p;
- d_wanted_apc_dc_offset_p[1] = d_wanted_low_apc_dc_offset_p;
- d_min_apc_dc_offset_p[0] = d_min_high_apc_dc_offset_p;
- d_min_apc_dc_offset_p[1] = d_min_low_apc_dc_offset_p;
- double d_c = atof(as_sub_c.c_str());
- AnsiString as_apc_dc_offset[2] = {"high", "low"};
- int i_pcl[2] = {s_LAST_PCL, s_FIRST_PCL};
- for (int apc_dc_offset_idx=0; apc_dc_offset_idx<i_apc_dc_offset_count; apc_dc_offset_idx++)
- {
- log->Add("n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " Wanted " + as_apc_dc_offset[apc_dc_offset_idx] + " APC DC offset = " + Double_To_AnsiString(d_wanted_apc_dc_offset_p[apc_dc_offset_idx]) + " dB"
- );
- if (!m_rct_ctrl.RCT_Config_ExpectedTxPower(m_pRct, false, d_wanted_apc_dc_offset_p[apc_dc_offset_idx]))
- {
- RestartTimerCal(WM_MF_AGE8960_CONFIG_TX_POWER_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : " + m_pRct->as_RCT + " < config expected TX power = " + Double_To_AnsiString(d_wanted_apc_dc_offset_p[apc_dc_offset_idx]) + " fail"
- );
- return false;
- }
- // if (!m_rct_ctrl.RCT_MSTXLevel(m_pRct, i_pcl[apc_dc_offset_idx]))
- // {
- // CalErrorHandler(WM_MF_AGE8960_SET_MS_TX_LEVEL_FAIL);
- // log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- // " FAIL : "
- // + m_pRct->as_RCT + " < MS TX level = " + IntToStr(i_pcl[apc_dc_offset_idx])
- // );
- // return false;
- // }
- // if ( this->Terminated )
- // {
- // this->OnTerminate = neByUser;
- // return false;
- // }
- // log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- // m_pRct->as_RCT + " < MS TX level = " + IntToStr(i_pcl[apc_dc_offset_idx])
- // );
- //
- m_iApcDcOffset = us_original_first_pcl_apc_dac + i_original_pcl_apc_dc_offset[apc_dc_offset_idx];
- if (!MF_rf_apc_ptr->Set_RealApcDcOffset(m_pCal->b_TADOSupport, band_index, i_pcl[apc_dc_offset_idx], m_iApcDcOffset))
- {
- CalErrorHandler(WM_MF_RF_TX_LEVEL_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Set APC DC offset " +
- " TADO support = " + IntToStr(m_pCal->b_TADOSupport) +
- " eFreqBand = " + IntToStr(eFreqBand) +
- " pcl = " + IntToStr(i_pcl[apc_dc_offset_idx])
- );
- return false;
- }
- MF_rf_apc_ptr->ConfirmCallback = ::ccb_write_apc_to_nvram;
- MF_rf_apc_ptr->REQ_RfSetRampTable_Start(m_pCal->ui_rf_id, m_pCal->b_TADOSupport, band_index);
- RestartTimerCal(WM_MF_SET_APC_DC_OFFSET_FAIL);
- SUSPEND_CAL_THREAD
- CHECK_TERMINATE_BY_USER
- E_METAAPP_RESULT_T state = MF_rf_apc_ptr->Get_ConfirmState();
- if (state != METAAPP_SUCCESS)
- {
- if (METAAPP_NVRAM_LID_VER_NOT_SUPPORT == state)
- {
- CalErrorHandler(WM_MF_NVRAM_EF_L1_RAMPTABLE_xxx_LID_VERNO_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : NVRAM_EF_L1_RAMPTABLE_xxx_LID version is not support, please update META to latest version. "
- );
- }
- else
- {
- CalErrorHandler(WM_MF_SET_APC_DAC_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < set APC DC offset, band_index = " + IntToStr(band_index) +
- " ,PCL = "+ i_pcl[apc_dc_offset_idx] +
- " ,APC DC offset = " + IntToStr(m_iApcDcOffset)
- );
- return false;
- }
- }
- for (int iRealRecursiveTimes=0; iRealRecursiveTimes<i_TXlevelRecusiveTimes; iRealRecursiveTimes++)
- {
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " RecursiveTimes = " + IntToStr(iRealRecursiveTimes)
- );
- RestartTimerCal(WM_MF_RF_STOP_FAIL);
- if (!MF_rf_stop.REQ_Start())
- {
- CalErrorHandler(WM_MF_RF_STOP_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < stop RF fail."
- );
- return false;
- }
- RestartTimerCal(WM_MF_RF_TX_LEVEL_FAIL);
- MF_rf_tx_level_req->arfcn = s_ARFCN;
- MF_rf_tx_level_req->bsic = m_cTSC;
- MF_rf_tx_level_req->power = i_pcl[apc_dc_offset_idx];
- MF_rf_tx_level_req->frames = i_N_TX;
- MF_rf_tx_level_req->dacValue = m_sDefault_value;
- MF_rf_tx_level_req->burstTypeNB = NB_TX_RANDOM_WITH_TSC;
- if (META_Rf_NB_TX_r(m_pCal->i_MainMETAHandle,
- MF_rf_tx_level_req,
- MF_rf_tx_level_cb,
- &MF_rf_tx_level_token,
- NULL
- ) != META_SUCCESS)
- {
- CalErrorHandler(WM_MF_RF_TX_LEVEL_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Target < ARFCN = " + IntToStr(s_ARFCN) +
- ", TSC = " + IntToStr(m_cTSC) +
- ", power = " + IntToStr(i_pcl[apc_dc_offset_idx]) +
- ", frames = " + IntToStr(i_N_TX) +
- ", dac value = " + IntToStr(m_sDefault_value)
- );
- return false;
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target < TX: ARFCN = " + IntToStr( s_ARFCN ) +
- ", TSC = " + IntToStr( m_cTSC ) +
- ", power = " + IntToStr(i_pcl[apc_dc_offset_idx]) +
- ", frames = " + IntToStr(i_N_TX) +
- ", dac value = " + IntToStr( m_sDefault_value )
- );
- // log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- // " TimerCal->Enabled 7= " + IntToStr((int)frmFatcory->TimerCal->Enabled)
- // );
- RestartTimerCal( WM_MF_RF_TX_LEVEL_FAIL );
- is_suspend_cal = true;
- this->Suspend();
- is_suspend_cal = false;
- if (!MF_rf_tx_level_cnf)
- {
- CalErrorHandler(WM_MF_RF_TX_LEVEL_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : ! MF_rf_tx_level_cnf"
- );
- return false;
- }
- if (this->Terminated)
- {
- this->OnTerminate = neByUser;
- return false;
- }
- RestartTimerCal( WM_MF_AGE8960_READ_TX_POWER_FAIL );
- if (!m_rct_ctrl.RCT_ReadTxPower(m_pRct, m_virTX))
- {
- CalErrorHandler(WM_MF_AGE8960_READ_TX_POWER_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : " + m_pRct->as_RCT + " < read TX power 1."
- );
- return false;
- }
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " < read TX power = "+ Double_To_AnsiString(m_virTX)
- );
- signed short ss1;
- double d1;
- if (iRealRecursiveTimes != i_TXlevelRecusiveTimes-1) //iteration
- {
- if (m_virTX > (d_wanted_apc_dc_offset_p[apc_dc_offset_idx] + m_dAPC_Delta) ||
- m_virTX < (d_wanted_apc_dc_offset_p[apc_dc_offset_idx] - m_dAPC_Delta)
- )
- {
- d1 = d_c * (d_wanted_apc_dc_offset_p[apc_dc_offset_idx] - m_virTX );
- ss1 = (signed short) (d1>0) ? floor(d1+1.0): ceil(d1-1.0);
- if( ! MF_rf_apc_ptr->Get_RealApcDcOffset( m_pCal->b_TADOSupport, band_index, i_pcl[apc_dc_offset_idx], m_iApcDcOffset ) )
- {
- CalErrorHandler(WM_MF_RF_TX_LEVEL_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Get APC DC offset " +
- " TADO support = " + IntToStr( m_pCal->b_TADOSupport ) +
- " eFreqBand = " + IntToStr( eFreqBand ) +
- " pcl = " + IntToStr(i_pcl[apc_dc_offset_idx])
- );
- return false;
- }
- m_iApcDcOffset += ss1;
- if (!MF_rf_apc_ptr->Set_RealApcDcOffset(m_pCal->b_TADOSupport, band_index, i_pcl[apc_dc_offset_idx], m_iApcDcOffset))
- {
- CalErrorHandler(WM_MF_RF_TX_LEVEL_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Set APC DC offset " +
- " TADO support = " + IntToStr(m_pCal->b_TADOSupport) +
- " eFreqBand = " + IntToStr(eFreqBand) +
- " pcl = " + IntToStr(i_pcl[apc_dc_offset_idx])
- );
- return false;
- }
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " delta s = "+
- AnsiString(ss1)
- );
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " new APC DC offset DAC = "+
- IntToStr(m_iApcDcOffset)
- );
- MF_rf_apc_ptr->ConfirmCallback = ::ccb_write_apc_to_nvram;
- MF_rf_apc_ptr->REQ_RfSetRampTable_Start(m_pCal->ui_rf_id, m_pCal->b_TADOSupport, band_index);
- RestartTimerCal(WM_MF_SET_APC_DC_OFFSET_FAIL);
- SUSPEND_CAL_THREAD
- CHECK_TERMINATE_BY_USER
- E_METAAPP_RESULT_T state = MF_rf_apc_ptr->Get_ConfirmState();
- if (state != METAAPP_SUCCESS)
- {
- if (METAAPP_NVRAM_LID_VER_NOT_SUPPORT == state)
- {
- CalErrorHandler(WM_MF_NVRAM_EF_L1_RAMPTABLE_xxx_LID_VERNO_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : NVRAM_EF_L1_RAMPTABLE_xxx_LID version is not support, please update META to latest version. "
- );
- }
- else
- {
- CalErrorHandler(WM_MF_SET_APC_DAC_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < set APC DC offset, band_index = " + IntToStr(band_index) +
- " ,PCL = "+ i_pcl[apc_dc_offset_idx] +
- " ,APC DC offset = " + IntToStr(m_iApcDcOffset)
- );
- return false;
- }
- }
- CHECK_TERMINATE_BY_USER
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target < set APC DC offset, band_index = " + IntToStr(band_index) +
- " ,PCL = "+ i_pcl[apc_dc_offset_idx] +
- " ,APC DC offset = " + IntToStr(m_iApcDcOffset)
- );
- }
- else
- {
- break; // for iRealRecursiveTimes
- }
- } // if no iteration
- else if (iRealRecursiveTimes == i_TXlevelRecusiveTimes-1 )
- {
- if ((m_virTX > d_max_apc_dc_offset_p[apc_dc_offset_idx]) ||
- (m_virTX < d_min_apc_dc_offset_p[apc_dc_offset_idx])
- )
- {
- CalErrorHandler(WM_MF_RF_TX_LEVEL_CHECK_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " > read TX power = "+ Double_To_AnsiString(m_virTX) +
- " ( Out of Range ), min TX power = " + Double_To_AnsiString(d_min_apc_dc_offset_p[apc_dc_offset_idx]) + ", max TX power = " + Double_To_AnsiString(d_max_apc_dc_offset_p[apc_dc_offset_idx])
- );
- return false;
- }
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " > read TX power = "+ Double_To_AnsiString(m_virTX) +
- " ( Pass ), min TX power = " + Double_To_AnsiString(d_min_apc_dc_offset_p[apc_dc_offset_idx]) + ", max TX power = " + Double_To_AnsiString(d_max_apc_dc_offset_p[apc_dc_offset_idx])
- );
- }
- } // for iRealRecursiveTimes
- } // for apc_dc_offset_idx
- MF_rf_apc_ptr->Set_ApcProfilePower(band_index, s_first_pcl_idx, us_original_first_pcl_apc_dac);
- MF_rf_apc_ptr->Set_ApcProfilePower(band_index, s_last_pcl_idx, us_original_last_pcl_apc_dac);
- MF_rf_apc_ptr->ConfirmCallback = ::ccb_write_apc_to_nvram;
- MF_rf_apc_ptr->REQ_Write_APC_To_NVRAM_Single_Band_Start(m_pCal->ui_rf_id, band_index, m_pCal->b_TADOSupport );
- eFreqBand++;
- }
- log->Add( "n" +DateToStr(Date()) + " " + CurrentTimeStr() +
- " =============== Calibrate APC DC offset value end ============== "
- );
- RestartTimerCal(WM_MF_RF_STOP_FAIL);
- if (!MF_rf_stop.REQ_Start())
- {
- CalErrorHandler(WM_MF_RF_STOP_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < stop RF fail."
- );
- return false;
- }
- frmFatcory->DisableAllCalTimer();
- return true;
- }
- //----------------------------------------------------------------------------
- bool __fastcall T_META_factory_calibration::TXPCLCal_EvalDac_Skyworks77328( void )
- {
- AnsiString as_tx_pcl;
- AnsiString as_tx_2cal_pcl;
- AnsiString as_wanted_p;
- AnsiString as_correction;
- AnsiString as_sub_tx_pcl;
- AnsiString as_sub_tx_2cal_pcl;
- AnsiString as_sub_wanted_p;
- AnsiString as_sub_correction;
- // Evaluate a and b
- // double switch_loss;
- double M;
- double Mnew;
- unsigned short weight;
- double d_weight;
- unsigned short ramp_value;
- unsigned short battery_compensate;
- double d_battery_compensate;
- unsigned short DACth;
- unsigned short DACthnew;
- unsigned short DACwant;
- unsigned short DACd;
- double Poff;
- double Poffnew;
- // double Pmeas;
- unsigned short i_PCL_Cal[MAX_SUPPORT_BAND_NUM][CALIBRATIE_NUM_2PCL];
- unsigned short target_pcl;
- unsigned short EffPCLDac_Cal[MAX_SUPPORT_BAND_NUM][CALIBRATIE_NUM_2PCL];
- // double PoutV_Cal[MAX_SUPPORT_BAND_NUM][CALIBRATIE_NUM_2PCL];
- // double Vramp_Cal[MAX_SUPPORT_BAND_NUM][CALIBRATIE_NUM_2PCL];
- // double PoutV_Eval[MAX_SUPPORT_BAND_NUM][RF_RAMP_TABLE_TX_LEVEL_COUNT];
- // double Vramp_Eval[MAX_SUPPORT_BAND_NUM][RF_RAMP_TABLE_TX_LEVEL_COUNT];
- unsigned short EffPclDac_Eval[MAX_SUPPORT_BAND_NUM][RF_RAMP_TABLE_TX_LEVEL_COUNT];
- log->Add( "n" +DateToStr(Date()) + " " + CurrentTimeStr() +
- " =================== Evaluate PCL DAC value begin =================== "
- );
- int FIRST_PCL=0;
- short s_ARFCN;
- FrequencyBand eFreqBand = FrequencyBand850;
- E_BANDSEL band_index;
- int vi_Band;
- while (eFreqBand < FrequencyBandCount)
- {
- switch (eFreqBand)
- {
- case FrequencyBand850:
- {
- if (! IsFreqBankSupported( m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_GSM850_BAND;
- s_ARFCN = m_sARFCN_C0_GSM850;
- band_index = BANDSEL_GSM850;
- FIRST_PCL = GSM850_FIRST_PCL;
- as_tx_pcl = m_as_gsm850_tx_pcl;
- as_tx_2cal_pcl = m_as_gsm850_tx_2cal_pcl;
- as_wanted_p = m_as_gsm850_wanted_p;
- as_correction = m_as_gsm850_correction;
- M = d_SKY77328_GSM850_M;
- target_pcl = i_SKY77328_GSM850_TARGET_PCL;
- }
- break;
- case FrequencyBand900:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_EGSM_BAND;
- s_ARFCN = m_sARFCN_C0_GSM;
- band_index = BANDSEL_GSM900;
- FIRST_PCL = GSM900_FIRST_PCL;
- as_tx_pcl = m_as_gsm900_tx_pcl;
- as_tx_2cal_pcl = m_as_gsm900_tx_2cal_pcl;
- as_wanted_p = m_as_gsm900_wanted_p;
- as_correction = m_as_gsm900_correction;
- M = d_SKY77328_GSM900_M;
- target_pcl = i_SKY77328_GSM900_TARGET_PCL;
- }
- break;
- case FrequencyBand1800:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_DCS1800_BAND;
- s_ARFCN = m_sARFCN_C0_DCS;
- band_index = BANDSEL_DCS1800;
- FIRST_PCL = DCS1800_FIRST_PCL;
- as_tx_pcl = m_as_dcs1800_tx_pcl;
- as_tx_2cal_pcl = m_as_dcs1800_tx_2cal_pcl;
- as_wanted_p = m_as_dcs1800_wanted_p;
- as_correction = m_as_dcs1800_correction;
- M = d_SKY77328_DCS1800_M;
- target_pcl = i_SKY77328_DCS1800_TARGET_PCL;
- }
- break;
- case FrequencyBand1900:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_PCS1900_BAND;
- s_ARFCN = m_sARFCN_C0_PCS;
- band_index = BANDSEL_PCS1900;
- FIRST_PCL = PCS1900_FIRST_PCL;
- as_tx_pcl = m_as_pcs1900_tx_pcl;
- as_tx_2cal_pcl = m_as_pcs1900_tx_2cal_pcl;
- as_wanted_p = m_as_pcs1900_wanted_p;
- as_correction = m_as_pcs1900_correction;
- M = d_SKY77328_PCS1900_M;
- target_pcl = i_SKY77328_PCS1900_TARGET_PCL;
- }
- break;
- default:
- assert(false);
- break;
- } // switch
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- "---------------------------------------------"
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- BandIdx_To_String(band_index)
- );
- if (IsFreqBankSupported( m_asFreqBank, eFreqBand))
- {
- if(eFreqBand == FrequencyBand1900)
- {
- if(META_Rf_SelectFrequencyBand1900_r( m_pCal->i_MainMETAHandle, 1, MF_SelectBand_cnf_cb, &MF_SelectBand_token, NULL) != META_SUCCESS)
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < set Band1900 flag = 1"
- );
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target < set Band1900 flag = 1"
- );
- }
- else
- {
- if(META_Rf_SelectFrequencyBand1900_r( m_pCal->i_MainMETAHandle, 0, MF_SelectBand_cnf_cb, &MF_SelectBand_token, NULL) != META_SUCCESS)
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < set Band1900 flag = 0"
- );
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target < set Band1900 flag = 0"
- );
- }
- is_suspend_cal = true;
- this->Suspend();
- is_suspend_cal = false;
- }
- if( ! m_rct_ctrl.RCT_cellBand( m_pRct, vi_Band ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_BAND_FAIL );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL :"+
- " Agilent 8960< Band = " + ViBand_To_Str( vi_Band )
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL :"+
- " cmu200 > Band = " + ViBand_To_Str( vi_Band )
- );
- }
- return false;
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add( "n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "
- );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Agilent 8960< Band = " + ViBand_To_Str( vi_Band )
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " CMU 200< Band = " + ViBand_To_Str( vi_Band )
- );
- }
- Sleep( 100 ); // wait Agilent 8960 ready!
- // if Agilent 8960 not read, target will get error power!
- short bch_arfcn = ::Get_SeperateChannel( vi_Band, s_ARFCN );
- if( ! m_rct_ctrl.RCT_BCHARFCN( m_pRct, bch_arfcn) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_TCH_ARFCN_FAIL );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL :"+
- " Agilent 8960< BCH ARFCN = " + IntToStr( bch_arfcn )
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL :"+
- " CMU 200< BCH ARFCN = " + IntToStr( bch_arfcn )
- );
- }
- return false;
- }
- if( ! m_rct_ctrl.RCT_TCHARFCN( m_pRct, s_ARFCN ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_TCH_ARFCN_FAIL );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL :"+
- " Agilent 8960< TCH ARFCN = " + IntToStr( s_ARFCN )
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL :"+
- " CMU 200< TCH ARFCN = " + IntToStr( s_ARFCN )
- );
- }
- return false;
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Agilent 8960< TCH ARFCN = " + IntToStr( s_ARFCN )
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " CMU 200< TCH ARFCN = " + IntToStr( s_ARFCN )
- );
- }
- // ----------------------- set Agilent 8960 < TSC -------------------------
- if( ! m_rct_ctrl.RCT_ConfigTSC( m_pRct, m_cTSC ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_TSC_FAIL );
- if( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- "FAIL : Agilent 8960 set TSC fail."
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : cmu200 > TSC = " + IntToStr( m_cTSC)
- );
- }
- return false;
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Agilent 8960< TSC = " + IntToStr( m_cTSC)
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " CMU 200< TSC = " + IntToStr( m_cTSC)
- );
- }
- RestartTimerCal( WM_MF_AGE8960_CONFIG_TX_POWER_FAIL );
- if (!m_rct_ctrl.RCT_Config_ExpectedTxPower(m_pRct, true, 0))
- {
- RestartTimerCal(WM_MF_AGE8960_CONFIG_TX_POWER_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : " + m_pRct->as_RCT + " < config expected TX power to auto fail"
- );
- return false;
- }
- if( ! m_rct_ctrl.RCT_confTXPower( m_pRct ) )
- {
- CalErrorHandler( WM_MF_AGE8960_CONFIG_TX_POWER_FAIL );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Agilent 8960< config TX power 1."
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : CMU 200< config TX power 1."
- );
- }
- return false;
- }
- // int i=0;
- for(int i=0; i<CALIBRATIE_NUM_2PCL; i++)
- {
- // PoutV_Cal[band_index][i] = sqrt(50.0*pow(10, (m_dPCL_dBm[band_index][i]+switch_loss)/10.0)/1000.0);
- // log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " PoutV_Cal[" + IntToStr(band_index) + "][" + IntToStr(i) + "] = " +
- // Double_To_AnsiString(PoutV_Cal[band_index][i]) + "n"
- // );
- if (! getAnsiStrSubItem( as_tx_2cal_pcl, i+1, DEFAULT_SEP_CHAR, as_sub_tx_2cal_pcl) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_tx_cal_pcl)."
- );
- return false;
- }
- i_PCL_Cal[band_index][i] = as_sub_tx_2cal_pcl.ToInt();
- l1cal_rampTable_T* p_ramp_table = MF_rf_apc_ptr->Get_ApcProfile(band_index);
- if(! MF_rf_apc_ptr->Get_SubBandWeighting( *p_ramp_table, s_ARFCN, as_sub_tx_2cal_pcl.ToInt(), weight) )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_EVALDAC_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: get sub-band weighting."
- );
- return false;
- }
- d_weight = 1.0 * weight / WEIGHT_SCALE;
- if(! MF_rf_apc_ptr->Get_RightTopRampUpValue(*p_ramp_table, band_index, FIRST_PCL-as_sub_tx_2cal_pcl.ToInt(), ramp_value) )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_EVALDAC_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: get ramp up value."
- );
- return false;
- }
- if(! MF_rf_apc_ptr->Get_BatteryCompensate(*p_ramp_table, MID_VOLTAGE_INDEX, MID_TEMPERATURE_INDEX, battery_compensate) )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_EVALDAC_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: get battery_compensate value."
- );
- return false;
- }
- d_battery_compensate = 1.0* battery_compensate / BATTERY_COMPENSATE_SCALE;
- EffPCLDac_Cal[band_index][i] = m_usPCLDacValue[band_index][i] * d_weight * d_battery_compensate * ramp_value / MAX_RAMP_VALUE;
- // Vramp_Cal[band_index][i] = (MF_rf_apc_ptr->ApcDcOffset[band_index]+EffPCLDac_Cal[band_index][i])/pow(2.0, 10.0) * 2.8;
- // log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " Vramp_Cal[" + IntToStr(band_index) + "][" + IntToStr(i) + "] = " +
- // Double_To_AnsiString(Vramp_Cal[band_index][i]) + "n"
- // );
- } // for
- // 2. Calculate DACth
- int i_apc_dc_offset[2];
- double factor = pow(10.0, (m_dPCL_dBm[band_index][1]-m_dPCL_dBm[band_index][0])/M);
- // DACth = ( (EffPCLDac_Cal[band_index][0]+MF_rf_apc_ptr->ApcDcOffset[band_index]) * factor - (EffPCLDac_Cal[band_index][1]+MF_rf_apc_ptr->ApcDcOffset[band_index]) ) / ( factor - 1 );
- // DACth = ( (EffPCLDac_Cal[band_index][0]+MF_rf_apc_ptr->Get_HighApcDcOffset(band_index)) * factor - (EffPCLDac_Cal[band_index][1]+MF_rf_apc_ptr->Get_HighApcDcOffset(band_index)) ) / ( factor - 1 );
- if( ! MF_rf_apc_ptr->Get_RealApcDcOffset( m_pCal->b_TADOSupport, band_index, target_pcl, m_iApcDcOffset ) )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Get APC DC offset " +
- " TADO support = " + IntToStr( m_pCal->b_TADOSupport ) +
- " eFreqBand = " + IntToStr( eFreqBand ) +
- " pcl = " + IntToStr( i_PCL_Cal[band_index][0] )
- );
- return false;
- }
- if( ! MF_rf_apc_ptr->Get_RealApcDcOffset( m_pCal->b_TADOSupport, band_index, i_PCL_Cal[band_index][0], i_apc_dc_offset[0] ) )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Get APC DC offset " +
- " TADO support = " + IntToStr( m_pCal->b_TADOSupport ) +
- " eFreqBand = " + IntToStr( eFreqBand ) +
- " pcl = " + IntToStr( i_PCL_Cal[band_index][0] )
- );
- return false;
- }
- if( ! MF_rf_apc_ptr->Get_RealApcDcOffset( m_pCal->b_TADOSupport, band_index, i_PCL_Cal[band_index][1], i_apc_dc_offset[1] ) )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Get APC DC offset " +
- " TADO support = " + IntToStr( m_pCal->b_TADOSupport ) +
- " eFreqBand = " + IntToStr( eFreqBand ) +
- " pcl = " + IntToStr( i_PCL_Cal[band_index][1] )
- );
- return false;
- }
- DACth = ( (EffPCLDac_Cal[band_index][0]+i_apc_dc_offset[0]) * factor - (EffPCLDac_Cal[band_index][1]+i_apc_dc_offset[1]) ) / ( factor - 1 );
- // 3. Calculate Poff
- // Poff = m_dPCL_dBm[band_index][0] - M * log10(1.0*(EffPCLDac_Cal[band_index][0]+MF_rf_apc_ptr->ApcDcOffset[band_index] - DACth));
- // Poff = m_dPCL_dBm[band_index][0] - M * log10(1.0*(EffPCLDac_Cal[band_index][0]+MF_rf_apc_ptr->Get_HighApcDcOffset(band_index) - DACth));
- Poff = m_dPCL_dBm[band_index][0] - M * log10(1.0*(EffPCLDac_Cal[band_index][0]+i_apc_dc_offset[0] - DACth));
- int pcl_index = cfg->getTargetPclIndex(as_tx_pcl, target_pcl);
- if (! getAnsiStrSubItem( as_wanted_p, pcl_index, DEFAULT_SEP_CHAR, as_sub_wanted_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_wanted_p)."
- );
- return false;
- }
- int iRealRecursiveTimes = 0;
- do
- {
- // 4. Calculate DACwant
- DACwant = DACth + pow(10.0, (atof(as_sub_wanted_p.c_str())-Poff)/M);
- MF_rf_apc_ptr->Set_ApcProfilePower(band_index, pcl_index-1, DACwant-m_iApcDcOffset );
- MF_rf_apc_ptr->ConfirmCallback = ccb_set_apc_level;
- MF_rf_apc_ptr->Req_Rf_SetRampApcLevel(eFreqBand, target_pcl, MF_rf_apc_ptr->Get_ApcProfilePower(band_index, pcl_index-1) );
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- RestartTimerCal( WM_MF_SET_APC_DAC_FAIL );
- // log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " TimerCal->Enabled 9= " + IntToStr((int)frmFatcory->TimerCal->Enabled)
- // );
- is_suspend_cal = true;
- this->Suspend();
- is_suspend_cal = false;
- E_METAAPP_RESULT_T state = MF_rf_apc_ptr->Get_ConfirmState();
- if (state != METAAPP_SUCCESS)
- {
- if (METAAPP_NVRAM_LID_VER_NOT_SUPPORT == state)
- {
- CalErrorHandler(WM_MF_NVRAM_EF_L1_RAMPTABLE_xxx_LID_VERNO_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : NVRAM_EF_L1_RAMPTABLE_xxx_LID version is not support, please update META to latest version. "
- );
- }
- else
- {
- CalErrorHandler(WM_MF_SET_APC_DAC_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < set APC level fail: PCL = "+ IntToStr(FIRST_PCL) +
- " APC DAC = " + IntToStr( MF_rf_apc_ptr->Get_ApcProfilePower(band_index, 0) ) + "n"
- );
- }
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target < set APC level ok: PCL = "+ IntToStr(FIRST_PCL) + "," +
- " APC DAC = " + IntToStr( MF_rf_apc_ptr->Get_ApcProfilePower(band_index, 0) ) + "n"
- );
- // 5. Get Pwantmeas from equipment
- if( ! m_rct_ctrl.RCT_MSTXLevel(m_pRct, target_pcl))
- {
- CalErrorHandler( WM_MF_AGE8960_SET_MS_TX_LEVEL_FAIL );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Agilent 8960< MS TX level = " + IntToStr( target_pcl )
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : cmu200 > MS TX level = " + IntToStr( target_pcl )
- );
- }
- return false;
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Agilent 8960< MS TX level = " + IntToStr( target_pcl )
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " CMU200 < MS TX level = " + IntToStr( target_pcl )
- );
- }
- RestartTimerCal(WM_MF_RF_TX_LEVEL_FAIL);
- if (!MF_rf_stop.REQ_Start())
- {
- CalErrorHandler( WM_MF_RF_STOP_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < stop RF fail."
- );
- return false;
- }
- MF_rf_tx_level_req->arfcn = s_ARFCN;
- MF_rf_tx_level_req->bsic = m_cTSC;
- MF_rf_tx_level_req->power = target_pcl;
- MF_rf_tx_level_req->frames = i_N_TX;
- MF_rf_tx_level_req->dacValue = m_sDefault_value;
- MF_rf_tx_level_req->burstTypeNB = NB_TX_RANDOM_WITH_TSC;
- if ( META_Rf_NB_TX_r( m_pCal->i_MainMETAHandle,
- MF_rf_tx_level_req,
- MF_rf_tx_level_cb,
- &MF_rf_tx_level_token,
- NULL
- ) != META_SUCCESS)
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Target < ARFCN = " + IntToStr( s_ARFCN ) +
- ", TSC = " + IntToStr( m_cTSC ) +
- ", power = " + IntToStr( target_pcl ) +
- ", frames = " + IntToStr(i_N_TX) +
- ", dac value = " + IntToStr( m_sDefault_value )
- );
- return false;
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target < TX: ARFCN = " + IntToStr( s_ARFCN ) +
- ", TSC = " + IntToStr( m_cTSC ) +
- ", power = " + IntToStr( target_pcl ) +
- ", frames = " + IntToStr(i_N_TX) +
- ", dac value = " + IntToStr( m_sDefault_value )
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " TimerCal->Enabled 7= " + IntToStr((int)frmFatcory->TimerCal->Enabled)
- );
- RestartTimerCal( WM_MF_RF_TX_LEVEL_FAIL );
- is_suspend_cal = true;
- this->Suspend();
- is_suspend_cal = false;
- if (! MF_rf_tx_level_cnf )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : ! MF_rf_tx_level_cnf"
- );
- return false;
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " TimerCal->Enabled 8= " + IntToStr((int)frmFatcory->TimerCal->Enabled)
- );
- RestartTimerCal( WM_MF_AGE8960_CONFIG_TX_POWER_FAIL );
- if (!m_rct_ctrl.RCT_Config_ExpectedTxPower(m_pRct, true, 0))
- {
- RestartTimerCal(WM_MF_AGE8960_CONFIG_TX_POWER_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : " + m_pRct->as_RCT + " < config expected TX power to auto fail"
- );
- return false;
- }
- if( ! m_rct_ctrl.RCT_confTXPower( m_pRct ) )
- {
- CalErrorHandler( WM_MF_AGE8960_CONFIG_TX_POWER_FAIL );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Agilent 8960< config TX power 1."
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : CMU 200< config TX power 1."
- );
- }
- return false;
- }
- RestartTimerCal( WM_MF_AGE8960_READ_TX_POWER_FAIL );
- if( ! m_rct_ctrl.RCT_ReadTxPower( m_pRct, m_virTX ) )
- {
- CalErrorHandler( WM_MF_AGE8960_READ_TX_POWER_FAIL );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Agilent 8960< read TX power 1."
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : CMU 200< read TX power 1."
- );
- }
- return false;
- }
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Agilent 8960< read TX power = "+ Double_To_AnsiString( m_virTX )
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " CMU 200< read TX power = "+ Double_To_AnsiString( m_virTX )
- );
- }
- int iRealRecursiveTimes_DAC = 0;
- do
- {
- // 6. Calculate DACthnew
- DACthnew = DACwant - pow(10.0, (m_virTX-Poff)/M);
- // 7. Calculate Mnew
- // Mnew = ( m_dPCL_dBm[band_index][1]-m_dPCL_dBm[band_index][0]) / ( log10(EffPCLDac_Cal[band_index][1]+MF_rf_apc_ptr->ApcDcOffset[band_index]-DACthnew) - log10(EffPCLDac_Cal[band_index][0]+MF_rf_apc_ptr->ApcDcOffset[band_index]-DACthnew) );
- // Mnew = ( m_dPCL_dBm[band_index][1]-m_dPCL_dBm[band_index][0]) / ( log10(EffPCLDac_Cal[band_index][1]+MF_rf_apc_ptr->Get_HighApcDcOffset(band_index)-DACthnew) - log10(EffPCLDac_Cal[band_index][0]+MF_rf_apc_ptr->Get_HighApcDcOffset(band_index)-DACthnew) );
- Mnew = ( m_dPCL_dBm[band_index][1]-m_dPCL_dBm[band_index][0]) / ( log10(EffPCLDac_Cal[band_index][1]+i_apc_dc_offset[1]-DACthnew) - log10(EffPCLDac_Cal[band_index][0]+i_apc_dc_offset[0]-DACthnew) );
- // Poffnew = m_dPCL_dBm[band_index][0] - Mnew * log10(EffPCLDac_Cal[band_index][0]+MF_rf_apc_ptr->ApcDcOffset[band_index] - DACthnew);
- // Poffnew = m_dPCL_dBm[band_index][0] - Mnew * log10(EffPCLDac_Cal[band_index][0]+MF_rf_apc_ptr->Get_HighApcDcOffset(band_index) - DACthnew);
- Poffnew = m_dPCL_dBm[band_index][0] - Mnew * log10(EffPCLDac_Cal[band_index][0]+i_apc_dc_offset[0] - DACthnew);
- // 8. Calculate DACdelta
- DACd = abs(DACthnew - DACth);
- DACth = DACthnew;
- Poff = Poffnew;
- M = Mnew;
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " DAC delta = " + IntToStr( DACd ) +
- ", DACth = " + IntToStr( DACth ) +
- ", Poff = " + Double_To_AnsiString( Poff ) +
- ", M = " + Double_To_AnsiString( M )
- );
- iRealRecursiveTimes_DAC++;
- }
- while( (DACd > i_SKY77328_DAC_Delta) && (iRealRecursiveTimes_DAC < i_TXlevelRecusiveTimes) );
- iRealRecursiveTimes++;
- }
- while( ( m_virTX > (atof(as_sub_wanted_p.c_str())+ m_dAPC_Delta) ||
- m_virTX < (atof(as_sub_wanted_p.c_str())- m_dAPC_Delta)) &&
- (iRealRecursiveTimes < i_TXlevelRecusiveTimes) );
- // Evaluate DAC except highest and lowest PCL
- for(int i=0; i<RF_RAMP_TABLE_TX_LEVEL_COUNT; i++)
- {
- if( i==RF_RAMP_TABLE_TX_LEVEL_COUNT-1 &&
- (eFreqBand==FrequencyBand850 || eFreqBand==FrequencyBand900 )
- )
- {
- break;
- }
- if (! getAnsiStrSubItem( as_tx_pcl, i+1, DEFAULT_SEP_CHAR, as_sub_tx_pcl) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_tx_pcl)."
- );
- return false;
- }
- if (! getAnsiStrSubItem( as_wanted_p, i+1, DEFAULT_SEP_CHAR, as_sub_wanted_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_wanted_p)."
- );
- return false;
- }
- if (! getAnsiStrSubItem( as_correction, i+1, DEFAULT_SEP_CHAR, as_sub_correction) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(as_sub_correction)."
- );
- return false;
- }
- if( as_sub_tx_pcl.ToInt() != i_PCL_Cal[band_index][PCL_LOW_INDEX] &&
- as_sub_tx_pcl.ToInt() != i_PCL_Cal[band_index][PCL_MID_INDEX]
- )
- {
- // EffPclDac_Eval[band_index][i] = DACth + pow(10.0, (atof(as_sub_wanted_p.c_str()) + atof(as_sub_correction.c_str())- Poff)/M) - MF_rf_apc_ptr->ApcDcOffset[band_index];
- // EffPclDac_Eval[band_index][i] = DACth + pow(10.0, (atof(as_sub_wanted_p.c_str()) + atof(as_sub_correction.c_str())- Poff)/M) - MF_rf_apc_ptr->Get_HighApcDcOffset(band_index);
- if( ! MF_rf_apc_ptr->Get_RealApcDcOffset( m_pCal->b_TADOSupport, band_index, as_sub_tx_pcl.ToInt(), m_iApcDcOffset ) )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: PCL to dBm " +
- " TADO support = " + IntToStr( m_pCal->b_TADOSupport ) +
- " eFreqBand = " + IntToStr( eFreqBand ) +
- " pcl = " + as_sub_tx_pcl
- );
- return false;
- }
- EffPclDac_Eval[band_index][i] = DACth + pow(10.0, (atof(as_sub_wanted_p.c_str()) + atof(as_sub_correction.c_str())- Poff)/M) - m_iApcDcOffset;
- if( d_weight*d_battery_compensate*ramp_value == 0 )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_EVALDAC_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: weight*battery_compensate*ramp_value = 0."
- );
- return false;
- }
- m_usPCLDacValue_ideal[band_index][i] = EffPclDac_Eval[band_index][i]*MAX_RAMP_VALUE/(d_weight*d_battery_compensate*ramp_value);
- // MF_rf_apc_ptr->ApcProfile[band_index].rampData.power[i] = m_usPCLDacValue_ideal[band_index][i];
- MF_rf_apc_ptr->Set_ApcProfilePower(band_index, i, m_usPCLDacValue_ideal[band_index][i]);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " " +
- " m_usPCLDacValue_ideal[" + IntToStr(band_index) + "][" + IntToStr(i) + "] = " +
- Double_To_AnsiString(m_usPCLDacValue_ideal[band_index][i]) + "n"
- );
- }
- }
- MF_rf_apc_ptr->ConfirmCallback = ::ccb_write_apc_to_nvram;
- MF_rf_apc_ptr->REQ_Write_APC_To_NVRAM_Single_Band_Start(m_pCal->ui_rf_id, band_index, m_pCal->b_TADOSupport );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Write to NVRAM band_index = " + IntToStr(band_index)
- );
- #ifdef _MYDEBUG_
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " TimerCal->Enabled 15= " + IntToStr((int)Form_META_Factory->TimerCal->Enabled) + "n"
- );
- #endif
- RestartTimerCal(WM_MF_NVRAM_LEVEL_RAMP_WRITE_FAIL);
- CHECK_TERMINATE_BY_USER
- SUSPEND_CAL_THREAD
- WriteAPCCalResultToFile(as_ID+".cal",Application->ExeName, m_pCal->b_CalResultPath, FreqBand_To_BandIdx(eFreqBand) );
- eFreqBand++;
- } // while
- RestartTimerCal(WM_MF_RF_STOP_FAIL);
- if (!MF_rf_stop.REQ_Start())
- {
- CalErrorHandler(WM_MF_RF_STOP_FAIL);
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < stop RF fail."
- );
- return false;
- }
- frmFatcory->DisableAllCalTimer();
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " ===================== Evaluate other PCL DAC value end =========== n "
- );
- return true;
- }