diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-08-15 20:06:14 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-08-15 20:06:14 +0200 |
commit | 1e01627b0653c76e215a9d8f5e9fffe510e247a6 (patch) | |
tree | f38f6b642dc0e1a44e630c5bca8467f005f64fcc /src | |
parent | 0ba1b6c711e4fe9622f6ca75b91b2740d640e099 (diff) | |
download | dabmod-1e01627b0653c76e215a9d8f5e9fffe510e247a6.tar.gz dabmod-1e01627b0653c76e215a9d8f5e9fffe510e247a6.tar.bz2 dabmod-1e01627b0653c76e215a9d8f5e9fffe510e247a6.zip |
Add support for Ettus GPSDO
Diffstat (limited to 'src')
-rw-r--r-- | src/OutputUHD.cpp | 46 | ||||
-rw-r--r-- | src/OutputUHD.h | 2 |
2 files changed, 43 insertions, 5 deletions
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index e71a625..609dd43 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -63,7 +63,7 @@ void uhd_msg_handler(uhd::msg::type_t type, const std::string &msg) } } -// Check function for GPS TIMELOCK sensor +// Check function for GPS TIMELOCK sensor from the ODR LEA-M8F board GPSDO bool check_gps_timelock(uhd::usrp::multi_usrp::sptr usrp) { try { @@ -83,6 +83,26 @@ bool check_gps_timelock(uhd::usrp::multi_usrp::sptr usrp) } } +// Check function for GPS LOCKED sensor from the Ettus GPSDO +bool check_gps_locked(uhd::usrp::multi_usrp::sptr usrp) +{ + try { + uhd::sensor_value_t sensor_value( + usrp->get_mboard_sensor("gps_locked", 0)); + if (not sensor_value.to_bool()) { + etiLog.level(warn) << "OutputUHD: gps_locked " << + sensor_value.to_pp_string(); + return false; + } + + return true; + } + catch (uhd::lookup_error &e) { + etiLog.level(warn) << "OutputUHD: no gps_locked sensor"; + return false; + } +} + OutputUHD::OutputUHD( const OutputUHDConfig& config) : @@ -162,7 +182,12 @@ OutputUHD::OutputUHD( MDEBUG("OutputUHD:Setting REFCLK and PPS input...\n"); - myUsrp->set_clock_source(myConf.refclk_src); + if (myConf.refclk_src == "gpsdo-ettus") { + myUsrp->set_clock_source("gpsdo"); + } + else { + myUsrp->set_clock_source(myConf.refclk_src); + } myUsrp->set_time_source(myConf.pps_src); if (myConf.subDevice != "") { @@ -209,6 +234,7 @@ OutputUHD::OutputUHD( uwd.sourceContainsTimestamp = false; uwd.muteNoTimestamps = myConf.muteNoTimestamps; uwd.refclk_lock_loss_behaviour = myConf.refclk_lock_loss_behaviour; + uwd.gpsdo_is_ettus = false; if (myConf.refclk_src == "internal") { uwd.check_refclk_loss = false; @@ -218,6 +244,11 @@ OutputUHD::OutputUHD( uwd.check_refclk_loss = true; uwd.check_gpsfix = (myConf.maxGPSHoldoverTime != 0); } + else if (myConf.refclk_src == "gpsdo-ettus") { + uwd.check_refclk_loss = true; + uwd.check_gpsfix = (myConf.maxGPSHoldoverTime != 0); + uwd.gpsdo_is_ettus = true; + } else { uwd.check_refclk_loss = true; uwd.check_gpsfix = false; @@ -568,9 +599,14 @@ void OutputUHD::check_gps() else { // Checking the sensor here takes too much // time, it has to be done in a separate thread. - gps_fix_pt = boost::packaged_task<bool>( - boost::bind(check_gps_timelock, myUsrp) ); - + if (uwd.gpsdo_is_ettus) { + gps_fix_pt = boost::packaged_task<bool>( + boost::bind(check_gps_locked, myUsrp) ); + } + else { + gps_fix_pt = boost::packaged_task<bool>( + boost::bind(check_gps_timelock, myUsrp) ); + } gps_fix_future = gps_fix_pt.get_future(); gps_fix_task = boost::thread(boost::move(gps_fix_pt)); diff --git a/src/OutputUHD.h b/src/OutputUHD.h index 88be215..124ff93 100644 --- a/src/OutputUHD.h +++ b/src/OutputUHD.h @@ -123,6 +123,8 @@ struct UHDWorkerData { // If we want to check for the gps_timelock sensor bool check_gpsfix; + bool gpsdo_is_ettus; // Set to false in case the ODR LEA-M8F board is used + // muting set by remote control bool muting; |