1 from spec
.interfaces
import Pinouts
3 from spec
.ifaceprint
import display
, display_fns
, check_functions
4 from spec
.ifaceprint
import display_fixed
7 class PinSpec(Pinouts
):
8 def __init__(self
, pinbanks
, fixedpins
, function_names
, fast
=None):
9 self
.fastbus
= fast
or {}
12 for bank
, (sz
, muxwidth
) in pinbanks
.items():
13 self
.pinbanks
[bank
] = sz
14 self
.muxwidths
[bank
] = muxwidth
15 self
.fixedpins
= fixedpins
16 self
.function_names
= function_names
19 pkeys
= sorted(self
.pinbanks
.keys())
22 bankspec
[kn
] = self
.offs
23 self
.offs
+= self
.pinbanks
[kn
]
27 Pinouts
.__init
__(self
, bankspec
)
29 def add_scenario(self
, name
, needed
, eint
, pwm
, descriptions
):
30 # Scenarios below can be spec'd out as either "find first interface"
31 # by name/number e.g. SPI0, or as "find in bank/mux" which must be
32 # spec'd as "BM:Name" where B is bank (A-F), M is Mux (0-3)
33 # EINT and PWM are grouped together, specially, but may still be spec'd
34 # using "BM:Name". Pins are removed in-order as listed from
35 # lists (interfaces, EINTs, PWMs) from available pins.
37 self
.scenarios
.append((name
, needed
, eint
, pwm
, descriptions
))
40 of
.write("""# Pinouts (PinMux)
41 auto-generated by [[pinouts.py]]
46 bk
= sorted(self
.pinbanks
.keys())
49 "\n## Bank %s (%d pins, width %d)\n\n" %
50 (bank
, self
.pinbanks
[bank
], self
.muxwidths
[bank
]))
51 display(of
, self
, bank
, muxwidth
=self
.muxwidths
[bank
])
53 of
.write("\n# Pinouts (Fixed function)\n\n")
54 fixedpins
= display_fixed(of
, self
.fixedpins
, len(self
))
56 of
.write("""# Functions (PinMux)
58 auto-generated by [[pinouts.py]]
61 fns
= display_fns(of
, self
.bankspec
, self
, self
.function_names
)
64 for scenario
in self
.scenarios
:
65 name
, needed
, eint
, pwm
, descriptions
= scenario
66 unused_pins
= check_functions(of
, name
, self
.bankspec
, fns
,
71 of
.write("""# Reference Datasheets
73 datasheets and pinout links
74 * <http://datasheets.chipdb.org/AMD/8018x/80186/amd-80186.pdf>
75 * <http://hands.com/~lkcl/eoma/shenzen/frida/FRD144A2701.pdf>
76 * <http://pinouts.ru/Memory/sdcard_pinout.shtml>
77 * p8 <http://www.onfi.org/~/media/onfi/specs/onfi_2_0_gold.pdf?la=en>
78 * <https://www.heyrick.co.uk/blog/files/datasheets/dm9000aep.pdf>
79 * <http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4393.pdf>
80 * <https://www.nxp.com/docs/en/data-sheet/MCF54418.pdf>
81 * ULPI OTG PHY, ST <http://www.st.com/en/interfaces-and-transceivers/stulpi01a.html>
82 * ULPI OTG PHY, TI TUSB1210 <http://ti.com/product/TUSB1210/>
86 return self
, self
.bankspec
, self
.pinbanks
, fixedpins