T_TXPCL_common.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:268k
- } // for N
- } // single slot
- else // multi-slot
- {
- unsigned int ui_tx_4cal_pcl[RF_TX_LEVEL_4_CAL_COUNT];
- double d_max_p[RF_TX_LEVEL_4_CAL_COUNT];
- double d_min_p[RF_TX_LEVEL_4_CAL_COUNT];
- double d_wanted_p[RF_TX_LEVEL_4_CAL_COUNT];
- S_MULTISLOT_BURST_POWER virTX_p;
- unsigned int ui_c[RF_TX_LEVEL_4_CAL_COUNT];
- unsigned short us_apc_dac[RF_TX_LEVEL_4_CAL_COUNT];
- for (int N=0; N<i_TX_level_count; N++) // DCS,PCS:16~1 or GSM:15~1
- {
- ui_tx_4cal_pcl[N] = s_pcl[N];
- } // for(N)
- 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;
- }
- int pcl[4];
- CodingScheme cs[4];
- cs[0] = CodingSchemeMCS5;
- cs[1] = CodingSchemeMCS5;
- cs[2] = CodingSchemeMCS5;
- cs[3] = CodingSchemeMCS5;
- pcl[0] = ui_tx_4cal_pcl[0];
- pcl[1] = ui_tx_4cal_pcl[1];
- pcl[2] = ui_tx_4cal_pcl[2];
- pcl[3] = ui_tx_4cal_pcl[3];
- S_MULTI_SLOT_TX_T multi_slot_tx;
- multi_slot_tx.b_MultiSlotTXExSupport = m_pCal->b_MultiSlotTxExSupport;
- multi_slot_tx.e_bandsel = band_index;
- multi_slot_tx.req.arfcn = s_ARFCN;
- multi_slot_tx.req.bsic = m_cTSC;
- multi_slot_tx.req.timeSlotmask = 0x0F;
- for (int i=0; i<4; i++)
- {
- multi_slot_tx.req.powerLev[i] = pcl[i];
- multi_slot_tx.req.cs[i] = cs[i];
- }
- multi_slot_tx.req.ta = 0;
- multi_slot_tx.req.frames = -99;
- multi_slot_tx.req.dacValue = m_sDefault_value;
- multi_slot_tx.req.pattern = NB_TX_RANDOM_WITH_TSC;
- multi_slot_tx.req.pattern_data = 0;
- RF_MULTI_SLOT_TX_Obj.ConfirmCallback = ::ConfirmCallback_MultiSlotTX;
- RF_MULTI_SLOT_TX_Obj.REQ_Start(multi_slot_tx);
- if (this->Terminated)
- {
- this->OnTerminate = neByUser;
- return false;
- }
- RestartTimerCal(WM_MF_RF_TX_LEVEL_FAIL);
- SUSPEND_CAL_THREAD
- if (RF_MULTI_SLOT_TX_Obj.Get_ConfirmState() != METAAPP_SUCCESS)
- {
- CalErrorHandler(WM_MF_RF_TX_LEVEL_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < multislot TX fail."
- );
- return false;
- }
- if (!m_rct_ctrl.RCT_readMultiSlotAverageTxPower(m_pRct, &virTX_p))
- {
- CalErrorHandler(WM_MF_AGE8960_READ_TX_POWER_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: " + m_pRct->as_RCT + " < read multislot TX power ."
- );
- return false;
- }
- frmFatcory->DisableAllCalTimer();
- for (int N=0; N<i_TX_level_count; N++) // DCS,PCS:16~1 or GSM:15~1
- {
- m_dPCL_dBm[band_index][N] = virTX_p.d_burstpower[N] ;
- m_dPCL_power[band_index][N] = pow(10.0, m_dPCL_dBm[band_index][N]/10.0)/1000.0;
- if (this->Terminated)
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " < read slot " + IntToStr(N) + " TX power = " + Double_To_AnsiString( virTX_p.d_burstpower[N] )
- );
- } // for(N)
- if (this->Terminated)
- {
- this->OnTerminate = neByUser;
- return false;
- }
- } // multi-slot
- eFreqBand++;
- if (this->Terminated)
- {
- this->OnTerminate = neByUser;
- return false;
- }
- } // while
- if (!m_rct_ctrl.RCT_TXPowerContOff(m_pRct))
- {
- CalErrorHandler(WM_MF_AGE8960_SET_TX_POWER_CONT_OFF_FAIL);
- if (frmFatcory->rbAgilent8960->Checked)
- {
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Agilent 8960< set continuous TX power OFF "
- );
- }
- else
- {
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : cmu200 < set continuous TX power OFF "
- );
- }
- return false;
- }
- if (this->Terminated)
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add("n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " ============= TX power control level calibration end ============= n "
- );
- 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( "n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " ============= GMSK TX power control level calibration end ============= n "
- );
- if( m_asAPC_Check.AnsiCompareIC("yes") != 0 )
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_RF_TX_LEVEL_CALIBRATION_DONE_NO_CHECK,
- 0,
- 0
- );
- frmFatcory->DisableAllCalTimer();
- log->Add( "n" + DateToStr(Date()) + " "+ CurrentTimeStr() +
- " TX PCL calibration done (without TX PCL check procedure)! n"
- );
- }
- return true;
- }
- //===========================================================================
- bool __fastcall T_META_factory_calibration::TXPCLCal_FullCal( void )
- {
- char tempbuf[256];
- AnsiString as_tx_pcl;
- AnsiString as_max_p;
- AnsiString as_wanted_p;
- AnsiString as_min_p;
- AnsiString as_c;
- AnsiString as_sub_tx_pcl;
- AnsiString as_sub_max_p;
- AnsiString as_sub_wanted_p;
- AnsiString as_sub_min_p;
- AnsiString as_sub_c;
- int FIRST_PCL=0;
- log->Add( "n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " ============ GMSK TX power control level calibration begin ============ n "
- );
-
- 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;
- }
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- short s_ARFCN;
- FrequencyBand eFreqBand = FrequencyBand850;
- i_N_TX = -99; // TX frames
- while (eFreqBand < FrequencyBandCount)
- {
- if (IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- if( FrequencyBand1900 == eFreqBand )
- {
- 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;
- }
- E_BANDSEL band_index;
- int vi_Band;
- switch (eFreqBand)
- {
- case FrequencyBand850:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- FIRST_PCL = GSM850_FIRST_PCL;
- band_index = BANDSEL_GSM850;
- vi_Band = age1960_GSM850_BAND;
- s_ARFCN = m_sARFCN_C0_GSM850;
- i_TX_level_count = RF_RAMP_TABLE_TX_LEVEL_COUNT-1;
- as_tx_pcl = m_as_gsm850_tx_pcl;
- as_max_p = m_as_gsm850_max_p;
- as_wanted_p = m_as_gsm850_wanted_p;
- as_min_p = m_as_gsm850_min_p;
- as_c = m_as_gsm850_c;
- }
- break;
- case FrequencyBand900:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- FIRST_PCL = GSM900_FIRST_PCL;
- band_index = BANDSEL_GSM900;
- vi_Band = age1960_EGSM_BAND;
- s_ARFCN = m_sARFCN_C0_GSM;
- i_TX_level_count = RF_RAMP_TABLE_TX_LEVEL_COUNT-1;
- as_tx_pcl = m_as_gsm900_tx_pcl;
- as_max_p = m_as_gsm900_max_p;
- as_wanted_p = m_as_gsm900_wanted_p;
- as_min_p = m_as_gsm900_min_p;
- as_c = m_as_gsm900_c;
- }
- break;
- case FrequencyBand1800:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- FIRST_PCL = DCS1800_FIRST_PCL;
- band_index = BANDSEL_DCS1800;
- vi_Band = age1960_DCS1800_BAND;
- s_ARFCN = m_sARFCN_C0_DCS;
- i_TX_level_count = RF_RAMP_TABLE_TX_LEVEL_COUNT;
- as_tx_pcl = m_as_dcs1800_tx_pcl;
- as_max_p = m_as_dcs1800_max_p;
- as_wanted_p = m_as_dcs1800_wanted_p;
- as_min_p = m_as_dcs1800_min_p;
- as_c = m_as_dcs1800_c;
- }
- break;
- case FrequencyBand1900:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- FIRST_PCL = PCS1900_FIRST_PCL;
- band_index = BANDSEL_PCS1900;
- vi_Band = age1960_PCS1900_BAND;
- s_ARFCN = m_sARFCN_C0_PCS;
- i_TX_level_count = RF_RAMP_TABLE_TX_LEVEL_COUNT;
- as_tx_pcl = m_as_pcs1900_tx_pcl;
- as_max_p = m_as_pcs1900_max_p;
- as_wanted_p = m_as_pcs1900_wanted_p;
- as_min_p = m_as_pcs1900_min_p;
- as_c = m_as_pcs1900_c;
- }
- break;
- default:
- {
- assert(false);
- }
- break;
- } // switch
- if (!MF_rf_apc_ptr->ApcSectionExist(m_pCal->as_IniFile.c_str(), band_index))
- {
- CalErrorHandler(WM_MF_RF_TX_LEVEL_INI_FAIL);
- log->Add(DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL :"+
- " APC section is not in initial file: " + FreqBand_To_Str(eFreqBand)
- );
- return false;
- }
-
- if (this->Terminated)
- {
- this->OnTerminate = neByUser;
- return 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;
- }
- #ifdef _MYDEBUG_
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Sleep 100 " + AnsiString(__FILE__)
- );
- #endif
- Sleep( 100 ); // wait Agilent 8960 cell band setup ready!
- // if Agilent 8960 not read, target will get error power!
- 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_TCH_ARFCN_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: "+
- m_pRct->as_RCT + " < BCH ARFCN = " + IntToStr( bch_arfcn )
- );
- return false;
- }
- if( TX_SLOT_SINGLE == m_pCal->e_tx_slot )
- {
- 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;
- }
- }
- else
- {
- if( ! m_rct_ctrl.RCT_PDTCHARFCN( m_pRct, s_ARFCN ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_TCH_ARFCN_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: "+
- m_pRct->as_RCT + " < PDTCH 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)
- );
- // log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " TimerCal->Enabled 12= " + 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( TX_SLOT_SINGLE == m_pCal->e_tx_slot )
- {
- 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;
- }
- }
- else
- {
- if( ! m_rct_ctrl.RCT_confMultiSlotTxPower( m_pRct, AGE1960_TX_POWER_MEASURE_COUNT, MOD_GMSK ) )
- {
- CalErrorHandler( WM_MF_AGE8960_CONFIG_TX_POWER_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: " + m_pRct->as_RCT + " < config TX power 1."
- );
- return false;
- }
- }
- if( ! m_rct_ctrl.RCT_TXPowerContOff( m_pRct ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_TX_POWER_CONT_OFF_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: " + m_pRct->as_RCT + " < set TX power continuous OFF "
- );
- return false;
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- // calibration from high power to low power
- // index from big to little.
- // PCL string in config file from right to left.
- if( TX_SLOT_SINGLE == m_pCal->e_tx_slot )
- {
- for( int N=i_TX_level_count; N>0; N--) // DCS,PCS:16~1 or GSM:15~1
- {
- // index start from 1
- if(! getAnsiStrSubItem( as_tx_pcl, N, 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 3)."
- );
- return false;
- }
- sprintf(tempbuf, "%3d", as_sub_tx_pcl.ToInt());
- if(! getAnsiStrSubItem( as_max_p, N, DEFAULT_SEP_CHAR, as_sub_max_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_max_p 3)."
- );
- return false;
- }
- if(! getAnsiStrSubItem( as_min_p, N, DEFAULT_SEP_CHAR, as_sub_min_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_min_p 3)."
- );
- return false;
- }
- if (! getAnsiStrSubItem( as_wanted_p, N, 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 3)."
- );
- return false;
- }
- if(! getAnsiStrSubItem( as_c, N, DEFAULT_SEP_CHAR, as_sub_c) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_c 3)."
- );
- return false;
- }
- for( int iRealRecursiveTimes=0; iRealRecursiveTimes<i_TXlevelRecusiveTimes;
- iRealRecursiveTimes++)
- {
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- if( ! m_rct_ctrl.RCT_MSTXLevel( m_pRct, as_sub_tx_pcl.ToInt() ) )
- {
- 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( as_sub_tx_pcl.ToInt())
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : cmu200 > MS TX level = " + IntToStr( as_sub_tx_pcl.ToInt())
- );
- }
- return false;
- }
- if( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Agilent 8960< MS TX level = " + IntToStr( as_sub_tx_pcl.ToInt())
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " CMU 200< MS TX level = " + IntToStr( as_sub_tx_pcl.ToInt())
- );
- }
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- 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 = as_sub_tx_pcl.ToInt();
- 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; // NB burst
- 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 = " + as_sub_tx_pcl +
- ", frames = " + IntToStr(i_N_TX) +
- ", dac value = " + IntToStr( m_sDefault_value )
- );
- return false;
- }
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- #ifdef _MYDEBUG_
- TDateTime::CurrentTime().DecodeTime(&hr, &min, &sec, &ms );
- #endif
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- #ifdef _MYDEBUG_
- ":" + AnsiString( ms ) +
- #endif
- " Target< TX: ARFCN = " + IntToStr( s_ARFCN ) +
- ", TSC = " + IntToStr( m_cTSC ) +
- ", power = " + as_sub_tx_pcl +
- ", frames = " + IntToStr(i_N_TX) +
- ", dac value = " + IntToStr( m_sDefault_value )
- );
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- #ifdef _MYDEBUG_
- TDateTime::CurrentTime().DecodeTime(&hr, &min, &sec, &ms );
- log->Add( " before suspend " + DateToStr(Date()) + " " + CurrentTimeStr() +
- ":" + AnsiString( ms )
- );
- #endif
- // log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " TimerCal->Enabled 11= " + IntToStr((int)frmFatcory->TimerCal->Enabled)
- // );
- RestartTimerCal( WM_MF_RF_TX_LEVEL_FAIL );
- is_suspend_cal = true;
- this->Suspend();
- is_suspend_cal = false;
- #ifdef _MYDEBUG_
- // TDateTime::CurrentTime().DecodeTime(&hr, &min, &sec, &ms );
- // log->Add( " after resume " + DateToStr(Date()) + " " + CurrentTimeStr() +
- // ":" + AnsiString( ms )
- // );
- #endif
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- if(! MF_rf_tx_level_cnf )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " TX level cnf fail"
- );
- return false;
- }
- #ifdef _MYDEBUG_
- TDateTime::CurrentTime().DecodeTime(&hr, &min, &sec, &ms );
- log->Add( " before read TX power Q " + DateToStr(Date()) + " " + CurrentTimeStr() +
- ":" + AnsiString( ms )
- );
- #endif
- 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."
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : CMU 200< read TX power."
- );
- }
- return false;
- }
- frmFatcory->DisableAllCalTimer();
- #ifdef _MYDEBUG_
- TDateTime::CurrentTime().DecodeTime(&hr, &min, &sec, &ms );
- log->Add( " after read TX power Q " + DateToStr(Date()) + " " + CurrentTimeStr() +
- ":" + AnsiString( ms )
- );
- #endif
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- 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 )
- );
- }
- signed short ss1;
- double d1;
- if (iRealRecursiveTimes != i_TXlevelRecusiveTimes-1) //iteration
- {
- if ( m_virTX > (atof(as_sub_wanted_p.c_str())+ m_dAPC_Delta) ||
- m_virTX < (atof(as_sub_wanted_p.c_str())- m_dAPC_Delta))
- {
- d1 = atof(as_sub_c.c_str()) * (atof(as_sub_wanted_p.c_str()) - m_virTX);
- ss1 = (signed short) (d1>0) ? floor(d1+1.0): ceil(d1-1.0);
- if ((MF_rf_apc_ptr->Get_ApcProfilePower(band_index, N-1) + ss1) <= 0)
- {
- MF_rf_apc_ptr->Set_ApcProfilePower(band_index, N-1, 1);
- }
- else if ((MF_rf_apc_ptr->Get_ApcProfilePower(band_index, N-1) + ss1) > MAX_APC_DAC)
- {
- MF_rf_apc_ptr->Set_ApcProfilePower(band_index, N-1, MAX_APC_DAC);
- }
- else
- {
- MF_rf_apc_ptr->Set_ApcProfilePower(band_index, N-1, MF_rf_apc_ptr->Get_ApcProfilePower(band_index,N-1) + ss1);
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " new S = " +
- IntToStr( MF_rf_apc_ptr->Get_ApcProfilePower( band_index, N-1 ) )
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " delta s = "+
- AnsiString( ss1 )
- );
- MF_rf_apc_ptr->ConfirmCallback = ccb_set_apc_level;
- MF_rf_apc_ptr->Req_Rf_SetRampApcLevel(eFreqBand, as_sub_tx_pcl.ToInt(), MF_rf_apc_ptr->Get_ApcProfilePower( band_index, N-1 ));
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- //log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " TimerCal->Enabled 13= " + IntToStr((int)frmFatcory->TimerCal->Enabled)
- //);
- RestartTimerCal ( WM_MF_SET_APC_DAC_FAIL );
- 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 = "+ as_sub_tx_pcl +
- " APC DAC = " + IntToStr(MF_rf_apc_ptr->Get_ApcProfilePower( band_index, N-1 ) ) + "n"
- );
- }
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target< set APC level ok. PCL = "+ as_sub_tx_pcl + "," +
- " APC DAC = " + IntToStr(MF_rf_apc_ptr->Get_ApcProfilePower( band_index, N-1 ) ) + "n"
- );
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " new S = " +
- IntToStr( MF_rf_apc_ptr->Get_ApcProfilePower( band_index, N-1 ) )
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " delta s = 0"
- );
- break; // for iRealRecursiveTimes
- }
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- }
- else if( iRealRecursiveTimes == i_TXlevelRecusiveTimes-1 )
- {
- double d_max_p = atof(as_sub_max_p.c_str());
- double d_min_p = atof(as_sub_min_p.c_str());
- if( m_virTX > d_max_p || m_virTX < d_min_p )
- {
- 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_p ) + ", max TX power = " + Double_To_AnsiString( d_max_p )
- );
- return false;
- }
- else
- {
- 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_p ) + ", max TX power = " + Double_To_AnsiString( d_max_p )
- );
- }
- }
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- } // for iRealRecursiveTimes
- sprintf(tempbuf, "%2.1f", m_virTX);
- m_pCal->as_ResultBuf = m_pCal->as_ResultBuf + tempbuf + ", ";
- } // for N
- } // single slot TX
- else
- {
- unsigned int ui_tx_cal_pcl[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- double d_max_p[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- double d_min_p[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- double d_wanted_p[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- S_MULTISLOT_BURST_POWER virTX_p;
- unsigned int ui_c[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- unsigned short us_apc_dac[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- for( int N=0; N<i_TX_level_count; N++) // DCS,PCS:16~1 or GSM:15~1
- {
- if (! getAnsiStrSubItem( as_tx_pcl, N+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_3cal_pcl)."
- );
- return false;
- }
- ui_tx_cal_pcl[N] = as_sub_tx_pcl.ToInt();
- if (! getAnsiStrSubItem( as_max_p, FIRST_PCL-ui_tx_cal_pcl[N]+1, DEFAULT_SEP_CHAR, as_sub_max_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_max_p)."
- );
- return false;
- }
- d_max_p[N] = atof(as_sub_max_p.c_str());
- if (! getAnsiStrSubItem( as_min_p, FIRST_PCL-ui_tx_cal_pcl[N]+1, DEFAULT_SEP_CHAR, as_sub_min_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_min_p)."
- );
- return false;
- }
- d_min_p[N] = atof(as_sub_min_p.c_str());
- if (! getAnsiStrSubItem( as_wanted_p, FIRST_PCL-ui_tx_cal_pcl[N]+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;
- }
- d_wanted_p[N] = atof(as_sub_wanted_p.c_str());
- if (! getAnsiStrSubItem( as_c, FIRST_PCL-ui_tx_cal_pcl[N]+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;
- }
- ui_c[N] = as_sub_c.ToInt();
- } // for(N)
- for (int g=0; g<4; g++) // DCS,PCS:16~1 or GSM:15~1
- {
- int pcl[4];
- CodingScheme cs[4];
- cs[0] = CodingSchemeMCS5;
- cs[1] = CodingSchemeMCS5;
- cs[2] = CodingSchemeMCS5;
- cs[3] = CodingSchemeMCS5;
- pcl[0] = ui_tx_cal_pcl[0+g];
- pcl[1] = ui_tx_cal_pcl[1+g];
- pcl[2] = ui_tx_cal_pcl[2+g];
- pcl[3] = ui_tx_cal_pcl[3+g];
- for (int iRealRecursiveTimes=0; iRealRecursiveTimes<i_TXlevelRecusiveTimes;
- iRealRecursiveTimes++) // marked by Andy Ueng for no iteration test
- {
- log->Add( "n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " RecursiveTimes = " + IntToStr(iRealRecursiveTimes)
- );
- if( 0 == iRealRecursiveTimes )
- {
- m_usPCLDacValue[band_index][0] = MF_rf_apc_ptr->Get_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[0] );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " m_usPCLDacValue[" +IntToStr(band_index) + "][" + IntToStr(0) + "] = " +
- IntToStr(m_usPCLDacValue[band_index][0])
- );
- }
- 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;
- }
- S_MULTI_SLOT_TX_T multi_slot_tx;
- multi_slot_tx.b_MultiSlotTXExSupport = m_pCal->b_MultiSlotTxExSupport;
- multi_slot_tx.e_bandsel = band_index;
- multi_slot_tx.req.arfcn = s_ARFCN;
- multi_slot_tx.req.bsic = m_cTSC;
- multi_slot_tx.req.timeSlotmask = 0x07;
- for (int i=0; i<4; i++)
- {
- multi_slot_tx.req.powerLev[i] = pcl[i];
- multi_slot_tx.req.cs[i] = cs[i];
- }
- multi_slot_tx.req.ta = 0;
- multi_slot_tx.req.frames = -99;
- multi_slot_tx.req.dacValue = m_sDefault_value;
- multi_slot_tx.req.pattern = NB_TX_RANDOM_WITH_TSC;
- multi_slot_tx.req.pattern_data = 0;
- RF_MULTI_SLOT_TX_Obj.ConfirmCallback = ::ConfirmCallback_MultiSlotTX;
- RF_MULTI_SLOT_TX_Obj.REQ_Start(multi_slot_tx);
- //RF_MULTI_SLOT_TX_Obj.ConfirmCallback = ::ConfirmCallback_MultiSlotTX;
- //RF_MULTI_SLOT_TX_Obj.REQ_Start( band_index, s_ARFCN, m_cTSC, cs, pcl, -99, m_sDefault_value, 0x07, 0, true, NB_TX_RANDOM_WITH_TSC, 0 );
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- RestartTimerCal( WM_MF_AGE8960_READ_TX_POWER_FAIL );
- SUSPEND_CAL_THREAD
-
- if( RF_MULTI_SLOT_TX_Obj.Get_ConfirmState() != METAAPP_SUCCESS )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < multislot TX fail."
- );
- return false;
- }
- if( ! m_rct_ctrl.RCT_readMultiSlotAverageTxPower( m_pRct, &virTX_p ) )
- {
- CalErrorHandler( WM_MF_AGE8960_READ_TX_POWER_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- " FAIL: " + m_pRct->as_RCT + " > read multislot TX power ."
- );
- return false;
- }
- frmFatcory->DisableAllCalTimer();
- for( int N=0; N<i_TX_level_count; N++) // DCS,PCS:16~1 or GSM:15~1
- {
- m_dPCL_dBm[band_index][N] = virTX_p.d_burstpower[N] ;
- m_dPCL_power[band_index][N] = pow(10.0, m_dPCL_dBm[band_index][N]/10.0)/1000.0;
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " > read slot " + IntToStr(N) + " TX power = " + Double_To_AnsiString( virTX_p.d_burstpower[N] )
- );
- signed short ss1;
- double d1;
- if (iRealRecursiveTimes != i_TXlevelRecusiveTimes-1) //iteration
- {
- if ( virTX_p.d_burstpower[N] > (d_wanted_p[N]+ m_dAPC_Delta) ||
- virTX_p.d_burstpower[N] < (d_wanted_p[N]- m_dAPC_Delta))
- {
- d1 = ui_c[N] * ( d_wanted_p[N] - virTX_p.d_burstpower[N] );
- ss1 = (signed short) (d1>0) ? floor(d1+1.0): ceil(d1-1.0);
- if( MF_rf_apc_ptr->Get_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N] ) + ss1 <= 0 )
- {
- MF_rf_apc_ptr->Set_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N], 1 );
- }
- else
- {
- MF_rf_apc_ptr->Set_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N], MF_rf_apc_ptr->Get_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N] )+ss1 );
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " band_index = " + IntToStr(band_index) + "," +
- " power_index = " + IntToStr(FIRST_PCL-ui_tx_cal_pcl[N]) + "," +
- " MF_rf_apc_ptr->ApcProfile[band_index].rampData.power[power_index] = " + IntToStr(MF_rf_apc_ptr->Get_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N] ) )
- );
- m_usPCLDacValue[band_index][N] = MF_rf_apc_ptr->Get_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N] );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " m_usPCLDacValue[" + IntToStr(band_index) +"][" + IntToStr(N) +"] = " +
- IntToStr(m_usPCLDacValue[band_index][N])
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " new S = "+
- AnsiString( MF_rf_apc_ptr->Get_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N] ) )
- );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " delta s = "+
- AnsiString( ss1 )
- );
- MF_rf_apc_ptr->ConfirmCallback = ccb_set_apc_level;
- MF_rf_apc_ptr->Req_Rf_SetRampApcLevel(eFreqBand, ui_tx_cal_pcl[N], MF_rf_apc_ptr->Get_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N] ));
- 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 = "+ as_sub_tx_pcl +
- " APC DAC = " + IntToStr(MF_rf_apc_ptr->Get_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N] )) + "n"
- );
- }
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target< set APC level ok. PCL = "+ as_sub_tx_pcl + "," +
- " APC DAC = " + IntToStr(MF_rf_apc_ptr->Get_ApcProfilePower( band_index, FIRST_PCL-ui_tx_cal_pcl[N] )) + "n"
- );
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " delta s = 0 "
- );
- break; // for iRealRecursiveTimes
- }
- } // if no iteration
- else if( iRealRecursiveTimes == i_TXlevelRecusiveTimes-1 )
- {
- if( virTX_p.d_burstpower[N] > d_max_p[N] || virTX_p.d_burstpower[N] < d_min_p[N] )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_CHECK_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " > read TX power = "+ Double_To_AnsiString( virTX_p.d_burstpower[N] ) +
- " ( Out of Range ), min TX power = " + Double_To_AnsiString( d_min_p[N] ) + ", max TX power = " + Double_To_AnsiString( d_max_p[N] )
- );
- return false;
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " > read TX power = "+ Double_To_AnsiString( virTX_p.d_burstpower[N] ) +
- " ( Pass ), min TX power = " + Double_To_AnsiString( d_min_p[N] ) + ", max TX power = " + Double_To_AnsiString( d_max_p[N] )
- );
- }
- }
- } // for(N)
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- } // for(iRealRecursiveTimes)
- } // for(g)
- } // multislot TX
- // write full calibration result to NVRAM
- 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() +
- // " TimerCal->Enabled 14= " + IntToStr((int)Form_META_Factory->TimerCal->Enabled)
- // );
- RestartTimerCal( WM_MF_NVRAM_LEVEL_RAMP_WRITE_FAIL );
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- is_suspend_cal = true;
- this->Suspend();
- is_suspend_cal = false;
- WriteAPCCalResultToFile(as_ID+".cal",Application->ExeName, m_pCal->b_CalResultPath, FreqBand_To_BandIdx(eFreqBand) );
- eFreqBand++;
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- } // while
- // Sleep( i_N_TX*4.615);
- if( ! m_rct_ctrl.RCT_TXPowerContOff( m_pRct ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_TX_POWER_CONT_OFF_FAIL );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Agilent 8960< set continuous TX power OFF "
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : cmu200 < set continuous TX power OFF "
- );
- }
- return false;
- }
- 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( "n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " ============= GMSK TX power control level calibration end ============= n "
- );
- if( m_asAPC_Check.AnsiCompareIC("yes") != 0 )
- {
- PostMessage(
- ctrl.hPostMsgDestHandle,
- WM_MF_RF_TX_LEVEL_CALIBRATION_DONE_NO_CHECK,
- 0,
- 0
- );
- frmFatcory->DisableAllCalTimer();
- log->Add( "n" + DateToStr(Date()) + " "+ CurrentTimeStr() +
- " TX PCL calibration done (without TX PCL check procedure)! n"
- );
- }
- // WriteAPCCalResultToFile(as_ID+".cal",Application->ExeName, frmFatcory->b_CalResultPath );
- return true;
- } // full PCL calibration end
- //=========================================================================
- bool __fastcall T_META_factory_calibration::TXPCLCal_check( void )
- {
- char tempbuf[256];
- AnsiString as_tx_pcl;
- AnsiString as_max_p;
- AnsiString as_min_p;
- AnsiString as_tx_check_pcl;
- AnsiString as_sub_tx_pcl;
- AnsiString as_sub_max_p;
- AnsiString as_sub_min_p;
- AnsiString as_sub_tx_check_pcl;
- log->Add( "n" +DateToStr(Date()) + " " + CurrentTimeStr() +
- " ===================== TX power check begin ===================== n "
- );
- 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;
- }
- }
- i_N_TX = -99; // TX frames
- short s_ARFCN;
- bool TX_PCL_OUT_OF_RANGE_FLAG = false; // set initial value
- FrequencyBand eFreqBand = FrequencyBand850;
- while (eFreqBand < FrequencyBandCount)
- {
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- E_BANDSEL band_index;
- int vi_Band;
- switch (eFreqBand)
- {
- case FrequencyBand850:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_GSM850_BAND;
- band_index = BANDSEL_GSM850;
- s_ARFCN = m_sARFCN_C0_GSM850;
- i_TX_level_count = RF_RAMP_TABLE_TX_LEVEL_COUNT-1;
- as_tx_pcl = m_as_gsm850_tx_pcl;
- as_max_p = m_as_gsm850_max_p;
- as_tx_check_pcl = m_as_gsm850_tx_check_pcl;
- as_min_p = m_as_gsm850_min_p;
- }
- break;
- case FrequencyBand900:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_EGSM_BAND;
- band_index = BANDSEL_GSM900;
- s_ARFCN = m_sARFCN_C0_GSM;
- i_TX_level_count = RF_RAMP_TABLE_TX_LEVEL_COUNT-1;
- as_tx_pcl = m_as_gsm900_tx_pcl;
- as_max_p = m_as_gsm900_max_p;
- as_tx_check_pcl = m_as_gsm900_tx_check_pcl;
- as_min_p = m_as_gsm900_min_p;
- }
- break;
- case FrequencyBand1800:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_DCS1800_BAND;
- band_index = BANDSEL_DCS1800;
- s_ARFCN = m_sARFCN_C0_DCS;
- i_TX_level_count = RF_RAMP_TABLE_TX_LEVEL_COUNT;
- as_tx_pcl = m_as_dcs1800_tx_pcl;
- as_max_p = m_as_dcs1800_max_p;
- as_tx_check_pcl = m_as_dcs1800_tx_check_pcl;
- as_min_p = m_as_dcs1800_min_p;
- }
- break;
- case FrequencyBand1900:
- {
- if (!IsFreqBankSupported(m_asFreqBank, eFreqBand))
- {
- eFreqBand++;
- continue;
- }
- vi_Band = age1960_PCS1900_BAND;
- band_index = BANDSEL_PCS1900;
- s_ARFCN = m_sARFCN_C0_PCS;
- i_TX_level_count = RF_RAMP_TABLE_TX_LEVEL_COUNT;
- as_tx_pcl = m_as_pcs1900_tx_pcl;
- as_max_p = m_as_pcs1900_max_p;
- as_tx_check_pcl = m_as_pcs1900_tx_check_pcl;
- as_min_p = m_as_pcs1900_min_p;
- }
- break;
- default:
- assert(false);
- break;
- } // switch
- ///////
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- 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 );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: "+
- m_pRct->as_RCT + " < Band = " + ViBand_To_Str( vi_Band )
- );
- return false;
- }
- #ifdef _MYDEBUG_
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Sleep 100 " + AnsiString(__FILE__)
- );
- #endif
- Sleep( 100 ); // wait Agilent 8960 ready!
- // if Agilent 8960 not read, target will get error power!
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- log->Add( "n" + DateToStr(Date()) + " " + CurrentTimeStr() +
- " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "
- );
- 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_TCH_ARFCN_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: "+
- m_pRct->as_RCT + " < BCH ARFCN = " + IntToStr( bch_arfcn )
- );
- return false;
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- if( TX_SLOT_SINGLE == m_pCal->e_tx_slot )
- {
- 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;
- }
- }
- else
- {
- if( ! m_rct_ctrl.RCT_PDTCHARFCN( m_pRct, s_ARFCN ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_TCH_ARFCN_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: "+
- m_pRct->as_RCT + " < PDTCH ARFCN = " + IntToStr( s_ARFCN )
- );
- return false;
- }
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " < TCH ARFCN = " + IntToStr( s_ARFCN )
- );
- // log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " TimerCal->Enabled -5= " + 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( TX_SLOT_SINGLE == m_pCal->e_tx_slot )
- {
- if( ! m_rct_ctrl.RCT_confTXPower( m_pRct ) )
- {
- CalErrorHandler( WM_MF_AGE8960_CONFIG_TX_POWER_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Agilent 8960< config TX power 1."
- );
- return false;
- }
- }
- else
- {
- if( ! m_rct_ctrl.RCT_confMultiSlotTxPower( m_pRct, AGE1960_TX_POWER_MEASURE_COUNT, MOD_GMSK ) )
- {
- CalErrorHandler( WM_MF_AGE8960_CONFIG_TX_POWER_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: " + m_pRct->as_RCT + " < config TX power 1."
- );
- return false;
- }
- }
- if( ! m_rct_ctrl.RCT_TXPowerContOff( m_pRct ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_TX_POWER_CONT_OFF_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: " + m_pRct->as_RCT + " < set TX power continuous OFF "
- );
- return false;
- }
- // calibration from high power to low power
- // index from big to little.
- // PCL string in config file from right to left.
- if( TX_SLOT_SINGLE == m_pCal->e_tx_slot )
- {
- for( int N=1; N<=i_TX_level_count; N++)
- {
- // index start from 1
- if (! getAnsiStrSubItem( as_tx_check_pcl, N, DEFAULT_SEP_CHAR, as_sub_tx_check_pcl) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_tx_check_pcl 5)."
- );
- return false;
- }
- if( (as_sub_tx_check_pcl.ToInt()) == -1) // all check PCL done
- {
- break;
- }
- CheckIndex = cfg->getTXCheckIndex(eFreqBand, as_tx_pcl, as_sub_tx_check_pcl);
- if( CheckIndex == -1 ) // not found
- {
- CalErrorHandler( WM_MF_CFG_CHECK_PCL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: CHECK_PCL has problem in CFG file "
- );
- return false;
- }
- if(! getAnsiStrSubItem( as_max_p, CheckIndex, DEFAULT_SEP_CHAR, as_sub_max_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_max_p 5)."
- );
- return false;
- }
- if(! getAnsiStrSubItem( as_min_p, CheckIndex, DEFAULT_SEP_CHAR, as_sub_min_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_min_p 5)."
- );
- return false;
- }
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- if( ! m_rct_ctrl.RCT_MSTXLevel( m_pRct, as_sub_tx_check_pcl.ToInt() ) )
- {
- 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( as_sub_tx_check_pcl.ToInt())
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : cmu200 > MS TX level = " + IntToStr( as_sub_tx_check_pcl.ToInt())
- );
- }
- return false;
- }
- log->Add( " n" + DateToStr(Date()) + " " + CurrentTimeStr() + " " +
- m_pRct->as_RCT + " < MS TX level = " + IntToStr( as_sub_tx_check_pcl.ToInt())
- );
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- 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 = as_sub_tx_check_pcl.ToInt();
- 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; // NB burst
- 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 = " + as_sub_tx_check_pcl +
- ", frames = " + IntToStr(i_N_TX) +
- ", dac value = " + IntToStr( m_sDefault_value )
- );
- return false;
- }
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Target< TX: ARFCN = " + IntToStr( s_ARFCN ) +
- ", TSC = " + IntToStr( m_cTSC ) +
- ", power = " + as_sub_tx_check_pcl +
- ", frames = " + IntToStr(i_N_TX) +
- ", dac value = " + IntToStr( m_sDefault_value )
- );
- if( this->Terminated )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " Terminate at line " + AnsiString(__FILE__) + " " + AnsiString(__LINE__)
- );
- this->OnTerminate = neByUser;
- return false;
- }
- // log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- // " TimerCal->Enabled 17= " + 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: TX level (! MF_rf_tx_level_cnf ) 3."
- );
- return false;
- }
- frmFatcory->DisableAllCalTimer();
- 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 );
- 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;
- }
- m_dPCL_dBm[band_index][N] = m_virTX ;
- sprintf(tempbuf, "%2.1f", m_virTX);
- m_pCal->as_ResultBuf = m_pCal->as_ResultBuf + tempbuf + ", ";
- TxdBmStr = TxdBmStr + IntToStr(MF_rf_apc_ptr->Get_ApcProfilePower( band_index, N-1 ) ) + ", ";
- frmFatcory->DisableAllCalTimer();
- if( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- double d_max_p = atof(as_sub_max_p.c_str());
- double d_min_p = atof(as_sub_min_p.c_str());
- if( m_virTX > d_max_p || m_virTX < d_min_p )
- {
- 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_p ) + ", max TX power = " + Double_To_AnsiString( d_max_p )
- );
- TX_PCL_OUT_OF_RANGE_FLAG = true;
- }
- else
- {
- 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_p ) + ", max TX power = " + Double_To_AnsiString( d_max_p )
- );
- }
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- } // for N
- } // single slot TX
- else // multi-slot TX
- {
- unsigned int ui_tx_check_pcl[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- double d_max_p[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- double d_min_p[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- S_MULTISLOT_BURST_POWER virTX_p;
- double d_virTx[RF_RAMP_TABLE_TX_LEVEL_COUNT];
- for( int N=0; N<i_TX_level_count; N++) // DCS,PCS:16~1 or GSM:15~1
- {
- if (! getAnsiStrSubItem( as_tx_check_pcl, N+1, DEFAULT_SEP_CHAR, as_sub_tx_check_pcl) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_tx_3cal_pcl)."
- );
- return false;
- }
- ui_tx_check_pcl[N] = as_sub_tx_check_pcl.ToInt();
- //int int_sub_tx_check_pcl;
- if ((as_sub_tx_check_pcl.ToInt()) == -1) // all check PCL done
- {
- break;
- }
- CheckIndex = cfg->getTXCheckIndex(eFreqBand, as_tx_pcl, as_sub_tx_check_pcl);
- if( CheckIndex == -1 ) // not found
- {
- CalErrorHandler( WM_MF_CFG_CHECK_PCL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: CHECK_PCL has problem in CFG file "
- );
- return false;
- }
- if(! getAnsiStrSubItem( as_max_p, CheckIndex, DEFAULT_SEP_CHAR, as_sub_max_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_max_p 5)."
- );
- return false;
- }
- d_max_p[N] = atof(as_sub_max_p.c_str());
- if(! getAnsiStrSubItem( as_min_p, CheckIndex, DEFAULT_SEP_CHAR, as_sub_min_p) )
- {
- CalErrorHandler( WM_MF_CFG_READ_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Read config file fail(sub_min_p 5)."
- );
- return false;
- }
- d_min_p[N] = atof(as_sub_max_p.c_str());
- } // for(N)
- for( int g=0; g<4; g++) // DCS,PCS:16~1 or GSM:15~1
- {
- int pcl[4];
- CodingScheme cs[4];
- cs[0] = CodingSchemeMCS5;
- cs[1] = CodingSchemeMCS5;
- cs[2] = CodingSchemeMCS5;
- cs[3] = CodingSchemeMCS5;
- pcl[0] = ui_tx_check_pcl[0+g];
- pcl[1] = ui_tx_check_pcl[1+g];
- pcl[2] = ui_tx_check_pcl[2+g];
- pcl[3] = ui_tx_check_pcl[3+g];
- S_MULTI_SLOT_TX_T multi_slot_tx;
- multi_slot_tx.b_MultiSlotTXExSupport = m_pCal->b_MultiSlotTxExSupport;
- multi_slot_tx.e_bandsel = band_index;
- multi_slot_tx.req.arfcn = s_ARFCN;
- multi_slot_tx.req.bsic = m_cTSC;
- multi_slot_tx.req.timeSlotmask = 0x0F;
- for (int i=0; i<4; i++)
- {
- multi_slot_tx.req.powerLev[i] = pcl[i];
- multi_slot_tx.req.cs[i] = cs[i];
- }
- multi_slot_tx.req.ta = 0;
- multi_slot_tx.req.frames = -99;
- multi_slot_tx.req.dacValue = m_sDefault_value;
- multi_slot_tx.req.pattern = NB_TX_RANDOM_WITH_TSC;
- multi_slot_tx.req.pattern_data = 0;
- RF_MULTI_SLOT_TX_Obj.ConfirmCallback = ::ConfirmCallback_MultiSlotTX;
- RF_MULTI_SLOT_TX_Obj.REQ_Start(multi_slot_tx);
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- RestartTimerCal( WM_MF_RF_TX_LEVEL_FAIL );
- SUSPEND_CAL_THREAD
- if( RF_MULTI_SLOT_TX_Obj.Get_ConfirmState() != METAAPP_SUCCESS )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: Target < multislot TX fail."
- );
- return false;
- }
- if( ! m_rct_ctrl.RCT_readMultiSlotAverageTxPower( m_pRct, &virTX_p ) )
- {
- CalErrorHandler( WM_MF_AGE8960_READ_TX_POWER_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL: " + m_pRct->as_RCT + " < read multislot TX power ."
- );
- return false;
- }
- for(int i=0; i<4; i++)
- {
- d_virTx[g+i] = virTX_p.d_burstpower[i];
- }
- frmFatcory->DisableAllCalTimer();
- } // for(g)
- for( int N=0; N<i_TX_level_count; N++) // DCS,PCS:16~1 or GSM:15~1
- {
- if( d_virTx[N] > d_max_p[N]|| d_virTx[N] < d_min_p[N] )
- {
- 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_p[N] ) + ", max TX power = " + Double_To_AnsiString( d_max_p[N] )
- );
- TX_PCL_OUT_OF_RANGE_FLAG = true;
- }
- else
- {
- 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_p[N] ) + ", max TX power = " + Double_To_AnsiString( d_max_p[N] )
- );
- }
- }
- }
- eFreqBand++;
- if ( this->Terminated )
- {
- this->OnTerminate = neByUser;
- return false;
- }
- } // while
-
- m_pCal->as_ResultBuf = m_pCal->as_ResultBuf + TxdBmStr;
- if( ! m_rct_ctrl.RCT_TXPowerContOff( m_pRct ) )
- {
- CalErrorHandler( WM_MF_AGE8960_SET_TX_POWER_CONT_OFF_FAIL );
- if ( frmFatcory->rbAgilent8960->Checked )
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : Agilent 8960< set continuous TX power OFF "
- );
- }
- else
- {
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : cmu200 < set continuous TX power OFF "
- );
- }
- return false;
- }
- frmFatcory->DisableAllCalTimer();
- 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;
- }
- if( TX_PCL_OUT_OF_RANGE_FLAG )
- {
- CalErrorHandler( WM_MF_RF_TX_LEVEL_CHECK_FAIL );
- log->Add( DateToStr(Date()) + " " + CurrentTimeStr() +
- " FAIL : TX level check " + "n"
- );
- return false;
- }
- 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;
-
- } // end of TX level check