From b9514a6db3ebd06b8ddeddc1283c530d59d60aaf Mon Sep 17 00:00:00 2001
From: Sugandha Gupta <sugandha.gupta@ettus.com>
Date: Wed, 12 Sep 2018 16:28:04 -0700
Subject: e320: Fix master_clock_rate setting

The master clock rate was getting overwritten while
running the codec loopback self test. So now we save the
current rate before running the test and then reapply it.
---
 host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'host/lib')

diff --git a/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp
index 4bf9b7573..71e467848 100644
--- a/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp
+++ b/host/lib/usrp/dboard/neon/neon_radio_ctrl_impl.cpp
@@ -130,6 +130,8 @@ void neon_radio_ctrl_impl::loopback_self_test(
         std::function<void(uint32_t)> poker_functor,
         std::function<uint64_t()> peeker_functor
 ) {
+    // Save current rate before running this test
+    const double current_rate = this->get_rate();
     // Set 2R2T mode, stream on all channels
     this->set_streaming_mode(true, true, true, true);
     // Set maximum rate for 2R2T mode
@@ -180,6 +182,8 @@ void neon_radio_ctrl_impl::loopback_self_test(
     // Take AD936x out of loopback mode
     _ad9361->data_port_loopback(false);
     this->set_streaming_mode(true, false, true, false);
+    // Switch back to current rate
+    this->set_rate(current_rate);
 }
 
 double neon_radio_ctrl_impl::set_rate(const double rate)
-- 
cgit v1.2.3