aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Transceiver52M/Makefile.am3
-rw-r--r--Transceiver52M/Transceiver.cpp19
-rw-r--r--Transceiver52M/UHDDevice.cpp64
-rw-r--r--Transceiver52M/USRPDevice.cpp7
-rw-r--r--Transceiver52M/USRPDevice.h2
-rw-r--r--Transceiver52M/radioDevice.h5
-rw-r--r--Transceiver52M/radioInterface.cpp24
-rw-r--r--Transceiver52M/radioInterface.h38
-rw-r--r--Transceiver52M/radioInterfaceDiversity.cpp248
-rw-r--r--Transceiver52M/radioInterfaceResamp.cpp16
-rw-r--r--Transceiver52M/runTransceiver.cpp14
11 files changed, 390 insertions, 50 deletions
diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index 8b37ea4..0e2276f 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -61,7 +61,8 @@ COMMON_SOURCES = \
libtransceiver_la_SOURCES = \
$(COMMON_SOURCES) \
Resampler.cpp \
- radioInterfaceResamp.cpp
+ radioInterfaceResamp.cpp \
+ radioInterfaceDiversity.cpp
noinst_PROGRAMS = \
transceiver
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 01fec5b..eae4e06 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -422,6 +422,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
bool success, equalize = false;
complex amp;
float toa, pow, max = -1.0, avg = 0.0;
+ int max_i = -1;
signalVector *burst;
SoftVector *bits;
@@ -439,8 +440,24 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
return NULL;
}
+ /* Select the diversity channel with highest energy */
+ for (size_t i = 0; i < radio_burst->chans(); i++) {
+ energyDetect(*radio_burst->getVector(i), 20 * mSPSRx, 0.0, &pow);
+ if (pow > max) {
+ max = pow;
+ max_i = i;
+ }
+ avg += pow;
+ }
+
+ if (max_i < 0) {
+ LOG(ALERT) << "Received empty burst";
+ delete radio_burst;
+ return NULL;
+ }
+
/* Average noise on diversity paths and update global levels */
- burst = radio_burst->getVector();
+ burst = radio_burst->getVector(max_i);
avg = avg / radio_burst->chans();
mNoiseLev = mNoises.avg();
avg = sqrt(avg);
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp
index 681f939..915cf32 100644
--- a/Transceiver52M/UHDDevice.cpp
+++ b/Transceiver52M/UHDDevice.cpp
@@ -78,17 +78,46 @@ static struct uhd_dev_offset uhd_offsets[NUM_USRP_TYPES * 2] = {
{ UMTRX, 4, 7.3846e-5, "UmTRX 4 SPS" },
};
-static double get_dev_offset(enum uhd_dev_type type, int sps)
+/*
+ * Offset handling for special cases. Currently used for UmTRX dual channel
+ * diversity receiver only.
+ */
+static struct uhd_dev_offset special_offsets[] = {
+ { UMTRX, 1, 8.0875e-5, "UmTRX diversity, 1 SPS" },
+ { UMTRX, 4, 5.2103e-5, "UmTRX diversity, 4 SPS" },
+};
+
+static double get_dev_offset(enum uhd_dev_type type,
+ int sps, bool diversity = false)
{
+ /* Reject USRP1 */
if (type == USRP1) {
LOG(ERR) << "Invalid device type";
return 0.0;
}
+ /* Special cases (e.g. diversity receiver) */
+ if (diversity) {
+ if (type != UMTRX) {
+ LOG(ALERT) << "Diversity on UmTRX only";
+ return 0.0;
+ }
+
+ switch (sps) {
+ case 1:
+ return special_offsets[0].offset;
+ case 4:
+ default:
+ return special_offsets[1].offset;
+ }
+ }
+
+ /* Normal operation */
switch (sps) {
case 1:
return uhd_offsets[2 * type + 0].offset;
case 4:
+ default:
return uhd_offsets[2 * type + 1].offset;
}
@@ -101,8 +130,15 @@ static double get_dev_offset(enum uhd_dev_type type, int sps)
* The base rate is either GSM symbol rate, 270.833 kHz, or the minimum
* usable channel spacing of 400 kHz.
*/
-static double select_rate(uhd_dev_type type, int sps)
+static double select_rate(uhd_dev_type type, int sps, bool diversity = false)
{
+ if (diversity && (type == UMTRX)) {
+ return GSMRATE * 4;
+ } else if (diversity) {
+ LOG(ALERT) << "Diversity supported on UmTRX only";
+ return -9999.99;
+ }
+
if ((sps != 4) && (sps != 1))
return -9999.99;
@@ -212,7 +248,7 @@ private:
*/
class uhd_device : public RadioDevice {
public:
- uhd_device(size_t sps, size_t chans);
+ uhd_device(size_t sps, size_t chans, bool diversity);
~uhd_device();
int open(const std::string &args, bool extref);
@@ -305,6 +341,7 @@ private:
std::string str_code(uhd::async_metadata_t metadata);
Thread async_event_thrd;
+ bool diversity;
};
void *async_event_loop(uhd_device *dev)
@@ -339,7 +376,7 @@ void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg)
}
}
-uhd_device::uhd_device(size_t sps, size_t chans)
+uhd_device::uhd_device(size_t sps, size_t chans, bool diversity)
: tx_gain_min(0.0), tx_gain_max(0.0),
rx_gain_min(0.0), rx_gain_max(0.0),
tx_spp(0), rx_spp(0),
@@ -348,6 +385,7 @@ uhd_device::uhd_device(size_t sps, size_t chans)
{
this->sps = sps;
this->chans = chans;
+ this->diversity = diversity;
}
uhd_device::~uhd_device()
@@ -600,8 +638,13 @@ int uhd_device::open(const std::string &args, bool extref)
rx_spp = rx_stream->get_max_num_samps();
// Set rates
+ double _rx_rate;
double _tx_rate = select_rate(dev_type, sps);
- double _rx_rate = _tx_rate / sps;
+ if (diversity)
+ _rx_rate = select_rate(dev_type, 1, true);
+ else
+ _rx_rate = _tx_rate / sps;
+
if ((_tx_rate > 0.0) && (set_rates(_tx_rate, _rx_rate) < 0))
return -1;
@@ -611,7 +654,7 @@ int uhd_device::open(const std::string &args, bool extref)
rx_buffers[i] = new smpl_buf(buf_len, rx_rate);
// Set receive chain sample offset
- double offset = get_dev_offset(dev_type, sps);
+ double offset = get_dev_offset(dev_type, sps, diversity);
if (offset == 0.0) {
LOG(ERR) << "Unsupported configuration, no correction applied";
ts_offset = 0;
@@ -625,11 +668,16 @@ int uhd_device::open(const std::string &args, bool extref)
// Print configuration
LOG(INFO) << "\n" << usrp_dev->get_pp_string();
+ if (diversity)
+ return DIVERSITY;
+
switch (dev_type) {
case B100:
return RESAMP_64M;
case USRP2:
return RESAMP_100M;
+ default:
+ break;
}
return NORMAL;
@@ -1173,7 +1221,7 @@ std::string smpl_buf::str_code(ssize_t code)
}
}
-RadioDevice *RadioDevice::make(size_t sps, size_t chans)
+RadioDevice *RadioDevice::make(size_t sps, size_t chans, bool diversity)
{
- return new uhd_device(sps, chans);
+ return new uhd_device(sps, chans, diversity);
}
diff --git a/Transceiver52M/USRPDevice.cpp b/Transceiver52M/USRPDevice.cpp
index e330bc3..e00d54e 100644
--- a/Transceiver52M/USRPDevice.cpp
+++ b/Transceiver52M/USRPDevice.cpp
@@ -59,8 +59,7 @@ const dboardConfigType dboardConfig = TXA_RXB;
const double USRPDevice::masterClockRate = 52.0e6;
-USRPDevice::USRPDevice(size_t sps, size_t)
- : skipRx(skipRx)
+USRPDevice::USRPDevice(size_t sps, size_t, bool)
{
LOG(INFO) << "creating USRP device...";
@@ -601,7 +600,7 @@ bool USRPDevice::setTxFreq(double wFreq) { return true;};
bool USRPDevice::setRxFreq(double wFreq) { return true;};
#endif
-RadioDevice *RadioDevice::make(size_t sps, size_t chans)
+RadioDevice *RadioDevice::make(size_t sps, size_t chans, bool diversity)
{
- return new USRPDevice(sps, chans);
+ return new USRPDevice(sps, chans, diversity);
}
diff --git a/Transceiver52M/USRPDevice.h b/Transceiver52M/USRPDevice.h
index c9f98ed..0807127 100644
--- a/Transceiver52M/USRPDevice.h
+++ b/Transceiver52M/USRPDevice.h
@@ -96,7 +96,7 @@ private:
public:
/** Object constructor */
- USRPDevice(size_t sps, size_t chans = 1);
+ USRPDevice(size_t sps, size_t chans = 1, bool diversity = false);
/** Instantiate the USRP */
int open(const std::string &, bool);
diff --git a/Transceiver52M/radioDevice.h b/Transceiver52M/radioDevice.h
index 19b5a88..10a0b4d 100644
--- a/Transceiver52M/radioDevice.h
+++ b/Transceiver52M/radioDevice.h
@@ -35,9 +35,10 @@ class RadioDevice {
enum TxWindowType { TX_WINDOW_USRP1, TX_WINDOW_FIXED };
/* Radio interface types */
- enum RadioInterfaceType { NORMAL, RESAMP_64M, RESAMP_100M };
+ enum RadioInterfaceType { NORMAL, RESAMP_64M, RESAMP_100M, DIVERSITY };
- static RadioDevice *make(size_t sps, size_t chans = 1);
+ static RadioDevice *make(size_t sps, size_t chans = 1,
+ bool diversity = false);
/** Initialize the USRP */
virtual int open(const std::string &args = "", bool extref = false)=0;
diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp
index 43fa3a3..ff9f493 100644
--- a/Transceiver52M/radioInterface.cpp
+++ b/Transceiver52M/radioInterface.cpp
@@ -34,10 +34,9 @@ extern "C" {
#define NUMCHUNKS 4
RadioInterface::RadioInterface(RadioDevice *wRadio,
- int wReceiveOffset,
- size_t sps, size_t chans,
- GSM::Time wStartTime)
- : mRadio(wRadio), mSPSTx(sps), mSPSRx(1), mChans(chans),
+ size_t sps, size_t chans, size_t diversity,
+ int wReceiveOffset, GSM::Time wStartTime)
+ : mRadio(wRadio), mSPSTx(sps), mSPSRx(1), mChans(chans), mMIMO(diversity),
sendCursor(0), recvCursor(0), underrun(false), overrun(false),
receiveOffset(wReceiveOffset), mOn(false), powerScaling(1.0),
loadTest(false)
@@ -52,11 +51,8 @@ RadioInterface::~RadioInterface(void)
bool RadioInterface::init(int type)
{
- if (type != RadioDevice::NORMAL)
- return false;
-
- if (!mChans) {
- LOG(ALERT) << "Invalid number of channels " << mChans;
+ if ((type != RadioDevice::NORMAL) || (mMIMO > 1) || !mChans) {
+ LOG(ALERT) << "Invalid configuration";
return false;
}
@@ -251,10 +247,14 @@ bool RadioInterface::driveReceiveRadio()
*/
while (recvSz > burstSize) {
for (size_t i = 0; i < mChans; i++) {
- burst = new radioVector(rcvClock, burstSize, head);
+ burst = new radioVector(rcvClock, burstSize, head, mMIMO);
+
+ for (size_t n = 0; n < mMIMO; n++) {
+ unRadioifyVector((float *)
+ (recvBuffer[mMIMO * i + n]->begin() + readSz),
+ *burst->getVector(n));
+ }
- unRadioifyVector((float *) (recvBuffer[i]->begin() + readSz),
- *burst->getVector());
if (mReceiveFIFO[i].size() < 32)
mReceiveFIFO[i].write(burst);
diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h
index 124cdc3..95ef2b2 100644
--- a/Transceiver52M/radioInterface.h
+++ b/Transceiver52M/radioInterface.h
@@ -20,6 +20,7 @@
#include "radioDevice.h"
#include "radioVector.h"
#include "radioClock.h"
+#include "Resampler.h"
static const unsigned gSlotLen = 148; ///< number of symbols per slot, not counting guard periods
@@ -37,6 +38,8 @@ protected:
size_t mSPSTx;
size_t mSPSRx;
size_t mChans;
+ size_t mMIMO;
+
std::vector<signalVector *> sendBuffer;
std::vector<signalVector *> recvBuffer;
unsigned sendCursor;
@@ -89,9 +92,8 @@ public:
/** constructor */
RadioInterface(RadioDevice* wRadio = NULL,
- int receiveOffset = 3,
- size_t sps = 4, size_t chans = 1,
- GSM::Time wStartTime = GSM::Time(0));
+ size_t sps = 4, size_t chans = 1, size_t diversity = 1,
+ int receiveOffset = 3, GSM::Time wStartTime = GSM::Time(0));
/** destructor */
virtual ~RadioInterface();
@@ -109,7 +111,7 @@ public:
bool tuneTx(double freq, size_t chan = 0);
/** set receive frequency */
- bool tuneRx(double freq, size_t chan = 0);
+ virtual bool tuneRx(double freq, size_t chan = 0);
/** set receive gain */
double setRxGain(double dB, size_t chan = 0);
@@ -166,13 +168,33 @@ private:
public:
- RadioInterfaceResamp(RadioDevice* wRadio = NULL,
- int receiveOffset = 3,
- size_t wSPS = 4, size_t chans = 1,
- GSM::Time wStartTime = GSM::Time(0));
+ RadioInterfaceResamp(RadioDevice* wRadio, size_t wSPS = 4, size_t chans = 1);
~RadioInterfaceResamp();
bool init(int type);
void close();
};
+
+class RadioInterfaceDiversity : public RadioInterface {
+public:
+ RadioInterfaceDiversity(RadioDevice* wRadio,
+ size_t sps = 4, size_t chans = 2);
+
+ ~RadioInterfaceDiversity();
+
+ bool init(int type);
+ void close();
+ bool tuneRx(double freq, size_t chan);
+
+private:
+ std::vector<Resampler *> dnsamplers;
+ std::vector<float> phases;
+ signalVector *outerRecvBuffer;
+
+ bool mDiversity;
+ double mFreqSpacing;
+
+ bool setupDiversityChannels();
+ void pullBuffer();
+};
diff --git a/Transceiver52M/radioInterfaceDiversity.cpp b/Transceiver52M/radioInterfaceDiversity.cpp
new file mode 100644
index 0000000..8e921b1
--- /dev/null
+++ b/Transceiver52M/radioInterfaceDiversity.cpp
@@ -0,0 +1,248 @@
+/*
+ * SSE Convolution
+ * Copyright (C) 2013 Thomas Tsou <tom@tsou.cc>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <radioInterface.h>
+#include <Logger.h>
+
+#include "Resampler.h"
+
+extern "C" {
+#include "convert.h"
+}
+
+/* Resampling parameters for 64 MHz clocking */
+#define RESAMP_64M_INRATE 20
+#define RESAMP_64M_OUTRATE 80
+
+/* Downlink block size */
+#define CHUNK 625
+
+/* Universal resampling parameters */
+#define NUMCHUNKS 48
+
+/*
+ * Resampling filter bandwidth scaling factor
+ * This narrows the filter cutoff relative to the output bandwidth
+ * of the polyphase resampler. At 4 samples-per-symbol using the
+ * 2 pulse Laurent GMSK approximation gives us below 0.5 degrees
+ * RMS phase error at the resampler output.
+ */
+#define RESAMP_TX4_FILTER 0.45
+
+static size_t resamp_inrate = 0;
+static size_t resamp_inchunk = 0;
+static size_t resamp_outrate = 0;
+static size_t resamp_outchunk = 0;
+
+RadioInterfaceDiversity::RadioInterfaceDiversity(RadioDevice *wRadio,
+ size_t sps, size_t chans)
+ : RadioInterface(wRadio, sps, chans, 2), outerRecvBuffer(NULL),
+ mDiversity(false), mFreqSpacing(0.0)
+{
+}
+
+RadioInterfaceDiversity::~RadioInterfaceDiversity()
+{
+ close();
+}
+
+void RadioInterfaceDiversity::close()
+{
+ delete outerRecvBuffer;
+
+ outerRecvBuffer = NULL;
+
+ for (size_t i = 0; i < dnsamplers.size(); i++) {
+ delete dnsamplers[i];
+ dnsamplers[i] = NULL;
+ }
+
+ if (recvBuffer.size())
+ recvBuffer[0] = NULL;
+
+ RadioInterface::close();
+}
+
+bool RadioInterfaceDiversity::setupDiversityChannels()
+{
+ size_t inner_rx_len;
+
+ /* Inner and outer rates */
+ resamp_inrate = RESAMP_64M_INRATE;
+ resamp_outrate = RESAMP_64M_OUTRATE;
+ resamp_inchunk = resamp_inrate * 4;
+ resamp_outchunk = resamp_outrate * 4;
+
+ /* Buffer lengths */
+ inner_rx_len = NUMCHUNKS * resamp_inchunk;
+
+ /* Inside buffer must hold at least 2 bursts */
+ if (inner_rx_len < 157 * mSPSRx * 2) {
+ LOG(ALERT) << "Invalid inner buffer size " << inner_rx_len;
+ return false;
+ }
+
+ /* One Receive buffer and downsampler per diversity channel */
+ for (size_t i = 0; i < mMIMO * mChans; i++) {
+ dnsamplers[i] = new Resampler(resamp_inrate, resamp_outrate);
+ if (!dnsamplers[i]->init()) {
+ LOG(ALERT) << "Rx resampler failed to initialize";
+ return false;
+ }
+
+ recvBuffer[i] = new signalVector(inner_rx_len);
+ }
+
+ return true;
+}
+
+/* Initialize I/O specific objects */
+bool RadioInterfaceDiversity::init(int type)
+{
+ int tx_len, outer_rx_len;
+
+ if ((mMIMO != 2) || (mChans != 2)) {
+ LOG(ALERT) << "Unsupported channel configuration " << mChans;
+ return false;
+ }
+
+ /* Resize for channel combination */
+ sendBuffer.resize(mChans);
+ recvBuffer.resize(mChans * mMIMO);
+ convertSendBuffer.resize(mChans);
+ convertRecvBuffer.resize(mChans);
+ mReceiveFIFO.resize(mChans);
+ dnsamplers.resize(mChans * mMIMO);
+ phases.resize(mChans);
+
+ if (!setupDiversityChannels())
+ return false;
+
+ tx_len = CHUNK * mSPSTx;
+ outer_rx_len = resamp_outchunk;
+
+ for (size_t i = 0; i < mChans; i++) {
+ /* Full rate float and integer outer receive buffers */
+ convertRecvBuffer[i] = new short[outer_rx_len * 2];
+
+ /* Send buffers (not-resampled) */
+ sendBuffer[i] = new signalVector(tx_len);
+ convertSendBuffer[i] = new short[tx_len * 2];
+ }
+
+ outerRecvBuffer = new signalVector(outer_rx_len, dnsamplers[0]->len());
+
+ return true;
+}
+
+bool RadioInterfaceDiversity::tuneRx(double freq, size_t chan)
+{
+ double f0, f1;
+
+ if (chan > 1)
+ return false;
+
+ if (!mRadio->setRxFreq(freq, chan))
+ return false;
+
+ f0 = mRadio->getRxFreq(0);
+ f1 = mRadio->getRxFreq(1);
+
+ mFreqSpacing = f1 - f0;
+
+ if (abs(mFreqSpacing) <= 600e3)
+ mDiversity = true;
+ else
+ mDiversity = false;
+
+ return true;
+}
+
+/* Receive a timestamped chunk from the device */
+void RadioInterfaceDiversity::pullBuffer()
+{
+ bool local_underrun;
+ int rc, num, path0, path1;
+ signalVector *shift, *base;
+ float *in, *out, rate = -mFreqSpacing * 2.0 * M_PI / 1.08333333e6;
+
+ if (recvCursor > recvBuffer[0]->size() - resamp_inchunk)
+ return;
+
+ /* Outer buffer access size is fixed */
+ num = mRadio->readSamples(convertRecvBuffer,
+ resamp_outchunk,
+ &overrun,
+ readTimestamp,
+ &local_underrun);
+ if ((size_t) num != resamp_outchunk) {
+ LOG(ALERT) << "Receive error " << num;
+ return;
+ }
+
+ for (size_t i = 0; i < mChans; i++) {
+ convert_short_float((float *) outerRecvBuffer->begin(),
+ convertRecvBuffer[i], 2 * resamp_outchunk);
+
+ if (!i) {
+ path0 = 0;
+ path1 = 2;
+ } else {
+ path0 = 3;
+ path1 = 1;
+ }
+
+ /* Diversity path 1 */
+ base = outerRecvBuffer;
+ in = (float *) base->begin();
+ out = (float *) (recvBuffer[path0]->begin() + recvCursor);
+
+ rc = dnsamplers[2 * i + 0]->rotate(in, resamp_outchunk,
+ out, resamp_inchunk);
+ if (rc < 0) {
+ LOG(ALERT) << "Sample rate downsampling error";
+ }
+
+ /* Enable path 2 if Nyquist bandwidth is sufficient */
+ if (!mDiversity)
+ continue;
+
+ /* Diversity path 2 */
+ shift = new signalVector(base->size(), base->getStart());
+ in = (float *) shift->begin();
+ out = (float *) (recvBuffer[path1]->begin() + recvCursor);
+
+ rate = i ? -rate : rate;
+ if (!frequencyShift(shift, base, rate, phases[i], &phases[i])) {
+ LOG(ALERT) << "Frequency shift failed";
+ }
+
+ rc = dnsamplers[2 * i + 1]->rotate(in, resamp_outchunk,
+ out, resamp_inchunk);
+ if (rc < 0) {
+ LOG(ALERT) << "Sample rate downsampling error";
+ }
+
+ delete shift;
+ }
+
+ underrun |= local_underrun;
+ readTimestamp += (TIMESTAMP) resamp_outchunk;
+ recvCursor += resamp_inchunk;
+}
diff --git a/Transceiver52M/radioInterfaceResamp.cpp b/Transceiver52M/radioInterfaceResamp.cpp
index 95ed16d..6f14a42 100644
--- a/Transceiver52M/radioInterfaceResamp.cpp
+++ b/Transceiver52M/radioInterfaceResamp.cpp
@@ -50,16 +50,14 @@ extern "C" {
static Resampler *upsampler = NULL;
static Resampler *dnsampler = NULL;
-static int resamp_inrate = 0;
-static int resamp_inchunk = 0;
-static int resamp_outrate = 0;
-static int resamp_outchunk = 0;
+static size_t resamp_inrate = 0;
+static size_t resamp_inchunk = 0;
+static size_t resamp_outrate = 0;
+static size_t resamp_outchunk = 0;
RadioInterfaceResamp::RadioInterfaceResamp(RadioDevice *wRadio,
- int wReceiveOffset,
- size_t sps, size_t chan,
- GSM::Time wStartTime)
- : RadioInterface(wRadio, wReceiveOffset, sps, chan, wStartTime),
+ size_t sps, size_t chans)
+ : RadioInterface(wRadio, sps, chans),
innerSendBuffer(NULL), outerSendBuffer(NULL),
innerRecvBuffer(NULL), outerRecvBuffer(NULL)
{
@@ -191,7 +189,7 @@ void RadioInterfaceResamp::pullBuffer()
&overrun,
readTimestamp,
&local_underrun);
- if (num_recv != resamp_outchunk) {
+ if (num_recv != (int) resamp_outchunk) {
LOG(ALERT) << "Receive error " << num_recv;
return;
}
diff --git a/Transceiver52M/runTransceiver.cpp b/Transceiver52M/runTransceiver.cpp
index e85ce56..a2267e2 100644
--- a/Transceiver52M/runTransceiver.cpp
+++ b/Transceiver52M/runTransceiver.cpp
@@ -114,7 +114,7 @@ int testConfig(const char *filename)
int main(int argc, char *argv[])
{
- int trxPort, radioType, chans = 1, extref = 0, fail = 0;
+ int trxPort, radioType, chans = 1, extref = 0, fail = 0, diversity = 0;
std::string logLevel, trxAddr, deviceArgs = "";
RadioDevice *usrp = NULL;
RadioInterface *radio = NULL;
@@ -162,7 +162,10 @@ int main(int argc, char *argv[])
srandom(time(NULL));
- usrp = RadioDevice::make(SPS, chans);
+ if (diversity)
+ chans = 2;
+
+ usrp = RadioDevice::make(SPS, chans, diversity);
radioType = usrp->open(deviceArgs, extref);
if (radioType < 0) {
LOG(ALERT) << "Transceiver exiting..." << std::endl;
@@ -171,11 +174,14 @@ int main(int argc, char *argv[])
switch (radioType) {
case RadioDevice::NORMAL:
- radio = new RadioInterface(usrp, 3, SPS, chans);
+ radio = new RadioInterface(usrp, SPS, chans);
break;
case RadioDevice::RESAMP_64M:
case RadioDevice::RESAMP_100M:
- radio = new RadioInterfaceResamp(usrp, 3, SPS, chans);
+ radio = new RadioInterfaceResamp(usrp, SPS, chans);
+ break;
+ case RadioDevice::DIVERSITY:
+ radio = new RadioInterfaceDiversity(usrp, SPS, chans);
break;
default:
LOG(ALERT) << "Unsupported configuration";