make sd bus connection
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 24 Jul 2018 11:53:22 +0000 (12:53 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 24 Jul 2018 11:53:22 +0000 (12:53 +0100)
src/bsv/peripheral_gen/sdmmc.py

index 74db274a69b8e6525c194bc4b7a9f82de43cc011..69f2d763cef083e5828f28234482423122e6eab3 100644 (file)
@@ -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