mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-23 18:52:28 -04:00
BladeRF output plugin: working basically
This commit is contained in:
parent
8bd9c74620
commit
f48fd4c3a4
@ -25,7 +25,7 @@ bool DeviceBladeRF::open_bladerf(struct bladerf **dev, const char *serial)
|
|||||||
|
|
||||||
if ((*dev = open_bladerf_from_serial(0)) == 0)
|
if ((*dev = open_bladerf_from_serial(0)) == 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DeviceBladeRF::open_bladerf: could not open BladeRF");
|
fprintf(stderr, "DeviceBladeRF::open_bladerf: could not open BladeRF\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,13 +33,13 @@ bool DeviceBladeRF::open_bladerf(struct bladerf **dev, const char *serial)
|
|||||||
|
|
||||||
if (fpga_loaded < 0)
|
if (fpga_loaded < 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "DeviceBladeRF::open_bladerf: failed to check FPGA state: %s",
|
fprintf(stderr, "DeviceBladeRF::open_bladerf: failed to check FPGA state: %s\n",
|
||||||
bladerf_strerror(fpga_loaded));
|
bladerf_strerror(fpga_loaded));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (fpga_loaded == 0)
|
else if (fpga_loaded == 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "BladerfOutput::start: the device's FPGA is not loaded.");
|
fprintf(stderr, "BladerfOutput::start: the device's FPGA is not loaded.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,9 +219,9 @@ void BladerfOutputGui::on_bandwidth_currentIndexChanged(int index)
|
|||||||
sendSettings();
|
sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BladerfOutputGui::on_decim_currentIndexChanged(int index)
|
void BladerfOutputGui::on_interp_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
if ((index <0) || (index > 5))
|
if ((index <0) || (index > 6))
|
||||||
return;
|
return;
|
||||||
m_settings.m_log2Interp = index;
|
m_settings.m_log2Interp = index;
|
||||||
sendSettings();
|
sendSettings();
|
||||||
@ -229,7 +229,7 @@ void BladerfOutputGui::on_decim_currentIndexChanged(int index)
|
|||||||
|
|
||||||
void BladerfOutputGui::on_vga1_valueChanged(int value)
|
void BladerfOutputGui::on_vga1_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if ((value < BLADERF_RXVGA1_GAIN_MIN) || (value > BLADERF_RXVGA1_GAIN_MAX))
|
if ((value < BLADERF_TXVGA1_GAIN_MIN) || (value > BLADERF_TXVGA1_GAIN_MAX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ui->vga1Text->setText(tr("%1dB").arg(value));
|
ui->vga1Text->setText(tr("%1dB").arg(value));
|
||||||
@ -239,7 +239,7 @@ void BladerfOutputGui::on_vga1_valueChanged(int value)
|
|||||||
|
|
||||||
void BladerfOutputGui::on_vga2_valueChanged(int value)
|
void BladerfOutputGui::on_vga2_valueChanged(int value)
|
||||||
{
|
{
|
||||||
if ((value < BLADERF_RXVGA2_GAIN_MIN) || (value > BLADERF_RXVGA2_GAIN_MAX))
|
if ((value < BLADERF_TXVGA2_GAIN_MIN) || (value > BLADERF_TXVGA2_GAIN_MAX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ui->vga2Text->setText(tr("%1dB").arg(value));
|
ui->vga2Text->setText(tr("%1dB").arg(value));
|
||||||
|
@ -71,7 +71,7 @@ private slots:
|
|||||||
void on_centerFrequency_changed(quint64 value);
|
void on_centerFrequency_changed(quint64 value);
|
||||||
void on_samplerate_currentIndexChanged(int index);
|
void on_samplerate_currentIndexChanged(int index);
|
||||||
void on_bandwidth_currentIndexChanged(int index);
|
void on_bandwidth_currentIndexChanged(int index);
|
||||||
void on_decim_currentIndexChanged(int index);
|
void on_interp_currentIndexChanged(int index);
|
||||||
void on_vga1_valueChanged(int value);
|
void on_vga1_valueChanged(int value);
|
||||||
void on_vga2_valueChanged(int value);
|
void on_vga2_valueChanged(int value);
|
||||||
void on_xb200_currentIndexChanged(int index);
|
void on_xb200_currentIndexChanged(int index);
|
||||||
|
@ -265,7 +265,7 @@
|
|||||||
<string>Interpolation factor</string>
|
<string>Interpolation factor</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -425,16 +425,16 @@
|
|||||||
<string>Amplifier before filtering gain (dB)</string>
|
<string>Amplifier before filtering gain (dB)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>5</number>
|
<number>-35</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>30</number>
|
<number>-4</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="pageStep">
|
<property name="pageStep">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>20</number>
|
<number>-20</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -450,7 +450,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>20</string>
|
<string>-20</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
@ -491,16 +491,16 @@
|
|||||||
<string>Amplifier before ADC gain (dB)</string>
|
<string>Amplifier before ADC gain (dB)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>30</number>
|
<number>25</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<number>3</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="pageStep">
|
<property name="pageStep">
|
||||||
<number>3</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>9</number>
|
<number>20</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -516,7 +516,7 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>9</string>
|
<string>20</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
@ -28,8 +28,8 @@ void BladeRFOutputSettings::resetToDefaults()
|
|||||||
{
|
{
|
||||||
m_centerFrequency = 435000*1000;
|
m_centerFrequency = 435000*1000;
|
||||||
m_devSampleRate = 3072000;
|
m_devSampleRate = 3072000;
|
||||||
m_vga1 = 20;
|
m_vga1 = -20;
|
||||||
m_vga2 = 9;
|
m_vga2 = 20;
|
||||||
m_bandwidth = 1500000;
|
m_bandwidth = 1500000;
|
||||||
m_log2Interp = 0;
|
m_log2Interp = 0;
|
||||||
m_xb200 = false;
|
m_xb200 = false;
|
||||||
|
@ -28,7 +28,7 @@ BladerfOutputThread::BladerfOutputThread(struct bladerf* dev, SampleSourceFifo*
|
|||||||
m_log2Interp(0),
|
m_log2Interp(0),
|
||||||
m_fcPos(0)
|
m_fcPos(0)
|
||||||
{
|
{
|
||||||
m_sampleFifo->resize(BLADERFOUTPUT_BLOCKSIZE);
|
m_sampleFifo->resize(16*BLADERFOUTPUT_BLOCKSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
BladerfOutputThread::~BladerfOutputThread()
|
BladerfOutputThread::~BladerfOutputThread()
|
||||||
@ -81,34 +81,34 @@ void BladerfOutputThread::run()
|
|||||||
void BladerfOutputThread::callback(qint16* buf, qint32 len)
|
void BladerfOutputThread::callback(qint16* buf, qint32 len)
|
||||||
{
|
{
|
||||||
SampleVector::iterator beginRead;
|
SampleVector::iterator beginRead;
|
||||||
m_sampleFifo->readAdvance(beginRead, len);
|
m_sampleFifo->readAdvance(beginRead, len/(1<<m_log2Interp));
|
||||||
beginRead -= len;
|
beginRead -= len;
|
||||||
|
|
||||||
if (m_log2Interp == 0)
|
if (m_log2Interp == 0)
|
||||||
{
|
{
|
||||||
m_interpolators.interpolate1(&beginRead, buf, len);
|
m_interpolators.interpolate1(&beginRead, buf, len*2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (m_log2Interp)
|
switch (m_log2Interp)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
m_interpolators.interpolate2_cen(&beginRead, buf, len);
|
m_interpolators.interpolate2_cen(&beginRead, buf, len*2);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
m_interpolators.interpolate4_cen(&beginRead, buf, len);
|
m_interpolators.interpolate4_cen(&beginRead, buf, len*2);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
m_interpolators.interpolate8_cen(&beginRead, buf, len);
|
m_interpolators.interpolate8_cen(&beginRead, buf, len*2);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
m_interpolators.interpolate16_cen(&beginRead, buf, len);
|
m_interpolators.interpolate16_cen(&beginRead, buf, len*2);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
m_interpolators.interpolate32_cen(&beginRead, buf, len);
|
m_interpolators.interpolate32_cen(&beginRead, buf, len*2);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
m_interpolators.interpolate64_cen(&beginRead, buf, len);
|
m_interpolators.interpolate64_cen(&beginRead, buf, len*2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "dsp/samplesourcefifo.h"
|
#include "dsp/samplesourcefifo.h"
|
||||||
#include "dsp/interpolators.h"
|
#include "dsp/interpolators.h"
|
||||||
|
|
||||||
#define BLADERFOUTPUT_BLOCKSIZE (1<<14)
|
#define BLADERFOUTPUT_BLOCKSIZE (1<<16)
|
||||||
|
|
||||||
class BladerfOutputThread : public QThread {
|
class BladerfOutputThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -855,8 +855,8 @@ void MainWindow::on_sampleSink_confirmClicked(bool checked)
|
|||||||
{
|
{
|
||||||
if ((*it)->m_deviceSourceEngine) // it is a source device
|
if ((*it)->m_deviceSourceEngine) // it is a source device
|
||||||
{
|
{
|
||||||
if ((deviceUI->m_deviceSourceAPI->getHardwareId() == (*it)->m_deviceSourceAPI->getHardwareId()) &&
|
if ((deviceUI->m_deviceSinkAPI->getHardwareId() == (*it)->m_deviceSourceAPI->getHardwareId()) &&
|
||||||
(deviceUI->m_deviceSourceAPI->getSampleSourceSerial() == (*it)->m_deviceSourceAPI->getSampleSourceSerial()))
|
(deviceUI->m_deviceSinkAPI->getSampleSinkSerial() == (*it)->m_deviceSourceAPI->getSampleSourceSerial()))
|
||||||
{
|
{
|
||||||
(*it)->m_deviceSourceAPI->addSinkBuddy(deviceUI->m_deviceSinkAPI);
|
(*it)->m_deviceSourceAPI->addSinkBuddy(deviceUI->m_deviceSinkAPI);
|
||||||
}
|
}
|
||||||
@ -864,8 +864,8 @@ void MainWindow::on_sampleSink_confirmClicked(bool checked)
|
|||||||
|
|
||||||
if ((*it)->m_deviceSinkEngine) // it is a sink device
|
if ((*it)->m_deviceSinkEngine) // it is a sink device
|
||||||
{
|
{
|
||||||
if ((deviceUI->m_deviceSourceAPI->getHardwareId() == (*it)->m_deviceSinkAPI->getHardwareId()) &&
|
if ((deviceUI->m_deviceSinkAPI->getHardwareId() == (*it)->m_deviceSinkAPI->getHardwareId()) &&
|
||||||
(deviceUI->m_deviceSourceAPI->getSampleSourceSerial() == (*it)->m_deviceSinkAPI->getSampleSinkSerial()))
|
(deviceUI->m_deviceSinkAPI->getSampleSinkSerial() == (*it)->m_deviceSinkAPI->getSampleSinkSerial()))
|
||||||
{
|
{
|
||||||
(*it)->m_deviceSinkAPI->addSinkBuddy(deviceUI->m_deviceSinkAPI);
|
(*it)->m_deviceSinkAPI->addSinkBuddy(deviceUI->m_deviceSinkAPI);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user