crystal_afc.h
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:8k
- /*****************************************************************************
- * 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:
- * ---------
- * crystal_afc.h
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * Crystal AFC header
- *
- * 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!!
- *============================================================================
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #ifndef _CRYSTAL_AFC_H_
- #define _CRYSTAL_AFC_H_
- #ifndef _META_CRYSTAL_CFG_H_
- #include "meta_crystal_cfg.h"
- #endif
- // common
- #ifndef _MTK_MCU_H_
- #include "mtk_mcu.h"
- #endif
- #ifndef _METAAPP_COMMON_H_
- #include "metaapp_common.h"
- #endif
- #ifndef META_DLL_H
- #include "meta.h"
- #endif
- #ifndef _MAN_HANDLE_H_
- #include "man_handle.h"
- #endif
- // equipment
- #ifndef _RCT_COMMON_H_
- #include "rct_common.h"
- #endif
- //---------------------------------------------------------------------------
- #define TOTAL_AFCDAC_COUNT 8
- #define CAP_ID_NUM 128
- #define CAP_ID_MIN 0
- #define CAP_ID_MAX_63 63 // MT6139, MT6140
- #define CAP_ID_MAX_127 127 // Aero2, Aero2E, ALICEG2S, A60111A
- #define CAP_ID_MAX_511 511 // AG2550
- typedef struct
- {
- E_BANDSEL e_band;
- TNotifyEvent ne_onTermSuccess;
- TNotifyEvent ne_onTermByUser;
- TMETA_crystal_cfg *crystal_cfg;
- TStringList *st_Log;
- E_DIR_TXRX_T e_sweep_type;
- E_DEVICE_TYPE e_device_type;
- bool b_cont_sine_wave;
- BBCHIP_TYPE e_bb_chip;
- APCTxPattern e_burst_type;
- short s_arfcn;
- int pcl;
- char c_TSC;
- short test_count;
- short s_min_afc_dac;
- short s_max_afc_dac;
- short s_afc_dac_step;
- int min_cap_id;
- int max_cap_id;
- int cap_id_step;
- // AnsiString &as_TaModel;
- bool b_temp_sweep;
- float min_temp;
- float max_temp;
- float temp_step;
- int com_port;
- HANDLE hCOM;
- DCB original_dcb;
- }S_CAS_T;
- //---------------------------------------------------------------------------
- class CCRYSTALAFC
- {
- private:
- E_METAAPP_RESULT_T m_eConfirmState;
- bool m_bDownloadCrystalAfcDataTrigger;
- bool m_bDownloadCAPIDTrigger;
- CMETAHANDLE m_META_HANDLE_Obj;
- short CRYSTALID_AFC;
- char *m_cCrystalAfcBuf;
- unsigned int m_uiCrystalAfcBufSize;
- int InitAfcDac;
- int AfcSlope;
- RfAfc_Req *RFReq_AFC;
- RfNbtx_Req *RFReq_TX;
- RfAfc_Cnf RFCnf_AFC;
- bool HasMeasured;
- int DisplayAFC;
- int EvalAfcDac[2];
- int EvalFreqErr[2];
- int EvalInitDac;
- int EvalSlope;
- int CurAFC;
-
- int AFCMin;
- int AFCMax;
- int AFCStep;
- int m_iCapId;
- protected:
- public:
- // int state;
- int Band;
- short m_sArfcn;
- int Bsic;
- int PCL;
- int Frames;
- int AFCDac;
- int BurstType;
- l1cal_crystalAfcData_T xo_afc;
- int CapIDBufSize;
- char *CapIDBuf;
- int TestCount;
- void Confirm(E_METAAPP_RESULT_T confirm_state);
- void REQ_Finish( void );
- void REQ_TimeOut( void );
- void REQ_SelectBand( void );
- void __stdcall CNF_SelectBand(const unsigned char cnf, const short token, void *usrData);
- void REQ_NormalTX( void );
- void __stdcall CNF_NormalTX(const unsigned char cnf, const short token, void *usrData);
- void REQ_MeasureAFC( void );
- void __stdcall CNF_MeasureAFC(const RfAfc_Cnf *cnf, const short token, void *usrData);
- // run time set CAP ID
- void REQ_SetCapID(void);
- CCRYSTALAFC( void );
- ~CCRYSTALAFC( );
- // Public member
- void (*ConfirmCallback)( void );
- void REQ_Stop( void );
- // run time set CAP_ID
- void REQ_SetCapID_Start(int cap_id);
- // NVRAM
- bool Decompose_crystalAfcData( void );
- bool Compose_crystalAfcData( void );
- bool Decompose_CapID( void );
- bool Compose_CapID( void );
- void REQ_Read_CrystalAfcData_From_NVRAM(void);
- void CNF_ReadCrystalAfcDataFromNVRAM(void);
- void REQ_Write_CrystalAfcData_To_NVRAM(void);
- void CNF_WriteCrystalAfcDataToNVRAM(void);
- void REQ_Read_CAPID_From_NVRAM(void);
- void CNF_CAPID_ReadFromNVRAM(void);
- void REQ_Write_CAPID_To_NVRAM(void);
- void CNF_CAPID_WriteToNVRAM(void);
- /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
- // Public member
- void REQ_Start_TX(int band, short arfcn, int bsic, int pcl, int frames, int afc_dac);
- // NVRAM
- void REQ_Read_CrystalAfcData_From_NVRAM_Start(void);
- void REQ_Write_CrystalAfcData_To_NVRAM_Start(void);
- void REQ_Read_CAPID_From_NVRAM_Start(void);
- void REQ_Write_CAPID_To_NVRAM_Start(void);
- // ini file
- bool REQ_Read_CrystalAfcData_From_File( char *filename );
- bool REQ_Write_CrystalAfcData_To_File( char *filename );
- bool CrystalAfcSectionExist( char *filename );
- bool REQ_Read_CAPID_From_File( char *filename );
- bool REQ_Write_CAPID_To_File( char *filename );
- // global information
- E_METAAPP_RESULT_T Get_ConfirmState(void);
- int Get_max_cap_id(unsigned int rd_id);
- int Get_cap_id(void);
- void Set_cap_id(int cap_id_par);
- };
- #endif