aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/magnesium
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-11-20 17:18:22 -0800
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:05:06 -0800
commit119934da2ea19337c564c4d3c5c7c31fc669c369 (patch)
tree1d3782b73bf422a31b655348c87022da1c5170ff /host/lib/usrp/dboard/magnesium
parentba6e9e801cb45b060c4d33351dd6aed1a7cf08c8 (diff)
downloaduhd-119934da2ea19337c564c4d3c5c7c31fc669c369.tar.gz
uhd-119934da2ea19337c564c4d3c5c7c31fc669c369.tar.bz2
uhd-119934da2ea19337c564c4d3c5c7c31fc669c369.zip
mg: Add stubs for LO locked sensors
Diffstat (limited to 'host/lib/usrp/dboard/magnesium')
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp20
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp9
-rw-r--r--host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp20
3 files changed, 48 insertions, 1 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
index 0e3768499..e67d0b1fe 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp
@@ -409,6 +409,26 @@ void magnesium_radio_ctrl_impl::set_rpc_client(
);
})
;
+
+ // Sensors
+ for (const auto &dir : std::vector<direction_t>{RX_DIRECTION, TX_DIRECTION}) {
+ for (size_t chan_idx = 0; chan_idx < 1 /* num channels FIXME */; chan_idx++) {
+ const fs_path fe_path =
+ fs_path("dboards") /
+ _radio_slot /
+ (dir == RX_DIRECTION ? "rx_frontends" : "tx_frontends") /
+ chan_idx;
+ UHD_LOG_TRACE(unique_id(),
+ "Stubbed out adding sensors for fe path " << fe_path);
+ // FIXME add sensors here
+ }
+ }
+}
+
+bool magnesium_radio_ctrl_impl::get_lo_lock_status(
+ const direction_t /*dir*/
+) {
+ return bool(_rpcc); // FIXME
}
UHD_RFNOC_BLOCK_REGISTER(magnesium_radio_ctrl, "MagnesiumRadio");
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp
index 7d67a7263..433ab9a94 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.hpp
@@ -120,6 +120,15 @@ private:
void _init_prop_tree();
/**************************************************************************
+ * Sensors
+ *************************************************************************/
+ //! Return LO lock status. Factors in current band (low/high) and
+ // direction (TX/RX)
+ bool get_lo_lock_status(
+ const direction_t dir
+ );
+
+ /**************************************************************************
* Gain Controls (implemented in magnesium_radio_ctrl_gain.cpp)
*************************************************************************/
//! Set the attenuation of the DSA
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
index c35a15418..355671a5f 100644
--- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
+++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_init.cpp
@@ -331,7 +331,7 @@ void magnesium_radio_ctrl_impl::_init_frontend_subtree(
})
;
// FIXME separate DSA and Myk gains
- // TX LO lock sensor
+ // TX LO lock sensor //////////////////////////////////////////////////////
// Note: The lowband and AD9371 LO lock sensors are generated
// programmatically in set_rpc_client(). The actual lo_locked publisher is
// also set there.
@@ -341,10 +341,28 @@ void magnesium_radio_ctrl_impl::_init_frontend_subtree(
throw uhd::runtime_error(
"Attempting to write to sensor!");
})
+ .set_publisher([this](){
+ return sensor_value_t(
+ "all_los",
+ this->get_lo_lock_status(TX_DIRECTION),
+ "locked", "unlocked"
+ );
+ })
;
// RX LO lock sensor (see not on TX LO lock sensor)
subtree->create<sensor_value_t>(rx_fe_path / "sensors" / "lo_locked")
.set(sensor_value_t("all_los", false, "locked", "unlocked"))
+ .add_coerced_subscriber([](const sensor_value_t &){
+ throw uhd::runtime_error(
+ "Attempting to write to sensor!");
+ })
+ .set_publisher([this](){
+ return sensor_value_t(
+ "all_los",
+ this->get_lo_lock_status(RX_DIRECTION),
+ "locked", "unlocked"
+ );
+ })
;
}