aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2022-02-18 12:13:09 +0100
committerAaron Rossetto <aaron.rossetto@ni.com>2022-02-24 13:40:56 -0600
commitbab20adbb4f7db28007dd2e65b9ab36d01d40615 (patch)
tree6eb659f5e43cc2f4b8a802a119b729c043478697 /host
parentbcdb8a1b8f98625c7414138b18f519cdb2ff7bcf (diff)
downloaduhd-bab20adbb4f7db28007dd2e65b9ab36d01d40615.tar.gz
uhd-bab20adbb4f7db28007dd2e65b9ab36d01d40615.tar.bz2
uhd-bab20adbb4f7db28007dd2e65b9ab36d01d40615.zip
rfnoc: replay: Add action handler for stream commands
When connecting an Rx streamer to a replay block, this now allows requesting data from the replay block using a stream command. This will automatically request data from all ports the streamer is connected to, and even if there are blocks in between (depending on their action forwarding policies).
Diffstat (limited to 'host')
-rw-r--r--host/lib/rfnoc/replay_block_control.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/host/lib/rfnoc/replay_block_control.cpp b/host/lib/rfnoc/replay_block_control.cpp
index ce431ba80..43a5ff43b 100644
--- a/host/lib/rfnoc/replay_block_control.cpp
+++ b/host/lib/rfnoc/replay_block_control.cpp
@@ -91,6 +91,8 @@ public:
get_unique_id(),
false /* Let it slide if minors mismatch */
);
+ RFNOC_LOG_TRACE(
+ "Initializing replay block with num ports=" << get_num_input_ports());
// Properties and actions can't propagate through this block, as we
// treat source and sink of this block like the radio (they terminate
// the graph).
@@ -98,6 +100,30 @@ public:
set_action_forwarding_policy(forwarding_policy_t::DROP);
// Same for MTU
set_mtu_forwarding_policy(forwarding_policy_t::DROP);
+ // Register action handler
+ register_action_handler(ACTION_KEY_STREAM_CMD,
+ [this](const res_source_info& src, action_info::sptr action) {
+ stream_cmd_action_info::sptr stream_cmd_action =
+ std::dynamic_pointer_cast<stream_cmd_action_info>(action);
+ if (!stream_cmd_action) {
+ RFNOC_LOG_WARNING("Received invalid stream command action!");
+ return;
+ }
+ RFNOC_LOG_TRACE("Received stream command: "
+ << stream_cmd_action->stream_cmd.stream_mode << " to "
+ << src.to_string());
+ if (src.type != res_source_info::OUTPUT_EDGE) {
+ RFNOC_LOG_WARNING(
+ "Received stream command, but not to output port! Ignoring.");
+ return;
+ }
+ const size_t port = src.instance;
+ if (port >= get_num_output_ports()) {
+ RFNOC_LOG_WARNING("Received stream command to invalid output port!");
+ return;
+ }
+ issue_stream_cmd(stream_cmd_action->stream_cmd, port);
+ });
// Initialize record properties
_record_type.reserve(_num_input_ports);