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

#include <devicextrx.h>

Public Member Functions

 DeviceXTRX ()
 
 ~DeviceXTRX ()
 
bool open (const char *deviceStr)
 
void close ()
 
struct xtrx_dev * getDevice ()
 
double set_samplerate (double rate, double master, bool output)
 
double getMasterRate () const
 
double getClockGen () const
 
double getActualInputRate () const
 
double getActualOutputRate () const
 

Static Public Member Functions

static void getAutoGains (uint32_t autoGain, uint32_t &lnaGain, uint32_t &tiaGain, uint32_t &pgaGain)
 

Static Public Attributes

static const uint32_t m_nbGains = 74
 
static const unsigned int blockSize = (1<<13)
 

Private Attributes

struct xtrx_dev * m_dev
 device handle More...
 
double m_inputRate
 
double m_outputRate
 
double m_masterRate
 
double m_clockGen
 
double m_actualInputRate
 
double m_actualOutputRate
 

Static Private Attributes

static const uint32_t m_lnaTbl [m_nbGains]
 
static const uint32_t m_pgaTbl [m_nbGains]
 

Detailed Description

Definition at line 27 of file devicextrx.h.

Constructor & Destructor Documentation

◆ DeviceXTRX()

DeviceXTRX::DeviceXTRX ( )

Definition at line 39 of file devicextrx.cpp.

39  :
40  m_dev(0),
41  m_inputRate(0),
42  m_outputRate(0),
43  m_masterRate(0),
44  m_clockGen(0),
47 {}
double m_clockGen
Definition: devicextrx.h:51
double m_outputRate
Definition: devicextrx.h:49
double m_actualInputRate
Definition: devicextrx.h:52
double m_inputRate
Definition: devicextrx.h:48
double m_masterRate
Definition: devicextrx.h:50
struct xtrx_dev * m_dev
device handle
Definition: devicextrx.h:47
double m_actualOutputRate
Definition: devicextrx.h:53

◆ ~DeviceXTRX()

DeviceXTRX::~DeviceXTRX ( )

Definition at line 49 of file devicextrx.cpp.

References close().

50 {
51  close();
52 }
void close()
Definition: devicextrx.cpp:70
+ Here is the call graph for this function:

Member Function Documentation

◆ close()

void DeviceXTRX::close ( )

Definition at line 70 of file devicextrx.cpp.

References m_dev.

Referenced by XTRXOutput::closeDevice(), XTRXInput::closeDevice(), and ~DeviceXTRX().

71 {
72  if (m_dev)
73  {
74  xtrx_close(m_dev);
75  m_dev = 0;
76  }
77 }
struct xtrx_dev * m_dev
device handle
Definition: devicextrx.h:47
+ Here is the caller graph for this function:

◆ getActualInputRate()

double DeviceXTRX::getActualInputRate ( ) const
inline

Definition at line 39 of file devicextrx.h.

Referenced by XTRXInput::applySettings(), XTRXInput::getDevSampleRate(), XTRXInput::getLog2HardDecim(), XTRXInput::getSampleRate(), and XTRXInput::handleMessage().

39 { return m_actualInputRate; }
double m_actualInputRate
Definition: devicextrx.h:52
+ Here is the caller graph for this function:

◆ getActualOutputRate()

double DeviceXTRX::getActualOutputRate ( ) const
inline

Definition at line 40 of file devicextrx.h.

Referenced by XTRXOutput::applySettings(), XTRXOutput::getDevSampleRate(), XTRXOutput::getLog2HardInterp(), XTRXOutput::getSampleRate(), and XTRXOutput::handleMessage().

40 { return m_actualOutputRate; }
double m_actualOutputRate
Definition: devicextrx.h:53
+ Here is the caller graph for this function:

◆ getAutoGains()

void DeviceXTRX::getAutoGains ( uint32_t  autoGain,
uint32_t lnaGain,
uint32_t tiaGain,
uint32_t pgaGain 
)
static

Definition at line 79 of file devicextrx.cpp.

References m_lnaTbl, and m_pgaTbl.

Referenced by XTRXInput::apply_gain_auto().

80 {
81  uint32_t value = autoGain + 12 > 73 ? 73 : autoGain + 12;
82 
83  if (value > 51) {
84  tiaGain = 2;
85  } else if (value > 42) {
86  tiaGain = 1;
87  } else {
88  tiaGain = 0;
89  }
90 
91  lnaGain = m_lnaTbl[value];
92  pgaGain = m_pgaTbl[value];
93 }
static const uint32_t m_lnaTbl[m_nbGains]
Definition: devicextrx.h:55
unsigned int uint32_t
Definition: rtptypes_win.h:46
static const uint32_t m_pgaTbl[m_nbGains]
Definition: devicextrx.h:56
+ Here is the caller graph for this function:

◆ getClockGen()

double DeviceXTRX::getClockGen ( ) const
inline

Definition at line 38 of file devicextrx.h.

Referenced by XTRXOutput::getClockGen(), XTRXInput::getClockGen(), XTRXInput::getLog2HardDecim(), XTRXOutput::getLog2HardInterp(), XTRXOutput::handleMessage(), and XTRXInput::handleMessage().

38 { return m_clockGen; }
double m_clockGen
Definition: devicextrx.h:51
+ Here is the caller graph for this function:

◆ getDevice()

struct xtrx_dev* DeviceXTRX::getDevice ( )
inline

◆ getMasterRate()

double DeviceXTRX::getMasterRate ( ) const
inline

Definition at line 37 of file devicextrx.h.

37 { return m_masterRate; }
double m_masterRate
Definition: devicextrx.h:50

◆ open()

bool DeviceXTRX::open ( const char *  deviceStr)

Definition at line 54 of file devicextrx.cpp.

References m_dev.

Referenced by XTRXOutput::openDevice(), and XTRXInput::openDevice().

55 {
56  int res;
57  qDebug("DeviceXTRX::open: serial: %s", (const char *) deviceStr);
58 
59  res = xtrx_open(deviceStr, XTRX_O_RESET | 4, &m_dev);
60 
61  if (res)
62  {
63  qCritical() << "DeviceXTRX::open: cannot open device " << deviceStr;
64  return false;
65  }
66 
67  return true;
68 }
struct xtrx_dev * m_dev
device handle
Definition: devicextrx.h:47
+ Here is the caller graph for this function:

◆ set_samplerate()

double DeviceXTRX::set_samplerate ( double  rate,
double  master,
bool  output 
)

Definition at line 95 of file devicextrx.cpp.

References m_actualInputRate, m_actualOutputRate, m_clockGen, m_dev, m_inputRate, m_masterRate, and m_outputRate.

Referenced by XTRXOutput::applySettings(), and XTRXInput::applySettings().

96 {
97  if (output)
98  {
99  m_outputRate = rate;
100 
101  if (master != 0.0) {
102  m_masterRate = master;
103  }
104  }
105  else
106  {
107  m_inputRate = rate;
108 
109  if (master != 0.0) {
110  m_masterRate = master;
111  }
112  }
113 
114  int res = xtrx_set_samplerate(m_dev,
115  m_masterRate,
116  m_inputRate,
117  m_outputRate,
118  0,
119  &m_clockGen,
122 
123  if (res)
124  {
125  qCritical("DeviceXTRX::set_samplerate: Unable to set %s samplerate, m_masterRate: %f, m_inputRate: %f, m_outputRate: %f, error=%d\n",
126  output ? "output" : "input", m_masterRate, m_inputRate, m_outputRate, res);
127  return 0;
128  }
129  else
130  {
131  qDebug() << "DeviceXTRX::set_samplerate: sample rate set: "
132  << "output: "<< output
133  << "m_masterRate: " << m_masterRate
134  << "m_inputRate: " << m_inputRate
135  << "m_outputRate: " << m_outputRate
136  << "m_clockGen: " << m_clockGen
137  << "m_actualInputRate: " << m_actualInputRate
138  << "m_actualOutputRate: " << m_actualOutputRate;
139  }
140 
141  if (output) {
142  return m_outputRate;
143  }
144 
145  return m_inputRate;
146 }
double m_clockGen
Definition: devicextrx.h:51
double m_outputRate
Definition: devicextrx.h:49
double m_actualInputRate
Definition: devicextrx.h:52
double m_inputRate
Definition: devicextrx.h:48
double m_masterRate
Definition: devicextrx.h:50
struct xtrx_dev * m_dev
device handle
Definition: devicextrx.h:47
double m_actualOutputRate
Definition: devicextrx.h:53
+ Here is the caller graph for this function:

Member Data Documentation

◆ blockSize

const unsigned int DeviceXTRX::blockSize = (1<<13)
static

◆ m_actualInputRate

double DeviceXTRX::m_actualInputRate
private

Definition at line 52 of file devicextrx.h.

Referenced by set_samplerate().

◆ m_actualOutputRate

double DeviceXTRX::m_actualOutputRate
private

Definition at line 53 of file devicextrx.h.

Referenced by set_samplerate().

◆ m_clockGen

double DeviceXTRX::m_clockGen
private

Definition at line 51 of file devicextrx.h.

Referenced by set_samplerate().

◆ m_dev

struct xtrx_dev* DeviceXTRX::m_dev
private

device handle

Definition at line 47 of file devicextrx.h.

Referenced by close(), open(), and set_samplerate().

◆ m_inputRate

double DeviceXTRX::m_inputRate
private

Definition at line 48 of file devicextrx.h.

Referenced by set_samplerate().

◆ m_lnaTbl

const uint32_t DeviceXTRX::m_lnaTbl
staticprivate
Initial value:
= {
0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5,
5, 5, 6, 6, 6, 7, 7, 7, 8, 9, 10, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 12, 13, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 14, 14, 14
}

Definition at line 55 of file devicextrx.h.

Referenced by getAutoGains().

◆ m_masterRate

double DeviceXTRX::m_masterRate
private

Definition at line 50 of file devicextrx.h.

Referenced by set_samplerate().

◆ m_nbGains

const uint32_t DeviceXTRX::m_nbGains = 74
static

Definition at line 43 of file devicextrx.h.

◆ m_outputRate

double DeviceXTRX::m_outputRate
private

Definition at line 49 of file devicextrx.h.

Referenced by set_samplerate().

◆ m_pgaTbl

const uint32_t DeviceXTRX::m_pgaTbl
staticprivate
Initial value:
= {
0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0,
1, 2, 0, 1, 2, 0, 1, 2, 0, 0, 0, 0, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 12, 12, 12, 4, 5, 6, 7, 8,
9, 10, 11, 12, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31
}

Definition at line 56 of file devicextrx.h.

Referenced by getAutoGains().


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