diff options
author | Josh Blum <josh@joshknows.com> | 2011-09-28 12:04:08 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-09-28 12:04:08 -0700 |
commit | 5098256a258623b2d0bb6aa54b923f22e92a178f (patch) | |
tree | 1bc0019735f0b1b557f5b573b4bbbe8713646ffd /host/lib/usrp/e100/e100_impl.cpp | |
parent | 0d9421b7ab57471d0bb223117413d01ac8299240 (diff) | |
download | uhd-5098256a258623b2d0bb6aa54b923f22e92a178f.tar.gz uhd-5098256a258623b2d0bb6aa54b923f22e92a178f.tar.bz2 uhd-5098256a258623b2d0bb6aa54b923f22e92a178f.zip |
e100: added support for internal gpsdo
Diffstat (limited to 'host/lib/usrp/e100/e100_impl.cpp')
-rw-r--r-- | host/lib/usrp/e100/e100_impl.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ -230,6 +230,22 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ .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<sensor_value_t>(mb_path / "sensors" / name) + .publish(boost::bind(&gps_ctrl::get_sensor, _gps, name)); + } + } + + //////////////////////////////////////////////////////////////////// // create frontend control objects //////////////////////////////////////////////////////////////////// _rx_fe = rx_frontend_core_200::make(_fpga_ctrl, E100_REG_SR_ADDR(UE_SR_RX_FRONT)); @@ -376,6 +392,15 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){ _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.get() != NULL and _gps->gps_detected()){ + UHD_MSG(status) << "Setting references to the internal GPSDO" << std::endl; + _tree->access<std::string>(mb_path / "time_source/value").set("external"); + _tree->access<std::string>(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){ |