diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 22 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_impl.hpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_regs.cpp | 1 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_regs.hpp | 1 |
4 files changed, 28 insertions, 1 deletions
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 29e0535f8..520ee49a6 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -26,6 +26,7 @@ #include <uhd/usrp/mboard_props.hpp> #include <uhd/utils/byteswap.hpp> #include <uhd/utils/algorithm.hpp> +#include <uhd/types/sensors.hpp> #include <boost/bind.hpp> #include <iostream> @@ -362,11 +363,32 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){ case MBOARD_PROP_CLOCK_RATE: val = this->get_master_clock_freq(); 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 { + 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 **********************************************************************/ diff --git a/host/lib/usrp/usrp2/usrp2_impl.hpp b/host/lib/usrp/usrp2/usrp2_impl.hpp index e9ff22b13..ccaf0c9a8 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.hpp +++ b/host/lib/usrp/usrp2/usrp2_impl.hpp @@ -163,7 +163,10 @@ private: void duc_get(const wax::obj &, wax::obj &, size_t); void duc_set(const wax::obj &, const wax::obj &, size_t); uhd::dict<std::string, wax_obj_proxy::sptr> _tx_dsp_proxies; - + + //sensors methods for mboard + bool get_mimo_locked(void); + bool get_ref_locked(void); }; /*! diff --git a/host/lib/usrp/usrp2/usrp2_regs.cpp b/host/lib/usrp/usrp2/usrp2_regs.cpp index 66c3ac137..65236396c 100644 --- a/host/lib/usrp/usrp2/usrp2_regs.cpp +++ b/host/lib/usrp/usrp2/usrp2_regs.cpp @@ -64,6 +64,7 @@ usrp2_regs_t usrp2_get_regs(bool use_n2xx_map) { x.time64_secs_rb_imm = bp_base + 4*10; x.time64_ticks_rb_imm = bp_base + 4*11; x.compat_num_rb = bp_base + 4*12; + x.irq_rb = bp_base + 4*13; x.time64_secs_rb_pps = bp_base + 4*14; x.time64_ticks_rb_pps = bp_base + 4*15; x.dsp_tx_freq = sr_addr(misc_output_base, x.sr_tx_dsp + 0); diff --git a/host/lib/usrp/usrp2/usrp2_regs.hpp b/host/lib/usrp/usrp2/usrp2_regs.hpp index 01f5ee65a..d1fbf3401 100644 --- a/host/lib/usrp/usrp2/usrp2_regs.hpp +++ b/host/lib/usrp/usrp2/usrp2_regs.hpp @@ -66,6 +66,7 @@ typedef struct { int time64_secs_rb_pps; int time64_ticks_rb_pps; int compat_num_rb; + int irq_rb; int dsp_tx_freq; int dsp_tx_scale_iq; int dsp_tx_interp_rate; |