diff options
-rw-r--r-- | host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp | 28 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/dboard_manager/base.py | 9 | ||||
-rw-r--r-- | mpm/python/usrp_mpm/dboard_manager/magnesium.py | 31 |
3 files changed, 52 insertions, 16 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 52bce2e9a..290c5f541 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_ctrl_impl.cpp @@ -430,9 +430,33 @@ void magnesium_radio_ctrl_impl::set_rpc_client( } bool magnesium_radio_ctrl_impl::get_lo_lock_status( - const direction_t /*dir*/ + const direction_t dir ) { - return bool(_rpcc); // FIXME + if (not (bool(_rpcc))) { + UHD_LOG_DEBUG(unique_id(), + "Reported no LO lock due to lack of RPC connection."); + return false; + } + + const std::string trx = (dir == RX_DIRECTION) ? "rx" : "tx"; + const size_t chan = 0; // They're the same after all + const double freq = (dir == RX_DIRECTION) ? + get_rx_frequency(chan) : + get_tx_frequency(chan); + + bool lo_lock = _rpcc->request_with_token<bool>( + _rpc_prefix + "get_ad9371_lo_lock", trx); + UHD_LOG_TRACE(unique_id(), + "AD9371 " << trx << " LO reports lock: " << (lo_lock ? "Yes" : "No")); + if (lo_lock && freq < MAGNESIUM_LOWBAND_FREQ) { + lo_lock = lo_lock && _rpcc->request_with_token<bool>( + _rpc_prefix + "get_lowband_lo_lock", trx); + UHD_LOG_TRACE(unique_id(), + "ADF4351 " << trx << " LO reports lock: " + << (lo_lock ? "Yes" : "No")); + } + + return lo_lock; } UHD_RFNOC_BLOCK_REGISTER(magnesium_radio_ctrl, "MagnesiumRadio"); diff --git a/mpm/python/usrp_mpm/dboard_manager/base.py b/mpm/python/usrp_mpm/dboard_manager/base.py index ef12c697a..82263bddc 100644 --- a/mpm/python/usrp_mpm/dboard_manager/base.py +++ b/mpm/python/usrp_mpm/dboard_manager/base.py @@ -135,7 +135,10 @@ class DboardManagerBase(object): """ self.log.warning("update_ref_clock_freq() called but not implemented") - def get_sensors(self, direction): + ########################################################################## + # Sensors + ########################################################################## + def get_sensors(self, direction, chan=0): """ Return a list of RX daughterboard sensor names. @@ -146,7 +149,7 @@ class DboardManagerBase(object): else: return list(self.tx_sensor_callback_map.keys()) - def get_sensor(self, direction, sensor_name): + def get_sensor(self, direction, sensor_name, chan=0): """ Return a dictionary that represents the sensor values for a given sensor. If the requested sensor sensor_name does not exist, throw an @@ -166,5 +169,5 @@ class DboardManagerBase(object): raise RuntimeError(error_msg) return getattr( self, callback_map.get('sensor_name') - )() + )(chan) diff --git a/mpm/python/usrp_mpm/dboard_manager/magnesium.py b/mpm/python/usrp_mpm/dboard_manager/magnesium.py index 1e24eb046..d3c8c0bb6 100644 --- a/mpm/python/usrp_mpm/dboard_manager/magnesium.py +++ b/mpm/python/usrp_mpm/dboard_manager/magnesium.py @@ -722,11 +722,19 @@ class Magnesium(DboardManagerBase): either 'tx' or 'rx' """ assert which.lower() in ('tx', 'rx') - return self.cpld.get_lo_lock_status(which) + return self.cpld.get_lo_lock_status(which.upper()) - def get_lowband_tx_lo_locked_sensor(self): + def get_ad9371_lo_lock(self, which): + """ + Return LO lock status (Boolean!) of the lowband LOs. 'which' must be + either 'tx' or 'rx' + """ + return self.mykonos.get_lo_locked(which.upper()) + + def get_lowband_tx_lo_locked_sensor(self, chan): " TX lowband LO lock sensor " - self.log.trace("Querying TX lowband LO lock status...") + self.log.trace("Querying TX lowband LO lock status for chan %d...", + chan) lock_status = self.get_lowband_lo_lock('tx') return { 'name': 'lowband_lo_locked', @@ -735,9 +743,10 @@ class Magnesium(DboardManagerBase): 'value': str(lock_status).lower(), } - def get_lowband_rx_lo_locked_sensor(self): + def get_lowband_rx_lo_locked_sensor(self, chan): " RX lowband LO lock sensor " - self.log.trace("Querying RX lowband LO lock status...") + self.log.trace("Querying RX lowband LO lock status for chan %d...", + chan) lock_status = self.get_lowband_lo_lock('rx') return { 'name': 'lowband_lo_locked', @@ -746,10 +755,10 @@ class Magnesium(DboardManagerBase): 'value': str(lock_status).lower(), } - def get_ad9371_tx_lo_locked_sensor(self): + def get_ad9371_tx_lo_locked_sensor(self, chan): " TX ad9371 LO lock sensor " - self.log.trace("Querying TX AD9371 LO lock status...") - lock_status = True # FIXME + self.log.trace("Querying TX AD9371 LO lock status for chan %d...", chan) + lock_status = self.get_ad9371_lo_lock('tx') return { 'name': 'ad9371_lo_locked', 'type': 'BOOLEAN', @@ -757,10 +766,10 @@ class Magnesium(DboardManagerBase): 'value': str(lock_status).lower(), } - def get_ad9371_rx_lo_locked_sensor(self): + def get_ad9371_rx_lo_locked_sensor(self, chan): " RX ad9371 LO lock sensor " - self.log.trace("Querying RX AD9371 LO lock status...") - lock_status = True # FIXME + self.log.trace("Querying RX AD9371 LO lock status for chan %d...", chan) + lock_status = self.get_ad9371_lo_lock('tx') return { 'name': 'ad9371_lo_locked', 'type': 'BOOLEAN', |