mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
MIMO: handle channel and ancillary source / sink lists add / remove items
This commit is contained in:
parent
88ea8b2ae9
commit
ad4827f36c
@ -50,6 +50,7 @@ TestMI::TestMI(DeviceAPI *deviceAPI) :
|
||||
m_masterTimer(deviceAPI->getMasterTimer())
|
||||
{
|
||||
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
|
||||
m_deviceAPI->addSourceStream(); // Add a new source stream data set in the engine
|
||||
m_deviceAPI->addAncillarySink(m_fileSink);
|
||||
m_sampleSinkFifos.push_back(SampleSinkFifo(96000 * 4));
|
||||
m_networkManager = new QNetworkAccessManager();
|
||||
@ -66,6 +67,7 @@ TestMI::~TestMI()
|
||||
}
|
||||
|
||||
m_deviceAPI->removeAncillarySink(m_fileSink);
|
||||
m_deviceAPI->removeLastSourceStream(); // Remove the last source stream data set in the engine
|
||||
delete m_fileSink;
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,34 @@ DeviceAPI::~DeviceAPI()
|
||||
{
|
||||
}
|
||||
|
||||
void DeviceAPI::addSourceStream()
|
||||
{
|
||||
if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->addSourceStream();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::removeLastSourceStream()
|
||||
{
|
||||
if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->removeLastSourceStream();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::addSinkStream()
|
||||
{
|
||||
if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->addSinkStream();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::removeLastSinkStream()
|
||||
{
|
||||
if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->removeLastSinkStream();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::addAncillarySink(BasebandSampleSink *sink)
|
||||
{
|
||||
if (m_deviceSourceEngine) {
|
||||
@ -83,10 +111,10 @@ void DeviceAPI::setSpectrumSinkInput(bool sourceElseSink, unsigned int index)
|
||||
|
||||
void DeviceAPI::addChannelSink(ThreadedBasebandSampleSink* sink, int streamIndex)
|
||||
{
|
||||
(void) streamIndex;
|
||||
|
||||
if (m_deviceSourceEngine) {
|
||||
m_deviceSourceEngine->addThreadedSink(sink);
|
||||
} else if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->addChannelSink(sink, streamIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,12 @@ public:
|
||||
);
|
||||
~DeviceAPI();
|
||||
|
||||
// MIMO Engine baseband / channel lists management
|
||||
void addSourceStream();
|
||||
void removeLastSourceStream();
|
||||
void addSinkStream();
|
||||
void removeLastSinkStream();
|
||||
|
||||
void addAncillarySink(BasebandSampleSink* sink); //!< Adds a sink to receive full baseband and that is not a channel (e.g. spectrum)
|
||||
void removeAncillarySink(BasebandSampleSink* sink); //!< Removes it
|
||||
void setSpectrumSinkInput(bool sourceElseSink = true, unsigned int index = 0); //!< Used in the MIMO case to select which stream is used as input to main spectrum
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include "dspdevicemimoengine.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::SetSampleMIMO, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddSourceStream, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveLastSourceStream, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddSinkStream, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveLastSinkStream, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddThreadedBasebandSampleSource, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveThreadedBasebandSampleSource, Message)
|
||||
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddThreadedBasebandSampleSink, Message)
|
||||
@ -118,6 +122,34 @@ void DSPDeviceMIMOEngine::setMIMOSequence(int sequence)
|
||||
m_sampleMIMOSequence = sequence;
|
||||
}
|
||||
|
||||
void DSPDeviceMIMOEngine::addSourceStream()
|
||||
{
|
||||
qDebug("DSPDeviceMIMOEngine::addSourceStream");
|
||||
AddSourceStream cmd;
|
||||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceMIMOEngine::removeLastSourceStream()
|
||||
{
|
||||
qDebug("DSPDeviceMIMOEngine::removeLastSourceStream");
|
||||
RemoveLastSourceStream cmd;
|
||||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceMIMOEngine::addSinkStream()
|
||||
{
|
||||
qDebug("DSPDeviceMIMOEngine::addSinkStream");
|
||||
AddSinkStream cmd;
|
||||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceMIMOEngine::removeLastSinkStream()
|
||||
{
|
||||
qDebug("DSPDeviceMIMOEngine::removeLastSinkStream");
|
||||
RemoveLastSourceStream cmd;
|
||||
m_syncMessenger.sendWait(cmd);
|
||||
}
|
||||
|
||||
void DSPDeviceMIMOEngine::addChannelSource(ThreadedBasebandSampleSource* source, int index)
|
||||
{
|
||||
qDebug() << "DSPDeviceMIMOEngine::addThreadedSource: "
|
||||
@ -294,7 +326,6 @@ void DSPDeviceMIMOEngine::work(int nbWriteSamples)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// adjust FIFO pointers
|
||||
sampleFifo->readCommit((unsigned int) count);
|
||||
samplesDone += count;
|
||||
@ -422,11 +453,18 @@ DSPDeviceMIMOEngine::State DSPDeviceMIMOEngine::gotoInit()
|
||||
}
|
||||
}
|
||||
|
||||
// pass data to listeners
|
||||
// if (m_deviceSampleSource->getMessageQueueToGUI())
|
||||
// {
|
||||
// DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy for the output queue
|
||||
// m_deviceSampleSource->getMessageQueueToGUI()->push(rep);
|
||||
// Probably not necessary
|
||||
// // possibly forward to spectrum sink
|
||||
// if ((m_spectrumSink) && (m_spectrumInputSourceElseSink) && (isource == m_spectrumInputIndex)) {
|
||||
// m_spectrumSink->handleMessage(notif);
|
||||
// }
|
||||
|
||||
// // forward changes to MIMO GUI input queue
|
||||
// MessageQueue *guiMessageQueue = m_deviceSampleMIMO->getMessageQueueToGUI();
|
||||
|
||||
// if (guiMessageQueue) {
|
||||
// SignalNotification* rep = new SignalNotification(sourceStreamSampleRate, sourceCenterFrequency, true, isource); // make a copy for the MIMO GUI
|
||||
// guiMessageQueue->push(rep);
|
||||
// }
|
||||
}
|
||||
|
||||
@ -560,13 +598,32 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
|
||||
else if (SetSampleMIMO::match(*message)) {
|
||||
handleSetMIMO(((SetSampleMIMO*) message)->getSampleMIMO());
|
||||
}
|
||||
else if (AddSourceStream::match(*message))
|
||||
{
|
||||
m_basebandSampleSinks.push_back(BasebandSampleSinks());
|
||||
m_threadedBasebandSampleSinks.push_back(ThreadedBasebandSampleSinks());
|
||||
m_sourcesCorrections.push_back(SourceCorrection());
|
||||
}
|
||||
else if (RemoveLastSourceStream::match(*message))
|
||||
{
|
||||
m_basebandSampleSinks.pop_back();
|
||||
m_threadedBasebandSampleSinks.pop_back();
|
||||
}
|
||||
else if (AddSinkStream::match(*message))
|
||||
{
|
||||
m_threadedBasebandSampleSources.push_back(ThreadedBasebandSampleSources());
|
||||
}
|
||||
else if (RemoveLastSinkStream::match(*message))
|
||||
{
|
||||
m_threadedBasebandSampleSources.pop_back();
|
||||
}
|
||||
else if (AddBasebandSampleSink::match(*message))
|
||||
{
|
||||
const AddBasebandSampleSink *msg = (AddBasebandSampleSink *) message;
|
||||
BasebandSampleSink* sink = msg->getSampleSink();
|
||||
unsigned int isource = msg->getIndex();
|
||||
|
||||
if ((isource < m_basebandSampleSinks.size()) && (isource < m_deviceSampleMIMO->getNbSourceStreams()))
|
||||
if (isource < m_basebandSampleSinks.size())
|
||||
{
|
||||
m_basebandSampleSinks[isource].push_back(sink);
|
||||
// initialize sample rate and center frequency in the sink:
|
||||
@ -601,7 +658,7 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
|
||||
ThreadedBasebandSampleSink *threadedSink = msg->getThreadedSampleSink();
|
||||
unsigned int isource = msg->getIndex();
|
||||
|
||||
if ((isource < m_threadedBasebandSampleSinks.size()) && (isource < m_deviceSampleMIMO->getNbSourceStreams()))
|
||||
if (isource < m_threadedBasebandSampleSinks.size())
|
||||
{
|
||||
m_threadedBasebandSampleSinks[isource].push_back(threadedSink);
|
||||
// initialize sample rate and center frequency in the sink:
|
||||
@ -633,7 +690,7 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
|
||||
ThreadedBasebandSampleSource *threadedSource = msg->getThreadedSampleSource();
|
||||
unsigned int isink = msg->getIndex();
|
||||
|
||||
if ((isink < m_threadedBasebandSampleSources.size()) && (isink < m_deviceSampleMIMO->getNbSinkStreams()))
|
||||
if (isink < m_threadedBasebandSampleSources.size())
|
||||
{
|
||||
m_threadedBasebandSampleSources[isink].push_back(threadedSource);
|
||||
// initialize sample rate and center frequency in the sink:
|
||||
@ -751,7 +808,8 @@ void DSPDeviceMIMOEngine::handleInputMessages()
|
||||
m_sourcesCorrections[isource].m_imbalance = 65536;
|
||||
}
|
||||
}
|
||||
|
||||
m_sourcesCorrections[isource].m_iBeta.reset();
|
||||
m_sourcesCorrections[isource].m_qBeta.reset();
|
||||
m_sourcesCorrections[isource].m_avgAmp.reset();
|
||||
m_sourcesCorrections[isource].m_avgII.reset();
|
||||
m_sourcesCorrections[isource].m_avgII2.reset();
|
||||
|
@ -60,6 +60,22 @@ public:
|
||||
unsigned int m_index;
|
||||
};
|
||||
|
||||
class AddSourceStream : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
};
|
||||
|
||||
class RemoveLastSourceStream : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
};
|
||||
|
||||
class AddSinkStream : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
};
|
||||
|
||||
class RemoveLastSinkStream : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
};
|
||||
|
||||
class RemoveThreadedBasebandSampleSource : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
@ -250,6 +266,11 @@ public:
|
||||
void setMIMOSequence(int sequence); //!< Set the sample MIMO sequence in type
|
||||
uint getUID() const { return m_uid; }
|
||||
|
||||
void addSourceStream();
|
||||
void removeLastSourceStream();
|
||||
void addSinkStream();
|
||||
void removeLastSinkStream();
|
||||
|
||||
void addChannelSource(ThreadedBasebandSampleSource* source, int index = 0); //!< Add a channel source that will run on its own thread
|
||||
void removeChannelSource(ThreadedBasebandSampleSource* source, int index = 0); //!< Remove a channel source that runs on its own thread
|
||||
void addChannelSink(ThreadedBasebandSampleSink* sink, int index = 0); //!< Add a channel sink that will run on its own thread
|
||||
@ -298,6 +319,26 @@ private:
|
||||
MovingAverageUtil<double, double, 128> m_avgPhi;
|
||||
MovingAverageUtil<double, double, 128> m_avgAmp;
|
||||
#endif
|
||||
SourceCorrection()
|
||||
{
|
||||
m_dcOffsetCorrection = false;
|
||||
m_iqImbalanceCorrection = false;
|
||||
m_iOffset = 0;
|
||||
m_qOffset = 0;
|
||||
m_iRange = 1 << 16;
|
||||
m_qRange = 1 << 16;
|
||||
m_imbalance = 65536;
|
||||
m_iBeta.reset();
|
||||
m_qBeta.reset();
|
||||
m_avgAmp.reset();
|
||||
m_avgII.reset();
|
||||
m_avgII2.reset();
|
||||
m_avgIQ.reset();
|
||||
m_avgPhi.reset();
|
||||
m_avgQQ2.reset();
|
||||
m_iBeta.reset();
|
||||
m_qBeta.reset();
|
||||
}
|
||||
};
|
||||
|
||||
uint32_t m_uid; //!< unique ID
|
||||
|
Loading…
Reference in New Issue
Block a user