diff options
Diffstat (limited to 'host/lib/usrp')
3 files changed, 19 insertions, 1 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp b/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp index 6a14f3976..d7d1b43de 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.cpp @@ -5,6 +5,7 @@  //  #include "magnesium_ad9371_iface.hpp" +#include "magnesium_constants.hpp"  #include <uhd/utils/log.hpp>  using namespace uhd; @@ -42,7 +43,8 @@ double magnesium_ad9371_iface::set_frequency(  {      // Note: This sets the frequency for both channels (1 and 2).      auto which       = _get_which(dir, chan); -    auto actual_freq = request<double>("set_freq", which, freq, false); +    auto actual_freq = +        request<double>(MAGNESIUM_TUNE_TIMEOUT, "set_freq", which, freq, false);      UHD_LOG_TRACE(_log_prefix, _rpc_prefix << "set_freq returned " << actual_freq);      return actual_freq;  } diff --git a/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.hpp b/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.hpp index 245c302ba..63972a54c 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_ad9371_iface.hpp @@ -50,6 +50,19 @@ private:              _rpc_prefix + func_name, std::forward<Args>(args)...);      }; +    /*! Shorthand to perform an RPC request with timeout. +     */ +    template <typename return_type, typename... Args> +    return_type request(uint64_t timeout_ms, std::string const& func_name, Args&&... args) +    { +        UHD_LOG_TRACE(_log_prefix, "[RPC] Calling " << func_name); +        return _rpcc->request_with_token<return_type>( +                timeout_ms, +                _rpc_prefix + func_name, +                std::forward<Args>(args)... +        ); +    }; +      //! Reference to the RPC client      uhd::rpc_client::sptr _rpcc; diff --git a/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp b/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp index a045d0558..9b3bdf800 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp @@ -76,4 +76,7 @@ static constexpr size_t MAGNESIUM_NUM_CHANS  = 2;  static constexpr double MAGNESIUM_RX_IF_FREQ = 2.44e9;  static constexpr double MAGNESIUM_TX_IF_FREQ = 1.95e9; +//! Max time we allow for a call to set_freq() to take +static constexpr size_t MAGNESIUM_TUNE_TIMEOUT = 15000; // milliseconds +  #endif /* INCLUDED_LIBUHD_MAGNESIUM_CONSTANTS_HPP */  | 
