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.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Bladerf1OutputThread Class Reference

#include <bladerf1outputthread.h>

Inherits QThread.

+ Collaboration diagram for Bladerf1OutputThread:

Public Member Functions

 Bladerf1OutputThread (struct bladerf *dev, SampleSourceFifo *sampleFifo, QObject *parent=NULL)
 
 ~Bladerf1OutputThread ()
 
void startWork ()
 
void stopWork ()
 
void setLog2Interpolation (unsigned int log2_interp)
 
bool isRunning () const
 

Private Member Functions

void run ()
 
void callback (qint16 *buf, qint32 len)
 

Private Attributes

QMutex m_startWaitMutex
 
QWaitCondition m_startWaiter
 
bool m_running
 
struct bladerf * m_dev
 
qint16 m_buf [2 *BLADERFOUTPUT_BLOCKSIZE]
 
SampleSourceFifom_sampleFifo
 
unsigned int m_log2Interp
 
Interpolators< qint16, SDR_TX_SAMP_SZ, 12 > m_interpolators
 

Detailed Description

Definition at line 30 of file bladerf1outputthread.h.

Constructor & Destructor Documentation

◆ Bladerf1OutputThread()

Bladerf1OutputThread::Bladerf1OutputThread ( struct bladerf *  dev,
SampleSourceFifo sampleFifo,
QObject *  parent = NULL 
)

Definition at line 26 of file bladerf1outputthread.cpp.

References BLADERFOUTPUT_BLOCKSIZE, and m_buf.

26  :
27  QThread(parent),
28  m_running(false),
29  m_dev(dev),
30  m_sampleFifo(sampleFifo),
31  m_log2Interp(0)
32 {
33  std::fill(m_buf, m_buf + 2*BLADERFOUTPUT_BLOCKSIZE, 0);
34 }
#define BLADERFOUTPUT_BLOCKSIZE
qint16 m_buf[2 *BLADERFOUTPUT_BLOCKSIZE]
SampleSourceFifo * m_sampleFifo

◆ ~Bladerf1OutputThread()

Bladerf1OutputThread::~Bladerf1OutputThread ( )

Definition at line 36 of file bladerf1outputthread.cpp.

References stopWork().

37 {
38  stopWork();
39 }
+ Here is the call graph for this function:

Member Function Documentation

◆ callback()

void Bladerf1OutputThread::callback ( qint16 *  buf,
qint32  len 
)
private

Definition at line 83 of file bladerf1outputthread.cpp.

References Interpolators< T, SdrBits, OutputBits >::interpolate1(), Interpolators< T, SdrBits, OutputBits >::interpolate16_cen(), Interpolators< T, SdrBits, OutputBits >::interpolate2_cen(), Interpolators< T, SdrBits, OutputBits >::interpolate32_cen(), Interpolators< T, SdrBits, OutputBits >::interpolate4_cen(), Interpolators< T, SdrBits, OutputBits >::interpolate64_cen(), Interpolators< T, SdrBits, OutputBits >::interpolate8_cen(), m_interpolators, m_log2Interp, m_sampleFifo, and SampleSourceFifo::readAdvance().

Referenced by run().

84 {
85  SampleVector::iterator beginRead;
86  m_sampleFifo->readAdvance(beginRead, len/(1<<m_log2Interp));
87  beginRead -= len;
88 
89  if (m_log2Interp == 0)
90  {
91  m_interpolators.interpolate1(&beginRead, buf, len*2);
92  }
93  else
94  {
95  switch (m_log2Interp)
96  {
97  case 1:
98  m_interpolators.interpolate2_cen(&beginRead, buf, len*2, true);
99  break;
100  case 2:
101  m_interpolators.interpolate4_cen(&beginRead, buf, len*2, true);
102  break;
103  case 3:
104  m_interpolators.interpolate8_cen(&beginRead, buf, len*2, true);
105  break;
106  case 4:
107  m_interpolators.interpolate16_cen(&beginRead, buf, len*2, true);
108  break;
109  case 5:
110  m_interpolators.interpolate32_cen(&beginRead, buf, len*2, true);
111  break;
112  case 6:
113  m_interpolators.interpolate64_cen(&beginRead, buf, len*2, true);
114  break;
115  default:
116  break;
117  }
118  }
119 }
void interpolate64_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
void interpolate32_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
SampleSourceFifo * m_sampleFifo
void interpolate8_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
void interpolate2_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
void readAdvance(SampleVector::iterator &readUntil, unsigned int nbSamples)
void interpolate1(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
Interpolators< qint16, SDR_TX_SAMP_SZ, 12 > m_interpolators
void interpolate16_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
void interpolate4_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRunning()

bool Bladerf1OutputThread::isRunning ( ) const
inline

Definition at line 40 of file bladerf1outputthread.h.

References m_running.

Referenced by Bladerf1Output::applySettings().

40 { return m_running; }
+ Here is the caller graph for this function:

◆ run()

void Bladerf1OutputThread::run ( )
private

Definition at line 61 of file bladerf1outputthread.cpp.

References BLADERFOUTPUT_BLOCKSIZE, callback(), m_buf, m_dev, m_running, and m_startWaiter.

62 {
63  int res;
64 
65  m_running = true;
66  m_startWaiter.wakeAll();
67 
68  while (m_running)
69  {
71 
72  if((res = bladerf_sync_tx(m_dev, m_buf, BLADERFOUTPUT_BLOCKSIZE, NULL, 10000)) < 0)
73  {
74  qCritical("BladerdOutputThread:run: sync error: %s", strerror(errno));
75  break;
76  }
77  }
78 
79  m_running = false;
80 }
QWaitCondition m_startWaiter
#define BLADERFOUTPUT_BLOCKSIZE
qint16 m_buf[2 *BLADERFOUTPUT_BLOCKSIZE]
void callback(qint16 *buf, qint32 len)
+ Here is the call graph for this function:

◆ setLog2Interpolation()

void Bladerf1OutputThread::setLog2Interpolation ( unsigned int  log2_interp)

Definition at line 56 of file bladerf1outputthread.cpp.

References m_log2Interp.

Referenced by Bladerf1Output::applySettings(), and Bladerf1Output::start().

57 {
58  m_log2Interp = log2_interp;
59 }
+ Here is the caller graph for this function:

◆ startWork()

void Bladerf1OutputThread::startWork ( )

Definition at line 41 of file bladerf1outputthread.cpp.

References m_running, m_startWaiter, and m_startWaitMutex.

Referenced by Bladerf1Output::applySettings(), and Bladerf1Output::start().

42 {
43  m_startWaitMutex.lock();
44  start();
45  while(!m_running)
46  m_startWaiter.wait(&m_startWaitMutex, 100);
47  m_startWaitMutex.unlock();
48 }
QWaitCondition m_startWaiter
+ Here is the caller graph for this function:

◆ stopWork()

void Bladerf1OutputThread::stopWork ( )

Definition at line 50 of file bladerf1outputthread.cpp.

References m_running.

Referenced by Bladerf1Output::applySettings(), Bladerf1Output::stop(), and ~Bladerf1OutputThread().

51 {
52  m_running = false;
53  wait();
54 }
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_buf

qint16 Bladerf1OutputThread::m_buf[2 *BLADERFOUTPUT_BLOCKSIZE]
private

Definition at line 48 of file bladerf1outputthread.h.

Referenced by Bladerf1OutputThread(), and run().

◆ m_dev

struct bladerf* Bladerf1OutputThread::m_dev
private

Definition at line 47 of file bladerf1outputthread.h.

Referenced by run().

◆ m_interpolators

Interpolators<qint16, SDR_TX_SAMP_SZ, 12> Bladerf1OutputThread::m_interpolators
private

Definition at line 53 of file bladerf1outputthread.h.

Referenced by callback().

◆ m_log2Interp

unsigned int Bladerf1OutputThread::m_log2Interp
private

Definition at line 51 of file bladerf1outputthread.h.

Referenced by callback(), and setLog2Interpolation().

◆ m_running

bool Bladerf1OutputThread::m_running
private

Definition at line 45 of file bladerf1outputthread.h.

Referenced by isRunning(), run(), startWork(), and stopWork().

◆ m_sampleFifo

SampleSourceFifo* Bladerf1OutputThread::m_sampleFifo
private

Definition at line 49 of file bladerf1outputthread.h.

Referenced by callback().

◆ m_startWaiter

QWaitCondition Bladerf1OutputThread::m_startWaiter
private

Definition at line 44 of file bladerf1outputthread.h.

Referenced by run(), and startWork().

◆ m_startWaitMutex

QMutex Bladerf1OutputThread::m_startWaitMutex
private

Definition at line 43 of file bladerf1outputthread.h.

Referenced by startWork().


The documentation for this class was generated from the following files: