aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/e300/e300_impl.cpp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-01-27 09:11:29 +0100
committerMartin Braun <martin.braun@ettus.com>2015-01-27 09:11:29 +0100
commitd238f12252870d73df125649d965edc2a05debf5 (patch)
tree13a80c077993812e61fb04be994e1159fe56cbb3 /host/lib/usrp/e300/e300_impl.cpp
parentfd8ccc869ae4f61f1171c894954d980aea57d4aa (diff)
parent5e9ffca09b0f6b8aba38ca7f0e9ed37eab8a43b9 (diff)
downloaduhd-d238f12252870d73df125649d965edc2a05debf5.tar.gz
uhd-d238f12252870d73df125649d965edc2a05debf5.tar.bz2
uhd-d238f12252870d73df125649d965edc2a05debf5.zip
Merge branch 'maint' into maint
Diffstat (limited to 'host/lib/usrp/e300/e300_impl.cpp')
-rw-r--r--host/lib/usrp/e300/e300_impl.cpp46
1 files changed, 15 insertions, 31 deletions
diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp
index d04794947..0c112fdb1 100644
--- a/host/lib/usrp/e300/e300_impl.cpp
+++ b/host/lib/usrp/e300/e300_impl.cpp
@@ -381,7 +381,7 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr)
} catch (std::exception &e) {
UHD_MSG(error) << "An error occured making GPSDO control: " << e.what() << std::endl;
}
- _sensor_manager = e300_sensor_manager::make_local(_gps);
+ _sensor_manager = e300_sensor_manager::make_local(_gps, _global_regs);
}
UHD_MSG(status) << (_sensor_manager->get_gps_found() ? "found" : "not found") << std::endl;
@@ -493,14 +493,15 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr)
.subscribe(boost::bind(&time_core_3000::set_time_next_pps, _radio_perifs[1].time64, _1));
//setup time source props
_tree->create<std::string>(mb_path / "time_source" / "value")
- .subscribe(boost::bind(&e300_impl::_update_time_source, this, _1));
- static const std::vector<std::string> time_sources = boost::assign::list_of("none")("external")("gpsdo");
+ .subscribe(boost::bind(&e300_impl::_update_time_source, this, _1))
+ .set(e300::DEFAULT_TIME_SRC);
+ 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")
- .subscribe(boost::bind(&e300_impl::_update_clock_source, this, _1));
- static const std::vector<std::string> clock_sources = boost::assign::list_of("internal");
- // not implemented ("external")("gpsdo");
+ .subscribe(boost::bind(&e300_impl::_update_clock_source, this, _1))
+ .set(e300::DEFAULT_CLOCK_SRC);
+ static const std::vector<std::string> clock_sources = boost::assign::list_of("internal"); //external,gpsdo not supported
_tree->create<std::vector<std::string> >(mb_path / "clock_source" / "options").set(clock_sources);
////////////////////////////////////////////////////////////////////
@@ -573,29 +574,6 @@ e300_impl::e300_impl(const uhd::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);
-
- if (_sensor_manager->get_gps_found()) {
- _tree->access<std::string>(mb_path / "clock_source" / "value").set("gpsdo");
- _tree->access<std::string>(mb_path / "time_source" / "value").set("gpsdo");
- UHD_MSG(status) << "References initialized to GPSDO sources" << std::endl;
- const time_t tp = time_t(_sensor_manager->get_gps_time().to_int());
- _tree->access<time_spec_t>(mb_path / "time" / "pps").set(time_spec_t(tp));
- //wait for time to be set (timeout after 1 second)
- for (int i = 0; i < 10; i++)
- {
- boost::this_thread::sleep(boost::posix_time::milliseconds(100));
- if(tp == (_tree->access<time_spec_t>(mb_path / "time" / "pps").get()).get_full_secs())
- break;
- }
- } else {
- // init to default time and clock source
- _tree->access<std::string>(mb_path / "clock_source" / "value").set(
- e300::DEFAULT_CLOCK_SRC);
- _tree->access<std::string>(mb_path / "time_source" / "value").set(
- e300::DEFAULT_TIME_SRC);
-
- UHD_MSG(status) << "References initialized to internal sources" << std::endl;
- }
}
boost::uint8_t e300_impl::_get_internal_gpio(
@@ -895,14 +873,20 @@ e300_impl::both_xports_t e300_impl::_make_transport(
return xports;
}
-void e300_impl::_update_clock_source(const std::string &)
+void e300_impl::_update_clock_source(const std::string &source)
{
+ if (source != "internal") {
+ throw uhd::value_error(boost::str(
+ boost::format("Clock source option not supported: %s. The only value supported is \"internal\". " \
+ "To discipline the internal oscillator, set the appropriate time source.") % source
+ ));
+ }
}
void e300_impl::_update_antenna_sel(const size_t &which, const std::string &ant)
{
if (ant != "TX/RX" and ant != "RX2")
- throw uhd::value_error("e300: unknown RX antenna option: " + ant);
+ throw uhd::value_error("Unknown RX antenna option: " + ant);
_radio_perifs[which].ant_rx2 = (ant == "RX2");
this->_update_atrs();
}