From 8ddc8522394ee28a167b95b3a86fc642cfef7f32 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 27 Oct 2017 00:53:34 +0200 Subject: [PATCH] LimeSDR: introduced a 0.5s delay after LMS_StartStream and LMS_StopStream and cleaned up some commented code --- .../limesdroutput/limesdroutput.cpp | 63 ------------------- .../limesdroutput/limesdroutputthread.cpp | 2 + .../limesdrinput/limesdrinput.cpp | 54 ---------------- .../limesdrinput/limesdrinputthread.cpp | 2 + 4 files changed, 4 insertions(+), 117 deletions(-) diff --git a/plugins/samplesink/limesdroutput/limesdroutput.cpp b/plugins/samplesink/limesdroutput/limesdroutput.cpp index 00b80abb1..a33a33d96 100644 --- a/plugins/samplesink/limesdroutput/limesdroutput.cpp +++ b/plugins/samplesink/limesdroutput/limesdroutput.cpp @@ -161,46 +161,6 @@ bool LimeSDROutput::openDevice() m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API - // acquire the channel - -// if (LMS_EnableChannel(m_deviceShared.m_deviceParams->getDevice(), LMS_CH_TX, m_deviceShared.m_channel, true) != 0) -// { -// qCritical("LimeSDROutput::acquireChannel: cannot enable Tx channel %d", m_deviceShared.m_channel); -// return false; -// } -// else -// { -// qDebug("LimeSDROutput::acquireChannel: Tx channel %d enabled", m_deviceShared.m_channel); -// } - - // set up the stream - -// m_streamId.channel = m_deviceShared.m_channel; // channel number -// m_streamId.fifoSize = 512 * 1024; // fifo size in samples (SR / 10 take ~5MS/s) -// m_streamId.throughputVsLatency = 0.0; // optimize for min latency -// m_streamId.isTx = true; // TX channel -// m_streamId.dataFmt = lms_stream_t::LMS_FMT_I12; // 12-bit integers -// -// suspendRxBuddies(); -// suspendTxBuddies(); -// -// if (LMS_SetupStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId) != 0) -// { -// qCritical("LimeSDROutput::acquireChannel: cannot setup the stream on Tx channel %d", m_deviceShared.m_channel); -// resumeTxBuddies(); -// resumeRxBuddies(); -// return false; -// } -// else -// { -// qDebug("LimeSDROutput::acquireChannel: stream set up on Tx channel %d", m_deviceShared.m_channel); -// } -// -// resumeTxBuddies(); -// resumeRxBuddies(); - -// m_channelAcquired = true; - return true; } @@ -292,26 +252,6 @@ void LimeSDROutput::closeDevice() if (m_running) stop(); - // destroy the stream - -// suspendRxBuddies(); -// suspendTxBuddies(); -// -// LMS_DestroyStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId); -// m_streamId.handle = 0; -// -// resumeTxBuddies(); -// resumeRxBuddies(); - - // release the channel - -// if (LMS_EnableChannel(m_deviceShared.m_deviceParams->getDevice(), LMS_CH_TX, m_deviceShared.m_channel, false) != 0) -// { -// qWarning("LimeSDROutput::releaseChannel: cannot disable Tx channel %d", m_deviceShared.m_channel); -// } -// -// m_channelAcquired = false; - // No buddies so effectively close the device if ((m_deviceAPI->getSourceBuddies().size() == 0) && (m_deviceAPI->getSinkBuddies().size() == 0)) @@ -555,9 +495,6 @@ bool LimeSDROutput::handleMessage(const Message& message) << " m_devSampleRate: " << m_settings.m_devSampleRate << " log2Hard: " << hard << " m_log2HardInterp: " << m_settings.m_log2HardInterp; - -// int adcdac_rate = report.getDevSampleRate() * (1<setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API - // acquire the channel - -// if (LMS_EnableChannel(m_deviceShared.m_deviceParams->getDevice(), LMS_CH_RX, m_deviceShared.m_channel, true) != 0) -// { -// qCritical("LimeSDRInput::openDevice: cannot enable Rx channel %d", m_deviceShared.m_channel); -// return false; -// } -// else -// { -// qDebug("LimeSDRInput::openDevice: Rx channel %d enabled", m_deviceShared.m_channel); -// } - - // set up the stream - -// m_streamId.channel = m_deviceShared.m_channel; //channel number -// m_streamId.fifoSize = 1024 * 1024; //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 -// -// suspendRxBuddies(); -// suspendTxBuddies(); -// -// if (LMS_SetupStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId) != 0) -// { -// qCritical("LimeSDRInput::start: cannot setup the stream on Rx channel %d", m_deviceShared.m_channel); -// return false; -// } -// else -// { -// qDebug("LimeSDRInput::start: stream set up on Rx channel %d", m_deviceShared.m_channel); -// } -// -// resumeTxBuddies(); -// resumeRxBuddies(); - return true; } @@ -305,24 +269,6 @@ void LimeSDRInput::closeDevice() if (m_running) { stop(); } - // destroy the stream - -// suspendRxBuddies(); -// suspendTxBuddies(); -// -// LMS_DestroyStream(m_deviceShared.m_deviceParams->getDevice(), &m_streamId); -// m_streamId.handle = 0; -// -// resumeTxBuddies(); -// resumeRxBuddies(); - - // release the channel - -// if (LMS_EnableChannel(m_deviceShared.m_deviceParams->getDevice(), LMS_CH_RX, m_deviceShared.m_channel, false) != 0) -// { -// qWarning("LimeSDRInput::closeDevice: cannot disable Rx channel %d", m_deviceShared.m_channel); -// } - m_deviceShared.m_channel = -1; // No buddies so effectively close the device diff --git a/plugins/samplesource/limesdrinput/limesdrinputthread.cpp b/plugins/samplesource/limesdrinput/limesdrinputthread.cpp index 752eff8bf..b2481095c 100644 --- a/plugins/samplesource/limesdrinput/limesdrinputthread.cpp +++ b/plugins/samplesource/limesdrinput/limesdrinputthread.cpp @@ -78,6 +78,7 @@ void LimeSDRInputThread::run() if (LMS_StartStream(m_stream) < 0) { qCritical("LimeSDRInputThread::run: could not start stream"); } else { + usleep(500000); qDebug("LimeSDRInputThread::run: stream started"); } @@ -96,6 +97,7 @@ void LimeSDRInputThread::run() if (LMS_StopStream(m_stream) < 0) { qCritical("LimeSDRInputThread::run: could not stop stream"); } else { + usleep(500000); qDebug("LimeSDRInputThread::run: stream stopped"); }