META_Factory_RF_cb.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:11k
- /*****************************************************************************
- * 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:
- * ---------
- * META_Factory_RF_cb.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * META factory RF callback 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 <windows.h>
- #pragma hdrstop
- #include "META_Factory.h"
- #include "T_META_factory_calibration.h"
- #include "meta_msg.h"
- extern HANDLE hForm_MF;
- // AFC
- extern RfAfc_Cnf *MF_rf_afc_cnf;
- extern unsigned char RfSetAfcDacCnf;
- // PM
- extern RfPm_Cnf *MF_rf_pm_cnf; // define in T_META_factory_calibration.cpp
- // APC
- extern bool MF_rf_tx_level_cnf;
- extern TfrmFatcory *frmFatcory;
- // Tthread
- extern bool is_suspend_cal; // in T_META_factory_calibration.cpp
- extern T_META_factory_calibration* pt_calibration;
- //------------------------------------------------------------------------------
- void __stdcall MF_SelectBand_cnf_cb(const unsigned char cnf, const short token, void *usrData)
- {
- frmFatcory->DisableAllCalTimer();
- if (0 == cnf)
- {
- PostMessage(
- hForm_MF,
- WM_MF_RF_SELECTBAND_CNF_FAIL,
- 0 , // unsigned short -> unsigned int
- 0 // long -> long
- );
- }
- else
- {
- if(is_suspend_cal == true && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- }
- //------------------------------------------------------------------------------
- void CNF_MF(void)
- {
- frmFatcory->DisableAllCalTimer();
- if( is_suspend_cal && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- //----------------------------------------------------------------------------
- // IP2
- void CNF_SetSky74117IP2MagToReg( void )
- {
- frmFatcory->DisableAllCalTimer();
- if( is_suspend_cal && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- //---------------------------------------------------------------------------
- void CNF_SetSky74117IP2PolToReg( void )
- {
- frmFatcory->DisableAllCalTimer();
- if( is_suspend_cal && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- // PM
- void __stdcall MF_rf_pm_cnf_cb(const RfPm_Cnf *cnf, const short token, void *usrData)
- {
- frmFatcory->DisableAllCalTimer();
- MF_rf_pm_cnf->deviation = cnf->deviation;
- MF_rf_pm_cnf->power = cnf->power;
- MF_rf_pm_cnf->usedGain = cnf->usedGain;
- MF_rf_pm_cnf->extra_info.valid = cnf->extra_info.valid;
- MF_rf_pm_cnf->extra_info.iOffset = cnf->extra_info.iOffset;
- MF_rf_pm_cnf->extra_info.qOffset = cnf->extra_info.qOffset;
- MF_rf_pm_cnf->extra_info.validSamples = cnf->extra_info.validSamples;
- if(is_suspend_cal == true && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- // PostMessage(
- // hForm_MF,
- // WM_MF_RF_PM_CNF,
- // 0 , // unsigned short -> unsigned int
- // cnf->power // long -> long
- // );
- }
- //-----------------------------------------------------------------------------
- // TX level
- void __stdcall MF_rf_tx_level_cb(const unsigned char cnf, const short token, void *usrData)
- {
-
- frmFatcory->DisableAllCalTimer();
- MF_rf_tx_level_cnf = cnf;
- PostMessage(
- hForm_MF,
- WM_MF_RF_TX_LEVEL_CNF,
- 0, // unsigned short -> unsigned int
- cnf // long -> long
- );
- }
- //-----------------------------------------------------------------------------
- // crystal TX level
- void __stdcall cb_MF_rf_tx_level_crystal(const unsigned char cnf, const short token, void *usrData)
- {
- frmFatcory->DisableAllCalTimer();
- MF_rf_tx_level_cnf = cnf;
- if(is_suspend_cal == true && pt_calibration != NULL ) // added by Andy Ueng
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- //-----------------------------------------------------------------------------
- // AFC
- void __stdcall MF_rf_afc_cb( const RfAfc_Cnf *cnf, const short token, void *usrData )
- {
- frmFatcory->DisableAllCalTimer();
- if(MF_rf_afc_cnf == NULL)
- {
- MF_rf_afc_cnf = new RfAfc_Cnf;
- }
- MF_rf_afc_cnf->deviation = cnf->deviation;
- MF_rf_afc_cnf->fcb_ok_number = cnf->fcb_ok_number;
- MF_rf_afc_cnf->freqOffset = cnf->freqOffset;
- PostMessage( hForm_MF,
- WM_MF_RF_AFC_CONTROL_CNF,
- 0, // unsigned short -> unsigned int
- cnf->fcb_ok_number // long -> long
- );
- }
- //------------------------------------------------------------------------------
- void MF_rf_pm_sub_band_write_cb (FT_NVRAM_WRITE_CNF *cnf, short token, void *usrData )
- {
- frmFatcory->DisableAllCalTimer();
- PostMessage(
- hForm_MF,
- WM_MF_NVRAM_PATH_LOSS_WRITE_CNF,
- cnf->status, // unsigned short -> unsigned int
- 0 // -> long
- );
- }
- //------------------------------------------------------------------------------
- void MF_rf_level_ramp_write_cb( FT_NVRAM_WRITE_CNF *cnf, short token, void *usrData)
- {
- frmFatcory->DisableAllCalTimer();
- PostMessage(
- hForm_MF,
- WM_MF_NVRAM_LEVEL_RAMP_WRITE_CNF,
- cnf->status, // unsigned short -> unsigned int
- 0 // -> long
- );
- }
- //------------------------------------------------------------------------------
- void MF_rf_afc_write_cb ( FT_NVRAM_WRITE_CNF *cnf, short token, void *usrData )
- {
- frmFatcory->DisableAllCalTimer();
- PostMessage(
- hForm_MF,
- WM_MF_NVRAM_AFC_WRITE_CNF,
- cnf->status, // unsigned short -> unsigned int
- 0 // int -> long
- );
- }
- //------------------------------------------------------------------------------
- void __stdcall MF_rf_SetAfcDacValue_cb(const unsigned char cnf, const short token, void *usrData)
- {
- frmFatcory->DisableAllCalTimer();
- RfSetAfcDacCnf = cnf;
- if (0 == cnf)
- {
- PostMessage(
- hForm_MF,
- WM_MF_RF_SET_AFC_DAC_CNF_FAIL,
- 0 , // unsigned short -> unsigned int
- 0 // long -> long
- );
- }
- if(is_suspend_cal == true && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- //---------------------------------------------------------------------------
- void ccb_set_apc_level()
- {
- frmFatcory->DisableAllCalTimer();
- if(is_suspend_cal == true && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- //---------------------------------------------------------------------------
- void ccb_rf_stop()
- {
- frmFatcory->DisableAllCalTimer();
- if(is_suspend_cal == true && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- //==============================================================================
- void __stdcall ccb_MF_rf_tx_level_TrOff(const unsigned char cnf, const short token, void *usrData)
- {
- frmFatcory->DisableAllCalTimer();
- MF_rf_tx_level_cnf = cnf;
- if(is_suspend_cal == true && pt_calibration != NULL ) // added by Andy Ueng
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- //------------------------------------------------------------------------------
- void __stdcall ccb_rf_setbbtx_cfg_TrOff(const unsigned char cnf, const short token, void *usrData)
- {
- frmFatcory->DisableAllCalTimer();
- if(is_suspend_cal == true && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }
- //===============================================================================================
- // mutli slot TX
- void ConfirmCallback_MultiSlotTX( void )
- {
- frmFatcory->DisableAllCalTimer();
- if(is_suspend_cal == true && pt_calibration != NULL )
- {
- is_suspend_cal = false;
- pt_calibration->Resume();
- }
- }