Change in osmo-trx[master]: devices: reset internal smart sample buffers upon stop

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Aug 25 11:39:28 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/19646 )

Change subject: devices: reset internal smart sample buffers upon stop
......................................................................

devices: reset internal smart sample buffers upon stop

They are too smart, they keep the timestamps.

Change-Id: Idb4b8f03eb5ffdfd6d3fdbc137b20e3ddc4cfa65
---
M Transceiver52M/device/common/smpl_buf.cpp
M Transceiver52M/device/common/smpl_buf.h
M Transceiver52M/device/ipc/IPCDevice.cpp
M Transceiver52M/device/uhd/UHDDevice.cpp
4 files changed, 22 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  fixeria: Looks good to me, but someone else must approve



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 @@
 	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 @@
 	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 @@
 
 	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 @@
 	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;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/19646
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Idb4b8f03eb5ffdfd6d3fdbc137b20e3ddc4cfa65
Gerrit-Change-Number: 19646
Gerrit-PatchSet: 12
Gerrit-Owner: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200825/c504482d/attachment.htm>


More information about the gerrit-log mailing list