Change in osmo-trx[master]: lms, uhd: Allow changing band between poweroff & poweron

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

pespin gerrit-no-reply at lists.osmocom.org
Wed Sep 22 10:50:57 UTC 2021


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

Change subject: lms,uhd: Allow changing band between poweroff & poweron
......................................................................

lms,uhd: Allow changing band between poweroff & poweron

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
---
M Transceiver52M/device/lms/LMSDevice.cpp
M Transceiver52M/device/lms/LMSDevice.h
M Transceiver52M/device/uhd/UHDDevice.cpp
M Transceiver52M/device/uhd/UHDDevice.h
4 files changed, 16 insertions(+), 7 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  osmith: Looks good to me, but someone else must approve



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 @@
 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 @@
 
 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 @@
 		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 @@
 	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 @@
 		       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 @@
 
 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 @@
 	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 @@
 
 	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;

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

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I43e5e1e4dcb36be605c6bd25dd6a5f3649e244e7
Gerrit-Change-Number: 25524
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210922/c653bbe8/attachment.htm>


More information about the gerrit-log mailing list