add horrible hack for turning single-interface PWM into multi-single pin
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 21 Jul 2018 02:58:41 +0000 (03:58 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 21 Jul 2018 02:58:41 +0000 (03:58 +0100)
src/ifacebase.py
src/parse.py

index 72dbcc9d06ef579673275866d46f429dcc850993..3a3bf1d245d41dc8ed311e3dd9dd7bda20e76b5c 100644 (file)
@@ -32,13 +32,23 @@ class InterfacesBase(UserDict):
                 ]
                 """
                 spec, ganged = self.read_spec(pth, name)
-                iface = ifacekls(name, spec, ganged, count == 1)
-                self.ifaceadd(name, count, iface)
+                # XXX HORRIBLE hack!!!
+                if name == 'pwm' and count == 1 and len(spec) != 1:
+                    #print "read", name, count, spec, ganged
+                    #print "multi pwm", spec[:1], len(spec)
+                    spec[0]['name'] = 'out'
+                    iface = ifacekls(name, spec[:1], ganged, False)
+                    self.ifaceadd(name, len(spec), iface)
+                else:
+                    iface = ifacekls(name, spec, ganged, count == 1)
+                    self.ifaceadd(name, count, iface)
 
     def getifacetype(self, fname):
         # finds the interface type, e.g sd_d0 returns "inout"
         for iface in self.values():
             typ = iface.getifacetype(fname)
+            #if fname.startswith('pwm'):
+            #   print fname, iface.ifacename, typ
             if typ:
                 return typ
         return None
index b8efe821174b168a1a56005637345638be5f8a5c..a233334e51403732194fcdf3efb645ebac76c3f9 100644 (file)
@@ -52,6 +52,10 @@ class Parse(object):
                 if len(line1) == 2:  # dedicated
                     self.dedicated_cells.append(line1)
                 else:
+                    for i in range(1, len(line1)):
+                        # XXX HORRIBLE HACK!!
+                        if line1[i].startswith('pwm'):
+                            line1[i] = 'pwm%s_out' % line1[i][4:]
                     self.muxed_cells.append(line1)
 
         self.pinnumbers = sorted(self.pinnumbers)