aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/rfnoc_tx_streamer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/rfnoc/rfnoc_tx_streamer.cpp')
-rw-r--r--host/lib/rfnoc/rfnoc_tx_streamer.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/host/lib/rfnoc/rfnoc_tx_streamer.cpp b/host/lib/rfnoc/rfnoc_tx_streamer.cpp
index 969c41ae6..411affe62 100644
--- a/host/lib/rfnoc/rfnoc_tx_streamer.cpp
+++ b/host/lib/rfnoc/rfnoc_tx_streamer.cpp
@@ -47,6 +47,7 @@ rfnoc_tx_streamer::rfnoc_tx_streamer(const size_t num_chans,
_tick_rate_out.reserve(num_chans);
_type_out.reserve(num_chans);
_mtu_out.reserve(num_chans);
+ _atomic_item_size_out.reserve(num_chans);
for (size_t i = 0; i < num_chans; i++) {
_register_props(i, stream_args.otw_format);
@@ -171,13 +172,16 @@ void rfnoc_tx_streamer::_register_props(const size_t chan, const std::string& ot
PROP_KEY_TYPE, otw_format, {res_source_info::OUTPUT_EDGE, chan}));
_mtu_out.push_back(property_t<size_t>(
PROP_KEY_MTU, get_mtu(), {res_source_info::OUTPUT_EDGE, chan}));
+ _atomic_item_size_out.push_back(
+ property_t<size_t>(PROP_KEY_ATOMIC_ITEM_SIZE, 1, {res_source_info::OUTPUT_EDGE, chan}));
// Give us some shorthands for the rest of this function
- property_t<double>* scaling_out = &_scaling_out.back();
- property_t<double>* samp_rate_out = &_samp_rate_out.back();
- property_t<double>* tick_rate_out = &_tick_rate_out.back();
- property_t<std::string>* type_out = &_type_out.back();
- property_t<size_t>* mtu_out = &_mtu_out.back();
+ property_t<double>* scaling_out = &_scaling_out.back();
+ property_t<double>* samp_rate_out = &_samp_rate_out.back();
+ property_t<double>* tick_rate_out = &_tick_rate_out.back();
+ property_t<std::string>* type_out = &_type_out.back();
+ property_t<size_t>* mtu_out = &_mtu_out.back();
+ property_t<size_t>* atomic_item_size_out = &_atomic_item_size_out.back();
// Register them
register_property(scaling_out);
@@ -185,6 +189,7 @@ void rfnoc_tx_streamer::_register_props(const size_t chan, const std::string& ot
register_property(tick_rate_out);
register_property(type_out);
register_property(mtu_out);
+ register_property(atomic_item_size_out);
// Add resolvers
add_property_resolver(
@@ -212,6 +217,23 @@ void rfnoc_tx_streamer::_register_props(const size_t chan, const std::string& ot
this->set_tick_rate(tick_rate_out.get());
}
});
+ add_property_resolver(
+ {atomic_item_size_out, mtu_out}, {}, [&ais = *atomic_item_size_out, 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->tx_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->tx_streamer_impl::set_max_num_samps(spp - misalignment);
+ }
+ }
+ });
}
void rfnoc_tx_streamer::_handle_tx_event_action(