Change in osmo-trx[master]: Add VTY parameter for Rx/Tx freq. shifting

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Tue Feb 16 21:24:23 UTC 2021


Hello fixeria,

I'd like you to do a code review. Please visit

    https://gerrit.osmocom.org/c/osmo-trx/+/22942

to review the following change.


Change subject: Add VTY parameter for Rx/Tx freq. shifting
......................................................................

Add VTY parameter for Rx/Tx freq. shifting

Change-Id: I360e8ba91471757210c7f096c04928a6fbb91c61
Related: SYS#4454
---
M CommonLibs/config_defs.h
M CommonLibs/trx_vty.c
M Transceiver52M/Transceiver.cpp
M Transceiver52M/osmo-trx.cpp
4 files changed, 18 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/42/22942/1

diff --git a/CommonLibs/config_defs.h b/CommonLibs/config_defs.h
index a9ed25e..ce6c1e7 100644
--- a/CommonLibs/config_defs.h
+++ b/CommonLibs/config_defs.h
@@ -46,6 +46,7 @@
 	enum FillerType filler;
 	bool multi_arfcn;
 	double offset;
+	double freq_offset;
 	double rssi_offset;
 	bool force_rssi_offset; /* Force value set in VTY? */
 	bool swap_channels;
diff --git a/CommonLibs/trx_vty.c b/CommonLibs/trx_vty.c
index 0bb83fe..fdd05b1 100644
--- a/CommonLibs/trx_vty.c
+++ b/CommonLibs/trx_vty.c
@@ -258,6 +258,18 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_freq_offset, cfg_freq_offset_cmd,
+	"freq-offset OFFSET",
+	"Shift the baseband frequency\n"
+	"Frequency shift in kHz (e.g. -145300)\n")
+{
+	struct trx_ctx *trx = trx_from_vty(vty);
+
+	trx->cfg.freq_offset = atoi(argv[0]);
+
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_swap_channels, cfg_swap_channels_cmd,
 	"swap-channels (disable|enable)",
 	"Swap primary and secondary channels of the PHY (if any)\n"
@@ -759,6 +771,7 @@
 	install_element(TRX_NODE, &cfg_multi_arfcn_cmd);
 	install_element(TRX_NODE, &cfg_offset_cmd);
 	install_element(TRX_NODE, &cfg_rssi_offset_cmd);
+	install_element(TRX_NODE, &cfg_freq_offset_cmd);
 	install_element(TRX_NODE, &cfg_swap_channels_cmd);
 	install_element(TRX_NODE, &cfg_egprs_cmd);
 	install_element(TRX_NODE, &cfg_ext_rach_cmd);
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 0a1ba6f..3384c6e 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -954,7 +954,7 @@
     // tune receiver
     int freqKhz;
     sscanf(params, "%d", &freqKhz);
-    mRxFreq = freqKhz * 1e3;
+    mRxFreq = (freqKhz + cfg->freq_offset) * 1e3;
     if (!mRadioInterface->tuneRx(mRxFreq, chan)) {
        LOGCHAN(chan, DTRXCTRL, FATAL) << "RX failed to tune";
        sprintf(response,"RSP RXTUNE 1 %d",freqKhz);
@@ -965,7 +965,7 @@
     // tune txmtr
     int freqKhz;
     sscanf(params, "%d", &freqKhz);
-    mTxFreq = freqKhz * 1e3;
+    mTxFreq = (freqKhz + cfg->freq_offset) * 1e3;
     if (!mRadioInterface->tuneTx(mTxFreq, chan)) {
        LOGCHAN(chan, DTRXCTRL, FATAL) << "TX failed to tune";
        sprintf(response,"RSP TXTUNE 1 %d",freqKhz);
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index 2d45932..bf11f9f 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -542,7 +542,8 @@
 	ost << "   Filler Burst TSC........ " << trx->cfg.rtsc << std::endl;
 	ost << "   Filler Burst RACH Delay. " << trx->cfg.rach_delay << std::endl;
 	ost << "   Multi-Carrier........... " << trx->cfg.multi_arfcn << std::endl;
-	ost << "   Tuning offset........... " << trx->cfg.offset << std::endl;
+	ost << "   LO freq. offset......... " << trx->cfg.offset << std::endl;
+	ost << "   Tune freq. offset....... " << trx->cfg.freq_offset << std::endl;
 	ost << "   RSSI to dBm offset...... " << trx->cfg.rssi_offset << (trx->cfg.force_rssi_offset ? "" : " (relative)") << std::endl;
 	ost << "   Swap channels........... " << trx->cfg.swap_channels << std::endl;
 	ost << "   Tx Antennas.............";

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/22942
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I360e8ba91471757210c7f096c04928a6fbb91c61
Gerrit-Change-Number: 22942
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210216/77909855/attachment.htm>


More information about the gerrit-log mailing list