aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M
diff options
context:
space:
mode:
authorJoachim Steiger <jsteiger@sysmocom.de>2019-04-16 16:22:23 +0200
committerHarald Welte <laforge@gnumonks.org>2019-04-17 18:24:11 +0000
commit2d130fb15db2162ac20f5db0cc863d462b29e125 (patch)
tree154185791b07b457d763235dd9890f5c1ffe7dc0 /Transceiver52M
parent6c5f4bae4665af581badeda3b2957bb9f92b49a9 (diff)
lms: move LMS_EnableChannel from Start/Stop to Open/Close device
move enable: it is important that channels are actually enabled before applying any configuration (besides external clock) move disable: move to close, so channels are not disabled and not enabled again while osmotrx is active. Change-Id: I82878913254ce15a85db8d006e13d5eb639793e9
Diffstat (limited to 'Transceiver52M')
-rw-r--r--Transceiver52M/device/lms/LMSDevice.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 33e3cbd..45427cf 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -78,8 +78,14 @@ LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t c
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 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
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 @@ bool LMSDevice::start()
/* 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 @@ bool LMSDevice::stop()
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;