mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-08 20:38:39 -05:00
LimeSDR: use constant instead of define for buffer size
This commit is contained in:
parent
f528347fd5
commit
03d39f8483
@ -62,6 +62,8 @@ public:
|
|||||||
/** Set clock source and external clock frequency if required */
|
/** Set clock source and external clock frequency if required */
|
||||||
static bool setClockSource(lms_device_t *device, bool extClock, uint32_t extClockFrequency);
|
static bool setClockSource(lms_device_t *device, bool extClock, uint32_t extClockFrequency);
|
||||||
|
|
||||||
|
static const unsigned int blockSize = (1<<15);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool findSerial(const char *lmsInfoStr, std::string& serial);
|
static bool findSerial(const char *lmsInfoStr, std::string& serial);
|
||||||
};
|
};
|
||||||
|
@ -30,7 +30,7 @@ LimeSDROutputThread::LimeSDROutputThread(lms_stream_t* stream, SampleSourceFifo*
|
|||||||
m_sampleFifo(sampleFifo),
|
m_sampleFifo(sampleFifo),
|
||||||
m_log2Interp(0)
|
m_log2Interp(0)
|
||||||
{
|
{
|
||||||
std::fill(m_buf, m_buf + 2*LIMESDROUTPUT_BLOCKSIZE, 0);
|
std::fill(m_buf, m_buf + 2*DeviceLimeSDR::blockSize, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LimeSDROutputThread::~LimeSDROutputThread()
|
LimeSDROutputThread::~LimeSDROutputThread()
|
||||||
@ -89,18 +89,18 @@ void LimeSDROutputThread::run()
|
|||||||
|
|
||||||
while (m_running)
|
while (m_running)
|
||||||
{
|
{
|
||||||
callback(m_buf, LIMESDROUTPUT_BLOCKSIZE);
|
callback(m_buf, DeviceLimeSDR::blockSize);
|
||||||
|
|
||||||
res = LMS_SendStream(m_stream, (void *) m_buf, LIMESDROUTPUT_BLOCKSIZE, &metadata, 1000000);
|
res = LMS_SendStream(m_stream, (void *) m_buf, DeviceLimeSDR::blockSize, &metadata, 1000000);
|
||||||
|
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
{
|
{
|
||||||
qCritical("LimeSDROutputThread::run write error: %s", strerror(errno));
|
qCritical("LimeSDROutputThread::run write error: %s", strerror(errno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (res != LIMESDROUTPUT_BLOCKSIZE)
|
else if (res != DeviceLimeSDR::blockSize)
|
||||||
{
|
{
|
||||||
qDebug("LimeSDROutputThread::run written %d/%d samples", res, LIMESDROUTPUT_BLOCKSIZE);
|
qDebug("LimeSDROutputThread::run written %d/%d samples", res, DeviceLimeSDR::blockSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,8 +26,7 @@
|
|||||||
|
|
||||||
#include "dsp/interpolators.h"
|
#include "dsp/interpolators.h"
|
||||||
#include "limesdr/devicelimesdrshared.h"
|
#include "limesdr/devicelimesdrshared.h"
|
||||||
|
#include "limesdr/devicelimesdr.h"
|
||||||
#define LIMESDROUTPUT_BLOCKSIZE (1<<15) //complex samples per buffer ~10k (16k)
|
|
||||||
|
|
||||||
class SampleSourceFifo;
|
class SampleSourceFifo;
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ private:
|
|||||||
bool m_running;
|
bool m_running;
|
||||||
|
|
||||||
lms_stream_t* m_stream;
|
lms_stream_t* m_stream;
|
||||||
qint16 m_buf[2*LIMESDROUTPUT_BLOCKSIZE]; //must hold I+Q values of each sample hence 2xcomplex size
|
qint16 m_buf[2*DeviceLimeSDR::blockSize]; //must hold I+Q values of each sample hence 2xcomplex size
|
||||||
SampleSourceFifo* m_sampleFifo;
|
SampleSourceFifo* m_sampleFifo;
|
||||||
|
|
||||||
unsigned int m_log2Interp; // soft decimation
|
unsigned int m_log2Interp; // soft decimation
|
||||||
|
@ -25,11 +25,11 @@ LimeSDRInputThread::LimeSDRInputThread(lms_stream_t* stream, SampleSinkFifo* sam
|
|||||||
QThread(parent),
|
QThread(parent),
|
||||||
m_running(false),
|
m_running(false),
|
||||||
m_stream(stream),
|
m_stream(stream),
|
||||||
m_convertBuffer(LIMESDR_BLOCKSIZE),
|
m_convertBuffer(DeviceLimeSDR::blockSize),
|
||||||
m_sampleFifo(sampleFifo),
|
m_sampleFifo(sampleFifo),
|
||||||
m_log2Decim(0)
|
m_log2Decim(0)
|
||||||
{
|
{
|
||||||
std::fill(m_buf, m_buf + 2*LIMESDR_BLOCKSIZE, 0);
|
std::fill(m_buf, m_buf + 2*DeviceLimeSDR::blockSize, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LimeSDRInputThread::~LimeSDRInputThread()
|
LimeSDRInputThread::~LimeSDRInputThread()
|
||||||
@ -88,7 +88,7 @@ void LimeSDRInputThread::run()
|
|||||||
|
|
||||||
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, DeviceLimeSDR::blockSize, &metadata, 1000)) < 0)
|
||||||
{
|
{
|
||||||
qCritical("LimeSDRInputThread::run read error: %s", strerror(errno));
|
qCritical("LimeSDRInputThread::run read error: %s", strerror(errno));
|
||||||
break;
|
break;
|
||||||
|
@ -27,8 +27,7 @@
|
|||||||
#include "dsp/samplesinkfifo.h"
|
#include "dsp/samplesinkfifo.h"
|
||||||
#include "dsp/decimators.h"
|
#include "dsp/decimators.h"
|
||||||
#include "limesdr/devicelimesdrshared.h"
|
#include "limesdr/devicelimesdrshared.h"
|
||||||
|
#include "limesdr/devicelimesdr.h"
|
||||||
#define LIMESDR_BLOCKSIZE (1<<15) //complex samples per buffer
|
|
||||||
|
|
||||||
class LimeSDRInputThread : public QThread, public DeviceLimeSDRShared::ThreadInterface
|
class LimeSDRInputThread : public QThread, public DeviceLimeSDRShared::ThreadInterface
|
||||||
{
|
{
|
||||||
@ -50,7 +49,7 @@ private:
|
|||||||
bool m_running;
|
bool m_running;
|
||||||
|
|
||||||
lms_stream_t* m_stream;
|
lms_stream_t* m_stream;
|
||||||
qint16 m_buf[2*LIMESDR_BLOCKSIZE]; //must hold I+Q values of each sample hence 2xcomplex size
|
qint16 m_buf[2*DeviceLimeSDR::blockSize]; //must hold I+Q values of each sample hence 2xcomplex size
|
||||||
SampleVector m_convertBuffer;
|
SampleVector m_convertBuffer;
|
||||||
SampleSinkFifo* m_sampleFifo;
|
SampleSinkFifo* m_sampleFifo;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user