From 84018da8b5022d75b463dd562e2ff45a6b3ae5fc Mon Sep 17 00:00:00 2001 From: Wade Fife Date: Thu, 8 Nov 2018 11:40:07 -0600 Subject: rfnoc: Add halt to replay API The HALT feature allows a command that takes a long time to run to be stopped while it is in progress. --- host/examples/replay_samples_from_file.cpp | 6 +++++- host/include/uhd/rfnoc/replay_block_ctrl.hpp | 3 +++ host/lib/rfnoc/replay_block_ctrl_impl.cpp | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'host') diff --git a/host/examples/replay_samples_from_file.cpp b/host/examples/replay_samples_from_file.cpp index f9ef3cd45..a8b5d40e9 100644 --- a/host/examples/replay_samples_from_file.cpp +++ b/host/examples/replay_samples_from_file.cpp @@ -346,9 +346,13 @@ int UHD_SAFE_MAIN(int argc, char *argv[]) cout << endl << "Stopping replay..." << endl; replay_ctrl->issue_stream_cmd(stream_cmd, replay_chan); + // The stop takes effect after the current command has completed, so use + // halt to stop the command in progress and clear any queued commands. + replay_ctrl->play_halt(replay_chan); + /////////////////////////////////////////////////////////////////////////// - // Wait for the replay data to flush out + // Wait for any buffered replay data to finish playing out uint16_t prev_packet_count, packet_count; diff --git a/host/include/uhd/rfnoc/replay_block_ctrl.hpp b/host/include/uhd/rfnoc/replay_block_ctrl.hpp index bd5c47739..ba49a6a7d 100644 --- a/host/include/uhd/rfnoc/replay_block_ctrl.hpp +++ b/host/include/uhd/rfnoc/replay_block_ctrl.hpp @@ -60,6 +60,9 @@ public: //! Returns the size of the packets played by the Replay block (in 64-bit words) virtual uint32_t get_words_per_packet(const size_t chan) = 0; + //! Halts playback and clears the playback command FIFO + virtual void play_halt(const size_t chan) = 0; + }; /* class replay_block_ctrl*/ }} /* namespace uhd::rfnoc */ diff --git a/host/lib/rfnoc/replay_block_ctrl_impl.cpp b/host/lib/rfnoc/replay_block_ctrl_impl.cpp index 3809cebc0..e9b119085 100644 --- a/host/lib/rfnoc/replay_block_ctrl_impl.cpp +++ b/host/lib/rfnoc/replay_block_ctrl_impl.cpp @@ -98,6 +98,10 @@ public: uint32_t get_words_per_packet(const size_t chan) { return _params[chan].words_per_packet; } + + void play_halt(const size_t chan) { + sr_write("RX_CTRL_HALT", 1, chan); + } /*************************************************************************** -- cgit v1.2.3