Transceiver: Move device specific code to radioDevice class
Change-Id: Ibcf258d8bf8595e286682e0bc59391b239ea7642
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; }