diff options
author | Josh Blum <josh@joshknows.com> | 2010-03-29 11:16:42 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-03-29 11:16:42 -0700 |
commit | 7396b53e1bdd1aa5f9dcba760c8993a0cf620b6a (patch) | |
tree | 064f8d3f077ac4b16c8d35dbdfdf9ea7e4b842d3 /host | |
parent | 86fffe7f9ed78a682879dd56c26628256f89e6ae (diff) | |
download | uhd-7396b53e1bdd1aa5f9dcba760c8993a0cf620b6a.tar.gz uhd-7396b53e1bdd1aa5f9dcba760c8993a0cf620b6a.tar.bz2 uhd-7396b53e1bdd1aa5f9dcba760c8993a0cf620b6a.zip |
use bb_rate and if_rate to handle dxc io rates
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/utils/tune_helper.hpp | 4 | ||||
-rw-r--r-- | host/lib/simple_device.cpp | 16 | ||||
-rw-r--r-- | host/lib/tune_helper.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/dsp_impl.cpp | 18 |
4 files changed, 25 insertions, 19 deletions
diff --git a/host/include/uhd/utils/tune_helper.hpp b/host/include/uhd/utils/tune_helper.hpp index 828575c99..958d1eceb 100644 --- a/host/include/uhd/utils/tune_helper.hpp +++ b/host/include/uhd/utils/tune_helper.hpp @@ -30,7 +30,7 @@ namespace uhd{ * the given target frequency + the LO offset (when applicable). * The ddc cordic is setup to bring the IF down to baseband. * \param subdev the dboard subdevice object with properties - * \param ddc the ddc properties object (with "rate", "decim", "freq") + * \param ddc the ddc properties object (with "if_rate", "bb_rate", "freq") * \param target_freq the desired center frequency * \param lo_offset an offset for the subdevice IF from center * \return a tune result struct @@ -55,7 +55,7 @@ UHD_API tune_result_t tune_rx_subdev_and_ddc( * the given target frequency + the LO offset (when applicable). * The duc cordic is setup to bring the baseband up to IF. * \param subdev the dboard subdevice object with properties - * \param duc the duc properties object (with "rate", "interp", "freq") + * \param duc the duc properties object (with "if_rate", "bb_rate", "freq") * \param target_freq the desired center frequency * \param lo_offset an offset for the subdevice IF from center * \return a tune result struct diff --git a/host/lib/simple_device.cpp b/host/lib/simple_device.cpp index d507762a9..2e6bffc9c 100644 --- a/host/lib/simple_device.cpp +++ b/host/lib/simple_device.cpp @@ -116,19 +116,17 @@ public: * RX methods ******************************************************************/ void set_rx_rate(double rate){ - double samp_rate = _rx_ddc[std::string("rate")].as<double>(); + double samp_rate = _rx_ddc[std::string("if_rate")].as<double>(); assert_has(get_rx_rates(), rate, "simple device rx rate"); _rx_ddc[std::string("decim")] = size_t(samp_rate/rate); } double get_rx_rate(void){ - double samp_rate = _rx_ddc[std::string("rate")].as<double>(); - size_t decim = _rx_ddc[std::string("decim")].as<size_t>(); - return samp_rate/decim; + return _rx_ddc[std::string("bb_rate")].as<double>(); } std::vector<double> get_rx_rates(void){ - return get_xx_rates(_rx_ddc[std::string("decims")], _rx_ddc[std::string("rate")]); + return get_xx_rates(_rx_ddc[std::string("decims")], _rx_ddc[std::string("if_rate")]); } tune_result_t set_rx_freq(double target_freq){ @@ -167,19 +165,17 @@ public: * TX methods ******************************************************************/ void set_tx_rate(double rate){ - double samp_rate = _tx_duc[std::string("rate")].as<double>(); + double samp_rate = _tx_duc[std::string("if_rate")].as<double>(); assert_has(get_tx_rates(), rate, "simple device tx rate"); _tx_duc[std::string("interp")] = size_t(samp_rate/rate); } double get_tx_rate(void){ - double samp_rate = _tx_duc[std::string("rate")].as<double>(); - size_t interp = _tx_duc[std::string("interp")].as<size_t>(); - return samp_rate/interp; + return _tx_duc[std::string("bb_rate")].as<double>(); } std::vector<double> get_tx_rates(void){ - return get_xx_rates(_tx_duc[std::string("interps")], _tx_duc[std::string("rate")]); + return get_xx_rates(_tx_duc[std::string("interps")], _tx_duc[std::string("if_rate")]); } tune_result_t set_tx_freq(double target_freq){ diff --git a/host/lib/tune_helper.cpp b/host/lib/tune_helper.cpp index eeda0b6be..1e5c4cd0d 100644 --- a/host/lib/tune_helper.cpp +++ b/host/lib/tune_helper.cpp @@ -34,7 +34,7 @@ static tune_result_t tune_xx_subdev_and_dxc( bool subdev_quadrature = subdev[SUBDEV_PROP_QUADRATURE].as<bool>(); bool subdev_spectrum_inverted = subdev[SUBDEV_PROP_SPECTRUM_INVERTED].as<bool>(); wax::obj dxc_freq_proxy = dxc[std::string("freq")]; - double dxc_sample_rate = dxc[std::string("rate")].as<double>(); + double dxc_sample_rate = dxc[std::string("if_rate")].as<double>(); // Ask the d'board to tune as closely as it can to target_freq+lo_offset double target_inter_freq = target_freq + lo_offset; @@ -96,7 +96,7 @@ tune_result_t uhd::tune_rx_subdev_and_ddc( double lo_offset = 0.0; //if the local oscillator will be in the passband, use an offset if (subdev[SUBDEV_PROP_LO_INTERFERES].as<bool>()){ - lo_offset = 2.0*ddc[std::string("rate")].as<double>()/ddc[std::string("decim")].as<size_t>(); + lo_offset = 2.0*ddc[std::string("bb_rate")].as<double>(); } return tune_rx_subdev_and_ddc(subdev, ddc, target_freq, lo_offset); } @@ -119,7 +119,7 @@ tune_result_t uhd::tune_tx_subdev_and_duc( double lo_offset = 0.0; //if the local oscillator will be in the passband, use an offset if (subdev[SUBDEV_PROP_LO_INTERFERES].as<bool>()){ - lo_offset = 2.0*duc[std::string("rate")].as<double>()/duc[std::string("interp")].as<size_t>(); + lo_offset = 2.0*duc[std::string("bb_rate")].as<double>(); } return tune_tx_subdev_and_duc(subdev, duc, target_freq, lo_offset); } diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp index 40ef06a8c..0d43fac0e 100644 --- a/host/lib/usrp/usrp2/dsp_impl.cpp +++ b/host/lib/usrp/usrp2/dsp_impl.cpp @@ -113,7 +113,8 @@ void usrp2_impl::ddc_get(const wax::obj &key, wax::obj &val){ case DSP_PROP_OTHERS:{ prop_names_t others = boost::assign::list_of - ("rate") + ("if_rate") + ("bb_rate") ("decim") ("decims") ("freq") @@ -127,10 +128,14 @@ void usrp2_impl::ddc_get(const wax::obj &key, wax::obj &val){ //handle string-based properties specific to this dsp std::string key_name = key.as<std::string>(); - if (key_name == "rate"){ + if (key_name == "if_rate"){ val = get_master_clock_freq(); return; } + else if (key_name == "bb_rate"){ + val = get_master_clock_freq()/_ddc_decim; + return; + } else if (key_name == "decim"){ val = _ddc_decim; return; @@ -234,7 +239,8 @@ void usrp2_impl::duc_get(const wax::obj &key, wax::obj &val){ case DSP_PROP_OTHERS:{ prop_names_t others = boost::assign::list_of - ("rate") + ("if_rate") + ("bb_rate") ("interp") ("interps") ("freq") @@ -247,10 +253,14 @@ void usrp2_impl::duc_get(const wax::obj &key, wax::obj &val){ //handle string-based properties specific to this dsp std::string key_name = key.as<std::string>(); - if (key_name == "rate"){ + if (key_name == "if_rate"){ val = get_master_clock_freq(); return; } + else if (key_name == "bb_rate"){ + val = get_master_clock_freq()/_duc_interp; + return; + } else if (key_name == "interp"){ val = _duc_interp; return; |