aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/usrp2/mboard_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/usrp2/mboard_impl.cpp')
-rw-r--r--host/lib/usrp/usrp2/mboard_impl.cpp44
1 files changed, 39 insertions, 5 deletions
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp
index 29e0535f8..ae098dba6 100644
--- a/host/lib/usrp/usrp2/mboard_impl.cpp
+++ b/host/lib/usrp/usrp2/mboard_impl.cpp
@@ -26,6 +26,8 @@
#include <uhd/usrp/mboard_props.hpp>
#include <uhd/utils/byteswap.hpp>
#include <uhd/utils/algorithm.hpp>
+#include <uhd/types/sensors.hpp>
+#include <boost/assign/list_of.hpp>
#include <boost/bind.hpp>
#include <iostream>
@@ -100,11 +102,11 @@ usrp2_mboard_impl::usrp2_mboard_impl(
//contruct the interfaces to mboard perifs
_clock_ctrl = usrp2_clock_ctrl::make(_iface);
_codec_ctrl = usrp2_codec_ctrl::make(_iface);
-// _gps_ctrl = gps_ctrl::make(
-// _iface->get_gps_write_fn(),
-// _iface->get_gps_read_fn());
-
- //if(_gps_ctrl->gps_detected()) std::cout << "GPS time: " << _gps_ctrl->get_time() << std::endl;
+ if (_iface->mb_eeprom["gpsdo"] == "internal"){
+ _gps_ctrl = gps_ctrl::make(
+ _iface->get_gps_write_fn(),
+ _iface->get_gps_read_fn());
+ }
//init the dsp stuff (before setting update packets)
dsp_init();
@@ -363,10 +365,42 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){
val = this->get_master_clock_freq();
return;
+ case SUBDEV_PROP_SENSOR_NAMES:{
+ prop_names_t names = boost::assign::list_of("mimo_locked")("ref_locked");
+ if (_gps_ctrl.get()) names.push_back("gps_time");
+ val = names;
+ }
+ return;
+
+ case MBOARD_PROP_SENSOR:
+ if(key.name == "mimo_locked") {
+ val = sensor_value_t("MIMO", this->get_mimo_locked(), "locked", "unlocked");
+ return;
+ }
+ else if(key.name == "ref_locked") {
+ val = sensor_value_t("Ref", this->get_ref_locked(), "locked", "unlocked");
+ return;
+ }
+ else if(key.name == "gps_time" and _gps_ctrl.get()) {
+ val = sensor_value_t("GPS time", int(_gps_ctrl->get_epoch_time()), "seconds");
+ }
+ else {
+ UHD_THROW_PROP_GET_ERROR();
+ }
+ break;
+
default: UHD_THROW_PROP_GET_ERROR();
}
}
+bool usrp2_mboard_impl::get_mimo_locked(void) {
+ return bool((_iface->peek32(_iface->regs.irq_rb) & (1<<10)) > 0);
+}
+
+bool usrp2_mboard_impl::get_ref_locked(void) {
+ return bool((_iface->peek32(_iface->regs.irq_rb) & (1<<11)) > 0);
+}
+
/***********************************************************************
* MBoard Set Properties
**********************************************************************/