⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gentunerdemod.h

📁 完整的基于Conxant平台的USB电视棒的WIN驱动程序。
💻 H
字号:
/*+++ *******************************************************************\ 
* 
*  Copyright and Disclaimer: 
*  
*     --------------------------------------------------------------- 
*     This software is provided "AS IS" without warranty of any kind, 
*     either expressed or implied, including but not limited to the 
*     implied warranties of noninfringement, merchantability and/or 
*     fitness for a particular purpose.
*     --------------------------------------------------------------- 
*   
*     Copyright (c) 2005 Conexant Systems, Inc. 
*     All rights reserved. 
*
\******************************************************************* ---*/ 

#ifndef _GEN_TUNER_DEMOD_H_
#define _GEN_TUNER_DEMOD_H_

extern "C"
{
    #include <wdm.h>
}

#include <windef.h>

#include "I2cIF.h"
#include "GenTuner.h"
#include "i2c_context.h"
#include "IBdaTuner.h"

class I2cIF;
class GpioIF;
class ResetIF;

typedef struct _TUNER_DEMOD_CB_CONTEXT
{
    PVOID     _p_context;
} TUNER_DEMOD_CB_CONTEXT, *P_TUNER_DEMOD_CB_CONTEXT;

typedef	VOID (*TUNER_DEMOD_CALLBACK)(struct _TUNER_DEMOD_CB_CONTEXT *);

typedef struct _TUNER_DEMOD_INFO
{
    I2cIF*               _p_demod_i2c;          // I2C object that driver creates to control demod
    I2cIF*               _p_tuner_i2c;          // I2C object that driver creates to control tuner
    
    DWORD                _tuner_type;           // This is got from TunerInfo.h file of the inc folder
    
    BYTE                 _demod_i2c_address0;   // I2C address of the Demod
    BYTE                 _demod_i2c_address1;   // I2C address of a sub device in the Demod
    BYTE                 _tuner_i2c_address;    // I2C address of the Tuner
    BYTE                 _sif_i2c_address;      // SIF address for the Tuner

    ResetIF*             _p_RstIf;              // The Tuner reset object. 
    GpioIF*              _p_GPIOPin;            // The driver's general GPIO control object.
        
    DWORD                _demod_transfer_mode;  // 0 = Serial, 1 = Parallel
    DWORD                _tuner_bypass_mode;    // 1 = Bypass ON, 0 = Bypass OFF

    DWORD                _demod_xtal_freq_hz;   // Crystal Freq of the Demod
    DWORD                _tuner_xtal_freq_hz;   // Crystal Freq of the Digital Tuner connected to the Demod
    DWORD                _tuner_saw_type;       // One of SIDEWINDER_SAW_TYPE if Tuner is Sidewinder
    DWORD                _tuner_saw_freq_hz;    // SAW frequency of the Tuner if it has one

    TUNER_DEMOD_CALLBACK _p_callback;

}TUNER_DEMOD_INFO, *PTUNER_DEMOD_INFO;


#pragma pack(push, 8)
class GenTunerDemod : public ITuner, public IBdaTuner
{
public:
    GenTunerDemod(
	    TUNER_DEMOD_INFO *p_tuner_demod_info);

    ~GenTunerDemod();
    
    /////////////////////////////////////////////////////////////////////////////////////
    //BDA tuner interface functions
    /////////////////////////////////////////////////////////////////////////////////////
    
    BOOL bdaTuner_initialize();

    I2cIF* getI2CInterface(); // WARNING !!! Make sure that the owner who calls this function releases the interface

    //Get BDA signal statistics
    BOOL  bdaTuner_isSignalLocked(); 
    DWORD bdaTuner_getSignalStrength();
	DWORD bdaTuner_getSignalQuality();
    DWORD bdaTuner_getTunerFreqOffset();
    
    BOOL  bdaTuner_powerDown(); 
	BOOL  bdaTuner_powerUp();
    
    //Set frequency for digital mode
    BOOL bdaTuner_setFrequency(DWORD frequency, DWORD bandwidth);

    BOOL bdaTuner_setMode(ULONG mode);

    virtual BOOL bdaTuner_setDemodParameters(PVOID demodParameters);
    virtual BOOL bdaTuner_setChannelParameters(PVOID channelParameters);

    virtual BOOL bdaTuner_resetDigitalTuner();

    /////////////////////////////////////////////////////////////////////////////////////
    //ITuner interface functions
	////////////////////////////////////////////////////////////////////////////////////

    virtual BOOLEAN Initialize();

    virtual BOOLEAN setFrequency(PULONG p_frequency, DWORD standard, DWORD tuning_flags);
    virtual BOOLEAN setFrequency(ULONG frequency, DWORD standard);

    virtual LONG getSignalOffset(); 
    virtual BOOLEAN setMode(ULONG mode);
   
    //Accessors to tuner information
    virtual DWORD getSupportedModes();
    virtual DWORD getSupportedStandards(ULONG mode);
    virtual DWORD getMinFrequency(ULONG mode);
    virtual DWORD getMaxFrequency(ULONG mode);
    virtual DWORD getNumInputs(ULONG mode);

protected:
    
    //Polling is required by the demod library.
    VOID startPolling();
    VOID stopPolling();
    
    //Polling thread
    static VOID static_PollingThread(GenTunerDemod* p_this);
    VOID pollingThread();
    
    VOID pollDemod();

    BOOL ProgramSiliconTuner(ULONG frequency, ULONG channel_bandwidth);

private:
    HANDLE           _demod_handle;
    
    KEVENT           _tracking_thread_event;    
    PVOID            _thread_object;

    PVOID            _p_tuner_demod_object;
	
	I2cIF*           _p_i2c;        //I2C interface to our slave devices

    ITuner*          _p_tuner;
    I2C_CONTEXT      _i2c_context;
    DWORD            _mode;    

    BOOLEAN          _inited;
    TUNER_DEMOD_INFO _tuner_demod_info;
};
#pragma pack(pop)

// WARNING !!! Make sure that the owner who calls this function releases the interface
// otherwise there might be a memory leak.
inline I2cIF* GenTunerDemod::getI2CInterface()
{
	if (_p_i2c)
        _p_i2c->addRef();

    return _p_i2c;
}


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -