gr-baz Package
rtl2832-tuner_fc2580.h
Go to the documentation of this file.
00001 #ifndef __TUNER_FC2580_H
00002 #define __TUNER_FC2580_H
00003 
00004 #include "rtl2832.h"
00005 
00006 namespace RTL2832_NAMESPACE
00007 {
00008 namespace TUNERS_NAMESPACE
00009 {
00010 
00011 class fc2580 : public RTL2832_NAMESPACE::tuner_skeleton
00012 {
00013 IMPLEMENT_INLINE_TUNER_FACTORY(fc2580)
00014 public:
00015         fc2580(demod* p);
00016 public:
00017         inline virtual const char* name() const
00018         { return "Fitipower FC2580"; }
00019 public:
00020         int initialise(tuner::PPARAMS params = NULL);
00021         int set_frequency(double freq);
00022         int set_bandwidth(double bw);
00023         int set_gain(double gain);
00024 };
00025 
00026 }
00027 }
00028 
00029 #define BORDER_FREQ     2600000 //2.6GHz : The border frequency which determines whether Low VCO or High VCO is used
00030 #define USE_EXT_CLK     0       //0 : Use internal XTAL Oscillator / 1 : Use External Clock input
00031 #define OFS_RSSI 57
00032 
00033 #define FC2580_I2C_ADDR         0xac
00034 #define FC2580_CHECK_ADDR       0x01
00035 #define FC2580_CHECK_VAL        0x56
00036 
00037 typedef enum {
00038         FC2580_UHF_BAND,
00039         FC2580_L_BAND,
00040         FC2580_VHF_BAND,
00041         FC2580_NO_BAND
00042 } fc2580_band_type;
00043 
00044 typedef int fc2580_fci_result_type;
00045 
00046 #define FC2580_FCI_FAIL         0
00047 #define FC2580_FCI_SUCCESS      1
00048 
00049 enum FUNCTION_STATUS
00050 {
00051         FUNCTION_SUCCESS,
00052         FUNCTION_ERROR,
00053 };
00054 
00055 extern void fc2580_wait_msec(RTL2832_NAMESPACE::tuner* pTuner, int a);
00056 /*
00057 fc2580_fci_result_type fc2580_i2c_write(RTL2832_NAMESPACE::tuner* pTuner, unsigned char reg, unsigned char val);
00058 fc2580_fci_result_type fc2580_i2c_read(RTL2832_NAMESPACE::tuner* pTuner, unsigned char reg, unsigned char *read_data);
00059 */
00060 /*==============================================================================
00061        fc2580 initial setting
00062 
00063   This function is a generic function which gets called to initialize
00064 
00065   fc2580 in DVB-H mode or L-Band TDMB mode
00066 
00067   <input parameter>
00068 
00069   ifagc_mode
00070     type : integer
00071         1 : Internal AGC
00072         2 : Voltage Control Mode
00073 
00074 ==============================================================================*/
00075 fc2580_fci_result_type fc2580_set_init(RTL2832_NAMESPACE::tuner* pTuner, int ifagc_mode, unsigned int freq_xtal );
00076 
00077 /*==============================================================================
00078        fc2580 frequency setting
00079 
00080   This function is a generic function which gets called to change LO Frequency
00081 
00082   of fc2580 in DVB-H mode or L-Band TDMB mode
00083 
00084   <input parameter>
00085 
00086   f_lo
00087         Value of target LO Frequency in 'kHz' unit
00088         ex) 2.6GHz = 2600000
00089 
00090 ==============================================================================*/
00091 fc2580_fci_result_type fc2580_set_freq(RTL2832_NAMESPACE::tuner* pTuner, unsigned int f_lo, unsigned int freq_xtal );
00092 
00093 
00094 /*==============================================================================
00095        fc2580 filter BW setting
00096 
00097   This function is a generic function which gets called to change Bandwidth
00098 
00099   frequency of fc2580's channel selection filter
00100 
00101   <input parameter>
00102 
00103   filter_bw
00104     1 : 1.53MHz(TDMB)
00105         6 : 6MHz
00106         7 : 7MHz
00107         8 : 7.8MHz
00108 
00109 
00110 ==============================================================================*/
00111 fc2580_fci_result_type fc2580_set_filter( RTL2832_NAMESPACE::tuner* pTuner, unsigned char filter_bw, unsigned int freq_xtal );
00112 
00113 // The following context is FC2580 tuner API source code
00114 // Definitions
00115 
00116 // AGC mode
00117 enum FC2580_AGC_MODE
00118 {
00119         FC2580_AGC_INTERNAL = 1,
00120         FC2580_AGC_EXTERNAL = 2,
00121 };
00122 
00123 
00124 // Bandwidth mode
00125 enum FC2580_BANDWIDTH_MODE
00126 {
00127         FC2580_BANDWIDTH_1530000HZ = 1,
00128         FC2580_BANDWIDTH_6000000HZ = 6,
00129         FC2580_BANDWIDTH_7000000HZ = 7,
00130         FC2580_BANDWIDTH_8000000HZ = 8,
00131 };
00132 
00133 // Manipulaing functions
00134 int
00135 fc2580_Initialize(
00136         RTL2832_NAMESPACE::tuner* pTuner
00137         );
00138 
00139 int
00140 fc2580_SetRfFreqHz(
00141         RTL2832_NAMESPACE::tuner* pTuner,
00142         unsigned long RfFreqHz
00143         );
00144 
00145 // Extra manipulaing functions
00146 int
00147 fc2580_SetBandwidthMode(
00148         RTL2832_NAMESPACE::tuner* pTuner,
00149         int BandwidthMode
00150         );
00151 
00152 #endif