diff options
Diffstat (limited to 'gr-uhd/lib/usrp_source_impl.cc')
-rw-r--r-- | gr-uhd/lib/usrp_source_impl.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gr-uhd/lib/usrp_source_impl.cc b/gr-uhd/lib/usrp_source_impl.cc index c840c43db1..8cdaebc4ca 100644 --- a/gr-uhd/lib/usrp_source_impl.cc +++ b/gr-uhd/lib/usrp_source_impl.cc @@ -154,12 +154,16 @@ namespace gr { void usrp_source_impl::set_normalized_gain(double norm_gain, size_t chan) { +#ifdef UHD_USRP_MULTI_USRP_NORMALIZED_GAIN + _dev->set_normalized_rx_gain(norm_gain, chan); +#else if (norm_gain > 1.0 || norm_gain < 0.0) { throw std::runtime_error("Normalized gain out of range, must be in [0, 1]."); } ::uhd::gain_range_t gain_range = get_gain_range(chan); double abs_gain = (norm_gain * (gain_range.stop() - gain_range.start())) + gain_range.start(); set_gain(abs_gain, chan); +#endif } double @@ -179,6 +183,9 @@ namespace gr { double usrp_source_impl::get_normalized_gain(size_t chan) { +#ifdef UHD_USRP_MULTI_USRP_NORMALIZED_GAIN + return _dev->get_normalized_rx_gain(chan); +#else ::uhd::gain_range_t gain_range = get_gain_range(chan); double norm_gain = (get_gain(chan) - gain_range.start()) / @@ -187,6 +194,7 @@ namespace gr { if (norm_gain > 1.0) return 1.0; if (norm_gain < 0.0) return 0.0; return norm_gain; +#endif } std::vector<std::string> @@ -553,6 +561,7 @@ namespace gr { gr_vector_void_star &output_items) { boost::recursive_mutex::scoped_lock lock(d_mutex); + boost::this_thread::disable_interruption disable_interrupt; //In order to allow for low-latency: //We receive all available packets without timeout. //This call can timeout under regular operation... @@ -563,6 +572,7 @@ namespace gr { _recv_timeout, true /* one packet -> minimize latency */ ); + boost::this_thread::restore_interruption restore_interrupt(disable_interrupt); //handle possible errors conditions switch(_metadata.error_code) { |