The C++ interface the transmit side of the USRPThis is the recommended interface to USRP transmit functionality for applications that use the USRP but not GNU Radio. More...
#include <usrp_standard.h>
Public Types | |
enum | coarse_mod_t { CM_NEG_FDAC_OVER_4, CM_NEG_FDAC_OVER_8, CM_OFF, CM_POS_FDAC_OVER_8, CM_POS_FDAC_OVER_4 } |
Public Member Functions | |
~usrp_standard_tx () | |
virtual bool | set_interp_rate (unsigned int rate) |
Set interpolator rate. rate must be in [4, 512] and a multiple of 4. | |
bool | set_nchannels (int nchannels) |
Set number of active channels. nchannels must be 1 or 2. | |
bool | set_mux (int mux) |
Set output mux configuration. | |
int | determine_tx_mux_value (const usrp_subdev_spec &ss) |
int | determine_tx_mux_value (const usrp_subdev_spec &ss_a, const usrp_subdev_spec &ss_b) |
virtual bool | set_tx_freq (int channel, double freq) |
set the frequency of the digital up converter. | |
unsigned int | interp_rate () const |
double | tx_freq (int channel) const |
int | nchannels () const |
int | mux () const |
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. | |
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_tx_sptr | make (int which_board, unsigned int interp_rate, int nchan=1, int mux=-1, 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 | |
Protected Member Functions | |
virtual bool | set_coarse_modulator (int channel, coarse_mod_t cm) |
usrp_standard_tx::coarse_mod_t | coarse_modulator (int channel) const |
usrp_standard_tx (int which_board, unsigned int interp_rate, int nchan=1, int mux=-1, int fusb_block_size=0, int fusb_nblocks=0, const std::string fpga_filename="", const std::string firmware_filename="") | |
bool | write_hw_mux_reg () |
Protected Attributes | |
unsigned int | d_interp_rate |
int | d_nchan |
int | d_sw_mux |
int | d_hw_mux |
double | d_tx_freq [MAX_CHAN] |
coarse_mod_t | d_coarse_mod [MAX_CHAN] |
unsigned char | d_tx_modulator_shadow [MAX_CHAN] |
Static Protected Attributes | |
static const int | MAX_CHAN = 2 |
The C++ interface the transmit side of the USRP
This is the recommended interface to USRP transmit functionality for applications that use the USRP but not GNU Radio.
Uses digital upconverter (coarse & fine modulators) in AD9862...
usrp_standard_tx::usrp_standard_tx | ( | int | which_board, | |
unsigned int | interp_rate, | |||
int | nchan = 1 , |
|||
int | mux = -1 , |
|||
int | fusb_block_size = 0 , |
|||
int | fusb_nblocks = 0 , |
|||
const std::string | fpga_filename = "" , |
|||
const std::string | firmware_filename = "" | |||
) | [protected] |
References CM_OFF, d_coarse_mod, d_tx_modulator_shadow, usrp_basic::d_udh, MAX_CHAN, set_interp_rate(), set_mux(), set_nchannels(), set_tx_freq(), TX_MODULATOR_COARSE_MODULATION_NONE, TX_MODULATOR_DISABLE_NCO, and usrp_9862_write_many_all().
Referenced by make().
usrp_standard_tx::~usrp_standard_tx | ( | ) |
usrp_standard_tx::coarse_mod_t usrp_standard_tx::coarse_modulator | ( | int | channel | ) | const [protected] |
References CM_OFF, d_coarse_mod, and MAX_CHAN.
int usrp_standard_tx::determine_tx_mux_value | ( | const usrp_subdev_spec & | ss_a, | |
const usrp_subdev_spec & | ss_b | |||
) |
References determine_tx_mux_value(), usrp_subdev_spec::side, and usrp_subdev_spec::subdev.
int usrp_standard_tx::determine_tx_mux_value | ( | const usrp_subdev_spec & | ss | ) |
Determine the appropriate Tx mux value as a function of the subdevice choosen and the characteristics of the respective daughterboard.
References usrp_basic::db(), usrp_basic::is_valid(), usrp_subdev_spec::side, and usrp_subdev_spec::subdev.
Referenced by determine_tx_mux_value().
unsigned int usrp_standard_tx::interp_rate | ( | ) | const |
References d_interp_rate.
usrp_standard_tx_sptr usrp_standard_tx::make | ( | int | which_board, | |
unsigned int | interp_rate, | |||
int | nchan = 1 , |
|||
int | mux = -1 , |
|||
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
which_board | Which USRP board on usb (not particularly useful; use 0) | |
interp_rate | interpolation factor | |
nchan | number of channels | |
mux | Tx mux setting, |
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. | |
fpga_filename | Name of rbf file to load | |
firmware_filename | Name of ihx file to load |
References usrp_standard_tx().
Referenced by main().
int usrp_standard_tx::mux | ( | ) | const |
References d_sw_mux.
int usrp_standard_tx::nchannels | ( | ) | const |
References d_nchan.
Referenced by set_interp_rate().
bool usrp_standard_tx::set_coarse_modulator | ( | int | channel, | |
coarse_mod_t | cm | |||
) | [protected, virtual] |
References CM_NEG_FDAC_OVER_4, CM_NEG_FDAC_OVER_8, CM_OFF, CM_POS_FDAC_OVER_4, CM_POS_FDAC_OVER_8, d_coarse_mod, d_tx_modulator_shadow, MAX_CHAN, TX_MODULATOR_CM_MASK, TX_MODULATOR_COARSE_MODULATION_F_OVER_4, TX_MODULATOR_COARSE_MODULATION_F_OVER_8, and TX_MODULATOR_NEG_COARSE_TUNE.
Referenced by set_tx_freq().
bool usrp_standard_tx::set_interp_rate | ( | unsigned int | rate | ) | [virtual] |
Set interpolator rate. rate
must be in [4, 512] and a multiple of 4.
The final complex sample rate across the USB is dac_freq () / interp_rate () * nchannels ()
References usrp_basic::_write_fpga_reg(), d_interp_rate, usrp_basic_tx::dac_rate(), usrp_basic_tx::disable_tx(), nchannels(), usrp_basic_tx::restore_tx(), and usrp_basic::set_usb_data_rate().
Referenced by usrp_standard_tx().
bool usrp_standard_tx::set_mux | ( | int | mux | ) |
Set output mux configuration.
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 +-------------------------------+-------+-------+-------+-------+ | | DAC3 | DAC2 | DAC1 | DAC0 | +-------------------------------+-------+-------+-------+-------+
There are two interpolators with complex inputs and outputs. There are four DACs.
Each 4-bit DACx field specifies the source for the DAC and whether or not that DAC is enabled. Each subfield is coded like this:
3 2 1 0 +-+-----+ |E| N | +-+-----+
Where E is set if the DAC is enabled, and N specifies which interpolator output is connected to this DAC.
N which interp output --- ------------------- 0 chan 0 I 1 chan 0 Q 2 chan 1 I 3 chan 1 Q
References d_hw_mux, d_sw_mux, and write_hw_mux_reg().
Referenced by usrp_standard_tx().
bool usrp_standard_tx::set_nchannels | ( | int | nchannels | ) |
Set number of active channels. nchannels
must be 1 or 2.
The final complex sample rate across the USB is dac_freq () / decim_rate () * nchannels ()
References d_nchan, usrp_standard_common::nducs(), and write_hw_mux_reg().
Referenced by usrp_standard_tx().
bool usrp_standard_tx::set_tx_freq | ( | int | channel, | |
double | freq | |||
) | [virtual] |
set the frequency of the digital up converter.
channel
must be in the range [0,1]. freq
is the center frequency in Hz. It must be in the range [-44M, 44M]. The frequency specified is quantized. Use tx_freq to retrieve the actual value used.
References usrp_basic::_write_9862(), CM_NEG_FDAC_OVER_4, CM_NEG_FDAC_OVER_8, CM_OFF, CM_POS_FDAC_OVER_4, CM_POS_FDAC_OVER_8, d_tx_freq, d_tx_modulator_shadow, usrp_basic::d_verbose, usrp_basic_tx::dac_rate(), MAX_CHAN, REG_TX_MODULATOR, REG_TX_NCO_FTW_15_8, REG_TX_NCO_FTW_23_16, REG_TX_NCO_FTW_7_0, set_coarse_modulator(), TX_MODULATOR_ENABLE_NCO, and TX_MODULATOR_NEG_FINE_TUNE.
Referenced by duc_control::set_dxc_freq(), and usrp_standard_tx().
bool usrp_standard_tx::start | ( | ) |
Start data transfers. Called in base class to derived class order.
Reimplemented from usrp_basic_tx.
References usrp_basic_tx::start().
bool usrp_standard_tx::stop | ( | ) |
Stop data transfers. Called in base class to derived class order.
Reimplemented from usrp_basic_tx.
bool usrp_standard_tx::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 DUC so that DC in the complex baseband samples ends up at RF target_freq.
chan | which DUC channel we're controlling (usually == which_side). | |
db | the daughterboard we're controlling. | |
target_freq | the RF frequency we want our baseband translated to. | |
[out] | result | details how the hardware was configured. |
References usrp_basic_tx::converter_rate().
double usrp_standard_tx::tx_freq | ( | int | channel | ) | const |
References d_tx_freq, and MAX_CHAN.
Referenced by duc_control::dxc_freq().
bool usrp_standard_tx::write_hw_mux_reg | ( | ) | [protected] |
References usrp_basic::_write_fpga_reg(), d_hw_mux, d_nchan, usrp_basic_tx::disable_tx(), and usrp_basic_tx::restore_tx().
Referenced by set_mux(), and set_nchannels().
coarse_mod_t usrp_standard_tx::d_coarse_mod[MAX_CHAN] [protected] |
Referenced by coarse_modulator(), set_coarse_modulator(), and usrp_standard_tx().
int usrp_standard_tx::d_hw_mux [protected] |
Referenced by set_mux(), and write_hw_mux_reg().
unsigned int usrp_standard_tx::d_interp_rate [protected] |
Referenced by interp_rate(), and set_interp_rate().
int usrp_standard_tx::d_nchan [protected] |
Referenced by nchannels(), set_nchannels(), and write_hw_mux_reg().
int usrp_standard_tx::d_sw_mux [protected] |
double usrp_standard_tx::d_tx_freq[MAX_CHAN] [protected] |
Referenced by set_tx_freq(), and tx_freq().
unsigned char usrp_standard_tx::d_tx_modulator_shadow[MAX_CHAN] [protected] |
Referenced by set_coarse_modulator(), set_tx_freq(), and usrp_standard_tx().
const int usrp_standard_tx::MAX_CHAN = 2 [static, protected] |
Referenced by coarse_modulator(), set_coarse_modulator(), set_tx_freq(), tx_freq(), and usrp_standard_tx().