diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-07-11 16:49:12 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-07-17 11:52:45 -0700 |
commit | dbb201e7275ff6e63bac9a749db3ee2c4f1c6418 (patch) | |
tree | f074d67f0916ca17dda8977007dcb12dff98d7b4 | |
parent | c0f34ddf82a20605acacaa2dffc93d27f3d9ed3f (diff) | |
download | uhd-dbb201e7275ff6e63bac9a749db3ee2c4f1c6418.tar.gz uhd-dbb201e7275ff6e63bac9a749db3ee2c4f1c6418.tar.bz2 uhd-dbb201e7275ff6e63bac9a749db3ee2c4f1c6418.zip |
sbx: Only update ATRs when lock state changes
The SBX tracks the LO lock state via on-board LEDs. However, querying
the LO lock status spawns an update to the entire ATR registers. To
reduce the number of register reads/writes, the LO lock status LED is
now only updated if it changed.
-rw-r--r-- | host/lib/usrp/dboard/db_sbx_common.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/host/lib/usrp/dboard/db_sbx_common.cpp b/host/lib/usrp/dboard/db_sbx_common.cpp index 585e4ba6b..b6eaedc3d 100644 --- a/host/lib/usrp/dboard/db_sbx_common.cpp +++ b/host/lib/usrp/dboard/db_sbx_common.cpp @@ -330,12 +330,14 @@ double sbx_xcvr::set_lo_freq(dboard_iface::unit_t unit, double target_freq) { sensor_value_t sbx_xcvr::get_locked(dboard_iface::unit_t unit) { const bool locked = (this->get_iface()->read_gpio(unit) & LOCKDET_MASK) != 0; + bool& lock_cache = (unit == dboard_iface::UNIT_RX) ? _rx_lo_lock_cache + : _tx_lo_lock_cache; - if (unit == dboard_iface::UNIT_RX) _rx_lo_lock_cache = locked; - if (unit == dboard_iface::UNIT_TX) _tx_lo_lock_cache = locked; - - //write the new lock cache setting to atr regs - update_atr(); + if (lock_cache != locked) { + lock_cache = locked; + // write the new lock cache setting to atr regs + update_atr(); + } return sensor_value_t("LO", locked, "locked", "unlocked"); } |