diff options
-rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/cores/rx_frontend_core_200.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/cores/rx_frontend_core_3000.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/cores/tx_frontend_core_200.cpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 18 |
5 files changed, 57 insertions, 0 deletions
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index 5177bb03d..07878aed8 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -1028,6 +1028,12 @@ public: virtual void set_rx_dc_offset(const std::complex<double> &offset, size_t chan = ALL_CHANS) = 0; /*! + * Get the valid range for RX DC offset values. + * \param chan the channel index 0 to N-1 + */ + virtual meta_range_t get_rx_dc_offset_range(size_t chan = ALL_CHANS) = 0; + + /*! * Enable/disable the automatic IQ imbalance correction. * * \param enb true to enable automatic IQ balance correction @@ -1311,6 +1317,12 @@ public: virtual void set_tx_dc_offset(const std::complex<double> &offset, size_t chan = ALL_CHANS) = 0; /*! + * Get the valid range for TX DC offset values. + * \param chan the channel index 0 to N-1 + */ + virtual meta_range_t get_tx_dc_offset_range(size_t chan = ALL_CHANS) = 0; + + /*! * Set the TX frontend IQ imbalance correction. * Use this to adjust the magnitude and phase of I and Q. * diff --git a/host/lib/usrp/cores/rx_frontend_core_200.cpp b/host/lib/usrp/cores/rx_frontend_core_200.cpp index 38710db15..f0556e4b0 100644 --- a/host/lib/usrp/cores/rx_frontend_core_200.cpp +++ b/host/lib/usrp/cores/rx_frontend_core_200.cpp @@ -6,6 +6,7 @@ // #include <uhdlib/usrp/cores/rx_frontend_core_200.hpp> +#include <uhd/types/ranges.hpp> #include <boost/math/special_functions/round.hpp> #include <boost/bind.hpp> @@ -21,6 +22,11 @@ using namespace uhd; #define OFFSET_SET (1ul << 30) #define FLAG_MASK (OFFSET_FIXED | OFFSET_SET) +namespace { + static const double DC_OFFSET_MIN = -1.0; + static const double DC_OFFSET_MAX = 1.0; +} + static uint32_t fs_to_bits(const double num, const size_t bits){ return int32_t(boost::math::round(num * (1 << (bits-1)))); } @@ -71,6 +77,9 @@ public: void populate_subtree(uhd::property_tree::sptr subtree) { + subtree->create<uhd::meta_range_t>("dc_offset/range") + .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX)) + ; subtree->create<std::complex<double> >("dc_offset/value") .set(DEFAULT_DC_OFFSET_VALUE) .set_coercer(boost::bind(&rx_frontend_core_200::set_dc_offset, this, _1)) diff --git a/host/lib/usrp/cores/rx_frontend_core_3000.cpp b/host/lib/usrp/cores/rx_frontend_core_3000.cpp index cf1a105d8..841a72d9b 100644 --- a/host/lib/usrp/cores/rx_frontend_core_3000.cpp +++ b/host/lib/usrp/cores/rx_frontend_core_3000.cpp @@ -6,6 +6,7 @@ // #include <uhd/types/dict.hpp> +#include <uhd/types/ranges.hpp> #include <uhdlib/usrp/cores/rx_frontend_core_3000.hpp> #include <uhdlib/usrp/cores/dsp_core_utils.hpp> #include <boost/math/special_functions/round.hpp> @@ -34,6 +35,11 @@ using namespace uhd; #define OFFSET_SET (1ul << 30) #define FLAG_MASK (OFFSET_FIXED | OFFSET_SET) +namespace { + static const double DC_OFFSET_MIN = -1.0; + static const double DC_OFFSET_MAX = 1.0; +} + using namespace uhd::usrp; static uint32_t fs_to_bits(const double num, const size_t bits){ @@ -138,6 +144,9 @@ public: } void populate_subtree(uhd::property_tree::sptr subtree) { + subtree->create<uhd::meta_range_t>("dc_offset/range") + .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX)) + ; subtree->create<std::complex<double> >("dc_offset/value") .set(DEFAULT_DC_OFFSET_VALUE) .set_coercer(boost::bind(&rx_frontend_core_3000::set_dc_offset, this, _1)) diff --git a/host/lib/usrp/cores/tx_frontend_core_200.cpp b/host/lib/usrp/cores/tx_frontend_core_200.cpp index 7e23e2515..d44a618bc 100644 --- a/host/lib/usrp/cores/tx_frontend_core_200.cpp +++ b/host/lib/usrp/cores/tx_frontend_core_200.cpp @@ -7,6 +7,7 @@ #include <uhdlib/usrp/cores/tx_frontend_core_200.hpp> #include <uhd/types/dict.hpp> +#include <uhd/types/ranges.hpp> #include <uhd/exception.hpp> #include <boost/assign/list_of.hpp> #include <boost/math/special_functions/round.hpp> @@ -23,6 +24,11 @@ using namespace uhd; const std::complex<double> tx_frontend_core_200::DEFAULT_DC_OFFSET_VALUE = std::complex<double>(0.0, 0.0); const std::complex<double> tx_frontend_core_200::DEFAULT_IQ_BALANCE_VALUE = std::complex<double>(0.0, 0.0); +namespace { + static const double DC_OFFSET_MIN = -1.0; + static const double DC_OFFSET_MAX = 1.0; +} + static uint32_t fs_to_bits(const double num, const size_t bits){ return int32_t(boost::math::round(num * (1 << (bits-1)))); } @@ -67,6 +73,9 @@ public: void populate_subtree(uhd::property_tree::sptr subtree) { + subtree->create<uhd::meta_range_t>("dc_offset/range") + .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX)) + ; subtree->create< std::complex<double> >("dc_offset/value") .set(DEFAULT_DC_OFFSET_VALUE) .set_coercer(boost::bind(&tx_frontend_core_200::set_dc_offset, this, _1)) diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 48da5023b..1d8a0fd7a 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -1541,6 +1541,15 @@ public: } } + meta_range_t get_rx_dc_offset_range(size_t chan) { + if (_tree->exists(rx_fe_root(chan) / "dc_offset" / "range")) { + return _tree->access<uhd::meta_range_t>(rx_fe_root(chan) / "dc_offset" / "range").get(); + } else { + UHD_LOGGER_WARNING("MULTI_USRP") << "This device does not support querying the RX DC offset range." ; + return meta_range_t(0, 0); + } + } + void set_rx_iq_balance(const bool enb, size_t chan){ if (chan != ALL_CHANS){ if (_tree->exists(rx_rf_fe_root(chan) / "iq_balance" / "enable")) { @@ -1912,6 +1921,15 @@ public: } } + meta_range_t get_tx_dc_offset_range(size_t chan) { + if (_tree->exists(tx_fe_root(chan) / "dc_offset" / "range")) { + return _tree->access<uhd::meta_range_t>(tx_fe_root(chan) / "dc_offset" / "range").get(); + } else { + UHD_LOGGER_WARNING("MULTI_USRP") << "This device does not support querying the TX DC offset range." ; + return meta_range_t(0, 0); + } + } + void set_tx_iq_balance(const std::complex<double> &offset, size_t chan){ if (chan != ALL_CHANS){ if (_tree->exists(tx_fe_root(chan) / "iq_balance" / "value")) { |