aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--host/lib/usrp/e100/clock_ctrl.cpp10
-rw-r--r--host/lib/usrp/e100/clock_ctrl.hpp3
-rw-r--r--host/lib/usrp/e100/e100_impl.cpp9
-rw-r--r--host/lib/usrp/e100/e100_impl.hpp2
4 files changed, 22 insertions, 2 deletions
diff --git a/host/lib/usrp/e100/clock_ctrl.cpp b/host/lib/usrp/e100/clock_ctrl.cpp
index 0eb9eef8e..1dd55049b 100644
--- a/host/lib/usrp/e100/clock_ctrl.cpp
+++ b/host/lib/usrp/e100/clock_ctrl.cpp
@@ -432,6 +432,16 @@ public:
this->latch_regs();
}
+ bool get_locked(void){
+ static const boost::uint8_t addr = 0x01F;
+ boost::uint32_t reg = _iface->read_spi(
+ UE_SPI_SS_AD9522, spi_config_t::EDGE_RISE,
+ _ad9522_regs.get_read_reg(addr), 24
+ );
+ _ad9522_regs.set_reg(addr, reg);
+ return _ad9522_regs.digital_lock_detect != 0;
+ }
+
private:
spi_iface::sptr _iface;
const bool _dboard_clocks_diff;
diff --git a/host/lib/usrp/e100/clock_ctrl.hpp b/host/lib/usrp/e100/clock_ctrl.hpp
index 538ea65d8..803265556 100644
--- a/host/lib/usrp/e100/clock_ctrl.hpp
+++ b/host/lib/usrp/e100/clock_ctrl.hpp
@@ -119,6 +119,9 @@ public:
*/
virtual void use_auto_ref(void) = 0;
+ //! Is the reference locked?
+ virtual bool get_locked(void) = 0;
+
};
#endif /* INCLUDED_USRP_E100_CLOCK_CTRL_HPP */
diff --git a/host/lib/usrp/e100/e100_impl.cpp b/host/lib/usrp/e100/e100_impl.cpp
index b80ee0836..b988de9a1 100644
--- a/host/lib/usrp/e100/e100_impl.cpp
+++ b/host/lib/usrp/e100/e100_impl.cpp
@@ -226,8 +226,8 @@ e100_impl::e100_impl(const uhd::device_addr_t &device_addr){
////////////////////////////////////////////////////////////////////
// and do the misc mboard sensors
////////////////////////////////////////////////////////////////////
- //none for now...
- _tree->create<int>(mb_path / "sensors"); //phony property so this dir exists
+ _tree->create<sensor_value_t>(mb_path / "sensors/ref_locked")
+ .publish(boost::bind(&e100_impl::get_ref_locked, this));
////////////////////////////////////////////////////////////////////
// create frontend control objects
@@ -406,3 +406,8 @@ void e100_impl::update_clock_source(const std::string &source){
else if (source == "external") _clock_ctrl->use_external_ref();
else throw uhd::runtime_error("unhandled clock configuration reference source: " + source);
}
+
+sensor_value_t e100_impl::get_ref_locked(void){
+ const bool lock = _clock_ctrl->get_locked();
+ return sensor_value_t("Ref", lock, "locked", "unlocked");
+}
diff --git a/host/lib/usrp/e100/e100_impl.hpp b/host/lib/usrp/e100/e100_impl.hpp
index a15197545..99c8481e3 100644
--- a/host/lib/usrp/e100/e100_impl.hpp
+++ b/host/lib/usrp/e100/e100_impl.hpp
@@ -31,6 +31,7 @@
#include <uhd/usrp/subdev_spec.hpp>
#include <uhd/usrp/dboard_eeprom.hpp>
#include <uhd/usrp/mboard_eeprom.hpp>
+#include <uhd/types/sensors.hpp>
#include <uhd/types/otw_type.hpp>
#include <uhd/types/clock_config.hpp>
#include <uhd/types/stream_cmd.hpp>
@@ -124,6 +125,7 @@ private:
void update_rx_subdev_spec(const uhd::usrp::subdev_spec_t &);
void update_tx_subdev_spec(const uhd::usrp::subdev_spec_t &);
void update_clock_source(const std::string &);
+ uhd::sensor_value_t get_ref_locked(void);
};