RCT_ctrl.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:53k
- /*****************************************************************************
- * 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:
- * ---------
- * RCT_ctrl.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * Radio Communication Tester control function 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 <vcl.h>
- #ifndef age1960_INCLUDE
- #include "age1960.h"
- #endif
- #pragma hdrstop
- #ifndef _RCT_CTRL_H_
- #include "rct_ctrl.h"
- #endif
- #ifndef _RCT_COMMON_H_
- #include "rct_common.h"
- #endif
- // equipment
- #ifndef _AGECOMMON_H_
- #include "agecommon.h"
- #endif
- #ifndef _AGE1960_UTILS_H_
- #include "age1960_utils.h"
- #endif
- #ifndef _AGE1968A_H_
- #include "age1968a.h"
- #endif
- #ifndef _CMU200_SIG_H_
- #include "cmu200_sig.h"
- #endif
- //===========================================================================
- //===========================================================================
- CRCTCTRL::CRCTCTRL( void )
- {
- }
- //---------------------------------------------------------------------------
- CRCTCTRL::~CRCTCTRL()
- {
- }
- //=============================================================================
- bool CRCTCTRL::RCT_Init(S_RCT *p_rct, AnsiString asFreqBand)
- {
- //-----------------------------------------------------------------------
- // Agilent
- if(p_rct->device_type == AGILENT_8960)
- {
- ViStatus vistat;
- if ((vistat = age1960_init( p_rct->age.ADD.c_str(), 0, 0, &(p_rct->age.vi))) != VI_SUCCESS)
- {
- return false;
- }
- //////////////////////////////////////////////////////////////////////////////
- if ( (vistat = age_QueryTaModel( p_rct->age.vi, &(p_rct->age.as_TaModel) )) != VI_SUCCESS)
- {
- return false;
- }
- //////////////////////////////////////////////////////////////////////////////
- Sleep(50);
- if ( p_rct->age.vi != VI_NULL)
- {
- if ( age1960_dcl(p_rct->age.vi)!= VI_SUCCESS)
- {
- return false;
- }
- }
- //////////////////////////////////////////////////////////////////////////////
- Sleep(50);
- if ( p_rct->age.vi != VI_NULL)
- {
- vistat = age1960_reset(p_rct->age.vi);
- if (vistat != VI_SUCCESS)
- {
- return false;
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- vistat = age1960_timeOut(p_rct->age.vi, p_rct->age.TMO);
- if (vistat != VI_SUCCESS)
- {
- return false;
- }
- /////////////////////////////////////////////////////////////////////////////
- const AMP_OFFSET_ITEMS = 10;
- ViReal64 freqArray[AMP_OFFSET_ITEMS] = { 400000000.0,
- 641000000.0,
- 641100000.0,
- 876000000.0,
- 876100000.0,
- 1312000000.0,
- 1312100000.0,
- 1880000000.0,
- 1881000000.0,
- 2000000000.0 };
- ViReal64 offsetArray[AMP_OFFSET_ITEMS] = { p_rct->age.d400,
- p_rct->age.d400,
- p_rct->age.d850,
- p_rct->age.d850,
- p_rct->age.d900,
- p_rct->age.d900,
- p_rct->age.d1800,
- p_rct->age.d1800,
- p_rct->age.d1900,
- p_rct->age.d1900
- };
- if ((vistat = age1960_amplitudeOffset (
- p_rct->age.vi,
- freqArray,
- offsetArray,
- AMP_OFFSET_ITEMS
- )) != VI_SUCCESS)
- {
- return false;
- }
- }
- else if(p_rct->device_type == CMU_200)
- {
- //--------------To Do CMU200 Functions------------------
- //************************************************************
- #if 0
- cmu.loss_gsm850_i = rct.cmu.dIn850;
- cmu.loss_gsm850_o = rct.cmu.dOut850;
- cmu.loss_gsm_i = rct.cmu.dIn900;
- cmu.loss_gsm_o = rct.cmu.dOut900;
- cmu.loss_dcs_i = rct.cmu.dIn1800;
- cmu.loss_dcs_o = rct.cmu.dOut1800;
- cmu.loss_pcs_i = rct.cmu.dIn1900;
- cmu.loss_pcs_o = rct.cmu.dOut1900;
- cmu.ADD = p_rct->as_GPIBAddr.SubString(0, p_rct->as_GPIBAddr.Pos("::INSTR")-1);
- cmu.TMO = p_rct->i_TimeOut;
- #endif
- p_rct->cmu.BAND = "GSM";
- if( !cmu_init_RCT( &(p_rct->cmu), asFreqBand, p_rct->bReset ) )
- {
- // Application->MessageBox( "Initial CMU200 fail", "Fail", MB_OK );
- return false;
- }
- Sleep(1500);
- }
- /////////////////////////////////////////////////////////////////////////////
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_dcl( S_RCT *p_rct )
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if ( age1960_dcl( p_rct->age.vi )!= VI_SUCCESS)
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_reset( S_RCT *p_rct )
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if ((age1960_reset( p_rct->age.vi )) != VI_SUCCESS)
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_close(S_RCT *p_rct, AnsiString asFreqBand)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- if (age1960_close(p_rct->age.vi)!= VI_SUCCESS)
- {
- return false;
- }
- p_rct->age.vi = NULL;
- }
- else
- {
- if(!cmu_close(&p_rct->cmu, asFreqBand))
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_close_RM(S_RCT *p_rct)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- }
- else
- {
- if (!cmu_close_RM(&(p_rct->cmu)))
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_QueryTaModel(S_RCT *p_rct, AnsiString &asTaModel)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if ( age_QueryTaModel( p_rct->age.vi, &asTaModel ) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_operatingMode( S_RCT *p_rct, ViInt16 OperatingMode )
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if( p_rct->age.as_TaModel.AnsiCompareIC( "E1960A" ) == 0)
- {
- if ((age1960A_operatingMode(
- p_rct->age.vi,
- OperatingMode
- ))!= VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- if (( age1968A_operatingMode(p_rct->age.vi, (E_AGE_OPERATING_MODE)OperatingMode))!= VI_SUCCESS)
- {
- return false;
- }
- }
- }
- return true;
- }
-
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_cellBand(S_RCT *p_rct, int i_BAND)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if ( age1960_cellBand(
- p_rct->age.vi,
- age1960_CELL_1,
- i_BAND
- ) != VI_SUCCESS )
- {
- return false;
- }
- }
- else if(p_rct->device_type == CMU_200)
- {
- if( !cmu_cellband(i_BAND, &(p_rct->cmu)) )
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_BurstModTran( S_RCT *p_rct )
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- }
- else if(p_rct->device_type == CMU_200)
- {
- if( !cmu_mod_tran(&(p_rct->cmu), true) )
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_ContModTran( S_RCT *p_rct )
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- }
- else if(p_rct->device_type == CMU_200)
- {
- if( !cmu_mod_tran(&(p_rct->cmu), false) )
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_BCHARFCN(S_RCT *p_rct, short s_ARFCN)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- if (age1960_BCHARFCN(p_rct->age.vi,
- age1960_CELL_1,
- s_ARFCN,
- age1960_CURRENT_BAND,
- VI_TRUE
- ) != VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- if (!cmu_bcharfcn(s_ARFCN, &(p_rct->cmu)))
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_GenFreq_CW(S_RCT *p_rct, FrequencyBand FreqBand, short arfcn)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- if (age1968A_GenFreq_CW(p_rct->age.vi, FreqBand, arfcn) != VI_SUCCESS)
- {
- }
- }
- else
- {
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_cellPower_CW(S_RCT *p_rct, double d_P_DL)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- if (age1968A_cellPower_CW(p_rct->age.vi, d_P_DL) != VI_SUCCESS)
- {
- return false;
- }
- }
- else if(p_rct->device_type == CMU_200)
- {
- if (!cmu_cellpower(d_P_DL, &(p_rct->cmu)))
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_cellPower(S_RCT *p_rct, double d_P_DL)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- if (age1960_cellPower(p_rct->age.vi, age1960_CELL_1, d_P_DL, 0) != VI_SUCCESS)
- {
- return false;
- }
- }
- else if(p_rct->device_type == CMU_200)
- {
- if( !cmu_cellpower( d_P_DL, &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_PowTranCont(S_RCT *p_rct)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- }
- else if(p_rct->device_type == CMU_200)
- {
- if( !cmu_pow_cont(true, &(p_rct->cmu)) )
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_PowTranBurst(S_RCT *p_rct)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- }
- else if(p_rct->device_type == CMU_200)
- {
- if( !cmu_pow_cont(false, &(p_rct->cmu)) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_GenFreqOffset(S_RCT *p_rct, double d_kHz)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- }
- else
- {
- if (!cmu_gen_freq_offset(&(p_rct->cmu), d_kHz))
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_GenTsc(S_RCT *p_rct, E_CMU200_GEN_TSC_TYPE_T tsc)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- }
- else
- {
- if (!cmu_gen_tsc(tsc, &(p_rct->cmu)))
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_GenBitMod(S_RCT *p_rct, E_CMU200_GEN_BIT_MODU_T bit_mod)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- }
- else
- {
- if (!cmu_gen_bit_mod(bit_mod, &(p_rct->cmu)))
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_InitRfg(S_RCT *p_rct)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- }
- else
- {
- if( ! cmu_init_rfg( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_TCHARFCN(S_RCT *p_rct, short s_ARFCN)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if ( age1960_TCHARFCN(
- p_rct->age.vi,
- s_ARFCN,
- (short) 0, // current band
- VI_TRUE
- )!= VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- if (!cmu_tcharfcn(s_ARFCN, &(p_rct->cmu)))
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_PDTCHARFCN(S_RCT *p_rct, short s_ARFCN)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if (age1968A_PDTCHARFCN(p_rct->age.vi, s_ARFCN) != VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- if (!cmu_pdtcharfcn(s_ARFCN, &(p_rct->cmu)))
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_TCHTimeslot(S_RCT *p_rct, int TCHTimeslot)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if( age1960_TCHTimeslot(p_rct->age.vi, TCHTimeslot, VI_TRUE) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
-
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_initMeasFcn_TXPOWER(S_RCT *p_rct)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if ( age1960_initMeasFcn(p_rct->age.vi, age1960_TXPOWER) != VI_SUCCESS )
- {
- return false;
- }
- else // CMU 200
- {
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_initMeasFcn_EGPRS_TXPOWER(S_RCT *p_rct)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if ( age1968A_initMeasFcn_EGPRS_TXPOWER(p_rct->age.vi) != VI_SUCCESS )
- {
- return false;
- }
- else // CMU 200
- {
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_MSTXLevel(S_RCT *p_rct, int i_pcl)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if ( age1960_MSTXLevel(
- p_rct->age.vi,
- i_pcl,
- (short) 0, // current band
- VI_TRUE
- )!= VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- if( !cmu_mxtxlevel( i_pcl, &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_PDTCHMSTargetPower(S_RCT *p_rct, double dBm)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- if (age1968A_PDTCHMSTargetPower(p_rct->age.vi, dBm) != VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- }
- return true;
- }
-
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_PDTCHMSTxLevel(S_RCT *p_rct, int i_pcl)
- {
- if (p_rct->device_type == AGILENT_8960)
- {
- if (age1968A_PDTCHMSTxLevel(p_rct->age.vi, i_pcl) != VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- if( !cmu_mxtxlevel( i_pcl, &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_Config_ExpectedTxPower(S_RCT *p_rct, bool b_auto_control, double d_expected_power)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- if (age1968A_Config_ExpectedTxPower(p_rct->age.vi,
- b_auto_control,
- d_expected_power) != VI_SUCCESS
- )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_confTXPower(S_RCT *p_rct)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if(age1960_confTXPower( p_rct->age.vi,
- AGE1960_TX_POWER_MEASURE_COUNT,
- age1960_TRIG_AUTO,
- AGE1960_TX_POWER_TRIGGER_DELAY,
- AGE1960_TX_POWER_TRIGGER_QUALIFIER_ON,
- AGE1960_READ_TX_POWER_TIMEOUT) != VI_SUCCESS
- )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_config_txpwr_control_mode( &(p_rct->cmu), AGE1960_TX_POWER_MEASURE_COUNT ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_confTXPower_EPSK(S_RCT *p_rct)
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if( age1968A_Config_EPSK_TxPower(p_rct->age.vi,
- AGE1960_EPSK_TX_POWER_MEASURE_COUNT,
- age1960_TRIG_AUTO,
- AGE1960_TX_POWER_TRIGGER_DELAY,
- AGE1960_TX_POWER_TRIGGER_QUALIFIER_ON,
- AGE1960_READ_TX_POWER_TIMEOUT) != VI_SUCCESS
- )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_config_txpwr_control_mode_epsk( &(p_rct->cmu), AGE1960_TX_POWER_MEASURE_COUNT ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_Config_EPSK_CodingScheme(S_RCT *p_rct, int i_MCS)
- {
- if( p_rct->device_type == AGILENT_8960 )
- {
- if( age1968A_Config_EPSK_CodingScheme(p_rct->age.vi, i_MCS) != VI_SUCCESS )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_ConfigTSC(S_RCT *p_rct, char c_TSC)
- {
- if( p_rct->device_type == AGILENT_8960 )
- {
- if( age1968A_ConfigTSC(p_rct->age.vi, c_TSC) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- if( !cmu_tsc( c_TSC, &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_TXPowerContOn( S_RCT *p_rct )
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- if( age1968A_TXPowerContOn( p_rct->age.vi ) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- // if( !cmu_pow_cont( true, &(p_rct->cmu) ) )
- if( ! cmu_config_txpwr_repetition_continuous( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_TXPowerContOff( S_RCT *p_rct )
- {
- if( p_rct->device_type == AGILENT_8960 )
- {
- if( age1968A_TXPowerContOff( p_rct->age.vi ) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- // if( !cmu_pow_cont( false, &(p_rct->cmu) ) )
- if( ! cmu_config_txpwr_repetition_single_shot( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_EPSK_TXPowerContOn( S_RCT *p_rct )
- {
- if(p_rct->device_type == AGILENT_8960)
- {
- // char chTXPowerON[100];
- // sprintf(chTXPowerON, "%s", "SET:TXPower:CONT ON ");
- // if ( age1960_cmd(
- // p_rct->age.vi,
- // chTXPowerON
- // )!= VI_SUCCESS)
- // {
- // return false;
- // }
- if( age1968A_EPSK_TXPowerContOn( p_rct->age.vi ) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_config_txpwr_repetition_continuous_epsk( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_EPSK_TXPowerContOff( S_RCT *p_rct )
- {
- if( p_rct->device_type == AGILENT_8960 )
- {
- // char chTXPowerOFF[100];
- // sprintf(chTXPowerOFF, "%s", "SET:TXPower:CONT OFF ");
- // if ( age1960_cmd(p_rct->age.vi, chTXPowerOFF)!= VI_SUCCESS)
- // {
- // return false;
- // }
- if( age1968A_EPSK_TXPowerContOff( p_rct->age.vi ) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- // if( !cmu_pow_cont( false, &(p_rct->cmu) ) )
- if( ! cmu_config_txpwr_repetition_single_shot_epsk( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_ReadTxPower( S_RCT *p_rct, ViReal64 &virTX )
- {
- ViInt32 viPowerInteg;
- if( p_rct->device_type == AGILENT_8960 )
- {
- if( p_rct->age.as_TaModel.AnsiCompareIC( "E1960A" ) == 0 )
- {
- if ( age1960_readTXPower_Q(
- p_rct->age.vi,
- VI_TRUE,
- &viPowerInteg,
- &virTX
- )!= VI_SUCCESS)
- {
- return false;
- }
- }
- else // GSM
- {
- if( age1968A_ReadTxPower(p_rct->age.vi, &virTX) != VI_SUCCESS )
- {
- return false;
- }
- }
- }
- else
- {
- viPowerInteg=0;
- if( !cmu_readtxpower( &virTX, &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_ReadTxPower_EPSK( S_RCT *p_rct, ViReal64 &virTX )
- {
- if( p_rct->device_type == AGILENT_8960 )
- {
- if( age1968A_ReadEGPRSTxPower(p_rct->age.vi, &virTX) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- //viPowerInteg=0;
- if( !cmu_readtxpower_8psk( &virTX, &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //==========================================================================
- // phase error
- bool CRCTCTRL::RCT_confPFER(S_RCT *p_rct, int measure_count )
- {
- if( p_rct->device_type == AGILENT_8960 )
- {
- if (age1968A_confPFER(p_rct->age.vi,
- measure_count,
- age1960_TRIG_AUTO,
- AGE1960_PFER_TRIGGER_DELAY,
- AGE1960_PFER_TRIGGER_QUALIFIER_ON,
- AGE1960_READ_PFER_TIMEOUT)!= VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_config_control_mode( &(p_rct->cmu), measure_count ) )
- {
- return false;
- }
- if( ! cmu_mod_config_control_repetition( &(p_rct->cmu), measure_count ) )
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- //bool CRCTCTRL::RCT_initMeasFcn_PFER( S_RCT *p_rct )
- //{
- // if( p_rct->device_type == AGILENT_8960 )
- // {
- // if ( age1960_initMeasFcn(p_rct->age.vi, age1960_PFER) != VI_SUCCESS )
- // {
- // return false;
- // }
- // else // CMU 200
- // {
- //
- // }
- // }
- // return true;
- //}
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_FetchAvgFreqErr( S_RCT *p_rct, ViReal64 &AvgFreqErr )
- {
- ViInt32 PFERIntegrity;
- ViReal64 PFERRMSError;
- ViReal64 PFERPeakError;
- ViReal64 PFERFreqError;
-
- if (AGILENT_8960 == p_rct->device_type)
- {
- if( age_FetchAvgFreqError(p_rct->age.vi, &PFERFreqError) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_init( &(p_rct->cmu) ) )
- {
- return false;
- }
- if( ! cmu_mod_sample(&(p_rct->cmu), FREQ_ERR_AVERAGE, &PFERFreqError) )
- {
- return false;
- }
- if( ! cmu_mod_abort( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- AvgFreqErr = PFERFreqError;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_FetchAvgPhErr( S_RCT *p_rct, ViReal64 &AvgPhErr )
- {
- ViInt32 PFERIntegrity;
- ViReal64 PFERRMSError;
- ViReal64 PFERPeakError;
- ViReal64 PFERFreqError;
- if( p_rct->device_type == AGILENT_8960 )
- {
- if ( age1960_fetchPFER_Q(
- p_rct->age.vi,
- &PFERIntegrity,
- &PFERRMSError,
- &PFERPeakError,
- &PFERFreqError
- )!= VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_init( &(p_rct->cmu ) ) )
- {
- return false;
- }
- if( ! cmu_mod_sample(&(p_rct->cmu), PH_ERR_RMS_AVERAGE, &PFERRMSError) )
- // if( !cmu_readmod(PH_ERR_RMS_AVERAGE, &cmu, &PFERFreqError) )
- {
- return false;
- }
- if( ! cmu_mod_abort( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- AvgPhErr = PFERRMSError;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_ReadAvgFreqErr( S_RCT *p_rct, ViReal64 &AvgFreqErr )
- {
- ViInt32 PFERIntegrity;
- ViReal64 PFERRMSError;
- ViReal64 PFERPeakError;
- ViReal64 PFERFreqError;
- if(AGILENT_8960 == p_rct->device_type)
- {
- if( age_ReadAvgFreqError(p_rct->age.vi, &PFERFreqError) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_read(&(p_rct->cmu), FREQ_ERR_AVERAGE, &PFERFreqError) )
- {
- return false;
- }
- }
- AvgFreqErr = PFERFreqError;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_ReadAvgPhErr( S_RCT *p_rct, ViReal64 &AvgPhErr )
- {
- ViInt32 PFERIntegrity;
- ViReal64 PFERRMSError;
- ViReal64 PFERPeakError;
- ViReal64 PFERFreqError;
- if( AGILENT_8960 == p_rct->device_type )
- {
- if ( age1960_readPFER_Q(
- p_rct->age.vi,
- &PFERIntegrity,
- &PFERRMSError,
- &PFERPeakError,
- &PFERFreqError
- )!= VI_SUCCESS)
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_read(&(p_rct->cmu), PH_ERR_RMS_AVERAGE, &PFERRMSError) )
- {
- return false;
- }
- }
- AvgPhErr = PFERRMSError;
- return true;
- }
- //===========================================================================
- ///////////////////////// IQ tunning /////////////////////////////
- //===========================================================================
- bool CRCTCTRL::RCT_initMeasFcn_IQTuning( S_RCT *p_rct )
- {
- if( p_rct->device_type == AGILENT_8960 )
- {
- if ( age1960_initMeasFcn(p_rct->age.vi, age1960_IQTUNING) != VI_SUCCESS )
- {
- return false;
- }
- else // CMU 200
- {
- }
- }
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_confIQTuning( S_RCT *p_rct, int measure_count )
- {
- if( p_rct->device_type == AGILENT_8960 )
- {
- if( age1960_confIQTuning(p_rct->age.vi,
- measure_count,
- age1960_TRIG_RF_RISE,
- AGE1960_IQ_TUNNING_TRIGGER_DELAY,
- age1960_IQ_REF_AUTO,
- AGE1960_IQ_TUNNING_TRIGGER_QUALIFIER_OFF,
- AGE1960_IQ_TUNNING_SPUR_FREQ,
- AGE1960_READ_IQ_TUNNING_TIMEOUT) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_xper_config_control_mode( &(p_rct->cmu), measure_count ) )
- {
- return false;
- }
- if( ! cmu_mod_xper_config_control_repetition( &(p_rct->cmu), measure_count ) )
- {
- return false;
- }
- }
- return true;
- }
- //----------------------------------------------------------------------------
- bool CRCTCTRL::RCT_readTxOriginalOffset( S_RCT *p_rct, double &d_Original_Offset )
- {
- if( AGILENT_8960 == p_rct->device_type )
- {
- ViInt32 IQTIntegrity;
- ViReal64 IQTSpurFreq;
- ViReal64 IQTSpurLevel;
- ViReal64 IQTResultsArray[age1960_IQ_ARRAY_MIN];
- ViReal64 IQTFreqsArray[age1960_IQ_ARRAY_MIN];
- ViInt32 IQTTuningCount;
- if( age1960_readIQTuning_Q( p_rct->age.vi,
- age1960_IQ_ARRAY_MIN,
- &IQTIntegrity,
- &IQTSpurFreq,
- &IQTSpurLevel,
- IQTResultsArray,
- IQTFreqsArray,
- &IQTTuningCount) != VI_SUCCESS )
- {
- return false;
- }
- d_Original_Offset = get_Original_Offset(IQTFreqsArray, IQTResultsArray, IQTTuningCount);
- if( NAN == d_Original_Offset )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_xper_read( &(p_rct->cmu), XPER_ORIGINAL_OFFSET_AVERAGE, &d_Original_Offset) )
- {
- return false;
- }
- }
- return true;
- }
- //----------------------------------------------------------------------------
- bool CRCTCTRL::RCT_fetchTxOriginalOffset( S_RCT *p_rct, double &d_Original_Offset )
- {
- if( AGILENT_8960 == p_rct->device_type )
- {
- ViInt32 IQTIntegrity;
- ViReal64 IQTSpurFreq;
- ViReal64 IQTSpurLevel;
- ViReal64 IQTResultsArray[age1960_IQ_ARRAY_MIN];
- ViReal64 IQTFreqsArray[age1960_IQ_ARRAY_MIN];
- ViInt32 IQTTuningCount;
- if( age1960_fetchIQTuning_Q ( p_rct->age.vi,
- age1960_IQ_ARRAY_MIN,
- &IQTIntegrity,
- &IQTSpurFreq,
- &IQTSpurLevel,
- IQTResultsArray,
- IQTFreqsArray,
- &IQTTuningCount) != VI_SUCCESS )
- {
- return false;
- }
- d_Original_Offset = get_Original_Offset(IQTFreqsArray, IQTResultsArray, IQTTuningCount);
- if( NAN == d_Original_Offset )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_xper_init( &(p_rct->cmu) ) )
- {
- return false;
- }
- if( ! cmu_mod_xper_sample( &(p_rct->cmu), XPER_ORIGINAL_OFFSET_AVERAGE, &d_Original_Offset) )
- {
- return false;
- }
- if( ! cmu_mod_xper_abort( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_fetchTxIqImbalance( S_RCT *p_rct, double &d_IQ_Imbalance )
- {
- if( AGILENT_8960 == p_rct->device_type )
- {
- ViInt32 IQTIntegrity;
- ViReal64 IQTSpurFreq;
- ViReal64 IQTSpurLevel;
- ViReal64 IQTResultsArray[age1960_IQ_ARRAY_MIN];
- ViReal64 IQTFreqsArray[age1960_IQ_ARRAY_MIN];
- ViInt32 IQTTuningCount;
- if( age1960_fetchIQTuning_Q ( p_rct->age.vi,
- age1960_IQ_ARRAY_MIN,
- &IQTIntegrity,
- &IQTSpurFreq,
- &IQTSpurLevel,
- IQTResultsArray,
- IQTFreqsArray,
- &IQTTuningCount
- ) != VI_SUCCESS )
- {
- return false;
- }
- d_IQ_Imbalance = get_IQ_Imbalance(IQTFreqsArray, IQTResultsArray, IQTTuningCount);
- if( NAN == d_IQ_Imbalance )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_xper_init( &(p_rct->cmu) ) )
- {
- return false;
- }
- if( ! cmu_mod_xper_sample( &(p_rct->cmu), XPER_IQ_IMBALANCE_AVERAGE, &d_IQ_Imbalance) )
- {
- return false;
- }
- if( ! cmu_mod_xper_abort( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_readTxIqImbalance( S_RCT *p_rct, double &d_IQ_Imbalance )
- {
- if( AGILENT_8960 == p_rct->device_type )
- {
- ViInt32 IQTIntegrity;
- ViReal64 IQTSpurFreq;
- ViReal64 IQTSpurLevel;
- ViReal64 IQTResultsArray[age1960_IQ_ARRAY_MIN];
- ViReal64 IQTFreqsArray[age1960_IQ_ARRAY_MIN];
- ViInt32 IQTTuningCount;
- if( age1960_readIQTuning_Q ( p_rct->age.vi,
- age1960_IQ_ARRAY_MIN,
- &IQTIntegrity,
- &IQTSpurFreq,
- &IQTSpurLevel,
- IQTResultsArray,
- IQTFreqsArray,
- &IQTTuningCount
- ) != VI_SUCCESS )
- {
- return false;
- }
- d_IQ_Imbalance = get_IQ_Imbalance(IQTFreqsArray, IQTResultsArray, IQTTuningCount);
- if( NAN == d_IQ_Imbalance )
- {
- return false;
- }
- }
- else
- {
- if( ! cmu_mod_xper_read( &(p_rct->cmu), XPER_IQ_IMBALANCE_AVERAGE, &d_IQ_Imbalance) )
- {
- return false;
- }
- }
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_readTxIq(S_RCT *p_rct, double &d_IQ_Imbalance, double &d_Original_Offset)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- ViInt32 IQTIntegrity;
- ViReal64 IQTSpurFreq;
- ViReal64 IQTSpurLevel;
- ViReal64 IQTResultsArray[age1960_IQ_ARRAY_MIN];
- ViReal64 IQTFreqsArray[age1960_IQ_ARRAY_MIN];
- ViInt32 IQTTuningCount;
- if (age1960_readIQTuning_Q (p_rct->age.vi,
- age1960_IQ_ARRAY_MIN,
- &IQTIntegrity,
- &IQTSpurFreq,
- &IQTSpurLevel,
- IQTResultsArray,
- IQTFreqsArray,
- &IQTTuningCount
- ) != VI_SUCCESS )
- {
- return false;
- }
- d_IQ_Imbalance = get_IQ_Imbalance(IQTFreqsArray, IQTResultsArray, IQTTuningCount);
- d_Original_Offset = get_Original_Offset(IQTFreqsArray, IQTResultsArray, IQTTuningCount);
- if ((NAN == d_IQ_Imbalance) || (NAN == d_Original_Offset))
- {
- return false;
- }
- }
- else
- {
- if (! cmu_mod_xper_read_txiq( &(p_rct->cmu), &d_IQ_Imbalance, &d_Original_Offset))
- {
- return false;
- }
- }
- return true;
- }
- //===========================================================================
- ////////////////////////// EPSK /////////////////////////
- //===========================================================================
- bool CRCTCTRL::RCT_Config_EPSK_ModACcuracy(S_RCT *p_rct, int iMeasureCount, int iTriSour, int iDelay, int iTimeout)
- {
- if( AGILENT_8960 == p_rct->device_type )
- {
- if( age1968A_Config_EPSK_ModACcuracy(p_rct->age.vi,
- iMeasureCount,
- iTriSour,
- iDelay,
- iTimeout) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- if (!cmu_mod_overview_config_control_mode_8psk(&(p_rct->cmu), iMeasureCount))
- {
- return false;
- }
- }
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_Fetch_EPSK_Average_OrignalOffset( S_RCT *p_rct, ViReal64 *p_virOOS )
- {
- if( AGILENT_8960 == p_rct->device_type )
- {
- if( age1968A_Fetch_EPSK_Average_OrignalOffset(p_rct->age.vi, p_virOOS ) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- if (!cmu_mod_overview_fetch_8psk(&(p_rct->cmu), 8, p_virOOS))
- {
- return false;
- }
- }
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_Fetch_EPSK_Average_IQImbalance( S_RCT *p_rct, ViReal64 *p_virSBS )
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- if( age1968A_Fetch_EPSK_Average_IQImbalance( p_rct->age.vi, p_virSBS) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- if (!cmu_mod_overview_read_8psk(&(p_rct->cmu), 16, p_virSBS))
- {
- return false;
- }
- }
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_Fetch_EPSK_Average_TxIq(S_RCT *p_rct, ViReal64 *p_virSBS, ViReal64 *p_virOOS)
- {
- if (AGILENT_8960 == p_rct->device_type)
- {
- // if( age1968A_Fetch_EPSK_Average_TxIq( p_rct->age.vi, p_virSBS, p_virOOS) != VI_SUCCESS )
- // {
- // return false;
- // }
- if (age1968A_Fetch_EPSK_Average_OrignalOffset(p_rct->age.vi, p_virOOS) != VI_SUCCESS)
- {
- return false;
- }
- if (age1968A_Fetch_EPSK_Average_IQImbalance(p_rct->age.vi, p_virSBS) != VI_SUCCESS )
- {
- return false;
- }
- }
- else
- {
- if (!cmu_Fetch_EPSK_Average_TxIq(&(p_rct->cmu), p_virSBS, p_virOOS))
- {
- return false;
- }
- }
- return true;
- }
- //===========================================================================
- ///////////////////////// Multislot TX power /////////////////////
- //===========================================================================
- bool CRCTCTRL::RCT_confMultiSlotTxPower( S_RCT *p_rct, int measure_count, E_MODULATION_TYPE modulation )
- {
- if( AGILENT_8960 == p_rct->device_type )
- {
- }
- else
- {
- if( ! cmu_config_multislot_txpower_control_mode( &(p_rct->cmu), measure_count ) )
- return false;
- if( ! cmu_config_multislot_txpower_repetition_single_shot( &(p_rct->cmu) ) )
- return false;
- if( ! cmu_config_multi_slot_count( &(p_rct->cmu), 4 ) )
- return false;
- if( ! cmu_config_trigger_slot_offset( &(p_rct->cmu), TIMESLOT_0 ) )
- return false;
- if( ! cmu_config_multislot_modulation( &(p_rct->cmu), modulation ) )
- return false;
- }
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_readMultiSlotAverageTxPower( S_RCT *p_rct, S_MULTISLOT_BURST_POWER *power )
- {
- if( AGILENT_8960 == p_rct->device_type )
- {
- }
- else
- {
- if( ! cmu_read_multislot_average_txpower( &(p_rct->cmu), power ) )
- return false;
- }
- return true;
- }
- //===========================================================================
- ///////////////////////// Signalling //////////////////////////
- //===========================================================================
- bool CRCTCTRL::RCT_sig_Init( S_RCT *p_rct, AnsiString asFreqBand )
- {
- //-----------------------------------------------------------------------
- // Agilent
- if(CMU_200 == p_rct->device_type)
- {
- p_rct->cmu.s_BAND = "GSM";
- if( ! cmu_sig_init_RCT( &(p_rct->cmu), asFreqBand, p_rct->bReset ) )
- {
- return false;
- }
- Sleep(3500);
- }
- /////////////////////////////////////////////////////////////////////////////
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_close(S_RCT *p_rct, AnsiString asFreqBand)
- {
- if(p_rct->device_type == CMU_200)
- {
- if (!cmu_sig_close(&p_rct->cmu, asFreqBand))
- {
- return false;
- }
- }
- return true;
- }
-
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_cellBand(S_RCT *p_rct, int i_BAND)
- {
- if(p_rct->device_type == CMU_200)
- {
- if( ! cmu_sig_cellband(&(p_rct->cmu), i_BAND) )
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_cellPower(S_RCT *p_rct, double d_P_DL)
- {
- if(p_rct->device_type == CMU_200)
- {
- if( ! cmu_sig_cellpower( &(p_rct->cmu), d_P_DL ) )
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_BCHARFCN(S_RCT *p_rct, short s_ARFCN)
- {
- if (CMU_200 == p_rct->device_type)
- {
- if (!cmu_sig_bcharfcn(&(p_rct->cmu), s_ARFCN))
- {
- return false;
- }
- }
- return true;
- }
- //--------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_TCHARFCN(S_RCT *p_rct, short s_ARFCN)
- {
- if (CMU_200 == p_rct->device_type)
- {
- if (!cmu_sig_tcharfcn(&(p_rct->cmu), s_ARFCN))
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_TCHTimeslot(S_RCT *p_rct, int TCHTimeslot)
- {
- if( CMU_200 == p_rct->device_type )
- {
- if( ! cmu_sig_tchtimeslot( &(p_rct->cmu), TCHTimeslot ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_TCHLevel(S_RCT *p_rct, double level)
- {
- if( CMU_200 == p_rct->device_type )
- {
- if( ! cmu_sig_tchlevel( &(p_rct->cmu), level ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_ConfigTSC(S_RCT *p_rct, char c_TSC)
- {
- if( CMU_200 == p_rct->device_type )
- {
- if( !cmu_sig_tsc( &(p_rct->cmu), c_TSC ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_MSTXLevel(S_RCT *p_rct, int i_pcl)
- {
- if( CMU_200 == p_rct->device_type )
- {
- if( ! cmu_sig_mstxlevel( &(p_rct->cmu), i_pcl ) )
- {
- return false;
- }
- }
- return true;
- }
- //-------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_confPFER(S_RCT *p_rct, int measure_count )
- {
- if( CMU_200 == p_rct->device_type )
- {
- if( ! cmu_sig_mod_config_control_mode( &(p_rct->cmu), measure_count ) )
- {
- return false;
- }
- #if 0
- if( ! cmu_sig_mod_config_control_repetition( &(p_rct->cmu), measure_count ) )
- {
- return false;
- }
- #endif
- }
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_FetchAvgFreqErr( S_RCT *p_rct, ViReal64 &AvgFreqErr )
- {
- ViInt32 PFERIntegrity;
- ViReal64 PFERRMSError;
- ViReal64 PFERPeakError;
- ViReal64 PFERFreqError;
- if(CMU_200 == p_rct->device_type )
- {
- if( ! cmu_sig_mod_init( &(p_rct->cmu) ) )
- {
- return false;
- }
- if( ! cmu_sig_mod_sample(&(p_rct->cmu), FREQ_ERR_AVERAGE, &PFERFreqError) )
- {
- return false;
- }
- if( ! cmu_sig_mod_abort( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- AvgFreqErr = PFERFreqError;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_FetchAvgPhErr( S_RCT *p_rct, ViReal64 &AvgPhErr )
- {
- ViInt32 PFERIntegrity;
- ViReal64 PFERRMSError;
- ViReal64 PFERPeakError;
- ViReal64 PFERFreqError;
- if(CMU_200 == p_rct->device_type )
- {
- if( ! cmu_sig_mod_init( &(p_rct->cmu ) ) )
- {
- return false;
- }
- if( ! cmu_sig_mod_sample(&(p_rct->cmu), PH_ERR_RMS_AVERAGE, &PFERRMSError) )
- // if( !cmu_readmod(PH_ERR_RMS_AVERAGE, &cmu, &PFERFreqError) )
- {
- return false;
- }
- if( ! cmu_sig_mod_abort( &(p_rct->cmu) ) )
- {
- return false;
- }
- }
- AvgPhErr = PFERRMSError;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_ReadAvgFreqErr( S_RCT *p_rct, ViReal64 &AvgFreqErr )
- {
- ViInt32 PFERIntegrity;
- ViReal64 PFERRMSError;
- ViReal64 PFERPeakError;
- ViReal64 PFERFreqError;
- if(CMU_200 == p_rct->device_type )
- {
- if( ! cmu_sig_mod_read(&(p_rct->cmu), FREQ_ERR_AVERAGE, &PFERFreqError) )
- {
- return false;
- }
- }
- AvgFreqErr = PFERFreqError;
- return true;
- }
- //---------------------------------------------------------------------------
- bool CRCTCTRL::RCT_sig_ReadAvgPhErr( S_RCT *p_rct, ViReal64 &AvgPhErr )
- {
- ViInt32 PFERIntegrity;
- ViReal64 PFERRMSError;
- ViReal64 PFERPeakError;
- ViReal64 PFERFreqError;
- if(CMU_200 == p_rct->device_type )
- {
- if( ! cmu_sig_mod_read(&(p_rct->cmu), PH_ERR_RMS_AVERAGE, &PFERRMSError) )
- {
- return false;
- }
- }
- AvgPhErr = PFERRMSError;
- return true;
- }
- //===========================================================================
- ///////////////////////// string //////////////////////////////
- //===========================================================================
- const AnsiString AGILENT_8960_STR = "Agilent 8960";
- const AnsiString CMU_200_STR = "CMU 200";
- //---------------------------------------------------------------------------
- int CRCTCTRL::RCT_StringToDeviceType( AnsiString as_str )
- {
- int device_type;
- if( as_str.AnsiCompareIC(AGILENT_8960_STR) == 0 )
- {
- device_type = AGILENT_8960;
- }
- else
- {
- device_type = CMU_200;
- }
- return device_type;
- }
- //---------------------------------------------------------------------------
- AnsiString CRCTCTRL::RCT_DeviceTypeToString( E_DEVICE_TYPE device_type )
- {
- AnsiString as_str;
- switch( device_type )
- {
- case AGILENT_8960:
- as_str = AGILENT_8960_STR;
- break;
- case CMU_200:
- as_str = CMU_200_STR;
- break;
- default:
- as_str = "Unkown device";
- break;
- }
- return as_str;
- }