From af5a2cb6280add9b97bbc7859d0538589f007e7f Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 24 Jul 2018 14:22:38 +0100 Subject: [PATCH] add master-only spi and quad-spi --- src/bsv/peripheral_gen/base.py | 6 ++++-- src/bsv/peripheral_gen/nspi.py | 6 +++++- src/bsv/peripheral_gen/qspi.py | 7 ++++++- src/bsv/peripheral_gen/spi.py | 8 +++++++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/bsv/peripheral_gen/base.py b/src/bsv/peripheral_gen/base.py index 324fbf3..a595dbe 100644 --- a/src/bsv/peripheral_gen/base.py +++ b/src/bsv/peripheral_gen/base.py @@ -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, diff --git a/src/bsv/peripheral_gen/nspi.py b/src/bsv/peripheral_gen/nspi.py index 8945779..a9b61b4 100644 --- a/src/bsv/peripheral_gen/nspi.py +++ b/src/bsv/peripheral_gen/nspi.py @@ -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 diff --git a/src/bsv/peripheral_gen/qspi.py b/src/bsv/peripheral_gen/qspi.py index 17e1585..18ae219 100644 --- a/src/bsv/peripheral_gen/qspi.py +++ b/src/bsv/peripheral_gen/qspi.py @@ -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) diff --git a/src/bsv/peripheral_gen/spi.py b/src/bsv/peripheral_gen/spi.py index 0b2ffb9..8b347ae 100644 --- a/src/bsv/peripheral_gen/spi.py +++ b/src/bsv/peripheral_gen/spi.py @@ -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) + -- 2.30.2