1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

BladeRF2 output: tried to fix SO->MO and MO->SO cycle

This commit is contained in:
f4exb 2018-10-02 06:11:34 +02:00
parent 49a0dbac40
commit f4976485fc
3 changed files with 33 additions and 39 deletions

3
debian/changelog vendored
View File

@ -1,8 +1,9 @@
sdrangel (4.2.0-1) unstable; urgency=medium
* LibbladeRF 2.0 support with BladeRF Micro
* Scope: corrected trace memory index position
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 14 Oct 2018 21:14:18 +0200
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 7 Oct 2018 21:14:18 +0200
sdrangel (4.1.0-1) unstable; urgency=medium

View File

@ -150,7 +150,7 @@ bool DeviceBladeRF2::openRx(int channel)
if (status < 0)
{
qCritical("DeviceBladeRF2::openRx: Failed to enable Rx channel %d: %s",
qCritical("DeviceBladeRF2::openRx: failed to enable Rx channel %d: %s",
channel, bladerf_strerror(status));
return false;
}
@ -163,8 +163,8 @@ bool DeviceBladeRF2::openRx(int channel)
}
else
{
qCritical("DeviceBladeRF2::openRx: Rx channel %d already opened", channel);
return false;
qDebug("DeviceBladeRF2::openRx: Rx channel %d already opened", channel);
return true;
}
}
@ -201,8 +201,8 @@ bool DeviceBladeRF2::openTx(int channel)
}
else
{
qCritical("DeviceBladeRF2::openTx: Tx channel %d already opened", channel);
return false;
qDebug("DeviceBladeRF2::openTx: Tx channel %d already opened", channel);
return true;
}
}
@ -220,26 +220,18 @@ void DeviceBladeRF2::closeRx(int channel)
if (m_rxOpen[channel])
{
for (int i = 0; i < m_nbRxChannels; i++)
{
if ((i != channel) && (m_rxOpen[i]))
{
qDebug("DeviceBladeRF2::closeRx: not closing channel %d as %d is still open", channel, i);
}
}
int status = bladerf_enable_module(m_dev, BLADERF_CHANNEL_RX(channel), false);
m_rxOpen[channel] = false;
if (status < 0) {
qCritical("DeviceBladeRF2::closeRx: cannot close channel %d: %s", channel, bladerf_strerror(status));
qCritical("DeviceBladeRF2::closeRx: failed to disable Rx channel %d: %s", channel, bladerf_strerror(status));
} else {
qDebug("DeviceBladeRF2::closeRx: channel %d closed", channel);
qDebug("DeviceBladeRF2::closeRx: Rx channel %d disabled", channel);
}
}
else
{
qCritical("DeviceBladeRF2::closeRx: Rx channel %d already closed", channel);
qDebug("DeviceBladeRF2::closeRx: Rx channel %d already closed", channel);
}
}
@ -257,26 +249,18 @@ void DeviceBladeRF2::closeTx(int channel)
if (m_txOpen[channel])
{
for (int i = 0; i < m_nbTxChannels; i++)
{
if ((i != channel) && (m_txOpen[i]))
{
qDebug("DeviceBladeRF2::closeTx: not closing channel %d as %d is still open", channel, i);
}
}
int status = bladerf_enable_module(m_dev, BLADERF_CHANNEL_TX(channel), false);
m_txOpen[channel] = false;
if (status < 0) {
qCritical("DeviceBladeRF2::closeTx: cannot close channel %d: %s", channel, bladerf_strerror(status));
qCritical("DeviceBladeRF2::closeTx: failed to disable Tx channel %d: %s", channel, bladerf_strerror(status));
} else {
qDebug("DeviceBladeRF2::closeTx: channel %d closed", channel);
qDebug("DeviceBladeRF2::closeTx: Tx channel %d disabled", channel);
}
}
else
{
qCritical("DeviceBladeRF2::closeTx: Rx channel %d already closed", channel);
qDebug("DeviceBladeRF2::closeTx: Rx channel %d already closed", channel);
}
}

View File

@ -298,6 +298,11 @@ bool BladeRF2Output::start()
((DeviceBladeRF2Shared*) (*it)->getBuddySharedPtr())->m_sink->setThread(0);
}
// close all channels
for (int i = bladeRF2OutputThread->getNbChannels()-1; i >= 0; i--) {
m_deviceShared.m_dev->closeTx(i);
}
needsStart = true;
}
else
@ -320,11 +325,9 @@ bool BladeRF2Output::start()
if (needsStart)
{
qDebug("BladeRF2Output::start: enabling channel(s) and (re)sart buddy thread");
qDebug("BladeRF2Output::start: enabling channel(s) and (re)starting the thread");
int nbChannels = bladeRF2OutputThread->getNbChannels();
for (int i = 0; i < nbChannels; i++)
for (unsigned int i = 0; i < bladeRF2OutputThread->getNbChannels(); i++) // open all channels
{
if (!m_deviceShared.m_dev->openTx(i)) {
qCritical("BladeRF2Output::start: channel %u cannot be enabled", i);
@ -429,16 +432,22 @@ void BladeRF2Output::stop()
((DeviceBladeRF2Shared*) (*it)->getBuddySharedPtr())->m_sink->setThread(0);
}
for (int i = 0; i < nbOriginalChannels-1; i++) // close all inactive channels
{
if (fifos[i] == 0) {
m_deviceShared.m_dev->closeTx(i);
}
// close all channels
for (int i = nbOriginalChannels-1; i >= 0; i--) {
m_deviceShared.m_dev->closeTx(i);
}
m_deviceShared.m_dev->closeTx(requestedChannel); // close the last channel
if (stillActiveFIFO)
{
qDebug("BladeRF2Output::stop: enabling channel(s) and restarting the thread");
for (unsigned int i = 0; i < bladeRF2OutputThread->getNbChannels(); i++) // open all channels
{
if (!m_deviceShared.m_dev->openTx(i)) {
qCritical("BladeRF2Output::start: channel %u cannot be enabled", i);
}
}
if (stillActiveFIFO) {
bladeRF2OutputThread->startWork();
}
}