form_RFTXIQBBTXRun.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:42k
- /*****************************************************************************
- * 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:
- * ---------
- * form_RFTXIQBBTXRun.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * RF TXIQ BB TX runtime setting form 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>
- #pragma hdrstop
- #include "form_main.h"
- #include "form_RFTool.h"
- #ifndef _FORM_RFTXIQBBTXRUN_H_
- #include "form_RFTXIQBBTXRun.h"
- #endif
- #include "misc.h"
- #ifndef _META_LAB_MSG_H_
- #include "meta_lab_msg.h"
- #endif
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TfrmTXIQBBTXRunTimeSetting *frmTXIQBBTXRunTimeSetting;
- //---------------------------------------------------------------------------
- static void ConfirmCallback_GetBBTxCfg(void)
- {
- frmTXIQBBTXRunTimeSetting->ConfirmCallback_GetBBTxCfg();
- }
- //--------------------------------------------------------------------------
- static void CNF_SetBBTxCfg(void)
- {
- frmTXIQBBTXRunTimeSetting->CNF_SetBBTxCfg();
- }
- //--------------------------------------------------------------------------
- static void ConfirmCallback_TX(void)
- {
- frmTXIQBBTXRunTimeSetting->ConfirmCallback_TX();
- }
- //--------------------------------------------------------------------------
- static void ConfirmCallback_MultiSlotTX( void )
- { frmTXIQBBTXRunTimeSetting->ConfirmCallback_MultiSlotTX();
- }
- //==============================================================================
- void _fastcall TfrmTXIQBBTXRunTimeSetting::SubClassWndProc( Messages::TMessage &Message)
- {
- switch ( Message.Msg )
- {
- // case WM_ML_QUERY_BBTXCFG3SUPPPORT_SUCCESS:
- // m_bBBTXCfg3Support = true;
- // lblTXBBTXPhasesel->Visible = true;
- // edtTXBBTXPhasesel->Visible = true;
- // break;
- // case WM_ML_QUERY_BBTXCFG3SUPPPORT_FAILED:
- // m_bBBTXCfg3Support = false;
- // lblTXBBTXPhasesel->Visible = false;
- // edtTXBBTXPhasesel->Visible = false;
- // break;
- default:
- this->WndProc( Message );
- break;
- }
- }
- //--------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::Init( void )
- {
- m_bInit = true;
- }
- //--------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::FormActivate(TObject *Sender)
- {
- if (m_bInit)
- {
- m_bInit = false;
- // modulation
- m_sFinalMSCAP = frmMainSel->Get_FinalMSCap();
- if (m_sFinalMSCAP.capability.EDGE_8PSK_TX)
- {
- lblTXModulation->Visible = true;
- cbTXModulation->Visible = true;
- }
- else
- {
- lblTXModulation->Visible = false;
- cbTXModulation->Visible = false;
- }
- if (MOD_GMSK_INDEX == cbTXModulation->ItemIndex)
- {
- Display_TxGmskUi();
- }
- else
- {
- Display_TxEpskUi();
- }
- // BBTXCfg
- BBCHIP_TYPE bb_chip = frmMainSel->Get_FinalBBChip();
- m_eBbTxCfgVer = m_pcRF_TXIQRUN_Obj->Query_BBTxCfgVer_Start(bb_chip);
- if (m_eBbTxCfgVer >= BBTXCFG_VER3)
- {
- lblTXBBTXPhasesel->Visible = true;
- edtTXBBTXPhasesel->Visible = true;
- }
- else
- {
- lblTXBBTXPhasesel->Visible = false;
- edtTXBBTXPhasesel->Visible = false;
- }
- // multi slot TX
- m_bMultiSlotTxExSupport = frmRFTool->Get_MultiSlotTxExSupport();
- }
- }
- //===========================================================================
- bool TfrmTXIQBBTXRunTimeSetting::CheckBbTxCfgFields(void)
- {
- signed char tx_trim_i;
- signed char tx_trim_q;
- signed char tx_offset_i;
- signed char tx_offset_q;
- signed char tx_cal_bias;
- char tx_iq_swap;
- signed char tx_cmv;
- signed char tx_gain;
- signed char tx_calrcsel;
- signed char tx_phasesel;
- AnsiString text;
- text = edtTXTrimI->Text; if (!IsValidTrimIQ(text, tx_trim_i)) { edtTrimIQCheck(edtTXTrimI); return false; }
- m_sBbTxCfg.TxTrimI = tx_trim_i;
- text = edtTXTrimQ->Text; if (!IsValidTrimIQ(text, tx_trim_q)) { edtTrimIQCheck(edtTXTrimQ); return false; }
- m_sBbTxCfg.TxTrimQ = tx_trim_q;
- text = edtTXOffsetI->Text; if (!IsValidOffsetIQ(m_eBbTxCfgVer, text, tx_offset_i) ) { edtOffsetIQCheck(edtTXOffsetI); return false; }
- m_sBbTxCfg.TxOffsetI = tx_offset_i;
- text = edtTXOffsetQ->Text; if (!IsValidOffsetIQ(m_eBbTxCfgVer, text, tx_offset_q) ) { edtOffsetIQCheck(edtTXOffsetQ); return false; }
- m_sBbTxCfg.TxOffsetQ = tx_offset_q;
- text = edtTXTXCalbias->Text; if (!IsValidTxCalbias(m_eBbTxCfgVer, text, tx_cal_bias)) { edtBBTXCalbiasCheck(edtTXTXCalbias); return false; }
- m_sBbTxCfg.TxCalbias = tx_cal_bias;
- text = edtTXTXIQSwap->Text; if (!IsValidTxIQSwap(text, tx_iq_swap)) { edtBBTXIQSwapCheck(edtTXTXIQSwap); return false; }
- m_sBbTxCfg.TxIQSwap = tx_iq_swap;
- text = edtTXCMV->Text; if (!IsValidBBTXCommonModeVoltage(text, tx_cmv)) { edtBBTXCommonModeVoltageCheck(edtTXCMV); return false; }
- m_sBbTxCfg.TxCMV = tx_cmv;
- text = edtTXBBTXGain->Text; if (!IsValidBBTXGain(text, tx_gain) ) { edtBBTXGainCheck(edtTXBBTXGain); return false; }
- m_sBbTxCfg.TxGain = tx_gain;
- text = edtTXBBTXCalrcsel->Text; if (!IsValidBBTXCalrcsel(text, tx_calrcsel)) { edtTXBBTXCalrcselCheck(edtTXBBTXCalrcsel); return false; }
- m_sBbTxCfg.TxCalrcsel = tx_calrcsel;
- if (edtTXBBTXPhasesel->Visible)
- {
- text = edtTXBBTXPhasesel->Text; if (!IsValidBBTXPhasesel(m_eBbTxCfgVer, text, tx_phasesel)) { edtTXBBTXPhaseselCheck(edtTXBBTXPhasesel); return false; }
- m_sBbTxCfg.TxPhasesel = tx_phasesel;
- }
- return true;
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::ReDrawFields(void)
- {
- edtTXTrimI->Text = IntToStr(m_sBbTxCfg.TxTrimI);
- edtTXTrimQ->Text = IntToStr(m_sBbTxCfg.TxTrimQ);
- edtTXOffsetI->Text = IntToStr(m_sBbTxCfg.TxOffsetI);
- edtTXOffsetQ->Text = IntToStr(m_sBbTxCfg.TxOffsetQ);
- edtTXTXCalbias->Text = IntToStr(m_sBbTxCfg.TxCalbias);
- edtTXTXIQSwap->Text = IntToStr(m_sBbTxCfg.TxIQSwap);
- edtTXCMV->Text = IntToStr(m_sBbTxCfg.TxCMV);
- edtTXBBTXGain->Text = IntToStr(m_sBbTxCfg.TxGain);
- edtTXBBTXCalrcsel->Text = IntToStr(m_sBbTxCfg.TxCalrcsel);
- if (m_eBbTxCfgVer >= BBTXCFG_VER3)
- {
- edtTXBBTXPhasesel->Text = IntToStr(m_sBbTxCfg.TxPhasesel);
- }
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::CurrentPageReset( void )
- {
- cbTXModulation->Enabled = true;
- cbxTXBand->Enabled = true;
- edtTXArfcn->Enabled = true;
- cbxTXTsc->Enabled = true;
- edtTXPcl->Enabled = true;
- edtTXAfc->Enabled = true;
- edtTXTA->Enabled = true;
- cbTXCS->Enabled = true;
- cbTXBurstType->Enabled = true;
- edtTXPattern->Enabled = true;
- // radTXAb->Enabled = true;
- // radTXNb->Enabled = true;
- // radTXNbOne->Enabled = true;
- edtTXTrimI->Enabled = true;
- edtTXTrimQ->Enabled = true;
- edtTXOffsetI->Enabled = true;
- edtTXOffsetQ->Enabled = true;
- edtTXTXCalbias->Enabled = true;
- edtTXTXIQSwap->Enabled = true;
- edtTXCMV->Enabled = true;
- edtTXBBTXGain->Enabled = true;
- edtTXBBTXCalrcsel->Enabled = true;
- edtTXBBTXPhasesel->Enabled = true;
- btnTXStart->Enabled = true;
- btnTXStart->Tag = 0;
- btnLoadFromFile->Enabled = true;
- btnSaveToFile->Enabled = true;
- btnLoadFromReg->Enabled = true;
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::CurrentPageLock( void )
- {
- cbTXModulation->Enabled = false;
- cbxTXBand->Enabled = false;
- edtTXArfcn->Enabled = false;
- cbxTXTsc->Enabled = false;
- edtTXPcl->Enabled = false;
- edtTXAfc->Enabled = false;
- edtTXTA->Enabled = false;
- cbTXCS->Enabled = false;
- cbTXBurstType->Enabled = false;
- edtTXPattern->Enabled = false;
- // radTXAb->Enabled = false;
- // radTXNb->Enabled = false;
- // radTXNbOne->Enabled = false;
- edtTXTrimI->Enabled = false;
- edtTXTrimQ->Enabled = false;
- edtTXOffsetI->Enabled = false;
- edtTXOffsetQ->Enabled = false;
- edtTXTXCalbias->Enabled = false;
- edtTXTXIQSwap->Enabled = false;
- edtTXCMV->Enabled = false;
- edtTXBBTXGain->Enabled = false;
- edtTXBBTXCalrcsel->Enabled = false;
- edtTXBBTXPhasesel->Enabled = false;
- btnTXStart->Enabled = false;
- btnTXStart->Tag = 1;
- btnLoadFromFile->Enabled = false;
- btnSaveToFile->Enabled = false;
- btnLoadFromReg->Enabled = false;
- }
- //===========================================================================
- //---------------------------------------------------------------------------
- __fastcall TfrmTXIQBBTXRunTimeSetting::TfrmTXIQBBTXRunTimeSetting(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::btnTXStartClick(
- TObject *Sender)
- {
- if (1 == btnTXStart->Tag)
- {
- return;
- }
- if (!CheckBbTxCfgFields())
- {
- return;
- }
- m_eCurBand = (E_BANDSEL) cbxTXBand->ItemIndex;
- CurrentPageLock();
- m_pcRF_TXIQRUN_Obj->ConfirmCallback = ::CNF_SetBBTxCfg;
- m_pcRF_TXIQRUN_Obj->REQ_SetBBTxCfg_Start(m_eBbTxCfgVer, m_sBbTxCfg);
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX processing";
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::CNF_SetBBTxCfg(void)
- {
- E_METAAPP_RESULT_T state = m_pcRF_TXIQRUN_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- AnsiString text;
- short arfcn;
- text = edtTXArfcn->Text; if (!IsValidARFCN(text, (E_BANDSEL) cbxTXBand->ItemIndex, arfcn)) { edtArfcnCheck(edtTXArfcn); return; }
- if (MOD_GMSK_INDEX == cbTXModulation->ItemIndex)
- {
- int pcl;
- APCTxPattern burst_type;
- S_RFTX rf_tx;
- rf_tx.e_bandsel = (E_BANDSEL) cbxTXBand->ItemIndex;
- rf_tx.s_RfNbTxReq.arfcn = arfcn;
- rf_tx.s_RfNbTxReq.bsic = cbxTXTsc->ItemIndex;
- text = edtTXPcl->Text; if (!IsValidPCL(text, rf_tx.e_bandsel, pcl)) { edtPclCheck(edtTXPcl); return; }
- rf_tx.s_RfNbTxReq.power = pcl;
- rf_tx.s_RfNbTxReq.frames = -99;
- text = edtTXAfc->Text; if (!IsValidAFC(text, rf_tx.s_RfNbTxReq.dacValue)) { edtAfcDacCheck(edtTXAfc); return; }
- rf_tx.s_RfNbTxReq.burstTypeNB = Get_GmskBurstType();
- m_pcRF_TX_Obj->ConfirmCallback = ::ConfirmCallback_TX;
- m_pcRF_TX_Obj->REQ_Start(rf_tx);
- }
- else
- {
- int pcl_ms[4];
- CodingScheme cs_ms[4];
- unsigned short pattern_data;
- int ta;
- char TimeSlotMask;
- S_MULTI_SLOT_TX_T multi_slot_tx;
- multi_slot_tx.e_bandsel = (E_BANDSEL) cbxTXBand->ItemIndex;
- text = edtTXAfc->Text; if (!IsValidAFC(text, multi_slot_tx.req.dacValue)) { edtAfcDacCheck(edtTXAfc); return; }
- cs_ms[0] = (CodingScheme) (cbTXCS->ItemIndex + (int) CodingSchemeMCS5);
- cs_ms[1] = (CodingScheme) (cbTXCS->ItemIndex + (int) CodingSchemeMCS5);
- cs_ms[2] = (CodingScheme) (cbTXCS->ItemIndex + (int) CodingSchemeMCS5);
- cs_ms[3] = (CodingScheme) (cbTXCS->ItemIndex + (int) CodingSchemeMCS5);
- text = edtTXPcl->Text; if (!IsValidPCL(text, multi_slot_tx.e_bandsel, pcl_ms[0])) { edtPclCheck(edtTXPcl); return; }
- pcl_ms[1] = pcl_ms[0];
- pcl_ms[2] = pcl_ms[0];
- pcl_ms[3] = pcl_ms[0];
- text = edtTXTA->Text; if (!IsValidTA(text, ta)) { edtTACheck(edtTXTA); return; }
- TimeSlotMask = 0x01;
- multi_slot_tx.req.pattern = Get_EpskBurstType();
- if (NB_TX_PATTERN_WITHOUT_TSC == multi_slot_tx.req.pattern)
- {
- text = edtTXPattern->Text; if( !IsValidMultiSlotTxPattern( text, pattern_data ) ) { edtPatternCheck(edtTXPattern); return; }
- }
- multi_slot_tx.b_MultiSlotTXExSupport = m_bMultiSlotTxExSupport;
- multi_slot_tx.req.arfcn = arfcn;
- multi_slot_tx.req.bsic = cbxTXTsc->ItemIndex;
- multi_slot_tx.req.timeSlotmask = TimeSlotMask;
- for (int i=0; i<4; i++)
- {
- multi_slot_tx.req.powerLev[i] = pcl_ms[i];
- multi_slot_tx.req.cs[i] = cs_ms[i];
- }
- multi_slot_tx.req.ta = ta;
- multi_slot_tx.req.frames = -99;
- multi_slot_tx.req.pattern_data = pattern_data;
- m_pcRF_MULTI_SLOT_TX_Obj->ConfirmCallback = ::ConfirmCallback_MultiSlotTX;
- m_pcRF_MULTI_SLOT_TX_Obj->REQ_Start(multi_slot_tx);
- }
- }
- break;
- case METAAPP_FAIL:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Set BB TX run time setting fail";
- Application->MessageBox( "Execution Failure : Set BB TX run time setting", "FAILURE", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Set BB TX run time setting timeout";
- Application->MessageBox( "Execution Timeout : Set BB TX run time setting", "TIMEOUT", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_STOP:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Set BB TX run time setting stop";
- CurrentPageReset();
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::ConfirmCallback_TX(void)
- {
- E_METAAPP_RESULT_T state = m_pcRF_TXIQRUN_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX successful";
- }
- break;
- case METAAPP_FAIL:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX fail";
- Application->MessageBox("Execution Failure : Burst TX", "FAILURE", MB_OK);
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX timeout";
- Application->MessageBox( "Execution Timout : Burst TX", "TIMEOUT", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_STOP:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX stop";
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::ConfirmCallback_MultiSlotTX(void)
- {
- E_METAAPP_RESULT_T state = m_pcRF_TXIQRUN_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX successful";
- }
- break;
- case METAAPP_FAIL:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX fail";
- Application->MessageBox( "Execution Failure : Burst TX", "FAILURE", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX timeout";
- Application->MessageBox( "Execution Timout : Burst TX", "TIMEOUT", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_STOP:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX stop";
- }
- break;
- }
- }
- //==============================================================================
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtArfcnCheck(TObject *Sender)
- {
- short sdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- {
- " value shall be 0~124 or 975~1023 ",
- " value shall be 512~885 ",
- " value shall be 512~810 ",
- " value shall be 128~251 ",
- };
- text = edit->Text;
- if (!IsValidARFCN(text, m_eCurBand, sdata))
- {
- edit->Text = IntToStr(Default_ARFCN[m_eCurBand]);
- ShowHintLabel(edit, hint[m_eCurBand]);
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtPclCheck(TObject *Sender)
- {
- int i;
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- { " value shall be 4~31 ",
- " value shall be 0~28 ",
- " value shall be 0~15 ",
- };
- text = edit->Text;
- if( !IsValidPCL( text, m_eCurBand, data ) )
- { ShowHintLabel( edit, hint[m_eCurBand] );
- edit->Text = IntToStr( Default_PCL );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtAfcDacCheck(TObject *Sender)
- {
- short sdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~8191 ";
- text = edit->Text;
- if (!IsValidAFC(text, sdata))
- {
- ShowHintLabel(edit, hint);
- edit->Text = IntToStr(Default_AFC);
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::ShowHintLabel( TControl *sender, char* hint )
- {
- TPoint pt0 = this->ClientOrigin;
- TPoint pt1 = sender->ClientOrigin;
- lblHint->Left = (pt1.x-pt0.x);
- lblHint->Top = (pt1.y-pt0.y)+sender->Height+3;
- lblHint->Caption = hint;
- lblHint->Visible = true;
- HintTimer->Enabled = true;
- }
- //--------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::HintTimerTimer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::cbxTXBandChange(
- TObject *Sender)
- {
- TEdit *edit;
- short sdata;
- if (!frmMainSel->cbGSM850->Checked)
- {
- if( BANDSEL_GSM850 == (E_BANDSEL) ((TComboBox*)Sender)->ItemIndex)
- {
- ((TComboBox*)Sender)->ItemIndex = 0;
- Application->MessageBox( "Please check GSM 850 on main menu", "FAILURE", MB_OK );
- }
- }
- m_eCurBand = (E_BANDSEL) ((TComboBox*)Sender)->ItemIndex;
- edit = edtTXArfcn;
- edtArfcnCheck( edit );
- if (!IsValidARFCN(edit->Text, m_eCurBand, sdata))
- {
- edit->Text = IntToStr(Default_ARFCN[m_eCurBand]);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtBBTXCommonModeVoltageCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -4 ~ 3 "
- };
- text = edit->Text;
- if( !IsValidBBTXCommonModeVoltage( text, data ) )
- {
- edit->Text = IntToStr( Default_BBTXCommonModeVoltage );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtBBTXGainCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -4 ~ 3 "
- };
- text = edit->Text;
- if( !IsValidBBTXGain( text, data ) )
- {
- edit->Text = IntToStr( Default_BBTXGain );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtTXBBTXCalrcselCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -4 ~ 3 "
- };
- text = edit->Text;
- if( !IsValidBBTXCalrcsel( text, data ) )
- {
- edit->Text = IntToStr( Default_BBTXCalrcsel );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtAPCBatLowVoltageCheck(
- TObject *Sender)
- {
- double d_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be 0 ~ 10 "
- };
- text = edit->Text;
- if( !IsValidAPCBatLowVoltage( text, d_data ) )
- {
- edit->Text = IntToStr( Default_APCBatLowVoltage );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtAPCBatHighVoltageCheck(
- TObject *Sender)
- {
- double d_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be 0 ~ 10 "
- };
- text = edit->Text;
- if( !IsValidAPCBatHighVoltage( text, d_data ) )
- {
- edit->Text = IntToStr( Default_APCBatHighVoltage );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtAPCBatLowTemperatureCheck(
- TObject *Sender)
- {
- double d_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -50 ~ 100 "
- };
- text = edit->Text;
- if( !IsValidAPCBatLowTemperature( text, d_data ) )
- {
- edit->Text = IntToStr( Default_APCBatLowTemperature );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtAPCBatHighTemperatureCheck(
- TObject *Sender)
- {
- double d_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " value shall be -50 ~ 100 "
- };
- text = edit->Text;
- if( !IsValidAPCBatHighTemperature( text, d_data ) )
- {
- edit->Text = IntToStr( Default_APCBatHighTemperature );
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtTrimIQCheck(TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be -8~7 ";
- text = edit->Text;
- if( !IsValidTrimIQ( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = Default_TrimIQ;
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtOffsetIQCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[2][128] = {" value shall be -32~31 ", " value shall be -64~63 "};
- text = edit->Text;
- if (!IsValidOffsetIQ(m_eBbTxCfgVer, text, data))
- {
- if (m_eBbTxCfgVer < BBTXCFG_VER4)
- {
- ShowHintLabel(edit, hint[0]);
- }
- else
- {
- ShowHintLabel(edit, hint[1]);
- }
- edit->Text = Default_OffsetIQ;
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtBBTXCalbiasCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[2][256] = {" value shall be -16~15 ", " value shall be -8~7 "};
- text = edit->Text;
- if( !IsValidTxCalbias(m_eBbTxCfgVer, text, data))
- {
- if (BBTXCFG_VER2 == m_eBbTxCfgVer)
- {
- ShowHintLabel(edit, hint[0]);
- }
- else
- {
- ShowHintLabel(edit, hint[1]);
- }
- edit->Text = Default_TxCalbias;
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtBBTXIQSwapCheck(
- TObject *Sender)
- {
- char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~1 ";
- text = edit->Text;
- if( !IsValidTxIQSwap( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = Default_TxIQSwap;
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::btnLoadFromRegClick(
- TObject *Sender)
- {
- CurrentPageLock();
- m_pcRF_TXIQRUN_Obj->ConfirmCallback = ::ConfirmCallback_GetBBTxCfg;
- m_pcRF_TXIQRUN_Obj->REQ_GetBBTxCfg_Start(m_eBbTxCfgVer);
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::ConfirmCallback_GetBBTxCfg( void )
- {
- E_METAAPP_RESULT_T state = m_pcRF_TXIQRUN_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- RfBBTXCfg4* p_bbtxcfg = m_pcRF_TXIQRUN_Obj->Get_BbTxCfg();
- m_sBbTxCfg = *p_bbtxcfg;
- ReDrawFields();
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Get BB TX run time setting successfully";
- }
- break;
- case METAAPP_FAIL:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Get BB TX run time setting fail";
- Application->MessageBox( "Execution Failure : Get BB TX run time setting", "FAILURE", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Get BB TX run time setting timeout";
- Application->MessageBox( "Execution Timeout : Get BB TX run time setting", "TIMEOUT", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_STOP:
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Get BB TX run time setting stop";
- }
- break;
- }
- CurrentPageReset();
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::btnLoadFromFileClick(
- TObject *Sender)
- {
- char str[512];
- bool ok;
- float fdata;
- ok = OpenDialog->Execute();
- if (!ok)
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Load BB TX run time setting from file fail";
- Application->MessageBox("Execution Failure : Load BB TX run time setting from file", "FAILURE", MB_OK);
- return;
- }
- strcpy(str, OpenDialog->FileName.c_str());
- ok = m_pcRF_TXIQRUN_Obj->REQ_Read_From_File(str, m_eBbTxCfgVer);
- if (ok)
- {
- RfBBTXCfg4* p_bbtxcfg = m_pcRF_TXIQRUN_Obj->Get_BbTxCfg();
- m_sBbTxCfg = *p_bbtxcfg;
- ReDrawFields();
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Load BB TX run time setting from file successfully";
- }
- else
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Load BB TX run time setting from file fail";
- Application->MessageBox("Execution Failure : Load BB TX run time setting from file", "FAILURE", MB_OK);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::btnSaveToFileClick(
- TObject *Sender)
- {
- char str[512];
- bool ok;
- if (!CheckBbTxCfgFields())
- {
- return;
- }
- ok = SaveDialog->Execute();
- if( !ok )
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Save BB TX run time setting to file fail";
- Application->MessageBox( "Execution Failure : Save BB TX run time setting to file", "FAILURE", MB_OK );
- return;
- }
- strcpy(str, SaveDialog->FileName.c_str());
- m_pcRF_TXIQRUN_Obj->Set_BbTxCfg(m_sBbTxCfg);
- ok = m_pcRF_TXIQRUN_Obj->REQ_Write_To_File(str, m_eBbTxCfgVer);
- if (!ok)
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Save BB TX run time setting to file fail";
- Application->MessageBox( "Execution Failure : Save BB TX run time setting to file", "FAILURE", MB_OK );
- }
- else
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString) " Save BB TX run time setting to file successfully";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::btnTXStopClick(TObject *Sender)
- {
- if( btnTXStart->Tag==1 )
- {
- sbTXIQ->Panels->Items[0]->Text = (AnsiString)" Burst TX stop";
- //m_pcRF_TXIQRUN_Obj->REQ_Stop();
- //m_cRF_MSTXRUN_Obj.REQ_Stop();
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::cbTXModulationChange(
- TObject *Sender)
- {
- if( cbTXModulation->ItemIndex == MOD_GMSK_INDEX )
- {
- Display_TxGmskUi();
- }
- else
- {
- Display_TxEpskUi();
- }
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::Display_TxGmskUi( void )
- {
- lblTXCS->Visible = false;
- cbTXCS->Visible = false;
- lblTXTA->Visible = false;
- edtTXTA->Visible = false;
- Display_TXGmskBurstType();
-
- m_sFinalMSCAP = frmMainSel->Get_FinalMSCap( );
- Display_TxCS( m_sFinalMSCAP.capability, GMSK );
- }
- //---------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::Display_TxEpskUi( void )
- {
- lblTXCS->Visible = true;
- cbTXCS->Visible = true;
- lblTXTA->Visible = true;
- edtTXTA->Visible = true;
- Display_TXEpskBurstType();
-
- m_sFinalMSCAP = frmMainSel->Get_FinalMSCap( );
- Display_TxCS( m_sFinalMSCAP.capability, EPSK );
- }
- //--------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::Display_TxCS( RfMsCapabilityBits capability, E_MODULATION modulation )
- {
- AnsiString CS_GPRS[] =
- {
- "CS1",
- "CS2",
- "CS3",
- "CS4",
- "PRACH8",
- "PRACH11"
- };
- AnsiString CS_EGPRS_GMSK[] =
- {
- "CS1",
- "CS2",
- "CS3",
- "CS4",
- "PRACH8",
- "PRACH11",
- "MCS1",
- "MCS2",
- "MCS3",
- "MCS4"
- };
- AnsiString CS_EGPRS_EPSK[] =
- {
- "MCS5",
- "MCS6",
- "MCS7",
- "MCS8",
- "MCS9"
- };
- int i;
- cbTXCS->Clear();
- if( GMSK == modulation )
- {
- if( capability.EDGE_RX || capability.EDGE_8PSK_TX )
- {
- for( i=0; i<sizeof(CS_EGPRS_GMSK)/sizeof(AnsiString); i++ )
- {
- cbTXCS->Items->Add(CS_EGPRS_GMSK[i]);
- }
- }
- else if( capability.GPRS )
- {
- for( i=0; i<sizeof(CS_GPRS)/sizeof(AnsiString); i++ )
- {
- cbTXCS->Items->Add(CS_GPRS[i]);
- }
- }
- }
- else // EPSK
- {
- if( capability.EDGE_8PSK_TX )
- {
- for( i=0; i<sizeof(CS_EGPRS_EPSK)/sizeof(AnsiString); i++ )
- {
- cbTXCS->Items->Add(CS_EGPRS_EPSK[i]);
- }
- }
- }
- cbTXCS->ItemIndex = 0;
- }
- //--------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::Display_TXGmskBurstType( void )
- {
- int i;
- AnsiString BT_GMSK[] =
- {
- "NB (TSC)",
- "AB",
- "All 1"
- };
- cbTXBurstType->Items->Clear();
- for( i=0; i<sizeof(BT_GMSK)/sizeof(BT_GMSK[0]); i++)
- {
- cbTXBurstType->Items->Add(BT_GMSK[i]);
- }
- cbTXBurstType->ItemIndex = 0;
- }
- //--------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::Display_TXEpskBurstType( void )
- {
- if( m_sFinalMSCAP.capability.EDGE_8PSK_TX )
- {
- AnsiString BT_EPSK[] =
- {
- "NB (TSC)",
- "All 0",
- "All 1",
- "Pattern",
- "Fixed (TSC)",
- "Fixed All 0 (TSC)",
- "Fixed Alter Bits (TSC)"
- };
- cbTXBurstType->Items->Clear();
- for(int i=0; i<sizeof(BT_EPSK)/sizeof(BT_EPSK[0]); i++)
- {
- cbTXBurstType->Items->Add(BT_EPSK[i]);
- }
- cbTXBurstType->ItemIndex = 0;
- lblTXBurstType->Visible = true;
- cbTXBurstType->Visible = true;
- }
- else
- {
- lblTXBurstType->Visible = false;
- cbTXBurstType->Visible = false;
- }
- }
- //--------------------------------------------------------------------------
- APCTxPattern TfrmTXIQBBTXRunTimeSetting::Get_EpskBurstType(void)
- {
- APCTxPattern e_bt;
- if (cbTXBurstType->Text.AnsiCompareIC("All 0") == 0)
- {
- e_bt = NB_TX_ALL_ZEROS_WITHOUT_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("All 1") == 0)
- {
- e_bt = NB_TX_ALL_ONES_WITHOUT_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("Pattern") == 0)
- {
- e_bt = NB_TX_PATTERN_WITHOUT_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("Fixed (TSC)") == 0)
- {
- e_bt = NB_TX_FIXED_RANDOM_WITH_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("Fixed All 0 (TSC)") == 0)
- {
- e_bt = NB_TX_FIXED_ALL_ZEROS_WITH_TSC;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("Fixed Alter Bits (TSC)") == 0)
- {
- e_bt = NB_TX_FIXED_ALTER_BITS_WITH_TSC;
- }
- else
- {
- e_bt = NB_TX_RANDOM_WITH_TSC;
- }
- return e_bt;
- }
- //--------------------------------------------------------------------------
- APCTxPattern TfrmTXIQBBTXRunTimeSetting::Get_GmskBurstType(void)
- {
- APCTxPattern e_bt;
- if (cbTXBurstType->Text.AnsiCompareIC("AB") == 0)
- {
- e_bt = AB_TX_RANDOM_WITH_SYNC_SEQ;
- }
- else if (cbTXBurstType->Text.AnsiCompareIC("All 1") == 0)
- {
- e_bt = NB_TX_ALL_ONES_WITHOUT_TSC;
- }
- else
- {
- e_bt = NB_TX_RANDOM_WITH_TSC;
- }
- return e_bt;
- }
- //--------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtPatternCheck(
- TObject *Sender)
- {
- int i;
- unsigned short data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[256] =
- { " binary format and length<=16 "
- };
- text = edit->Text;
- if( !IsValidMultiSlotTxPattern( text, data ) )
- { ShowHintLabel( edit, hint);
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::cbTXBurstTypeChange(
- TObject *Sender)
- {
- if( cbTXBurstType->Text.AnsiCompareIC("Pattern") == 0 )
- {
- lblTXPattern->Visible = true;
- edtTXPattern->Visible = true;
- }
- else
- {
- lblTXPattern->Visible = false;
- edtTXPattern->Visible = false;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::FormCreate(TObject *Sender)
- {
- WindowProc = SubClassWndProc;
- m_bInit = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtTACheck(TObject *Sender)
- {
- int data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~63 ";
- text = edit->Text;
- if( !IsValidTA( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->Text = Default_TA;
- edit->SetFocus();
- return;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TfrmTXIQBBTXRunTimeSetting::edtTXBBTXPhaseselCheck(
- TObject *Sender)
- {
- signed char data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[2][256] =
- {
- " value shall be -3 ~ 3 ",
- " value shall be -5 ~ 5 "
- };
- text = edit->Text;
- if (!IsValidBBTXPhasesel(m_eBbTxCfgVer, text, data))
- {
- if (m_eBbTxCfgVer <= BBTXCFG_VER4)
- {
- ShowHintLabel(edit, hint[0]);
- }
- else
- {
- ShowHintLabel(edit, hint[1]);
- }
- edit->SetFocus();
- return;
- }
- }
- //============================================================================
- /////////////////////////// export information //////////////////////////////
- //============================================================================
- void TfrmTXIQBBTXRunTimeSetting::Set_RF_TX_Obj(CRFTX* rf_tx_obj)
- { m_pcRF_TX_Obj = rf_tx_obj;
- }
- //----------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::Set_RF_TXIQRUN_Obj(CRFTXIQRUN* rf_txiqrun_obj)
- {
- m_pcRF_TXIQRUN_Obj = rf_txiqrun_obj;
- }
- //----------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::Set_RF_MULTI_SLOT_TX_Obj(CRFMULTISLOTTX *rf_multi_slot_tx_obj)
- {
- m_pcRF_MULTI_SLOT_TX_Obj = rf_multi_slot_tx_obj;
- }
- //----------------------------------------------------------------------------
- void TfrmTXIQBBTXRunTimeSetting::Set_RF_STOP_Obj(CRFSTOP* rf_stop_obj)
- { m_pcRF_STOP_Obj = rf_stop_obj;
- }