aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-09-21 13:52:46 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-09-21 17:24:18 +0200
commitbb2cb9d54bf9681f07ff3fe0affc02e7b2ac047e (patch)
tree668c7d4855732b4237709a2d47c3873f7ec5d48c
parentb9423b25b6f02246430a8b16a3c06616d0c68dc8 (diff)
lms,uhd: Allow changing band between poweroff & poweronHEADmaster
Before this patch, reconnecting to osmo-trx and attempting to configure it for another band is not going to work without restarting the process. The new variable is added in order to still allow POWEROFF followed by a POWERON without need to reconfigure the device. In that case, previous configuration is kept. Change-Id: I43e5e1e4dcb36be605c6bd25dd6a5f3649e244e7
-rw-r--r--Transceiver52M/device/lms/LMSDevice.cpp12
-rw-r--r--Transceiver52M/device/lms/LMSDevice.h1
-rw-r--r--Transceiver52M/device/uhd/UHDDevice.cpp9
-rw-r--r--Transceiver52M/device/uhd/UHDDevice.h1
4 files changed, 16 insertions, 7 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 95bc41e..6e5002c 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -134,8 +134,9 @@ static enum lms_dev_type parse_dev_type(lms_device_t *m_lms_dev)
LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chan_num, double lo_offset,
const std::vector<std::string>& tx_paths,
const std::vector<std::string>& rx_paths):
- RadioDevice(tx_sps, rx_sps, iface, chan_num, lo_offset, tx_paths, rx_paths),
- m_lms_dev(NULL), started(false), band((enum gsm_band)0), m_dev_type(LMS_DEV_UNKNOWN)
+ RadioDevice(tx_sps, rx_sps, iface, chan_num, lo_offset, tx_paths, rx_paths),
+ m_lms_dev(NULL), started(false), band_ass_curr_sess(false), band((enum gsm_band)0),
+ m_dev_type(LMS_DEV_UNKNOWN)
{
LOGC(DDEV, INFO) << "creating LMS device...";
@@ -240,16 +241,17 @@ void LMSDevice::assign_band_desc(enum gsm_band req_band)
bool LMSDevice::set_band(enum gsm_band req_band)
{
- if (band != 0 && req_band != band) {
+ if (band_ass_curr_sess && req_band != band) {
LOGC(DDEV, ALERT) << "Requesting band " << gsm_band_name(req_band)
<< " different from previous band " << gsm_band_name(band);
return false;
}
- if (band == 0) {
+ if (req_band != band) {
band = req_band;
assign_band_desc(band);
}
+ band_ass_curr_sess = true;
return true;
}
@@ -466,6 +468,8 @@ bool LMSDevice::stop()
LMS_DestroyStream(m_lms_dev, &m_lms_stream_rx[i]);
}
+ band_ass_curr_sess = false;
+
started = false;
return true;
}
diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h
index 4ce8ed6..ab28250 100644
--- a/Transceiver52M/device/lms/LMSDevice.h
+++ b/Transceiver52M/device/lms/LMSDevice.h
@@ -87,6 +87,7 @@ private:
TIMESTAMP ts_initial, ts_offset;
std::vector<double> tx_gains, rx_gains;
+ bool band_ass_curr_sess; /* true if "band" was set after last POWEROFF */
enum gsm_band band;
struct dev_band_desc band_desc;
diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index bc39a6d..f109660 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -225,7 +225,7 @@ uhd_device::uhd_device(size_t tx_sps, size_t rx_sps,
const std::vector<std::string>& tx_paths,
const std::vector<std::string>& rx_paths)
: RadioDevice(tx_sps, rx_sps, iface, chan_num, lo_offset, tx_paths, rx_paths),
- rx_gain_min(0.0), rx_gain_max(0.0),
+ rx_gain_min(0.0), rx_gain_max(0.0), band_ass_curr_sess(false),
band((enum gsm_band)0), tx_spp(0), rx_spp(0),
started(false), aligned(false), drop_cnt(0),
prev_ts(0,0), ts_initial(0), ts_offset(0), async_event_thrd(NULL)
@@ -258,16 +258,17 @@ void uhd_device::assign_band_desc(enum gsm_band req_band)
bool uhd_device::set_band(enum gsm_band req_band)
{
- if (band != 0 && req_band != band) {
+ if (band_ass_curr_sess && req_band != band) {
LOGC(DDEV, ALERT) << "Requesting band " << gsm_band_name(req_band)
<< " different from previous band " << gsm_band_name(band);
return false;
}
- if (band == 0) {
+ if (req_band != band) {
band = req_band;
assign_band_desc(band);
}
+ band_ass_curr_sess = true;
return true;
}
@@ -795,6 +796,8 @@ bool uhd_device::stop()
for (size_t i = 0; i < rx_buffers.size(); i++)
rx_buffers[i]->reset();
+ band_ass_curr_sess = false;
+
started = false;
return true;
}
diff --git a/Transceiver52M/device/uhd/UHDDevice.h b/Transceiver52M/device/uhd/UHDDevice.h
index 995b43c..659fd18 100644
--- a/Transceiver52M/device/uhd/UHDDevice.h
+++ b/Transceiver52M/device/uhd/UHDDevice.h
@@ -160,6 +160,7 @@ protected:
std::vector<double> tx_gains, rx_gains;
std::vector<double> tx_freqs, rx_freqs;
+ bool band_ass_curr_sess; /* true if "band" was set after last POWEROFF */
enum gsm_band band;
struct dev_band_desc band_desc;
size_t tx_spp, rx_spp;