diff options
author | Josh Blum <josh@joshknows.com> | 2010-04-05 17:42:22 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-04-05 17:42:22 -0700 |
commit | e4f75a9271cc20702444641a3e8d442e12492c11 (patch) | |
tree | a9135bfa9d4ef5b648d861e7de9c7bf989867d2c /host/lib/usrp/simple_usrp.cpp | |
parent | 9c1e7c5b8804a821e9a48908e7302327e4b9070d (diff) | |
parent | 97496ace66842f9d7529793b2b202be9abe156c3 (diff) | |
download | uhd-e4f75a9271cc20702444641a3e8d442e12492c11.tar.gz uhd-e4f75a9271cc20702444641a3e8d442e12492c11.tar.bz2 uhd-e4f75a9271cc20702444641a3e8d442e12492c11.zip |
Merge branch 'rework' of git@ettus.sourcerepo.com:ettus/uhd
Diffstat (limited to 'host/lib/usrp/simple_usrp.cpp')
-rw-r--r-- | host/lib/usrp/simple_usrp.cpp | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/host/lib/usrp/simple_usrp.cpp b/host/lib/usrp/simple_usrp.cpp index a0551a630..fb3cc8eec 100644 --- a/host/lib/usrp/simple_usrp.cpp +++ b/host/lib/usrp/simple_usrp.cpp @@ -22,6 +22,7 @@ #include <uhd/usrp/mboard_props.hpp> #include <uhd/usrp/device_props.hpp> #include <uhd/usrp/dboard_props.hpp> +#include <uhd/usrp/dsp_props.hpp> #include <boost/foreach.hpp> #include <boost/format.hpp> #include <stdexcept> @@ -30,17 +31,6 @@ using namespace uhd; using namespace uhd::usrp; /*********************************************************************** - * Helper Functions - **********************************************************************/ -static std::vector<double> get_xx_rates(wax::obj decerps, wax::obj rate){ - std::vector<double> rates; - BOOST_FOREACH(size_t decerp, decerps.as<std::vector<size_t> >()){ - rates.push_back(rate.as<double>()/decerp); - } - return rates; -} - -/*********************************************************************** * Simple Device Implementation **********************************************************************/ class simple_usrp_impl : public simple_usrp{ @@ -48,8 +38,8 @@ public: simple_usrp_impl(const device_addr_t &addr){ _dev = device::make(addr); _mboard = (*_dev)[DEVICE_PROP_MBOARD]; - _rx_ddc = _mboard[named_prop_t(MBOARD_PROP_RX_DSP, "ddc0")]; - _tx_duc = _mboard[named_prop_t(MBOARD_PROP_TX_DSP, "duc0")]; + _rx_dsp = _mboard[MBOARD_PROP_RX_DSP]; + _tx_dsp = _mboard[MBOARD_PROP_TX_DSP]; //extract rx subdevice wax::obj rx_dboard = _mboard[MBOARD_PROP_RX_DBOARD]; @@ -86,7 +76,7 @@ public: } void issue_stream_cmd(const stream_cmd_t &stream_cmd){ - _rx_ddc[std::string("stream_cmd")] = stream_cmd; + _mboard[MBOARD_PROP_STREAM_CMD] = stream_cmd; } void set_clock_config(const clock_config_t &clock_config){ @@ -101,21 +91,15 @@ public: * RX methods ******************************************************************/ void set_rx_rate(double rate){ - 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); + _rx_dsp[DSP_PROP_HOST_RATE] = rate; } double get_rx_rate(void){ - 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("if_rate")]); + return _rx_dsp[DSP_PROP_HOST_RATE].as<double>(); } tune_result_t set_rx_freq(double target_freq){ - return tune_rx_subdev_and_ddc(_rx_subdev, _rx_ddc, target_freq); + return tune_rx_subdev_and_ddc(_rx_subdev, _rx_dsp, target_freq); } freq_range_t get_rx_freq_range(void){ @@ -150,21 +134,15 @@ public: * TX methods ******************************************************************/ void set_tx_rate(double rate){ - 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); + _tx_dsp[DSP_PROP_HOST_RATE] = rate; } double get_tx_rate(void){ - 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("if_rate")]); + return _tx_dsp[DSP_PROP_HOST_RATE].as<double>(); } tune_result_t set_tx_freq(double target_freq){ - return tune_tx_subdev_and_duc(_tx_subdev, _tx_duc, target_freq); + return tune_tx_subdev_and_duc(_tx_subdev, _tx_dsp, target_freq); } freq_range_t get_tx_freq_range(void){ @@ -198,8 +176,8 @@ public: private: device::sptr _dev; wax::obj _mboard; - wax::obj _rx_ddc; - wax::obj _tx_duc; + wax::obj _rx_dsp; + wax::obj _tx_dsp; wax::obj _rx_subdev; wax::obj _tx_subdev; }; |