diff options
author | eb | 2008-10-22 16:18:41 +0000 |
---|---|---|
committer | eb | 2008-10-22 16:18:41 +0000 |
commit | 631f63e5cb7a018cad6b6ecd05faf29a3c5e6bf7 (patch) | |
tree | 82134deae3b2970dadf61df773106a1470b572f6 /usrp2/host | |
parent | bfe79d23738f24562dc7612049a90e8b20b53f79 (diff) | |
download | gnuradio-631f63e5cb7a018cad6b6ecd05faf29a3c5e6bf7.tar.gz gnuradio-631f63e5cb7a018cad6b6ecd05faf29a3c5e6bf7.tar.bz2 gnuradio-631f63e5cb7a018cad6b6ecd05faf29a3c5e6bf7.zip |
added rx_decim and tx_interp accessors
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9819 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'usrp2/host')
-rw-r--r-- | usrp2/host/include/usrp2/usrp2.h | 6 | ||||
-rw-r--r-- | usrp2/host/lib/usrp2_impl.cc | 13 | ||||
-rw-r--r-- | usrp2/host/lib/usrp2_impl.h | 4 |
3 files changed, 22 insertions, 1 deletions
diff --git a/usrp2/host/include/usrp2/usrp2.h b/usrp2/host/include/usrp2/usrp2.h index 9a1b8b549..9fc168791 100644 --- a/usrp2/host/include/usrp2/usrp2.h +++ b/usrp2/host/include/usrp2/usrp2.h @@ -132,6 +132,9 @@ namespace usrp2 { */ bool set_rx_decim(int decimation_factor); + //! Return current decimation factor + int rx_decim(); + /*! * Set receiver IQ magnitude scaling */ @@ -214,6 +217,9 @@ namespace usrp2 { */ bool set_tx_interp(int interpolation_factor); + //! Return current interpolation factor + int tx_interp(); + /*! * Set transmit IQ magnitude scaling */ diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc index 5fd671085..956f2561e 100644 --- a/usrp2/host/lib/usrp2_impl.cc +++ b/usrp2/host/lib/usrp2_impl.cc @@ -130,7 +130,7 @@ namespace usrp2 { d_rx_seqno(-1), d_tx_seqno(0), d_next_rid(0), d_num_rx_frames(0), d_num_rx_missing(0), d_num_rx_overruns(0), d_num_rx_bytes(0), d_num_enqueued(0), d_enqueued_mutex(), d_bg_pending_cond(&d_enqueued_mutex), - d_channel_rings(NCHANS) + d_channel_rings(NCHANS), d_tx_interp(0), d_rx_decim(0) { if (!d_eth_buf->open(ifc, htons(U2_ETHERTYPE))) throw std::runtime_error("Unable to register USRP2 protocol"); @@ -179,6 +179,13 @@ namespace usrp2 { if (!set_rx_gain((rx_gain_min() + rx_gain_max()) / 2)) std::cerr << "usrp2::ctor set_rx_gain failed\n"; + // default interp and decim + if (!set_tx_interp(12)) + std::cerr << "usrp2::ctor set_tx_interp failed\n"; + + if (!set_rx_decim(12)) + std::cerr << "usrp2::ctor set_rx_decim failed\n"; + // set workable defaults for scaling if (!set_rx_scale_iq(DEFAULT_RX_SCALE, DEFAULT_RX_SCALE)) std::cerr << "usrp2::ctor set_rx_scale_iq failed\n"; @@ -524,6 +531,8 @@ namespace usrp2 { return false; bool success = (ntohx(reply.ok) == 1); + if (success) + d_rx_decim = decimation_factor; return success; } @@ -761,6 +770,8 @@ namespace usrp2 { return false; bool success = (ntohx(reply.ok) == 1); + if (success) + d_tx_interp = interpolation_factor; return success; } diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h index a134c9ec1..f513cf9d3 100644 --- a/usrp2/host/lib/usrp2_impl.h +++ b/usrp2/host/lib/usrp2_impl.h @@ -80,6 +80,8 @@ namespace usrp2 { db_info d_tx_db_info; db_info d_rx_db_info; + int d_tx_interp; // shadow tx interp + int d_rx_decim; // shadow rx decim void inc_enqueued() { omni_mutex_lock l(d_enqueued_mutex); @@ -123,6 +125,7 @@ namespace usrp2 { double rx_freq_min() { return d_rx_db_info.freq_min; } double rx_freq_max() { return d_rx_db_info.freq_max; } bool set_rx_decim(int decimation_factor); + int rx_decim() { return d_rx_decim; } bool set_rx_scale_iq(int scale_i, int scale_q); bool start_rx_streaming(unsigned int channel, unsigned int items_per_frame); bool rx_samples(unsigned int channel, rx_sample_handler *handler); @@ -140,6 +143,7 @@ namespace usrp2 { double tx_freq_min() { return d_tx_db_info.freq_min; } double tx_freq_max() { return d_tx_db_info.freq_max; } bool set_tx_interp(int interpolation_factor); + int tx_interp() { return d_tx_interp; } bool set_tx_scale_iq(int scale_i, int scale_q); bool tx_32fc(unsigned int channel, |