From 4e775027871a7676bb49076cf56638aef2529bfe Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 4 May 2020 06:51:53 -0700 Subject: cores: Fix rx_vita_core_3000 assertion error in issue_stream_cmd() The current code had an assertion UHD_ASSERT_THROW(stream_cmd.num_samps <= 0x0fffffff); which would check that num_samps in a stream command don't exceed the counter depth in the FPGA. However, this is only relevant if the stream command is not "continuous" or "stop". num_samps could be unitialized, and randomly have a value larger than the maximum, and the assertion could trigger even though the value in num_samps is irrelevant. The new assertion checks for the correct case, and has a more verbose error message. --- host/lib/usrp/cores/rx_vita_core_3000.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'host/lib/usrp/cores') diff --git a/host/lib/usrp/cores/rx_vita_core_3000.cpp b/host/lib/usrp/cores/rx_vita_core_3000.cpp index 8a20e637b..4b09f75fd 100644 --- a/host/lib/usrp/cores/rx_vita_core_3000.cpp +++ b/host/lib/usrp/cores/rx_vita_core_3000.cpp @@ -82,9 +82,13 @@ struct rx_vita_core_3000_impl : rx_vita_core_3000 // not setup yet!"; return; } - UHD_ASSERT_THROW(stream_cmd.num_samps <= 0x0fffffff); - _continuous_streaming = stream_cmd.stream_mode - == stream_cmd_t::STREAM_MODE_START_CONTINUOUS; + if ((stream_cmd.stream_mode == stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE + || stream_cmd.stream_mode == stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_MORE) + && stream_cmd.num_samps > 0x0fffffff) { + throw uhd::assertion_error( + "Invalid stream command: num_samps exceeds maximum value! " + "(Note: Chain multiple commands to request larger bursts)"); + } // setup the mode to instruction flags typedef std::tuple inst_t; -- cgit v1.2.3