from spec.pinfunctions import pinspec
from copy import deepcopy
+
def namesuffix(name, suffix, namelist):
names = []
for n in namelist:
in combination with setattr (below) gives the function a name
in the Pinouts class, according to the pinspec.
"""
+
def __init__(self, pinouts, fname, pinfn, bankspec):
self.pinouts = pinouts
self.bankspec = bankspec
prefix, pingroup = pingroup
else:
prefix = self.fname
- if start and limit: # limit turns into an offset from start
+ if start and limit: # limit turns into an offset from start
limit = start + limit
- pingroup = pingroup[start:limit] # see comment in spec.pinfunctions
+ pingroup = pingroup[start:limit] # see comment in spec.pinfunctions
pins = Pins(prefix, pingroup, self.bankspec,
suffix, offs, bank, mux,
spec, origsuffix=suffix)
# pinouts class
+
class Pinouts(object):
def __init__(self, bankspec):
self.bankspec = bankspec
for k in v:
assert k not in self.pins[pinidx], \
"pin %d position %d already taken\n%s\n%s" % \
- (pinidx, k, str(v), self.pins[pinidx])
+ (pinidx, k, str(v), self.pins[pinidx])
self.pins[pinidx].update(v)
def keys(self):
specname = fname + suffix
else:
specname = fname
- #print "fname bank specname suffix ", fname, bank, specname, repr(
+ # print "fname bank specname suffix ", fname, bank, specname, repr(
# suffix)
if specname in self.fnspec[fname]:
# ok so some declarations may bring in different
def pinspec():
pinbanks = {
- 'B': 28,
- }
+ 'B': 28,
+ }
bankspec = {}
pkeys = sorted(pinbanks.keys())
offs = 0
pinouts.uart("1", ('B', 2), "B", 2)
pinouts.uart("2", ('B', 14), "B", 2)
-
print ("""# Pinouts (PinMux)
auto-generated by [[pinouts.py]]
# lists (interfaces, EINTs, PWMs) from available pins.
minitest = ['ULPI0/8', 'ULPI1', 'MMC', 'SD0', 'UART0',
- 'TWI0', 'SPI0', 'B3:SD1', ]
+ 'TWI0', 'SPI0', 'B3:SD1', ]
minitest_eint = ['EINT_0', 'EINT_1', 'EINT_2', 'EINT_3', 'EINT_4']
minitest_pwm = ['B2:PWM_0']
descriptions = {
minitest, minitest_eint, minitest_pwm,
descriptions)
-
print ("""# Reference Datasheets
datasheets and pinout links
added). see spec.interfaces.PinGen class slice on pingroup
"""
+
def i2s(suffix, bank):
return ['MCK+', 'BCK+', 'LRCK+', 'DI-', 'DO+']
+
def emmc(suffix, bank):
emmcpins = ['CMD+', 'CLK+']
for i in range(8):
emmcpins.append("D%d*" % i)
return emmcpins
+
def sdmmc(suffix, bank):
sdmmcpins = ['CMD+', 'CLK+']
for i in range(4):
sdmmcpins.append("D%d*" % i)
return sdmmcpins
+
def spi(suffix, bank):
return ['CLK*', 'NSS*', 'MOSI*', 'MISO*']
+
def quadspi(suffix, bank):
return ['CK*', 'NSS*', 'IO0*', 'IO1*', 'IO2*', 'IO3*']
+
def i2c(suffix, bank):
return ['SDA*', 'SCL*']
+
def jtag(suffix, bank):
return ['MS+', 'DI-', 'DO+', 'CK+']
+
def uart(suffix, bank):
return ['TX+', 'RX-']
+
def ulpi(suffix, bank):
ulpipins = ['CK+', 'DIR+', 'STP+', 'NXT+']
for i in range(8):
ulpipins.append('D%d*' % i)
return ulpipins
+
def uartfull(suffix, bank):
return ['TX+', 'RX-', 'CTS-', 'RTS+']
+
def rgbttl(suffix, bank):
ttlpins = ['CK+', 'DE+', 'HS+', 'VS+']
for i in range(24):
ttlpins.append("D%d+" % i)
return ttlpins
+
def rgmii(suffix, bank):
buspins = []
for i in range(4):
'ECOL+', 'ETXERR+']
return buspins
+
def flexbus1(suffix, bank):
buspins = []
for i in range(8):
buspins.append("CS%d+" % i)
return buspins
+
def flexbus2(suffix, bank):
buspins = []
for i in range(8, 32):
buspins.append("AD%d*" % i)
return buspins
+
def sdram1(suffix, bank):
buspins = []
for i in range(16):
'SDRRST+']
return buspins
+
def sdram2(suffix, bank):
buspins = []
for i in range(3, 6):
buspins.append("SDRDQ%d*" % i)
return buspins
+
def mcu8080(suffix, bank):
buspins = []
for i in range(8):
'MCURST+']
return buspins
+
class RangePin(object):
def __init__(self, suffix, prefix=None):
self.suffix = suffix
res.append("%s%d%s" % (self.prefix, idx, self.suffix))
return res
+
def eint(suffix, bank):
return RangePin("*")
+
def pwm(suffix, bank):
return RangePin("+")
+
def gpio(suffix, bank):
return ("GPIO%s" % bank, RangePin(prefix=bank, suffix="*"))
('EINT', eint),
('PWM', pwm),
('GPIO', gpio),
- )
-
+ )