aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2016-10-17 17:26:14 -0700
committerMartin Braun <martin.braun@ettus.com>2016-10-17 17:26:14 -0700
commitd172b44f157a1429de69599cf0a06aa61fa7a274 (patch)
tree239d6edf32ac2ca18eed392ce0ee090bdfb4c1ab /host/lib
parent1b70b3e70df40aae4d1e53037212d77af2fdc4e4 (diff)
parent9e73914791be936216ea11eea9bd38061ef5f323 (diff)
downloaduhd-d172b44f157a1429de69599cf0a06aa61fa7a274.tar.gz
uhd-d172b44f157a1429de69599cf0a06aa61fa7a274.tar.bz2
uhd-d172b44f157a1429de69599cf0a06aa61fa7a274.zip
Merge branch 'maint'
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/rfnoc/node_ctrl_base.cpp47
-rw-r--r--host/lib/rfnoc/radio_ctrl_impl.hpp2
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp10
3 files changed, 57 insertions, 2 deletions
diff --git a/host/lib/rfnoc/node_ctrl_base.cpp b/host/lib/rfnoc/node_ctrl_base.cpp
index 6e19d276a..b4d0a30ff 100644
--- a/host/lib/rfnoc/node_ctrl_base.cpp
+++ b/host/lib/rfnoc/node_ctrl_base.cpp
@@ -17,6 +17,7 @@
#include <uhd/rfnoc/node_ctrl_base.hpp>
#include <uhd/utils/msg.hpp>
+#include <boost/range/adaptor/map.hpp>
using namespace uhd::rfnoc;
@@ -101,3 +102,49 @@ size_t node_ctrl_base::get_upstream_port(const size_t this_port)
return _upstream_ports[this_port];
}
+void node_ctrl_base::disconnect()
+{
+ // Notify neighbours:
+ for (node_map_t::iterator i = _downstream_nodes.begin(); i != _downstream_nodes.end(); ++i) {
+ sptr downstream_node = i->second.lock();
+ if (not downstream_node) {
+ // Actually this is not OK
+ continue;
+ }
+ downstream_node->disconnect_input_port(_downstream_ports[i->first]);
+ }
+ for (node_map_t::iterator i = _upstream_nodes.begin(); i != _upstream_nodes.end(); ++i) {
+ sptr upstream_node = i->second.lock();
+ if (not upstream_node) {
+ // Actually this is not OK
+ continue;
+ }
+ upstream_node->disconnect_output_port(_upstream_ports[i->first]);
+ }
+ // Clear own maps:
+ _downstream_nodes.clear();
+ _downstream_ports.clear();
+ _upstream_nodes.clear();
+ _upstream_ports.clear();
+}
+
+void node_ctrl_base::disconnect_output_port(const size_t output_port)
+{
+ if (_downstream_nodes.count(output_port) == 0 or
+ _downstream_ports.count(output_port) == 0) {
+ throw uhd::assertion_error(str(boost::format("[%s] Attempting to disconnect output port %u, which is not registered as connected!") % unique_id() % output_port));
+ }
+ _downstream_nodes.erase(output_port);
+ _downstream_ports.erase(output_port);
+}
+
+void node_ctrl_base::disconnect_input_port(const size_t input_port)
+{
+ if (_upstream_nodes.count(input_port) == 0 or
+ _upstream_ports.count(input_port) == 0) {
+ throw uhd::assertion_error(str(boost::format("[%s] Attempting to disconnect input port %u, which is not registered as connected!") % unique_id() % input_port));
+ }
+ _upstream_nodes.erase(input_port);
+ _upstream_ports.erase(input_port);
+}
+
diff --git a/host/lib/rfnoc/radio_ctrl_impl.hpp b/host/lib/rfnoc/radio_ctrl_impl.hpp
index 4224ec5c4..881cce3b4 100644
--- a/host/lib/rfnoc/radio_ctrl_impl.hpp
+++ b/host/lib/rfnoc/radio_ctrl_impl.hpp
@@ -60,7 +60,6 @@ public:
virtual double set_rx_frequency(const double freq, const size_t chan);
virtual double set_tx_gain(const double gain, const size_t chan);
virtual double set_rx_gain(const double gain, const size_t chan);
- virtual void set_time_sync(const uhd::time_spec_t &time);
virtual double get_rate() const;
virtual std::string get_tx_antenna(const size_t chan) /* const */;
@@ -72,6 +71,7 @@ public:
void set_time_now(const time_spec_t &time_spec);
void set_time_next_pps(const time_spec_t &time_spec);
+ void set_time_sync(const uhd::time_spec_t &time);
time_spec_t get_time_now();
time_spec_t get_time_last_pps();
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index e4f6d6fb8..776fac928 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -986,9 +986,17 @@ void x300_impl::setup_mb(const size_t mb_i, const uhd::device_addr_t &dev_addr)
mb.radios.at(i)->self_test_adc();
}
}
+
+ ////////////////////////////////////////////////////////////////////
+ // Synchronize times (dboard initialization can desynchronize them)
+ ////////////////////////////////////////////////////////////////////
+ if (radio_ids.size() == 2) {
+ this->sync_times(mb, mb.radios[0]->get_time_now());
+ }
+
} else {
UHD_MSG(status) << "No Radio Block found. Assuming radio-less operation." << std::endl;
- }
+ } /* end of radio block(s) initialization */
mb.initialization_done = true;
}