1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-30 03:38:55 -05:00

LimeSDR input: moved stream setup and destruciton in open and close device methods respectively

This commit is contained in:
f4exb 2017-04-19 08:19:09 +02:00
parent 0847a8464c
commit 5cd430c245

View File

@ -163,6 +163,24 @@ bool LimeSDRInput::openDevice()
qDebug("LimeSDRInput::openDevice: Rx channel %lu enabled", m_deviceShared.m_channel);
}
// set up the stream
m_streamId.channel = m_deviceShared.m_channel; //channel number
m_streamId.fifoSize = 1024 * 128; //fifo size in samples
m_streamId.throughputVsLatency = 1.0; //optimize for max throughput
m_streamId.isTx = false; //RX channel
m_streamId.dataFmt = lms_stream_t::LMS_FMT_I12; //12-bit integers
if (LMS_SetupStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId) != 0)
{
qCritical("LimeSDRInput::start: cannot setup the stream on Rx channel %lu", m_deviceShared.m_channel);
return false;
}
else
{
qDebug("LimeSDRInput::start: stream set up on Rx channel %lu", m_deviceShared.m_channel);
}
return true;
}
@ -172,6 +190,9 @@ void LimeSDRInput::closeDevice()
return;
}
// destroy the stream
LMS_DestroyStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId);
// release the channel
if (LMS_EnableChannel(m_deviceShared.m_deviceParams->getDevice(), LMS_CH_RX, m_deviceShared.m_channel, false) != 0)
@ -199,24 +220,6 @@ bool LimeSDRInput::start()
if (m_running) stop();
// set up the stream
m_streamId.channel = m_deviceShared.m_channel; //channel number
m_streamId.fifoSize = 1024 * 128; //fifo size in samples
m_streamId.throughputVsLatency = 1.0; //optimize for max throughput
m_streamId.isTx = false; //RX channel
m_streamId.dataFmt = lms_stream_t::LMS_FMT_I12; //12-bit integers
if (LMS_SetupStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId) != 0)
{
qCritical("LimeSDRInput::start: cannot setup the stream on Rx channel %lu", m_deviceShared.m_channel);
return false;
}
else
{
qDebug("LimeSDRInput::start: stream set up on Rx channel %lu", m_deviceShared.m_channel);
}
// start / stop streaming is done in the thread.
if ((m_limeSDRInputThread = new LimeSDRInputThread(&m_streamId, &m_sampleFifo)) == 0)
@ -249,9 +252,6 @@ void LimeSDRInput::stop()
m_limeSDRInputThread = 0;
}
// destroy the stream
LMS_DestroyStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId);
m_running = false;
}