From 5e585897f358b97e1d2fcdca805daddeaa6d2596 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 24 Jul 2018 12:53:22 +0100 Subject: [PATCH] make sd bus connection --- src/bsv/peripheral_gen/sdmmc.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/bsv/peripheral_gen/sdmmc.py b/src/bsv/peripheral_gen/sdmmc.py index 74db274..69f2d76 100644 --- a/src/bsv/peripheral_gen/sdmmc.py +++ b/src/bsv/peripheral_gen/sdmmc.py @@ -15,14 +15,21 @@ class sdmmc(PBase): def _mk_connection(self, name=None, count=0): return "sd{0}.slave" - def pinname_in(self, pname): - return "%s_in" % pname - def pinname_out(self, pname): - if pname.startswith('d'): - return "%s_out" % pname - return pname + if pname in ['cmd', 'clk']: + return pname + return '' + + def mk_pincon(self, name, count): + ret = [PBase.mk_pincon(self, name, count)] + # special-case for gpio in, store in a temporary vector + plen = len(self.peripheral.pinspecs) + template = " mkConnection({0}.{1},\n\t\t\t{2}.{1});" + sname = self.peripheral.iname().format(count) + name = self.get_iname(count) + ps = "pinmux.peripheral_side.%s" % sname + n = "{0}".format(name) + for ptype in ['out', 'out_en', 'in']: + ret.append(template.format(ps, ptype, n)) + return '\n'.join(ret) - def pinname_outen(self, pname): - if pname.startswith('d'): - return "%s_outen" % pname -- 2.30.2