From d0e8f4effa356d2c8018241e78a520c50ab23f9a Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 9 Aug 2018 17:16:01 -0500 Subject: multi_usrp: Add get_user_settings_iface() API call For USRPs that support user settings (e.g., B2xx, N230), this will return an object that will allow peeking and poking user-defined settings registers. Mock code example: auto usrp = multi_usrp::make(...); auto user_settings_iface = usrp->get_user_settings_iface(); user_settings_iface->poke32(0, 23); --- host/include/uhd/usrp/multi_usrp.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'host/include') 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 #include #include +#include #include #include #include @@ -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 ******************************************************************/ -- cgit v1.2.3