usrp_basic_tx Class Reference

class for accessing the transmit side of the USRP More...

#include <usrp_basic.h>

Inheritance diagram for usrp_basic_tx:

Inheritance graph
[legend]
Collaboration diagram for usrp_basic_tx:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~usrp_basic_tx ()
bool set_fpga_tx_sample_rate_divisor (unsigned int div)
 tell the fpga the rate tx samples are going to the D/A's
int write (const void *buf, int len, bool *underrun)
 Write data to the A/D's via the FPGA.
void wait_for_completion ()
virtual long converter_rate () const
 sampling rate of D/A converter
long dac_rate () const
long dac_freq () const
 deprecated method name
int daughterboard_id (int which_dboard) const
 Return daughterboard ID for given Tx 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 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 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_txmake (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_tx (int which_board, int fusb_block_size=0, int fusb_nblocks=0, const std::string fpga_filename="", const std::string firmware_filename="")
bool set_tx_enable (bool on)
bool tx_enable () const
bool disable_tx ()
void restore_tx (bool on)
void probe_tx_slots (bool verbose)
int dboard_to_slot (int dboard)

Protected Attributes

int d_dbid [2]


Detailed Description

class for accessing the transmit side of the USRP

Constructor & Destructor Documentation

usrp_basic_tx::usrp_basic_tx ( int  which_board,
int  fusb_block_size = 0,
int  fusb_nblocks = 0,
const std::string  fpga_filename = "",
const std::string  firmware_filename = "" 
) [protected]

Parameters:
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::make_devhandle(), fusb_devhandle::make_ephandle(), probe_tx_slots(), REG_TX_PWR_DN, set_fpga_tx_sample_rate_divisor(), set_tx_enable(), TX_PWR_DN_TX_ANALOG_BOTH, TX_PWR_DN_TX_DIGITAL, usrp_9862_write(), usrp_9862_write_many_all(), and usrp_set_fpga_tx_reset().

Referenced by make().

usrp_basic_tx::~usrp_basic_tx (  ) 


Member Function Documentation

bool usrp_basic_tx::_write_oe ( int  which_dboard,
int  value,
int  mask 
)

Write direction register (output enables) for pins that go to daughterboard.

Parameters:
which_dboard [0,1] which d'board
value value to write into register
mask which bits of value to write into reg
Each d'board has 16-bits of general purpose i/o. Setting the bit makes it an output from the FPGA to the d'board.

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().

int usrp_basic_tx::block_size (  )  const

returns current fusb block size

References fusb_ephandle::block_size().

virtual long usrp_basic_tx::converter_rate (  )  const [inline, virtual]

sampling rate of D/A converter

References usrp_basic::fpga_master_clock_freq().

Referenced by dac_freq(), and dac_rate().

long usrp_basic_tx::dac_freq (  )  const [inline]

deprecated method name

References converter_rate().

Referenced by usrp_standard_tx::set_tx_freq().

long usrp_basic_tx::dac_rate (  )  const [inline]

int usrp_basic_tx::daughterboard_id ( int  which_dboard  )  const [inline]

Return daughterboard ID for given Tx daughterboard slot [0,1].

Returns:
daughterboard id >= 0 if successful

-1 if no daugherboard

-2 if invalid EEPROM on daughterboard

References d_dbid.

int usrp_basic_tx::dboard_to_slot ( int  dboard  )  [inline, protected]

bool usrp_basic_tx::disable_tx (  )  [protected]

usrp_basic_tx * usrp_basic_tx::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

Parameters:
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_tx().

double usrp_basic_tx::pga ( int  which  )  const

Return programmable gain amplifier gain in dB.

Parameters:
which which D/A [0,3]

References usrp_basic::_read_9862(), pga_db_per_step(), pga_min(), and usrp_basic::READ_FAILED.

double usrp_basic_tx::pga_db_per_step (  )  const [inline]

Return hardware step size of PGA (linear in dB).

Referenced by pga(), and set_pga().

double usrp_basic_tx::pga_max (  )  const [inline]

Return maximum legal PGA gain in dB.

Referenced by set_pga().

double usrp_basic_tx::pga_min (  )  const [inline]

Return minimum legal PGA gain in dB.

Referenced by pga(), and set_pga().

void usrp_basic_tx::probe_tx_slots ( bool  verbose  )  [protected]

int usrp_basic_tx::read_aux_adc ( int  which_dboard,
int  which_adc 
)

Read auxiliary analog to digital converter.

Parameters:
which_dboard [0,1] which d'board
which_adc [0,1]
Returns:
value in the range [0,4095] if successful, else READ_FAILED.

Reimplemented from usrp_basic.

References dboard_to_slot(), and read_aux_adc().

bool usrp_basic_tx::read_aux_adc ( int  which_dboard,
int  which_adc,
int *  value 
)

Read auxiliary analog to digital converter.

Parameters:
which_dboard [0,1] which d'board
which_adc [0,1]
value return 12-bit value [0,4095]
Returns:
true iff successful

Reimplemented from usrp_basic.

References dboard_to_slot().

Referenced by read_aux_adc().

int usrp_basic_tx::read_io ( int  which_dboard  ) 

Read daughterboard i/o pin value.

Parameters:
which_dboard [0,1] which d'board
Returns:
register value if successful, else READ_FAILED

References usrp_basic::READ_FAILED, and read_io().

bool usrp_basic_tx::read_io ( int  which_dboard,
int *  value 
)

Read daughterboard i/o pin value.

Parameters:
which_dboard [0,1] which d'board
value return value

References usrp_basic::_read_fpga_reg().

Referenced by read_io().

void usrp_basic_tx::restore_tx ( bool  on  )  [protected]

bool usrp_basic_tx::set_fpga_tx_sample_rate_divisor ( unsigned int  div  ) 

tell the fpga the rate tx samples are going to the D/A's

div = fpga_master_clock_freq () * 2

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_tx().

bool usrp_basic_tx::set_pga ( int  which,
double  gain_in_db 
)

Set Programmable Gain Amplifier (PGA).

Parameters:
which which D/A [0,3]
gain_in_db gain value (linear in dB)
gain is rounded to closest setting supported by hardware. Note that DAC 0 and DAC 1 share a gain setting as do DAC 2 and DAC 3. Setting DAC 0 affects DAC 1 and vice versa. Same with DAC 2 and DAC 3.

Returns:
true iff sucessful.
See also:
pga_min(), pga_max(), pga_db_per_step()

References usrp_basic::_write_9862(), pga_db_per_step(), pga_max(), and pga_min().

bool usrp_basic_tx::set_tx_enable ( bool  on  )  [protected]

bool usrp_basic_tx::start (  ) 

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

Reimplemented from usrp_basic.

Reimplemented in usrp_standard_tx.

References set_tx_enable(), fusb_ephandle::start(), and usrp_basic::start().

Referenced by usrp_standard_tx::start().

bool usrp_basic_tx::stop (  ) 

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

Reimplemented from usrp_basic.

Reimplemented in usrp_standard_tx.

References set_tx_enable(), and fusb_ephandle::stop().

bool usrp_basic_tx::tx_enable (  )  const [inline, protected]

Referenced by disable_tx(), and restore_tx().

void usrp_basic_tx::wait_for_completion (  ) 

int usrp_basic_tx::write ( const void *  buf,
int  len,
bool *  underrun 
)

Write data to the A/D's via the FPGA.

len must be a multiple of 512 bytes.

Returns:
number of bytes written or -1 on error.
if underrun is non-NULL, it will be set to true iff a transmit underrun condition is detected.

References usrp_basic::d_bytes_per_poll, usrp_basic::d_udh, usrp_check_tx_underrun(), and fusb_ephandle::write().

bool usrp_basic_tx::write_aux_dac ( int  which_board,
int  which_dac,
int  value 
)

Write auxiliary digital to analog converter.

Parameters:
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]
Returns:
true iff successful

Reimplemented from usrp_basic.

References dboard_to_slot().

bool usrp_basic_tx::write_io ( int  which_dboard,
int  value,
int  mask 
)

Write daughterboard i/o pin value.

Parameters:
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().


Member Data Documentation

int usrp_basic_tx::d_dbid[2] [protected]

Referenced by daughterboard_id(), and probe_tx_slots().


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

Generated on Thu Mar 5 09:04:26 2009 for Universal Software Radio Peripheral by  doxygen 1.5.8