form_RF8PskApcProfile.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:82k
源码类别:
MTK
开发平台:
C++ Builder
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * form_RF8PSKApcProfile.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * RF 8PSK APC profile 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
- // form
- #ifndef _FORM_RF8PSKAPCPROFILE_H_
- #include "form_RF8PskApcProfile.h"
- #endif
- #ifndef _FORM_RFTOOL_H_
- #include "form_rftool.h"
- #endif
- #ifndef _FORM_MAIN_H_
- #include "form_main.h"
- #endif
- #ifndef _MAN_FDM_H_
- #include "man_fdm.h"
- #endif
- #ifndef _MISC_H_
- #include "misc.h"
- #endif
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- Tfrm8PskApcProfile *frm8PskApcProfile;
- extern bool g_bHideEnable;
- //===========================================================================
- //static void ConfirmCallback_TX( void )
- //{ frm8PskApcProfile->ConfirmCallback_TX();
- //}
- //---------------------------------------------------------------------------
- static void CNF_ReadApcFromNVRAM( void )
- { frm8PskApcProfile->UploadApcFromFlashDone();
- }
- //---------------------------------------------------------------------------
- static void CNF_ReadB5PFromNVRAM( void )
- { frm8PskApcProfile->UploadB5PFromFlashDone();
- }
- //---------------------------------------------------------------------------
- static void ConfirmCallback_MultiSlotTX( void )
- {
- frm8PskApcProfile->ConfirmCallback_MultiSlotTX();
- }
- //---------------------------------------------------------------------------
- static void CNF_WriteApcToNVRAM( void )
- { frm8PskApcProfile->DownloadApcToFlashDone();
- }
- //---------------------------------------------------------------------------
- static void CNF_WriteB5PToNVRAM( void )
- { frm8PskApcProfile->DownloadB5PToFlashDone();
- }
- //---------------------------------------------------------------------------
- static void CNF_SetB5PToReg( void )
- { frm8PskApcProfile->CNF_SetB5PToReg();
- }
- //---------------------------------------------------------------------------
- static void CNF_SetW6sImmediateBSI( void )
- { frm8PskApcProfile->CNF_SetW6sImmediateBSI();
- }
- //---------------------------------------------------------------------------
- __fastcall Tfrm8PskApcProfile::Tfrm8PskApcProfile(TComponent* Owner)
- : TForm(Owner)
- {
- int band, i, j;
- for (band=0; band<MAX_SUPPORT_BAND_NUM; band++)
- {
- m_sEpskRamp.s_ramp_table[band].rampData.lowest_power = 0;
- for(i=0; i<16; i++)
- {
- m_sEpskRamp.s_ramp_table[band].rampData.power[i] = 0;
- for (j=0; j<16; j++)
- {
- m_sEpskRamp.s_ramp_table[band].rampData.ramp[i].point[0][j] = 0;
- }
- }
- for (i=0; i<11; i++)
- {
- m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].max_arfcn = -1;
- m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].mid_level = 10;
- m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].hi_weight = 0;
- m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].low_weight = 0;
- }
- }
- // battery compensate
- for (int band=0; band<MAX_SUPPORT_BAND_NUM; band++)
- {
- for (int i=0; i<3; i++)
- {
- for(int j=0; j<3; j++)
- {
- m_sEpskRamp.s_ramp_table[band].rampData.battery_compensate[i][j] = BATTERY_COMPENSATE_SCALE;
- }
- }
- }
- // vbias
- for (int i=0; i<MAX_PA_VBIAS_NUM; i++)
- {
- m_sEpskRamp.s_pa_vbias.data.GSM850_pa_vbias[i].pcl_index = -1;
- m_sEpskRamp.s_pa_vbias.data.GSM900_pa_vbias[i].pcl_index = -1;
- m_sEpskRamp.s_pa_vbias.data.DCS1800_pa_vbias[i].pcl_index = -1;
- m_sEpskRamp.s_pa_vbias.data.PCS1900_pa_vbias[i].pcl_index = -1;
- m_sEpskRamp.s_pa_vbias.data.GSM850_pa_vbias[i].pa_vbias1 = 0;
- m_sEpskRamp.s_pa_vbias.data.GSM900_pa_vbias[i].pa_vbias1 = 0;
- m_sEpskRamp.s_pa_vbias.data.DCS1800_pa_vbias[i].pa_vbias1 = 0;
- m_sEpskRamp.s_pa_vbias.data.PCS1900_pa_vbias[i].pa_vbias1 = 0;
- }
- m_eCurBand = BANDSEL_GSM900;
- CurPCLIndex = 0;
- for (i=0; i<MAX_SUPPORT_BAND_NUM; i++)
- {
- HighApcDcOffset[band] = 0;
- LowApcDcOffset[band] = 0;
- }
- m_sTestArfcn[BANDSEL_GSM900 ] = 0;
- m_sTestArfcn[BANDSEL_DCS1800] = 512;
- m_sTestArfcn[BANDSEL_PCS1900] = 512;
- m_sTestArfcn[BANDSEL_GSM850] = 128;
- ApcLowestPower[BANDSEL_GSM900] = 5;
- ApcLowestPower[BANDSEL_DCS1800] = 0;
- ApcLowestPower[BANDSEL_PCS1900] = 0;
- ApcLowestPower[BANDSEL_GSM850] = 5;
- lastTabIndex = 0; // GSM 900
- // RF_TX_8PSK_Obj = 0;
- RF_APC_8PSK_Obj = 0;
- edtPCLDAC[ 0]=edtPCLDAC00; btnPCL[ 0]=btnPCL00; edtRampUp[ 0]=edtRampUp00; edtRampDn[ 0]=edtRampDn00; edtWtARFCN[ 0]=edtWtARFCN00; edtWtHigh[ 0]=edtWtHigh00; edtWtLow[ 0]=edtWtLow00; edtWtPCL[ 0]=edtWtPCL00;
- edtPCLDAC[ 1]=edtPCLDAC01; btnPCL[ 1]=btnPCL01; edtRampUp[ 1]=edtRampUp01; edtRampDn[ 1]=edtRampDn01; edtWtARFCN[ 1]=edtWtARFCN01; edtWtHigh[ 1]=edtWtHigh01; edtWtLow[ 1]=edtWtLow01; edtWtPCL[ 1]=edtWtPCL01;
- edtPCLDAC[ 2]=edtPCLDAC02; btnPCL[ 2]=btnPCL02; edtRampUp[ 2]=edtRampUp02; edtRampDn[ 2]=edtRampDn02; edtWtARFCN[ 2]=edtWtARFCN02; edtWtHigh[ 2]=edtWtHigh02; edtWtLow[ 2]=edtWtLow02; edtWtPCL[ 2]=edtWtPCL02;
- edtPCLDAC[ 3]=edtPCLDAC03; btnPCL[ 3]=btnPCL03; edtRampUp[ 3]=edtRampUp03; edtRampDn[ 3]=edtRampDn03; edtWtARFCN[ 3]=edtWtARFCN03; edtWtHigh[ 3]=edtWtHigh03; edtWtLow[ 3]=edtWtLow03; edtWtPCL[ 3]=edtWtPCL03;
- edtPCLDAC[ 4]=edtPCLDAC04; btnPCL[ 4]=btnPCL04; edtRampUp[ 4]=edtRampUp04; edtRampDn[ 4]=edtRampDn04; edtWtARFCN[ 4]=edtWtARFCN04; edtWtHigh[ 4]=edtWtHigh04; edtWtLow[ 4]=edtWtLow04; edtWtPCL[ 4]=edtWtPCL04;
- edtPCLDAC[ 5]=edtPCLDAC05; btnPCL[ 5]=btnPCL05; edtRampUp[ 5]=edtRampUp05; edtRampDn[ 5]=edtRampDn05; edtWtARFCN[ 5]=edtWtARFCN05; edtWtHigh[ 5]=edtWtHigh05; edtWtLow[ 5]=edtWtLow05; edtWtPCL[ 5]=edtWtPCL05;
- edtPCLDAC[ 6]=edtPCLDAC06; btnPCL[ 6]=btnPCL06; edtRampUp[ 6]=edtRampUp06; edtRampDn[ 6]=edtRampDn06; edtWtARFCN[ 6]=edtWtARFCN06; edtWtHigh[ 6]=edtWtHigh06; edtWtLow[ 6]=edtWtLow06; edtWtPCL[ 6]=edtWtPCL06;
- edtPCLDAC[ 7]=edtPCLDAC07; btnPCL[ 7]=btnPCL07; edtRampUp[ 7]=edtRampUp07; edtRampDn[ 7]=edtRampDn07; edtWtARFCN[ 7]=edtWtARFCN07; edtWtHigh[ 7]=edtWtHigh07; edtWtLow[ 7]=edtWtLow07; edtWtPCL[ 7]=edtWtPCL07;
- edtPCLDAC[ 8]=edtPCLDAC08; btnPCL[ 8]=btnPCL08; edtRampUp[ 8]=edtRampUp08; edtRampDn[ 8]=edtRampDn08; edtWtARFCN[ 8]=edtWtARFCN08; edtWtHigh[ 8]=edtWtHigh08; edtWtLow[ 8]=edtWtLow08; edtWtPCL[ 8]=edtWtPCL08;
- edtPCLDAC[ 9]=edtPCLDAC09; btnPCL[ 9]=btnPCL09; edtRampUp[ 9]=edtRampUp09; edtRampDn[ 9]=edtRampDn09; edtWtARFCN[ 9]=edtWtARFCN09; edtWtHigh[ 9]=edtWtHigh09; edtWtLow[ 9]=edtWtLow09; edtWtPCL[ 9]=edtWtPCL09;
- edtPCLDAC[10]=edtPCLDAC10; btnPCL[10]=btnPCL10; edtRampUp[10]=edtRampUp10; edtRampDn[10]=edtRampDn10; edtWtARFCN[10]=edtWtARFCN10; edtWtHigh[10]=edtWtHigh10; edtWtLow[10]=edtWtLow10; edtWtPCL[10]=edtWtPCL10;
- edtPCLDAC[11]=edtPCLDAC11; btnPCL[11]=btnPCL11; edtRampUp[11]=edtRampUp11; edtRampDn[11]=edtRampDn11;
- edtPCLDAC[12]=edtPCLDAC12; btnPCL[12]=btnPCL12; edtRampUp[12]=edtRampUp12; edtRampDn[12]=edtRampDn12;
- edtPCLDAC[13]=edtPCLDAC13; btnPCL[13]=btnPCL13; edtRampUp[13]=edtRampUp13; edtRampDn[13]=edtRampDn13;
- edtPCLDAC[14]=edtPCLDAC14; btnPCL[14]=btnPCL14; edtRampUp[14]=edtRampUp14; edtRampDn[14]=edtRampDn14;
- edtPCLDAC[15]=edtPCLDAC15; btnPCL[15]=btnPCL15; edtRampUp[15]=edtRampUp15; edtRampDn[15]=edtRampDn15;
- // PA Vbias
- m_edtVbias[0] = m_edtVbias0;
- m_edtVbias[1] = m_edtVbias1;
- m_edtVbias[2] = m_edtVbias2;
- m_edtVbias[3] = m_edtVbias3;
- m_edtVbias[4] = m_edtVbias4;
- m_edtVbias[5] = m_edtVbias5;
- m_edtVbias[6] = m_edtVbias6;
- m_edtVbias[7] = m_edtVbias7;
- m_edtVbiasPCL[0] = m_edtVbiasPCL0;
- m_edtVbiasPCL[1] = m_edtVbiasPCL1;
- m_edtVbiasPCL[2] = m_edtVbiasPCL2;
- m_edtVbiasPCL[3] = m_edtVbiasPCL3;
- m_edtVbiasPCL[4] = m_edtVbiasPCL4;
- m_edtVbiasPCL[5] = m_edtVbiasPCL5;
- m_edtVbiasPCL[6] = m_edtVbiasPCL6;
- m_edtVbiasPCL[7] = m_edtVbiasPCL7;
- // battery compensate
- edtBatteryCompensateArray[0][0] = edtBatteryCompensate00; edtBatteryCompensateArray[0][1] = edtBatteryCompensate01; edtBatteryCompensateArray[0][2] = edtBatteryCompensate02;
- edtBatteryCompensateArray[1][0] = edtBatteryCompensate10; edtBatteryCompensateArray[1][1] = edtBatteryCompensate11; edtBatteryCompensateArray[1][2] = edtBatteryCompensate12;
- edtBatteryCompensateArray[2][0] = edtBatteryCompensate20; edtBatteryCompensateArray[2][1] = edtBatteryCompensate21; edtBatteryCompensateArray[2][2] = edtBatteryCompensate22;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::FormClose(TObject *Sender,
- TCloseAction &Action)
- {
- if( !m_bInit )
- {
- write_APC_files_setup( "MF_setup.txt", Application->ExeName );
- }
- if( btnTXStart->Tag == 1)
- {
- btnTXStopClick(this);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::FormCreate(TObject *Sender)
- {
- isSetCal3ModeTrigger = false;
- m_uiFinalRFID = 0;
- m_bInit = true;
- m_bFirstFormShow = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::FormHide(TObject *Sender)
- {
- if(btnTXStart->Tag==1)
- { btnTXStopClick(this);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::FormShow(TObject *Sender)
- {
- if (m_bFirstFormShow)
- {
- read_APC_files_setup( "MF_setup.txt", Application->ExeName );
- ReDrawFields(DRAW_PCL |
- DRAW_VBIAS |
- DRAW_AD6546 |
- DRAW_RAMP |
- DRAW_WEIGHT |
- DRAW_BATTERY_COMPENSATE |
- DRAW_TX_AFC_OFFSET |
- DRAW_WORD3 |
- DRAW_BV |
- DRAW_INTERSLOT_LOWEST_DAC
- );
- m_bFirstFormShow = false;
- }
- ApplyHideProperty();
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::FormActivate(TObject *Sender)
- {
- if (m_bInit)
- {
- m_bInit = false;
- m_uiFinalRFID = frmMainSel->Get_FinalRFID();
- if ((RF_ID_MT6140A == m_uiFinalRFID) ||
- (RF_ID_MT6140B == m_uiFinalRFID) ||
- (RF_ID_MT6140C == m_uiFinalRFID) ||
- (RF_ID_MT6140D == m_uiFinalRFID) ||
- (RF_ID_AERO2E == m_uiFinalRFID)
- )
- {
- m_pnlPAVbiasTItle->Visible = true;
- m_pnlPAVbias->Visible = true;
- }
- else
- {
- m_pnlPAVbiasTItle->Visible = false;
- m_pnlPAVbias->Visible = false;
- }
- if (RF_ID_AERO2E == m_uiFinalRFID)
- {
- m_pnlPCLDacTItle->Caption = "DVGA Code";
- lblPclDac->Caption = "DVGA Code";
- }
- else
- {
- m_pnlPCLDacTItle->Caption = "PCL DAC";
- lblPclDac->Caption = "PCL DAC";
- }
- if (RF_ID_AD6546 == m_uiFinalRFID)
- {
- m_pnlAD6546TItle->Visible = true;
- m_pnlAD6546->Visible = true;
- }
- else
- {
- m_pnlAD6546TItle->Visible = false;
- m_pnlAD6546->Visible = false;
- }
- m_bMultiSlotTxExSupport = frmRFTool->Get_MultiSlotTxExSupport();
- }
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Init(void)
- {
- m_bInit = true;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::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 Tfrm8PskApcProfile::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 __fastcall Tfrm8PskApcProfile::edtTestArfcnCheck(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;
- }
- m_sTestArfcn[m_eCurBand] = sdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::btnTXStartClick(TObject *Sender)
- {
- if(btnTXStart->Tag==0)
- {
- frmRFTool->Force_RF_Stop();
- char TimeSlotMask;
- int TA;
- CodingScheme CS[4];
- int PCL[4];
- APCTxPattern Pattern;
- AnsiString text;
- int Tsc;
- short sAfcDac;
- // int BurstType;
- // unsigned short Pattern_data;
- btnTXStart->Enabled = false;
- btnTXStart->Tag = 1;
- Tsc = cbTSC->ItemIndex;
- CS[0] = (CodingScheme) cbCS->ItemIndex + CodingSchemeMCS5;
- CS[1] = (CodingScheme) cbCS->ItemIndex + CodingSchemeMCS5;
- CS[2] = (CodingScheme) cbCS->ItemIndex + CodingSchemeMCS5;
- CS[3] = (CodingScheme) cbCS->ItemIndex + CodingSchemeMCS5;
- PCL[0] = PCL_RANGE[m_eCurBand][CurPCLIndex];
- PCL[1] = PCL_RANGE[m_eCurBand][CurPCLIndex];
- PCL[2] = PCL_RANGE[m_eCurBand][CurPCLIndex];
- PCL[3] = PCL_RANGE[m_eCurBand][CurPCLIndex];
- text = edtAFC->Text; if (!IsValidAFC(text, sAfcDac)) { edtAfcDacCheck(edtAFC); return; }
- TimeSlotMask = 0x01;
- text = edtTA->Text; if( !IsValidTA( text, TA ) ) { edtTACheck(edtTA); return; }
- Pattern = NB_TX_RANDOM_WITH_TSC;
- S_MULTI_SLOT_TX_T multi_slot_tx;
- multi_slot_tx.b_MultiSlotTXExSupport = m_bMultiSlotTxExSupport;
- multi_slot_tx.e_bandsel = m_eCurBand;
- multi_slot_tx.req.arfcn = m_sTestArfcn[m_eCurBand];
- multi_slot_tx.req.bsic = Tsc;
- multi_slot_tx.req.timeSlotmask = TimeSlotMask;
- 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 = TA;
- multi_slot_tx.req.frames = -99;
- multi_slot_tx.req.dacValue = sAfcDac;
- multi_slot_tx.req.pattern = Pattern;
- 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);
- CurrentPageLock();
- frmRFTool->CurrentPageLock();
- frmRFTool->btnTXStart->Enabled = false;
- frmRFTool->pctlToolSel->Enabled = false;
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX progressing";
- }
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::ConfirmCallback_MultiSlotTX( void )
- {
- E_METAAPP_RESULT_T state = RF_MULTI_SLOT_TX_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Multi slot TX progressing";
- }
- break;
- case METAAPP_FAIL:
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Multi slot TX fail";
- Application->MessageBox("Execution Failure : Multi slot TX", "FAILURE", MB_OK);
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Multi slot TX timeout";
- Application->MessageBox( "Execution Timeout : Multi slot TX", "TIMEOUT", MB_OK );
- frmRFTool->Force_RF_Stop();
- CurrentPageReset();
- }
- break;
- case METAAPP_STOP:
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Multi slot TX stop";
- }
- break;
- default:
- {
- }
- break;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::btnTXStopClick(TObject *Sender)
- {
- if( btnTXStart->Tag == 1 )
- {
- frmRFTool->Force_RF_Stop();
- // btnTXStart->Kind = bkRetry;
- // btnTXStart->Caption = "Start";
- btnTXStart->Tag = 0;
- frmRFTool->pctlToolSel->Enabled = true;
- frmRFTool->btnMultiSlotTxStart->Enabled = true;
- CurrentPageReset();
- frmRFTool->CurrentPageReset();
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString)" Burst TX stop";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtPCLDACCheck(TObject *Sender)
- {
- unsigned short usdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~1023 ";
- text = edit->Text;
- if (!IsValidPCLDac(text, usdata))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.power[edit->Tag] = usdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::m_edtVbiasPCLCheck(TObject *Sender)
- {
- 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 ",
- " value shall be 4~31 ",
- };
- text = edit->Text;
- if (!IsValidPCL(text, m_eCurBand, data))
- {
- ShowHintLabel(edit, hint[m_eCurBand]);
- edit->SetFocus();
- return;
- }
- pa_vbias* p_pa_vibas[] =
- {
- m_sEpskRamp.s_pa_vbias.data.GSM900_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.DCS1800_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.PCS1900_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.GSM850_pa_vbias
- };
- p_pa_vibas[m_eCurBand][edit->Tag].pcl_index = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtVbiasCheck(TObject *Sender)
- {
- unsigned char ucdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] = {" value shall be 0~7 ", " value shall be 0~31 "};
- text = edit->Text;
- if (!IsValidVbias(m_uiFinalRFID, text, ucdata))
- {
- if (RF_ID_AERO2E != m_uiFinalRFID)
- {
- ShowHintLabel(edit, hint[0]);
- }
- else
- {
- ShowHintLabel(edit, hint[1]);
- }
- edit->SetFocus();
- return;
- }
- pa_vbias* p_pa_vibas[] =
- {
- m_sEpskRamp.s_pa_vbias.data.GSM900_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.DCS1800_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.PCS1900_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.GSM850_pa_vbias
- };
- p_pa_vibas[m_eCurBand][edit->Tag].pa_vbias1 = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::m_edtSlopeSkewCheck(TObject *Sender)
- {
- unsigned char ucdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = {" value shall be 0~255 "};
- text = edit->Text;
- if (!IsValidRefDetSlopeSkew(text, ucdata))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ad6546.REFDET_SLOPE_SKEW = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::m_edtAmFbDacCheck(TObject *Sender)
- {
- unsigned char ucdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = {" value shall be 0~255 "};
- text = edit->Text;
- if (!IsValidAmFbDac(text, ucdata))
- {
- ShowHintLabel(edit, hint);
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ad6546.AM_FB_DAC = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::OnBtnPclClick(TObject *Sender)
- {
- if(btnTXStart->Tag==1)
- { btnTXStartClick(this);
- }
- CurPCLIndex = (*(TComponent*)Sender).Tag;
- ReDrawFields( DRAW_RAMP );
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::btnLeftClick(TObject *Sender)
- {
- TButton *button = (TButton*)Sender;
- int up_down = button->Tag;
- int i;
- for(i=0; i<15; i++)
- {
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[up_down][i] =
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[up_down][i+1];
- }
- ReDrawFields( DRAW_RAMP );
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::btnUpRightClick(TObject *Sender)
- {
- TButton *button = (TButton*)Sender;
- int up_down = button->Tag;
- int i;
- for(i=15; i>=1; i--)
- {
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[up_down][i] =
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[up_down][i-1];
- }
- ReDrawFields( DRAW_RAMP );
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::btnDnLeftClick(TObject *Sender)
- {
- TButton *button = (TButton*)Sender;
- int up_down = button->Tag;
- int i;
- for(i=0; i<15; i++)
- {
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[up_down][i] =
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[up_down][i+1];
- }
- ReDrawFields( DRAW_RAMP );
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::btnDnRightClick(TObject *Sender)
- {
- TButton *button = (TButton*)Sender;
- int up_down = button->Tag;
- int i;
- for(i=15; i>=1; i--)
- {
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[up_down][i] =
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[up_down][i-1];
- }
- ReDrawFields( DRAW_RAMP );
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtRampUpCheck(TObject *Sender)
- {
- unsigned char ucdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~255 ";
- text = edit->Text;
- if( !IsValidRamp( text, ucdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[0][edit->Tag] = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtRampDnCheck(TObject *Sender)
- {
- unsigned char ucdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0~255 ";
- text = edit->Text;
- if( !IsValidRamp( text, ucdata ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.ramp[CurPCLIndex].point[1][edit->Tag] = ucdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtWtARFCNCheck(TObject *Sender)
- {
- short sdata;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[][256] =
- { " value shall be 0~124 or 975~1023 or -1 ",
- " value shall be 512~885 or -1 ",
- " value shall be 512~810 or -1 ",
- " value shall be 128~251 or -1 ",
- };
- text = edit->Text;
- if (!IsValidARFCN2(text, m_eCurBand, sdata))
- {
- ShowHintLabel(edit, hint[m_eCurBand]);
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.arfcn_weight[edit->Tag].max_arfcn = sdata;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtWtPCLCheck(TObject *Sender)
- {
- 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 ",
- " value shall be 4~31 ",
- };
- text = edit->Text;
- if( !IsValidPCL( text, m_eCurBand, data ) )
- {
- ShowHintLabel( edit, hint[m_eCurBand] );
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.arfcn_weight[edit->Tag].mid_level = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtWtHighCheck(TObject *Sender)
- {
- unsigned short us_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[2][128] = {" value shall be 0.0~4.0 ", " value shall be -4~4 "};
- text = edit->Text;
- if (!IsValidWeight(text, m_uiFinalRFID, us_data))
- {
- if (m_uiFinalRFID != RF_ID_A60111A)
- {
- ShowHintLabel(edit, hint[0]);
- }
- else
- {
- ShowHintLabel(edit, hint[1]);
- }
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.arfcn_weight[edit->Tag].hi_weight = us_data;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtWtLowCheck(TObject *Sender)
- {
- unsigned short us_data;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[2][128] = {" value shall be 0.0~4.0 ", " value shall be -4~4 "};
- text = edit->Text;
- if (!IsValidWeight(text, m_uiFinalRFID, us_data))
- {
- if (m_uiFinalRFID != RF_ID_A60111A)
- {
- ShowHintLabel(edit, hint[0]);
- }
- else
- {
- ShowHintLabel(edit, hint[1]);
- }
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.arfcn_weight[edit->Tag].low_weight = us_data;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtBatteryCompensateCheck(
- TObject *Sender)
- {
- unsigned short data;
- int row, col;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0.1 ~ 1.9 ";
- text = edit->Text;
- if( !IsValidBatteryCompensate( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- row = edit->Tag / 3;
- col = edit->Tag % 3;
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.battery_compensate[row][col] = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtTxAfcOffsetCheck(TObject *Sender)
- {
- short data;
- int row, col;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be -65536 ~ 65535 ";
- text = edit->Text;
- if( !IsValidTxAfcOffset( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_sEpskRamp.s_ramp_table[m_eCurBand].rampData.tx_afc_offset = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtAPCheck(TObject *Sender)
- {
- int data;
- int row, col;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0 ~ 7 ";
- text = edit->Text;
- if( !IsValidBVAP( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- if( lblBVReg->Caption.AnsiCompareIC("W6-4-0") == 0 )
- {
- bvw640.uc_ap = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-5-0") == 0 )
- {
- bvw650.uc_ap = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-6-0") == 0 )
- {
- bvw660.uc_ap = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-7-0") == 0 )
- {
- bvw670.uc_ap = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtASCheck(TObject *Sender)
- {
- int data;
- int row, col;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0 ~ 7 ";
- text = edit->Text;
- if( !IsValidBVAS( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- if( lblBVReg->Caption.AnsiCompareIC("W6-4-0") == 0 )
- {
- bvw640.uc_as = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-5-0") == 0 )
- {
- bvw650.uc_as = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-6-0") == 0 )
- {
- bvw660.uc_as = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-7-0") == 0 )
- {
- bvw670.uc_as = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtAOCheck(TObject *Sender)
- {
- int data;
- int row, col;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0 ~ 63 ";
- text = edit->Text;
- if( !IsValidBVAO( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- if( lblBVReg->Caption.AnsiCompareIC("W6-4-0") == 0 )
- {
- bvw640.uc_ao = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-5-0") == 0 )
- {
- bvw650.uc_ao = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-6-0") == 0 )
- {
- bvw660.uc_ao = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-7-0") == 0 )
- {
- bvw670.uc_ao = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtBDCheck(TObject *Sender)
- {
- int data;
- int row, col;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0 ~ 31 ";
- text = edit->Text;
- if( !IsValidBVBD( text, data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- if( lblBVReg->Caption.AnsiCompareIC("W6-4-0") == 0 )
- {
- bvw640.uc_bd = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-5-0") == 0 )
- {
- bvw650.uc_bd = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-6-0") == 0 )
- {
- bvw660.uc_bd = data;
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-7-0") == 0 )
- {
- bvw670.uc_bd = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::cbC3ModeEnableClick(TObject *Sender)
- {
- if( cbC3ModeEnable->Checked )
- {
- b5p_coef.tx.c3mode = 1;
- }
- else
- {
- b5p_coef.tx.c3mode = 0;
- }
- ReDrawFields( DRAW_WORD3 );
- ComposeRenesasField();
- isSetCal3ModeTrigger = false;
- RF_APC_8PSK_Obj->ConfirmCallback = ::CNF_WriteApcToNVRAM;
- RF_APC_8PSK_Obj->Req_SetB5PToReg( b5p_coef );
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtTNCheck(TObject *Sender)
- {
- unsigned char data;
- int row, col;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- text = edit->Text;
- if( cbC3ModeEnable->Checked )
- {
- if( !IsValidC3TN( text, data ) )
- {
- char hint[] = " value shall be 0 ~ 63 ";
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- c3mode.uc_tn = data;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::edtTOCheck(TObject *Sender)
- {
- unsigned char data;
- int row, col;
- char hint[] = " value shall be 0 ~ 15 ";
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- text = edit->Text;
- if( !IsValidC3TO( text, data ) )
- {
- ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- c3mode.uc_to = data;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::UploadFromFlashStart(TObject *Sender)
- {
- if( ! NVRAMMan->Get_IsInit() )
- { frmMainSel->mnuFDMDatabaseClick(Sender);
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialization fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialization fail", "FAILURE", MB_OK );
- return;
- }
- stNVRAMDB->Caption = frmMainSel->Get_NVRAMDBFileName();
- }
- RF_APC_8PSK_Obj->ConfirmCallback = ::CNF_ReadApcFromNVRAM;
- RF_APC_8PSK_Obj->REQ_Read_APC_From_NVRAM_Start(m_uiFinalRFID);
- CurrentPageLock();
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile setting from flash progressing";
- }
- //-----------------------------------------------
- void Tfrm8PskApcProfile::UploadApcFromFlashDone( void )
- {
- E_METAAPP_RESULT_T state = RF_APC_8PSK_Obj->Get_ConfirmState();
- int band;
- int total_band_num;
- if( state==METAAPP_SUCCESS )
- {
- if(frmMainSel->cbGSM850->Checked)
- { total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for (band=0; band<total_band_num; band++)
- {
- m_ucInterslotLowestDAC[band] = RF_APC_8PSK_Obj->Get_InterslotLowestDAC(band);
- }
- S_EPSK_RAMP_T* p_ramp_table = RF_APC_8PSK_Obj->Get_ApcProfile();
- m_sEpskRamp = *p_ramp_table;
- if( m_uiFinalRFID == RF_ID_BRIGHT5P )
- {
- RF_APC_8PSK_Obj->ConfirmCallback = ::CNF_ReadB5PFromNVRAM;
- RF_APC_8PSK_Obj->REQ_Read_B5P_From_NVRAM();
- return;
- }
- else
- {
- ReDrawFields(DRAW_PCL |
- DRAW_VBIAS |
- DRAW_AD6546 |
- DRAW_RAMP |
- DRAW_WEIGHT |
- DRAW_BATTERY_COMPENSATE |
- DRAW_TX_AFC_OFFSET |
- DRAW_WORD3 |
- DRAW_BV |
- DRAW_INTERSLOT_LOWEST_DAC
- );
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile setting from flash successfully";
- }
- }
- else if( state==METAAPP_FAIL )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile setting from flash fail";
- Application->MessageBox( "Execution Failure : Upload APC profile from flash, please check 1.GSM850 support, 2. The version of load and NVRAM database are same. ", "FAILURE", MB_OK );
- }
- else if( state==METAAPP_TIMEOUT )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile setting from flash timeout";
- Application->MessageBox( "Execution Timeout : Upload APC profile from flash", "TIMEOUT", MB_OK );
- }
- else if( state==METAAPP_STOP )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile setting from flash stop";
- }
- CurrentPageReset();
- }
- //-----------------------------------------------
- void Tfrm8PskApcProfile::UploadB5PFromFlashDone( void )
- {
- E_METAAPP_RESULT_T state = RF_APC_8PSK_Obj->Get_ConfirmState();
- int band;
- int total_band_num;
- if( state==METAAPP_SUCCESS )
- {
- if( isDownloadTrigger )
- {
- isDownloadTrigger = false;
- ComposeRenesasField();
- RF_APC_8PSK_Obj->Set_RenesasCoef( b5p_coef );
- RF_APC_8PSK_Obj->ConfirmCallback = ::CNF_WriteB5PToNVRAM;
- RF_APC_8PSK_Obj->REQ_Write_B5P_To_NVRAM();
- return;
- }
- else
- {
- RF_APC_8PSK_Obj->Get_RenesasCoef( b5p_coef );
- DeComposeRenesasField();
- ReDrawFields(DRAW_PCL |
- DRAW_VBIAS |
- DRAW_AD6546 |
- DRAW_RAMP |
- DRAW_WEIGHT |
- DRAW_BATTERY_COMPENSATE |
- DRAW_TX_AFC_OFFSET |
- DRAW_WORD3 |
- DRAW_BV |
- DRAW_INTERSLOT_LOWEST_DAC
- );
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload APC profile, WORD3 and BV setting from flash successfully";
- }
- }
- else if( state==METAAPP_FAIL )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload WORD3 setting from flash fail";
- Application->MessageBox( "Execution Failure : Upload WORD3 setting from flash, please check 1.GSM850 support, 2. The version of load and NVRAM database are same. ", "FAILURE", MB_OK );
- }
- else if( state==METAAPP_TIMEOUT )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload WORD3 setting from flash timeout";
- Application->MessageBox( "Execution Timeout : Upload WORD3 setting from flash", "TIMEOUT", MB_OK );
- }
- else if( state==METAAPP_STOP )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Upload WORD3 setting from flash stop";
- Application->MessageBox( "Execution Timeout : Upload WORD3 setting from flash", "STOP", MB_OK );
- }
- CurrentPageReset();
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void __fastcall Tfrm8PskApcProfile::btnDownloadToFlashClick(
- TObject *Sender)
- {
- int band;
- int total_band_num;
- if( !CheckFields() )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash fail";
- Application->MessageBox( "Execution Failure : Download APC profile to flash", "FAILURE", MB_OK );
- return;
- }
- if( ! NVRAMMan->Get_IsInit())
- { frmMainSel->mnuFDMDatabaseClick(Sender);
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialization fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialization fail", "FAILURE", MB_OK );
- return;
- }
- stNVRAMDB->Caption = frmMainSel->Get_NVRAMDBFileName();
- }
- if(frmMainSel->cbGSM850->Checked)
- { total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for (band=0; band<total_band_num; band++)
- {
- RF_APC_8PSK_Obj->Set_InterslotLowestDAC( band, m_ucInterslotLowestDAC[band] );
- RF_APC_8PSK_Obj->Set_ApcProfile(m_sEpskRamp);
- }
- RF_APC_8PSK_Obj->ConfirmCallback = ::CNF_WriteApcToNVRAM;
- RF_APC_8PSK_Obj->REQ_Write_APC_To_NVRAM_Start(m_uiFinalRFID);
- isDownloadTrigger = true;
- CurrentPageLock();
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash progressing";
- }
- //-----------------------------------------------
- void Tfrm8PskApcProfile::DownloadApcToFlashDone( void )
- {
- E_METAAPP_RESULT_T state = RF_APC_8PSK_Obj->Get_ConfirmState();
- switch (state)
- {
- case METAAPP_SUCCESS:
- {
- if (m_uiFinalRFID == RF_ID_BRIGHT5P)
- {
- if (isDownloadTrigger)
- {
- RF_APC_8PSK_Obj->ConfirmCallback = ::CNF_ReadB5PFromNVRAM;
- RF_APC_8PSK_Obj->REQ_Read_B5P_From_NVRAM();
- return;
- }
- }
- else
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash successfully";
- }
- }
- break;
- case METAAPP_FAIL:
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash fail";
- Application->MessageBox( "Execution Failure : Download APC profile to flash, please check 1.GSM850 support. 2. The version of load and NVRAM database are same. ", "FAILURE", MB_OK );
- }
- break;
- case METAAPP_TIMEOUT:
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash timeout";
- Application->MessageBox( "Execution Timeout : Download APC profile to flash", "TIMEOUT", MB_OK );
- }
- break;
- case METAAPP_STOP:
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile setting to flash stop";
- }
- break;
- case METAAPP_NVRAM_LID_VER_NOT_SUPPORT:
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " NVRAM_EF_L1_EPSK_RAMPTABLE_xxx_LID version is not support, please update META to latest version";
- Application->MessageBox("Execution Warning : NVRAM_EF_L1_EPSK_RAMPTABLE_xxx_LID version is not support, please update META to latest version", "WARNING", MB_OK);
- }
- break;
- default:
- {
- }
- break;
- }
- CurrentPageReset();
- }
- //-----------------------------------------------
- void Tfrm8PskApcProfile::DownloadB5PToFlashDone( void )
- {
- E_METAAPP_RESULT_T state = RF_APC_8PSK_Obj->Get_ConfirmState();
- CurrentPageReset();
- if( state==METAAPP_SUCCESS )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download APC profile, WORD3 and BV setting to flash successfully";
- }
- else if( state==METAAPP_FAIL )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download BV setting to flash fail";
- Application->MessageBox( "Execution Failure : Download BV to flash, please check 1.GSM850 support. 2. The version of load and NVRAM database are same. ", "FAILURE", MB_OK );
- }
- else if( state==METAAPP_TIMEOUT )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download BV setting to flash timeout";
- Application->MessageBox( "Execution Timeout : Download BV to flash", "TIMEOUT", MB_OK );
- }
- else if( state==METAAPP_STOP )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Download BV setting to flash stop";
- // Application->MessageBox( "Execution Stop : Download BV to flash", "STOP", MB_OK );
- }
- }
- void __fastcall Tfrm8PskApcProfile::btnChangeDBClick(TObject *Sender)
- {
- frmMainSel->mnuFDMDatabaseClick(Sender);
- if( ! NVRAMMan->Get_IsInit() )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " NVRAM database file initialization fail";
- Application->MessageBox( "Execution Failure : NVRAM database file initialization fail", "FAILURE", MB_OK );
- return;
- }
- stNVRAMDB->Caption = frmMainSel->Get_NVRAMDBFileName();
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Change NVRAM database file successfully";
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::btnLoadFromFileClick(TObject *Sender)
- {
- char str[512];
- bool ok;
- int band;
- int total_band_num;
- //Get_FinalBandSupport(band_support, BandSupportArray);
- if( frmMainSel->cbGSM850->Checked )
- {
- total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- ok = OpenDialog->Execute();
- if( !ok )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Load APC profile setting from file fail";
- Application->MessageBox( "Execution Failure : Load APC profile from file", "FAILURE", MB_OK );
- return;
- }
- strcpy( str, OpenDialog->FileName.c_str() );
- //ok = RF_APC_8PSK_Obj->REQ_Read_APC_From_File( str );
- // for(band=0; band<MAX_SUPPORT_BAND_NUM; band++)
- for (band=0; band<total_band_num; band++)
- {
- if (RF_APC_8PSK_Obj->ApcSectionExist(str, band))
- {
- ok = RF_APC_8PSK_Obj->REQ_Read_APC_From_File_Single_Band(str, m_uiFinalRFID, band);
- if (!ok)
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Load APC profile setting from file fail";
- Application->MessageBox( "Execution Failure : Load APC profile from file", "FAILURE", MB_OK );
- return;
- }
- m_ucInterslotLowestDAC[band] = RF_APC_8PSK_Obj->Get_InterslotLowestDAC(band);
- }
- }
- S_EPSK_RAMP_T* p_ramp_table = RF_APC_8PSK_Obj->Get_ApcProfile();
- m_sEpskRamp = *p_ramp_table;
- if( m_uiFinalRFID == RF_ID_BRIGHT5P )
- {
- if( RF_APC_8PSK_Obj->RenesasWord3SectionExist(str) )
- {
- ok = RF_APC_8PSK_Obj->REQ_Read_Word3_From_File( str );
- if( !ok )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Load WORD3 setting from file fail";
- Application->MessageBox( "Execution Failure : Load WORD3 from file", "FAILURE", MB_OK );
- return;
- }
- }
- if( RF_APC_8PSK_Obj->RenesasWord6sSectionExist(str) )
- {
- ok = RF_APC_8PSK_Obj->REQ_Read_Word6s_From_File( str );
- if( !ok )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Load BV mode setting from file fail";
- Application->MessageBox( "Execution Failure : Load BV mode from file", "FAILURE", MB_OK );
- return;
- }
- }
- // get C3, BV
- RF_APC_8PSK_Obj->Get_RenesasCoef( b5p_coef );
- DeComposeRenesasField();
- ReDrawFields(DRAW_PCL |
- DRAW_VBIAS |
- DRAW_AD6546 |
- DRAW_RAMP |
- DRAW_WEIGHT |
- DRAW_BATTERY_COMPENSATE |
- DRAW_TX_AFC_OFFSET |
- DRAW_WORD3 |
- DRAW_BV |
- DRAW_INTERSLOT_LOWEST_DAC
- );
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Load APC profile, WORD3 and BV setting from file successfully";
- }
- else
- {
- ReDrawFields(DRAW_PCL |
- DRAW_VBIAS |
- DRAW_AD6546 |
- DRAW_RAMP |
- DRAW_WEIGHT |
- DRAW_BATTERY_COMPENSATE |
- DRAW_TX_AFC_OFFSET |
- DRAW_WORD3 |
- DRAW_BV |
- DRAW_INTERSLOT_LOWEST_DAC
- );
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Load APC profile setting from file successfully";
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::btnSaveToFileClick(TObject *Sender)
- {
- char str[512];
- bool ok;
- int band;
- int total_band_num;
- ok = CheckFields();
- if(!ok)
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save APC profile setting to file fail";
- Application->MessageBox( "Execution Failure : Save APC profile to file", "FAILURE", MB_OK );
- return;
- }
- ok = SaveDialog->Execute();
- if( !ok )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save APC profile setting to file fail";
- Application->MessageBox( "Execution Failure : Save APC profile to file", "FAILURE", MB_OK );
- return;
- }
- strcpy( str, SaveDialog->FileName.c_str() );
- if( frmMainSel->cbGSM850->Checked )
- { total_band_num = 4;
- }
- else
- {
- total_band_num = 3;
- }
- for (band=0; band<total_band_num; band++)
- {
- RF_APC_8PSK_Obj->Set_InterslotLowestDAC(band, m_ucInterslotLowestDAC[band]);
- RF_APC_8PSK_Obj->Set_ApcProfile(m_sEpskRamp);
- ok = RF_APC_8PSK_Obj->REQ_Write_APC_To_File_Single_Band(str, m_uiFinalRFID, band);
- if (!ok )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save APC profile setting to file fail";
- Application->MessageBox( "Execution Failure : Save APC profile to file", "FAILURE", MB_OK );
- return;
- }
- }
- if( m_uiFinalRFID == RF_ID_BRIGHT5P )
- {
- // Renesas
- ComposeRenesasField();
- RF_APC_8PSK_Obj->Set_RenesasCoef( b5p_coef );
- ok = RF_APC_8PSK_Obj->REQ_Write_Word3_To_File( str );
- if( !ok )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save WORD3 setting to file fail";
- Application->MessageBox( "Execution Failure : Save WORD3 setting to file", "FAILURE", MB_OK );
- return;
- }
- ok = RF_APC_8PSK_Obj->REQ_Write_Word6s_To_File( str );
- if( !ok )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save bias Word6s to file fail";
- Application->MessageBox( "Execution Failure : Save bias Word6s to file", "FAILURE", MB_OK );
- return;
- }
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save APC profile, Word3 and Word6s setting to file successfully";
- return;
- }
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString) " Save APC profile setting to file successfully";
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::btnSetCAL3ModeToRegisterClick(
- TObject *Sender)
- {
- bool ok;
- unsigned int CurW6s;
- CurrentPageLock();
- ComposeRenesasField();
- isSetCal3ModeTrigger = true;
- RF_APC_8PSK_Obj->ConfirmCallback = ::CNF_SetB5PToReg;
- RF_APC_8PSK_Obj->Req_SetB5PToReg( b5p_coef );
- }
- //-----------------------------------------------
- void Tfrm8PskApcProfile::CNF_SetB5PToReg( void )
- {
- E_METAAPP_RESULT_T state = RF_APC_8PSK_Obj->Get_ConfirmState();
- unsigned int CurW6s;
- if( state==METAAPP_SUCCESS )
- {
- if( isSetCal3ModeTrigger )
- {
- Get_CurrentWord6s( CurW6s );
- RF_APC_8PSK_Obj->ConfirmCallback = ::CNF_SetW6sImmediateBSI;
- RF_APC_8PSK_Obj->REQ_SetW6sImmediateBSI_Start( CurW6s );
- return;
- }
- }
- else if( state==METAAPP_FAIL )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString)" Set CAL3 mode to register fail";
- Application->MessageBox( "Execution Fail : Set CAL3 mode to register", "FAIL", MB_OK );
- }
- else if( state==METAAPP_TIMEOUT )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString)" Set CAL3 mode to register timeout";
- Application->MessageBox( "Execution Timeout : Set CAL3 mode to register", "TIMEOUT", MB_OK );
- }
- else if( state==METAAPP_STOP )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString)" Set CAL3 mode to register stop";
- // Application->MessageBox( "Execution Stop : Set CAL3 mode to register", "STOP", MB_OK );
- }
- CurrentPageReset();
- }
- //-----------------------------------------------
- void Tfrm8PskApcProfile::CNF_SetW6sImmediateBSI( void )
- {
- E_METAAPP_RESULT_T state = RF_APC_8PSK_Obj->Get_ConfirmState();
- if( state==METAAPP_SUCCESS )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString)" Set CAL3 mode to register successfully";
- }
- else if( state==METAAPP_FAIL )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString)" Set word6s to register fail";
- Application->MessageBox( "Execution Fail : Set word6s to register", "FAIL", MB_OK );
- }
- else if( state==METAAPP_TIMEOUT )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString)" Set word6s to register timeout";
- Application->MessageBox( "Execution Timeout : Set word6s to register", "TIMEOUT", MB_OK );
- }
- else if( state==METAAPP_STOP )
- {
- sbAPCProfile->Panels->Items[0]->Text = (AnsiString)" Set word6s to register stop";
- // Application->MessageBox( "Execution Stop : Set word6s to register", "STOP", MB_OK );
- }
- CurrentPageReset();
- }
- //---------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::read_APC_files_setup( AnsiString asSetupFile, AnsiString asExeName )
- {
- AnsiString asPath;
- if ( getPathFromStr(asExeName, asPath) &&
- withPath( asPath) &&
- !withPath( asSetupFile)
- )
- {
- asSetupFile = asPath + asSetupFile;
- }
- TIniFile *ini;
- try
- {
- ini = new TIniFile( asSetupFile );
- if(ini != NULL)
- {
- // stNVRAMDB->Caption = ini->ReadString("RF tool","EPSK APC RAMP NVRAM database file", "");
- // if ( stNVRAMDB->Caption.Length() >0)
- //// {
- // read_APC_db_file( stNVRAMDB->Caption );
- // }
- as_NVRAM_DB_File = ini->ReadString("RF tool","NVRAM database file", "");
- if( read_db_file( as_NVRAM_DB_File ) )
- {
- UpdateDBFileCaption(as_NVRAM_DB_File);
- frmRFTool->UpdateDBFileCaption(as_NVRAM_DB_File);
- frm8PskApcProfile->UpdateDBFileCaption(as_NVRAM_DB_File);
- }
- delete ini;
- ini = NULL;
- }
- }
- catch (...)
- {
- AnsiString as_warning_msg;
- as_warning_msg = " RF tool : read setup file : " + asSetupFile + " error ";
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- }
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::read_APC_db_file( AnsiString asFileName )
- {
- unsigned long nvram_idb;
- if( ! NVRAMMan->Get_IsInit() )
- {
- frmMainSel->FDMDatabaseInit( asFileName.c_str());
- }
- if( ! NVRAMMan->Get_IsInit() )
- {
- MessageBox(NULL, "Open NVRAM database error", NULL, MB_OK);
- }
- else
- {
- stNVRAMDB->Caption = asFileName;
- }
- }
- //---------------------------------------------------------------------------
- bool Tfrm8PskApcProfile::read_db_file( AnsiString asFileName )
- {
- unsigned long nvram_idb;
- if(! NVRAMMan->Get_IsInit() || asFileName.AnsiCompareIC(NVRAMMan->Get_NVRAM_DB_File()) )
- {
- frmMainSel->FDMDatabaseInit( asFileName.c_str());
- }
- if(! NVRAMMan->Get_IsInit() )
- {
- Application->MessageBox( " Initialize NVRAM database fail", "Fail", MB_OK );
- return false;
- }
- return true;
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::UpdateDBFileCaption( AnsiString asFileName )
- {
- stNVRAMDB->Caption = asFileName;
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::write_APC_files_setup( AnsiString asSetupFile, AnsiString asExeName )
- {
- AnsiString asPath;
- if ( getPathFromStr(asExeName, asPath) &&
- withPath( asPath) &&
- !withPath( asSetupFile)
- )
- {
- asSetupFile = asPath + asSetupFile;
- }
- TIniFile *ini;
- try
- {
- ini = new TIniFile( asSetupFile );
- if(ini != NULL)
- {
- ini->WriteString("RF tool","NVRAM database file", stNVRAMDB->Caption );
- delete ini;
- ini = NULL;
- }
- }
- catch (...)
- {
- AnsiString as_warning_msg;
- as_warning_msg = " RF tool : write setup file : " + asSetupFile + " error ";
- Application->MessageBox( as_warning_msg.c_str(), "Warning", MB_OK );
- }
- }
- void __fastcall Tfrm8PskApcProfile::HintTimerTimer(TObject *Sender)
- {
- HintTimer->Enabled = false;
- lblHint->Visible = false;
- }
- //------------------------------------------------------------------------------
- void Tfrm8PskApcProfile::ReDrawFields(int draw_mask)
- {
- int i, j;
- int band = m_eCurBand;
- char str[256];
- edtTestArfcn->Text = m_sTestArfcn[band];
- if (draw_mask & DRAW_PCL)
- {
- for (i=0; i<16; i++)
- {
- edtPCLDAC[i]->Text = m_sEpskRamp.s_ramp_table[band].rampData.power[i];
- btnPCL[i]->Caption = PCL_RANGE[band][i];
- }
- }
- if (draw_mask & DRAW_VBIAS)
- {
- pa_vbias* p_pa_vibas[] =
- {
- m_sEpskRamp.s_pa_vbias.data.GSM900_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.DCS1800_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.PCS1900_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.GSM850_pa_vbias
- };
- for (int i=0; i<MAX_PA_VBIAS_NUM; i++)
- {
- m_edtVbiasPCL[i]->Text = IntToStr(p_pa_vibas[m_eCurBand][i].pcl_index);
- m_edtVbias[i]->Text = IntToStr(p_pa_vibas[m_eCurBand][i].pa_vbias1);
- }
- }
- if (draw_mask & DRAW_AD6546)
- {
- m_edtSlopeSkew->Text = IntToStr(m_sEpskRamp.s_ad6546.REFDET_SLOPE_SKEW);
- m_edtAmFbDac->Text = IntToStr(m_sEpskRamp.s_ad6546.AM_FB_DAC);
- }
- if (draw_mask & DRAW_RAMP)
- {
- sprintf(str, "PCL %d Profile", PCL_RANGE[m_eCurBand][CurPCLIndex]);
- pnlProfileTItle->Caption = str;
- for (i=0; i<16; i++)
- {
- edtRampUp[i]->Text = m_sEpskRamp.s_ramp_table[band].rampData.ramp[CurPCLIndex].point[0][i];
- edtRampDn[i]->Text = m_sEpskRamp.s_ramp_table[band].rampData.ramp[CurPCLIndex].point[1][i];
- }
- }
- if (draw_mask & DRAW_WEIGHT)
- {
- for (i=0; i<11; i++)
- {
- edtWtARFCN[i]->Text = m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].max_arfcn;
- edtWtPCL[i]->Text = m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].mid_level;
- }
- if (RF_ID_A60111A == m_uiFinalRFID)
- {
- for (i=0; i<11; i++)
- {
- edtWtHigh[i]->Text = IntToStr(m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].hi_weight - A60111A_WEIGHT_OFFSET);
- edtWtLow[i]->Text = IntToStr(m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].low_weight - A60111A_WEIGHT_OFFSET);
- }
- }
- else
- {
- for (i=0; i<11; i++)
- {
- edtWtHigh[i]->Text = (long)(m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].hi_weight*1.0/WEIGHT_SCALE*1000+0.5)/1000.0;
- edtWtLow[i]->Text = (long)(m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].low_weight*1.0/WEIGHT_SCALE*1000+0.5)/1000.0;
- }
- }
- }
- if (draw_mask & DRAW_BATTERY_COMPENSATE)
- {
- for (i=0; i<3; i++)
- {
- for (j=0; j<3; j++)
- {
- edtBatteryCompensateArray[i][j]->Text = (long) (m_sEpskRamp.s_ramp_table[band].rampData.battery_compensate[i][j]*1.0 / BATTERY_COMPENSATE_SCALE*1000+0.5)/1000.0 ;
- }
- }
- }
- if (draw_mask & DRAW_TX_AFC_OFFSET)
- {
- edtTxAfcOffset->Text = IntToStr( m_sEpskRamp.s_ramp_table[band].rampData.tx_afc_offset );
- }
- if (draw_mask & DRAW_INTERSLOT_LOWEST_DAC)
- {
- edtInterslotLowestDAC->Text = IntToStr( m_ucInterslotLowestDAC[band] );
- }
- if (draw_mask & DRAW_WORD3)
- {
- Display_Word3();
- }
- if (draw_mask & DRAW_BV)
- {
- Display_Word6s(tctlAPC->TabIndex);
- }
- edtTestArfcn->Text = m_sTestArfcn[m_eCurBand];
- if (band!=BANDSEL_GSM900 && band!=BANDSEL_GSM850)
- {
- edtPCLDAC[15]->Visible = true;
- btnPCL[15]->Visible = true;
- }
- else
- {
- edtPCLDAC[15]->Visible = false;
- btnPCL[15]->Visible = false;
- }
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::CurrentPageLock( void )
- {
- int i;
- // button
- // btnTXStart->Kind = bkNo;
- // btnTXStart->Caption = "Stop";
- btnTXStart->Enabled = false;
- btnTXStart->Tag = 1;
- btnUpLeft->Enabled = false;
- btnDnLeft->Enabled = false;
- btnUpRight->Enabled = false;
- btnDnRight->Enabled = false;
- btnUploadFromFlash->Enabled = false;
- btnDownloadToFlash->Enabled = false;
- btnChangeDB->Enabled = false;
- btnLoadFromFile->Enabled = false;
- btnSaveToFile->Enabled = false;
- btnSetCAL3ModeToRegister->Enabled = false;
- // for(i=0; i<TOTAL_PCL_DAC_NUM; i++ )
- // {
- // btnPCL[i]->Enabled = false;
- // }
- // editor
- // edtApcDcOffset->Enabled = false;
- // edtTestArfcn->Enabled = false;
- // PCL DAC
- // for( i=0; i<TOTAL_PCL_DAC_NUM; i++ )
- // { edtPCLDAC[i]->Enabled = false;
- // }
- // Ramp up, ramp down
- // for( i=0; i<TOTAL_RAMP_DOWN_NUM; i++ )
- // {
- // edtRampUp[i]->Enabled = false;
- // edtRampDn[i]->Enabled = false;
- // }
- // sub band weighting
- // for( i=0; i<TOTAL_SUBBAND_WEIGHT_NUM; i++ )
- // {
- // edtWtARFCN[i]->Enabled = false;
- // edtWtPCL[i]->Enabled = false;
- // edtWtHigh[i]->Enabled = false;
- // edtWtLow[i]->Enabled = false;
- // }
- // battery compensate
- // for( i=0; i<3; i++ )
- // {
- // for(int j=0; j<3; j++)
- // {
- // edtBatteryCompensateArray[i][j]->Enabled = false;
- // }
- // }
- // Tx AFC offset
- // pnlTxAfcOffset->Enabled = false;
- }
- //----------------------------------------------------------------------------
- void Tfrm8PskApcProfile::CurrentPageReset( void )
- {
- int i;
- // button
- // btnTXStart->Kind = bkRetry;
- // btnTXStart->Caption = "Start";
- btnTXStart->Enabled = true;
- btnTXStart->Tag = 0;
- btnUpLeft->Enabled = true;
- btnDnLeft->Enabled = true;
- btnUpRight->Enabled = true;
- btnDnRight->Enabled = true;
- btnUploadFromFlash->Enabled = true;
- btnDownloadToFlash->Enabled = true;
- btnChangeDB->Enabled = true;
- btnLoadFromFile->Enabled = true;
- btnSaveToFile->Enabled = true;
- btnSetCAL3ModeToRegister->Enabled = true;
- #if 0
- for(i=0; i<TOTAL_PCL_DAC_NUM; i++ )
- {
- btnPCL[i]->Enabled = true;
- }
- // editor
- edtApcDcOffset->Enabled = true;
- edtTestArfcn->Enabled = true;
- // PCL DAC
- for( i=0; i<TOTAL_PCL_DAC_NUM; i++ )
- { edtPCLDAC[i]->Enabled = true;
- }
- // Ramp up, ramp down
- for( i=0; i<TOTAL_RAMP_DOWN_NUM; i++ )
- {
- edtRampUp[i]->Enabled = true;
- edtRampDn[i]->Enabled = true;
- }
- // sub band weighting
- for( i=0; i<TOTAL_SUBBAND_WEIGHT_NUM; i++ )
- {
- edtWtARFCN[i]->Enabled = true;
- edtWtPCL[i]->Enabled = true;
- edtWtHigh[i]->Enabled = true;
- edtWtLow[i]->Enabled = true;
- }
- // battery compensate
- for( i=0; i<3; i++ )
- {
- for(int j=0; j<3; j++)
- {
- edtBatteryCompensateArray[i][j]->Enabled = true;
- }
- }
- #endif
- }
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- bool Tfrm8PskApcProfile::ComposeRenesasField( void )
- {
- if( cbC3ModeEnable->Checked )
- {
- b5p_coef.tx.c3mode = 1;
- }
- else
- {
- b5p_coef.tx.c3mode = 0;
- }
- RF_APC_8PSK_Obj->Compose_wordC3( c3mode, b5p_coef.tx.wordC3);
- RF_APC_8PSK_Obj->Compose_word6_4_0(bvw640, b5p_coef.tx.word6_4_0);
- RF_APC_8PSK_Obj->Compose_word6_5_0(bvw650, b5p_coef.tx.word6_5_0);
- RF_APC_8PSK_Obj->Compose_word6_6_0(bvw660, b5p_coef.tx.word6_6_0);
- RF_APC_8PSK_Obj->Compose_word6_7_0(bvw670, b5p_coef.tx.word6_7_0);
- return true;
- }
- //---------------------------------------------------------------------------
- bool Tfrm8PskApcProfile::DeComposeRenesasField( void )
- {
- RF_APC_8PSK_Obj->DeCompose_wordC3( b5p_coef.tx.wordC3, c3mode );
- c3mode.c3mode = b5p_coef.tx.c3mode;
- RF_APC_8PSK_Obj->DeCompose_word6_x_0(b5p_coef.tx.word6_4_0, bvw640);
- RF_APC_8PSK_Obj->DeCompose_word6_x_0(b5p_coef.tx.word6_5_0, bvw650);
- RF_APC_8PSK_Obj->DeCompose_word6_x_0(b5p_coef.tx.word6_6_0, bvw660);
- RF_APC_8PSK_Obj->DeCompose_word6_x_0(b5p_coef.tx.word6_7_0, bvw670);
- return true;
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Get_CurrentWord6s( unsigned int &cur_w6s )
- {
- if( lblBVReg->Caption.AnsiCompareIC("W6-4-0")==0 )
- {
- RF_APC_8PSK_Obj->Compose_word6_4_0( bvw640, cur_w6s);
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-5-0")==0 )
- {
- RF_APC_8PSK_Obj->Compose_word6_5_0( bvw650, cur_w6s);
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-6-0")==0 )
- {
- RF_APC_8PSK_Obj->Compose_word6_6_0( bvw660, cur_w6s);
- }
- else if( lblBVReg->Caption.AnsiCompareIC("W6-7-0")==0 )
- {
- RF_APC_8PSK_Obj->Compose_word6_7_0( bvw670, cur_w6s);
- }
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::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;
- }
- //---------------------------------------------------------------------------
- bool Tfrm8PskApcProfile::CheckFields(void)
- {
- int i;
- int idata;
- short sdata;
- unsigned char ucdata;
- unsigned short usdata;
- E_BANDSEL band = m_eCurBand;
- AnsiString text;
- for (i=0; i<MAX_APC_PCL_NUM; i++)
- {
- if (edtPCLDAC[i]->Visible)
- {
- text = edtPCLDAC[i]->Text; if (!IsValidPCLDac(text, usdata)) { edtPCLDACCheck(edtPCLDAC[i]); return false; }
- m_sEpskRamp.s_ramp_table[band].rampData.power[i] = usdata;
- }
- text = edtRampUp[i]->Text; if (!IsValidRamp( text, ucdata)) { edtRampUpCheck(edtRampUp[i]); return false; }
- m_sEpskRamp.s_ramp_table[band].rampData.ramp[CurPCLIndex].point[0][i] = ucdata;
- text = edtRampDn[i]->Text; if (!IsValidRamp( text, ucdata)) { edtRampDnCheck(edtRampDn[i]); return false; }
- m_sEpskRamp.s_ramp_table[band].rampData.ramp[CurPCLIndex].point[1][i] = ucdata;
- }
- if (m_pnlPAVbias->Visible)
- {
- // vbias
- for (i=0; i<MAX_PA_VBIAS_NUM; i++)
- {
- text = m_edtVbiasPCL[i]->Text;
- if (!IsValidPCL(text, m_eCurBand, idata))
- {
- m_edtVbiasPCLCheck(m_edtVbiasPCL[i]);
- return false;
- }
- text = m_edtVbias[i]->Text;
- if (!IsValidVbias(m_uiFinalRFID, text, ucdata))
- {
- edtVbiasCheck(m_edtVbias[i]);
- return false;
- }
- pa_vbias* p_pa_vibas[] =
- {
- m_sEpskRamp.s_pa_vbias.data.GSM900_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.DCS1800_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.PCS1900_pa_vbias,
- m_sEpskRamp.s_pa_vbias.data.GSM850_pa_vbias
- };
- p_pa_vibas[m_eCurBand][i].pcl_index = idata;
- p_pa_vibas[m_eCurBand][i].pa_vbias1 = ucdata;
- }
- }
- if (m_pnlAD6546->Visible)
- {
- // REFDET_SLOPE_SKEW
- text = m_edtSlopeSkew->Text;
- if (!IsValidRefDetSlopeSkew(text, ucdata))
- {
- m_edtSlopeSkewCheck(m_edtSlopeSkew);
- return false;
- }
- m_sEpskRamp.s_ad6546.REFDET_SLOPE_SKEW = ucdata;
- // AM_FB_DAC
- text = m_edtAmFbDac->Text;
- if (!IsValidAmFbDac(text, ucdata))
- {
- m_edtAmFbDacCheck(m_edtAmFbDac);
- return false;
- }
- m_sEpskRamp.s_ad6546.AM_FB_DAC = ucdata;
- }
- for (i=0; i<ARFCN_SECTION_NUM-1; i++)
- {
- text = edtWtARFCN[i]->Text;
- if (!IsValidARFCN2(text, band, sdata))
- {
- edtWtARFCNCheck(edtWtARFCN[i]);
- return false;
- }
- m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].max_arfcn = sdata;
- if (-1 == idata)
- {
- break;
- }
- text = edtWtPCL[i]->Text;
- if (!IsValidPCL(text, band, idata))
- {
- edtWtPCLCheck(edtWtPCL[i]);
- return false;
- }
- m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].mid_level = idata;
- text = edtWtHigh[i]->Text;
- if (!IsValidWeight(text, m_uiFinalRFID, usdata))
- {
- edtWtHighCheck(edtWtHigh[i]);
- return false;
- }
- m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].hi_weight = usdata;
- text = edtWtLow[i]->Text;
- if (!IsValidWeight(text, m_uiFinalRFID, usdata))
- {
- edtWtLowCheck(edtWtLow[i]);
- return false;
- }
- m_sEpskRamp.s_ramp_table[band].rampData.arfcn_weight[i].low_weight = usdata;
- }
- for (i=0; i<APC_BATTERY_COMP_NUM; i++)
- {
- for (int j=0; j<APC_BATTERY_COMP_NUM; j++)
- {
- text = edtBatteryCompensateArray[i][j]->Text;
- if (!IsValidBatteryCompensate(text, usdata))
- {
- edtBatteryCompensateCheck(edtBatteryCompensateArray[i][j]);
- return false;
- }
- m_sEpskRamp.s_ramp_table[band].rampData.battery_compensate[i][j] = usdata;
- }
- }
- text = edtTestArfcn->Text; if (!IsValidARFCN( text, band, m_sTestArfcn[band])) { edtTestArfcnCheck(edtTestArfcn); return(false); }
- //text = edtApcDcOffset->Text; if( !IsValidPCLDac( text, ApcDcOffset[band] ) ) { edtApcDcOffsetCheck(edtApcDcOffset); return(false); }
- text = edtTxAfcOffset->Text; if (!IsValidTxAfcOffset( text, tx_afc_offset[band])) { edtTxAfcOffsetCheck(edtTxAfcOffset); return(false); }
- m_sEpskRamp.s_ramp_table[band].rampData.tx_afc_offset = tx_afc_offset[band];
- text = edtInterslotLowestDAC->Text; if (!IsValidInterslotLowestDAC(text, ucdata)) { edtInterslotLowestDACCheck(edtInterslotLowestDAC); return(false); }
- m_ucInterslotLowestDAC[band] = ucdata;
- return true;
- }
- //----------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Display_Word3( void )
- {
- if( m_uiFinalRFID == RF_ID_BRIGHT5P )
- {
- // int bv=RF_APC_Obj->Get_BvMode();
- btnSetCAL3ModeToRegister->Visible = true;
- pnlCAL3ModeHeader->Visible = true;
- pnlCAL3Mode->Visible = true;
- if( b5p_coef.tx.c3mode )
- {
- cbC3ModeEnable->Checked = true;
- lblTN->Visible = true;
- edtTN->Visible = true;
- lblTO->Visible = true;
- edtTO->Visible = true;
- Display_C3WordEditor();
- }
- else
- {
- cbC3ModeEnable->Checked = false;
- lblTN->Visible = false;
- edtTN->Visible = false;
- lblTO->Visible = false;
- edtTO->Visible = false;
- }
- }
- else
- {
- btnSetCAL3ModeToRegister->Visible = false;
- pnlCAL3ModeHeader->Visible = false;
- pnlCAL3Mode->Visible = false;
- }
- }
- //----------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Display_C3WordEditor( void )
- {
- edtTN->Text = c3mode.uc_tn;
- edtTO->Text = c3mode.uc_to;
- }
- //----------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Display_Word6s( int band_mode )
- {
- if( RF_ID_BRIGHT5P == m_uiFinalRFID )
- {
- int bv=RF_APC_8PSK_Obj->Get_BvMode();
- stBvmode->Caption = bv;
- btnSetCAL3ModeToRegister->Visible = true;
- pnlCAL3ModeHeader->Visible = true;
- pnlCAL3Mode->Visible = true;
- switch( band_mode )
- {
- case BANDSEL_GSM850:
- {
- // Display_BVW64();
- if( bv == 0 )
- {
- Display_BVW66();
- }
- else
- {
- Display_BVW64();
- }
- }
- break;
- case BANDSEL_GSM900:
- {
- if( bv == 0 )
- {
- // Display_BVW64();
- Display_BVW66();
- }
- else
- {
- Display_BVW65();
- }
- }
- break;
- case BANDSEL_DCS1800:
- {
- if( bv == 0 )
- {
- // Display_BVW65();
- Display_BVW67();
- }
- else
- {
- Display_BVW66();
- }
- }
- break;
- case BANDSEL_PCS1900:
- {
- if( bv == 0 )
- {
- // Display_BVW65();
- Display_BVW67();
- }
- else
- {
- Display_BVW67();
- }
- }
- break;
- }
- }
- else
- {
- btnSetCAL3ModeToRegister->Visible = false;
- pnlCAL3ModeHeader->Visible = false;
- pnlCAL3Mode->Visible = false;
- }
- }
- //----------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Display_BVW64( void )
- {
- lblBVReg->Caption = "W6-4-0";
- edtAP->Text = bvw640.uc_ap;
- edtAS->Text = bvw640.uc_as;
- edtAO->Text = bvw640.uc_ao;
- edtBD->Text = bvw640.uc_bd;
- }
- //----------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Display_BVW65( void )
- {
- lblBVReg->Caption = "W6-5-0";
- edtAP->Text = bvw650.uc_ap;
- edtAS->Text = bvw650.uc_as;
- edtAO->Text = bvw650.uc_ao;
- edtBD->Text = bvw650.uc_bd;
- }
- //----------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Display_BVW66( void )
- {
- lblBVReg->Caption = "W6-6-0";
- edtAP->Text = bvw660.uc_ap;
- edtAS->Text = bvw660.uc_as;
- edtAO->Text = bvw660.uc_ao;
- edtBD->Text = bvw660.uc_bd;
- }
- //----------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Display_BVW67( void )
- {
- lblBVReg->Caption = "W6-7-0";
- edtAP->Text = bvw670.uc_ap;
- edtAS->Text = bvw670.uc_as;
- edtAO->Text = bvw670.uc_ao;
- edtBD->Text = bvw670.uc_bd;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::tctlAPCChange(TObject *Sender)
- {
- if (!frmMainSel->cbGSM850->Checked)
- {
- if (BANDSEL_GSM850 == (E_BANDSEL) tctlAPC->TabIndex)
- {
- tctlAPC->TabIndex = lastTabIndex;
- Application->MessageBox( "Please check GSM 850 on main menu", "FAILURE", MB_OK );
- return;
- }
- }
- if( !CheckFields() )
- {
- tctlAPC->TabIndex = m_eCurBand;
- return;
- }
- if(btnTXStart->Tag==1)
- { btnTXStartClick(this);
- }
- m_eCurBand = (E_BANDSEL) tctlAPC->TabIndex;
- lastTabIndex = tctlAPC->TabIndex;
- CurPCLIndex = 0;
- ReDrawFields(DRAW_PCL |
- DRAW_VBIAS |
- DRAW_AD6546 |
- DRAW_RAMP |
- DRAW_WEIGHT |
- DRAW_BATTERY_COMPENSATE |
- DRAW_TX_AFC_OFFSET |
- DRAW_WORD3 |
- DRAW_BV |
- DRAW_INTERSLOT_LOWEST_DAC
- );
- }
- //---------------------------------------------------------------------------
- //===========================================================================
- ///////////////////////// Global information ///////////////////////////
- //===========================================================================
- //--------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Set_RF_APC_8PSK_Obj( CRFAPC8PSK *rf_apc_8psk_obj )
- {
- RF_APC_8PSK_Obj = rf_apc_8psk_obj;
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::Set_RF_MULTI_SLOT_TX_Obj( CRFMULTISLOTTX *rf_multi_slot_tx_obj)
- {
- RF_MULTI_SLOT_TX_Obj = rf_multi_slot_tx_obj;
- }
- void __fastcall Tfrm8PskApcProfile::edtInterslotLowestDACCheck(
- TObject *Sender)
- {
- unsigned char uc_data;
- int row, col;
- AnsiString text;
- TEdit *edit = (TEdit*)Sender;
- char hint[] = " value shall be 0 ~ 255 ";
- text = edit->Text;
- if( !IsValidInterslotLowestDAC( text, uc_data ) )
- { ShowHintLabel( edit, hint );
- edit->SetFocus();
- return;
- }
- m_ucInterslotLowestDAC[m_eCurBand] = uc_data;
- }
- //---------------------------------------------------------------------------
- void __fastcall Tfrm8PskApcProfile::ToggleHideExecute(TObject *Sender)
- {
- g_bHideEnable = !g_bHideEnable;
- ApplyHideProperty();
- }
- //---------------------------------------------------------------------------
- void Tfrm8PskApcProfile::ApplyHideProperty(void)
- {
- }