GNU Radio 3.3.0 C++ API
usrp_standard_rx Class Reference

The C++ interface the receive side of the USRPThis is the recommended interface to USRP receive functionality for applications that use the USRP but not GNU Radio. More...

#include <usrp_standard.h>

Inheritance diagram for usrp_standard_rx:

List of all members.

Public Types

enum  { FPGA_MODE_NORMAL = 0x00, FPGA_MODE_LOOPBACK = 0x01, FPGA_MODE_COUNTING = 0x02, FPGA_MODE_COUNTING_32BIT = 0x04 }

Public Member Functions

 ~usrp_standard_rx ()
bool set_decim_rate (unsigned int rate)
 Set decimator rate. rate MUST BE EVEN and in [8, 256].
bool set_nchannels (int nchannels)
 Set number of active channels. nchannels must be 1, 2 or 4.
bool set_mux (int mux)
 Set input mux configuration.
int determine_rx_mux_value (const usrp_subdev_spec &ss)
int determine_rx_mux_value (const usrp_subdev_spec &ss_a, const usrp_subdev_spec &ss_b)
bool set_rx_freq (int channel, double freq)
 set the frequency of the digital down converter.
bool set_fpga_mode (int mode)
 set fpga mode
bool set_ddc_phase (int channel, int phase)
 Set the digital down converter phase register.
bool set_format (unsigned int format)
 Specify Rx data format.
bool tune (int chan, db_base_sptr db, double target_freq, usrp_tune_result *result)
 High-level "tune" method. Works for the single channel case.
unsigned int decim_rate () const
double rx_freq (int channel) const
int nchannels () const
int mux () const
unsigned int format () const
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_standard_rx_sptr make (int which_board, unsigned int decim_rate, int nchan=1, int mux=-1, int mode=0, int fusb_block_size=0, int fusb_nblocks=0, const std::string fpga_filename="", const std::string firmware_filename="")
 invokes constructor, returns shared_ptr or shared_ptr equivalent of 0 if trouble
static unsigned int make_format (int width=16, int shift=0, bool want_q=true, bool bypass_halfband=false)
static int format_width (unsigned int format)
static int format_shift (unsigned int format)
static bool format_want_q (unsigned int format)
static bool format_bypass_halfband (unsigned int format)

Protected Member Functions

 usrp_standard_rx (int which_board, unsigned int decim_rate, int nchan=1, int mux=-1, int mode=0, int fusb_block_size=0, int fusb_nblocks=0, const std::string fpga_filename="", const std::string firmware_filename="")
bool write_hw_mux_reg ()

Detailed Description

The C++ interface the receive side of the USRP

This is the recommended interface to USRP receive functionality for applications that use the USRP but not GNU Radio.


Member Enumeration Documentation

anonymous enum
Enumerator:
FPGA_MODE_NORMAL 
FPGA_MODE_LOOPBACK 
FPGA_MODE_COUNTING 
FPGA_MODE_COUNTING_32BIT 

Constructor & Destructor Documentation

usrp_standard_rx::usrp_standard_rx ( int  which_board,
unsigned int  decim_rate,
int  nchan = 1,
int  mux = -1,
int  mode = 0,
int  fusb_block_size = 0,
int  fusb_nblocks = 0,
const std::string  fpga_filename = "",
const std::string  firmware_filename = "" 
) [protected]
usrp_standard_rx::~usrp_standard_rx ( )

Member Function Documentation

unsigned int usrp_standard_rx::decim_rate ( ) const
int usrp_standard_rx::determine_rx_mux_value ( const usrp_subdev_spec ss)

Determine the appropriate Rx mux value as a function of the subdevice choosen and the characteristics of the respective daughterboard.

int usrp_standard_rx::determine_rx_mux_value ( const usrp_subdev_spec ss_a,
const usrp_subdev_spec ss_b 
)
unsigned int usrp_standard_rx::format ( ) const
static bool usrp_standard_rx::format_bypass_halfband ( unsigned int  format) [static]
static int usrp_standard_rx::format_shift ( unsigned int  format) [static]
static bool usrp_standard_rx::format_want_q ( unsigned int  format) [static]
static int usrp_standard_rx::format_width ( unsigned int  format) [static]
static usrp_standard_rx_sptr usrp_standard_rx::make ( int  which_board,
unsigned int  decim_rate,
int  nchan = 1,
int  mux = -1,
int  mode = 0,
int  fusb_block_size = 0,
int  fusb_nblocks = 0,
const std::string  fpga_filename = "",
const std::string  firmware_filename = "" 
) [static]

invokes constructor, returns shared_ptr or shared_ptr equivalent of 0 if trouble

Parameters:
which_boardWhich USRP board on usb (not particularly useful; use 0)
decim_ratedecimation factor
nchannumber of channels
muxRx mux setting,
See also:
set_mux
Parameters:
modemode
fusb_block_sizefast usb xfer block size. Must be a multiple of 512. Use zero for a reasonable default.
fusb_nblocksnumber of fast usb URBs to allocate. Use zero for a reasonable default.
fpga_filenameName of rbf file to load
firmware_filenameName of ihx file to load
static unsigned int usrp_standard_rx::make_format ( int  width = 16,
int  shift = 0,
bool  want_q = true,
bool  bypass_halfband = false 
) [static]
int usrp_standard_rx::mux ( ) const
int usrp_standard_rx::nchannels ( ) const
double usrp_standard_rx::rx_freq ( int  channel) const
bool usrp_standard_rx::set_ddc_phase ( int  channel,
int  phase 
)

Set the digital down converter phase register.

Parameters:
channelwhich ddc channel [0, 3]
phase32-bit integer phase value.
bool usrp_standard_rx::set_decim_rate ( unsigned int  rate)

Set decimator rate. rate MUST BE EVEN and in [8, 256].

The final complex sample rate across the USB is adc_freq () / decim_rate () * nchannels ()

bool usrp_standard_rx::set_format ( unsigned int  format)

Specify Rx data format.

Parameters:
formatformat specifier

Rx data format control register

3 2 1 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +-----------------------------------------+-+-+---------+-------+ | Reserved (Must be zero) |B|Q| WIDTH | SHIFT | +-----------------------------------------+-+-+---------+-------+

SHIFT specifies arithmetic right shift [0, 15] WIDTH specifies bit-width of I & Q samples across the USB [1, 16] (not all valid) Q if set deliver both I & Q, else just I B if set bypass half-band filter.

Right now the acceptable values are:

B Q WIDTH SHIFT 0 1 16 0 0 1 8 8

More valid combos to come.

Default value is 0x00000300 16-bits, 0 shift, deliver both I & Q.

bool usrp_standard_rx::set_fpga_mode ( int  mode)

set fpga mode

bool usrp_standard_rx::set_mux ( int  mux)

Set input mux configuration.

This determines which ADC (or constant zero) is connected to each DDC input. There are 4 DDCs. Each has two inputs.

 Mux value:
    3                   2                   1                       
  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
 +-------+-------+-------+-------+-------+-------+-------+-------+
 |   Q3  |   I3  |   Q2  |   I2  |   Q1  |   I1  |   Q0  |   I0  |
 +-------+-------+-------+-------+-------+-------+-------+-------+
 Each 4-bit I field is either 0,1,2,3
 Each 4-bit Q field is either 0,1,2,3 or 0xf (input is const zero)
 All Q's must be 0xf or none of them may be 0xf
 
bool usrp_standard_rx::set_nchannels ( int  nchannels)

Set number of active channels. nchannels must be 1, 2 or 4.

The final complex sample rate across the USB is adc_freq () / decim_rate () * nchannels ()

bool usrp_standard_rx::set_rx_freq ( int  channel,
double  freq 
)

set the frequency of the digital down converter.

channel must be in the range [0,3]. freq is the center frequency in Hz. freq may be either negative or postive. The frequency specified is quantized. Use rx_freq to retrieve the actual value used.

bool usrp_standard_rx::start ( )

Start data transfers. Called in base class to derived class order.

Reimplemented from usrp_basic_rx.

bool usrp_standard_rx::stop ( )

Stop data transfers. Called in base class to derived class order.

Reimplemented from usrp_basic_rx.

bool usrp_standard_rx::tune ( int  chan,
db_base_sptr  db,
double  target_freq,
usrp_tune_result result 
)

High-level "tune" method. Works for the single channel case.

This method adjusts both the daughterboard LO and the DDC so that target_freq ends up at DC in the complex baseband samples.

Parameters:
chanwhich DDC channel we're controlling (almost always 0).
dbthe daughterboard we're controlling.
target_freqthe RF frequency we want at DC in the complex baseband.
[out]resultdetails how the hardware was configured.
Returns:
true iff everything was successful.
bool usrp_standard_rx::write_hw_mux_reg ( ) [protected]

The documentation for this class was generated from the following file: