aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMark Meserve <mark.meserve@ni.com>2018-10-15 15:03:48 -0500
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-11-01 11:58:20 -0700
commit44eb4b4b43a58324854ce50ef983331c98125eeb (patch)
treea02f01ee0d052ff67af5e98e952f504e0435b6d7 /host
parent09136828d4b1b6c9123651f9e2e1894ada436038 (diff)
downloaduhd-44eb4b4b43a58324854ce50ef983331c98125eeb.tar.gz
uhd-44eb4b4b43a58324854ce50ef983331c98125eeb.tar.bz2
uhd-44eb4b4b43a58324854ce50ef983331c98125eeb.zip
rh: fix handling of spur_dodging arg
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/dboard/rhodium/rhodium_constants.hpp4
-rw-r--r--host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.cpp22
-rw-r--r--host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_init.cpp11
3 files changed, 30 insertions, 7 deletions
diff --git a/host/lib/usrp/dboard/rhodium/rhodium_constants.hpp b/host/lib/usrp/dboard/rhodium/rhodium_constants.hpp
index 82ed5b4c8..1d76994d0 100644
--- a/host/lib/usrp/dboard/rhodium/rhodium_constants.hpp
+++ b/host/lib/usrp/dboard/rhodium/rhodium_constants.hpp
@@ -51,6 +51,10 @@ static const std::vector<std::string> RHODIUM_TX_ANTENNAS = {
"TX/RX", "CAL", "TERM"
};
+// These names are taken from radio_rhodium.xml
+static constexpr char SPUR_DODGING_ARG_NAME[] = "spur_dodging";
+static constexpr char SPUR_DODGING_THRESHOLD_ARG_NAME[] = "spur_dodging_threshold";
+
static constexpr uint32_t SW10_GPIO_MASK = 0x3;
//! Main LO
diff --git a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.cpp
index b9c56a7f0..01f467476 100644
--- a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.cpp
+++ b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_impl.cpp
@@ -309,19 +309,23 @@ uhd::gain_range_t rhodium_radio_ctrl_impl::_get_gain_range(direction_t dir)
bool rhodium_radio_ctrl_impl::_get_spur_dodging_enabled(uhd::direction_t dir) const
{
+ UHD_ASSERT_THROW(_tree->exists(get_arg_path(SPUR_DODGING_ARG_NAME) / "value"));
+ auto block_value = _tree->access<std::string>(get_arg_path(SPUR_DODGING_ARG_NAME) / "value").get();
auto dict = _get_tune_args(_tree, _radio_slot, dir);
// get the current tune_arg for spur_dodging
- // if the tune_arg doesn't exist, get the radio block argument instead
+ // if the tune_arg doesn't exist, use the radio block argument instead
std::string spur_dodging_arg = dict.cast<std::string>(
- "spur_dodging",
- (_tree->access<std::string>(get_arg_path("spur_dodging") / "value").get()));
+ SPUR_DODGING_ARG_NAME,
+ block_value);
if (spur_dodging_arg == "enabled")
{
+ UHD_LOG_TRACE(unique_id(), "_get_spur_dodging_enabled returning enabled");
return true;
}
else if (spur_dodging_arg == "disabled") {
+ UHD_LOG_TRACE(unique_id(), "_get_spur_dodging_enabled returning disabled");
return false;
}
else {
@@ -333,13 +337,17 @@ bool rhodium_radio_ctrl_impl::_get_spur_dodging_enabled(uhd::direction_t dir) co
double rhodium_radio_ctrl_impl::_get_spur_dodging_threshold(uhd::direction_t dir) const
{
+ UHD_ASSERT_THROW(_tree->exists(get_arg_path(SPUR_DODGING_THRESHOLD_ARG_NAME) / "value"));
+ auto block_value = _tree->access<double>(get_arg_path(SPUR_DODGING_THRESHOLD_ARG_NAME) / "value").get();
auto dict = _get_tune_args(_tree, _radio_slot, dir);
// get the current tune_arg for spur_dodging_threshold
- // if the tune_arg doesn't exist, get the radio block argument instead
- return dict.cast(
- "spur_dodging_threshold",
- _tree->access<double>(get_arg_path("spur_dodging_threshold") / "value").get());
+ // if the tune_arg doesn't exist, use the radio block argument instead
+ auto threshold = dict.cast<double>(SPUR_DODGING_THRESHOLD_ARG_NAME, block_value);
+
+ UHD_LOG_TRACE(unique_id(), "_get_spur_dodging_threshold returning " << threshold);
+
+ return threshold;
}
size_t rhodium_radio_ctrl_impl::get_chan_from_dboard_fe(
diff --git a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_init.cpp b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_init.cpp
index c2c2002eb..8c2e6f231 100644
--- a/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_init.cpp
+++ b/host/lib/usrp/dboard/rhodium/rhodium_radio_ctrl_init.cpp
@@ -131,6 +131,17 @@ void rhodium_radio_ctrl_impl::_init_defaults()
UHD_LOG_DEBUG(unique_id(),
"Setting default spp to " << default_spp);
_tree->access<int>(get_arg_path("spp") / "value").set(default_spp);
+
+ // Update configurable block arguments from the device arguments provided
+ if (_block_args.has_key(SPUR_DODGING_ARG_NAME)) {
+ _tree->access<std::string>(get_arg_path(SPUR_DODGING_ARG_NAME) / "value")
+ .set(_block_args.get(SPUR_DODGING_ARG_NAME));
+ }
+
+ if (_block_args.has_key(SPUR_DODGING_THRESHOLD_ARG_NAME)) {
+ _tree->access<double>(get_arg_path(SPUR_DODGING_THRESHOLD_ARG_NAME) / "value")
+ .set(boost::lexical_cast<double>(_block_args.get(SPUR_DODGING_THRESHOLD_ARG_NAME)));
+ }
}
void rhodium_radio_ctrl_impl::_init_peripherals()