aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/mpmd
diff options
context:
space:
mode:
authorLars Amsel <lars.amsel@ni.com>2021-06-04 08:27:50 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-06-10 12:01:53 -0500
commit2a575bf9b5a4942f60e979161764b9e942699e1e (patch)
tree2f0535625c30025559ebd7494a4b9e7122550a73 /host/lib/usrp/mpmd
parente17916220cc955fa219ae37f607626ba88c4afe3 (diff)
downloaduhd-2a575bf9b5a4942f60e979161764b9e942699e1e.tar.gz
uhd-2a575bf9b5a4942f60e979161764b9e942699e1e.tar.bz2
uhd-2a575bf9b5a4942f60e979161764b9e942699e1e.zip
uhd: Add support for the USRP X410
Co-authored-by: Lars Amsel <lars.amsel@ni.com> Co-authored-by: Michael Auchter <michael.auchter@ni.com> Co-authored-by: Martin Braun <martin.braun@ettus.com> Co-authored-by: Paul Butler <paul.butler@ni.com> Co-authored-by: Cristina Fuentes <cristina.fuentes-curiel@ni.com> Co-authored-by: Humberto Jimenez <humberto.jimenez@ni.com> Co-authored-by: Virendra Kakade <virendra.kakade@ni.com> Co-authored-by: Lane Kolbly <lane.kolbly@ni.com> Co-authored-by: Max Köhler <max.koehler@ni.com> Co-authored-by: Andrew Lynch <andrew.lynch@ni.com> Co-authored-by: Grant Meyerhoff <grant.meyerhoff@ni.com> Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com> Co-authored-by: Thomas Vogel <thomas.vogel@ni.com>
Diffstat (limited to 'host/lib/usrp/mpmd')
-rw-r--r--host/lib/usrp/mpmd/mpmd_devices.hpp2
-rw-r--r--host/lib/usrp/mpmd/mpmd_image_loader.cpp17
-rw-r--r--host/lib/usrp/mpmd/mpmd_mb_controller.cpp64
3 files changed, 76 insertions, 7 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_devices.hpp b/host/lib/usrp/mpmd/mpmd_devices.hpp
index 9cc046037..689e5c981 100644
--- a/host/lib/usrp/mpmd/mpmd_devices.hpp
+++ b/host/lib/usrp/mpmd/mpmd_devices.hpp
@@ -19,6 +19,6 @@ static const std::vector<std::string> MPM_DEVICE_TYPES = {
MPM_CATCHALL_DEVICE_TYPE,
"n3xx",
"e3xx",
-};
+ "x4xx"};
#endif /* INCLUDED_MPMD_DEVICES_HPP */
diff --git a/host/lib/usrp/mpmd/mpmd_image_loader.cpp b/host/lib/usrp/mpmd/mpmd_image_loader.cpp
index 145ad70c9..c15c4832c 100644
--- a/host/lib/usrp/mpmd/mpmd_image_loader.cpp
+++ b/host/lib/usrp/mpmd/mpmd_image_loader.cpp
@@ -10,10 +10,13 @@
#include <uhd/device.hpp>
#include <uhd/exception.hpp>
#include <uhd/image_loader.hpp>
+#include <uhd/rfnoc/radio_control.hpp>
+#include <uhd/rfnoc_graph.hpp>
#include <uhd/types/component_file.hpp>
#include <uhd/types/eeprom.hpp>
#include <uhd/utils/paths.hpp>
#include <uhd/utils/static.hpp>
+#include <uhdlib/features/fpga_load_notification_iface.hpp>
#include <uhdlib/utils/prefs.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/archive/iterators/binary_from_base64.hpp>
@@ -368,6 +371,19 @@ static bool mpmd_image_loader(const image_loader::image_loader_args_t& image_loa
mpmd_send_fpga_to_device(image_loader_args, dev_addr);
+ {
+ // All MPM devices use RFNoC
+ auto graph = rfnoc::rfnoc_graph::make(find_hint);
+ for (size_t mb_index = 0; mb_index < graph->get_num_mboards(); mb_index++) {
+ auto mboard = graph->get_mb_controller(mb_index);
+ if (mboard->has_feature<uhd::features::fpga_load_notification_iface>()) {
+ auto& notifier =
+ mboard->get_feature<uhd::features::fpga_load_notification_iface>();
+ notifier.onload();
+ }
+ }
+ }
+
return true;
}
@@ -385,4 +401,5 @@ UHD_STATIC_BLOCK(register_mpm_image_loader)
// time being
image_loader::register_image_loader("n3xx", mpmd_image_loader, recovery_instructions);
image_loader::register_image_loader("e3xx", mpmd_image_loader, recovery_instructions);
+ image_loader::register_image_loader("x4xx", mpmd_image_loader, recovery_instructions);
}
diff --git a/host/lib/usrp/mpmd/mpmd_mb_controller.cpp b/host/lib/usrp/mpmd/mpmd_mb_controller.cpp
index dba8713c4..9bbd324b0 100644
--- a/host/lib/usrp/mpmd/mpmd_mb_controller.cpp
+++ b/host/lib/usrp/mpmd/mpmd_mb_controller.cpp
@@ -14,6 +14,44 @@ namespace {
constexpr size_t MPMD_DEFAULT_LONG_TIMEOUT = 30000; // ms
} // namespace
+mpmd_mb_controller::fpga_onload::fpga_onload()
+{}
+
+void mpmd_mb_controller::fpga_onload::onload()
+{
+ for (auto& cb : _cbs)
+ {
+ if (auto spt = cb.lock())
+ {
+ spt->onload();
+ }
+ }
+}
+
+void mpmd_mb_controller::fpga_onload::request_cb(uhd::features::fpga_load_notification_iface::sptr handler)
+{
+ _cbs.emplace_back(handler);
+}
+
+mpmd_mb_controller::ref_clk_calibration::ref_clk_calibration(uhd::usrp::mpmd_rpc_iface::sptr rpcc)
+ : _rpcc(rpcc)
+{}
+
+void mpmd_mb_controller::ref_clk_calibration::set_ref_clk_tuning_word(uint32_t tuning_word)
+{
+ _rpcc->set_ref_clk_tuning_word(tuning_word);
+}
+
+uint32_t mpmd_mb_controller::ref_clk_calibration::get_ref_clk_tuning_word()
+{
+ return _rpcc->get_ref_clk_tuning_word();
+}
+
+void mpmd_mb_controller::ref_clk_calibration::store_ref_clk_tuning_word(uint32_t tuning_word)
+{
+ _rpcc->store_ref_clk_tuning_word(tuning_word);
+}
+
mpmd_mb_controller::mpmd_mb_controller(
uhd::usrp::mpmd_rpc_iface::sptr rpcc, uhd::device_addr_t device_info)
: _rpc(rpcc), _device_info(device_info)
@@ -33,6 +71,14 @@ mpmd_mb_controller::mpmd_mb_controller(
for (const auto& bank : _gpio_banks) {
_gpio_srcs.insert({bank, _rpc->get_gpio_srcs(bank)});
}
+
+ _fpga_onload = std::make_shared<fpga_onload>();
+ register_feature(_fpga_onload);
+
+ if (_rpc->supports_feature("ref_clk_calibration")) {
+ _ref_clk_cal = std::make_shared<ref_clk_calibration>(_rpc);
+ register_feature(_ref_clk_cal);
+ }
}
/******************************************************************************
@@ -142,16 +188,22 @@ std::vector<device_addr_t> mpmd_mb_controller::get_sync_sources()
return result;
}
-void mpmd_mb_controller::set_clock_source_out(const bool /*enb*/)
+void mpmd_mb_controller::set_clock_source_out(const bool enb)
{
- throw uhd::not_implemented_error(
- "set_clock_source_out() not implemented on this device!");
+ _rpc->set_clock_source_out(enb);
}
-void mpmd_mb_controller::set_time_source_out(const bool /*enb*/)
+void mpmd_mb_controller::set_time_source_out(const bool enb)
{
- throw uhd::not_implemented_error(
- "set_time_source_out() not implemented on this device!");
+ if (_rpc->supports_feature("time_export"))
+ {
+ _rpc->set_trigger_io(enb ? "pps_output" : "off");
+ }
+ else
+ {
+ throw uhd::not_implemented_error(
+ "set_time_source_out() not implemented on this device!");
+ }
}
sensor_value_t mpmd_mb_controller::get_sensor(const std::string& name)