aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/device/lms/LMSDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Transceiver52M/device/lms/LMSDevice.cpp')
-rw-r--r--Transceiver52M/device/lms/LMSDevice.cpp330
1 files changed, 233 insertions, 97 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index b5993b8..7c220d2 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -20,6 +20,9 @@
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
+
+#include <map>
+
#include "Logger.h"
#include "Threads.h"
#include "LMSDevice.h"
@@ -28,6 +31,7 @@
#include <lime/LimeSuite.h>
extern "C" {
+#include "trx_vty.h"
#include "osmo_signal.h"
#include <osmocom/core/utils.h>
}
@@ -36,20 +40,78 @@ extern "C" {
#include "config.h"
#endif
-using namespace std;
-
#define MAX_ANTENNA_LIST_SIZE 10
-#define LMS_SAMPLE_RATE GSMRATE*32
#define GSM_CARRIER_BW 270000.0 /* 270kHz */
#define LMS_MIN_BW_SUPPORTED 2.5e6 /* 2.5mHz, minimum supported by LMS */
#define LMS_CALIBRATE_BW_HZ OSMO_MAX(GSM_CARRIER_BW, LMS_MIN_BW_SUPPORTED)
#define SAMPLE_BUF_SZ (1 << 20) /* Size of Rx timestamp based Ring buffer, in bytes */
-LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
- const std::vector<std::string>& tx_paths,
- const std::vector<std::string>& rx_paths):
- RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths),
- m_lms_dev(NULL)
+
+/* Device Name Prefixes as presented by LimeSuite API LMS_GetDeviceInfo(): */
+#define LMS_DEV_SDR_USB_PREFIX_NAME "LimeSDR-USB"
+#define LMS_DEV_SDR_MINI_PREFIX_NAME "LimeSDR-Mini"
+#define LMS_DEV_NET_MICRO_PREFIX_NAME "LimeNET-Micro"
+
+
+
+static const dev_map_t dev_param_map {
+ { LMS_DEV_SDR_USB, { true, true, GSMRATE, MCBTS_SPACING, 8.9e-5, 7.9e-5, LMS_DEV_SDR_USB_PREFIX_NAME } },
+ { LMS_DEV_SDR_MINI, { false, true, GSMRATE, MCBTS_SPACING, 8.9e-5, 8.2e-5, LMS_DEV_SDR_MINI_PREFIX_NAME } },
+ { LMS_DEV_NET_MICRO, { true, false, GSMRATE, MCBTS_SPACING, 8.9e-5, 7.9e-5, LMS_DEV_NET_MICRO_PREFIX_NAME } },
+ { LMS_DEV_UNKNOWN, { true, true, GSMRATE, MCBTS_SPACING, 8.9e-5, 7.9e-5, "UNKNOWN" } },
+};
+
+static const power_map_t dev_band_nom_power_param_map {
+ { std::make_tuple(LMS_DEV_SDR_USB, GSM_BAND_850), { 73.0, 11.2, -6.0 } },
+ { std::make_tuple(LMS_DEV_SDR_USB, GSM_BAND_900), { 73.0, 10.8, -6.0 } },
+ { std::make_tuple(LMS_DEV_SDR_USB, GSM_BAND_1800), { 65.0, -3.5, -17.0 } }, /* FIXME: OS#4583: 1800Mhz is failing above TxGain=65, which is around -3.5dBm (already < 0 dBm) */
+ { std::make_tuple(LMS_DEV_SDR_USB, GSM_BAND_1900), { 73.0, 1.7, -17.0 } }, /* FIXME: OS#4583: 1900MHz is failing in all TxGain values */
+ { std::make_tuple(LMS_DEV_SDR_MINI, GSM_BAND_850), { 66.0, 3.1, -6.0 } }, /* FIXME: OS#4583: Ensure BAND2 is used at startup */
+ { std::make_tuple(LMS_DEV_SDR_MINI, GSM_BAND_900), { 66.0, 2.8, -6.0 } }, /* FIXME: OS#4583: Ensure BAND2 is used at startup */
+ { std::make_tuple(LMS_DEV_SDR_MINI, GSM_BAND_1800), { 66.0, -11.6, -17.0 } }, /* OS#4583: Any of BAND1 or BAND2 is fine */
+ { std::make_tuple(LMS_DEV_SDR_MINI, GSM_BAND_1900), { 66.0, -9.2, -17.0 } }, /* FIXME: OS#4583: Ensure BAND1 is used at startup */
+ { std::make_tuple(LMS_DEV_NET_MICRO, GSM_BAND_850), { 71.0, 6.8, -6.0 } },
+ { std::make_tuple(LMS_DEV_NET_MICRO, GSM_BAND_900), { 71.0, 6.8, -6.0 } },
+ { std::make_tuple(LMS_DEV_NET_MICRO, GSM_BAND_1800), { 65.0, -10.5, -17.0 } }, /* OS#4583: TxGain=71 (-4.4dBm) FAIL rms phase errors ~10° */
+ { std::make_tuple(LMS_DEV_NET_MICRO, GSM_BAND_1900), { 71.0, -6.3, -17.0 } }, /* FIXME: OS#4583: all FAIL, BAND1/BAND2 rms phase errors >23° */
+};
+
+/* So far measurements done for B210 show really close to linear relationship
+ * between gain and real output power, so we simply adjust the measured offset
+ */
+static double TxGain2TxPower(const dev_band_desc &desc, double tx_gain_db)
+{
+ return desc.nom_out_tx_power - (desc.nom_lms_tx_gain - tx_gain_db);
+}
+static double TxPower2TxGain(const dev_band_desc &desc, double tx_power_dbm)
+{
+ return desc.nom_lms_tx_gain - (desc.nom_out_tx_power - tx_power_dbm);
+}
+
+static enum lms_dev_type parse_dev_type(lms_device_t *m_lms_dev)
+{
+ std::map<enum lms_dev_type, struct dev_desc>::const_iterator it = dev_param_map.begin();
+
+ const lms_dev_info_t* device_info = LMS_GetDeviceInfo(m_lms_dev);
+
+ while (it != dev_param_map.end())
+ {
+ enum lms_dev_type dev_type = it->first;
+ struct dev_desc desc = it->second;
+
+ if (strncmp(device_info->deviceName, desc.desc_str.c_str(), desc.desc_str.length()) == 0) {
+ LOGC(DDEV, INFO) << "Device identified as " << desc.desc_str;
+ return dev_type;
+ }
+ it++;
+ }
+ return LMS_DEV_UNKNOWN;
+}
+
+LMSDevice::LMSDevice(InterfaceType iface, const struct trx_cfg *cfg)
+ : RadioDevice(iface, cfg),
+ band_manager(m_dev_type, dev_band_nom_power_param_map, dev_param_map, {LMS_DEV_SDR_USB, GSM_BAND_850}), m_lms_dev(NULL),
+ started(false), m_dev_type(LMS_DEV_UNKNOWN)
{
LOGC(DDEV, INFO) << "creating LMS device...";
@@ -59,6 +121,11 @@ LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t c
tx_gains.resize(chans);
rx_buffers.resize(chans);
+
+ /* Set up per-channel Rx timestamp based Ring buffers */
+ for (size_t i = 0; i < rx_buffers.size(); i++)
+ rx_buffers[i] = new smpl_buf(SAMPLE_BUF_SZ / sizeof(uint32_t));
+
}
LMSDevice::~LMSDevice()
@@ -93,7 +160,7 @@ static void lms_log_callback(int lvl, const char *msg)
if ((unsigned int) lvl >= ARRAY_SIZE(lvl_map))
lvl = ARRAY_SIZE(lvl_map)-1;
- LOGLV(DLMS, lvl_map[lvl]) << msg;
+ LOGLV(DDEVDRV, lvl_map[lvl]) << msg;
}
static void print_range(const char* name, lms_range_t *range)
@@ -110,7 +177,7 @@ static void print_range(const char* name, lms_range_t *range)
int info_list_find(lms_info_str_t* info_list, unsigned int count, const std::string &args)
{
unsigned int i, j;
- vector<string> filters;
+ std::vector<std::string> filters;
filters = comma_delimited_to_vector(args.c_str());
@@ -131,24 +198,25 @@ int info_list_find(lms_info_str_t* info_list, unsigned int count, const std::str
return -1;
}
-int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
+int LMSDevice::open()
{
lms_info_str_t* info_list;
- const lms_dev_info_t* device_info;
lms_range_t range_sr;
float_type sr_host, sr_rf;
unsigned int i, n;
int rc, dev_id;
+ struct dev_desc dev_desc;
LOGC(DDEV, INFO) << "Opening LMS device..";
LMS_RegisterLogHandler(&lms_log_callback);
- if ((n = LMS_GetDeviceList(NULL)) < 0)
+ if ((rc = LMS_GetDeviceList(NULL)) < 0)
LOGC(DDEV, ERROR) << "LMS_GetDeviceList(NULL) failed";
- LOGC(DDEV, INFO) << "Devices found: " << n;
- if (n < 1)
+ LOGC(DDEV, INFO) << "Devices found: " << rc;
+ if (rc < 1)
return -1;
+ n = rc;
info_list = new lms_info_str_t[n];
@@ -158,9 +226,9 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
for (i = 0; i < n; i++)
LOGC(DDEV, INFO) << "Device [" << i << "]: " << info_list[i];
- dev_id = info_list_find(info_list, n, args);
+ dev_id = info_list_find(info_list, n, cfg->dev_args);
if (dev_id == -1) {
- LOGC(DDEV, ERROR) << "No LMS device found with address '" << args << "'";
+ LOGC(DDEV, ERROR) << "No LMS device found with address '" << cfg->dev_args << "'";
delete[] info_list;
return -1;
}
@@ -175,19 +243,21 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
delete [] info_list;
- device_info = LMS_GetDeviceInfo(m_lms_dev);
+ m_dev_type = parse_dev_type(m_lms_dev);
+ dev_desc = dev_param_map.at(m_dev_type);
+ update_band_dev(m_dev_type);
- if ((ref != REF_EXTERNAL) && (ref != REF_INTERNAL)){
+ if ((cfg->clock_ref != REF_EXTERNAL) && (cfg->clock_ref != REF_INTERNAL)) {
LOGC(DDEV, ERROR) << "Invalid reference type";
goto out_close;
}
- /* if reference clock is external setup must happen _before_ calling LMS_Init */
- /* FIXME make external reference frequency configurable */
- if (ref == REF_EXTERNAL) {
+ /* if reference clock is external, setup must happen _before_ calling LMS_Init */
+ if (cfg->clock_ref == REF_EXTERNAL) {
LOGC(DDEV, INFO) << "Setting External clock reference to 10MHz";
- /* Assume an external 10 MHz reference clock */
- if (LMS_SetClockFreq(m_lms_dev, LMS_CLOCK_EXTREF, 10000000.0) < 0)
+ /* FIXME: Assume an external 10 MHz reference clock. make
+ external reference frequency configurable */
+ if (!do_clock_src_freq(REF_EXTERNAL, 10000000.0))
goto out_close;
}
@@ -197,22 +267,13 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
goto out_close;
}
- /* LimeSDR-Mini does not have switches but needs soldering to select external/internal clock */
- /* LimeNET-Micro also does not like selecting internal clock*/
- /* also set device specific maximum tx levels selected by phasenoise measurements*/
- if (strncmp(device_info->deviceName,"LimeSDR-USB",11) == 0){
- /* if reference clock is internal setup must happen _after_ calling LMS_Init */
- /* according to lms using LMS_CLOCK_EXTREF with a frequency <= 0 is the correct way to set clock to internal reference*/
- if (ref == REF_INTERNAL) {
- LOGC(DDEV, INFO) << "Setting Internal clock reference";
- if (LMS_SetClockFreq(m_lms_dev, LMS_CLOCK_EXTREF, -1) < 0)
- goto out_close;
- }
- maxTxGainClamp = 73.0;
- } else if (strncmp(device_info->deviceName,"LimeSDR-Mini",12) == 0)
- maxTxGainClamp = 66.0;
- else
- maxTxGainClamp = 71.0; /* "LimeNET-Micro", etc FIXME pciE based LMS boards?*/
+ /* if reference clock is internal, setup must happen _after_ calling LMS_Init */
+ if (cfg->clock_ref == REF_INTERNAL) {
+ LOGC(DDEV, INFO) << "Setting Internal clock reference";
+ /* Internal freq param is not used */
+ if (!do_clock_src_freq(REF_INTERNAL, 0))
+ goto out_close;
+ }
/* enable all used channels */
for (i=0; i<chans; i++) {
@@ -227,16 +288,22 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
goto out_close;
print_range("Sample Rate", &range_sr);
- LOGC(DDEV, INFO) << "Setting sample rate to " << GSMRATE*tx_sps << " " << tx_sps;
- if (LMS_SetSampleRate(m_lms_dev, GSMRATE*tx_sps, 32) < 0)
+ if (iface == MULTI_ARFCN)
+ sr_host = dev_desc.rate_multiarfcn * tx_sps;
+ else
+ sr_host = dev_desc.rate * tx_sps;
+ LOGC(DDEV, INFO) << "Setting sample rate to " << sr_host << " " << tx_sps;
+ if (LMS_SetSampleRate(m_lms_dev, sr_host, 32) < 0)
goto out_close;
if (LMS_GetSampleRate(m_lms_dev, LMS_CH_RX, 0, &sr_host, &sr_rf))
goto out_close;
LOGC(DDEV, INFO) << "Sample Rate: Host=" << sr_host << " RF=" << sr_rf;
- /* FIXME: make this device/model dependent, like UHDDevice:dev_param_map! */
- ts_offset = static_cast<TIMESTAMP>(8.9e-5 * GSMRATE * tx_sps); /* time * sample_rate */
+ if (iface == MULTI_ARFCN)
+ ts_offset = static_cast<TIMESTAMP>(dev_desc.ts_offset_coef_multiarfcn * sr_host);
+ else
+ ts_offset = static_cast<TIMESTAMP>(dev_desc.ts_offset_coef * sr_host);
/* configure antennas */
if (!set_antennas()) {
@@ -244,13 +311,7 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
goto out_close;
}
- /* Set up per-channel Rx timestamp based Ring buffers */
- for (size_t i = 0; i < rx_buffers.size(); i++)
- rx_buffers[i] = new smpl_buf(SAMPLE_BUF_SZ / sizeof(uint32_t));
-
- started = false;
-
- return NORMAL;
+ return iface == MULTI_ARFCN ? MULTI_ARFCN : NORMAL;
out_close:
LOGC(DDEV, FATAL) << "Error in LMS open, closing: " << LMS_GetLastErrorMessage();
@@ -264,17 +325,20 @@ bool LMSDevice::start()
LOGC(DDEV, INFO) << "starting LMS...";
unsigned int i;
+ dev_band_desc desc;
if (started) {
LOGC(DDEV, ERR) << "Device already started";
return false;
}
+ get_dev_band_desc(desc);
+
/* configure the channels/streams */
for (i=0; i<chans; i++) {
/* Set gains for calibration/filter setup */
/* TX gain to maximum */
- setTxGain(maxTxGain(), i);
+ LMS_SetGaindB(m_lms_dev, LMS_CH_TX, i, TxPower2TxGain(desc, desc.nom_out_tx_power));
/* RX gain to midpoint */
setRxGain((minRxGain() + maxRxGain()) / 2, i);
@@ -340,10 +404,49 @@ bool LMSDevice::stop()
LMS_DestroyStream(m_lms_dev, &m_lms_stream_rx[i]);
}
+ band_reset();
+
started = false;
return true;
}
+bool LMSDevice::do_clock_src_freq(enum ReferenceType ref, double freq)
+{
+ struct dev_desc dev_desc = dev_param_map.at(m_dev_type);
+ size_t lms_clk_id;
+
+ switch (ref) {
+ case REF_EXTERNAL:
+ lms_clk_id = LMS_CLOCK_EXTREF;
+ break;
+ case REF_INTERNAL:
+ if (!dev_desc.clock_src_int_usable) {
+ LOGC(DDEV, ERROR)
+ << "Device type " << dev_desc.desc_str << " doesn't support internal reference clock";
+ return false;
+ }
+ /* According to lms using LMS_CLOCK_EXTREF with a
+ frequency <= 0 is the correct way to set clock to
+ internal reference */
+ lms_clk_id = LMS_CLOCK_EXTREF;
+ freq = -1;
+ break;
+ default:
+ LOGC(DDEV, ERROR) << "Invalid reference type " << get_value_string(clock_ref_names, ref);
+ return false;
+ }
+
+ if (dev_desc.clock_src_switchable) {
+ if (LMS_SetClockFreq(m_lms_dev, lms_clk_id, freq) < 0)
+ return false;
+ } else {
+ LOGC(DDEV, INFO)
+ << "Device type " << dev_desc.desc_str << " doesn't support switching clock source through SW";
+ }
+
+ return true;
+}
+
/* do rx/tx calibration - depends on gain, freq and bw */
bool LMSDevice::do_calib(size_t chan)
{
@@ -382,17 +485,6 @@ bool LMSDevice::do_filters(size_t chan)
return true;
}
-
-double LMSDevice::maxTxGain()
-{
- return maxTxGainClamp;
-}
-
-double LMSDevice::minTxGain()
-{
- return 0.0;
-}
-
double LMSDevice::maxRxGain()
{
return 73.0;
@@ -403,22 +495,6 @@ double LMSDevice::minRxGain()
return 0.0;
}
-double LMSDevice::setTxGain(double dB, size_t chan)
-{
- if (dB > maxTxGain())
- dB = maxTxGain();
- if (dB < minTxGain())
- dB = minTxGain();
-
- LOGCHAN(chan, DDEV, NOTICE) << "Setting TX gain to " << dB << " dB";
-
- if (LMS_SetGaindB(m_lms_dev, LMS_CH_TX, chan, dB) < 0)
- LOGCHAN(chan, DDEV, ERR) << "Error setting TX gain to " << dB << " dB";
- else
- tx_gains[chan] = dB;
- return tx_gains[chan];
-}
-
double LMSDevice::setRxGain(double dB, size_t chan)
{
if (dB > maxRxGain())
@@ -435,6 +511,63 @@ double LMSDevice::setRxGain(double dB, size_t chan)
return rx_gains[chan];
}
+double LMSDevice::rssiOffset(size_t chan)
+{
+ double rssiOffset;
+ dev_band_desc desc;
+
+ if (chan >= rx_gains.size()) {
+ LOGC(DDEV, ALERT) << "Requested non-existent channel " << chan;
+ return 0.0f;
+ }
+
+ get_dev_band_desc(desc);
+ rssiOffset = rx_gains[chan] + desc.rxgain2rssioffset_rel;
+ return rssiOffset;
+}
+
+double LMSDevice::setPowerAttenuation(int atten, size_t chan)
+{
+ double tx_power, dB;
+ dev_band_desc desc;
+
+ if (chan >= tx_gains.size()) {
+ LOGC(DDEV, ALERT) << "Requested non-existent channel " << chan;
+ return 0.0f;
+ }
+
+ get_dev_band_desc(desc);
+ tx_power = desc.nom_out_tx_power - atten;
+ dB = TxPower2TxGain(desc, tx_power);
+
+ LOGCHAN(chan, DDEV, NOTICE) << "Setting TX gain to " << dB << " dB (~" << tx_power << " dBm)";
+
+ if (LMS_SetGaindB(m_lms_dev, LMS_CH_TX, chan, dB) < 0)
+ LOGCHAN(chan, DDEV, ERR) << "Error setting TX gain to " << dB << " dB (~" << tx_power << " dBm)";
+ else
+ tx_gains[chan] = dB;
+ return desc.nom_out_tx_power - TxGain2TxPower(desc, tx_gains[chan]);
+}
+
+double LMSDevice::getPowerAttenuation(size_t chan) {
+ dev_band_desc desc;
+ if (chan >= tx_gains.size()) {
+ LOGC(DDEV, ALERT) << "Requested non-existent channel " << chan;
+ return 0.0f;
+ }
+
+ get_dev_band_desc(desc);
+ return desc.nom_out_tx_power - TxGain2TxPower(desc, tx_gains[chan]);
+}
+
+int LMSDevice::getNominalTxPower(size_t chan)
+{
+ dev_band_desc desc;
+ get_dev_band_desc(desc);
+
+ return desc.nom_out_tx_power;
+}
+
void LMSDevice::log_ant_list(bool dir_tx, size_t chan, std::ostringstream& os)
{
lms_name_t name_list[MAX_ANTENNA_LIST_SIZE]; /* large enough list for antenna names. */
@@ -644,7 +777,7 @@ void LMSDevice::update_stream_stats_rx(size_t chan, bool *overrun)
// NOTE: Assumes sequential reads
int LMSDevice::readSamples(std::vector < short *>&bufs, int len, bool * overrun,
- TIMESTAMP timestamp, bool * underrun, unsigned *RSSI)
+ TIMESTAMP timestamp, bool * underrun)
{
int rc, num_smpls, expect_smpls;
ssize_t avail_smpls;
@@ -711,8 +844,9 @@ int LMSDevice::readSamples(std::vector < short *>&bufs, int len, bool * overrun,
for (size_t i = 0; i < rx_buffers.size(); i++) {
rc = rx_buffers[i]->read(bufs[i], len, timestamp);
if ((rc < 0) || (rc != len)) {
- LOGC(DDEV, ERROR) << rx_buffers[i]->str_code(rc);
- LOGC(DDEV, ERROR) << rx_buffers[i]->str_status(timestamp);
+ LOGCHAN(i, DDEV, ERROR) << rx_buffers[i]->str_code(rc) << ". "
+ << rx_buffers[i]->str_status(timestamp)
+ << ", (len=" << len << ")";
return 0;
}
}
@@ -762,8 +896,7 @@ void LMSDevice::update_stream_stats_tx(size_t chan, bool *underrun)
}
int LMSDevice::writeSamples(std::vector < short *>&bufs, int len,
- bool * underrun, unsigned long long timestamp,
- bool isControl)
+ bool * underrun, unsigned long long timestamp)
{
int rc = 0;
unsigned int i;
@@ -772,11 +905,6 @@ int LMSDevice::writeSamples(std::vector < short *>&bufs, int len,
tx_metadata.waitForTimestamp = true;
tx_metadata.timestamp = timestamp - ts_offset; /* Shift Tx time by offset */
- if (isControl) {
- LOGC(DDEV, ERROR) << "Control packets not supported";
- return 0;
- }
-
if (bufs.size() != chans) {
LOGC(DDEV, ERROR) << "Invalid channel combination " << bufs.size();
return -1;
@@ -806,8 +934,16 @@ bool LMSDevice::updateAlignment(TIMESTAMP timestamp)
bool LMSDevice::setTxFreq(double wFreq, size_t chan)
{
+ if (chan >= chans) {
+ LOGC(DDEV, ALERT) << "Requested non-existent channel " << chan;
+ return false;
+ }
+
LOGCHAN(chan, DDEV, NOTICE) << "Setting Tx Freq to " << wFreq << " Hz";
+ if (!update_band_from_freq(wFreq, chan, true))
+ return false;
+
if (LMS_SetLOFrequency(m_lms_dev, LMS_CH_TX, chan, wFreq) < 0) {
LOGCHAN(chan, DDEV, ERROR) << "Error setting Tx Freq to " << wFreq << " Hz";
return false;
@@ -820,6 +956,9 @@ bool LMSDevice::setRxFreq(double wFreq, size_t chan)
{
LOGCHAN(chan, DDEV, NOTICE) << "Setting Rx Freq to " << wFreq << " Hz";
+ if (!update_band_from_freq(wFreq, chan, false))
+ return false;
+
if (LMS_SetLOFrequency(m_lms_dev, LMS_CH_RX, chan, wFreq) < 0) {
LOGCHAN(chan, DDEV, ERROR) << "Error setting Rx Freq to " << wFreq << " Hz";
return false;
@@ -828,18 +967,15 @@ bool LMSDevice::setRxFreq(double wFreq, size_t chan)
return true;
}
-RadioDevice *RadioDevice::make(size_t tx_sps, size_t rx_sps,
- InterfaceType iface, size_t chans, double lo_offset,
- const std::vector < std::string > &tx_paths,
- const std::vector < std::string > &rx_paths)
+RadioDevice *RadioDevice::make(InterfaceType type, const struct trx_cfg *cfg)
{
- if (tx_sps != rx_sps) {
- LOGC(DDEV, ERROR) << "LMS Requires tx_sps == rx_sps";
+ if (cfg->tx_sps != cfg->rx_sps) {
+ LOGC(DDEV, ERROR) << "LMS requires tx_sps == rx_sps";
return NULL;
}
- if (lo_offset != 0.0) {
+ if (cfg->offset != 0.0) {
LOGC(DDEV, ERROR) << "LMS doesn't support lo_offset";
return NULL;
}
- return new LMSDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths);
+ return new LMSDevice(type, cfg);
}