rf_MultiSlotTx.cpp
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:10k
- /*****************************************************************************
- * 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:
- * ---------
- * rf_MultiSlotTx.cpp
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * RF multi slot TX 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!!
- *============================================================================
- ****************************************************************************/
- #pragma hdrstop
- #include "meta.h"
- #ifndef _RF_COMMON_H_
- #include "rf_common.h"
- #endif
- #ifndef _RF_MOD_H_
- #include "rf_mod.h"
- #endif
- #include "rf_MultiSlotTx.h"
- #include "man_active.h"
- //===========================================================================
- static CRFMULTISLOTTX* rf_multi_slot_tx_ptr;
- static bool g_bIsRunning = false;
- //===========================================================================
- static void REQ_SelectBand( void )
- { rf_multi_slot_tx_ptr->REQ_SelectBand( );
- }
- //---------------------------------------------------------------------------
- static void __stdcall CNF_SelectBand( const unsigned char cnf, const short token, void *usrData )
- {
- rf_multi_slot_tx_ptr->CNF_SelectBand( cnf, token, usrData );
- }
- //---------------------------------------------------------------------------
- static void REQ_MultiSlotTx( void )
- { rf_multi_slot_tx_ptr->REQ_MultiSlotTx( );
- }
- //---------------------------------------------------------------------------
- static void __stdcall CNF_MultiSlotTx(const unsigned char cnf, const short token, void *usrData)
- {
- rf_multi_slot_tx_ptr->CNF_MultiSlotTx( cnf, token, usrData );
- }
- //===========================================================================
- CRFMULTISLOTTX::CRFMULTISLOTTX( void )
- {
- g_bIsRunning = false;
- ConfirmCallback = NULL;
- }
- //---------------------------------------------------------------------------
- CRFMULTISLOTTX::~CRFMULTISLOTTX()
- {
- g_bIsRunning = false;
- ConfirmCallback = NULL;
- }
- //---------------------------------------------------------------------------
- void CRFMULTISLOTTX::REQ_Stop(void)
- {
- if(!g_bIsRunning) return;
- META_Cancel_r( m_META_HANDLE_Obj.Get_MainHandle(), m_sRFID_MULTISLOTTX );
- Confirm( METAAPP_STOP );
- }
- //---------------------------------------------------------------------------
- void CRFMULTISLOTTX::Confirm(E_METAAPP_RESULT_T confirm_state)
- {
- if (!g_bIsRunning)
- {
- return;
- }
- g_bIsRunning = false;
- if (NULL == ConfirmCallback)
- {
- return;
- }
- if (confirm_state != METAAPP_SUCCESS)
- {
- META_Cancel_r(m_META_HANDLE_Obj.Get_MainHandle(), m_sRFID_MULTISLOTTX);
- META_CancelAllBlockingCall_r(m_META_HANDLE_Obj.Get_MainHandle());
- }
- m_eConfirmState = confirm_state;
- ActiveMan->SetActiveFunction(ConfirmCallback);
- }
- //===========================================================================
- //void CRFMULTISLOTTX::REQ_Start(int band, int arfcn, int tsc, int *cs, int *pcl, int frames, int afc_dac, char TimeSlotMask_par, int ta, bool isEDGEsupport, int pattern, unsigned short pattern_data)
- void CRFMULTISLOTTX::REQ_Start(S_MULTI_SLOT_TX_T multi_slot_tx)
- {
- rf_multi_slot_tx_ptr = this;
- g_bIsRunning = true;
- m_sMultiSlotTx = multi_slot_tx;
- ActiveMan->SetActiveFunction( ::REQ_SelectBand );
- }
- //---------------------------------------------------------------------------
- void CRFMULTISLOTTX::REQ_SelectBand(void)
- {
- if (!g_bIsRunning)
- {
- return;
- }
- unsigned char select_PCS1900;
- if (BANDSEL_PCS1900 == m_sMultiSlotTx.e_bandsel)
- {
- select_PCS1900 = 1;
- }
- else
- {
- select_PCS1900 = 0;
- }
- META_RESULT MetaResult = META_Rf_SelectFrequencyBand1900_r(m_META_HANDLE_Obj.Get_MainHandle(), select_PCS1900, ::CNF_SelectBand, &m_sRFID_MULTISLOTTX, NULL );
- if (MetaResult != META_SUCCESS)
- {
- Confirm( METAAPP_FAIL );
- return;
- }
- }
- //-------------------------------------
- void __stdcall CRFMULTISLOTTX::CNF_SelectBand( const unsigned char cnf, const short token, void *usrData )
- {
- if (!g_bIsRunning)
- {
- return;
- }
- if (false == cnf)
- {
- Confirm(METAAPP_FAIL);
- return;
- }
- ActiveMan->SetActiveFunction(::REQ_MultiSlotTx);
- }
- //---------------------------------------------------------------------------
- void CRFMULTISLOTTX::REQ_MultiSlotTx(void)
- {
- if (!g_bIsRunning)
- {
- return;
- }
- if (m_sMultiSlotTx.b_MultiSlotTXExSupport)
- {
- META_RESULT MetaResult = META_Rf_MultiSlot_TX_Ex_r(m_META_HANDLE_Obj.Get_MainHandle(), 5000, &m_sMultiSlotTx.req);
- if (MetaResult != META_SUCCESS)
- {
- if (MetaResult != META_TIMEOUT)
- {
- Confirm(METAAPP_FAIL);
- return;
- }
- else
- {
- Confirm(METAAPP_TIMEOUT);
- return;
- }
- }
- Confirm(METAAPP_SUCCESS);
- }
- else
- {
- RfMultiSlotTX_Req req;
- req.arfcn = m_sMultiSlotTx.req.arfcn;
- req.bsic = m_sMultiSlotTx.req.bsic;
- req.timeSlotmask = m_sMultiSlotTx.req.timeSlotmask;
- for (int i=0; i<MAX_SUPPORT_TIMESLOT_NUM; i++)
- {
- req.cs[i] = m_sMultiSlotTx.req.cs[i];
- req.powerLev[i] = m_sMultiSlotTx.req.powerLev[i];
- }
- req.frames = m_sMultiSlotTx.req.frames;
- req.dacValue = m_sMultiSlotTx.req.dacValue;
- req.ta = m_sMultiSlotTx.req.ta;
- META_RESULT MetaResult = META_Rf_MultiSlot_TX_r(m_META_HANDLE_Obj.Get_MainHandle(), &req, ::CNF_MultiSlotTx, &m_sRFID_MULTISLOTTX, NULL);
- if (MetaResult!=META_SUCCESS)
- {
- Confirm(METAAPP_FAIL);
- return;
- }
- }
- }
- //-------------------------------------
- void __stdcall CRFMULTISLOTTX::CNF_MultiSlotTx(const unsigned char cnf, const short token, void *usrData)
- {
- if (!g_bIsRunning)
- {
- return;
- }
- if (false == cnf)
- {
- Confirm(METAAPP_FAIL);
- return;
- }
- Confirm(METAAPP_SUCCESS);
- }
- //===========================================================================
- //////////////////////////// Query ///////////////////////////
- //===========================================================================
- bool CRFMULTISLOTTX::Query_MultiSlotTxEx_Start(void)
- {
- META_RESULT MetaResult = META_QueryIfFunctionSupportedByTarget_r(m_META_HANDLE_Obj.Get_MainHandle(), 300, "META_Rf_MultiSlot_TX_Ex_r");
- if (META_SUCCESS != MetaResult)
- {
- return false;
- }
- return true;
- }
- //===========================================================================
- //////////////////////////// Export information ///////////////////////////
- //===========================================================================
- E_METAAPP_RESULT_T CRFMULTISLOTTX::Get_ConfirmState( void )
- {
- return m_eConfirmState;
- }