aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CommonLibs/trx_vty.c13
-rw-r--r--CommonLibs/trx_vty.h1
-rw-r--r--Transceiver52M/Transceiver.cpp8
-rw-r--r--Transceiver52M/Transceiver.h3
-rw-r--r--Transceiver52M/osmo-trx.cpp5
5 files changed, 23 insertions, 7 deletions
diff --git a/CommonLibs/trx_vty.c b/CommonLibs/trx_vty.c
index 45b58eb..488a2b0 100644
--- a/CommonLibs/trx_vty.c
+++ b/CommonLibs/trx_vty.c
@@ -269,6 +269,18 @@ DEFUN(cfg_rssi_offset, cfg_rssi_offset_cmd,
return CMD_SUCCESS;
}
+DEFUN(cfg_freq_offset, cfg_freq_offset_cmd,
+ "freq-offset INT",
+ "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 channels (default=disable)\n")
@@ -562,6 +574,7 @@ int trx_vty_init(struct trx_ctx* trx)
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_rt_prio_cmd);
diff --git a/CommonLibs/trx_vty.h b/CommonLibs/trx_vty.h
index c921722..0d5b455 100644
--- a/CommonLibs/trx_vty.h
+++ b/CommonLibs/trx_vty.h
@@ -55,6 +55,7 @@ struct trx_ctx {
enum FillerType filler;
bool multi_arfcn;
double offset;
+ int freq_offset;
double rssi_offset;
bool swap_channels;
bool egprs;
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index a1ebb30..18af833 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -111,11 +111,11 @@ Transceiver::Transceiver(int wBasePort,
size_t tx_sps, size_t rx_sps, size_t chans,
GSM::Time wTransmitLatency,
RadioInterface *wRadioInterface,
- double wRssiOffset)
+ double wRssiOffset, int wFreqOffset)
: mBasePort(wBasePort), mLocalAddr(TRXAddress), mRemoteAddr(GSMcoreAddress),
mClockSocket(TRXAddress, wBasePort, GSMcoreAddress, wBasePort + 100),
mTransmitLatency(wTransmitLatency), mRadioInterface(wRadioInterface),
- rssiOffset(wRssiOffset),
+ rssiOffset(wRssiOffset), freqOffset(wFreqOffset),
mSPSTx(tx_sps), mSPSRx(rx_sps), mChans(chans), mEdge(false), mOn(false), mForceClockInterface(false),
mTxFreq(0.0), mRxFreq(0.0), mTSC(0), mMaxExpectedDelayAB(0), mMaxExpectedDelayNB(0),
mWriteBurstToDiskMask(0)
@@ -783,7 +783,7 @@ void Transceiver::driveControl(size_t chan)
// tune receiver
int freqKhz;
sscanf(params, "%d", &freqKhz);
- mRxFreq = freqKhz * 1e3;
+ mRxFreq = (freqKhz + freqOffset) * 1e3;
if (!mRadioInterface->tuneRx(mRxFreq, chan)) {
LOG(ALERT) << "RX failed to tune";
sprintf(response,"RSP RXTUNE 1 %d",freqKhz);
@@ -794,7 +794,7 @@ void Transceiver::driveControl(size_t chan)
// tune txmtr
int freqKhz;
sscanf(params, "%d", &freqKhz);
- mTxFreq = freqKhz * 1e3;
+ mTxFreq = (freqKhz + freqOffset) * 1e3;
if (!mRadioInterface->tuneTx(mTxFreq, chan)) {
LOG(ALERT) << "TX failed to tune";
sprintf(response,"RSP TXTUNE 1 %d",freqKhz);
diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h
index f9b54f0..d359c9a 100644
--- a/Transceiver52M/Transceiver.h
+++ b/Transceiver52M/Transceiver.h
@@ -107,7 +107,7 @@ public:
size_t tx_sps, size_t rx_sps, size_t chans,
GSM::Time wTransmitLatency,
RadioInterface *wRadioInterface,
- double wRssiOffset);
+ double wRssiOffset, int freqOffset);
/** Destructor */
~Transceiver();
@@ -176,6 +176,7 @@ private:
double rxFullScale; ///< full scale output to radio
double rssiOffset; ///< RSSI to dBm conversion offset
+ int freqOffset; ///< Tuning freq. offset
/** modulate and add a burst to the transmit queue */
void addRadioVector(size_t chan, BitVector &bits,
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index 1c40fcf..f6de226 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -125,7 +125,7 @@ int makeTransceiver(struct trx_ctx *trx, RadioInterface *radio)
transceiver = new Transceiver(trx->cfg.base_port, trx->cfg.bind_addr,
trx->cfg.remote_addr, trx->cfg.tx_sps,
trx->cfg.rx_sps, trx->cfg.num_chans, GSM::Time(3,0),
- radio, trx->cfg.rssi_offset);
+ radio, trx->cfg.rssi_offset, trx->cfg.freq_offset);
if (!transceiver->init(trx->cfg.filler, trx->cfg.rtsc,
trx->cfg.rach_delay, trx->cfg.egprs)) {
LOG(ALERT) << "Failed to initialize transceiver";
@@ -400,7 +400,8 @@ static void print_config(struct trx_ctx *trx)
ost << " Reference............... " << trx->cfg.clock_ref << std::endl;
ost << " C0 Filler Table......... " << trx->cfg.filler << 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 << std::endl;
ost << " Swap channels........... " << trx->cfg.swap_channels << std::endl;
ost << " Tx Antennas.............";