diff options
Diffstat (limited to 'host/lib/rfnoc/rfnoc_rx_streamer.cpp')
-rw-r--r-- | host/lib/rfnoc/rfnoc_rx_streamer.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/host/lib/rfnoc/rfnoc_rx_streamer.cpp b/host/lib/rfnoc/rfnoc_rx_streamer.cpp index d57b8aab2..5e6dddcbe 100644 --- a/host/lib/rfnoc/rfnoc_rx_streamer.cpp +++ b/host/lib/rfnoc/rfnoc_rx_streamer.cpp @@ -59,6 +59,7 @@ rfnoc_rx_streamer::rfnoc_rx_streamer(const size_t num_chans, _tick_rate_in.reserve(num_chans); _type_in.reserve(num_chans); _mtu_in.reserve(num_chans); + _atomic_item_size_in.reserve(num_chans); for (size_t i = 0; i < num_chans; i++) { _register_props(i, stream_args.otw_format); @@ -188,13 +189,16 @@ void rfnoc_rx_streamer::_register_props(const size_t chan, const std::string& ot PROP_KEY_TYPE, otw_format, {res_source_info::INPUT_EDGE, chan})); _mtu_in.emplace_back( property_t<size_t>(PROP_KEY_MTU, get_mtu(), {res_source_info::INPUT_EDGE, chan})); + _atomic_item_size_in.emplace_back( + property_t<size_t>(PROP_KEY_ATOMIC_ITEM_SIZE, 1, {res_source_info::INPUT_EDGE, chan})); // Give us some shorthands for the rest of this function - property_t<double>* scaling_in = &_scaling_in.back(); - property_t<double>* samp_rate_in = &_samp_rate_in.back(); - property_t<double>* tick_rate_in = &_tick_rate_in.back(); - property_t<std::string>* type_in = &_type_in.back(); - property_t<size_t>* mtu_in = &_mtu_in.back(); + property_t<double>* scaling_in = &_scaling_in.back(); + property_t<double>* samp_rate_in = &_samp_rate_in.back(); + property_t<double>* tick_rate_in = &_tick_rate_in.back(); + property_t<std::string>* type_in = &_type_in.back(); + property_t<size_t>* mtu_in = &_mtu_in.back(); + property_t<size_t>* atomic_item_size_in = &_atomic_item_size_in.back(); // Register them register_property(scaling_in); @@ -202,6 +206,7 @@ void rfnoc_rx_streamer::_register_props(const size_t chan, const std::string& ot register_property(tick_rate_in); register_property(type_in); register_property(mtu_in); + register_property(atomic_item_size_in); // Add resolvers add_property_resolver({scaling_in}, {}, [& scaling_in = *scaling_in, chan, this]() { @@ -228,6 +233,24 @@ void rfnoc_rx_streamer::_register_props(const size_t chan, const std::string& ot this->set_tick_rate(tick_rate_in.get()); } }); + + add_property_resolver( + {atomic_item_size_in, mtu_in}, {}, [&ais = *atomic_item_size_in, chan, this]() { + const auto UHD_UNUSED(log_chan) = chan; + RFNOC_LOG_TRACE("Calling resolver for `atomic_item_size'@" << chan); + if (ais.is_valid()) { + const auto spp = this->rx_streamer_impl::get_max_num_samps(); + if (spp < ais.get()) { + throw uhd::value_error("samples per package must not be smaller than atomic item size"); + } + const auto misalignment = spp % ais.get(); + RFNOC_LOG_TRACE("Check atomic item size " << ais.get() << " divides spp " << spp); + if (misalignment > 0) { + RFNOC_LOG_TRACE("Reduce spp by " << misalignment << " to align with atomic item size"); + this->rx_streamer_impl::set_max_num_samps(spp - misalignment); + } + } + }); } void rfnoc_rx_streamer::_handle_rx_event_action( |