2015-06-06 21:30:28 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2015-06-07 11:56:19 -04:00
|
|
|
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
2015-06-06 21:30:28 -04:00
|
|
|
// //
|
|
|
|
// 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/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-12-26 20:14:31 -05:00
|
|
|
#ifndef INCLUDE_BLADERFINPUTTHREAD_H
|
|
|
|
#define INCLUDE_BLADERFINPUTTHREAD_H
|
2015-06-06 21:30:28 -04:00
|
|
|
|
|
|
|
#include <QThread>
|
|
|
|
#include <QMutex>
|
|
|
|
#include <QWaitCondition>
|
|
|
|
#include <libbladeRF.h>
|
2016-10-06 13:18:02 -04:00
|
|
|
#include "dsp/samplesinkfifo.h"
|
2015-08-26 22:20:56 -04:00
|
|
|
#include "dsp/decimators.h"
|
2015-06-06 21:30:28 -04:00
|
|
|
|
2015-06-09 21:26:06 -04:00
|
|
|
#define BLADERF_BLOCKSIZE (1<<14)
|
2015-06-06 21:30:28 -04:00
|
|
|
|
2018-09-19 02:56:39 -04:00
|
|
|
class Bladerf1InputThread : public QThread {
|
2015-06-06 21:30:28 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2018-09-19 02:56:39 -04:00
|
|
|
Bladerf1InputThread(struct bladerf* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
|
|
|
|
~Bladerf1InputThread();
|
2015-06-06 21:30:28 -04:00
|
|
|
|
|
|
|
void startWork();
|
|
|
|
void stopWork();
|
|
|
|
void setLog2Decimation(unsigned int log2_decim);
|
2015-07-01 19:00:27 -04:00
|
|
|
void setFcPos(int fcPos);
|
2015-06-06 21:30:28 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
QMutex m_startWaitMutex;
|
|
|
|
QWaitCondition m_startWaiter;
|
|
|
|
bool m_running;
|
|
|
|
|
|
|
|
struct bladerf* m_dev;
|
|
|
|
qint16 m_buf[2*BLADERF_BLOCKSIZE];
|
|
|
|
SampleVector m_convertBuffer;
|
2016-10-06 13:18:02 -04:00
|
|
|
SampleSinkFifo* m_sampleFifo;
|
2015-06-06 21:30:28 -04:00
|
|
|
|
|
|
|
unsigned int m_log2Decim;
|
2015-07-01 19:00:27 -04:00
|
|
|
int m_fcPos;
|
2015-06-06 21:30:28 -04:00
|
|
|
|
2018-01-22 02:46:05 -05:00
|
|
|
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
2015-06-06 21:30:28 -04:00
|
|
|
|
|
|
|
void run();
|
|
|
|
void callback(const qint16* buf, qint32 len);
|
|
|
|
};
|
|
|
|
|
2016-12-26 20:14:31 -05:00
|
|
|
#endif // INCLUDE_BLADERFINPUTTHREAD_H
|