Change in osmo-trx[master]: move LMS_EnableChannel from Start/Stop to Open/Close device

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

roh gerrit-no-reply at lists.osmocom.org
Tue Apr 16 15:20:28 UTC 2019


roh has uploaded this change for review. ( https://gerrit.osmocom.org/13661


Change subject: move LMS_EnableChannel from Start/Stop to Open/Close device
......................................................................

move LMS_EnableChannel from Start/Stop to Open/Close device

Change-Id: I82878913254ce15a85db8d006e13d5eb639793e9
---
M Transceiver52M/device/lms/LMSDevice.cpp
1 file changed, 14 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/61/13661/1

diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 52ef4a4..cb41858 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -78,8 +78,14 @@
 
 LMSDevice::~LMSDevice()
 {
+	unsigned int i;
 	LOGC(DDEV, INFO) << "Closing LMS device";
 	if (m_lms_dev) {
+		/* disable all channels */
+		for (i=0; i<chans; i++) {
+			LMS_EnableChannel(m_lms_dev, LMS_CH_RX, i, false);
+			LMS_EnableChannel(m_lms_dev, LMS_CH_TX, i, false);
+		}
 		LMS_Close(m_lms_dev);
 		m_lms_dev = NULL;
 	}
@@ -194,6 +200,14 @@
 		goto out_close;
 	}
 
+	/* enable all used channels */
+	for (i=0; i<chans; i++) {
+		if (LMS_EnableChannel(m_lms_dev, LMS_CH_RX, i, true) < 0)
+			goto out_close;
+		if (LMS_EnableChannel(m_lms_dev, LMS_CH_TX, i, true) < 0)
+			goto out_close;
+	}
+
 	if (LMS_GetSampleRateRange(m_lms_dev, LMS_CH_RX, &range_sr))
 		goto out_close;
 	print_range("Sample Rate", &range_sr);
@@ -286,12 +300,6 @@
 
 	/* configure the channels/streams */
 	for (i=0; i<chans; i++) {
-		if (LMS_EnableChannel(m_lms_dev, LMS_CH_RX, i, true) < 0)
-			return false;
-
-		if (LMS_EnableChannel(m_lms_dev, LMS_CH_TX, i, true) < 0)
-			return false;
-
 		// Set gains to midpoint
 		setTxGain((minTxGain() + maxTxGain()) / 2, i);
 		setRxGain((minRxGain() + maxRxGain()) / 2, i);
@@ -348,8 +356,6 @@
 	for (i=0; i<chans; i++) {
 		LMS_DestroyStream(m_lms_dev, &m_lms_stream_tx[i]);
 		LMS_DestroyStream(m_lms_dev, &m_lms_stream_rx[i]);
-		LMS_EnableChannel(m_lms_dev, LMS_CH_RX, i, false);
-		LMS_EnableChannel(m_lms_dev, LMS_CH_TX, i, false);
 	}
 
 	started = false;

-- 
To view, visit https://gerrit.osmocom.org/13661
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82878913254ce15a85db8d006e13d5eb639793e9
Gerrit-Change-Number: 13661
Gerrit-PatchSet: 1
Gerrit-Owner: roh <jsteiger at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190416/d23ba0b5/attachment.htm>


More information about the gerrit-log mailing list