From 5098256a258623b2d0bb6aa54b923f22e92a178f Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 28 Sep 2011 12:04:08 -0700 Subject: e100: added support for internal gpsdo --- host/lib/usrp/e100/e100_impl.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'host/lib/usrp/e100/e100_impl.cpp') diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp index b988de9a1..564a05a7e 100644 --- a/host/lib/usrp/e100/e100_impl.cpp +++ b/host/lib/usrp/e100/e100_impl.cpp @@ -229,6 +229,22 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ _tree->create(mb_path / "sensors/ref_locked") .publish(boost::bind(&e100_impl::get_ref_locked, this)); + //////////////////////////////////////////////////////////////////// + // Create the GPSDO control + //////////////////////////////////////////////////////////////////// + try{ + _gps = gps_ctrl::make(e100_ctrl::make_gps_uart_iface(E100_UART_DEV_NODE)); + } + catch(std::exception &e){ + UHD_MSG(error) << "An error occurred making GPSDO control: " << e.what() << std::endl; + } + if (_gps.get() != NULL and _gps->gps_detected()){ + BOOST_FOREACH(const std::string &name, _gps->get_sensors()){ + _tree->create(mb_path / "sensors" / name) + .publish(boost::bind(&gps_ctrl::get_sensor, _gps, name)); + } + } + //////////////////////////////////////////////////////////////////// // create frontend control objects //////////////////////////////////////////////////////////////////// @@ -376,6 +392,15 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ _tree->access(mb_path / "clock_source/value").set("internal"); _tree->access(mb_path / "time_source/value").set("none"); + //GPS installed: use external ref, time, and init time spec + if (_gps.get() != NULL and _gps->gps_detected()){ + UHD_MSG(status) << "Setting references to the internal GPSDO" << std::endl; + _tree->access(mb_path / "time_source/value").set("external"); + _tree->access(mb_path / "clock_source/value").set("external"); + UHD_MSG(status) << "Initializing time to the internal GPSDO" << std::endl; + _time64->set_time_next_pps(time_spec_t(time_t(_gps->get_sensor("gps_time").to_int()+1))); + } + } e100_impl::~e100_impl(void){ -- cgit v1.2.3