aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Transceiver52M/Transceiver.cpp8
-rw-r--r--Transceiver52M/device/radioDevice.h5
-rw-r--r--Transceiver52M/device/uhd/UHDDevice.cpp10
-rw-r--r--Transceiver52M/device/usrp1/USRPDevice.cpp4
-rw-r--r--Transceiver52M/device/usrp1/USRPDevice.h3
-rw-r--r--Transceiver52M/radioInterface.h3
6 files changed, 26 insertions, 7 deletions
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 @@ using namespace GSM;
#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 @@ void Transceiver::driveTxFIFO()
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 @@ class RadioDevice {
/** 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 @@ public:
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 @@ bool uhd_device::requiresRadioAlign()
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 @@ bool USRPDevice::requiresRadioAlign()
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 @@ private:
/** 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 @@ public:
/** 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();