This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-trx/+/25522 ) Change subject: lms,uhd: Validate band of RxFreq too ...................................................................... lms,uhd: Validate band of RxFreq too So far the validation is only done on TxFreq for all TRX. Let's also do it for RxFreq. Change-Id: I30eef2727ee96b1344aa1416edd66e2302b88964 --- M Transceiver52M/device/lms/LMSDevice.cpp M Transceiver52M/device/uhd/UHDDevice.cpp 2 files changed, 34 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve osmith: Looks good to me, approved diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp index 30fd665..221d7e2 100644 --- a/Transceiver52M/device/lms/LMSDevice.cpp +++ b/Transceiver52M/device/lms/LMSDevice.cpp @@ -1026,8 +1026,25 @@ bool LMSDevice::setRxFreq(double wFreq, size_t chan) { + uint16_t req_arfcn; + enum gsm_band req_band; + LOGCHAN(chan, DDEV, NOTICE) << "Setting Rx Freq to " << wFreq << " Hz"; + req_arfcn = gsm_freq102arfcn(wFreq / 1000 / 100, 1); + if (req_arfcn == 0xffff) { + LOGCHAN(chan, DDEV, ALERT) << "Unknown ARFCN for Rx Frequency " << wFreq / 1000 << " kHz"; + return false; + } + if (gsm_arfcn2band_rc(req_arfcn, &req_band) < 0) { + LOGCHAN(chan, DDEV, ALERT) << "Unknown GSM band for Rx Frequency " << wFreq + << " Hz (ARFCN " << req_arfcn << " )"; + return false; + } + + if (!set_band(req_band)) + 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; diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp index 5486822..7a8eb9b 100644 --- a/Transceiver52M/device/uhd/UHDDevice.cpp +++ b/Transceiver52M/device/uhd/UHDDevice.cpp @@ -1102,12 +1102,29 @@ bool uhd_device::setRxFreq(double wFreq, size_t chan) { + uint16_t req_arfcn; + enum gsm_band req_band; + if (chan >= rx_freqs.size()) { LOGC(DDEV, ALERT) << "Requested non-existent channel " << chan; return false; } ScopedLock lock(tune_lock); + req_arfcn = gsm_freq102arfcn(wFreq / 1000 / 100, 1); + if (req_arfcn == 0xffff) { + LOGCHAN(chan, DDEV, ALERT) << "Unknown ARFCN for Rx Frequency " << wFreq / 1000 << " kHz"; + return false; + } + if (gsm_arfcn2band_rc(req_arfcn, &req_band) < 0) { + LOGCHAN(chan, DDEV, ALERT) << "Unknown GSM band for Rx Frequency " << wFreq + << " Hz (ARFCN " << req_arfcn << " )"; + return false; + } + + if (!set_band(req_band)) + return false; + return set_freq(wFreq, chan, false); } -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/25522 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I30eef2727ee96b1344aa1416edd66e2302b88964 Gerrit-Change-Number: 25522 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: osmith <osmith at sysmocom.de> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210922/c85ee182/attachment.htm>