add master-only spi and quad-spi
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 24 Jul 2018 13:22:38 +0000 (14:22 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 24 Jul 2018 13:22:38 +0000 (14:22 +0100)
src/bsv/peripheral_gen/base.py
src/bsv/peripheral_gen/nspi.py
src/bsv/peripheral_gen/qspi.py
src/bsv/peripheral_gen/spi.py

index 324fbf3e1ac8417cffc7920ad7485109bbc254d9..a595dbe23306444b58474dcb8386a4713cf9630c 100644 (file)
@@ -404,8 +404,8 @@ class PFactory(object):
         from twi import twi
         from eint import eint
         from jtag import jtag
-        from spi import spi
-        from qspi import qspi
+        from spi import spi, mspi
+        from qspi import qspi, mqspi
         from gpio import gpio
         from rgbttl import rgbttl
 
@@ -413,6 +413,8 @@ class PFactory(object):
                      'rs232': rs232,
                      'twi': twi,
                      'quart': quart,
+                     'mqspi': mqspi,
+                     'mspi': mspi,
                      'qspi': qspi,
                      'spi': spi,
                      'pwm': pwm,
index 894577943b028e5f0a021259cc05a2159bc2def3..a9b61b468693cc027cb56ec8449ab68f64d529e6 100644 (file)
@@ -3,9 +3,13 @@ from bsv.peripheral_gen.base import PBase
 
 class nspi(PBase):
 
-    def __init__(self, name):
+    def __init__(self, name, masteronly):
         PBase.__init__(self, name)
+        if masteronly:
+            name = "m" + name
         self.ifndict = {'N': name.upper(), 'n': name}
+        self.masteronly = masteronly
+        assert masteronly, "Only master only %s supported for now" % name
 
     def slowimport(self):
         return "    import %(n)s              :: *;" % self.ifndict
index 17e1585987412b9c638a56448519b57a9fb262c8..18ae219b2e4b31a8998c7396be7f4885fd6990a3 100644 (file)
@@ -1,4 +1,9 @@
 from bsv.peripheral_gen.nspi import nspi
 
+class mqspi(nspi):
+    def __init__(self, name):
+        nspi.__init__(self, name, True)
+
 class qspi(nspi):
-    pass
+    def __init__(self, name):
+        nspi.__init__(self, name, False)
index 0b2ffb962fb057ed10437501506a0764259745ba..8b347ae28f72c7956cebfcffb5e2af342889ddaa 100644 (file)
@@ -1,4 +1,10 @@
 from bsv.peripheral_gen.nspi import nspi
 
+class mspi(nspi):
+    def __init__(self, name):
+        nspi.__init__(self, name, True)
+
 class spi(nspi):
-    pass
+    def __init__(self, name):
+        nspi.__init__(self, name, False)
+