📄 tuner.h
字号:
#ifndef TUNER_H
#define TUNER_H
#ifdef __cplusplus
extern "C" {
#endif
//
// Make sure we compile the MS headers at warning level 3. Restore the
// previous warning level when we're done.
//
#pragma warning( push, 3 )
#include <wdm.h>
#include "strmini.h"
#include "ksmedia.h"
#pragma warning( pop )
//
// Disable some unnescessary compiler warnings
//
#pragma warning( disable : 4127 ) // conditional expression is constant
#pragma warning( disable : 4514 ) // unreferenced inline function
#include "i2cintr.h"
#include "bttunerif.h"
#include "bdatundefs.h"
#include "btreg.h"
#include "prop.h"
#include "hdallintr.h"
#ifndef FIELDOFFSET
#define FIELDOFFSET(type, field) ((LONG_PTR)(&((type *)1)->field)-1)
#endif
#define M_GUID0 0xa19dc0e0, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
#define M_GUID1 0xa19dc0e1, 0x3b39, 0x11d1, 0x90, 0x5f, 0x0, 0x0, 0xc0, 0xcc, 0x16, 0xba
extern KSPIN_MEDIUM TVTunerMediums[];
extern BOOL TVTunerPinDirection[];
#define INTERMEDIATE_FREQUENCY_FM 10700000L
#define INTERMEDIATE_FREQUENCY_FM_TEMIC4049 33300000L
#define INTERMEDIATE_FREQUENCY_FM_PHILIPS1216 10700000L
#define INTERMEDIATE_FREQUENCY_FM_PHILIPS1236MK3 10700000L
#define INTERMEDIATE_FREQUENCY_FM_THOMSON761x 41250000L
#define PICTURE_INTERMEDIATE_FREQUENCY_525LINE 45750000L
#define PICTURE_INTERMEDIATE_FREQUENCY_625LINE 38875000L
#define PICTURE_INTERMEDIATE_FREQUENCY_625LINE_TEMIC4049 38900000L
#define PICTURE_INTERMEDIATE_FREQUENCY_SECAML1_TEMIC4049 33900000L
#define PICTURE_INTERMEDIATE_FREQUENCY_PHILIPS_ATSC 44000000L
#define PICTURE_INTERMEDIATE_FREQUENCY_PHILIPS1216 38900000L
#define PICTURE_INTERMEDIATE_FREQUENCY_PHILIPS1216_L1 33950000L
#define PICTURE_INTERMEDIATE_FREQUENCY_PHILIPS1286MK3 58750000L
#define PICTURE_INTERMEDIATE_FREQUENCY_TCL2002MI3 38900000L
/*
Applications such as MS tuner filter and MCE try to scan signal from as lower as
55.00 MHz if there is no signal at center frequency of channel 2.(55.25 MHz)
Setting the low band minimum freq to 53.50 allows such application UI and Comcast
cable sending out a 54MHz for channel 2.
*/
const BAND_LOW = 53500000; // 53.50 MHz
const BAND_LOWMID = 160000000; // 160.00 MHz
const BAND_MIDHI = 454000000; // 454.00 MHz
const BAND_HI = 801250000; // 801.25 MHz
const BAND_LOW_1216 = 41250000; // 41.25 MHz
const BAND_MID_1216 = 160000000; // 160.00 MHz
const BAND_MIDHIGH_1216 = 442000000; // 442.00 MHz
const BAND_HIGH_1216 = 997250000; // 997.25 MHz
const BAND_LOW_1236 = 53500000; // 53.50 MHz
const BAND_MID_1236 = 160000000; // 160.00 MHz
const BAND_HIGH_1236 = 442000000; // 442.00 MHz
const BAND_LOW_1286MK3 = 90500000; // 90.50 MHz Philips FM1286 MK3 (with FM for Japan); Freq low from spec is 91.25MHz.
const BAND_LOWMID_1286MK3 = 160000000; // 160.00 MHz
const BAND_MIDHIGH_1286MK3 = 442000000; // 442.00 MHz
const BAND_HIGH_1286MK3 = 765250000; // 765.25 MHz
const BAND_LOW_4039 = 53500000; // 53.50 MHz For Temic 4039 FR5 and 4039 FI5
const BAND_MID_4039 = 158000000; // 158.00 MHz
const BAND_HIGH_4039 = 453000000; // 453.00 MHz
const BAND_LOW_XG126 = 47750000; // 47.75 MHz For XuGuang JS-2S/126
const BAND_LOWMID_XG126 = 160250000; // 160.25 MHz
const BAND_MIDHIGH_XG126 = 456250000; // 456.25 MHz
const BAND_HIGH_XG126 = 865250000; // 865.25 MHz
const BAND_ATSC_LOW = 160000000; // 160.00 MHz
const BAND_ATSC_HIGH = 453000000; // 453.00 MHz
const BAND_LOW_761x = 53500000; // 53.50 MHz
const BAND_MID_761x = 151250000; // 151.25 MHz
const BAND_HIGH_761x = 421250000; // 421.25 MHz
const BAND_LOW_TCL2002MI3 = 45750000; // 45.75 MHz For TCL2002MI-3
const BAND_LOWMID_TCL2002MI3 = 170000000; // 170.00 MHz
const BAND_MIDHIGH_TCL2002MI3 = 450000000; // 450.00 MHz
const BAND_HIGH_TCL2002MI3 = 863250000; // 863.25 MHz
// Philips FMD1216ME
const BAND_LOW_FMD1216ME = 48250000; // 48.25 MHz
const BAND_MID_FMD1216ME = 160000000; // 160.00 MHz
const BAND_HIGH_FMD1216ME = 442000000; // 442.00 MHz
const BAND_MAX_FMD1216ME = 863250000; // 863.25 MHz
const BAND_FM_LOW_FMD1216ME = 87500000; // 87.50 MHz
//
// Define FM lower and upper frequencies for different tuners with FM radio
// Media Center Edition Chinese version will tune to as low as 86.9 even when 87.0 is entered.
// Thus the range has been extended to 86.50-108.50.
//
const FM_LOW = 86500000; // 86.50 MHz
const FM_HIGH = 108500000; // 108.50 MHz
const FM_LOW_1286MK3 = 75900000; // 75.90 MHz Philips FM1286 MK3 (with FM for Japan)
const FM_HIGH_1286MK3 = 90000000; // 90.00 MHz
// tuner brands
typedef enum
{
TUNER_BRAND_TEMIC = 1,
TUNER_BRAND_PHILIPS,
TUNER_BRAND_ALPS,
TUNER_BRAND_PHILIPS_1236D,
TUNER_BRAND_CONEXANT_DVBS,
TUNER_BRAND_XUGUANG,
TUNER_BRAND_THOMSON,
TUNER_BRAND_TCL2002MI3
} TUNER_BRANDS;
// tuner types
typedef enum
{
NTSC_M = 1,
PAL_B = 2,
PAL_I = 3,
NTSC_M_ATSC = 4,
DVB_S = 5,
PAL_D = 6,
SECAM = 7,
TEMIC_4_IN_1 = 8, // multi-standard Euro tuner
TEMIC_4136 = 9,
PHILIPS_FM1216_MK3 = 10, // multi-standard Euro tuner, FM radio
PHILIPS_FM1236_MK3 = 11, // NTSC-M tuner, FM radio
PHILIPS_FI1236_MK3 = 12, // Economy NTSC-M tuner, no radio
PHILIPS_FQ1216_MK3 = 13, // multi-standard Euro tuner, no radio
PHILIPS_FQ1236_MK3 = 14, // NTSC-M tuner, no radio
TEMIC_4039 = 15, // Temic 4039 NTSC-M tuner, FM radio
XUGUANG_126 = 16, // XuGuang JS-2S/126 tuner, PAL D/K and I, no radio
THOMSON_DTT761x = 17, // NTSC-M/ATSC tuner
TCL_2002_MI3 = 18, // TCL 2002 MI-3 tuner, PAL D/K and I, no radio
PHILIPS_FM1286_MK3 = 19, // NTSC System M tuner, FM radio for Japan
PHILIPS_FMD1216_ME = 20 // PAL/DVB-T tuner, FM radio
} TUNER_TYPES;
typedef enum
{
PLL_LOW_125K = 0,
PLL_LOW_62K,
PLL_LOCKED,
PLL_HIGH_62K,
PLL_HIGH_125K
} PLL_LOCK_STATUS;
typedef enum
{
PLL_LOW_13K = 0,
PLL_LOW_38K,
PLL_LOW_63K,
PLL_LOW_88K,
PLL_LOW_113K,
PLL_LOW_138K,
PLL_LOW_163K,
PLL_LOW_188K,
PLL_HIGH_188K,
PLL_HIGH_163K,
PLL_HIGH_138K,
PLL_HIGH_113K,
PLL_HIGH_88K,
PLL_HIGH_63K ,
PLL_HIGH_38K,
PLL_HIGH_13K
} PLL_LOCK_STATUS_FI1236;
typedef struct _TUNER_INFO
{
ULONG TunerBrand; // Brand of tuner
BYTE TunerI2CAddress; // I2C address for tuner
WORD TunerBandCtrlFM; // Ctrl code for FM
WORD TunerBandCtrlLow; // Ctrl code for VHF low
WORD TunerBandCtrlMid; // Ctrl code for VHF high
WORD TunerBandCtrlHigh; // Ctrl code for UHF
} TUNER_INFO, *PTUNER_INFO;
typedef struct tagSRB_DATA_EXTENSION
{
LIST_ENTRY leSrbListEntry;
PHW_STREAM_REQUEST_BLOCK pSrb;
} SRB_DATA_EXTENSION, *PSRB_DATA_EXTENSION;
#define KSPROPERTIES_TUNER_LAST ( KSPROPERTY_TUNER_STATUS + 1 )
typedef struct tagBT_KSPROPERTY_TUNER_CAPS
{
ULONG ulStandardsSupported;
ULONG ulMinFrequency;
ULONG ulMaxFrequency;
ULONG ulTuningGranularity;
ULONG ulNumberOfInputs;
ULONG ulSettlingTime;
ULONG ulStrategy;
} BT_KSPROPERTY_TUNER_CAPS, *PBT_KSPROPERTY_TUNER_CAPS;
// this structure defines the per request extension. It defines any storage
// space that the mini driver may need in each request packet.
typedef struct _SRB_EXTENSION
{
LIST_ENTRY ListEntry;
PHW_STREAM_REQUEST_BLOCK pSrb;
} SRB_EXTENSION, * PSRB_EXTENSION;
// Philips Analog only tuner
const kPhilipsBandCtrlFM = 0xCEA5;
const kPhilipsBandCtrlLow = 0xCEA0;
const kPhilipsBandCtrlMid = 0xCE90;
const kPhilipsBandCtrlHigh = 0xCE30;
// Alps tuner
const kAlpsBandCtrlLow = 0xC214;
const kAlpsBandCtrlMid = 0xC212;
const kAlpsBandCtrlHigh = 0xC211;
// Old default Temic values, pre 4136
const kTemicBandCtrlLow = 0x8E02;
const kTemicBandCtrlMid = 0x8E04;
const kTemicBandCtrlHigh = 0x8E01;
// Temic 4-in-1
const kTemic4049BandCtrlFM = 0x8EA4;
const kTemic4049BandCtrlLow = 0x8EA0;
const kTemic4049BandCtrlMid = 0x8E90;
const kTemic4049BandCtrlHigh = 0x8E30;
// Temic 4039
const kTemic4039BandCtrlFM = 0x88A5;
const kTemic4039BandCtrlLow = 0x8EA0;
const kTemic4039BandCtrlMid = 0x8E90;
const kTemic4039BandCtrlHigh = 0x8E30;
// Temic 4136
const kTemic4136BandCtrlFM = 0x8EA4;
const kTemic4136BandCtrlLow = 0x8EA0;
const kTemic4136BandCtrlMid = 0x8E90;
const kTemic4136BandCtrlHigh = 0x8E30;
// Philips 1236D Analog Video, Outside Tuner Input
const kPhilips1236DTvOutBandCtrlLow = 0xCEA3;
const kPhilips1236DTvOutBandCtrlMid = 0xCE93;
const kPhilips1236DTvOutBandCtrlHigh = 0xCE33;
// Philips 1236D Analog Video, Inside Tuner Input
const kPhilips1236DTvInBandCtrlLow = 0xCEA2;
const kPhilips1236DTvInBandCtrlMid = 0xCE92;
const kPhilips1236DTvInBandCtrlHigh = 0xCE32;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -