1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-05-28 02:57:00 -04:00

BladeRF2 MIMO (2)

This commit is contained in:
f4exb 2019-09-26 23:51:31 +02:00
parent 6bcf8caa21
commit 208b9f4ebf
3 changed files with 15 additions and 31 deletions

View File

@ -73,8 +73,7 @@ BladeRF2MIMO::BladeRF2MIMO(DeviceAPI *deviceAPI) :
}
m_mimoType = MIMOHalfSynchronous;
m_sampleSinkFifos.push_back(SampleSinkFifo(96000 * 4));
m_sampleSinkFifos.push_back(SampleSinkFifo(96000 * 4));
m_sampleMIFifo.init(2, 96000 * 4);
m_deviceAPI->setNbSourceStreams(2);
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
@ -177,8 +176,7 @@ void BladeRF2MIMO::startRx()
}
m_sourceThread = new BladeRF2MIThread(m_dev->getDev());
m_sourceThread->setFifo(0, &m_sampleSinkFifos[0]);
m_sourceThread->setFifo(1, &m_sampleSinkFifos[1]);
m_sourceThread->setFifo(&m_sampleMIFifo);
m_sourceThread->setFcPos(m_settings.m_fcPos);
m_sourceThread->setLog2Decimation(m_settings.m_log2Decim);

View File

@ -16,14 +16,15 @@
///////////////////////////////////////////////////////////////////////////////////
#include "bladerf2/devicebladerf2shared.h"
#include "dsp/samplesinkfifo.h"
#include "dsp/samplemififo.h"
#include "bladerf2mithread.h"
BladeRF2MIThread::BladeRF2MIThread(struct bladerf* dev, QObject* parent) :
QThread(parent),
m_running(false),
m_dev(dev)
m_dev(dev),
m_sampleFifo(nullptr)
{
qDebug("BladeRF2MIThread::BladeRF2MIThread");
m_buf = new qint16[2*DeviceBladeRF2::blockSize*2];
@ -82,22 +83,6 @@ int BladeRF2MIThread::getFcPos() const
return m_fcPos;
}
void BladeRF2MIThread::setFifo(unsigned int channel, SampleSinkFifo *sampleFifo)
{
if (channel < 2) {
m_sampleFifo[channel] = sampleFifo;
}
}
SampleSinkFifo *BladeRF2MIThread::getFifo(unsigned int channel)
{
if (channel < 2) {
return m_sampleFifo[channel];
} else {
return nullptr;
}
}
void BladeRF2MIThread::run()
{
int res;
@ -143,12 +128,15 @@ void BladeRF2MIThread::callback(const qint16* buf, qint32 samplesPerChannel)
return;
}
std::vector<SampleVector::const_iterator> vbegin;
for (unsigned int channel = 0; channel < 2; channel++)
{
if (m_sampleFifo[channel]) {
channelCallback(&buf[2*samplesPerChannel*channel], 2*samplesPerChannel, channel);
}
channelCallback(&buf[2*samplesPerChannel*channel], 2*samplesPerChannel, channel);
vbegin.push_back(m_convertBuffer[channel].begin());
}
m_sampleFifo->writeSync(vbegin, samplesPerChannel/(1<<m_log2Decim));
}
void BladeRF2MIThread::channelCallback(const qint16* buf, qint32 len, int channel)
@ -240,6 +228,4 @@ void BladeRF2MIThread::channelCallback(const qint16* buf, qint32 len, int channe
}
}
}
m_sampleFifo[channel]->write(m_convertBuffer[channel].begin(), it);
}

View File

@ -29,7 +29,7 @@
#include "dsp/decimators.h"
class SampleSinkFifo;
class SampleMIFifo;
class BladeRF2MIThread : public QThread {
Q_OBJECT
@ -45,8 +45,8 @@ public:
unsigned int getLog2Decimation() const;
void setFcPos(int fcPos);
int getFcPos() const;
void setFifo(unsigned int channel, SampleSinkFifo *sampleFifo);
SampleSinkFifo *getFifo(unsigned int channel);
void setFifo(SampleMIFifo *sampleFifo) { m_sampleFifo = sampleFifo; }
SampleMIFifo *getFifo() { return m_sampleFifo; }
private:
QMutex m_startWaitMutex;
@ -56,7 +56,7 @@ private:
qint16 *m_buf;
SampleVector m_convertBuffer[2];
SampleSinkFifo* m_sampleFifo[2];
SampleMIFifo* m_sampleFifo;
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators[2];
unsigned int m_log2Decim;
int m_fcPos;