aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2014-09-23 16:03:27 -0700
committerMartin Braun <martin.braun@ettus.com>2014-09-23 16:03:27 -0700
commit5aefa0fdfcf45717c133641b7e4df8070ed025e3 (patch)
tree7eaf97986d62892368f8d14cd48cfc45dddf7923 /host
parente56809a09aeffa2ccaec4582f6ca2fc0d4b4949e (diff)
parentc431a66df3df4cff82bfa2d2b2c7b16895a7efd6 (diff)
downloaduhd-5aefa0fdfcf45717c133641b7e4df8070ed025e3.tar.gz
uhd-5aefa0fdfcf45717c133641b7e4df8070ed025e3.tar.bz2
uhd-5aefa0fdfcf45717c133641b7e4df8070ed025e3.zip
Merge branch 'maint'
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/property_tree.hpp1
-rw-r--r--host/lib/property_tree.cpp6
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp1
-rw-r--r--host/lib/usrp/dboard/db_cbx.cpp10
-rw-r--r--host/lib/usrp/e100/e100_impl.cpp2
-rw-r--r--host/lib/usrp/usrp2/usrp2_impl.cpp2
-rw-r--r--host/tests/property_test.cpp21
7 files changed, 34 insertions, 9 deletions
diff --git a/host/include/uhd/property_tree.hpp b/host/include/uhd/property_tree.hpp
index b4531698d..a92654ba2 100644
--- a/host/include/uhd/property_tree.hpp
+++ b/host/include/uhd/property_tree.hpp
@@ -120,6 +120,7 @@ struct fs_path : std::string{
};
UHD_API fs_path operator/(const fs_path &, const fs_path &);
+UHD_API fs_path operator/(const fs_path &, size_t);
/*!
* The property tree provides a file system structure for accessing properties.
diff --git a/host/lib/property_tree.cpp b/host/lib/property_tree.cpp
index 0f4cbc025..039f05f12 100644
--- a/host/lib/property_tree.cpp
+++ b/host/lib/property_tree.cpp
@@ -65,6 +65,12 @@ fs_path uhd::operator/(const fs_path &lhs, const fs_path &rhs){
return fs_path(lhs + "/" + rhs);
}
+fs_path uhd::operator/(const fs_path &lhs, size_t rhs)
+{
+ fs_path rhs_str = boost::lexical_cast<std::string>(rhs);
+ return lhs / rhs_str;
+}
+
/***********************************************************************
* Property tree implementation
**********************************************************************/
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index 33a3b0e04..78b979e04 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -333,7 +333,6 @@ b200_impl::b200_impl(const device_addr_t &device_addr)
}
else
{
- UHD_MSG(status) << "not found" << std::endl;
_local_ctrl->poke32(TOREG(SR_CORE_GPSDO_ST), B200_GPSDO_ST_NONE);
}
}
diff --git a/host/lib/usrp/dboard/db_cbx.cpp b/host/lib/usrp/dboard/db_cbx.cpp
index 78ecd9794..a64110fc7 100644
--- a/host/lib/usrp/dboard/db_cbx.cpp
+++ b/host/lib/usrp/dboard/db_cbx.cpp
@@ -19,6 +19,7 @@
#include "max2870_regs.hpp"
#include "db_sbx_common.hpp"
#include <boost/algorithm/string.hpp>
+#include <boost/math/special_functions/round.hpp>
using namespace uhd;
using namespace uhd::usrp;
@@ -94,10 +95,10 @@ double sbx_xcvr::cbx::set_lo_freq(dboard_iface::unit_t unit, double target_freq)
vco_freq *= 2;
RFdiv *= 2;
}
-
+
/*
* The goal here is to loop though possible R dividers,
- * band select clock dividers, N (int) dividers, and FRAC
+ * band select clock dividers, N (int) dividers, and FRAC
* (frac) dividers.
*
* Calculate the N and F dividers for each set of values.
@@ -122,7 +123,7 @@ double sbx_xcvr::cbx::set_lo_freq(dboard_iface::unit_t unit, double target_freq)
N = int(vco_freq/pfd_freq);
//Fractional-N calculation
- FRAC = int((vco_freq/pfd_freq - N)*MOD);
+ FRAC = int(boost::math::round((vco_freq/pfd_freq - N)*MOD));
if(is_int_n) {
if (FRAC > (MOD / 2)) { //Round integer such that actual freq is closest to target
@@ -197,7 +198,8 @@ double sbx_xcvr::cbx::set_lo_freq(dboard_iface::unit_t unit, double target_freq)
regs.r_counter_10_bit = R;
regs.reference_divide_by_2 = T;
regs.reference_doubler = D;
- regs.band_select_clock_div = BS;
+ regs.band_select_clock_div = (BS & 0x0FF);
+ regs.bs_msb = (BS & 0x300) >>8;
UHD_ASSERT_THROW(rfdivsel_to_enum.has_key(RFdiv));
regs.rf_divider_select = rfdivsel_to_enum[RFdiv];
regs.int_n_mode = (is_int_n) ? max2870_regs_t::INT_N_MODE_INT_N : max2870_regs_t::INT_N_MODE_FRAC_N;
diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp
index 5becaf5bb..8b4f2316c 100644
--- a/host/lib/usrp/e100/e100_impl.cpp
+++ b/host/lib/usrp/e100/e100_impl.cpp
@@ -261,7 +261,6 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){
}
if (_gps and _gps->gps_detected())
{
- UHD_MSG(status) << "found" << std::endl;
BOOST_FOREACH(const std::string &name, _gps->get_sensors())
{
_tree->create<sensor_value_t>(mb_path / "sensors" / name)
@@ -270,7 +269,6 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){
}
else
{
- UHD_MSG(status) << "not found" << std::endl;
std::ofstream(GPSDO_VOLATILE_PATH.string().c_str(), std::ofstream::binary) << "42" << std::endl;
}
}
diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp
index 0979ca071..217c1d434 100644
--- a/host/lib/usrp/usrp2/usrp2_impl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_impl.cpp
@@ -525,7 +525,6 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
}
if (_mbc[mb].gps and _mbc[mb].gps->gps_detected())
{
- UHD_MSG(status) << "found" << std::endl;
BOOST_FOREACH(const std::string &name, _mbc[mb].gps->get_sensors())
{
_tree->create<sensor_value_t>(mb_path / "sensors" / name)
@@ -534,7 +533,6 @@ usrp2_impl::usrp2_impl(const device_addr_t &_device_addr){
}
else
{
- UHD_MSG(status) << "not found" << std::endl;
_mbc[mb].iface->pokefw(U2_FW_REG_HAS_GPSDO, dont_look_for_gpsdo);
}
}
diff --git a/host/tests/property_test.cpp b/host/tests/property_test.cpp
index 04d3a831c..00bb3c022 100644
--- a/host/tests/property_test.cpp
+++ b/host/tests/property_test.cpp
@@ -173,3 +173,24 @@ BOOST_AUTO_TEST_CASE(test_prop_subtree){
BOOST_CHECK_EQUAL_COLLECTIONS(tree_dirs2.begin(), tree_dirs2.end(), subtree2_dirs.begin(), subtree2_dirs.end());
}
+
+
+BOOST_AUTO_TEST_CASE(test_prop_operators)
+{
+ uhd::fs_path path1 = "/root/";
+ path1 = path1 / "leaf";
+ BOOST_CHECK_EQUAL(path1, "/root/leaf");
+
+ uhd::fs_path path2 = "/root";
+ path2 = path2 / "leaf";
+ BOOST_CHECK_EQUAL(path2, "/root/leaf");
+
+ uhd::fs_path path3 = "/root/";
+ path3 = path3 / "/leaf/";
+ BOOST_CHECK_EQUAL(path3, "/root/leaf/");
+
+ uhd::fs_path path4 = "/root/";
+ size_t x = 2;
+ path4 = path4 / x;
+ BOOST_CHECK_EQUAL(path4, "/root/2");
+}