gr-baz Package

Classes | Namespaces | Macros | Enumerations | Functions
rtl2832-tuner_e4000.h File Reference

E4000 tuner module declaration One can manipulate E4000 tuner through E4000 module. E4000 module is derived from tuner module. More...

`#include "rtl2832.h"`
Include dependency graph for rtl2832-tuner_e4000.h:

Go to the source code of this file.

## Classes
class | RTL2832_NAMESPACE::TUNERS_NAMESPACE::e4000

## Namespaces
namespace | RTL2832_NAMESPACE
namespace | RTL2832_NAMESPACE::TUNERS_NAMESPACE

## Macros
#define | E4000_1_SUCCESS 1
#define | E4000_1_FAIL 0
#define | E4000_I2C_SUCCESS 1
#define | E4000_I2C_FAIL 0
#define | RTL2832_E4000_ADDITIONAL_INIT_REG_TABLE_LEN 34
#define | RTL2832_E4000_LNA_GAIN_TABLE_LEN 16
#define | RTL2832_E4000_LNA_GAIN_ADD_TABLE_LEN 8
#define | RTL2832_E4000_MIXER_GAIN_TABLE_LEN 2
#define | RTL2832_E4000_IF_STAGE_1_GAIN_TABLE_LEN 2
#define | RTL2832_E4000_IF_STAGE_2_GAIN_TABLE_LEN 4
#define | RTL2832_E4000_IF_STAGE_3_GAIN_TABLE_LEN 4
#define | RTL2832_E4000_IF_STAGE_4_GAIN_TABLE_LEN 4
#define | RTL2832_E4000_IF_STAGE_5_GAIN_TABLE_LEN 8
#define | RTL2832_E4000_IF_STAGE_6_GAIN_TABLE_LEN 8
#define | RTL2832_E4000_LNA_GAIN_BAND_NUM 2
#define | RTL2832_E4000_MIXER_GAIN_BAND_NUM 2
#define | RTL2832_E4000_RF_BAND_BOUNDARY_HZ 300000000
#define | RTL2832_E4000_LNA_GAIN_ADDR 0x14
#define | RTL2832_E4000_LNA_GAIN_MASK 0xf
#define | RTL2832_E4000_LNA_GAIN_SHIFT 0
#define | RTL2832_E4000_LNA_GAIN_ADD_ADDR 0x24
#define | RTL2832_E4000_LNA_GAIN_ADD_MASK 0x7
#define | RTL2832_E4000_LNA_GAIN_ADD_SHIFT 0
#define | RTL2832_E4000_MIXER_GAIN_ADDR 0x15
#define | RTL2832_E4000_MIXER_GAIN_MASK 0x1
#define | RTL2832_E4000_MIXER_GAIN_SHIFT 0
#define | RTL2832_E4000_IF_STAGE_1_GAIN_ADDR 0x16
#define | RTL2832_E4000_IF_STAGE_1_GAIN_MASK 0x1
#define | RTL2832_E4000_IF_STAGE_1_GAIN_SHIFT 0
#define | RTL2832_E4000_IF_STAGE_2_GAIN_ADDR 0x16
#define | RTL2832_E4000_IF_STAGE_2_GAIN_MASK 0x6
#define | RTL2832_E4000_IF_STAGE_2_GAIN_SHIFT 1
#define | RTL2832_E4000_IF_STAGE_3_GAIN_ADDR 0x16
#define | RTL2832_E4000_IF_STAGE_3_GAIN_MASK 0x18
#define | RTL2832_E4000_IF_STAGE_3_GAIN_SHIFT 3
#define | RTL2832_E4000_IF_STAGE_4_GAIN_ADDR 0x16
#define | RTL2832_E4000_IF_STAGE_4_GAIN_MASK 0x60
#define | RTL2832_E4000_IF_STAGE_4_GAIN_SHIFT 5
#define | RTL2832_E4000_IF_STAGE_5_GAIN_ADDR 0x17
#define | RTL2832_E4000_IF_STAGE_5_GAIN_MASK 0x7
#define | RTL2832_E4000_IF_STAGE_5_GAIN_SHIFT 0
#define | RTL2832_E4000_IF_STAGE_6_GAIN_ADDR 0x17
#define | RTL2832_E4000_IF_STAGE_6_GAIN_MASK 0x38
#define | RTL2832_E4000_IF_STAGE_6_GAIN_SHIFT 3
#define | RTL2832_E4000_TUNER_OUTPUT_POWER_UNIT_0P1_DBM -100
#define | RTL2832_E4000_TUNER_MODE_UPDATE_WAIT_TIME_MS 1000

## Enumerations
enum | RTL2832_E4000_TUNER_GAIN_MODE { RTL2832_E4000_TUNER_GAIN_SENSITIVE = RTL2832_NAMESPACE::tuner::DEFAULT , RTL2832_E4000_TUNER_GAIN_NORMAL , RTL2832_E4000_TUNER_GAIN_LINEAR }

## Functions
int | tunerreset (RTL2832_NAMESPACE::tuner *pTuner)
int | Tunerclock (RTL2832_NAMESPACE::tuner *pTuner)
int | Qpeak (RTL2832_NAMESPACE::tuner *pTuner)
int | DCoffloop (RTL2832_NAMESPACE::tuner *pTuner)
int | GainControlinit (RTL2832_NAMESPACE::tuner *pTuner)
int | Gainmanual (RTL2832_NAMESPACE::tuner *pTuner)
int | E4000_gain_freq (RTL2832_NAMESPACE::tuner *pTuner, int frequency)
int | PLL (RTL2832_NAMESPACE::tuner *pTuner, int Ref_clk, int Freq)
int | LNAfilter (RTL2832_NAMESPACE::tuner *pTuner, int Freq)
int | IFfilter (RTL2832_NAMESPACE::tuner *pTuner, int bandwidth, int Ref_clk)
int | freqband (RTL2832_NAMESPACE::tuner *pTuner, int Freq)
int | DCoffLUT (RTL2832_NAMESPACE::tuner *pTuner)
int | GainControlauto (RTL2832_NAMESPACE::tuner *pTuner)
int | E4000_sensitivity (RTL2832_NAMESPACE::tuner *pTuner, int Freq, int bandwidth)
int | E4000_linearity (RTL2832_NAMESPACE::tuner *pTuner, int Freq, int bandwidth)
int | E4000_high_linearity (RTL2832_NAMESPACE::tuner *pTuner)
int | E4000_nominal (RTL2832_NAMESPACE::tuner *pTuner, int Freq, int bandwidth)
void | e4000_GetTunerType (RTL2832_NAMESPACE::tuner *pTuner, int *pTunerType)
void | e4000_GetDeviceAddr (RTL2832_NAMESPACE::tuner *pTuner, unsigned char *pDeviceAddr)
int | e4000_Initialize (RTL2832_NAMESPACE::tuner *pTuner, bool enable_dc_offset_loop=true, bool set_manual_gain=false)
int | e4000_SetRfFreqHz (RTL2832_NAMESPACE::tuner *pTuner, unsigned long RfFreqHz, bool update_gain_control=true, bool enable_dc_offset_lut=true)
int | e4000_GetRfFreqHz (RTL2832_NAMESPACE::tuner *pTuner, unsigned long *pRfFreqHz)
int | e4000_GetRegByte (RTL2832_NAMESPACE::tuner *pTuner, unsigned char RegAddr, unsigned char *pReadingByte)
int | e4000_SetBandwidthHz (RTL2832_NAMESPACE::tuner *pTuner, unsigned long BandwidthHz)
int | e4000_GetBandwidthHz (RTL2832_NAMESPACE::tuner *pTuner, unsigned long *pBandwidthHz)

## Detailed Description

E4000 tuner module declaration One can manipulate E4000 tuner through E4000 module. E4000 module is derived from tuner module.

Example:
  // The example is the same as the tuner example in tuner_base.h except the listed lines.
  #include "tuner_e4000.h"
  ...
  int main(void)
  {
  TUNER_MODULE *pTuner;
  E4000_EXTRA_MODULE *pTunerExtra;
  TUNER_MODULE TunerModuleMemory;
  BASE_INTERFACE_MODULE BaseInterfaceModuleMemory;
  // I2C_BRIDGE_MODULE I2cBridgeModuleMemory;
  unsigned long BandwidthMode;
  ...
  // Build E4000 tuner module.
  BuildE4000Module(
  &pTuner,
  &TunerModuleMemory,
  &BaseInterfaceModuleMemory,
  &I2cBridgeModuleMemory,
  0xac, // I2C device address is 0xac in 8-bit format.
  CRYSTAL_FREQ_16384000HZ, // Crystal frequency is 16.384 MHz.
  E4000_AGC_INTERNAL // The E4000 AGC mode is internal AGC mode.
  );
  // Get E4000 tuner extra module.
  pTunerExtra = (T2266_EXTRA_MODULE *)(pTuner->pExtra);
  // ==== Initialize tuner and set its parameters =====
  ...
  // Set E4000 bandwidth.
  pTunerExtra->SetBandwidthMode(pTuner, E4000_BANDWIDTH_6MHZ);
  // ==== Get tuner information =====
  ...
  // Get E4000 bandwidth.
  pTunerExtra->GetBandwidthMode(pTuner, &BandwidthMode);
  // See the example for other tuner functions in tuner_base.h
  return 0;
  }

## Macro Definition Documentation

## ◆ E4000_1_FAIL

#define E4000_1_FAIL 0

## ◆ E4000_1_SUCCESS

#define E4000_1_SUCCESS 1

## ◆ E4000_I2C_FAIL

#define E4000_I2C_FAIL 0

## ◆ E4000_I2C_SUCCESS

#define E4000_I2C_SUCCESS 1

## ◆ RTL2832_E4000_ADDITIONAL_INIT_REG_TABLE_LEN

#define RTL2832_E4000_ADDITIONAL_INIT_REG_TABLE_LEN 34

## ◆ RTL2832_E4000_IF_STAGE_1_GAIN_ADDR

#define RTL2832_E4000_IF_STAGE_1_GAIN_ADDR 0x16

## ◆ RTL2832_E4000_IF_STAGE_1_GAIN_MASK

#define RTL2832_E4000_IF_STAGE_1_GAIN_MASK 0x1

## ◆ RTL2832_E4000_IF_STAGE_1_GAIN_SHIFT

#define RTL2832_E4000_IF_STAGE_1_GAIN_SHIFT 0

## ◆ RTL2832_E4000_IF_STAGE_1_GAIN_TABLE_LEN

#define RTL2832_E4000_IF_STAGE_1_GAIN_TABLE_LEN 2

## ◆ RTL2832_E4000_IF_STAGE_2_GAIN_ADDR

#define RTL2832_E4000_IF_STAGE_2_GAIN_ADDR 0x16

## ◆ RTL2832_E4000_IF_STAGE_2_GAIN_MASK

#define RTL2832_E4000_IF_STAGE_2_GAIN_MASK 0x6

## ◆ RTL2832_E4000_IF_STAGE_2_GAIN_SHIFT

#define RTL2832_E4000_IF_STAGE_2_GAIN_SHIFT 1

## ◆ RTL2832_E4000_IF_STAGE_2_GAIN_TABLE_LEN

#define RTL2832_E4000_IF_STAGE_2_GAIN_TABLE_LEN 4

## ◆ RTL2832_E4000_IF_STAGE_3_GAIN_ADDR

#define RTL2832_E4000_IF_STAGE_3_GAIN_ADDR 0x16

## ◆ RTL2832_E4000_IF_STAGE_3_GAIN_MASK

#define RTL2832_E4000_IF_STAGE_3_GAIN_MASK 0x18

## ◆ RTL2832_E4000_IF_STAGE_3_GAIN_SHIFT

#define RTL2832_E4000_IF_STAGE_3_GAIN_SHIFT 3

## ◆ RTL2832_E4000_IF_STAGE_3_GAIN_TABLE_LEN

#define RTL2832_E4000_IF_STAGE_3_GAIN_TABLE_LEN 4

## ◆ RTL2832_E4000_IF_STAGE_4_GAIN_ADDR

#define RTL2832_E4000_IF_STAGE_4_GAIN_ADDR 0x16

## ◆ RTL2832_E4000_IF_STAGE_4_GAIN_MASK

#define RTL2832_E4000_IF_STAGE_4_GAIN_MASK 0x60

## ◆ RTL2832_E4000_IF_STAGE_4_GAIN_SHIFT

#define RTL2832_E4000_IF_STAGE_4_GAIN_SHIFT 5

## ◆ RTL2832_E4000_IF_STAGE_4_GAIN_TABLE_LEN

#define RTL2832_E4000_IF_STAGE_4_GAIN_TABLE_LEN 4

## ◆ RTL2832_E4000_IF_STAGE_5_GAIN_ADDR

#define RTL2832_E4000_IF_STAGE_5_GAIN_ADDR 0x17

## ◆ RTL2832_E4000_IF_STAGE_5_GAIN_MASK

#define RTL2832_E4000_IF_STAGE_5_GAIN_MASK 0x7

## ◆ RTL2832_E4000_IF_STAGE_5_GAIN_SHIFT

#define RTL2832_E4000_IF_STAGE_5_GAIN_SHIFT 0

## ◆ RTL2832_E4000_IF_STAGE_5_GAIN_TABLE_LEN

#define RTL2832_E4000_IF_STAGE_5_GAIN_TABLE_LEN 8

## ◆ RTL2832_E4000_IF_STAGE_6_GAIN_ADDR

#define RTL2832_E4000_IF_STAGE_6_GAIN_ADDR 0x17

## ◆ RTL2832_E4000_IF_STAGE_6_GAIN_MASK

#define RTL2832_E4000_IF_STAGE_6_GAIN_MASK 0x38

## ◆ RTL2832_E4000_IF_STAGE_6_GAIN_SHIFT

#define RTL2832_E4000_IF_STAGE_6_GAIN_SHIFT 3

## ◆ RTL2832_E4000_IF_STAGE_6_GAIN_TABLE_LEN

#define RTL2832_E4000_IF_STAGE_6_GAIN_TABLE_LEN 8

## ◆ RTL2832_E4000_LNA_GAIN_ADD_ADDR

#define RTL2832_E4000_LNA_GAIN_ADD_ADDR 0x24

## ◆ RTL2832_E4000_LNA_GAIN_ADD_MASK

#define RTL2832_E4000_LNA_GAIN_ADD_MASK 0x7

## ◆ RTL2832_E4000_LNA_GAIN_ADD_SHIFT

#define RTL2832_E4000_LNA_GAIN_ADD_SHIFT 0

## ◆ RTL2832_E4000_LNA_GAIN_ADD_TABLE_LEN

#define RTL2832_E4000_LNA_GAIN_ADD_TABLE_LEN 8

## ◆ RTL2832_E4000_LNA_GAIN_ADDR

#define RTL2832_E4000_LNA_GAIN_ADDR 0x14

## ◆ RTL2832_E4000_LNA_GAIN_BAND_NUM

#define RTL2832_E4000_LNA_GAIN_BAND_NUM 2

## ◆ RTL2832_E4000_LNA_GAIN_MASK

#define RTL2832_E4000_LNA_GAIN_MASK 0xf

## ◆ RTL2832_E4000_LNA_GAIN_SHIFT

#define RTL2832_E4000_LNA_GAIN_SHIFT 0

## ◆ RTL2832_E4000_LNA_GAIN_TABLE_LEN

#define RTL2832_E4000_LNA_GAIN_TABLE_LEN 16

## ◆ RTL2832_E4000_MIXER_GAIN_ADDR

#define RTL2832_E4000_MIXER_GAIN_ADDR 0x15

## ◆ RTL2832_E4000_MIXER_GAIN_BAND_NUM

#define RTL2832_E4000_MIXER_GAIN_BAND_NUM 2

## ◆ RTL2832_E4000_MIXER_GAIN_MASK

#define RTL2832_E4000_MIXER_GAIN_MASK 0x1

## ◆ RTL2832_E4000_MIXER_GAIN_SHIFT

#define RTL2832_E4000_MIXER_GAIN_SHIFT 0

## ◆ RTL2832_E4000_MIXER_GAIN_TABLE_LEN

#define RTL2832_E4000_MIXER_GAIN_TABLE_LEN 2

## ◆ RTL2832_E4000_RF_BAND_BOUNDARY_HZ

#define RTL2832_E4000_RF_BAND_BOUNDARY_HZ 300000000

## ◆ RTL2832_E4000_TUNER_MODE_UPDATE_WAIT_TIME_MS

#define RTL2832_E4000_TUNER_MODE_UPDATE_WAIT_TIME_MS 1000

## ◆ RTL2832_E4000_TUNER_OUTPUT_POWER_UNIT_0P1_DBM

#define RTL2832_E4000_TUNER_OUTPUT_POWER_UNIT_0P1_DBM -100

## Enumeration Type Documentation

## ◆ RTL2832_E4000_TUNER_GAIN_MODE

enum RTL2832_E4000_TUNER_GAIN_MODE

Enumerator
RTL2832_E4000_TUNER_GAIN_SENSITIVE |
RTL2832_E4000_TUNER_GAIN_NORMAL |
RTL2832_E4000_TUNER_GAIN_LINEAR |

## Function Documentation

## ◆ DCoffloop()

int DCoffloop | ( | RTL2832_NAMESPACE::tuner * | pTuner | ) |

## ◆ DCoffLUT()

int DCoffLUT | ( | RTL2832_NAMESPACE::tuner * | pTuner | ) |

## ◆ E4000_gain_freq()

int E4000_gain_freq | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | int | frequency
| ) |  |

## ◆ e4000_GetBandwidthHz()

int e4000_GetBandwidthHz | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | unsigned long * | pBandwidthHz
| ) |  |

## ◆ e4000_GetDeviceAddr()

void e4000_GetDeviceAddr | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | unsigned char * | pDeviceAddr
| ) |  |

## ◆ e4000_GetRegByte()

int e4000_GetRegByte | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | unsigned char | RegAddr,
|  | unsigned char * | pReadingByte
| ) |  |

## ◆ e4000_GetRfFreqHz()

int e4000_GetRfFreqHz | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | unsigned long * | pRfFreqHz
| ) |  |

## ◆ e4000_GetTunerType()

void e4000_GetTunerType | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | int * | pTunerType
| ) |  |

## ◆ E4000_high_linearity()

int E4000_high_linearity | ( | RTL2832_NAMESPACE::tuner * | pTuner | ) |

## ◆ e4000_Initialize()

int e4000_Initialize | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | bool | enable_dc_offset_loop = `true`,
|  | bool | set_manual_gain = `false`
| ) |  |

## ◆ E4000_linearity()

int E4000_linearity | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | int | Freq,
|  | int | bandwidth
| ) |  |

## ◆ E4000_nominal()

int E4000_nominal | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | int | Freq,
|  | int | bandwidth
| ) |  |

## ◆ E4000_sensitivity()

int E4000_sensitivity | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | int | Freq,
|  | int | bandwidth
| ) |  |

## ◆ e4000_SetBandwidthHz()

int e4000_SetBandwidthHz | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | unsigned long | BandwidthHz
| ) |  |

## ◆ e4000_SetRfFreqHz()

int e4000_SetRfFreqHz | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | unsigned long | RfFreqHz,
|  | bool | update_gain_control = `true`,
|  | bool | enable_dc_offset_lut = `true`
| ) |  |

## ◆ freqband()

int freqband | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | int | Freq
| ) |  |

## ◆ GainControlauto()

int GainControlauto | ( | RTL2832_NAMESPACE::tuner * | pTuner | ) |

## ◆ GainControlinit()

int GainControlinit | ( | RTL2832_NAMESPACE::tuner * | pTuner | ) |

## ◆ Gainmanual()

int Gainmanual | ( | RTL2832_NAMESPACE::tuner * | pTuner | ) |

## ◆ IFfilter()

int IFfilter | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | int | bandwidth,
|  | int | Ref_clk
| ) |  |

## ◆ LNAfilter()

int LNAfilter | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | int | Freq
| ) |  |

## ◆ PLL()

int PLL | ( | RTL2832_NAMESPACE::tuner * | pTuner,
|  | int | Ref_clk,
|  | int | Freq
| ) |  |

## ◆ Qpeak()

int Qpeak | ( | RTL2832_NAMESPACE::tuner * | pTuner | ) |

## ◆ Tunerclock()

int Tunerclock | ( | RTL2832_NAMESPACE::tuner * | pTuner | ) |

## ◆ tunerreset()

int tunerreset | ( | RTL2832_NAMESPACE::tuner * | pTuner | ) |