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

#include <deviceplutosdrbox.h>

Classes

struct  Sample
 
struct  SampleRates
 

Public Types

enum  DeviceType { DEVICE_PHY, DEVICE_RX, DEVICE_TX }
 
enum  DeviceUse { USE_RX, USE_TX }
 

Public Member Functions

 DevicePlutoSDRBox (const std::string &uri)
 
 ~DevicePlutoSDRBox ()
 
bool isValid () const
 
void set_params (DeviceType devType, const std::vector< std::string > &params)
 
bool get_param (DeviceType devType, const std::string &param, std::string &value)
 
bool openRx ()
 
bool openTx ()
 
void closeRx ()
 
void closeTx ()
 
struct iio_buffer * createRxBuffer (unsigned int size, bool cyclic)
 
struct iio_buffer * createTxBuffer (unsigned int size, bool cyclic)
 
void deleteRxBuffer ()
 
void deleteTxBuffer ()
 
ssize_t getRxSampleSize ()
 
ssize_t getTxSampleSize ()
 
struct iio_channel * getRxChannel0 ()
 
struct iio_channel * getTxChannel0I ()
 
struct iio_channel * getTxChannel0Q ()
 
ssize_t rxBufferRefill ()
 
ssize_t txBufferPush ()
 
std::ptrdiff_t rxBufferStep ()
 
char * rxBufferEnd ()
 
char * rxBufferFirst ()
 
std::ptrdiff_t txBufferStep ()
 
char * txBufferEnd ()
 
char * txBufferFirst ()
 
void txChannelConvert (int16_t *dst, int16_t *src)
 
bool getRxSampleRates (SampleRates &sampleRates)
 
bool getTxSampleRates (SampleRates &sampleRates)
 
void setSampleRate (uint32_t sampleRate)
 
void setFIR (uint32_t sampleRate, uint32_t intdec, DeviceUse use, uint32_t bw, int gain)
 
void setFIREnable (bool enable)
 
void setLOPPMTenths (int ppmTenths)
 
bool getRxGain (int &gaindB, unsigned int chan)
 
bool getRxRSSI (std::string &rssiStr, unsigned int chan)
 
bool getTxRSSI (std::string &rssiStr, unsigned int chan)
 
void getRxLORange (uint64_t &minLimit, uint64_t &maxLimit)
 
void getTxLORange (uint64_t &minLimit, uint64_t &maxLimit)
 
void getbbLPRxRange (uint32_t &minLimit, uint32_t &maxLimit)
 
void getbbLPTxRange (uint32_t &minLimit, uint32_t &maxLimit)
 
bool fetchTemp ()
 
float getTemp () const
 
bool getRateGovernors (std::string &rateGovernors)
 

Static Public Member Functions

static bool probeURI (const std::string &uri)
 

Public Attributes

uint64_t m_devSampleRate
 Host interface sample rate. More...
 
int32_t m_LOppmTenths
 XO correction. More...
 
bool m_lpfFIREnable
 enable digital lowpass FIR filter More...
 
float m_lpfFIRBW
 digital lowpass FIR filter bandwidth (Hz) More...
 
uint32_t m_lpfFIRlog2Decim
 digital lowpass FIR filter log2 of decimation factor (0..2) More...
 
int m_lpfFIRRxGain
 digital lowpass FIR filter gain Rx side (dB) More...
 
int m_lpfFIRTxGain
 digital lowpass FIR filter gain Tx side (dB) More...
 

Private Member Functions

bool parseSampleRates (const std::string &rateStr, SampleRates &sampleRates)
 
void setFilter (const std::string &filterConfigStr)
 
void formatFIRHeader (std::ostringstream &str, uint32_t intdec)
 
void formatFIRCoefficients (std::ostringstream &str, uint32_t nbTaps, double normalizedBW)
 
void getXO ()
 

Private Attributes

struct iio_context * m_ctx
 
struct iio_device * m_devPhy
 
struct iio_device * m_devRx
 
struct iio_device * m_devTx
 
struct iio_channel * m_chnRx0
 
struct iio_channel * m_chnTx0i
 
struct iio_channel * m_chnTx0q
 
struct iio_buffer * m_rxBuf
 
struct iio_buffer * m_txBuf
 
bool m_valid
 
int64_t m_xoInitial
 
float m_temp
 

Detailed Description

Definition at line 33 of file deviceplutosdrbox.h.

Member Enumeration Documentation

◆ DeviceType

Enumerator
DEVICE_PHY 
DEVICE_RX 
DEVICE_TX 

Definition at line 36 of file deviceplutosdrbox.h.

◆ DeviceUse

Enumerator
USE_RX 
USE_TX 

Definition at line 43 of file deviceplutosdrbox.h.

Constructor & Destructor Documentation

◆ DevicePlutoSDRBox()

DevicePlutoSDRBox::DevicePlutoSDRBox ( const std::string &  uri)

Definition at line 31 of file deviceplutosdrbox.cpp.

References getXO(), m_ctx, m_devPhy, m_devRx, m_devTx, and m_valid.

31  :
32  m_devSampleRate(0),
33  m_LOppmTenths(0),
34  m_lpfFIREnable(false),
35  m_lpfFIRBW(100.0f),
37  m_lpfFIRRxGain(0),
38  m_lpfFIRTxGain(0),
39  m_ctx(0),
40  m_devPhy(0),
41  m_devRx(0),
42  m_devTx(0),
43  m_chnRx0(0),
44  m_chnTx0i(0),
45  m_chnTx0q(0),
46  m_rxBuf(0),
47  m_txBuf(0),
48  m_xoInitial(0),
49  m_temp(0.0f)
50 {
51  m_ctx = iio_create_context_from_uri(uri.c_str());
52 
53  if (m_ctx)
54  {
55  m_devPhy = iio_context_find_device(m_ctx, "ad9361-phy");
56  m_devRx = iio_context_find_device(m_ctx, "cf-ad9361-lpc");
57  m_devTx = iio_context_find_device(m_ctx, "cf-ad9361-dds-core-lpc");
58  }
59 
61 
62  if (m_valid) {
63  getXO();
64 // int nb_channels = iio_device_get_channels_count(m_devRx);
65 // for (int i = 0; i < nb_channels; i++) {
66 // iio_channel_disable(iio_device_get_channel(m_devRx, i));
67 // }
68 // nb_channels = iio_device_get_channels_count(m_devTx);
69 // for (int i = 0; i < nb_channels; i++) {
70 // iio_channel_disable(iio_device_get_channel(m_devTx, i));
71 // }
72  }
73 }
struct iio_device * m_devTx
uint32_t m_lpfFIRlog2Decim
digital lowpass FIR filter log2 of decimation factor (0..2)
float m_lpfFIRBW
digital lowpass FIR filter bandwidth (Hz)
struct iio_channel * m_chnTx0i
struct iio_buffer * m_txBuf
bool m_lpfFIREnable
enable digital lowpass FIR filter
struct iio_context * m_ctx
uint64_t m_devSampleRate
Host interface sample rate.
struct iio_device * m_devPhy
struct iio_buffer * m_rxBuf
int32_t m_LOppmTenths
XO correction.
struct iio_device * m_devRx
int m_lpfFIRRxGain
digital lowpass FIR filter gain Rx side (dB)
struct iio_channel * m_chnTx0q
struct iio_channel * m_chnRx0
int m_lpfFIRTxGain
digital lowpass FIR filter gain Tx side (dB)
+ Here is the call graph for this function:

◆ ~DevicePlutoSDRBox()

DevicePlutoSDRBox::~DevicePlutoSDRBox ( )

Definition at line 75 of file deviceplutosdrbox.cpp.

References closeRx(), closeTx(), deleteRxBuffer(), deleteTxBuffer(), and m_ctx.

76 {
79  closeRx();
80  closeTx();
81  if (m_ctx) { iio_context_destroy(m_ctx); }
82 }
struct iio_context * m_ctx
+ Here is the call graph for this function:

Member Function Documentation

◆ closeRx()

void DevicePlutoSDRBox::closeRx ( )

Definition at line 328 of file deviceplutosdrbox.cpp.

References m_chnRx0.

Referenced by ~DevicePlutoSDRBox().

329 {
330  if (m_chnRx0) { iio_channel_disable(m_chnRx0); }
331 }
struct iio_channel * m_chnRx0
+ Here is the caller graph for this function:

◆ closeTx()

void DevicePlutoSDRBox::closeTx ( )

Definition at line 333 of file deviceplutosdrbox.cpp.

References m_chnTx0i, and m_chnTx0q.

Referenced by ~DevicePlutoSDRBox().

334 {
335  if (m_chnTx0i) { iio_channel_disable(m_chnTx0i); }
336  if (m_chnTx0q) { iio_channel_disable(m_chnTx0q); }
337 }
struct iio_channel * m_chnTx0i
struct iio_channel * m_chnTx0q
+ Here is the caller graph for this function:

◆ createRxBuffer()

struct iio_buffer * DevicePlutoSDRBox::createRxBuffer ( unsigned int  size,
bool  cyclic 
)

Definition at line 339 of file deviceplutosdrbox.cpp.

References m_devRx, and m_rxBuf.

Referenced by PlutoSDRInput::openDevice().

340 {
341  if (m_devRx) {
342  m_rxBuf = iio_device_create_buffer(m_devRx, size, cyclic ? '\1' : '\0');
343  } else {
344  m_rxBuf = 0;
345  }
346 
347  return m_rxBuf;
348 }
struct iio_buffer * m_rxBuf
struct iio_device * m_devRx
+ Here is the caller graph for this function:

◆ createTxBuffer()

struct iio_buffer * DevicePlutoSDRBox::createTxBuffer ( unsigned int  size,
bool  cyclic 
)

Definition at line 350 of file deviceplutosdrbox.cpp.

References m_devTx, and m_txBuf.

Referenced by PlutoSDROutput::openDevice().

351 {
352  if (m_devTx) {
353  m_txBuf = iio_device_create_buffer(m_devTx, size, cyclic ? '\1' : '\0');
354  } else {
355  m_txBuf = 0;
356  }
357 
358  return m_txBuf;
359 }
struct iio_device * m_devTx
struct iio_buffer * m_txBuf
+ Here is the caller graph for this function:

◆ deleteRxBuffer()

void DevicePlutoSDRBox::deleteRxBuffer ( )

Definition at line 361 of file deviceplutosdrbox.cpp.

References m_rxBuf.

Referenced by ~DevicePlutoSDRBox().

362 {
363  if (m_rxBuf) {
364  iio_buffer_destroy(m_rxBuf);
365  m_rxBuf = 0;
366  }
367 }
struct iio_buffer * m_rxBuf
+ Here is the caller graph for this function:

◆ deleteTxBuffer()

void DevicePlutoSDRBox::deleteTxBuffer ( )

Definition at line 369 of file deviceplutosdrbox.cpp.

References m_txBuf.

Referenced by ~DevicePlutoSDRBox().

370 {
371  if (m_txBuf) {
372  iio_buffer_destroy(m_txBuf);
373  m_txBuf = 0;
374  }
375 }
struct iio_buffer * m_txBuf
+ Here is the caller graph for this function:

◆ fetchTemp()

bool DevicePlutoSDRBox::fetchTemp ( )

Definition at line 801 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, get_param(), and m_temp.

Referenced by PlutoSDROutput::fetchTemperature(), and PlutoSDRInput::fetchTemperature().

802 {
803  std::string temp_mC_str;
804 
805  if (get_param(DEVICE_PHY, "in_temp0_input", temp_mC_str))
806  {
807  try
808  {
809  uint32_t temp_mC = boost::lexical_cast<uint32_t>(temp_mC_str);
810  m_temp = temp_mC / 1000.0;
811  return true;
812  }
813  catch (const boost::bad_lexical_cast &e)
814  {
815  std::cerr << "PlutoSDRDevice::getTemp: bad conversion to numeric" << std::endl;
816  return false;
817  }
818  }
819  else
820  {
821  return false;
822  }
823 }
bool get_param(DeviceType devType, const std::string &param, std::string &value)
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatFIRCoefficients()

void DevicePlutoSDRBox::formatFIRCoefficients ( std::ostringstream &  str,
uint32_t  nbTaps,
double  normalizedBW 
)
private

Definition at line 642 of file deviceplutosdrbox.cpp.

References WFIR::BasicFIR(), i, WFIR::LPF, WFIR::wtBLACKMAN_HARRIS, and WFIR::wtHAMMING.

Referenced by setFIR().

643 {
644  double *fcoeffs = new double[nbTaps];
645  WFIR::BasicFIR(fcoeffs, nbTaps, WFIR::LPF, normalizedBW, 0.0, normalizedBW < 0.2 ? WFIR::wtHAMMING : WFIR::wtBLACKMAN_HARRIS, 0.0);
646 
647  for (unsigned int i = 0; i < nbTaps; i++) {
648  ostr << (int16_t) (fcoeffs[i] * 32768.0f) << ", " << (int16_t) (fcoeffs[i] * 32768.0f) << std::endl;
649  }
650 
651  delete[] fcoeffs;
652 }
short int16_t
Definition: rtptypes_win.h:43
Definition: wfir.h:63
int32_t i
Definition: decimators.h:244
static void BasicFIR(double *FirCoeff, int NumTaps, TPassTypeName PassType, double OmegaC, double BW, TWindowType WindowType, double WinBeta)
Definition: wfir.cpp:19
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatFIRHeader()

void DevicePlutoSDRBox::formatFIRHeader ( std::ostringstream &  str,
uint32_t  intdec 
)
private

Definition at line 636 of file deviceplutosdrbox.cpp.

References m_lpfFIRRxGain, and m_lpfFIRTxGain.

Referenced by setFIR().

637 {
638  ostr << "RX 3 GAIN " << m_lpfFIRRxGain << " DEC " << intdec << std::endl;
639  ostr << "TX 3 GAIN " << m_lpfFIRTxGain << " INT " << intdec << std::endl;
640 }
int m_lpfFIRRxGain
digital lowpass FIR filter gain Rx side (dB)
int m_lpfFIRTxGain
digital lowpass FIR filter gain Tx side (dB)
+ Here is the caller graph for this function:

◆ get_param()

bool DevicePlutoSDRBox::get_param ( DeviceType  devType,
const std::string &  param,
std::string &  value 
)

Definition at line 188 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, DEVICE_RX, DEVICE_TX, m_devPhy, m_devRx, and m_devTx.

Referenced by fetchTemp(), getbbLPRxRange(), getbbLPTxRange(), getRateGovernors(), getRxGain(), getRxLORange(), getRxRSSI(), getRxSampleRates(), getTxLORange(), getTxRSSI(), getTxSampleRates(), and getXO().

189 {
190  struct iio_channel *chn = 0;
191  const char *attr = 0;
192  char valuestr[256];
193  int ret;
194  ssize_t nchars;
195  iio_device *dev;
196 
197  switch (devType)
198  {
199  case DEVICE_PHY:
200  dev = m_devPhy;
201  break;
202  case DEVICE_RX:
203  dev = m_devRx;
204  break;
205  case DEVICE_TX:
206  dev = m_devTx;
207  break;
208  default:
209  dev = m_devPhy;
210  break;
211  }
212 
213  ret = iio_device_identify_filename(dev, param.c_str(), &chn, &attr);
214 
215  if (ret)
216  {
217  std::cerr << "DevicePlutoSDRBox::get_param: Parameter not recognized: " << param << std::endl;
218  return false;
219  }
220 
221  if (chn) {
222  nchars = iio_channel_attr_read(chn, attr, valuestr, 256);
223  } else if (iio_device_find_attr(dev, attr)) {
224  nchars = iio_device_attr_read(dev, attr, valuestr, 256);
225  } else {
226  nchars = iio_device_debug_attr_read(dev, attr, valuestr, 256);
227  }
228 
229  if (nchars < 0)
230  {
231  std::cerr << "DevicePlutoSDRBox::get_param: Unable to read attribute " << param << ": " << nchars << std::endl;
232  return false;
233  }
234  else
235  {
236  value.assign(valuestr);
237  return true;
238  }
239 }
struct iio_device * m_devTx
struct iio_device * m_devPhy
struct iio_device * m_devRx
+ Here is the caller graph for this function:

◆ getbbLPRxRange()

void DevicePlutoSDRBox::getbbLPRxRange ( uint32_t minLimit,
uint32_t maxLimit 
)

Definition at line 758 of file deviceplutosdrbox.cpp.

References DevicePlutoSDR::bbLPRxHighLimitFreq, DevicePlutoSDR::bbLPRxLowLimitFreq, DEVICE_PHY, and get_param().

Referenced by PlutoSDRInput::getbbLPRange().

759 {
760  // values are returned in Hz of RF (complex channel) bandwidth
761  qint32 stepLimit;
762  std::string rangeStr;
763 
764  char buff[50];
765  snprintf(buff, sizeof(buff), "in_voltage_rf_bandwidth_available");
766 
767  if (get_param(DEVICE_PHY, buff, rangeStr))
768  {
769  std::istringstream instream(rangeStr.substr(1, rangeStr.size() - 2));
770  instream >> minLimit >> stepLimit >> maxLimit;
771  }
772  else
773  {
776  }
777 }
static const uint32_t bbLPRxLowLimitFreq
Analog base band Rx low pass filter lower frequency limit (Hz)
bool get_param(DeviceType devType, const std::string &param, std::string &value)
static const uint32_t bbLPRxHighLimitFreq
Analog base band Rx high pass filter lower frequency limit (Hz)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getbbLPTxRange()

void DevicePlutoSDRBox::getbbLPTxRange ( uint32_t minLimit,
uint32_t maxLimit 
)

Definition at line 779 of file deviceplutosdrbox.cpp.

References DevicePlutoSDR::bbLPTxHighLimitFreq, DevicePlutoSDR::bbLPTxLowLimitFreq, DEVICE_PHY, and get_param().

Referenced by PlutoSDROutput::getbbLPRange().

780 {
781  // values are returned in Hz
782  qint32 stepLimit;
783  std::string rangeStr;
784 
785  char buff[50];
786  snprintf(buff, sizeof(buff), "out_voltage_rf_bandwidth_available");
787 
788  if (get_param(DEVICE_PHY, buff, rangeStr))
789  {
790  std::istringstream instream(rangeStr.substr(1, rangeStr.size() - 2));
791  instream >> minLimit >> stepLimit >> maxLimit;
792  }
793  else
794  {
797  }
798 }
static const uint32_t bbLPTxHighLimitFreq
Analog base band Tx high pass filter lower frequency limit (Hz)
bool get_param(DeviceType devType, const std::string &param, std::string &value)
static const uint32_t bbLPTxLowLimitFreq
Analog base band Tx low pass filter lower frequency limit (Hz)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRateGovernors()

bool DevicePlutoSDRBox::getRateGovernors ( std::string &  rateGovernors)

Definition at line 825 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, and get_param().

826 {
827  return get_param(DEVICE_PHY, "trx_rate_governor", rateGovernors);
828 }
bool get_param(DeviceType devType, const std::string &param, std::string &value)
+ Here is the call graph for this function:

◆ getRxChannel0()

struct iio_channel* DevicePlutoSDRBox::getRxChannel0 ( )
inline

Definition at line 88 of file deviceplutosdrbox.h.

88 { return m_chnRx0; }
struct iio_channel * m_chnRx0

◆ getRxGain()

bool DevicePlutoSDRBox::getRxGain ( int &  gaindB,
unsigned int  chan 
)

Definition at line 669 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, and get_param().

Referenced by PlutoSDRInput::getGain().

670 {
671  chan = chan % 2;
672  char buff[30];
673  snprintf(buff, sizeof(buff), "in_voltage%d_hardwaregain", chan);
674  std::string gainStr;
675  get_param(DEVICE_PHY, buff, gainStr);
676 
677  std::regex gain_regex("(.+)\\.(.+) dB");
678  std::smatch gain_match;
679  std::regex_search(gainStr, gain_match, gain_regex);
680 
681  if (gain_match.size() == 3)
682  {
683  try
684  {
685  gaindB = boost::lexical_cast<int>(gain_match[1]);
686  return true;
687  }
688  catch (const boost::bad_lexical_cast &e)
689  {
690  qWarning("DevicePlutoSDRBox::getRxGain: bad conversion to numeric");
691  return false;
692  }
693  }
694  else
695  {
696  return false;
697  }
698 }
bool get_param(DeviceType devType, const std::string &param, std::string &value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRxLORange()

void DevicePlutoSDRBox::getRxLORange ( uint64_t minLimit,
uint64_t maxLimit 
)

Definition at line 716 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, get_param(), DevicePlutoSDR::rxLOHighLimitFreq, and DevicePlutoSDR::rxLOLowLimitFreq.

Referenced by PlutoSDRInput::getLORange().

717 {
718  // values are returned in Hz
719  qint64 stepLimit;
720  std::string rangeStr;
721 
722  char buff[50];
723  snprintf(buff, sizeof(buff), "out_altvoltage0_RX_LO_frequency_available");
724 
725  if (get_param(DEVICE_PHY, buff, rangeStr))
726  {
727  std::istringstream instream(rangeStr.substr(1, rangeStr.size() - 2));
728  instream >> minLimit >> stepLimit >> maxLimit;
729  }
730  else
731  {
734  }
735 }
static const uint64_t rxLOLowLimitFreq
Rx LO hard coded lower frequency limit (Hz)
bool get_param(DeviceType devType, const std::string &param, std::string &value)
static const uint64_t rxLOHighLimitFreq
Rx LO hard coded lower frequency limit (Hz)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRxRSSI()

bool DevicePlutoSDRBox::getRxRSSI ( std::string &  rssiStr,
unsigned int  chan 
)

Definition at line 700 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, and get_param().

Referenced by PlutoSDRInput::getRSSI().

701 {
702  chan = chan % 2;
703  char buff[20];
704  snprintf(buff, sizeof(buff), "in_voltage%d_rssi", chan);
705  return get_param(DEVICE_PHY, buff, rssiStr);
706 }
bool get_param(DeviceType devType, const std::string &param, std::string &value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRxSampleRates()

bool DevicePlutoSDRBox::getRxSampleRates ( SampleRates sampleRates)

Definition at line 477 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, get_param(), and parseSampleRates().

Referenced by PlutoSDRInput::applySettings(), and setFIR().

478 {
479  std::string srStr;
480 
481  if (get_param(DEVICE_PHY, "rx_path_rates", srStr)) {
482  qDebug("DevicePlutoSDRBox::getRxSampleRates: %s", srStr.c_str());
483  return parseSampleRates(srStr, sampleRates);
484  } else {
485  return false;
486  }
487 }
bool parseSampleRates(const std::string &rateStr, SampleRates &sampleRates)
bool get_param(DeviceType devType, const std::string &param, std::string &value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRxSampleSize()

ssize_t DevicePlutoSDRBox::getRxSampleSize ( )

Definition at line 377 of file deviceplutosdrbox.cpp.

References m_devRx.

Referenced by PlutoSDROutputThread::run(), and PlutoSDRInputThread::run().

378 {
379  if (m_devRx) {
380  return iio_device_get_sample_size(m_devRx);
381  } else {
382  return 0;
383  }
384 }
struct iio_device * m_devRx
+ Here is the caller graph for this function:

◆ getTemp()

float DevicePlutoSDRBox::getTemp ( ) const
inline

Definition at line 114 of file deviceplutosdrbox.h.

Referenced by PlutoSDROutput::getTemperature(), and PlutoSDRInput::getTemperature().

114 { return m_temp; }
+ Here is the caller graph for this function:

◆ getTxChannel0I()

struct iio_channel* DevicePlutoSDRBox::getTxChannel0I ( )
inline

Definition at line 89 of file deviceplutosdrbox.h.

89 { return m_chnTx0i; }
struct iio_channel * m_chnTx0i

◆ getTxChannel0Q()

struct iio_channel* DevicePlutoSDRBox::getTxChannel0Q ( )
inline

Definition at line 90 of file deviceplutosdrbox.h.

90 { return m_chnTx0q; }
struct iio_channel * m_chnTx0q

◆ getTxLORange()

void DevicePlutoSDRBox::getTxLORange ( uint64_t minLimit,
uint64_t maxLimit 
)

Definition at line 737 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, get_param(), DevicePlutoSDR::txLOHighLimitFreq, and DevicePlutoSDR::txLOLowLimitFreq.

Referenced by PlutoSDROutput::getLORange().

738 {
739  // values are returned in Hz
740  qint64 stepLimit;
741  std::string rangeStr;
742 
743  char buff[50];
744  snprintf(buff, sizeof(buff), "out_altvoltage1_TX_LO_frequency_available");
745 
746  if (get_param(DEVICE_PHY, buff, rangeStr))
747  {
748  std::istringstream instream(rangeStr.substr(1, rangeStr.size() - 2));
749  instream >> minLimit >> stepLimit >> maxLimit;
750  }
751  else
752  {
755  }
756 }
bool get_param(DeviceType devType, const std::string &param, std::string &value)
static const uint64_t txLOLowLimitFreq
Tx LO hard coded lower frequency limit (Hz)
static const uint64_t txLOHighLimitFreq
Tx LO hard coded lower frequency limit (Hz)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTxRSSI()

bool DevicePlutoSDRBox::getTxRSSI ( std::string &  rssiStr,
unsigned int  chan 
)

Definition at line 708 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, and get_param().

Referenced by PlutoSDROutput::getRSSI().

709 {
710  chan = chan % 2;
711  char buff[20];
712  snprintf(buff, sizeof(buff), "out_voltage%d_rssi", chan);
713  return get_param(DEVICE_PHY, buff, rssiStr);
714 }
bool get_param(DeviceType devType, const std::string &param, std::string &value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTxSampleRates()

bool DevicePlutoSDRBox::getTxSampleRates ( SampleRates sampleRates)

Definition at line 489 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, get_param(), and parseSampleRates().

Referenced by PlutoSDROutput::applySettings().

490 {
491  std::string srStr;
492 
493  if (get_param(DEVICE_PHY, "tx_path_rates", srStr)) {
494  return parseSampleRates(srStr, sampleRates);
495  } else {
496  return false;
497  }
498 }
bool parseSampleRates(const std::string &rateStr, SampleRates &sampleRates)
bool get_param(DeviceType devType, const std::string &param, std::string &value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTxSampleSize()

ssize_t DevicePlutoSDRBox::getTxSampleSize ( )

Definition at line 386 of file deviceplutosdrbox.cpp.

References m_devTx.

Referenced by PlutoSDROutputThread::run(), and PlutoSDRInputThread::run().

387 {
388  if (m_devTx) {
389  return iio_device_get_sample_size(m_devTx);
390  } else {
391  return 0;
392  }
393 }
struct iio_device * m_devTx
+ Here is the caller graph for this function:

◆ getXO()

void DevicePlutoSDRBox::getXO ( )
private

Definition at line 654 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, get_param(), and m_xoInitial.

Referenced by DevicePlutoSDRBox().

655 {
656  std::string valueStr;
657  get_param(DEVICE_PHY, "xo_correction", valueStr);
658  try
659  {
660  m_xoInitial = boost::lexical_cast<quint64>(valueStr);
661  qDebug("DevicePlutoSDRBox::getXO: %ld", m_xoInitial);
662  }
663  catch (const boost::bad_lexical_cast &e)
664  {
665  qWarning("DevicePlutoSDRBox::getXO: cannot get initial XO correction");
666  }
667 }
bool get_param(DeviceType devType, const std::string &param, std::string &value)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValid()

bool DevicePlutoSDRBox::isValid ( ) const
inline

Definition at line 73 of file deviceplutosdrbox.h.

73 { return m_valid; }

◆ openRx()

bool DevicePlutoSDRBox::openRx ( )

Definition at line 253 of file deviceplutosdrbox.cpp.

References m_chnRx0, m_devRx, and m_valid.

Referenced by PlutoSDRInput::openDevice().

254 {
255  if (!m_valid) { return false; }
256 
257  if (!m_chnRx0) {
258  m_chnRx0 = iio_device_find_channel(m_devRx, "voltage0", false);
259  }
260 
261  if (m_chnRx0) {
262  iio_channel_enable(m_chnRx0);
263  const struct iio_data_format *df = iio_channel_get_data_format(m_chnRx0);
264  qDebug("DevicePlutoSDRBox::openRx: length: %u bits: %u shift: %u signed: %s be: %s with_scale: %s scale: %lf repeat: %u",
265  df->length,
266  df->bits,
267  df->shift,
268  df->is_signed ? "true" : "false",
269  df->is_be ? "true" : "false",
270  df->with_scale? "true" : "false",
271  df->scale,
272  df->repeat);
273  return true;
274  } else {
275  std::cerr << "DevicePlutoSDRBox::openRx: failed" << std::endl;
276  return false;
277  }
278 }
struct iio_device * m_devRx
struct iio_channel * m_chnRx0
+ Here is the caller graph for this function:

◆ openTx()

bool DevicePlutoSDRBox::openTx ( )

Definition at line 280 of file deviceplutosdrbox.cpp.

References m_chnTx0i, m_chnTx0q, m_devTx, and m_valid.

Referenced by PlutoSDROutput::openDevice().

281 {
282  if (!m_valid) { return false; }
283 
284  if (!m_chnTx0i) {
285  m_chnTx0i = iio_device_find_channel(m_devTx, "voltage0", true);
286  }
287 
288  if (m_chnTx0i) {
289  iio_channel_enable(m_chnTx0i);
290  const struct iio_data_format *df = iio_channel_get_data_format(m_chnTx0i);
291  qDebug("DevicePlutoSDRBox::openTx: channel I: length: %u bits: %u shift: %u signed: %s be: %s with_scale: %s scale: %lf repeat: %u",
292  df->length,
293  df->bits,
294  df->shift,
295  df->is_signed ? "true" : "false",
296  df->is_be ? "true" : "false",
297  df->with_scale? "true" : "false",
298  df->scale,
299  df->repeat);
300  } else {
301  std::cerr << "DevicePlutoSDRBox::openTx: failed to open I channel" << std::endl;
302  return false;
303  }
304 
305  if (!m_chnTx0q) {
306  m_chnTx0q = iio_device_find_channel(m_devTx, "voltage1", true);
307  }
308 
309  if (m_chnTx0q) {
310  iio_channel_enable(m_chnTx0q);
311  const struct iio_data_format *df = iio_channel_get_data_format(m_chnTx0q);
312  qDebug("DevicePlutoSDRBox::openTx: channel Q: length: %u bits: %u shift: %u signed: %s be: %s with_scale: %s scale: %lf repeat: %u",
313  df->length,
314  df->bits,
315  df->shift,
316  df->is_signed ? "true" : "false",
317  df->is_be ? "true" : "false",
318  df->with_scale? "true" : "false",
319  df->scale,
320  df->repeat);
321  return true;
322  } else {
323  std::cerr << "DevicePlutoSDRBox::openTx: failed to open Q channel" << std::endl;
324  return false;
325  }
326 }
struct iio_device * m_devTx
struct iio_channel * m_chnTx0i
struct iio_channel * m_chnTx0q
+ Here is the caller graph for this function:

◆ parseSampleRates()

bool DevicePlutoSDRBox::parseSampleRates ( const std::string &  rateStr,
SampleRates sampleRates 
)
private

Definition at line 500 of file deviceplutosdrbox.cpp.

References DevicePlutoSDRBox::SampleRates::m_addaConnvRate, DevicePlutoSDRBox::SampleRates::m_bbRateHz, DevicePlutoSDRBox::SampleRates::m_firRate, DevicePlutoSDRBox::SampleRates::m_hb1Rate, DevicePlutoSDRBox::SampleRates::m_hb2Rate, and DevicePlutoSDRBox::SampleRates::m_hb3Rate.

Referenced by getRxSampleRates(), and getTxSampleRates().

501 {
502  // Rx: "BBPLL:983040000 ADC:245760000 R2:122880000 R1:61440000 RF:30720000 RXSAMP:30720000"
503  // Tx: "BBPLL:983040000 DAC:122880000 T2:122880000 T1:61440000 TF:30720000 TXSAMP:30720000"
504  std::regex desc_regex("BBPLL:(.+) ..C:(.+) .2:(.+) .1:(.+) .F:(.+) .XSAMP:(.+)");
505  std::smatch desc_match;
506  std::regex_search(rateStr, desc_match, desc_regex);
507  std::string valueStr;
508 
509  if (desc_match.size() == 7)
510  {
511  try
512  {
513  sampleRates.m_bbRateHz = boost::lexical_cast<uint32_t>(desc_match[1]);
514  sampleRates.m_addaConnvRate = boost::lexical_cast<uint32_t>(desc_match[2]);
515  sampleRates.m_hb3Rate = boost::lexical_cast<uint32_t>(desc_match[3]);
516  sampleRates.m_hb2Rate = boost::lexical_cast<uint32_t>(desc_match[4]);
517  sampleRates.m_hb1Rate = boost::lexical_cast<uint32_t>(desc_match[5]);
518  sampleRates.m_firRate = boost::lexical_cast<uint32_t>(desc_match[6]);
519  return true;
520  }
521  catch (const boost::bad_lexical_cast &e)
522  {
523  qWarning("DevicePlutoSDRBox::parseSampleRates: bad conversion to numeric");
524  return false;
525  }
526  }
527  else
528  {
529  return false;
530  }
531 }
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the caller graph for this function:

◆ probeURI()

bool DevicePlutoSDRBox::probeURI ( const std::string &  uri)
static

Definition at line 84 of file deviceplutosdrbox.cpp.

Referenced by DevicePlutoSDRScan::scan().

85 {
86  bool retVal;
87  struct iio_context *ctx;
88 
89  ctx = iio_create_context_from_uri(uri.c_str());
90  retVal = (ctx != 0);
91 
92  if (ctx) {
93  iio_context_destroy(ctx);
94  }
95 
96  return retVal;
97 }
+ Here is the caller graph for this function:

◆ rxBufferEnd()

char * DevicePlutoSDRBox::rxBufferEnd ( )

Definition at line 422 of file deviceplutosdrbox.cpp.

References m_rxBuf.

Referenced by PlutoSDRInputThread::run().

423 {
424  if (m_rxBuf) {
425  return (char *) iio_buffer_end(m_rxBuf);
426  } else {
427  return 0;
428  }
429 }
struct iio_buffer * m_rxBuf
+ Here is the caller graph for this function:

◆ rxBufferFirst()

char * DevicePlutoSDRBox::rxBufferFirst ( )

Definition at line 431 of file deviceplutosdrbox.cpp.

References m_chnRx0, and m_rxBuf.

Referenced by PlutoSDRInputThread::run().

432 {
433  if (m_rxBuf) {
434  return (char *) iio_buffer_first(m_rxBuf, m_chnRx0);
435  } else {
436  return 0;
437  }
438 }
struct iio_buffer * m_rxBuf
struct iio_channel * m_chnRx0
+ Here is the caller graph for this function:

◆ rxBufferRefill()

ssize_t DevicePlutoSDRBox::rxBufferRefill ( )

Definition at line 395 of file deviceplutosdrbox.cpp.

References m_rxBuf.

Referenced by PlutoSDRInputThread::run().

396 {
397  if (m_rxBuf) {
398  return iio_buffer_refill(m_rxBuf);
399  } else {
400  return 0;
401  }
402 }
struct iio_buffer * m_rxBuf
+ Here is the caller graph for this function:

◆ rxBufferStep()

std::ptrdiff_t DevicePlutoSDRBox::rxBufferStep ( )

Definition at line 413 of file deviceplutosdrbox.cpp.

References m_rxBuf.

Referenced by PlutoSDRInputThread::run().

414 {
415  if (m_rxBuf) {
416  return iio_buffer_step(m_rxBuf);
417  } else {
418  return 0;
419  }
420 }
struct iio_buffer * m_rxBuf
+ Here is the caller graph for this function:

◆ set_params()

void DevicePlutoSDRBox::set_params ( DeviceType  devType,
const std::vector< std::string > &  params 
)

Definition at line 99 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, DEVICE_RX, DEVICE_TX, m_devPhy, m_devRx, and m_devTx.

Referenced by PlutoSDROutput::applySettings(), PlutoSDRInput::applySettings(), setFIREnable(), setLOPPMTenths(), and setSampleRate().

101 {
102  iio_device *dev;
103 
104  switch (devType)
105  {
106  case DEVICE_PHY:
107  dev = m_devPhy;
108  break;
109  case DEVICE_RX:
110  dev = m_devRx;
111  break;
112  case DEVICE_TX:
113  dev = m_devTx;
114  break;
115  default:
116  dev = m_devPhy;
117  break;
118  }
119 
120  for (std::vector<std::string>::const_iterator it = params.begin(); it != params.end(); ++it)
121  {
122  struct iio_channel *chn = 0;
123  const char *attr = 0;
124  std::size_t pos;
125  int ret;
126  int type;
127 
128  pos = it->find('=');
129 
130  if (pos == std::string::npos)
131  {
132  std::cerr << "DevicePlutoSDRBox::set_params: Misformed line: " << *it << std::endl;
133  continue;
134  }
135 
136  std::string key = it->substr(0, pos);
137  std::string val = it->substr(pos + 1, std::string::npos);
138 
139  ret = iio_device_identify_filename(dev, key.c_str(), &chn, &attr);
140 
141  if (ret)
142  {
143  std::cerr << "DevicePlutoSDRBox::set_params: Parameter not recognized: " << key << std::endl;
144  continue;
145  }
146 
147  if (chn) {
148  ret = iio_channel_attr_write(chn, attr, val.c_str());
149  type = 0;
150  } else if (iio_device_find_attr(dev, attr)) {
151  ret = iio_device_attr_write(dev, attr, val.c_str());
152  type = 1;
153  } else {
154  ret = iio_device_debug_attr_write(dev, attr, val.c_str());
155  type = 2;
156  }
157 
158  if (ret < 0)
159  {
160  std::string item;
161  char errstr[256];
162 
163  switch (type)
164  {
165  case 0:
166  item = "channel";
167  break;
168  case 1:
169  item = "device";
170  break;
171  case 2:
172  item = "debug";
173  break;
174  default:
175  item = "unknown";
176  break;
177  }
178  iio_strerror(-ret, errstr, 255);
179  std::cerr << "DevicePlutoSDRBox::set_params: Unable to write " << item << " attribute " << key << "=" << val << ": " << errstr << " (" << ret << ") " << std::endl;
180  }
181  else
182  {
183  std::cerr << "DevicePlutoSDRBox::set_params: set attribute " << key << "=" << val << ": " << ret << std::endl;
184  }
185  }
186 }
struct iio_device * m_devTx
struct iio_device * m_devPhy
struct iio_device * m_devRx
+ Here is the caller graph for this function:

◆ setFilter()

void DevicePlutoSDRBox::setFilter ( const std::string &  filterConfigStr)
private

Definition at line 241 of file deviceplutosdrbox.cpp.

References m_devPhy.

Referenced by setFIR().

242 {
243  int ret;
244 
245  ret = iio_device_attr_write_raw(m_devPhy, "filter_fir_config", filterConfigStr.c_str(), filterConfigStr.size());
246 
247  if (ret < 0)
248  {
249  std::cerr << "DevicePlutoSDRBox::set_filter: Unable to set: " << filterConfigStr << ": " << ret << std::endl;
250  }
251 }
struct iio_device * m_devPhy
+ Here is the caller graph for this function:

◆ setFIR()

void DevicePlutoSDRBox::setFIR ( uint32_t  sampleRate,
uint32_t  log2IntDec,
DeviceUse  use,
uint32_t  bw,
int  gain 
)
Parameters
sampleRatebaseband sample rate (S/s)
log2IntDecFIR interpolation or decimation factor
useRx or Tx. Applies to the rest of the parameters
bwFIR filter bandwidth at approximately -6 dB cutoff (Hz)
gainFIR filter gain (dB)

Definition at line 552 of file deviceplutosdrbox.cpp.

References DevicePlutoSDR::firBWHighLimitFactor, DevicePlutoSDR::firBWLowLimitFactor, formatFIRCoefficients(), formatFIRHeader(), getRxSampleRates(), DevicePlutoSDRBox::SampleRates::m_addaConnvRate, DevicePlutoSDRBox::SampleRates::m_hb1Rate, m_lpfFIRBW, m_lpfFIRlog2Decim, m_lpfFIRRxGain, m_lpfFIRTxGain, setFilter(), setFIREnable(), setSampleRate(), and USE_RX.

Referenced by PlutoSDROutput::applySettings(), and PlutoSDRInput::applySettings().

553 {
554  SampleRates sampleRates;
555  std::ostringstream ostr;
556 
557  uint32_t nbTaps;
558  double normalizedBW;
559  uint32_t intdec = 1<<(log2IntDec > 2 ? 2 : log2IntDec);
560 
561  // update gain parameter
562 
563  if (use == USE_RX) {
564  m_lpfFIRRxGain = gain;
565  } else {
566  m_lpfFIRTxGain = gain;
567  }
568 
569  // set a dummy minimal filter first to get the sample rates right
570 
571  setFIREnable(false); // disable first
572 
573  formatFIRHeader(ostr, intdec);
574  formatFIRCoefficients(ostr, 16, 0.5);
575  setFilter(ostr.str());
576  ostr.str(""); // reset string stream
577 
578  setFIREnable(true); // re-enable
579  setSampleRate(sampleRate); // set to new sample rate
580 
581  if (!getRxSampleRates(sampleRates)) {
582  return;
583  }
584 
585  setFIREnable(false); // disable again
586 
587  uint32_t nbGroups = sampleRates.m_addaConnvRate / 16;
588  nbTaps = nbGroups*8 > 128 ? 128 : nbGroups*8;
589  nbTaps = intdec == 1 ? (nbTaps > 64 ? 64 : nbTaps) : nbTaps;
590  normalizedBW = ((float) bw) / sampleRates.m_hb1Rate;
591  normalizedBW = normalizedBW < DevicePlutoSDR::firBWLowLimitFactor ?
594 
595  qDebug("DevicePlutoSDRBox::setFIR: intdec: %u gain: %d nbTaps: %u BWin: %u BW: %f (%f)",
596  intdec,
597  gain,
598  nbTaps,
599  bw,
600  normalizedBW*sampleRates.m_hb1Rate,
601  normalizedBW);
602 
603  // set the right filter
604 
605  formatFIRHeader(ostr, intdec);
606  formatFIRCoefficients(ostr, nbTaps, normalizedBW);
607  setFilter(ostr.str());
608 
609  m_lpfFIRlog2Decim = log2IntDec;
610  m_lpfFIRBW = bw;
611 
612  // enable and set sample rate will be done by the caller
613 }
void setSampleRate(uint32_t sampleRate)
static const float firBWHighLimitFactor
Factor by which the FIR working sample rate is multiplied to yield bandwidth higher limit...
uint32_t m_lpfFIRlog2Decim
digital lowpass FIR filter log2 of decimation factor (0..2)
float m_lpfFIRBW
digital lowpass FIR filter bandwidth (Hz)
void setFilter(const std::string &filterConfigStr)
unsigned int uint32_t
Definition: rtptypes_win.h:46
void setFIREnable(bool enable)
bool getRxSampleRates(SampleRates &sampleRates)
void formatFIRHeader(std::ostringstream &str, uint32_t intdec)
void formatFIRCoefficients(std::ostringstream &str, uint32_t nbTaps, double normalizedBW)
int m_lpfFIRRxGain
digital lowpass FIR filter gain Rx side (dB)
static const float firBWLowLimitFactor
Factor by which the FIR working sample rate is multiplied to yield bandwidth lower limit...
int m_lpfFIRTxGain
digital lowpass FIR filter gain Tx side (dB)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFIREnable()

void DevicePlutoSDRBox::setFIREnable ( bool  enable)

Definition at line 615 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, m_lpfFIREnable, and set_params().

Referenced by PlutoSDROutput::applySettings(), PlutoSDRInput::applySettings(), and setFIR().

616 {
617  char buff[100];
618  std::vector<std::string> params;
619  snprintf(buff, sizeof(buff), "in_out_voltage_filter_fir_en=%d", enable ? 1 : 0);
620  params.push_back(std::string(buff));
621  set_params(DEVICE_PHY, params);
622  m_lpfFIREnable = enable;
623 }
bool m_lpfFIREnable
enable digital lowpass FIR filter
void set_params(DeviceType devType, const std::vector< std::string > &params)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLOPPMTenths()

void DevicePlutoSDRBox::setLOPPMTenths ( int  ppmTenths)

Definition at line 625 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, m_LOppmTenths, m_xoInitial, and set_params().

Referenced by PlutoSDROutput::applySettings(), and PlutoSDRInput::applySettings().

626 {
627  char buff[100];
628  std::vector<std::string> params;
629  int64_t newXO = m_xoInitial + ((m_xoInitial*ppmTenths) / 10000000L);
630  snprintf(buff, sizeof(buff), "xo_correction=%ld", (long int) newXO);
631  params.push_back(std::string(buff));
632  set_params(DEVICE_PHY, params);
633  m_LOppmTenths = ppmTenths;
634 }
__int64 int64_t
Definition: rtptypes_win.h:47
int32_t m_LOppmTenths
XO correction.
void set_params(DeviceType devType, const std::vector< std::string > &params)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSampleRate()

void DevicePlutoSDRBox::setSampleRate ( uint32_t  sampleRate)

Definition at line 533 of file deviceplutosdrbox.cpp.

References DEVICE_PHY, m_devSampleRate, and set_params().

Referenced by PlutoSDROutput::applySettings(), PlutoSDRInput::applySettings(), and setFIR().

534 {
535  char buff[100];
536  std::vector<std::string> params;
537  snprintf(buff, sizeof(buff), "in_voltage_sampling_frequency=%d", sampleRate);
538  params.push_back(std::string(buff));
539  snprintf(buff, sizeof(buff), "out_voltage_sampling_frequency=%d", sampleRate);
540  params.push_back(std::string(buff));
541  set_params(DEVICE_PHY, params);
542  m_devSampleRate = sampleRate;
543 }
uint64_t m_devSampleRate
Host interface sample rate.
void set_params(DeviceType devType, const std::vector< std::string > &params)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ txBufferEnd()

char * DevicePlutoSDRBox::txBufferEnd ( )

Definition at line 449 of file deviceplutosdrbox.cpp.

References m_txBuf.

Referenced by PlutoSDROutputThread::run().

450 {
451  if (m_txBuf) {
452  return (char *) iio_buffer_end(m_txBuf);
453  } else {
454  return 0;
455  }
456 }
struct iio_buffer * m_txBuf
+ Here is the caller graph for this function:

◆ txBufferFirst()

char * DevicePlutoSDRBox::txBufferFirst ( )

Definition at line 458 of file deviceplutosdrbox.cpp.

References m_chnTx0i, and m_txBuf.

Referenced by PlutoSDROutputThread::run().

459 {
460  if (m_txBuf) {
461  return (char *) iio_buffer_first(m_txBuf, m_chnTx0i);
462  } else {
463  return 0;
464  }
465 }
struct iio_channel * m_chnTx0i
struct iio_buffer * m_txBuf
+ Here is the caller graph for this function:

◆ txBufferPush()

ssize_t DevicePlutoSDRBox::txBufferPush ( )

Definition at line 404 of file deviceplutosdrbox.cpp.

References m_txBuf.

Referenced by PlutoSDROutputThread::run().

405 {
406  if (m_txBuf) {
407  return iio_buffer_push(m_txBuf);
408  } else {
409  return 0;
410  }
411 }
struct iio_buffer * m_txBuf
+ Here is the caller graph for this function:

◆ txBufferStep()

std::ptrdiff_t DevicePlutoSDRBox::txBufferStep ( )

Definition at line 440 of file deviceplutosdrbox.cpp.

References m_txBuf.

Referenced by PlutoSDROutputThread::run().

441 {
442  if (m_txBuf) {
443  return iio_buffer_step(m_txBuf);
444  } else {
445  return 0;
446  }
447 }
struct iio_buffer * m_txBuf
+ Here is the caller graph for this function:

◆ txChannelConvert()

void DevicePlutoSDRBox::txChannelConvert ( int16_t dst,
int16_t src 
)

Definition at line 467 of file deviceplutosdrbox.cpp.

References m_chnTx0i, and m_chnTx0q.

Referenced by PlutoSDROutputThread::run().

468 {
469  if (m_chnTx0i) {
470  iio_channel_convert_inverse(m_chnTx0i, &dst[0], &src[0]);
471  }
472  if (m_chnTx0q) {
473  iio_channel_convert_inverse(m_chnTx0q, &dst[1], &src[1]);
474  }
475 }
struct iio_channel * m_chnTx0i
struct iio_channel * m_chnTx0q
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_chnRx0

struct iio_channel* DevicePlutoSDRBox::m_chnRx0
private

Definition at line 122 of file deviceplutosdrbox.h.

Referenced by closeRx(), openRx(), and rxBufferFirst().

◆ m_chnTx0i

struct iio_channel* DevicePlutoSDRBox::m_chnTx0i
private

Definition at line 123 of file deviceplutosdrbox.h.

Referenced by closeTx(), openTx(), txBufferFirst(), and txChannelConvert().

◆ m_chnTx0q

struct iio_channel* DevicePlutoSDRBox::m_chnTx0q
private

Definition at line 124 of file deviceplutosdrbox.h.

Referenced by closeTx(), openTx(), and txChannelConvert().

◆ m_ctx

struct iio_context* DevicePlutoSDRBox::m_ctx
private

Definition at line 118 of file deviceplutosdrbox.h.

Referenced by DevicePlutoSDRBox(), and ~DevicePlutoSDRBox().

◆ m_devPhy

struct iio_device* DevicePlutoSDRBox::m_devPhy
private

Definition at line 119 of file deviceplutosdrbox.h.

Referenced by DevicePlutoSDRBox(), get_param(), set_params(), and setFilter().

◆ m_devRx

struct iio_device* DevicePlutoSDRBox::m_devRx
private

◆ m_devSampleRate

uint64_t DevicePlutoSDRBox::m_devSampleRate

Host interface sample rate.

Definition at line 63 of file deviceplutosdrbox.h.

Referenced by setSampleRate().

◆ m_devTx

struct iio_device* DevicePlutoSDRBox::m_devTx
private

◆ m_LOppmTenths

int32_t DevicePlutoSDRBox::m_LOppmTenths

XO correction.

Definition at line 64 of file deviceplutosdrbox.h.

Referenced by setLOPPMTenths().

◆ m_lpfFIRBW

float DevicePlutoSDRBox::m_lpfFIRBW

digital lowpass FIR filter bandwidth (Hz)

Definition at line 66 of file deviceplutosdrbox.h.

Referenced by setFIR().

◆ m_lpfFIREnable

bool DevicePlutoSDRBox::m_lpfFIREnable

enable digital lowpass FIR filter

Definition at line 65 of file deviceplutosdrbox.h.

Referenced by setFIREnable().

◆ m_lpfFIRlog2Decim

uint32_t DevicePlutoSDRBox::m_lpfFIRlog2Decim

digital lowpass FIR filter log2 of decimation factor (0..2)

Definition at line 67 of file deviceplutosdrbox.h.

Referenced by setFIR().

◆ m_lpfFIRRxGain

int DevicePlutoSDRBox::m_lpfFIRRxGain

digital lowpass FIR filter gain Rx side (dB)

Definition at line 68 of file deviceplutosdrbox.h.

Referenced by formatFIRHeader(), and setFIR().

◆ m_lpfFIRTxGain

int DevicePlutoSDRBox::m_lpfFIRTxGain

digital lowpass FIR filter gain Tx side (dB)

Definition at line 69 of file deviceplutosdrbox.h.

Referenced by formatFIRHeader(), and setFIR().

◆ m_rxBuf

struct iio_buffer* DevicePlutoSDRBox::m_rxBuf
private

◆ m_temp

float DevicePlutoSDRBox::m_temp
private

Definition at line 129 of file deviceplutosdrbox.h.

Referenced by fetchTemp().

◆ m_txBuf

struct iio_buffer* DevicePlutoSDRBox::m_txBuf
private

◆ m_valid

bool DevicePlutoSDRBox::m_valid
private

Definition at line 127 of file deviceplutosdrbox.h.

Referenced by DevicePlutoSDRBox(), openRx(), and openTx().

◆ m_xoInitial

int64_t DevicePlutoSDRBox::m_xoInitial
private

Definition at line 128 of file deviceplutosdrbox.h.

Referenced by getXO(), and setLOPPMTenths().


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