diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-07-30 16:52:54 -0700 |
---|---|---|
committer | Brent Stapleton <bstapleton@g.hmc.edu> | 2018-10-11 17:54:23 -0700 |
commit | b66f3701a7c3c34b08f3e977c385f8343fa2c852 (patch) | |
tree | 612caff96a5e439d58f4b50f03c9d62a11547e6f /host/include | |
parent | bf3d9ac2f4574feccc6578bc3eb743e7be07f50f (diff) | |
download | uhd-b66f3701a7c3c34b08f3e977c385f8343fa2c852.tar.gz uhd-b66f3701a7c3c34b08f3e977c385f8343fa2c852.tar.bz2 uhd-b66f3701a7c3c34b08f3e977c385f8343fa2c852.zip |
multi_usrp: Add sync_source API
The sync_source API is an atomic setter for all sync-related settings.
If supported by the underlying USRP, it can be faster to call
set_sync_source() rather than sequentially calling set_clock_source()
and set_time_source().
If the underlying device does not support the sync_source API, it will
fall back to the set_clock_source() and set_time_source() APIs, making
this change backward-compatiple.
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index efb4b5eed..73fb58332 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -389,6 +389,57 @@ public: */ virtual std::vector<std::string> get_clock_sources(const size_t mboard) = 0; + /*! Set the reference/synchronization sources for the USRP device + * + * This is a shorthand for calling + * `set_sync_source(device_addr_t("clock_source=$CLOCK_SOURCE,time_source=$TIME_SOURCE"))` + * + * \param clock_source A string representing the clock source + * \param time_source A string representing the time source + * \param mboard which motherboard to set the config + * \throws uhd::value_error if the sources don't actually exist + */ + virtual void set_sync_source( + const std::string &clock_source, + const std::string &time_source, + const size_t mboard = ALL_MBOARDS + ) = 0; + + /*! Set the reference/synchronization sources for the USRP device + * + * Typically, this will set both clock and time source in a single call. For + * some USRPs, this may be significantly faster than calling + * set_time_source() and set_clock_source() individually. + * + * Example: + * ~~~{.cpp} + * auto usrp = uhd::usrp::multi_usrp::make(""); + * usrp->set_sync_source(device_addr_t("clock_source=external,time_source=external")); + * ~~~ + * + * \param sync_source A dictionary representing the various source settings. + * \param mboard which motherboard to set the config + * \throws uhd::value_error if the sources don't actually exist + */ + virtual void set_sync_source( + const device_addr_t& sync_source, + const size_t mboard = ALL_MBOARDS + ) = 0; + + /*! Get the currently set sync source. + * + * \param mboard which motherboard to get the config + * \return the dictionary representing the sync source settings + */ + virtual device_addr_t get_sync_source(const size_t mboard) = 0; + + /*! Get a list of available sync sources + * + * \param mboard which motherboard to get the config + * \return the dictionary representing the sync source settings + */ + virtual std::vector<device_addr_t> get_sync_sources(const size_t mboard) = 0; + /*! * Send the clock source to an output connector. * This call is only applicable on devices with reference outputs. |