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

📄 itunerproperties.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) 2008 Conexant Systems, Inc.
*     All rights reserved.
*
\******************************************************************* ---*/

#ifndef _ITUNER_PROP_H_
#define _ITUNER_PROP_H_

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

#include <windef.h>
#include <unknown.h>
#include <ks.h>
#include <ksmedia.h>

//#include "pinmediums.h"
#include "CommonGuid.h"
#include "device.h"

// Classes
class ITuner;

#define NUM_TUNER_PINS      2
#define PIN_INDEX_VIDEO     0
#define PIN_INDEX_TV_AUDIO  1
// tuner pin guid definitions
static KSPIN_MEDIUM g_tuner_mediums[NUM_TUNER_PINS] =
{
	{ TUNER_VIDEO_OUT_GUID, 0, 0},  // Pin 0 Video
	{ TUNER_TV_AUDIO_OUT_GUID, 0, 0}   // Pin 1 TV Audio
};

// tuner pin directions
static BOOL g_tuner_pin_direction[NUM_TUNER_PINS] =
{
	TRUE,                      // Pin 0 is output (Video)
	TRUE                       // Pin 1 is output (TV Audio)
};

// From GenSiTuner.cpp 
typedef struct 
{
    DWORD saw_frequency;
    DWORD BW_6_saw_offset; // BW is actually 5.5
    DWORD BW_7_saw_offset;
    DWORD BW_8_saw_offset;
} SAW_FREQ_AND_OFFSETS;
// Below are the negative SAW Freq offsets for 6, 7 and 8 MHz bandwidth
// for each of the three different SAW filter types.
// We have to subtract the offset from the SAW filter freq to get the final
// SAW Filter FREQ
static SAW_FREQ_AND_OFFSETS g_saw_freq_and_offsets[SIDEWINDER_TOTAL_NO_OF_SAW_TYPES] = 
{ 
    // SAW Freq    6MHz   7 MHz   8 MHz
    {1218600000, 700000,      0,      0},  // Temex Saw  1218.6 MHz
    {1216000000, 200000, 100000, 100000},  // TriQuint   1216.0 Mhz
    {1220000000,      0,      0,      0}   // Epcos      1220.0 Mhz
};



/////////////////////////////////////////////////////////////////////////////////////////
//Class ITunerProperties
//
// This is the base class for handling the tuner property sets.  It is meant to be
// overridden by a class representing the specific tuner being used.
//
// It contains all the static DDK entry points for the various tuner properties, and
// will call virtual functions when it needs information specific to a certain tuner.
//
class ITunerProperties
{
public:
	ITunerProperties(Device* p_device, I2cIF* p_i2c);
	~ITunerProperties();

	//Static DDK entry points
	static NTSTATUS static_getCaps(
		PIRP p_irp,
		PKSPROPERTY_TUNER_CAPS_S p_request,
		PKSPROPERTY_TUNER_CAPS_S p_data);

	static NTSTATUS static_getModeCaps(
		PIRP p_irp,
		PKSPROPERTY_TUNER_MODE_CAPS_S p_request,
		PKSPROPERTY_TUNER_MODE_CAPS_S p_data);

	static NTSTATUS static_getMode(
		PIRP p_irp,
		PKSPROPERTY_TUNER_MODE_S p_request,
		PKSPROPERTY_TUNER_MODE_S p_data);

	static NTSTATUS static_setMode(
		PIRP p_irp,
		PKSPROPERTY_TUNER_MODE_S p_request,
		PKSPROPERTY_TUNER_MODE_S p_data);

	static NTSTATUS static_getStandard(
		PIRP p_irp,
		PKSPROPERTY_TUNER_STANDARD_S p_request,
		PKSPROPERTY_TUNER_STANDARD_S p_data);

	static NTSTATUS static_setStandard(
		PIRP p_irp,
		PKSPROPERTY_TUNER_STANDARD_S p_request,
		PKSPROPERTY_TUNER_STANDARD_S p_data);

	static NTSTATUS static_getFrequency(
		PIRP p_irp,
		PKSPROPERTY_TUNER_FREQUENCY_S p_request,
		PKSPROPERTY_TUNER_FREQUENCY_S p_data);

	static NTSTATUS static_setFrequency(
		PIRP p_irp,
		PKSPROPERTY_TUNER_FREQUENCY_S p_request,
		PKSPROPERTY_TUNER_FREQUENCY_S p_data);

	static NTSTATUS static_getInput(
		PIRP p_irp,
		PKSPROPERTY_TUNER_INPUT_S p_request,
		PKSPROPERTY_TUNER_INPUT_S p_data);

	static NTSTATUS static_setInput(
		PIRP p_irp,
		PKSPROPERTY_TUNER_INPUT_S p_request,
		PKSPROPERTY_TUNER_INPUT_S p_data);

	static NTSTATUS static_getStatus(
		PIRP p_irp,
		PKSPROPERTY_TUNER_STATUS_S p_request,
		PKSPROPERTY_TUNER_STATUS_S p_data);

	DWORD   get_mode(){return _mode;}
	static  NTSTATUS registerFilter(PDEVICE_OBJECT pdo, DWORD medium_id);

	//Power up the device
	virtual VOID powerUp() = 0;
	virtual VOID powerDown() = 0;
	virtual VOID resetTunerTVMode() = 0;

    BOOLEAN ChangeChannelThreadIsActive() { return _change_channel_thread_active; }
	VOID    SetChangeChannelThreadState(BOOLEAN state) { _change_channel_thread_active = state; }    
    virtual NTSTATUS setFrequency(ULONG frequency, ULONG country, DWORD tuning_flags);

    ITuner* getTuner(DWORD mode = 0);
    

protected:
	virtual VOID setCountry(ULONG country) = 0;
	virtual ITuner* allocateTuner(Device* p_device, DWORD tuner_type, I2cIF* p_i2c) = 0;	
    virtual NTSTATUS setMode(ULONG mode) = 0;	    
	
	//Current tuner state.
	ULONG   _mode;
	ULONG   _input;
	ULONG   _standard;
	ULONG   _frequency;
	DWORD   _country_code;
	DWORD   _tuning_flags;
	DWORD   _tuner_type;
	Device* _p_device;
	ITuner* _p_tuner1;
	ITuner* _p_tuner2;    
    BOOLEAN _use_pll_tune;	
	PVOID   _channel_change_thread_object;
	BOOLEAN _received_change_frequency;
    BOOLEAN _change_channel_thread_active;

private:
	static VOID static_channelChangeThread(ITunerProperties* p_tuner_properties);
	NTSTATUS    startChannelChangeThread();
	LONG        getSignalOffset();
};



#endif

⌨️ 快捷键说明

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