#include <usrp_basic.h>
Public Member Functions | |
~usrp_basic_rx () | |
bool | set_fpga_rx_sample_rate_divisor (unsigned int div) |
tell the fpga the rate rx samples are coming from the A/D's | |
int | read (void *buf, int len, bool *overrun) |
read data from the D/A's via the FPGA. len must be a multiple of 512 bytes. | |
virtual long | converter_rate () const |
sampling rate of A/D converter | |
long | adc_rate () const |
long | adc_freq () const |
deprecated method name | |
int | daughterboard_id (int which_dboard) const |
Return daughterboard ID for given Rx daughterboard slot [0,1]. | |
bool | set_pga (int which, double gain_in_db) |
Set Programmable Gain Amplifier (PGA). | |
double | pga (int which) const |
Return programmable gain amplifier gain setting in dB. | |
double | pga_min () const |
Return minimum legal PGA gain in dB. | |
double | pga_max () const |
Return maximum legal PGA gain in dB. | |
double | pga_db_per_step () const |
Return hardware step size of PGA (linear in dB). | |
bool | _write_oe (int which_dboard, int value, int mask) |
Write direction register (output enables) for pins that go to daughterboard. | |
bool | write_io (int which_dboard, int value, int mask) |
Write daughterboard i/o pin value. | |
bool | read_io (int which_dboard, int *value) |
Read daughterboard i/o pin value. | |
int | read_io (int which_dboard) |
Read daughterboard i/o pin value. | |
bool | write_aux_dac (int which_board, int which_dac, int value) |
Write auxiliary digital to analog converter. | |
bool | read_aux_adc (int which_dboard, int which_adc, int *value) |
Read auxiliary analog to digital converter. | |
int | read_aux_adc (int which_dboard, int which_adc) |
Read auxiliary analog to digital converter. | |
int | block_size () const |
returns current fusb block size | |
bool | set_dc_offset_cl_enable (int bits, int mask) |
Enable/disable automatic DC offset removal control loop in FPGA. | |
bool | start () |
Start data transfers. Called in base class to derived class order. | |
bool | stop () |
Stop data transfers. Called in base class to derived class order. | |
Static Public Member Functions | |
static usrp_basic_rx * | make (int which_board, int fusb_block_size=0, int fusb_nblocks=0, const std::string fpga_filename="", const std::string firmware_filename="") |
invokes constructor, returns instance or 0 if trouble | |
Protected Member Functions | |
usrp_basic_rx (int which_board, int fusb_block_size=0, int fusb_nblocks=0, const std::string fpga_filename="", const std::string firmware_filename="") | |
bool | set_rx_enable (bool on) |
bool | rx_enable () const |
bool | disable_rx () |
void | restore_rx (bool on) |
void | probe_rx_slots (bool verbose) |
int | dboard_to_slot (int dboard) |
Protected Attributes | |
int | d_dbid [2] |
usrp_basic_rx::usrp_basic_rx | ( | int | which_board, | |
int | fusb_block_size = 0 , |
|||
int | fusb_nblocks = 0 , |
|||
const std::string | fpga_filename = "" , |
|||
const std::string | firmware_filename = "" | |||
) | [protected] |
which_board | Which USRP board on usb (not particularly useful; use 0) | |
fusb_block_size | fast usb xfer block size. Must be a multiple of 512. Use zero for a reasonable default. | |
fusb_nblocks | number of fast usb URBs to allocate. Use zero for a reasonable default. |
References usrp_basic::_write_fpga_reg(), usrp_basic::d_udh, fusb_sysconfig::default_block_size(), fusb_sysconfig::make_devhandle(), fusb_devhandle::make_ephandle(), probe_rx_slots(), REG_RX_PWR_DN, set_dc_offset_cl_enable(), set_fpga_rx_sample_rate_divisor(), set_rx_enable(), usrp_9862_write(), usrp_9862_write_many_all(), and usrp_set_fpga_rx_reset().
Referenced by make().
usrp_basic_rx::~usrp_basic_rx | ( | ) |
References usrp_basic::d_udh, set_rx_enable(), fusb_ephandle::stop(), and usrp_9862_write_many_all().
bool usrp_basic_rx::_write_oe | ( | int | which_dboard, | |
int | value, | |||
int | mask | |||
) |
Write direction register (output enables) for pins that go to daughterboard.
which_dboard | [0,1] which d'board | |
value | value to write into register | |
mask | which bits of value to write into reg |
This register is initialized based on a value stored in the d'board EEPROM. In general, you shouldn't be using this routine without a very good reason. Using this method incorrectly will kill your USRP motherboard and/or daughterboard.
References usrp_basic::_write_fpga_reg(), and dboard_to_slot().
long usrp_basic_rx::adc_freq | ( | ) | const [inline] |
long usrp_basic_rx::adc_rate | ( | ) | const [inline] |
int usrp_basic_rx::block_size | ( | ) | const |
virtual long usrp_basic_rx::converter_rate | ( | ) | const [inline, virtual] |
sampling rate of A/D converter
References usrp_basic::fpga_master_clock_freq().
Referenced by adc_freq(), and adc_rate().
int usrp_basic_rx::daughterboard_id | ( | int | which_dboard | ) | const [inline] |
Return daughterboard ID for given Rx daughterboard slot [0,1].
which_dboard | [0,1] which Rx daughterboard |
-1 if no daugherboard
-2 if invalid EEPROM on daughterboard
References d_dbid.
int usrp_basic_rx::dboard_to_slot | ( | int | dboard | ) | [inline, protected] |
Referenced by _write_oe(), read_aux_adc(), write_aux_dac(), and write_io().
bool usrp_basic_rx::disable_rx | ( | ) | [protected] |
References rx_enable(), and set_rx_enable().
Referenced by usrp_standard_rx::set_decim_rate(), and usrp_standard_rx::write_hw_mux_reg().
usrp_basic_rx * usrp_basic_rx::make | ( | int | which_board, | |
int | fusb_block_size = 0 , |
|||
int | fusb_nblocks = 0 , |
|||
const std::string | fpga_filename = "" , |
|||
const std::string | firmware_filename = "" | |||
) | [static] |
invokes constructor, returns instance or 0 if trouble
which_board | Which USRP board on usb (not particularly useful; use 0) | |
fusb_block_size | fast usb xfer block size. Must be a multiple of 512. Use zero for a reasonable default. | |
fusb_nblocks | number of fast usb URBs to allocate. Use zero for a reasonable default. |
References usrp_basic_rx().
double usrp_basic_rx::pga | ( | int | which | ) | const |
Return programmable gain amplifier gain setting in dB.
which | which A/D [0,3] |
References usrp_basic::_read_9862(), pga_db_per_step(), pga_min(), and usrp_basic::READ_FAILED.
double usrp_basic_rx::pga_db_per_step | ( | ) | const [inline] |
double usrp_basic_rx::pga_max | ( | ) | const [inline] |
double usrp_basic_rx::pga_min | ( | ) | const [inline] |
void usrp_basic_rx::probe_rx_slots | ( | bool | verbose | ) | [protected] |
References usrp_basic::_write_fpga_reg(), d_dbid, usrp_basic::d_udh, usrp_dboard_eeprom::id, usrp_dboard_eeprom::oe, usrp_dboard_eeprom::offset, usrp_basic::set_adc_offset(), UDBE_BAD_SLOT, UDBE_INVALID_EEPROM, UDBE_NO_EEPROM, UDBE_OK, usrp_dbid_to_string(), and usrp_read_dboard_eeprom().
Referenced by usrp_basic_rx().
int usrp_basic_rx::read | ( | void * | buf, | |
int | len, | |||
bool * | overrun | |||
) |
read data from the D/A's via the FPGA. len
must be a multiple of 512 bytes.
References usrp_basic::d_bytes_per_poll, usrp_basic::d_udh, fusb_ephandle::read(), and usrp_check_rx_overrun().
int usrp_basic_rx::read_aux_adc | ( | int | which_dboard, | |
int | which_adc | |||
) |
Read auxiliary analog to digital converter.
which_dboard | [0,1] which d'board | |
which_adc | [0,1] |
Reimplemented from usrp_basic.
References dboard_to_slot(), and read_aux_adc().
bool usrp_basic_rx::read_aux_adc | ( | int | which_dboard, | |
int | which_adc, | |||
int * | value | |||
) |
Read auxiliary analog to digital converter.
which_dboard | [0,1] which d'board | |
which_adc | [0,1] | |
value | return 12-bit value [0,4095] |
Reimplemented from usrp_basic.
References dboard_to_slot().
Referenced by read_aux_adc().
int usrp_basic_rx::read_io | ( | int | which_dboard | ) |
Read daughterboard i/o pin value.
which_dboard | [0,1] which d'board |
References usrp_basic::READ_FAILED, and read_io().
bool usrp_basic_rx::read_io | ( | int | which_dboard, | |
int * | value | |||
) |
Read daughterboard i/o pin value.
which_dboard | [0,1] which d'board | |
value | output |
References usrp_basic::_read_fpga_reg().
Referenced by read_io().
void usrp_basic_rx::restore_rx | ( | bool | on | ) | [protected] |
References rx_enable(), and set_rx_enable().
Referenced by usrp_standard_rx::set_decim_rate(), and usrp_standard_rx::write_hw_mux_reg().
bool usrp_basic_rx::rx_enable | ( | ) | const [inline, protected] |
Referenced by disable_rx(), and restore_rx().
bool usrp_basic_rx::set_dc_offset_cl_enable | ( | int | bits, | |
int | mask | |||
) |
Enable/disable automatic DC offset removal control loop in FPGA.
bits | which control loops to enable | |
mask | which bits to pay attention to |
The 4 low bits are significant:
ADC0 = (1 << 0) ADC1 = (1 << 1) ADC2 = (1 << 2) ADC3 = (1 << 3)
By default the control loop is enabled on all ADC's.
References usrp_basic::_write_fpga_reg(), and usrp_basic::d_fpga_shadows.
Referenced by usrp_basic_rx().
bool usrp_basic_rx::set_fpga_rx_sample_rate_divisor | ( | unsigned int | div | ) |
tell the fpga the rate rx samples are coming from the A/D's
div = fpga_master_clock_freq () / sample_rate
sample_rate is determined by a myriad of registers in the 9862. That's why you have to tell us, so we can tell the fpga.
References usrp_basic::_write_fpga_reg().
Referenced by usrp_basic_rx().
bool usrp_basic_rx::set_pga | ( | int | which, | |
double | gain_in_db | |||
) |
Set Programmable Gain Amplifier (PGA).
which | which A/D [0,3] | |
gain_in_db | gain value (linear in dB) |
References usrp_basic::_read_9862(), usrp_basic::_write_9862(), pga_db_per_step(), pga_max(), pga_min(), and RX_X_BYPASS_INPUT_BUFFER.
Referenced by main().
bool usrp_basic_rx::set_rx_enable | ( | bool | on | ) | [protected] |
References usrp_basic::d_udh, and usrp_set_fpga_rx_enable().
Referenced by disable_rx(), restore_rx(), start(), stop(), usrp_basic_rx(), and ~usrp_basic_rx().
bool usrp_basic_rx::start | ( | ) |
Start data transfers. Called in base class to derived class order.
Reimplemented from usrp_basic.
Reimplemented in usrp_standard_rx.
References set_rx_enable(), fusb_ephandle::start(), and usrp_basic::start().
Referenced by usrp_standard_rx::start().
bool usrp_basic_rx::stop | ( | ) |
Stop data transfers. Called in base class to derived class order.
Reimplemented from usrp_basic.
Reimplemented in usrp_standard_rx.
References set_rx_enable(), and fusb_ephandle::stop().
bool usrp_basic_rx::write_aux_dac | ( | int | which_board, | |
int | which_dac, | |||
int | value | |||
) |
Write auxiliary digital to analog converter.
which_dboard | [0,1] which d'board N.B., SLOT_TX_A and SLOT_RX_A share the same AUX DAC's. SLOT_TX_B and SLOT_RX_B share the same AUX DAC's. | |
which_dac | [2,3] TX slots must use only 2 and 3. | |
value | [0,4095] |
Reimplemented from usrp_basic.
References dboard_to_slot().
bool usrp_basic_rx::write_io | ( | int | which_dboard, | |
int | value, | |||
int | mask | |||
) |
Write daughterboard i/o pin value.
which_dboard | [0,1] which d'board | |
value | value to write into register | |
mask | which bits of value to write into reg |
References usrp_basic::_write_fpga_reg(), and dboard_to_slot().
int usrp_basic_rx::d_dbid[2] [protected] |
Referenced by daughterboard_id(), and probe_rx_slots().