GNU Radio 3.3.0 C++ API
|
abstract interface to Universal Software Radio Peripheral Rx path (Rev 1) More...
#include <usrp_source_base.h>
Public Member Functions | |
~usrp_source_base () | |
int | work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) |
just like gr_block::general_work, only this arranges to call consume_each for you | |
bool | set_decim_rate (unsigned int rate) |
Set decimator rate. rate must be EVEN and in [8, 256]. | |
bool | set_nchannels (int nchan) |
bool | set_mux (int mux) |
int | determine_rx_mux_value (usrp_subdev_spec ss) |
int | determine_rx_mux_value (usrp_subdev_spec ss_a, usrp_subdev_spec ss_b) |
bool | set_rx_freq (int channel, double freq) |
set the center frequency of the digital down converter. | |
bool | set_fpga_mode (int mode) |
set fpga special modes | |
bool | set_ddc_phase (int channel, int phase) |
Set the digital down converter phase register. | |
long | adc_rate () const |
long | adc_freq () const |
unsigned int | decim_rate () const |
int | nchannels () const |
int | mux () const |
double | rx_freq (int channel) const |
int | noverruns () const |
bool | has_rx_halfband () |
bool | has_tx_halfband () |
int | nddcs () |
int | nducs () |
bool | start () |
Called to enable drivers, etc for i/o devices. | |
bool | stop () |
Called to disable drivers, etc for i/o devices. | |
bool | set_format (unsigned int format) |
Specify Rx data format. | |
unsigned int | format () const |
return current 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. | |
usrp_subdev_spec | pick_rx_subdevice () |
Select suitable Rx daughterboard. | |
Static Public Member Functions | |
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_source_base (const std::string &name, gr_io_signature_sptr output_signature, int which_board, unsigned int decim_rate, int nchan, int mux, int mode, int fusb_block_size, int fusb_nblocks, const std::string fpga_filename, const std::string firmware_filename) throw (std::runtime_error) | |
virtual int | ninput_bytes_reqd_for_noutput_items (int noutput_items)=0 |
return number of usrp input bytes required to produce noutput items. | |
unsigned int | sizeof_basic_sample () const |
number of bytes in a low-level sample | |
virtual void | copy_from_usrp_buffer (gr_vector_void_star &output_items, int output_index, int output_items_available, int &output_items_produced, const void *usrp_buffer, int usrp_buffer_length, int &bytes_read)=0 |
convert between native usrp format and output item format |
abstract interface to Universal Software Radio Peripheral Rx path (Rev 1)
usrp_source_base::usrp_source_base | ( | const std::string & | name, |
gr_io_signature_sptr | output_signature, | ||
int | which_board, | ||
unsigned int | decim_rate, | ||
int | nchan, | ||
int | mux, | ||
int | mode, | ||
int | fusb_block_size, | ||
int | fusb_nblocks, | ||
const std::string | fpga_filename, | ||
const std::string | firmware_filename | ||
) | throw (std::runtime_error) [protected] |
usrp_source_base::~usrp_source_base | ( | ) |
long usrp_source_base::adc_freq | ( | ) | const [inline] |
References usrp_base::converter_rate().
long usrp_source_base::adc_rate | ( | ) | const [inline] |
References usrp_base::converter_rate().
virtual void usrp_source_base::copy_from_usrp_buffer | ( | gr_vector_void_star & | output_items, |
int | output_index, | ||
int | output_items_available, | ||
int & | output_items_produced, | ||
const void * | usrp_buffer, | ||
int | usrp_buffer_length, | ||
int & | bytes_read | ||
) | [protected, pure virtual] |
convert between native usrp format and output item format
[out] | output_items | stream(s) of output items |
[in] | output_index | starting index in output_items |
[in] | output_items_available | number of empty items available at item[index] |
[out] | output_items_produced | number of items produced by copy |
[in] | usrp_buffer | source buffer |
[in] | usrp_buffer_length | number of bytes available in usrp_buffer |
[out] | bytes_read | number of bytes read from usrp_buffer |
The copy must consume all bytes available. That is, bytes_read
must equal usrp_buffer_length
.
Implemented in usrp_source_c, and usrp_source_s.
unsigned int usrp_source_base::decim_rate | ( | ) | const |
int usrp_source_base::determine_rx_mux_value | ( | usrp_subdev_spec | ss | ) |
int usrp_source_base::determine_rx_mux_value | ( | usrp_subdev_spec | ss_a, |
usrp_subdev_spec | ss_b | ||
) |
unsigned int usrp_source_base::format | ( | ) | const |
return current format
static bool usrp_source_base::format_bypass_halfband | ( | unsigned int | format | ) | [static] |
static int usrp_source_base::format_shift | ( | unsigned int | format | ) | [static] |
static bool usrp_source_base::format_want_q | ( | unsigned int | format | ) | [static] |
static int usrp_source_base::format_width | ( | unsigned int | format | ) | [static] |
bool usrp_source_base::has_rx_halfband | ( | ) |
bool usrp_source_base::has_tx_halfband | ( | ) |
static unsigned int usrp_source_base::make_format | ( | int | width = 16 , |
int | shift = 0 , |
||
bool | want_q = true , |
||
bool | bypass_halfband = false |
||
) | [static] |
int usrp_source_base::mux | ( | ) | const |
int usrp_source_base::nchannels | ( | ) | const |
int usrp_source_base::nddcs | ( | ) |
int usrp_source_base::nducs | ( | ) |
virtual int usrp_source_base::ninput_bytes_reqd_for_noutput_items | ( | int | noutput_items | ) | [protected, pure virtual] |
return number of usrp input bytes required to produce noutput items.
Implemented in usrp_source_c, and usrp_source_s.
int usrp_source_base::noverruns | ( | ) | const [inline] |
usrp_subdev_spec usrp_source_base::pick_rx_subdevice | ( | ) |
Select suitable Rx daughterboard.
double usrp_source_base::rx_freq | ( | int | channel | ) | const |
bool usrp_source_base::set_ddc_phase | ( | int | channel, |
int | phase | ||
) |
Set the digital down converter phase register.
channel | which ddc channel [0, 3] |
phase | 32-bit integer phase value. |
bool usrp_source_base::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 ()
bool usrp_source_base::set_format | ( | unsigned int | format | ) |
Specify Rx data format.
format | format 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_source_base::set_fpga_mode | ( | int | mode | ) |
set fpga special modes
bool usrp_source_base::set_mux | ( | int | mux | ) |
bool usrp_source_base::set_nchannels | ( | int | nchan | ) |
bool usrp_source_base::set_rx_freq | ( | int | channel, |
double | freq | ||
) |
set the center frequency of the digital down converter.
channel
must be 0. freq
is the center frequency in Hz. It must be in the range [-FIXME, FIXME]. The frequency specified is quantized. Use rx_freq to retrieve the actual value used.
unsigned int usrp_source_base::sizeof_basic_sample | ( | ) | const [protected] |
number of bytes in a low-level sample
bool usrp_source_base::start | ( | ) | [virtual] |
Called to enable drivers, etc for i/o devices.
This allows a block to enable an associated driver to begin transfering data just before we start to execute the scheduler. The end result is that this reduces latency in the pipeline when dealing with audio devices, usrps, etc.
Reimplemented from gr_block.
bool usrp_source_base::stop | ( | ) | [virtual] |
Called to disable drivers, etc for i/o devices.
Reimplemented from gr_block.
bool usrp_source_base::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.
chan | which DDC channel we're controlling (almost always 0). | |
db | the daughterboard we're controlling. | |
target_freq | the RF frequency we want at DC in the complex baseband. | |
[out] | result | details how the hardware was configured. |
int usrp_source_base::work | ( | int | noutput_items, |
gr_vector_const_void_star & | input_items, | ||
gr_vector_void_star & | output_items | ||
) | [virtual] |
just like gr_block::general_work, only this arranges to call consume_each for you
The user must override work to define the signal processing code
Implements gr_sync_block.