From 4888233252d58f0df3c8773ec3268a0ed7bea1d2 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 28 Jun 2011 11:11:04 -0700 Subject: uhd: re-work to make the properties easier to use --- host/lib/usrp/cores/rx_dsp_core_200.cpp | 14 ++++++-- host/lib/usrp/cores/rx_dsp_core_200.hpp | 2 +- host/lib/usrp/dboard_manager.cpp | 57 +++++++++++++-------------------- 3 files changed, 35 insertions(+), 38 deletions(-) (limited to 'host/lib/usrp') 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(subdev[SUBDEV_PROP_NAME].as())); + tree->create(root / "name").set(subdev[SUBDEV_PROP_NAME].as()); const prop_names_t sensor_names = subdev[SUBDEV_PROP_SENSOR_NAMES].as(); BOOST_FOREACH(const std::string &name, sensor_names){ - property sensor_prop; - sensor_prop.publish(boost::bind(&get_sensor, subdev, name)); - tree->create(root / "sensors" / name, sensor_prop); + tree->create(root / "sensors" / name) + .publish(boost::bind(&get_sensor, subdev, name)); } const prop_names_t gain_names = subdev[SUBDEV_PROP_GAIN_NAMES].as(); BOOST_FOREACH(const std::string &name, gain_names){ - property gain_prop; - gain_prop.subscribe_master(boost::bind(&get_set_gain, subdev, name, _1)); - tree->create(root / "gains" / name / "value", gain_prop); - property 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(root / "gains" / name / "value") + .subscribe_master(boost::bind(&get_set_gain, subdev, name, _1)); + tree->create(root / "gains" / name / "range") + .publish(boost::bind(&get_gain_range, subdev, name)); } - property freq_prop; - freq_prop.subscribe_master(boost::bind(&get_set_freq, subdev, _1)); - tree->create(root / "freq/value", freq_prop); + tree->create(root / "freq/value") + .subscribe_master(boost::bind(&get_set_freq, subdev, _1)); - property freq_range_prop; - freq_range_prop.publish(boost::bind(&get_freq_range, subdev)); - tree->create(root / "freq/range", freq_range_prop); + tree->create(root / "freq/range") + .publish(boost::bind(&get_freq_range, subdev)); - property ant_prop; - ant_prop.subscribe_master(boost::bind(&get_set_ant, subdev, _1)); - tree->create(root / "antenna/value", ant_prop); + tree->create(root / "antenna/value") + .subscribe_master(boost::bind(&get_set_ant, subdev, _1)); - property > ants_prop; - ants_prop.publish(boost::bind(&get_ants, subdev)); - tree->create(root / "antenna/options", ants_prop); + tree->create >(root / "antenna/options") + .publish(boost::bind(&get_ants, subdev)); - property conn_prop; - conn_prop.publish(boost::bind(&get_conn, subdev)); - tree->create(root / "connection", conn_prop); + tree->create(root / "connection") + .publish(boost::bind(&get_conn, subdev)); - property enb_prop; - enb_prop.subscribe_master(boost::bind(&get_set_enb, subdev, _1)); - tree->create(root / "enabled", enb_prop); + tree->create(root / "enabled") + .subscribe_master(boost::bind(&get_set_enb, subdev, _1)); - property 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(root / "use_lo_offset") + .publish(boost::bind(&get_use_lo_off, subdev)); - property bw_prop; - bw_prop.subscribe_master(boost::bind(&get_set_bw, subdev, _1)); - tree->create(root / "bandwidth/value", bw_prop); + tree->create(root / "bandwidth/value") + .subscribe_master(boost::bind(&get_set_bw, subdev, _1)); } -- cgit v1.2.3