[MERGED] osmo-trx[master]: Transceiver: Move device specific code to radioDevice class

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Apr 25 19:00:52 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: Transceiver: Move device specific code to radioDevice class
......................................................................


Transceiver: Move device specific code to radioDevice class

Change-Id: Ibcf258d8bf8595e286682e0bc59391b239ea7642
---
M Transceiver52M/Transceiver.cpp
M Transceiver52M/device/radioDevice.h
M Transceiver52M/device/uhd/UHDDevice.cpp
M Transceiver52M/device/usrp1/USRPDevice.cpp
M Transceiver52M/device/usrp1/USRPDevice.h
M Transceiver52M/radioInterface.h
6 files changed, 26 insertions(+), 7 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 2d3771c..be6f526 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -35,12 +35,6 @@
 
 #define USB_LATENCY_INTRVL		10,0
 
-#if USE_UHD
-#  define USB_LATENCY_MIN		6,7
-#else
-#  define USB_LATENCY_MIN		1,1
-#endif
-
 /* Number of running values use in noise average */
 #define NOISE_CNT			20
 
@@ -994,7 +988,7 @@
         else {
           // if underrun hasn't occurred in the last sec (216 frames) drop
           //    transmit latency by a timeslot
-          if (mTransmitLatency > GSM::Time(USB_LATENCY_MIN)) {
+          if (mTransmitLatency > mRadioInterface->minLatency()) {
               if (radioClock->get() > mLatencyUpdateTime + GSM::Time(216,0)) {
               mTransmitLatency.decTN();
               LOG(INFO) << "reduced latency: " << mTransmitLatency;
diff --git a/Transceiver52M/device/radioDevice.h b/Transceiver52M/device/radioDevice.h
index 8915b17..44636d5 100644
--- a/Transceiver52M/device/radioDevice.h
+++ b/Transceiver52M/device/radioDevice.h
@@ -18,6 +18,8 @@
 #include <string>
 #include <vector>
 
+#include "GSMCommon.h"
+
 extern "C" {
 #include "config_defs.h"
 }
@@ -151,6 +153,9 @@
   /** return whether user drives synchronization of Tx/Rx of USRP */
   virtual bool requiresRadioAlign() = 0;
 
+  /** Minimum latency that the device can achieve */
+  virtual GSM::Time minLatency() = 0;
+
   /** Return internal status values */
   virtual double getTxFreq(size_t chan = 0) = 0;
   virtual double getRxFreq(size_t chan = 0) = 0;
diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index ecdebe1..0d59bfc 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -257,6 +257,8 @@
 
 	bool requiresRadioAlign();
 
+	GSM::Time minLatency();
+
 	inline double getSampleRate() { return tx_rate; }
 	inline double numberRead() { return rx_pkt_cnt; }
 	inline double numberWritten() { return 0; }
@@ -1289,6 +1291,14 @@
 	return false;
 }
 
+GSM::Time uhd_device::minLatency() {
+	/* Empirical data from a handful of
+	relatively recent machines shows that the B100 will underrun when
+	the transmit threshold is reduced to a time of 6 and a half frames,
+	so we set a minimum 7 frame threshold. */
+	return GSM::Time(6,7);
+}
+
 /*
  * Only allow sampling the Rx path lower than Tx and not vice-versa.
  * Using Tx with 4 SPS and Rx at 1 SPS is the only allowed mixed
diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp b/Transceiver52M/device/usrp1/USRPDevice.cpp
index 455528a..7f73f43 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.cpp
+++ b/Transceiver52M/device/usrp1/USRPDevice.cpp
@@ -358,6 +358,10 @@
 	return true;
 }
 
+GSM::Time USRPDevice::minLatency() {
+	return GSM::Time(1,1);
+}
+
 // NOTE: Assumes sequential reads
 int USRPDevice::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
                             TIMESTAMP timestamp, bool *underrun, unsigned *RSSI)
diff --git a/Transceiver52M/device/usrp1/USRPDevice.h b/Transceiver52M/device/usrp1/USRPDevice.h
index 9091dea..6304ea1 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.h
+++ b/Transceiver52M/device/usrp1/USRPDevice.h
@@ -194,6 +194,9 @@
   /** return whether user drives synchronization of Tx/Rx of USRP */
   bool requiresRadioAlign();
 
+  /** return whether user drives synchronization of Tx/Rx of USRP */
+  virtual GSM::Time minLatency();
+
   /** Return internal status values */
   inline double getTxFreq(size_t chan = 0) { return 0; }
   inline double getRxFreq(size_t chan = 0) { return 0; }
diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h
index 6b482d1..ffcacdd 100644
--- a/Transceiver52M/radioInterface.h
+++ b/Transceiver52M/radioInterface.h
@@ -133,6 +133,9 @@
   /** get transport window type of attached device */ 
   enum RadioDevice::TxWindowType getWindowType() { return mRadio->getWindowType(); }
 
+  /** Minimum latency that the device can achieve */
+  GSM::Time minLatency()  { return mRadio->minLatency(); }
+
 protected:
   /** drive synchronization of Tx/Rx of USRP */
   void alignRadio();

-- 
To view, visit https://gerrit.osmocom.org/7916
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibcf258d8bf8595e286682e0bc59391b239ea7642
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list