From b14cafd90c84e69cdb77aec2d8553c4d45213b8f Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 16 Nov 2017 16:41:32 -0800 Subject: mpm: mg: Add dboard sensors for low- and highband LO lock status - Add LO locked APIs to Magnesium - Add LO locked sensor APIs for RX/TX and highband/lowband LOs - Poll all those sensors from magnesium_radio_ctrl_impl Reviewed-By: Steven Bingler Reviewed-By: Trung Tran --- mpm/python/usrp_mpm/dboard_manager/base.py | 9 ++++--- mpm/python/usrp_mpm/dboard_manager/magnesium.py | 31 ++++++++++++++++--------- 2 files changed, 26 insertions(+), 14 deletions(-) (limited to 'mpm/python') 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', -- cgit v1.2.3