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

BladeRF output: set FIFO size to 0.25s or 75 kS whichever is larger (300kS/s knee) except when decimating by 32 where a fixed 150 kS FIFO is used

This commit is contained in:
f4exb 2017-08-09 00:31:23 +02:00
parent 5829519116
commit 6522f62326
5 changed files with 73 additions and 6 deletions

View File

@ -3,12 +3,14 @@ project(bladerfdevice)
set(bladerfdevice_SOURCES
devicebladerf.cpp
devicebladerfvalues.cpp
devicebladerfshared.cpp
)
set(bladerfdevice_HEADERS
devicebladerf.h
devicebladerfvalues.h
devicebladerfparam.h
devicebladerfshared.h
)
if (BUILD_DEBIAN)

View File

@ -0,0 +1,21 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "devicebladerfshared.h"
const float DeviceBladeRFShared::m_sampleFifoLengthInSeconds = 0.25;
const int DeviceBladeRFShared::m_sampleFifoMinSize = 75000; // 300 kS/s knee
const int DeviceBladeRFShared::m_sampleFifoMinSize32 = 150000; // Fixed for interpolation by 32

View File

@ -0,0 +1,31 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef DEVICES_BLADERF_DEVICEHACKRFSHARED_H_
#define DEVICES_BLADERF_DEVICEHACKRFSHARED_H_
#include "util/message.h"
class DeviceBladeRFShared
{
public:
static const float m_sampleFifoLengthInSeconds;
static const int m_sampleFifoMinSize;
static const int m_sampleFifoMinSize32;
};
#endif /* DEVICES_BLADERF_DEVICEHACKRFSHARED_H_ */

View File

@ -45,7 +45,8 @@ CONFIG(Release):build_subdir = release
CONFIG(Debug):build_subdir = debug
!macx:SOURCES += bladerf/devicebladerf.cpp\
bladerf/devicebladerfvalues.cpp
bladerf/devicebladerfvalues.cpp\
bladerf/devicebladerfshared.cpp
SOURCES += hackrf/devicehackrf.cpp\
hackrf/devicehackrfvalues.cpp\
@ -57,7 +58,8 @@ CONFIG(MINGW64)SOURCES += limesdr/devicelimesdr.cpp\
!macx:HEADERS -= bladerf/devicebladerf.h\
bladerf/devicebladerfparam.h\
bladerf/devicebladerfvalues.h
bladerf/devicebladerfvalues.h\
bladerf/devicebladerfshared.h
HEADERS += hackrf/devicehackrf.h\
hackrf/devicehackrfparam.h\

View File

@ -23,6 +23,7 @@
#include "dsp/dspengine.h"
#include "device/devicesinkapi.h"
#include "device/devicesourceapi.h"
#include "bladerf/devicebladerfshared.h"
#include "bladerfoutput.h"
#include "bladerfoutputgui.h"
@ -243,10 +244,20 @@ bool BladerfOutput::applySettings(const BladeRFOutputSettings& settings, bool fo
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || (m_settings.m_log2Interp != settings.m_log2Interp) || force)
{
// FIFO size:
// 1 s length up to interpolation by 16
// 2 s for interpolation by 32
m_sampleSourceFifo.resize(settings.m_devSampleRate/(1<<(settings.m_log2Interp <= 4 ? settings.m_log2Interp : 4)));
int fifoSize;
if (settings.m_log2Interp == 5)
{
fifoSize = DeviceBladeRFShared::m_sampleFifoMinSize32;
}
else
{
fifoSize = std::max(
(int) ((settings.m_devSampleRate/(1<<settings.m_log2Interp)) * DeviceBladeRFShared::m_sampleFifoLengthInSeconds),
DeviceBladeRFShared::m_sampleFifoMinSize);
}
m_sampleSourceFifo.resize(fifoSize);
}
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || force)