From c69b87f9bd755fec5fa5757eee06d5a8b07fc37e Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 14 Jan 2020 18:50:36 +0100 Subject: lms: Make ts_offset and smpl rate coefs device-specific Right now the values are the same for all devices, but they will differ in forthcoming commits once multi-arfcn support is added. Change-Id: I262d3a71848fc3070473e29e42820848e7591d02 --- Transceiver52M/device/lms/LMSDevice.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp index 1ef7728..5a5fbe4 100644 --- a/Transceiver52M/device/lms/LMSDevice.cpp +++ b/Transceiver52M/device/lms/LMSDevice.cpp @@ -67,15 +67,19 @@ struct dev_desc { bool clock_src_int_usable; /* Device specific maximum tx levels selected by phasenoise measurements, in dB */ double max_tx_gain; + /* Sample rate coef (without having TX/RX samples per symbol into account) */ + double rate; + /* Coefficient multiplied by TX sample rate in order to shift Tx time */ + double ts_offset_coef; /* Device Name Prefix as presented by LimeSuite API LMS_GetDeviceInfo() */ std::string name_prefix; }; static const std::map dev_param_map { - { LMS_DEV_SDR_USB, { true, true, 73.0, LMS_DEV_SDR_USB_PREFIX_NAME } }, - { LMS_DEV_SDR_MINI, { false, true, 66.0, LMS_DEV_SDR_MINI_PREFIX_NAME } }, - { LMS_DEV_NET_MICRO, { true, false, 71.0, LMS_DEV_NET_MICRO_PREFIX_NAME } }, - { LMS_DEV_UNKNOWN, { true, true, 73.0, "UNKNOWN" } }, + { LMS_DEV_SDR_USB, { true, true, 73.0, GSMRATE, 8.9e-5, LMS_DEV_SDR_USB_PREFIX_NAME } }, + { LMS_DEV_SDR_MINI, { false, true, 66.0, GSMRATE, 8.9e-5, LMS_DEV_SDR_MINI_PREFIX_NAME } }, + { LMS_DEV_NET_MICRO, { true, false, 71.0, GSMRATE, 8.9e-5, LMS_DEV_NET_MICRO_PREFIX_NAME } }, + { LMS_DEV_UNKNOWN, { true, true, 73.0, GSMRATE, 8.9e-5, "UNKNOWN" } }, }; static enum lms_dev_type parse_dev_type(lms_device_t *m_lms_dev) @@ -277,16 +281,16 @@ 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) + 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(8.9e-5 * GSMRATE * tx_sps); /* time * sample_rate */ + ts_offset = static_cast(dev_desc.ts_offset_coef * sr_host); /* configure antennas */ if (!set_antennas()) { -- cgit v1.2.3