aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/b200
diff options
context:
space:
mode:
authormichael-west <michael.west@ettus.com>2014-07-30 11:54:26 -0700
committermichael-west <michael.west@ettus.com>2014-07-30 11:54:26 -0700
commit35fc42f9fcbc5a791bdabc92086a51a2279563f1 (patch)
treefd053dd7e462fd49759ae255334de6d5c5aefd59 /host/lib/usrp/b200
parentbca5edb57979983a9eb8d6cd1016961552ad217c (diff)
parenteafae66c030aa86e9da127de4f6d5ec4fd641c59 (diff)
downloaduhd-35fc42f9fcbc5a791bdabc92086a51a2279563f1.tar.gz
uhd-35fc42f9fcbc5a791bdabc92086a51a2279563f1.tar.bz2
uhd-35fc42f9fcbc5a791bdabc92086a51a2279563f1.zip
Merge branch 'maint' into uhd/bug492
Conflicts: host/lib/usrp/b200/b200_impl.cpp
Diffstat (limited to 'host/lib/usrp/b200')
-rw-r--r--host/lib/usrp/b200/b200_impl.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp
index f2b3885e6..f88d787ca 100644
--- a/host/lib/usrp/b200/b200_impl.cpp
+++ b/host/lib/usrp/b200/b200_impl.cpp
@@ -427,7 +427,7 @@ b200_impl::b200_impl(const device_addr_t &device_addr)
//setup time source props
_tree->create<std::string>(mb_path / "time_source" / "value")
.subscribe(boost::bind(&b200_impl::update_time_source, this, _1));
- static const std::vector<std::string> time_sources = boost::assign::list_of("none")("external")("gpsdo");
+ static const std::vector<std::string> time_sources = boost::assign::list_of("none")("internal")("external")("gpsdo");
_tree->create<std::vector<std::string> >(mb_path / "time_source" / "options").set(time_sources);
//setup reference source props
_tree->create<std::string>(mb_path / "clock_source" / "value")
@@ -464,10 +464,6 @@ b200_impl::b200_impl(const device_addr_t &device_addr)
_tree->access<subdev_spec_t>(mb_path / "rx_subdev_spec").set(rx_spec);
_tree->access<subdev_spec_t>(mb_path / "tx_subdev_spec").set(tx_spec);
- //init to internal clock and time source
- _tree->access<std::string>(mb_path / "clock_source/value").set("internal");
- _tree->access<std::string>(mb_path / "time_source/value").set("none");
-
//GPS installed: use external ref, time, and init time spec
if (_gps and _gps->gps_detected())
{
@@ -482,6 +478,10 @@ b200_impl::b200_impl(const device_addr_t &device_addr)
time_spec_t pps_time = _tree->access<time_spec_t>(mb_path / "time" / "pps").get();
for (size_t i = 0; i < 10 && _tree->access<time_spec_t>(mb_path / "time" / "pps").get() == pps_time; i++)
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
+ } else {
+ //init to internal clock and time source
+ _tree->access<std::string>(mb_path / "clock_source/value").set("internal");
+ _tree->access<std::string>(mb_path / "time_source/value").set("internal");
}
}
@@ -686,10 +686,10 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co
else
{
const double max_tick_rate = ((chan_count <= 1) ? AD9361_1_CHAN_CLOCK_RATE_MAX : AD9361_2_CHAN_CLOCK_RATE_MAX);
- if (tick_rate > max_tick_rate)
+ if (tick_rate - max_tick_rate >= 1.0)
{
throw uhd::value_error(boost::str(
- boost::format("current master clock rate (%.2f MHz) exceeds maximum possible master clock rate (%.2f MHz) when using %d %s channels")
+ boost::format("current master clock rate (%.6f MHz) exceeds maximum possible master clock rate (%.6f MHz) when using %d %s channels")
% (tick_rate/1e6)
% (max_tick_rate/1e6)
% chan_count
@@ -701,12 +701,12 @@ void b200_impl::enforce_tick_rate_limits(size_t chan_count, double tick_rate, co
double b200_impl::set_tick_rate(const double rate)
{
- UHD_MSG(status) << "Asking for clock rate " << rate/1e6 << " MHz\n";
+ UHD_MSG(status) << (boost::format("Asking for clock rate %.6f MHz\n") % (rate/1e6));
check_tick_rate_with_current_streamers(rate); // Defined in b200_io_impl.cpp
_tick_rate = _codec_ctrl->set_clock_rate(rate);
- UHD_MSG(status) << "Actually got clock rate " << _tick_rate/1e6 << " MHz\n";
+ UHD_MSG(status) << (boost::format("Actually got clock rate %.6f MHz\n") % (_tick_rate/1e6));
//reset after clock rate change
this->reset_codec_dcm();
@@ -791,11 +791,17 @@ void b200_impl::update_clock_source(const std::string &source)
void b200_impl::update_time_source(const std::string &source)
{
- if (source == "none"){}
- else if (source == "external"){}
- else if (source == "gpsdo"){}
+ boost::uint32_t value = 0;
+ if (source == "none")
+ value = 3;
+ else if (source == "internal")
+ value = 2;
+ else if (source == "external")
+ value = 1;
+ else if (source == "gpsdo")
+ value = 0;
else throw uhd::key_error("update_time_source: unknown source: " + source);
- _local_ctrl->poke32(TOREG(SR_CORE_PPS_SEL), (source == "external")? 1 : 0);
+ _local_ctrl->poke32(TOREG(SR_CORE_PPS_SEL), value);
}
/***********************************************************************