summaryrefslogtreecommitdiff
path: root/usrp2/host/lib
diff options
context:
space:
mode:
Diffstat (limited to 'usrp2/host/lib')
-rw-r--r--usrp2/host/lib/usrp2_impl.cc13
-rw-r--r--usrp2/host/lib/usrp2_impl.h4
2 files changed, 16 insertions, 1 deletions
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,