/****************************************************************************/ /* */ /* Copyright (c) 2003 Trident Technologies, Inc. */ /* All rights reserved */ /* */ /* The content of this file or document is CONFIDENTIAL and PROPRIETARY */ /* to Trident Microsystems, Inc. It is subject to the terms of a */ /* License Agreement between Licensee and Trident Technologies, Inc. */ /* restricting among other things, the use, reproduction, distribution */ /* and transfer. Each of the embodiments, including this information and */ /* any derivative work shall retain this copyright notice */ /* */ /****************************************************************************/ /**************************************************************************** * Copyright (C) 2003-2005, Trident Technologies, Inc. * Copyright (C) 2003-2005, Oren Semiconductor * * File: TunerDTVS205FH201A.H * * Created: 01-25-05 * Description: This file contain header file code for DTVS205FH201A * Modified by Alex, 2006-4-29 * ****************************************************************************/ #ifndef TUNER_DTVS205FH201A_H #define TUNER_DTVS205FH201A_H #include "Cas2BGeneralDefinitions_dtvs205.h" #define MAX_TUNER_SUPPORT 2 #define YIELD_TIME 3000 #if 1 //For Tuner DTVS205FH201A typedef enum EN_TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO{ TUNERDTVS205FH201A_REF_DIVIDER_RATIO_31_25 = 0, TUNERDTVS205FH201A_REF_DIVIDER_RATIO_50, TUNERDTVS205FH201A_REF_DIVIDER_RATIO_62_5, // TUNERDTVS205FH201A_REF_DIVIDER_RATIO_166_7 }TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO; typedef enum EN_TYPE_TUNERDTVS205FH201A_AGC{ TUNERDTVS205FH201A_AGC_102_A = 0, TUNERDTVS205FH201A_AGC_102_B, TUNERDTVS205FH201A_AGC_99, TUNERDTVS205FH201A_AGC_96, TUNERDTVS205FH201A_AGC_93, TUNERDTVS205FH201A_AGC_90, TUNERDTVS205FH201A_AGC_WIDE_BAND_OFF }TYPE_TUNERDTVS205FH201A_AGC; typedef enum EN_TYPE_TUNERDTVS205FH201A_CHARGE_PUMP{ TUNERDTVS205FH201A_CHARGE_PUMP_20 = 0, TUNERDTVS205FH201A_CHARGE_PUMP_100 }TYPE_TUNERDTVS205FH201A_CHARGE_PUMP; typedef enum EN_TYPE_TUNERDTVS205FH201A_AGC_TIME_CONSTANT{ TUNERDTVS205FH201A_AGC_TIME_CONSTANT_50_MS = 0, TUNERDTVS205FH201A_AGC_TIME_CONSTANT_2_SEC }TYPE_TUNERDTVS205FH201A_AGC_TIME_CONSTANT; #if 1//20071016 #define DTVS205FH201A_DEVICE_ADDRESS_WRITE 0xC2 #define DTVS205FH201A_SLAVE_ADDRESS 0xC3 #else #define DTVS205FH201A_DEVICE_ADDRESS_WRITE 0xC2 // can be read from i2c. Tuner I2C address #define DTVS205FH201A_SLAVE_ADDRESS 0x86 // Alex modify , 0x86 PIN open, can be read from i2c. Tuner IF address #endif #define DTVS205FH201A_CHANNEL_DOES_NOT_FIT_ANY_FREQUENCY -1 #define DTVS205FH201A_SUCCESS 0 #define DTVS205FH201A_FREQUENCY_VALUE_OUT_OF_RANGE 1 #define DTVS205FH201A_VALUE_OUT_OF_RANGE 2 #define DTVS205FH201A_COULD_NOT_SET_N 3 #define DTVS205FH201A_BEFORE_SEND_BYTES_FAILED 4 #define DTVS205FH201A_AFTER_SEND_BYTES_FAILED 5 #define DTVS205FH201A_SEND_CONTROL_DATA_FAILED 6 #define DTVS205FH201A_CHANNEL_OUT_OF_RANGE 7 #define DTVS205FH201A_LOW_BAND_MIN 54000 #define DTVS205FH201A_LOW_BAND_MAX 168000 #define DTVS205FH201A_MID_BAND_MIN 168000 #define DTVS205FH201A_MID_BAND_MAX 470000 #define DTVS205FH201A_HIGH_BAND_MIN 470000 #define DTVS205FH201A_HIGH_BAND_MAX 863000 #define DTVS205FH201A_F_IF_KHZ 44000 #define DTVS205FH201A_N_MAX 32768 //15 bits //20071110 add #define DTVS205FH201A_100MHz 100000 #define DTVS205FH201A_168MHz 168000 #define DTVS205FH201A_700MHz 700000 #define DTVS205FH201A_866MHz 866000 int TunerDTVS205FH201ASendChannel(unsigned int uiChannel, int iAdjustFreqKHZ, CHANNEL_TABLE_TYPE iChannelTable,TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO iRefDividerRatio,unsigned int uiAgc, unsigned int uiAgcMode,unsigned int uiChargePump,unsigned int uiAgcTimeConstant); int TunerDTVS205FH201ASendFreq(unsigned long ulFrequency,TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO iRefDividerRatio,unsigned int uiAgc, unsigned int uiAgcMode,unsigned int uiChargePump,unsigned int uiAgcTimeConstant); int TunerDTVS205FH201ASendPicCarrier(unsigned long ulFrequency,TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO iRefDividerRatio,unsigned int uiAgc, unsigned int uiAgcMode,unsigned int uiChargePump,unsigned int uiAgcTimeConstant); void DTVS205FH201ASetCPandStepSize(TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO iRefDividerRatio, TYPE_TUNERDTVS205FH201A_CHARGE_PUMP iRefChargePump, unsigned char* pucCb); void DTVS205FH201ASetStepSize(TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO iRefDividerRatio, unsigned char* pucCb,unsigned char* pucCb2); void DTVS205FH201ASetAGC(unsigned int uiAgc, unsigned char* pucAb); void DTVS205FH201ASetATC(unsigned int uiAgcTimeConstant,unsigned char* pucAb); void DTVS205FH201AInitBytes(unsigned char* pucDb1,unsigned char* pucDb2,unsigned char* pucCb,unsigned char* pucBb); BOOLEAN TunerDTVS205FH201ASetRFFreq(unsigned long ulFrequency,unsigned int iAgcMode ,unsigned char* pucBb); BOOLEAN DTVS205FH201ASetN(unsigned long ulFrequency,TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO iRefDividerRatio, unsigned char* pucDb1,unsigned char* pucDb2); unsigned int DTVS205FH201ASendControlData(unsigned int uiAgcMode,unsigned char Db1,unsigned char Db2,unsigned char Cb,unsigned char Bb); unsigned long TunerDTVS205FH201AGetFrequency(unsigned int uiChannelNumber,CHANNEL_TABLE_TYPE iChannelTable); //----------------------------------------------------------------------------------------------------------- // Function name : SetTunerDTVS205FH201A // Description : controls the Thomson DTVS205FH201A tuner // Return type : INT: 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner // Argument : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency // by channel, by center frequency(Khz) or by picture carrier(Khz). // Argument : void* pvTunerSet: The value to set according to TunerSet. // Argument : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number. // Argument : TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO: Determines the reference divider ratio for the tuner // Argument : TYPE_TUNERDTVS205FH201A_AGC: Determines the AGC value for the tuner // Argument : TYPE_TUNER_AGC_MODE: Determines if the tuner will internal AGC digital or analog // the default value is TUNERDTVS205FH201A_AGC_MODE_EXTERNAL // Argument : CHARGE_PUMP: Determines the charge pump value // Argument : TYPE_TUNERDTVS205FH201A_AGC_TIME_CONSTANT: Determines the AGC time constant value, //----------------------------------------------------------------------------------------------------------- int __stdcall SetTunerDTVS205FH201A(TYPE_TUNER_SET_OPTION TunerSet, void* pvTunerSet, int iAdjustFreqKHZ, CHANNEL_TABLE_TYPE iChannelTable, TYPE_TUNERDTVS205FH201A_REF_DIVIDER_RATIO iRefDividerRatio, TYPE_TUNERDTVS205FH201A_AGC iAgc, TYPE_TUNER_AGC_MODE iAgcMode, CHARGE_PUMP iChargePump, TYPE_TUNERDTVS205FH201A_AGC_TIME_CONSTANT iAgcTimeConstant); //----------------------------------------------------------------------------------------------------------- // Function name : __stdcall SetChannel // Description : This function sets the tuner PLL frequencyand sends channel change command to the cascade2B DSP right after the // tuner freuency was set. This function can perform set tuner PLL frequencyand operation by passing the parameters // usDelay = 0 and pstChannelChangeParameters = NULL // Return type : unsigned int - 0 If CC succeeded, a number greater than zero - if CC did not succeeded. // Argument : CAS_2B_TUNER_PARAMETERS stTunerParameters - this struct holds the parameters for the set tuner PLL frequencyand operation // The struct fields are: // - TUNER_TYPE iTunerType - set the tuner type TUNER_DTVS205FH201A, TUNER_DTT7612 or TUNER_THOMSON_T_2000 // - TYPE_TUNER_SET_OPTION iTunerSet - Determines how to set the tuner PLL frequency // by channel, by center frequency(Khz) or by picture carrier(Khz). // - unsigned long ulSetValue - holds the value to set according to iTunerSet channel, or center frequency(Khz) or by picture carrier(Khz). // - CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number. // this field in needed only when the iTunerSet = TUNER_SET_CHANNEL is selected (not valid for TUNER_THOMSON_T_2000). // - TYPE_TUNER_AGC_MODE iAgcMode - determines the agc mode can be digital or analog. // - TYPE_TUNER_INPUT_SELECTION iInputSelection - determines the input selection terrestrial or cable (valid only for TUNER_THOMSON_T_2000). // // Argument : unsigned short usDelay - this parameter is used determine the delay between the set tuner PLL frequency operation and the cascade2B DSP channel change command. // The delay value is multiplied by 10000 and than it is decremented in a loop each time by one until the value reaches to 0. The delay time // will be influenced by the processor speed. // Set the usDelay value to 0 when only a set tuner PLL frequency operation takes place. // Argument : CAS_2B_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters - this parameter is a pointer the a struct that holds all the parameters needed for a // Cascade2B DSP channel change operation. Set the pstChannelChangeParameters value to NULL when only a set tuner PLL frequency operation takes place. // The struct fields are: // - TYPE_RECEIVER_MODE iReceiverMode: Describes to which receiver mode to change if needed. // - TYPE_CARRIER_ACQUISITION iCarrierAcquisition: Describes the carrier acquisition - normal, wide. // this parameter has to be set only for the VSB and QAM Annex B recievers // - TYPE_INVERSE_SPECTRUM iInverseSpectrum: Describes if inverse spectrum is on or off // this parameter has to be set only for the VSB recievers //----------------------------------------------------------------------------------------------------------- //unsigned int __stdcall SetChannel( CAS_2B_TUNER_PARAMETERS stTunerParameters,unsigned short usDelay,CAS_2B_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters); int DTVS205FH201A_Init(TUNER_INIT_PARAMETERS InitParam[2]); int DTVS205FH201A_SetChannel( CAS_2B_TUNER_PARAMETERS* pstTunerParameters,unsigned short usDelay,CAS_2B_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters); int DTVS205FH201A_GetInfo( CAS_2B_TUNER_GET_PARAMETERS* pstTunerParameters); #endif #if 0 //For Tuner DTT7611 typedef enum EN_TYPE_TUNERDTT7611_REF_DIVIDER_RATIO{ TUNERDTT7611_REF_DIVIDER_RATIO_31_25 = 0, TUNERDTT7611_REF_DIVIDER_RATIO_50, TUNERDTT7611_REF_DIVIDER_RATIO_62_5, TUNERDTT7611_REF_DIVIDER_RATIO_166_7 }TYPE_TUNERDTT7611_REF_DIVIDER_RATIO; typedef enum EN_TYPE_TUNERDTT7611_AGC{ TUNERDTT7611_AGC_102_A = 0, TUNERDTT7611_AGC_102_B, TUNERDTT7611_AGC_99, TUNERDTT7611_AGC_96, TUNERDTT7611_AGC_93, TUNERDTT7611_AGC_90, TUNERDTT7611_AGC_WIDE_BAND_OFF }TYPE_TUNERDTT7611_AGC; typedef enum EN_TYPE_TUNERDTT7611_CHARGE_PUMP{ TUNERDTT7611_CHARGE_PUMP_60 = 0, TUNERDTT7611_CHARGE_PUMP_280 }TYPE_TUNERDTT7611_CHARGE_PUMP; typedef enum EN_TYPE_TUNERDTT7611_AGC_TIME_CONSTANT{ TUNERDTT7611_AGC_TIME_CONSTANT_50_MS = 0, TUNERDTT7611_AGC_TIME_CONSTANT_2_SEC }TYPE_TUNERDTT7611_AGC_TIME_CONSTANT; #define DTT7611_DEVICE_ADDRESS_WRITE 0xC2 // can be read from i2c. Tuner I2C address #define DTT7611_SLAVE_ADDRESS 0x86 // Alex modify , 0x86 PIN open, can be read from i2c. Tuner IF address #define DTT7611_CHANNEL_DOES_NOT_FIT_ANY_FREQUENCY -1 #define DTT7611_SUCCESS 0 #define DTT7611_FREQUENCY_VALUE_OUT_OF_RANGE 1 #define DTT7611_VALUE_OUT_OF_RANGE 2 #define DTT7611_COULD_NOT_SET_N 3 #define DTT7611_BEFORE_SEND_BYTES_FAILED 4 #define DTT7611_AFTER_SEND_BYTES_FAILED 5 #define DTT7611_SEND_CONTROL_DATA_FAILED 6 #define DTT7611_CHANNEL_OUT_OF_RANGE 7 #define DTT7611_LOW_BAND_MIN 55250 //#define DTT7611_LOW_BAND_MAX 145250 //#define DTT7611_LOW_BAND_MAX 147000 #define DTT7611_LOW_BAND_MAX 149000 #define DTT7611_MID_BAND_MIN 151250 //#define DTT7611_MID_BAND_MAX 415250 //#define DTT7611_MID_BAND_MAX 417000 #define DTT7611_MID_BAND_MAX 419000 #define DTT7611_HIGH_BAND_MIN 421250 //#define DTT7611_HIGH_BAND_MAX 859250 #define DTT7611_HIGH_BAND_MAX 870000 #define DTT7611_F_IF_KHZ 44000 #define DTT7611_N_MAX 32768 //15 bits //For DTT7612 #define FM_MIN_VALUE 88000 #define FM_MAX_VALUE 108000 #define FM_DTT7612_F_IF_KHZ 41300 int TunerDTT7611SendChannel(unsigned int uiChannel, int iAdjustFreqKHZ, CHANNEL_TABLE_TYPE iChannelTable,TYPE_TUNERDTT7611_REF_DIVIDER_RATIO iRefDividerRatio,unsigned int uiAgc, unsigned int uiAgcMode,unsigned int uiChargePump,unsigned int uiAgcTimeConstant); int TunerDTT7611SendFreq(unsigned long ulFrequency,TYPE_TUNERDTT7611_REF_DIVIDER_RATIO iRefDividerRatio,unsigned int uiAgc, unsigned int uiAgcMode,unsigned int uiChargePump,unsigned int uiAgcTimeConstant); int TunerDTT7611SendPicCarrier(unsigned long ulFrequency,TYPE_TUNERDTT7611_REF_DIVIDER_RATIO iRefDividerRatio,unsigned int uiAgc, unsigned int uiAgcMode,unsigned int uiChargePump,unsigned int uiAgcTimeConstant); void DTT7611SetCP(unsigned int uiChargePump,unsigned char* pucCb); void DTT7611SetStepSize(TYPE_TUNERDTT7611_REF_DIVIDER_RATIO iRefDividerRatio, unsigned char* pucCb,unsigned char* pucCb2); void DTT7611SetAGC(unsigned int uiAgc, unsigned char* pucAb); void DTT7611SetATC(unsigned int uiAgcTimeConstant,unsigned char* pucAb); void DTT7611InitBytes(unsigned char* pucDb1,unsigned char* pucDb2,unsigned char* pucCb,unsigned char* pucBb,unsigned char* pucAb,unsigned char* pucCb2); BOOLEAN TunerDTT7611SetRFFreq(unsigned long ulFrequency,unsigned int uiAgcMode,unsigned char* pucBb); BOOLEAN DTT7611SetN(unsigned long ulFrequency,TYPE_TUNERDTT7611_REF_DIVIDER_RATIO iRefDividerRatio, unsigned char* pucDb1,unsigned char* pucDb2); unsigned int DTT7611SendControlData(unsigned int uiAgcMode,unsigned char Db1,unsigned char Db2,unsigned char Cb,unsigned char Bb,unsigned char Ab,unsigned char Cb2); unsigned long TunerDTT7611GetFrequency(unsigned int uiChannelNumber,CHANNEL_TABLE_TYPE iChannelTable); //----------------------------------------------------------------------------------------------------------- // Function name : SetTunerDTT7611 // Description : controls the Thomson DTT7611 tuner // Return type : INT: 0 - Succeeded to set the tuner, other value - Did not succeed to set the tuner // Argument : TYPE_TUNER_SET_OPTION TunerSet: Determines how to set the tuner PLL frequency // by channel, by center frequency(Khz) or by picture carrier(Khz). // Argument : void* pvTunerSet: The value to set according to TunerSet. // Argument : CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number. // Argument : TYPE_TUNERDTT7611_REF_DIVIDER_RATIO: Determines the reference divider ratio for the tuner // Argument : TYPE_TUNERDTT7611_AGC: Determines the AGC value for the tuner // Argument : TYPE_TUNER_AGC_MODE: Determines if the tuner will internal AGC digital or analog // the default value is TUNERDTT7611_AGC_MODE_EXTERNAL // Argument : CHARGE_PUMP: Determines the charge pump value // Argument : TYPE_TUNERDTT7611_AGC_TIME_CONSTANT: Determines the AGC time constant value, //----------------------------------------------------------------------------------------------------------- int __stdcall SetTunerDTT7611(TYPE_TUNER_SET_OPTION TunerSet, void* pvTunerSet, int iAdjustFreqKHZ, CHANNEL_TABLE_TYPE iChannelTable, TYPE_TUNERDTT7611_REF_DIVIDER_RATIO iRefDividerRatio, TYPE_TUNERDTT7611_AGC iAgc, TYPE_TUNER_AGC_MODE iAgcMode, CHARGE_PUMP iChargePump, TYPE_TUNERDTT7611_AGC_TIME_CONSTANT iAgcTimeConstant); //----------------------------------------------------------------------------------------------------------- // Function name : __stdcall SetChannel // Description : This function sets the tuner PLL frequencyand sends channel change command to the cascade2B DSP right after the // tuner freuency was set. This function can perform set tuner PLL frequencyand operation by passing the parameters // usDelay = 0 and pstChannelChangeParameters = NULL // Return type : unsigned int - 0 If CC succeeded, a number greater than zero - if CC did not succeeded. // Argument : CAS_2B_TUNER_PARAMETERS stTunerParameters - this struct holds the parameters for the set tuner PLL frequencyand operation // The struct fields are: // - TUNER_TYPE iTunerType - set the tuner type TUNER_DTT7611, TUNER_DTT7612 or TUNER_THOMSON_T_2000 // - TYPE_TUNER_SET_OPTION iTunerSet - Determines how to set the tuner PLL frequency // by channel, by center frequency(Khz) or by picture carrier(Khz). // - unsigned long ulSetValue - holds the value to set according to iTunerSet channel, or center frequency(Khz) or by picture carrier(Khz). // - CHANNEL_TABLE_TYPE iChannelTableType - determines which channel table will be selected to get the tuner pll frequency from the channel number. // this field in needed only when the iTunerSet = TUNER_SET_CHANNEL is selected (not valid for TUNER_THOMSON_T_2000). // - TYPE_TUNER_AGC_MODE iAgcMode - determines the agc mode can be digital or analog. // - TYPE_TUNER_INPUT_SELECTION iInputSelection - determines the input selection terrestrial or cable (valid only for TUNER_THOMSON_T_2000). // // Argument : unsigned short usDelay - this parameter is used determine the delay between the set tuner PLL frequency operation and the cascade2B DSP channel change command. // The delay value is multiplied by 10000 and than it is decremented in a loop each time by one until the value reaches to 0. The delay time // will be influenced by the processor speed. // Set the usDelay value to 0 when only a set tuner PLL frequency operation takes place. // Argument : CAS_2B_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters - this parameter is a pointer the a struct that holds all the parameters needed for a // Cascade2B DSP channel change operation. Set the pstChannelChangeParameters value to NULL when only a set tuner PLL frequency operation takes place. // The struct fields are: // - TYPE_RECEIVER_MODE iReceiverMode: Describes to which receiver mode to change if needed. // - TYPE_CARRIER_ACQUISITION iCarrierAcquisition: Describes the carrier acquisition - normal, wide. // this parameter has to be set only for the VSB and QAM Annex B recievers // - TYPE_INVERSE_SPECTRUM iInverseSpectrum: Describes if inverse spectrum is on or off // this parameter has to be set only for the VSB recievers //----------------------------------------------------------------------------------------------------------- //unsigned int __stdcall SetChannel( CAS_2B_TUNER_PARAMETERS stTunerParameters,unsigned short usDelay,CAS_2B_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters); int DTT7611_Init(TUNER_INIT_PARAMETERS InitParam[2]); int DTT7611_SetChannel( CAS_2B_TUNER_PARAMETERS* pstTunerParameters,unsigned short usDelay,CAS_2B_CHANNEL_CHANGE_PARAMETERS* pstChannelChangeParameters); int DTT7611_GetInfo( CAS_2B_TUNER_GET_PARAMETERS* pstTunerParameters); #endif #endif