diff options
| -rw-r--r-- | host/lib/usrp/dboard/magnesium/magnesium_constants.hpp | 3 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp | 8 | 
2 files changed, 7 insertions, 4 deletions
| diff --git a/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp b/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp index 2e9debaae..e19603b94 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_constants.hpp @@ -10,6 +10,7 @@  #include <vector>  #include <string>  #include <cstddef> +#include <uhd/types/ranges.hpp>  static constexpr size_t FPGPIO_MASTER_RADIO = 0;  static constexpr size_t TOTAL_RADIO_PORTS = 4; @@ -51,6 +52,8 @@ static constexpr double ALL_TX_MIN_GAIN = 0.0;  static constexpr double ALL_TX_MAX_GAIN = 65.0;  static constexpr double ALL_TX_GAIN_STEP = 0.5; +static const uhd::freq_range_t MAGNESIUM_FREQ_RANGE(MAGNESIUM_MIN_FREQ, MAGNESIUM_MAX_FREQ); +  static const std::vector<std::string> MAGNESIUM_RX_ANTENNAS = {      "TX/RX", "RX2", "CAL", "LOCAL"  }; diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp index 3fd32bda9..d27531a2b 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp @@ -206,10 +206,10 @@ void magnesium_radio_ctrl_impl::set_rx_antenna(  }  double magnesium_radio_ctrl_impl::set_tx_frequency( -        const double freq, +        const double req_freq,          const size_t chan  ) { -    // FIXME bounds checking + clipping!!! +    const double freq = MAGNESIUM_FREQ_RANGE.clip(req_freq);      UHD_LOG_TRACE(unique_id(),          "set_tx_frequency(f=" << freq << ", chan=" << chan << ")");      _desired_rf_freq[TX_DIRECTION]=freq; @@ -289,10 +289,10 @@ void magnesium_radio_ctrl_impl::_update_freq(  }  double magnesium_radio_ctrl_impl::set_rx_frequency( -        const double freq, +        const double req_freq,          const size_t chan  ) { -    // FIXME bounds checking + clipping!!! +    const double freq = MAGNESIUM_FREQ_RANGE.clip(req_freq);      UHD_LOG_TRACE(unique_id(),          "set_rx_frequency(f=" << freq << ", chan=" << chan << ")");      _desired_rf_freq[RX_DIRECTION]=freq; | 
