Change in osmo-trx[master]: lms: Move {under, over}run checks into separate method

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Dec 4 19:56:49 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/12125


Change subject: lms: Move {under,over}run checks into separate method
......................................................................

lms: Move {under,over}run checks into separate method

Change-Id: I7f450aa79f6285d14826c40ecfdd9490d00509ef
---
M Transceiver52M/device/lms/LMSDevice.cpp
M Transceiver52M/device/lms/LMSDevice.h
2 files changed, 18 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/25/12125/1

diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 9804bbd..8ad7115 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -499,13 +499,27 @@
 	return GSM::Time(6,7);
 }
 
+void LMSDevice::update_stream_stats(size_t chan, bool * underrun, bool * overrun)
+{
+	lms_stream_status_t status;
+	if (LMS_GetStreamStatus(&m_lms_stream_rx[chan], &status) == 0) {
+		if (status.underrun > m_last_rx_underruns[chan])
+			*underrun = true;
+		m_last_rx_underruns[chan] = status.underrun;
+
+		if (status.overrun > m_last_rx_overruns[chan])
+			*overrun = true;
+		m_last_rx_overruns[chan] = status.overrun;
+		LOGC(DDEV, NOTICE) << "chan " << chan << ": underrun " << status.underrun << ", overrun " << status.overrun;
+	}
+}
+
 // NOTE: Assumes sequential reads
 int LMSDevice::readSamples(std::vector < short *>&bufs, int len, bool * overrun,
 			   TIMESTAMP timestamp, bool * underrun, unsigned *RSSI)
 {
 	int rc = 0;
 	unsigned int i;
-	lms_stream_status_t status;
 	lms_stream_meta_t rx_metadata = {};
 	rx_metadata.flushPartialPacket = false;
 	rx_metadata.waitForTimestamp = false;
@@ -521,23 +535,14 @@
 	for (i = 0; i<chans; i++) {
 		thread_enable_cancel(false);
 		rc = LMS_RecvStream(&m_lms_stream_rx[i], bufs[i], len, &rx_metadata, 100);
+		update_stream_stats(i, underrun, overrun);
 		if (rc != len) {
 			LOGC(DDEV, ALERT) << "LMS: Device receive timed out (" << rc << " vs exp " << len << ").";
 			thread_enable_cancel(true);
 			return -1;
 		}
-		if (timestamp != (TIMESTAMP)rx_metadata.timestamp)
+		//if (timestamp != (TIMESTAMP)rx_metadata.timestamp)
 			LOGC(DDEV, ALERT) << "chan "<< i << " recv buffer of len " << rc << " expect " << std::hex << timestamp << " got " << std::hex << (TIMESTAMP)rx_metadata.timestamp << " (" << std::hex << rx_metadata.timestamp <<") diff=" << rx_metadata.timestamp - timestamp;
-
-		if (LMS_GetStreamStatus(&m_lms_stream_rx[i], &status) == 0) {
-			if (status.underrun > m_last_rx_underruns[i])
-				*underrun = true;
-			m_last_rx_underruns[i] = status.underrun;
-
-			if (status.overrun > m_last_rx_overruns[i])
-				*overrun = true;
-			m_last_rx_overruns[i] = status.overrun;
-		}
 		thread_enable_cancel(true);
 	}
 
diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h
index d1a8813..fde2408 100644
--- a/Transceiver52M/device/lms/LMSDevice.h
+++ b/Transceiver52M/device/lms/LMSDevice.h
@@ -67,6 +67,7 @@
 
 	int get_ant_idx(const std::string & name, bool dir_tx, size_t chan);
 	bool flush_recv(size_t num_pkts);
+	void update_stream_stats(size_t chan, bool * underrun, bool * overrun);
 
 public:
 

-- 
To view, visit https://gerrit.osmocom.org/12125
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f450aa79f6285d14826c40ecfdd9490d00509ef
Gerrit-Change-Number: 12125
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181204/d3255be0/attachment.htm>


More information about the gerrit-log mailing list