laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/22942 )

Change subject: Add a (hidden) VTY parameter for Rx/Tx freq. shifting
......................................................................

Add a (hidden) 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, 22 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/CommonLibs/config_defs.h b/CommonLibs/config_defs.h
index a9ed25e..17352c3 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_khz;
        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..d1da450 100644
--- a/CommonLibs/trx_vty.c
+++ b/CommonLibs/trx_vty.c
@@ -244,6 +244,19 @@
        return CMD_SUCCESS;
 }

+DEFUN_ATTR(cfg_freq_offset, cfg_freq_offset_cmd,
+          "freq-offset FLOAT",
+          "Apply an artificial offset to Rx/Tx carrier frequency\n"
+          "Frequency offset in kHz (e.g. -145300)\n",
+          CMD_ATTR_HIDDEN)
+{
+       struct trx_ctx *trx = trx_from_vty(vty);
+
+       trx->cfg.freq_offset_khz = atof(argv[0]);
+
+       return CMD_SUCCESS;
+}
+
 DEFUN(cfg_rssi_offset, cfg_rssi_offset_cmd,
        "rssi-offset FLOAT [relative]",
        "Set the RSSI to dBm offset in dB (default=0)\n"
@@ -593,6 +606,8 @@
        vty_out(vty, " multi-arfcn %s%s", trx->cfg.multi_arfcn ? "enable" : 
"disable", VTY_NEWLINE);
        if (trx->cfg.offset != 0)
                vty_out(vty, " offset %f%s", trx->cfg.offset, VTY_NEWLINE);
+       if (trx->cfg.freq_offset_khz != 0)
+               vty_out(vty, " freq-offset %f%s", trx->cfg.freq_offset_khz, 
VTY_NEWLINE);
        if (!(trx->cfg.rssi_offset == 0 && !trx->cfg.force_rssi_offset))
                vty_out(vty, " rssi-offset %f%s%s", trx->cfg.rssi_offset,
                        trx->cfg.force_rssi_offset ? " relative": "", 
VTY_NEWLINE);
@@ -758,6 +773,7 @@
        install_element(TRX_NODE, &cfg_clock_ref_cmd);
        install_element(TRX_NODE, &cfg_multi_arfcn_cmd);
        install_element(TRX_NODE, &cfg_offset_cmd);
+       install_element(TRX_NODE, &cfg_freq_offset_cmd);
        install_element(TRX_NODE, &cfg_rssi_offset_cmd);
        install_element(TRX_NODE, &cfg_swap_channels_cmd);
        install_element(TRX_NODE, &cfg_egprs_cmd);
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 0a1ba6f..91f06ec 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_khz) * 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_khz) * 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..b227863 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -542,7 +542,9 @@
        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;
+       if (trx->cfg.freq_offset_khz != 0)
+               ost << "   Tune freq. offset....... " << 
trx->cfg.freq_offset_khz << 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: 3
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Hoernchen <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-CC: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to