X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fifacebase.py;h=81e4e9d2fcaa8da932a5bd04206744effcbd5052;hb=964251075187857f74b9438eea25e38e5ca56442;hp=c5487a1c3946562e55902f3714ab5200b7b60cb9;hpb=f4c61ad1224b12e76e20b899b4a9a02034355ce5;p=pinmux.git diff --git a/src/ifacebase.py b/src/ifacebase.py index c5487a1..81e4e9d 100644 --- a/src/ifacebase.py +++ b/src/ifacebase.py @@ -10,9 +10,12 @@ class InterfacesBase(UserDict): """ contains a list of interface definitions """ - def __init__(self, ifacekls, pth=None): + def __init__(self, ifacekls, pth=None, ifaceklsdict=None): self.pth = pth + self.fastbus = [] self.ifacecount = [] + if ifaceklsdict is None: + ifaceklsdict = {} UserDict.__init__(self, {}) if not pth: return @@ -25,20 +28,36 @@ class InterfacesBase(UserDict): ln = ln.split("\t") name = ln[0] # will have uart count = int(ln[1]) # will have count of uart + self.fastbus += ln[2:] # spec looks like this: """ [{'name': 'sda', 'outen': True}, {'name': 'scl', 'outen': True}, ] """ + ikls = ifacekls + for k, v in ifaceklsdict.items(): + if name.startswith(k): + ikls = v + break 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 = ikls(name, spec[:1], ganged, False) + self.ifaceadd(name, len(spec), iface) + else: + iface = ikls(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 @@ -66,7 +85,8 @@ class InterfacesBase(UserDict): ln = ln.strip() ln = ln.split("\t") name = ln[0] - d = {'name': name} # here we start to make the dictionary + d = {'name': name, # here we start to make the dictionary + 'type': ln[1]} if ln[1] == 'out': d['action'] = True # adding element to the dict elif ln[1] == 'inout':