diff options
author | Josh Blum <josh@joshknows.com> | 2011-06-28 11:11:04 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-06-28 11:11:04 -0700 |
commit | 4888233252d58f0df3c8773ec3268a0ed7bea1d2 (patch) | |
tree | 33daab577ff64117e647bb5d6e97397c89ff6b11 /host/lib/usrp | |
parent | 3a6187515677b277489df4ec59f9cf21f1ed62bc (diff) | |
download | uhd-4888233252d58f0df3c8773ec3268a0ed7bea1d2.tar.gz uhd-4888233252d58f0df3c8773ec3268a0ed7bea1d2.tar.bz2 uhd-4888233252d58f0df3c8773ec3268a0ed7bea1d2.zip |
uhd: re-work to make the properties easier to use
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/cores/rx_dsp_core_200.cpp | 14 | ||||
-rw-r--r-- | host/lib/usrp/cores/rx_dsp_core_200.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/dboard_manager.cpp | 57 |
3 files changed, 35 insertions, 38 deletions
diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp index 5aa32c630..b13cc8f03 100644 --- a/host/lib/usrp/cores/rx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp @@ -48,10 +48,18 @@ public: rx_dsp_core_200_impl( wb_iface::sptr iface, const size_t dsp_base, const size_t ctrl_base, - const boost::uint32_t sid + const boost::uint32_t sid, const bool lingering_packet ): _iface(iface), _dsp_base(dsp_base), _ctrl_base(ctrl_base) { + //This is a hack/fix for the lingering packet problem. + //The caller should also flush the recv transports + if (lingering_packet){ + stream_cmd_t stream_cmd(stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); + stream_cmd.num_samps = 1; + issue_stream_command(stream_cmd); + } + _iface->poke32(REG_RX_CTRL_CLEAR, 1); //reset _iface->poke32(REG_RX_CTRL_NCHANNELS, 1); _iface->poke32(REG_RX_CTRL_VRT_HDR, 0 @@ -162,6 +170,6 @@ private: bool _continuous_streaming; }; -rx_dsp_core_200::sptr rx_dsp_core_200::make(wb_iface::sptr iface, const size_t dsp_base, const size_t ctrl_base, const boost::uint32_t sid){ - return sptr(new rx_dsp_core_200_impl(iface, dsp_base, ctrl_base, sid)); +rx_dsp_core_200::sptr rx_dsp_core_200::make(wb_iface::sptr iface, const size_t dsp_base, const size_t ctrl_base, const boost::uint32_t sid, const bool lingering_packet){ + return sptr(new rx_dsp_core_200_impl(iface, dsp_base, ctrl_base, sid, lingering_packet)); } diff --git a/host/lib/usrp/cores/rx_dsp_core_200.hpp b/host/lib/usrp/cores/rx_dsp_core_200.hpp index 6bc7c6102..c496fca76 100644 --- a/host/lib/usrp/cores/rx_dsp_core_200.hpp +++ b/host/lib/usrp/cores/rx_dsp_core_200.hpp @@ -32,7 +32,7 @@ public: static sptr make( wb_iface::sptr iface, const size_t dsp_base, const size_t ctrl_base, - const boost::uint32_t sid + const boost::uint32_t sid, const bool lingering_packet = false ); virtual void set_nsamps_per_packet(const size_t nsamps) = 0; diff --git a/host/lib/usrp/dboard_manager.cpp b/host/lib/usrp/dboard_manager.cpp index 5b9186a32..bff55009e 100644 --- a/host/lib/usrp/dboard_manager.cpp +++ b/host/lib/usrp/dboard_manager.cpp @@ -471,54 +471,43 @@ void dboard_manager::populate_prop_tree_from_subdev( const property_tree::path_type &root, wax::obj subdev ){ - tree->create(root / "name", property<std::string>(subdev[SUBDEV_PROP_NAME].as<std::string>())); + tree->create<std::string>(root / "name").set(subdev[SUBDEV_PROP_NAME].as<std::string>()); const prop_names_t sensor_names = subdev[SUBDEV_PROP_SENSOR_NAMES].as<prop_names_t>(); BOOST_FOREACH(const std::string &name, sensor_names){ - property<sensor_value_t> sensor_prop; - sensor_prop.publish(boost::bind(&get_sensor, subdev, name)); - tree->create(root / "sensors" / name, sensor_prop); + tree->create<sensor_value_t>(root / "sensors" / name) + .publish(boost::bind(&get_sensor, subdev, name)); } const prop_names_t gain_names = subdev[SUBDEV_PROP_GAIN_NAMES].as<prop_names_t>(); BOOST_FOREACH(const std::string &name, gain_names){ - property<double> gain_prop; - gain_prop.subscribe_master(boost::bind(&get_set_gain, subdev, name, _1)); - tree->create(root / "gains" / name / "value", gain_prop); - property<meta_range_t> gain_range_prop; - gain_range_prop.publish(boost::bind(&get_gain_range, subdev, name)); - tree->create(root / "gains" / name / "range", gain_range_prop); + tree->create<double>(root / "gains" / name / "value") + .subscribe_master(boost::bind(&get_set_gain, subdev, name, _1)); + tree->create<meta_range_t>(root / "gains" / name / "range") + .publish(boost::bind(&get_gain_range, subdev, name)); } - property<double> freq_prop; - freq_prop.subscribe_master(boost::bind(&get_set_freq, subdev, _1)); - tree->create(root / "freq/value", freq_prop); + tree->create<double>(root / "freq/value") + .subscribe_master(boost::bind(&get_set_freq, subdev, _1)); - property<meta_range_t> freq_range_prop; - freq_range_prop.publish(boost::bind(&get_freq_range, subdev)); - tree->create(root / "freq/range", freq_range_prop); + tree->create<meta_range_t>(root / "freq/range") + .publish(boost::bind(&get_freq_range, subdev)); - property<std::string> ant_prop; - ant_prop.subscribe_master(boost::bind(&get_set_ant, subdev, _1)); - tree->create(root / "antenna/value", ant_prop); + tree->create<std::string>(root / "antenna/value") + .subscribe_master(boost::bind(&get_set_ant, subdev, _1)); - property<std::vector<std::string> > ants_prop; - ants_prop.publish(boost::bind(&get_ants, subdev)); - tree->create(root / "antenna/options", ants_prop); + tree->create<std::vector<std::string> >(root / "antenna/options") + .publish(boost::bind(&get_ants, subdev)); - property<std::string> conn_prop; - conn_prop.publish(boost::bind(&get_conn, subdev)); - tree->create(root / "connection", conn_prop); + tree->create<std::string>(root / "connection") + .publish(boost::bind(&get_conn, subdev)); - property<bool> enb_prop; - enb_prop.subscribe_master(boost::bind(&get_set_enb, subdev, _1)); - tree->create(root / "enabled", enb_prop); + tree->create<bool>(root / "enabled") + .subscribe_master(boost::bind(&get_set_enb, subdev, _1)); - property<bool> use_lo_off_prop; - use_lo_off_prop.publish(boost::bind(&get_use_lo_off, subdev)); - tree->create(root / "use_lo_offset", use_lo_off_prop); + tree->create<bool>(root / "use_lo_offset") + .publish(boost::bind(&get_use_lo_off, subdev)); - property<double> bw_prop; - bw_prop.subscribe_master(boost::bind(&get_set_bw, subdev, _1)); - tree->create(root / "bandwidth/value", bw_prop); + tree->create<double>(root / "bandwidth/value") + .subscribe_master(boost::bind(&get_set_bw, subdev, _1)); } |