Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/36373?usp=email )
Change subject: ms: add config file
..
ms: add config file
This adds proper config options.
The ul/dl freq lines can be copied from the osmo-trx (network side) cfg.
Change-Id: Ibd432f7abbd00065a59104d2c006b676d5db7b47
---
M Transceiver52M/Makefile.am
M Transceiver52M/ms/bladerf_specific.h
M Transceiver52M/ms/ms.h
M Transceiver52M/ms/ms_rx_lower.cpp
M Transceiver52M/ms/ms_upper.cpp
M Transceiver52M/ms/ms_upper.h
A Transceiver52M/ms/mssdr_vty.c
A Transceiver52M/ms/mssdr_vty.h
M doc/examples/Makefile.am
A doc/examples/osmo-trx-ms-blade/mssdr.cfg
10 files changed, 580 insertions(+), 196 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/73/36373/1
diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index dadfde9..b007a3d 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -97,6 +97,7 @@
ms/ms_upper.cpp \
ms/l1ctl_server.c \
ms/logging.c \
+ ms/mssdr_vty.c \
ms/l1ctl_server_cb.cpp \
ms/ms_trxcon_if.cpp
@@ -110,6 +111,7 @@
ms/itrq.h \
ms/sch.h \
ms/threadpool.h \
+ ms/mssdr_vty.h \
grgsm_vitac/viterbi_detector.h \
grgsm_vitac/constants.h \
grgsm_vitac/grgsm_vitac.h
diff --git a/Transceiver52M/ms/bladerf_specific.h
b/Transceiver52M/ms/bladerf_specific.h
index 9db8bf0..d31ea29 100644
--- a/Transceiver52M/ms/bladerf_specific.h
+++ b/Transceiver52M/ms/bladerf_specific.h
@@ -32,6 +32,9 @@
#include
#include
#include
+extern "C" {
+#include "mssdr_vty.h"
+}
const size_t BLADE_BUFFER_SIZE = 1024 * 1;
const size_t BLADE_NUM_BUFFERS = 32 * 1;
@@ -195,8 +198,8 @@
using tx_buf_q_type = spsc_cond_timeout;
const unsigned int rxFullScale, txFullScale;
const int rxtxdelay;
+ bool use_agc;
- float rxgain, txgain;
static std::atomic stop_lower_threads_flag;
double rxfreq_cache, txfreq_cache;
@@ -205,9 +208,13 @@
int rx_freq;
int sample_rate;
int bandwidth;
+ float rxgain;
+ float txgain;
public:
- ms_trx_config() : tx_freq(881e6), rx_freq(926e6),
sample_rate(((1625e3 / 6) * 4)), bandwidth(1e6)
+ ms_trx_config()
+ : tx_freq(881e6), rx_freq(926e6), sample_rate(((1625e3
/ 6) * 4)), bandwidth(1e6), rxgain(30),
+ txgain(30)
{
}
} cfg;
@@ -223,10 +230,14 @@
{
close_device();
}
- blade_hw()
- : rxFullScale(2047), txFullScale(2047), rxtxdelay(-60),
rxgain(30), txgain(30), rxfreq_cache(0),
+ blade_hw(struct mssdr_cfg *cfgdata)
+ : rxFullScale(2047), txFullScale(2047), rxtxdelay(-60),
use_agc(cfgdata->use_agc), rxfreq_cache(0),
txfreq_cache(0)
{
+ cfg.tx_freq = cfgdata->overrides.ul_freq;
+ cfg.rx_freq = cfgdata->overrides.dl_freq;
+ cfg.rxgain = cfgdata->overrides.dl_gain;
+ cfg.txgain = cfgdata->overrides.ul_gain;
}
void close_device()
@@ -251,6 +262,7 @@
int init_device(bh_fn_t rxh, bh_fn_t txh)
{
struct bladerf_rational_rate rate = { 0,
static_cast((1625e3 * 4)) * 64, 6 * 64 }, actual;
+ std::cerr << "cfg: ul " << cfg.tx_freq << " dl " << cfg.rx_freq
<< std::endl;
bladerf_log_set_verbosity(BLADERF_LOG_LEVEL_DEBUG);
bladerf_set_usb_reset_on_open(true);
@@ -294,9 +306,10 @@
blade_check(bladerf_set_bandwidth, dev, BLADERF_CHANNEL_TX(0),
(bladerf_bandwidth)cfg.bandwidth,
(bladerf_bandwidth *)NULL);
- blade_check(bladerf_set_gain_mode, dev, BLADERF_CHANNEL_RX(0),
BLADERF_GAIN_MGC);
- setRxGain(rxgain, 0);
- setTxGain(txgain, 0);
+ blade_check(bladerf_set_gain_mode, dev, BLADERF_CHANNEL_RX(0),
+ use_agc ? BLADERF_GAIN_AUTOMATIC :
BLADERF_GAIN_MGC);
+ setRxGain(cfg.rxgain, 0);
+ setTxGain(cfg.txgain, 0);
usleep(1000);
bladerf_set_stream_timeout(dev, BLADERF_TX, 10);
@@ -350,7 +363,7 @@
double setRxGain(double dB, size_t chan = 0)
{
- rxgain = dB;
+ cfg.rxgain = dB;
msleep(15);
blade_check(bladerf_set_gain, dev, BLADERF_CHANNEL_RX(0),
(bladerf_gain)dB);
msleep(15);
@@ -358,7 +371,7 @@
};
double setTxGain(double dB, size_t chan = 0)
{
- txgain = dB;
+ cfg.txgain = dB;
msleep(15);
blade_check(bladerf_set_gain, dev, BLADERF