diff options
| author | Martin Braun <martin.braun@ettus.com> | 2017-10-06 16:58:52 -0700 | 
|---|---|---|
| committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:04:02 -0800 | 
| commit | 5c489c2597948b131aaddb516fe6af40e438b251 (patch) | |
| tree | 984cc0dd2c9c13aea1f36cfff73bababdd265d46 /mpm/python/usrp_mpm | |
| parent | e2f8f8e0bd36171246e99d96a5155a5b098f6700 (diff) | |
| download | uhd-5c489c2597948b131aaddb516fe6af40e438b251.tar.gz uhd-5c489c2597948b131aaddb516fe6af40e438b251.tar.bz2 uhd-5c489c2597948b131aaddb516fe6af40e438b251.zip | |
mpm/n310: Moved the mboard ref_locked sensor into MPM
An N310 device will query all its dboards for ref lock status and
return a Boolean combination as a motherboard sensors (note: the N310
does not actually have a ref_locked sensor on the motherboard, this is
mostly for backwards-compat with UHD applications that expect a
motherboard ref lock sensor).
Diffstat (limited to 'mpm/python/usrp_mpm')
| -rw-r--r-- | mpm/python/usrp_mpm/periph_manager/n310.py | 28 | 
1 files changed, 28 insertions, 0 deletions
| diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py index c6ae10241..a920fd35b 100644 --- a/mpm/python/usrp_mpm/periph_manager/n310.py +++ b/mpm/python/usrp_mpm/periph_manager/n310.py @@ -214,6 +214,9 @@ class n310(PeriphManagerBase):      mboard_eeprom_max_len = 256      mboard_info = {"type": "n3xx"}      mboard_max_rev = 3 # 3 == RevD +    mboard_sensor_callback_map = { +        'ref_locked': 'get_ref_lock_sensor', +    }      dboard_eeprom_addr = "e0004000.i2c"      dboard_eeprom_max_len = 64      # We're on a Zynq target, so the following two come from the Zynq standard @@ -483,3 +486,28 @@ class n310(PeriphManagerBase):          ))          self._gpios.set("PWREN-CLK-MAINREF", int(bool(enable))) +    ########################################################################### +    # Sensors +    ########################################################################### +    def get_ref_lock_sensor(self): +        """ +        The N310 has no ref lock sensor, but because the ref lock is +        historically considered a motherboard-level sensor, we will return the +        combined lock status of all daughterboards. If no dboard is connected, +        or none has a ref lock sensor, we simply return True. +        """ +        self.log.trace( +            "Querying ref lock status from %d dboards.", +            len(self.dboards) +        ) +        lock_status = all([ +            not hasattr(db, 'get_ref_lock') or db.get_ref_lock() +            for db in self.dboards +        ]) +        return { +            'name': 'ref_locked', +            'type': 'BOOLEAN', +            'unit': 'locked' if lock_status else 'unlocked', +            'value': str(lock_status).lower(), +        } + | 
