aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorVidush <vidush.vishwanath@ettus.com>2018-06-11 12:11:38 -0700
committerMartin Braun <martin.braun@ettus.com>2018-06-21 15:30:16 -0700
commita1c8c617538c208151da245dc11b651a932c387d (patch)
tree7e685c88218234cda0ae692112fb006c2f9d433d /host/lib
parentc21458305392483e1884fcca15e1ea4b67628fbd (diff)
downloaduhd-a1c8c617538c208151da245dc11b651a932c387d.tar.gz
uhd-a1c8c617538c208151da245dc11b651a932c387d.tar.bz2
uhd-a1c8c617538c208151da245dc11b651a932c387d.zip
*_dsp_core: Update frequency when updating rates
Since the frequency shifter is set to a relative rate, it needs to be updated when changing the sampling rate.
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/include/uhdlib/usrp/cores/rx_dsp_core_3000.hpp2
-rw-r--r--host/lib/include/uhdlib/usrp/cores/tx_dsp_core_3000.hpp2
-rw-r--r--host/lib/usrp/cores/rx_dsp_core_3000.cpp8
-rw-r--r--host/lib/usrp/cores/tx_dsp_core_3000.cpp8
4 files changed, 20 insertions, 0 deletions
diff --git a/host/lib/include/uhdlib/usrp/cores/rx_dsp_core_3000.hpp b/host/lib/include/uhdlib/usrp/cores/rx_dsp_core_3000.hpp
index 8ea4531a1..e87fd4926 100644
--- a/host/lib/include/uhdlib/usrp/cores/rx_dsp_core_3000.hpp
+++ b/host/lib/include/uhdlib/usrp/cores/rx_dsp_core_3000.hpp
@@ -51,6 +51,8 @@ public:
virtual double set_freq(const double freq) = 0;
+ virtual double get_freq(void) = 0;
+
virtual void setup(const uhd::stream_args_t &stream_args) = 0;
virtual void populate_subtree(uhd::property_tree::sptr subtree) = 0;
diff --git a/host/lib/include/uhdlib/usrp/cores/tx_dsp_core_3000.hpp b/host/lib/include/uhdlib/usrp/cores/tx_dsp_core_3000.hpp
index d63f6a609..2976d8b4a 100644
--- a/host/lib/include/uhdlib/usrp/cores/tx_dsp_core_3000.hpp
+++ b/host/lib/include/uhdlib/usrp/cores/tx_dsp_core_3000.hpp
@@ -45,6 +45,8 @@ public:
virtual double set_freq(const double freq) = 0;
+ virtual double get_freq(void) = 0;
+
virtual void setup(const uhd::stream_args_t &stream_args) = 0;
virtual void populate_subtree(uhd::property_tree::sptr subtree) = 0;
diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.cpp b/host/lib/usrp/cores/rx_dsp_core_3000.cpp
index c7d3c25c8..7104d51a0 100644
--- a/host/lib/usrp/cores/rx_dsp_core_3000.cpp
+++ b/host/lib/usrp/cores/rx_dsp_core_3000.cpp
@@ -110,6 +110,7 @@ public:
void set_tick_rate(const double rate){
_tick_rate = rate;
+ set_freq(_current_freq);
}
void set_link_rate(const double rate){
@@ -229,9 +230,14 @@ public:
int32_t freq_word;
get_freq_and_freq_word(requested_freq + _dsp_freq_offset, _tick_rate, actual_freq, freq_word);
_iface->poke32(REG_DSP_RX_FREQ, uint32_t(freq_word));
+ _current_freq = actual_freq;
return actual_freq;
}
+ double get_freq(void){
+ return _current_freq;
+ }
+
uhd::meta_range_t get_freq_range(void){
//Too keep the DSP range symmetric about 0, we use abs(_dsp_freq_offset)
const double offset = std::abs<double>(_dsp_freq_offset);
@@ -279,6 +285,7 @@ public:
subtree->create<double>("freq/value")
.set(DEFAULT_DDS_FREQ)
.set_coercer(boost::bind(&rx_dsp_core_3000::set_freq, this, _1))
+ .set_publisher([this](){ return this->get_freq(); })
;
subtree->create<meta_range_t>("freq/range")
.set_publisher(boost::bind(&rx_dsp_core_3000::get_freq_range, this))
@@ -292,6 +299,7 @@ private:
double _tick_rate, _link_rate;
double _scaling_adjustment, _dsp_extra_scaling, _host_extra_scaling, _fxpt_scalar_correction;
double _dsp_freq_offset;
+ double _current_freq;
};
rx_dsp_core_3000::sptr rx_dsp_core_3000::make(wb_iface::sptr iface, const size_t dsp_base, const bool is_b200 /* = false */)
diff --git a/host/lib/usrp/cores/tx_dsp_core_3000.cpp b/host/lib/usrp/cores/tx_dsp_core_3000.cpp
index cc4d23393..d548c543f 100644
--- a/host/lib/usrp/cores/tx_dsp_core_3000.cpp
+++ b/host/lib/usrp/cores/tx_dsp_core_3000.cpp
@@ -54,6 +54,7 @@ public:
void set_tick_rate(const double rate){
_tick_rate = rate;
+ set_freq(_current_freq);
}
void set_link_rate(const double rate){
@@ -131,9 +132,14 @@ public:
int32_t freq_word;
get_freq_and_freq_word(requested_freq, _tick_rate, actual_freq, freq_word);
_iface->poke32(REG_DSP_TX_FREQ, uint32_t(freq_word));
+ _current_freq = actual_freq;
return actual_freq;
}
+ double get_freq(void){
+ return _current_freq;
+ }
+
uhd::meta_range_t get_freq_range(void){
return uhd::meta_range_t(-_tick_rate/2, +_tick_rate/2, _tick_rate/std::pow(2.0, 32));
}
@@ -179,6 +185,7 @@ public:
subtree->create<double>("freq/value")
.set(DEFAULT_DDS_FREQ)
.set_coercer(boost::bind(&tx_dsp_core_3000::set_freq, this, _1))
+ .set_publisher([this](){ return this->get_freq(); })
;
subtree->create<meta_range_t>("freq/range")
.set_publisher(boost::bind(&tx_dsp_core_3000::get_freq_range, this))
@@ -190,6 +197,7 @@ private:
const size_t _dsp_base;
double _tick_rate, _link_rate;
double _scaling_adjustment, _dsp_extra_scaling, _host_extra_scaling, _fxpt_scalar_correction;
+ double _current_freq;
};
tx_dsp_core_3000::sptr tx_dsp_core_3000::make(wb_iface::sptr iface, const size_t dsp_base)