diff options
author | Josh Blum <josh@joshknows.com> | 2010-04-05 16:36:51 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-04-05 16:36:51 -0700 |
commit | 97496ace66842f9d7529793b2b202be9abe156c3 (patch) | |
tree | b3c584cba724e346e353dd82560644edbf92bfd6 /host | |
parent | 1cc8c6c964d4368d9e918e4cb357600453a24c94 (diff) | |
download | uhd-97496ace66842f9d7529793b2b202be9abe156c3.tar.gz uhd-97496ace66842f9d7529793b2b202be9abe156c3.tar.bz2 uhd-97496ace66842f9d7529793b2b202be9abe156c3.zip |
simplified the usage of dboard, dsp, and mboard proxies.
removed the dict structure for each, we are just going to have one.
Diffstat (limited to 'host')
-rw-r--r-- | host/examples/rx_timed_samples.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/simple_usrp.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/dboard_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/dboard_interface.cpp | 8 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/dsp_impl.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 26 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 10 |
8 files changed, 38 insertions, 28 deletions
diff --git a/host/examples/rx_timed_samples.cpp b/host/examples/rx_timed_samples.cpp index 7b06981b2..e971e9f6a 100644 --- a/host/examples/rx_timed_samples.cpp +++ b/host/examples/rx_timed_samples.cpp @@ -29,6 +29,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ std::string transport_args; int seconds_in_future; size_t total_num_samps; + double rx_rate; //setup the program options po::options_description desc("Allowed options"); @@ -37,6 +38,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ ("args", po::value<std::string>(&transport_args)->default_value(""), "simple uhd transport args") ("secs", po::value<int>(&seconds_in_future)->default_value(3), "number of seconds in the future to receive") ("nsamps", po::value<size_t>(&total_num_samps)->default_value(1000), "total number of samples to receive") + ("rxrate", po::value<double>(&rx_rate)->default_value(100e6/16), "rate of incoming samples") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); @@ -57,9 +59,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ std::cout << boost::format("Using Device: %s") % sdev->get_name() << std::endl; //set properties on the device - double rx_rate = 100e6/16; //FIXME get this from somewhere std::cout << boost::format("Setting RX Rate: %f Msps...") % (rx_rate/1e6) << std::endl; sdev->set_rx_rate(rx_rate); + std::cout << boost::format("Actual RX Rate: %f Msps...") % (sdev->get_rx_rate()/1e6) << std::endl; std::cout << boost::format("Setting device timestamp to 0...") << std::endl; sdev->set_time_now(uhd::time_spec_t(0)); diff --git a/host/lib/usrp/simple_usrp.cpp b/host/lib/usrp/simple_usrp.cpp index bd8bac00f..fb3cc8eec 100644 --- a/host/lib/usrp/simple_usrp.cpp +++ b/host/lib/usrp/simple_usrp.cpp @@ -38,8 +38,8 @@ public: simple_usrp_impl(const device_addr_t &addr){ _dev = device::make(addr); _mboard = (*_dev)[DEVICE_PROP_MBOARD]; - _rx_dsp = _mboard[named_prop_t(MBOARD_PROP_RX_DSP, "ddc0")]; //FIX string crap - _tx_dsp = _mboard[named_prop_t(MBOARD_PROP_TX_DSP, "duc0")]; //FIX string crap + _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]; diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp index 39e4baa7b..d1515f2d5 100644 --- a/host/lib/usrp/usrp2/dboard_impl.cpp +++ b/host/lib/usrp/usrp2/dboard_impl.cpp @@ -49,11 +49,11 @@ void usrp2_impl::dboard_init(void){ ); //load dboards - _rx_dboards[""] = wax_obj_proxy::make( + _rx_dboard_proxy = wax_obj_proxy::make( boost::bind(&usrp2_impl::rx_dboard_get, this, _1, _2), boost::bind(&usrp2_impl::rx_dboard_set, this, _1, _2) ); - _tx_dboards[""] = wax_obj_proxy::make( + _tx_dboard_proxy = wax_obj_proxy::make( boost::bind(&usrp2_impl::tx_dboard_get, this, _1, _2), boost::bind(&usrp2_impl::tx_dboard_set, this, _1, _2) ); diff --git a/host/lib/usrp/usrp2/dboard_interface.cpp b/host/lib/usrp/usrp2/dboard_interface.cpp index 87fc19117..d7c18983a 100644 --- a/host/lib/usrp/usrp2/dboard_interface.cpp +++ b/host/lib/usrp/usrp2/dboard_interface.cpp @@ -62,6 +62,14 @@ dboard_interface::sptr make_usrp2_dboard_interface(usrp2_impl *impl){ **********************************************************************/ usrp2_dboard_interface::usrp2_dboard_interface(usrp2_impl *impl){ _impl = impl; + + //set the selection mux to use atr + boost::uint32_t new_sels = 0x0; + for(size_t i = 0; i < 16; i++){ + new_sels |= FRF_GPIO_SEL_ATR << (i*2); + } + _impl->poke32(FR_GPIO_TX_SEL, new_sels); + _impl->poke32(FR_GPIO_RX_SEL, new_sels); } usrp2_dboard_interface::~usrp2_dboard_interface(void){ diff --git a/host/lib/usrp/usrp2/dsp_impl.cpp b/host/lib/usrp/usrp2/dsp_impl.cpp index 559ea38d8..92b55d029 100644 --- a/host/lib/usrp/usrp2/dsp_impl.cpp +++ b/host/lib/usrp/usrp2/dsp_impl.cpp @@ -66,7 +66,7 @@ pick_closest_rate(double exact_rate, const std::vector<rate_t> &rates){ void usrp2_impl::init_ddc_config(void){ //create the ddc in the rx dsp dict - _rx_dsps["ddc0"] = wax_obj_proxy::make( + _rx_dsp_proxy = wax_obj_proxy::make( boost::bind(&usrp2_impl::ddc_get, this, _1, _2), boost::bind(&usrp2_impl::ddc_set, this, _1, _2) ); @@ -149,7 +149,7 @@ void usrp2_impl::ddc_set(const wax::obj &key, const wax::obj &val){ **********************************************************************/ void usrp2_impl::init_duc_config(void){ //create the duc in the tx dsp dict - _tx_dsps["duc0"] = wax_obj_proxy::make( + _tx_dsp_proxy = wax_obj_proxy::make( boost::bind(&usrp2_impl::duc_get, this, _1, _2), boost::bind(&usrp2_impl::duc_set, this, _1, _2) ); diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 0891f9dc8..94ab88a6b 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -29,7 +29,7 @@ using namespace uhd::usrp; * Helper Methods **********************************************************************/ void usrp2_impl::mboard_init(void){ - _mboards[""] = wax_obj_proxy::make( + _mboard_proxy = wax_obj_proxy::make( boost::bind(&usrp2_impl::mboard_get, this, _1, _2), boost::bind(&usrp2_impl::mboard_set, this, _1, _2) ); @@ -173,21 +173,21 @@ void usrp2_impl::mboard_get(const wax::obj &key_, wax::obj &val){ return; case MBOARD_PROP_RX_DBOARD: - ASSERT_THROW(_rx_dboards.has_key(name)); - val = _rx_dboards[name]->get_link(); + ASSERT_THROW(name == ""); + val = _rx_dboard_proxy->get_link(); return; case MBOARD_PROP_RX_DBOARD_NAMES: - val = prop_names_t(_rx_dboards.get_keys()); + val = prop_names_t(1, ""); return; case MBOARD_PROP_TX_DBOARD: - ASSERT_THROW(_tx_dboards.has_key(name)); - val = _tx_dboards[name]->get_link(); + ASSERT_THROW(name == ""); + val = _tx_dboard_proxy->get_link(); return; case MBOARD_PROP_TX_DBOARD_NAMES: - val = prop_names_t(_tx_dboards.get_keys()); + val = prop_names_t(1, ""); return; case MBOARD_PROP_CLOCK_RATE: @@ -195,21 +195,21 @@ void usrp2_impl::mboard_get(const wax::obj &key_, wax::obj &val){ return; case MBOARD_PROP_RX_DSP: - ASSERT_THROW(_rx_dsps.has_key(name)); - val = _rx_dsps[name]->get_link(); + ASSERT_THROW(name == ""); + val = _rx_dsp_proxy->get_link(); return; case MBOARD_PROP_RX_DSP_NAMES: - val = prop_names_t(_rx_dsps.get_keys()); + val = prop_names_t(1, ""); return; case MBOARD_PROP_TX_DSP: - ASSERT_THROW(_tx_dsps.has_key(name)); - val = _tx_dsps[name]->get_link(); + ASSERT_THROW(name == ""); + val = _tx_dsp_proxy->get_link(); return; case MBOARD_PROP_TX_DSP_NAMES: - val = prop_names_t(_tx_dsps.get_keys()); + val = prop_names_t(1, ""); return; case MBOARD_PROP_CLOCK_CONFIG: diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index d7a9845cd..a7be2da8c 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -255,12 +255,12 @@ void usrp2_impl::get(const wax::obj &key_, wax::obj &val){ return; case DEVICE_PROP_MBOARD: - ASSERT_THROW(_mboards.has_key(name)); - val = _mboards[name]->get_link(); + ASSERT_THROW(name == ""); + val = _mboard_proxy->get_link(); return; case DEVICE_PROP_MBOARD_NAMES: - val = prop_names_t(_mboards.get_keys()); + val = prop_names_t(1, ""); return; case DEVICE_PROP_MAX_RX_SAMPLES: diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index 26f9bb386..baa6530b8 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -163,18 +163,18 @@ private: void mboard_init(void); void mboard_get(const wax::obj &, wax::obj &); void mboard_set(const wax::obj &, const wax::obj &); - uhd::dict<std::string, wax_obj_proxy::sptr> _mboards; + wax_obj_proxy::sptr _mboard_proxy; //properties interface for rx dboard void rx_dboard_get(const wax::obj &, wax::obj &); void rx_dboard_set(const wax::obj &, const wax::obj &); - uhd::dict<std::string, wax_obj_proxy::sptr> _rx_dboards; + wax_obj_proxy::sptr _rx_dboard_proxy; uhd::prop_names_t _rx_subdevs_in_use; //properties interface for tx dboard void tx_dboard_get(const wax::obj &, wax::obj &); void tx_dboard_set(const wax::obj &, const wax::obj &); - uhd::dict<std::string, wax_obj_proxy::sptr> _tx_dboards; + wax_obj_proxy::sptr _tx_dboard_proxy; uhd::prop_names_t _tx_subdevs_in_use; void update_rx_mux_config(void); void update_tx_mux_config(void); @@ -196,12 +196,12 @@ private: //properties interface for ddc void ddc_get(const wax::obj &, wax::obj &); void ddc_set(const wax::obj &, const wax::obj &); - uhd::dict<std::string, wax_obj_proxy::sptr> _rx_dsps; + wax_obj_proxy::sptr _rx_dsp_proxy; //properties interface for duc void duc_get(const wax::obj &, wax::obj &); void duc_set(const wax::obj &, const wax::obj &); - uhd::dict<std::string, wax_obj_proxy::sptr> _tx_dsps; + wax_obj_proxy::sptr _tx_dsp_proxy; }; |