1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

MIMO: implemented SampleMOFifo in device sample MIMO

This commit is contained in:
f4exb 2019-10-17 00:58:36 +02:00
parent 8691fef573
commit 626e07dd85
5 changed files with 22 additions and 39 deletions

View File

@ -42,12 +42,3 @@ void DeviceSampleMIMO::handleInputMessages()
}
}
}
SampleSourceFifo* DeviceSampleMIMO::getSampleSourceFifo(unsigned int index)
{
if (index >= m_sampleSourceFifos.size()) {
return nullptr;
} else {
return &m_sampleSourceFifos[index];
}
}

View File

@ -23,6 +23,7 @@
#include "samplesourcefifo.h"
#include "samplemififo.h"
#include "samplemofifo.h"
#include "util/message.h"
#include "util/messagequeue.h"
#include "export.h"
@ -132,23 +133,23 @@ public:
virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
unsigned int getNbSourceFifos() const { return m_sampleSourceFifos.size(); } //!< Get the number of Tx FIFOs
unsigned int getNbSourceFifos() const { return m_sampleMOFifo.getNbStreams(); } //!< Get the number of Tx FIFOs
unsigned int getNbSinkFifos() const { return m_sampleMIFifo.getNbStreams(); } //!< Get the number of Rx FIFOs
SampleSourceFifo* getSampleSourceFifo(unsigned int index); //!< Get Tx FIFO at index
SampleMIFifo* getSampleMIFifo() { return &m_sampleMIFifo; }
SampleMOFifo* getSampleMOFifo() { return &m_sampleMOFifo; }
// Streams and FIFOs are in opposed source/sink type whick makes it confusing when stream direction is involved:
// Rx: source stream -> sink FIFO -> channel sinks
// Tx: sink stream <- source FIFO <- channel sources
unsigned int getNbSourceStreams() const { return m_sampleMIFifo.getNbStreams(); } //!< Commodity function same as getNbSinkFifos (Rx or source streams)
unsigned int getNbSinkStreams() const { return m_sampleSourceFifos.size(); } //!< Commodity function same as getNbSourceFifos (Tx or sink streams)
unsigned int getNbSinkStreams() const { return m_sampleMOFifo.getNbStreams(); } //!< Commodity function same as getNbSourceFifos (Tx or sink streams)
protected slots:
void handleInputMessages();
protected:
MIMOType m_mimoType;
std::vector<SampleSourceFifo> m_sampleSourceFifos; //!< Tx FIFOs
SampleMIFifo m_sampleMIFifo; //!< Multiple Input FIFO
SampleMOFifo m_sampleMOFifo; //!< Multiple Output FIFO
MessageQueue m_inputMessageQueue; //!< Input queue to the sink
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
};

View File

@ -834,11 +834,11 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
BasebandSampleSink* spectrumSink = ((DSPRemoveSpectrumSink*) message)->getSampleSink();
spectrumSink->stop();
if (!m_spectrumInputSourceElseSink && m_deviceSampleMIMO && (m_spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams()))
{
SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex);
disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int)));
}
// if (!m_spectrumInputSourceElseSink && m_deviceSampleMIMO && (m_spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams()))
// {
// SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex);
// disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int)));
// }
m_spectrumSink = nullptr;
}
@ -850,16 +850,16 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
if ((spectrumInputSourceElseSink != m_spectrumInputSourceElseSink) || (spectrumInputIndex != m_spectrumInputIndex))
{
if (!m_spectrumInputSourceElseSink) // remove the source listener
{
SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex);
disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int)));
}
// if (!m_spectrumInputSourceElseSink) // remove the source listener
// {
// SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex);
// disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int)));
// }
if ((!spectrumInputSourceElseSink) && (spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams())) // add the source listener
{
SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(spectrumInputIndex);
connect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int)));
// SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(spectrumInputIndex);
// connect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int)));
if (m_spectrumSink)
{
@ -1043,18 +1043,6 @@ void DSPDeviceMIMOEngine::configureCorrections(bool dcOffsetCorrection, bool iqI
m_inputMessageQueue.push(cmd);
}
// This is used for the Tx (sink streams) side
void DSPDeviceMIMOEngine::handleForwardToSpectrumSink(int nbSamples)
{
if ((m_spectrumSink) && (m_spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams()))
{
SampleSourceFifo* sampleFifo = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex);
SampleVector::iterator readUntil;
sampleFifo->getReadIterator(readUntil);
m_spectrumSink->feed(readUntil - nbSamples, readUntil, false);
}
}
void DSPDeviceMIMOEngine::iqCorrections(SampleVector::iterator begin, SampleVector::iterator end, int isource, bool imbalanceCorrection)
{
for(SampleVector::iterator it = begin; it < end; it++)

View File

@ -375,7 +375,6 @@ private slots:
void handleDataRxAsync(int streamIndex); //!< Handle data when Rx samples have to be processed asynchronously
void handleSynchronousMessages(); //!< Handle synchronous messages with the thread
void handleInputMessages(); //!< Handle input message queue
void handleForwardToSpectrumSink(int nbSamples);
};
#endif // SDRBASE_DSP_DSPDEVICEMIMOENGINE_H_

View File

@ -48,6 +48,10 @@ public:
);
void writeAsync(const SampleVector::const_iterator& begin, unsigned int amount, unsigned int stream);
const std::vector<SampleVector>& getData() { return m_data; }
const SampleVector& getData(unsigned int stream) { return m_data[stream]; }
unsigned int getNbStreams() const { return m_data.size(); }
unsigned int remainderSync()
{
QMutexLocker mutexLocker(&m_mutex);