1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

LimeSDR: fixed lockup problem by moving start/stop stream from thread run method to start/stop work methods

This commit is contained in:
f4exb 2017-10-29 18:38:04 +01:00
parent c7e7bf3480
commit e8fb70096c
6 changed files with 36 additions and 55 deletions

View File

@ -35,11 +35,12 @@ From version 2 SDRangel can integrate more than one hardware device running conc
<h2>Transmission support</h2> <h2>Transmission support</h2>
From version 3 transmission or signal generation is supported for BladeRF, HackRF (since version 3.1) and LimeSDR (since version 3.4) using a sample sink plugin. These plugins are: From version 3 transmission or signal generation is supported for BladeRF, HackRF (since version 3.1), LimeSDR (since version 3.4) and PlutoSDR (since version 3.7.8) using a sample sink plugin. These plugins are:
- [BladeRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/bladerfoutput) limited support in Windows - [BladeRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/bladerfoutput) limited support in Windows
- [HackRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/hackrfoutput) - [HackRF output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/hackrfoutput)
- [LimeSDR output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/limesdroutput) - [LimeSDR output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/limesdroutput)
- [PlutoSDR output plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/plutosdroutput)
- [File output or file sink plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/filesink) - [File output or file sink plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/filesink)
- [Remote device via Network with SDRdaemon](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/sdrdaemonsink) Linux only - [Remote device via Network with SDRdaemon](https://github.com/f4exb/sdrangel/tree/dev/plugins/samplesink/sdrdaemonsink) Linux only

9
debian/changelog vendored
View File

@ -1,8 +1,15 @@
sdrangel (3.7.8-1) unstable; urgency=medium
* PlutoSDR: restored and fixed Tx support
* LimeSDR: reworked the start/stop stream so it does not need the workaround delay
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 28 Oct 2017 18:14:18 +0200
sdrangel (3.7.7-1) unstable; urgency=medium sdrangel (3.7.7-1) unstable; urgency=medium
* PlutoSDR: removed Tx support * PlutoSDR: removed Tx support
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 28 Oct 2017 23:14:18 +0200 -- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sat, 27 Oct 2017 23:14:18 +0200
sdrangel (3.7.6-1) unstable; urgency=medium sdrangel (3.7.6-1) unstable; urgency=medium

View File

@ -30,7 +30,7 @@
const PluginDescriptor LimeSDROutputPlugin::m_pluginDescriptor = { const PluginDescriptor LimeSDROutputPlugin::m_pluginDescriptor = {
QString("LimeSDR Output"), QString("LimeSDR Output"),
QString("3.7.6"), QString("3.7.8"),
QString("(c) Edouard Griffiths, F4EXB"), QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"), QString("https://github.com/f4exb/sdrangel"),
true, true,

View File

@ -38,6 +38,12 @@ void LimeSDROutputThread::startWork()
{ {
if (m_running) return; // return if running already if (m_running) return; // return if running already
if (LMS_StartStream(m_stream) < 0) {
qCritical("LimeSDROutputThread::startWork: could not start stream");
} else {
qDebug("LimeSDROutputThread::startWork: stream started");
}
m_startWaitMutex.lock(); m_startWaitMutex.lock();
start(); start();
while(!m_running) while(!m_running)
@ -51,6 +57,12 @@ void LimeSDROutputThread::stopWork()
m_running = false; m_running = false;
wait(); wait();
if (LMS_StopStream(m_stream) < 0) {
qCritical("LimeSDROutputThread::stopWork: could not stop stream");
} else {
qDebug("LimeSDROutputThread::stopWork: stream stopped");
}
} }
void LimeSDROutputThread::setLog2Interpolation(unsigned int log2_interp) void LimeSDROutputThread::setLog2Interpolation(unsigned int log2_interp)
@ -65,9 +77,7 @@ void LimeSDROutputThread::setFcPos(int fcPos)
void LimeSDROutputThread::run() void LimeSDROutputThread::run()
{ {
//int count, msleep, mdelta;
int res; int res;
//lms_stream_status_t streamStatus;
lms_stream_meta_t metadata; //Use metadata for additional control over sample receive function behaviour lms_stream_meta_t metadata; //Use metadata for additional control over sample receive function behaviour
metadata.flushPartialPacket = false; //Do not discard data remainder when read size differs from packet size metadata.flushPartialPacket = false; //Do not discard data remainder when read size differs from packet size
@ -76,13 +86,6 @@ void LimeSDROutputThread::run()
m_running = true; m_running = true;
m_startWaiter.wakeAll(); m_startWaiter.wakeAll();
if (LMS_StartStream(m_stream) < 0) {
qCritical("LimeSDROutputThread::run: could not start stream");
} else {
usleep(100000);
qDebug("LimeSDROutputThread::run: stream started");
}
while (m_running) while (m_running)
{ {
callback(m_buf, LIMESDROUTPUT_BLOCKSIZE); callback(m_buf, LIMESDROUTPUT_BLOCKSIZE);
@ -98,33 +101,6 @@ void LimeSDROutputThread::run()
{ {
qDebug("LimeSDROutputThread::run written %d/%d samples", res, LIMESDROUTPUT_BLOCKSIZE); qDebug("LimeSDROutputThread::run written %d/%d samples", res, LIMESDROUTPUT_BLOCKSIZE);
} }
// usleep(msleep);
//
// if (count < 10)
// {
// count++;
// }
// else
// {
// if (LMS_GetStreamStatus(m_stream, &streamStatus) == 0)
// {
// if (streamStatus.fifoFilledCount < (4*streamStatus.fifoSize)/5) { // FIFO at 80%
// msleep -= mdelta;
// } else {
// msleep += mdelta;
// }
// }
//
// count = 0;
// }
}
if (LMS_StopStream(m_stream) < 0) {
qCritical("LimeSDROutputThread::run: could not stop stream");
} else {
usleep(100000);
qDebug("LimeSDROutputThread::run: stream stopped");
} }
m_running = false; m_running = false;

View File

@ -31,7 +31,7 @@
const PluginDescriptor LimeSDRInputPlugin::m_pluginDescriptor = { const PluginDescriptor LimeSDRInputPlugin::m_pluginDescriptor = {
QString("LimeSDR Input"), QString("LimeSDR Input"),
QString("3.7.6"), QString("3.7.8"),
QString("(c) Edouard Griffiths, F4EXB"), QString("(c) Edouard Griffiths, F4EXB"),
QString("https://github.com/f4exb/sdrangel"), QString("https://github.com/f4exb/sdrangel"),
true, true,

View File

@ -39,6 +39,12 @@ void LimeSDRInputThread::startWork()
{ {
if (m_running) return; // return if running already if (m_running) return; // return if running already
if (LMS_StartStream(m_stream) < 0) {
qCritical("LimeSDRInputThread::startWork: could not start stream");
} else {
qDebug("LimeSDRInputThread::startWork: stream started");
}
m_startWaitMutex.lock(); m_startWaitMutex.lock();
start(); start();
while(!m_running) while(!m_running)
@ -52,6 +58,12 @@ void LimeSDRInputThread::stopWork()
m_running = false; m_running = false;
wait(); wait();
if (LMS_StopStream(m_stream) < 0) {
qCritical("LimeSDRInputThread::stopWork: could not stop stream");
} else {
qDebug("LimeSDRInputThread::stopWork: stream stopped");
}
} }
void LimeSDRInputThread::setLog2Decimation(unsigned int log2_decim) void LimeSDRInputThread::setLog2Decimation(unsigned int log2_decim)
@ -75,13 +87,6 @@ void LimeSDRInputThread::run()
m_running = true; m_running = true;
m_startWaiter.wakeAll(); m_startWaiter.wakeAll();
if (LMS_StartStream(m_stream) < 0) {
qCritical("LimeSDRInputThread::run: could not start stream");
} else {
usleep(100000);
qDebug("LimeSDRInputThread::run: stream started");
}
while (m_running) while (m_running)
{ {
if ((res = LMS_RecvStream(m_stream, (void *) m_buf, LIMESDR_BLOCKSIZE, &metadata, 1000)) < 0) if ((res = LMS_RecvStream(m_stream, (void *) m_buf, LIMESDR_BLOCKSIZE, &metadata, 1000)) < 0)
@ -93,14 +98,6 @@ void LimeSDRInputThread::run()
callback(m_buf, 2 * res); callback(m_buf, 2 * res);
} }
if (LMS_StopStream(m_stream) < 0) {
qCritical("LimeSDRInputThread::run: could not stop stream");
} else {
usleep(100000);
qDebug("LimeSDRInputThread::run: stream stopped");
}
m_running = false; m_running = false;
} }