diff options
Diffstat (limited to 'host')
| -rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 11 | ||||
| -rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 19 | ||||
| -rw-r--r-- | host/lib/usrp/multi_usrp_rfnoc.cpp | 17 | 
3 files changed, 45 insertions, 2 deletions
| diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index 27b5f3d9a..4efc062b0 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -614,6 +614,17 @@ public:       */      virtual void set_rx_rate(double rate, size_t chan = ALL_CHANS) = 0; +    /*! Set the number of samples sent per packet (spp) for RX streaming +     * +     * On RFNoC devices, this will set the spp value on the radio itself. For +     * older devices, it will inject the spp value into a later get_rx_stream() +     * call, but it won't change anything in existing streamers. +     * +     * \param spp the new spp value +     * \param chan the channel index 0 to N-1 +     */ +    virtual void set_rx_spp(const size_t spp, const size_t chan = ALL_CHANS) = 0; +      /*!       * Gets the RX sample rate.       * \param chan the channel index 0 to N-1 diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 6dad00787..1b39a2827 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -961,7 +961,16 @@ public:       ******************************************************************/      rx_streamer::sptr get_rx_stream(const stream_args_t &args) {          _check_link_rate(args, false); -        return this->get_device()->get_rx_stream(args); +        stream_args_t args_ = args; +        if (!args.args.has_key("spp")) { +            for (auto chan : args.channels) { +                if (_rx_spp.count(chan)) { +                    args_.args.set("spp", std::to_string(_rx_spp.at(chan))); +                    break; +                } +            } +        } +        return this->get_device()->get_rx_stream(args_);      }      void set_rx_subdev_spec(const subdev_spec_t &spec, size_t mboard){ @@ -1018,6 +1027,11 @@ public:          }      } +    void set_rx_spp(const size_t spp, const size_t chan = ALL_CHANS) +    { +        _rx_spp[chan] = spp; +    } +      double get_rx_rate(size_t chan){          return _tree->access<double>(rx_dsp_root(chan) / "rate" / "value").get();      } @@ -2258,6 +2272,9 @@ private:      device::sptr _dev;      property_tree::sptr _tree; +    //! Container for spp values set in set_rx_spp() +    std::unordered_map<size_t, size_t> _rx_spp; +      struct mboard_chan_pair{          size_t mboard, chan;          mboard_chan_pair(void): mboard(0), chan(0){} diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index b3851ba9e..d6f16824d 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -16,8 +16,9 @@  #include <uhd/utils/graph_utils.hpp>  #include <uhdlib/rfnoc/rfnoc_device.hpp>  #include <uhdlib/usrp/gpio_defs.hpp> +#include <uhdlib/utils/narrow.hpp>  #include <unordered_set> -#include <boost/pointer_cast.hpp> +#include <boost/format.hpp>  #include <algorithm>  #include <chrono>  #include <memory> @@ -1044,6 +1045,20 @@ public:          _rx_rates[chan] = actual_rate;      } +    void set_rx_spp(const size_t spp, const size_t chan = ALL_CHANS) +    { +        std::lock_guard<std::recursive_mutex> l(_graph_mutex); +        if (chan == ALL_CHANS) { +            for (size_t chan = 0; chan < _rx_chans.size(); ++chan) { +                set_rx_spp(spp, chan); +            } +            return; +        } +        auto rx_chain = _get_rx_chan(chan); +        rx_chain.radio->set_property<int>( +            "spp", narrow_cast<int>(spp), rx_chain.block_chan); +    } +      double get_rx_rate(size_t chan)      {          std::lock_guard<std::recursive_mutex> l(_graph_mutex); | 
