SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
bladerf2outputthread.h
Go to the documentation of this file.
1 // Copyright (C) 2015 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef PLUGINS_SAMPLESINK_BLADERF2OUTPUT_BLADERF2OUTPUTTHREAD_H_
19 #define PLUGINS_SAMPLESINK_BLADERF2OUTPUT_BLADERF2OUTPUTTHREAD_H_
20 
21 #include <QThread>
22 #include <QMutex>
23 #include <QWaitCondition>
24 #include <libbladeRF.h>
25 
27 #include "dsp/interpolators.h"
28 
29 class SampleSinkFifo;
30 
31 class BladeRF2OutputThread : public QThread {
32  Q_OBJECT
33 
34 public:
35  BladeRF2OutputThread(struct bladerf* dev, unsigned int nbTxChannels, QObject* parent = 0);
37 
38  void startWork();
39  void stopWork();
40  bool isRunning() const { return m_running; }
41  unsigned int getNbChannels() const { return m_nbChannels; }
42  void setLog2Interpolation(unsigned int channel, unsigned int log2_interp);
43  unsigned int getLog2Interpolation(unsigned int channel) const;
44  void setFifo(unsigned int channel, SampleSourceFifo *sampleFifo);
45  SampleSourceFifo *getFifo(unsigned int channel);
46 
47 private:
48  struct Channel
49  {
51  unsigned int m_log2Interp;
53 
54  Channel() :
55  m_sampleFifo(0),
56  m_log2Interp(0)
57  {}
58 
60  {}
61  };
62 
64  QWaitCondition m_startWaiter;
65  bool m_running;
66  struct bladerf* m_dev;
67 
69  qint16 *m_buf;
70  unsigned int m_nbChannels;
71 
72  void run();
73  unsigned int getNbFifos();
74  void callbackSO(qint16* buf, qint32 len, unsigned int channel = 0);
75  void callbackMO(qint16* buf, qint32 samplesPerChannel);
76 };
77 
78 
79 
80 #endif /* PLUGINS_SAMPLESINK_BLADERF2OUTPUT_BLADERF2OUTPUTTHREAD_H_ */
void callbackSO(qint16 *buf, qint32 len, unsigned int channel=0)
void callbackMO(qint16 *buf, qint32 samplesPerChannel)
SampleSourceFifo * getFifo(unsigned int channel)
unsigned int getLog2Interpolation(unsigned int channel) const
Channel * m_channels
Array of channels dynamically allocated for the given number of Tx channels.
unsigned int getNbChannels() const
void setFifo(unsigned int channel, SampleSourceFifo *sampleFifo)
BladeRF2OutputThread(struct bladerf *dev, unsigned int nbTxChannels, QObject *parent=0)
void setLog2Interpolation(unsigned int channel, unsigned int log2_interp)
QWaitCondition m_startWaiter
Interpolators< qint16, SDR_TX_SAMP_SZ, 12 > m_interpolators
qint16 * m_buf
Full buffer for SISO or MIMO operation.