aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M
diff options
context:
space:
mode:
authorEric <ewild@sysmocom.de>2020-07-16 18:08:30 +0200
committerEric <ewild@sysmocom.de>2020-08-25 01:00:19 +0200
commit4080eb76f890ea21bb89b402c0b5b6b1b05b9428 (patch)
tree93ff848723d37a72d6d5e30cdf75a4dea51c2f10 /Transceiver52M
parent1e17c4fb0a77dcee49a7cd566dca7e8f48f6d8e7 (diff)
devices: reset internal smart sample buffers upon stop
They are too smart, they keep the timestamps. Change-Id: Idb4b8f03eb5ffdfd6d3fdbc137b20e3ddc4cfa65
Diffstat (limited to 'Transceiver52M')
-rw-r--r--Transceiver52M/device/common/smpl_buf.cpp12
-rw-r--r--Transceiver52M/device/common/smpl_buf.h4
-rw-r--r--Transceiver52M/device/ipc/IPCDevice.cpp4
-rw-r--r--Transceiver52M/device/uhd/UHDDevice.cpp4
4 files changed, 22 insertions, 2 deletions
diff --git a/Transceiver52M/device/common/smpl_buf.cpp b/Transceiver52M/device/common/smpl_buf.cpp
index ceca000..e57eb0c 100644
--- a/Transceiver52M/device/common/smpl_buf.cpp
+++ b/Transceiver52M/device/common/smpl_buf.cpp
@@ -28,9 +28,9 @@
#include <inttypes.h>
smpl_buf::smpl_buf(size_t len)
- : buf_len(len), time_start(0), time_end(0),
- data_start(0), data_end(0)
+ : buf_len(len)
{
+ reset();
data = new uint32_t[len];
}
@@ -39,6 +39,14 @@ smpl_buf::~smpl_buf()
delete[] data;
}
+void smpl_buf::reset()
+{
+ time_start = 0;
+ time_end = 0;
+ data_start = 0;
+ data_end = 0;
+}
+
ssize_t smpl_buf::avail_smpls(TIMESTAMP timestamp) const
{
if (timestamp < time_start)
diff --git a/Transceiver52M/device/common/smpl_buf.h b/Transceiver52M/device/common/smpl_buf.h
index 0b49b82..ff02baf 100644
--- a/Transceiver52M/device/common/smpl_buf.h
+++ b/Transceiver52M/device/common/smpl_buf.h
@@ -44,6 +44,10 @@ public:
smpl_buf(size_t len);
~smpl_buf();
+ /** Reset this buffer, keeps the size
+ */
+ void reset();
+
/** Query number of samples available for reading
@param timestamp time of first sample
@return number of available samples or error
diff --git a/Transceiver52M/device/ipc/IPCDevice.cpp b/Transceiver52M/device/ipc/IPCDevice.cpp
index 4a1f8b6..32a46e5 100644
--- a/Transceiver52M/device/ipc/IPCDevice.cpp
+++ b/Transceiver52M/device/ipc/IPCDevice.cpp
@@ -980,6 +980,10 @@ bool IPCDevice::stop()
LOGC(DDEV, NOTICE) << "All channels stopped, terminating...";
+ /* reset internal buffer timestamps */
+ for (size_t i = 0; i < rx_buffers.size(); i++)
+ rx_buffers[i]->reset();
+
started = false;
return true;
}
diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index 43b9f9c..143a061 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -750,6 +750,10 @@ bool uhd_device::stop()
async_event_thrd->join();
delete async_event_thrd;
+ /* reset internal buffer timestamps */
+ for (size_t i = 0; i < rx_buffers.size(); i++)
+ rx_buffers[i]->reset();
+
started = false;
return true;
}