aboutsummaryrefslogtreecommitdiffstats
path: root/mpm/python
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-07-28 14:36:08 -0700
committerMartin Braun <martin.braun@ettus.com>2017-12-22 15:04:00 -0800
commit90f608fa75ca65fb0220742f311cffbefe7a2129 (patch)
tree7ea1967db7ae85d51a252f236d4f27dedb60896e /mpm/python
parenteb2b11524bf4e65c48a0853d3f9cdb4ad9ee1719 (diff)
downloaduhd-90f608fa75ca65fb0220742f311cffbefe7a2129.tar.gz
uhd-90f608fa75ca65fb0220742f311cffbefe7a2129.tar.bz2
uhd-90f608fa75ca65fb0220742f311cffbefe7a2129.zip
n3xx mpm: Enable more subcomponents through API calls
Diffstat (limited to 'mpm/python')
-rw-r--r--mpm/python/usrp_mpm/periph_manager/n310.py49
1 files changed, 44 insertions, 5 deletions
diff --git a/mpm/python/usrp_mpm/periph_manager/n310.py b/mpm/python/usrp_mpm/periph_manager/n310.py
index 0c700bd1d..764ebc8d6 100644
--- a/mpm/python/usrp_mpm/periph_manager/n310.py
+++ b/mpm/python/usrp_mpm/periph_manager/n310.py
@@ -36,6 +36,8 @@ from .. import libpyusrp_periphs as lib
N3XX_DEFAULT_EXT_CLOCK_FREQ = 10e6
N3XX_DEFAULT_CLOCK_SOURCE = 'external'
N3XX_DEFAULT_TIME_SOURCE = 'internal'
+N3XX_DEFAULT_ENABLE_GPS = True
+N3XX_DEFAULT_ENABLE_FPGPIO = True
class TCA6424(object):
"""
@@ -183,15 +185,24 @@ class n310(PeriphManagerBase):
eth_tables = {'eth1': 'misc-enet-regs0', 'eth2': 'misc-enet-regs1'}
def __init__(self, args):
- # First initialize parent class - will populate self._eeprom_head and self._eeprom_rawdata
super(n310, self).__init__(args)
-
self.log.trace("Initializing TCA6424 port expander controls...")
self._gpios = TCA6424()
-
- # Initialize reference clock
- self._gpios.set("PWREN-CLK-MAINREF")
self._gpios.set("PWREN-CLK-MGT156MHz")
+ self.enable_gps(
+ enable=bool(
+ args.default_args.get('enable_gps', N3XX_DEFAULT_ENABLE_GPS)
+ )
+ )
+ self.enable_fp_gpio(
+ enable=bool(
+ args.default_args.get(
+ 'enable_fp_gpio',
+ N3XX_DEFAULT_ENABLE_FPGPIO
+ )
+ )
+ )
+ self.enable_ref_clock(enable=True)
self._ext_clock_freq = float(
args.default_args.get('ext_clock_freq', N3XX_DEFAULT_EXT_CLOCK_FREQ)
)
@@ -378,3 +389,31 @@ class n310(PeriphManagerBase):
else:
assert False
+ def enable_gps(self, enable):
+ """
+ Turn power to the GPS off or on.
+ """
+ self.log.trace("{} power to GPS".format(
+ "Enabling" if enable else "Disabling"
+ ))
+ self._gpios.set("PWREN-GPS", int(bool(enable)))
+
+ def enable_fp_gpio(self, enable):
+ """
+ Turn power to the front panel GPIO off or on.
+ """
+ self.log.trace("{} power to front-panel GPIO".format(
+ "Enabling" if enable else "Disabling"
+ ))
+ self._gpios.set("FPGA-GPIO-EN", int(bool(enable)))
+
+ def enable_ref_clock(self, enable):
+ """
+ Enables the ref clock voltage (+3.3-MAINREF). Without setting this to
+ True, *no* ref clock works.
+ """
+ self.log.trace("{} power to reference clocks".format(
+ "Enabling" if enable else "Disabling"
+ ))
+ self._gpios.set("PWREN-CLK-MAINREF", int(bool(enable)))
+