aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/b200
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/b200')
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp9
-rw-r--r--host/lib/usrp/b200/b200_io_impl.cpp19
2 files changed, 18 insertions, 10 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index bfb32b2c8..0b4eccd5e 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -730,6 +730,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<bool>(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)
.add_coerced_subscriber(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<bool>(rx_dsp_path / "rate" / "set").set(false);
_tree->access<double>(rx_dsp_path / "rate" / "value")
.set_coercer(boost::bind(&b200_impl::coerce_rx_samp_rate, this, perif.ddc, dspno, _1))
+ .add_coerced_subscriber(boost::bind(&lambda_set_bool_prop, _tree, rx_dsp_path / "rate" / "set", true, _1))
.add_coerced_subscriber(boost::bind(&b200_impl::update_rx_samp_rate, this, dspno, _1))
;
_tree->create<stream_cmd_t>(rx_dsp_path / "stream_cmd")
@@ -802,8 +809,10 @@ void b200_impl::setup_radio(const size_t dspno)
.add_coerced_subscriber(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<bool>(tx_dsp_path / "rate" / "set").set(false);
_tree->access<double>(tx_dsp_path / "rate" / "value")
.set_coercer(boost::bind(&b200_impl::coerce_tx_samp_rate, this, perif.duc, dspno, _1))
+ .add_coerced_subscriber(boost::bind(&lambda_set_bool_prop, _tree, tx_dsp_path / "rate" / "set", true, _1))
.add_coerced_subscriber(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 98347b114..85d61280f 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<double>(rate, uhd::math::FREQ_COMPARISON_DELTA_HZ) >
- uhd::math::fp_compare::fp_compare_delta<double>(max_tick_rate, uhd::math::FREQ_COMPARISON_DELTA_HZ))) {
+ (fp_compare::fp_compare_delta<double>(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<boost::uint32_t>(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<bool>(dsp_path / "rate/set").get()) {
+ continue;
+ }
double this_dsp_rate = _tree->access<double>(dsp_path / "rate/value").get();
// Check if the user selected something completely unreasonable:
- if (uhd::math::fp_compare::fp_compare_delta<double>(this_dsp_rate, uhd::math::FREQ_COMPARISON_DELTA_HZ) >
- uhd::math::fp_compare::fp_compare_delta<double>(max_tick_rate, uhd::math::FREQ_COMPARISON_DELTA_HZ)) {
+ if (fp_compare::fp_compare_delta<double>(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<boost::uint32_t>(
lcm_rate,
static_cast<boost::uint32_t>(floor(this_dsp_rate + 0.5))