aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2019-02-26 16:03:48 -0800
committerMichael West <michael.west@ettus.com>2019-03-05 10:33:06 -0800
commitdd61c2376f62b42e06844fd23522138eb7c01a04 (patch)
tree0fb39e72f2e22d348d99644e0aa94a75d6a4449d
parent10843679bde75cd77b0d6d518177a07b1949ade8 (diff)
downloaduhd-dd61c2376f62b42e06844fd23522138eb7c01a04.tar.gz
uhd-dd61c2376f62b42e06844fd23522138eb7c01a04.tar.bz2
uhd-dd61c2376f62b42e06844fd23522138eb7c01a04.zip
x300: Catch more inconsistencies in x300_device_args
- ADC self test had magic numbers for default duration - resource and addr can be no longer be both specified without a warning - second_addr requires addr now, or you get a warning
-rw-r--r--host/lib/usrp/x300/x300_defaults.hpp2
-rw-r--r--host/lib/usrp/x300/x300_device_args.hpp25
2 files changed, 24 insertions, 3 deletions
diff --git a/host/lib/usrp/x300/x300_defaults.hpp b/host/lib/usrp/x300/x300_defaults.hpp
index 5956686d0..55991587a 100644
--- a/host/lib/usrp/x300/x300_defaults.hpp
+++ b/host/lib/usrp/x300/x300_defaults.hpp
@@ -102,6 +102,8 @@ static const size_t MAX_RATE_1GIGE = (size_t)( // bytes/s
/ float(GE_DATA_FRAME_RECV_SIZE
+ 8 /* UDP header */ + 20 /* Ethernet header length */)));
+static constexpr double DEFAULT_EXT_ADC_SELF_TEST_DURATION = 30.0;
+
}}} /* namespace uhd::usrp::x300 */
#endif /* INCLUDED_X300_DEFAULTS_HPP */
diff --git a/host/lib/usrp/x300/x300_device_args.hpp b/host/lib/usrp/x300/x300_device_args.hpp
index b9294b48b..05238a7d1 100644
--- a/host/lib/usrp/x300/x300_device_args.hpp
+++ b/host/lib/usrp/x300/x300_device_args.hpp
@@ -27,7 +27,8 @@ public:
, _resource("resource", "")
, _self_cal_adc_delay("self_cal_adc_delay", false)
, _ext_adc_self_test("ext_adc_self_test", false)
- , _ext_adc_self_test_duration("ext_adc_self_test", 30.0)
+ , _ext_adc_self_test_duration(
+ "ext_adc_self_test", DEFAULT_EXT_ADC_SELF_TEST_DURATION)
, _recover_mb_eeprom("recover_mb_eeprom", false)
, _ignore_cal_file("ignore_cal_file", false)
, _niusrprio_rpc_port("niusrprio_rpc_port", NIUSRPRIO_DEFAULT_RPC_PORT)
@@ -136,7 +137,9 @@ public:
+ (_self_cal_adc_delay.get() ? (_self_cal_adc_delay.to_string() + ", ")
: "")
+ (_ext_adc_self_test.get() ? (_ext_adc_self_test.to_string() + ", ") : "")
- + (_ext_adc_self_test.get() && (_ext_adc_self_test_duration.get() != 30.0)
+ + (_ext_adc_self_test.get()
+ && (_ext_adc_self_test_duration.get()
+ != DEFAULT_EXT_ADC_SELF_TEST_DURATION)
? (_ext_adc_self_test.to_string() + ", ")
: "")
+ (_recover_mb_eeprom.get() ? (_recover_mb_eeprom.to_string() + ", ") : "")
@@ -180,7 +183,23 @@ private:
PARSE_DEFAULT(_first_addr)
PARSE_DEFAULT(_second_addr)
PARSE_DEFAULT(_resource)
- PARSE_DEFAULT(_resource)
+ if (_first_addr.get().empty() && !_second_addr.get().empty()) {
+ UHD_LOG_WARNING("X300",
+ "Specifying `second_addr' without `addr'is inconsistent and has "
+ "undefined behaviour. This will be no longer allowed in future "
+ "versions of UHD.");
+ } else if (!_first_addr.get().empty() && _second_addr.get().empty()
+ && _first_addr.get() == _second_addr.get()) {
+ UHD_LOG_WARNING("X300",
+ "Specifying `addr' identical to `second_addr' has no effect. "
+ "`second_addr' will be ignored.");
+ }
+ if (!_resource.get().empty() && !_first_addr.get().empty()) {
+ UHD_LOG_WARNING("X300",
+ "Specifying both `resource' and `addr' is inconsistent and has "
+ "undefined behaviour. This will be no longer allowed in future "
+ "versions of UHD.");
+ }
PARSE_DEFAULT(_self_cal_adc_delay)
if (dev_args.has_key("ext_adc_self_test")) {
_ext_adc_self_test.set(true);