aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2/dsp_impl.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-16 11:05:54 -0700
committerJosh Blum <josh@joshknows.com>2010-04-16 11:05:54 -0700
commit067491b58676cbdaa754334949a8ffc2daf32979 (patch)
tree13b7c03adf0bddbc5b2a527d5b67a1a3f3e6dff0 /host/lib/usrp/usrp2/dsp_impl.cpp
parent0718961ed11dc82b9430d9fa5da985f7ffcd5d2a (diff)
downloaduhd-067491b58676cbdaa754334949a8ffc2daf32979.tar.gz
uhd-067491b58676cbdaa754334949a8ffc2daf32979.tar.bz2
uhd-067491b58676cbdaa754334949a8ffc2daf32979.zip
RFX seems to be tuning. Added some code to dsp to check for valid range.
Diffstat (limited to 'host/lib/usrp/usrp2/dsp_impl.cpp')
-rw-r--r--host/lib/usrp/usrp2/dsp_impl.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp
index 664d69948..204277ba7 100644
--- a/host/lib/usrp/usrp2/dsp_impl.cpp
+++ b/host/lib/usrp/usrp2/dsp_impl.cpp
@@ -40,7 +40,8 @@ template <class T> T log2(T num){
* DDC Helper Methods
**********************************************************************/
static boost::uint32_t calculate_freq_word_and_update_actual_freq(double &freq, double clock_freq){
- double scale_factor = std::pow(2.0, 32);
+ ASSERT_THROW(std::abs(freq) < clock_freq/2.0);
+ static const double scale_factor = std::pow(2.0, 32);
//calculate the freq register word
boost::uint32_t freq_word = rint((freq / clock_freq) * scale_factor);
@@ -124,12 +125,10 @@ void usrp2_impl::ddc_set(const wax::obj &key, const wax::obj &val){
case DSP_PROP_FREQ_SHIFT:{
double new_freq = val.as<double>();
- ASSERT_THROW(new_freq <= get_master_clock_freq()/2.0);
- ASSERT_THROW(new_freq >= -get_master_clock_freq()/2.0);
- _ddc_freq = new_freq; //shadow
_iface->poke32(FR_DSP_RX_FREQ,
- calculate_freq_word_and_update_actual_freq(_ddc_freq, get_master_clock_freq())
+ calculate_freq_word_and_update_actual_freq(new_freq, get_master_clock_freq())
);
+ _ddc_freq = new_freq; //shadow
}
return;
@@ -209,12 +208,10 @@ void usrp2_impl::duc_set(const wax::obj &key, const wax::obj &val){
case DSP_PROP_FREQ_SHIFT:{
double new_freq = val.as<double>();
- ASSERT_THROW(new_freq <= get_master_clock_freq()/2.0);
- ASSERT_THROW(new_freq >= -get_master_clock_freq()/2.0);
- _duc_freq = new_freq; //shadow
_iface->poke32(FR_DSP_TX_FREQ,
- calculate_freq_word_and_update_actual_freq(_duc_freq, get_master_clock_freq())
+ calculate_freq_word_and_update_actual_freq(new_freq, get_master_clock_freq())
);
+ _duc_freq = new_freq; //shadow
}
return;