From aae93861a042e18b34871e36e8e66004f777396a Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 22 Apr 2016 09:44:20 -0700 Subject: math: Fixed floating point comparison for custom delta Reviewed-By: Derek Kozel --- host/include/uhd/utils/fp_compare_delta.ipp | 2 +- host/tests/fp_compare_delta_test.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'host') diff --git a/host/include/uhd/utils/fp_compare_delta.ipp b/host/include/uhd/utils/fp_compare_delta.ipp index 49cbc281b..292ef4bf6 100644 --- a/host/include/uhd/utils/fp_compare_delta.ipp +++ b/host/include/uhd/utils/fp_compare_delta.ipp @@ -27,7 +27,7 @@ namespace uhd { namespace math { namespace fp_compare { template UHD_INLINE float_t fp_compare_select_delta(float_t lhs_delta, float_t rhs_delta) { - return ((lhs_delta < rhs_delta) ? lhs_delta : rhs_delta); + return ((lhs_delta > rhs_delta) ? lhs_delta : rhs_delta); } template<> UHD_INLINE diff --git a/host/tests/fp_compare_delta_test.cpp b/host/tests/fp_compare_delta_test.cpp index 36ff14756..d6d8a5209 100644 --- a/host/tests/fp_compare_delta_test.cpp +++ b/host/tests/fp_compare_delta_test.cpp @@ -237,6 +237,14 @@ BOOST_AUTO_TEST_CASE(double_greaterthanequals_operators) { BOOST_CHECK(double(alpha._value + 3.0008) >= alpha); } +BOOST_AUTO_TEST_CASE(fp_compare_large_delta) { + BOOST_CHECK(fp_compare_delta(61440000.047870710492, 0.1) == 61440000.000000000000); + BOOST_CHECK(fp_compare_delta(61440000.047870710492, 0.1) <= 61440000.000000000000); + BOOST_CHECK(fp_compare_delta(61440000.047870710492, 0.1) >= 61440000.000000000000); + + BOOST_CHECK(fp_compare_delta(1.0, 10.0) == 2.0); +} + BOOST_AUTO_TEST_CASE(frequency_compare_function) { BOOST_CHECK(uhd::math::frequencies_are_equal(6817333232.0, 6817333232.0)); -- cgit v1.2.3 From d010b3e4d4327f3db10147c67ec47b85b89fe0fd Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Fri, 22 Apr 2016 09:45:44 -0700 Subject: b200: Fixed setting of max rate DSP rates are now being tracked as in whether or not they've been set. We can disregard unset DSPs for the automatic clock rate calculation. Reviewed-By: Derek Kozel --- host/lib/usrp/b200/b200_impl.cpp | 9 +++++++++ host/lib/usrp/b200/b200_io_impl.cpp | 19 +++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'host') diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index 18dcdadba..327d7760d 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -731,6 +731,11 @@ b200_impl::~b200_impl(void) * setup radio control objects **********************************************************************/ +void lambda_set_bool_prop(property_tree::sptr tree, fs_path path, bool value, double) +{ + tree->access(path).set(value); +} + void b200_impl::setup_radio(const size_t dspno) { radio_perifs_t &perif = _radio_perifs[dspno]; @@ -788,8 +793,10 @@ void b200_impl::setup_radio(const size_t dspno) .subscribe(boost::bind(&rx_dsp_core_3000::set_tick_rate, perif.ddc, _1)); const fs_path rx_dsp_path = mb_path / "rx_dsps" / dspno; perif.ddc->populate_subtree(_tree->subtree(rx_dsp_path)); + _tree->create(rx_dsp_path / "rate" / "set").set(false); _tree->access(rx_dsp_path / "rate" / "value") .coerce(boost::bind(&b200_impl::coerce_rx_samp_rate, this, perif.ddc, dspno, _1)) + .subscribe(boost::bind(&lambda_set_bool_prop, _tree, rx_dsp_path / "rate" / "set", true, _1)) .subscribe(boost::bind(&b200_impl::update_rx_samp_rate, this, dspno, _1)) ; _tree->create(rx_dsp_path / "stream_cmd") @@ -803,8 +810,10 @@ void b200_impl::setup_radio(const size_t dspno) .subscribe(boost::bind(&tx_dsp_core_3000::set_tick_rate, perif.duc, _1)); const fs_path tx_dsp_path = mb_path / "tx_dsps" / dspno; perif.duc->populate_subtree(_tree->subtree(tx_dsp_path)); + _tree->create(tx_dsp_path / "rate" / "set").set(false); _tree->access(tx_dsp_path / "rate" / "value") .coerce(boost::bind(&b200_impl::coerce_tx_samp_rate, this, perif.duc, dspno, _1)) + .subscribe(boost::bind(&lambda_set_bool_prop, _tree, tx_dsp_path / "rate" / "set", true, _1)) .subscribe(boost::bind(&b200_impl::update_tx_samp_rate, this, dspno, _1)) ; diff --git a/host/lib/usrp/b200/b200_io_impl.cpp b/host/lib/usrp/b200/b200_io_impl.cpp index 93f5b22fc..ec37f2f6f 100644 --- a/host/lib/usrp/b200/b200_io_impl.cpp +++ b/host/lib/usrp/b200/b200_io_impl.cpp @@ -82,9 +82,9 @@ void b200_impl::set_auto_tick_rate( num_chans = std::max(size_t(1), max_chan_count()); } const double max_tick_rate = ad9361_device_t::AD9361_MAX_CLOCK_RATE/num_chans; + using namespace uhd::math; if (rate != 0.0 and - (uhd::math::fp_compare::fp_compare_delta(rate, uhd::math::FREQ_COMPARISON_DELTA_HZ) > - uhd::math::fp_compare::fp_compare_delta(max_tick_rate, uhd::math::FREQ_COMPARISON_DELTA_HZ))) { + (fp_compare::fp_compare_delta(rate, FREQ_COMPARISON_DELTA_HZ) > max_tick_rate)) { throw uhd::value_error(str( boost::format("Requested sampling rate (%.2f Msps) exceeds maximum tick rate of %.2f MHz.") % (rate / 1e6) % (max_tick_rate / 1e6) @@ -96,26 +96,25 @@ void b200_impl::set_auto_tick_rate( boost::uint32_t lcm_rate = (rate == 0) ? 1 : static_cast(floor(rate + 0.5)); for (int i = 0; i < 2; i++) { // Loop through rx and tx std::string dir = (i == 0) ? "tx" : "rx"; - // We have no way of knowing which DSPs are used, so we check them all. + // We assume all 'set' DSPs are being used. BOOST_FOREACH(const std::string &dsp_no, _tree->list(str(boost::format("/mboards/0/%s_dsps") % dir))) { fs_path dsp_path = str(boost::format("/mboards/0/%s_dsps/%s") % dir % dsp_no); if (dsp_path == tree_dsp_path) { continue; } + if (not _tree->access(dsp_path / "rate/set").get()) { + continue; + } double this_dsp_rate = _tree->access(dsp_path / "rate/value").get(); // Check if the user selected something completely unreasonable: - if (uhd::math::fp_compare::fp_compare_delta(this_dsp_rate, uhd::math::FREQ_COMPARISON_DELTA_HZ) > - uhd::math::fp_compare::fp_compare_delta(max_tick_rate, uhd::math::FREQ_COMPARISON_DELTA_HZ)) { + if (fp_compare::fp_compare_delta(this_dsp_rate, FREQ_COMPARISON_DELTA_HZ) > max_tick_rate) { throw uhd::value_error(str( boost::format("Requested sampling rate (%.2f Msps) exceeds maximum tick rate of %.2f MHz.") % (this_dsp_rate / 1e6) % (max_tick_rate / 1e6) )); } - // If this_dsp_rate == 0.0, the sampling rate for this DSP hasn't been set, so - // we don't take that into consideration. - if (this_dsp_rate == 0.0) { - continue; - } + // Clean up floating point rounding errors if they crept in + this_dsp_rate = std::min(max_tick_rate, this_dsp_rate); lcm_rate = boost::math::lcm( lcm_rate, static_cast(floor(this_dsp_rate + 0.5)) -- cgit v1.2.3 From 0feabd678fe3bde22e994649b9071bb05f4050d3 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 21 Apr 2016 15:32:29 -0700 Subject: Preparing maint branch for 3.9.4-RC1 - Updated changelog - Updated submodule pointer - Updated version Note: Image package was not updated for RC1 because it's unchanged from 3.9.3. --- CHANGELOG | 12 ++++++++++++ fpga-src | 2 +- host/cmake/Modules/UHDVersion.cmake | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'host') diff --git a/CHANGELOG b/CHANGELOG index b91d5fb4a..9cc22f474 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,18 @@ Change Log for Releases ============================== +## 003.009.004 +- GPIO control: Fix address mismatch for RX and full duplex. + This fixes full-duplex mode for most devices. +- B200: Fixed auto rate selection (can now select 61.44 Msps) +- UBX: Fix member declaration order which could cause + segfaults for debug builds +- Manual/Docs: Numerous fixes, use dot for graphs in manual +- Utils: multiple fixes for query_gpsdo_sensors, fixed floating point + comparison +- Windows: Include registry file in installation +- Converters: Improve NEON converters + ## 003.009.003 * UBX: Fixed a phase synchronization issue on the sub-1GHz band * USB: Fixed transport issue that crashed when multiple USB devices were diff --git a/fpga-src b/fpga-src index b859659c1..593aae943 160000 --- a/fpga-src +++ b/fpga-src @@ -1 +1 @@ -Subproject commit b859659c12db508911639981ab3c750ff971df86 +Subproject commit 593aae943b7d18e4e165ccd91a6b6581005e62e8 diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake index 6f906f8bf..a344969d1 100644 --- a/host/cmake/Modules/UHDVersion.cmake +++ b/host/cmake/Modules/UHDVersion.cmake @@ -28,7 +28,7 @@ FIND_PACKAGE(Git QUIET) ######################################################################## SET(UHD_VERSION_MAJOR 003) SET(UHD_VERSION_MINOR 009) -SET(UHD_VERSION_PATCH 003) +SET(UHD_VERSION_PATCH 004) SET(UHD_VERSION_DEVEL FALSE) ######################################################################## -- cgit v1.2.3