aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/usrp/multi_usrp.hpp27
-rw-r--r--host/lib/usrp/multi_usrp.cpp12
2 files changed, 39 insertions, 0 deletions
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp
index c2b905426..9e098d3e1 100644
--- a/host/include/uhd/usrp/multi_usrp.hpp
+++ b/host/include/uhd/usrp/multi_usrp.hpp
@@ -33,6 +33,7 @@
#include <uhd/types/tune_result.hpp>
#include <uhd/types/sensors.hpp>
#include <uhd/types/filters.hpp>
+#include <uhd/types/wb_iface.hpp>
#include <uhd/usrp/subdev_spec.hpp>
#include <uhd/usrp/dboard_iface.hpp>
#include <boost/shared_ptr.hpp>
@@ -437,6 +438,32 @@ public:
*/
virtual void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard = ALL_MBOARDS) = 0;
+ /*! Return a user settings interface object
+ *
+ * This is only supported by some USRPs (B2xx series, N230). It will return
+ * an object that will allow to peek and poke user settings, which typically
+ * are implemented by custom FPGA images.
+ * If the device does not support such an interface, it will return a null
+ * pointer. This allows to probe this functionality, but can lead to
+ * dereferencing errors if no checks are performed.
+ *
+ * A typical way to use this is as follows:
+ * ~~~~{.cpp}
+ * auto usrp = multi_usrp::make(device_args);
+ * const size_t chan = 0;
+ * auto user_settings = usrp->get_user_settings_iface(chan);
+ * if (!user_settings) {
+ * std::cout << "No user settings!" << std::endl;
+ * } else {
+ * user_settings->poke32(0, 23); // Write value 23 to register 0
+ * }
+ * ~~~~
+ *
+ * \returns Either a uhd::wb_iface object to poke the user settings, or a
+ * nullptr if the device doesn't support this interface.
+ */
+ virtual uhd::wb_iface::sptr get_user_settings_iface(const size_t chan = 0) = 0;
+
/*******************************************************************
* RX methods
******************************************************************/
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp
index 1985da254..687f1c06d 100644
--- a/host/lib/usrp/multi_usrp.cpp
+++ b/host/lib/usrp/multi_usrp.cpp
@@ -820,6 +820,18 @@ public:
}
}
+ wb_iface::sptr get_user_settings_iface(const size_t chan)
+ {
+ const auto user_settings_path =
+ rx_rf_fe_root(chan) / "user_settings" / "iface";
+ if (_tree->exists(user_settings_path)) {
+ return _tree->access<wb_iface::sptr>(user_settings_path).get();
+ }
+ UHD_LOG_WARNING("MULTI_USRP",
+ "Attempting to read back non-existant user settings iface!");
+ return nullptr;
+ }
+
/*******************************************************************
* RX methods
******************************************************************/