#!/usr/bin/env python
-from spec.interfaces import Pinouts
+from spec.base import PinSpec
from spec.ifaceprint import display, display_fns, check_functions
from spec.ifaceprint import display_fixed
-def pinspec(of):
+def pinspec():
pinbanks = {
- 'B': 28,
+ 'A': 28,
}
- bankspec = {}
- pkeys = sorted(pinbanks.keys())
- offs = 0
- for kn in pkeys:
- bankspec[kn] = offs
- offs += pinbanks[kn]
-
- pinouts = Pinouts(bankspec)
-
- # Bank B, 16-47
- pinouts.gpio("", ('B', 0), "B", 0, 0, 28)
- pinouts.rgbttl("", ('B', 0), "B", 1, limit=23)
- pinouts.spi("0", ('B', 10), "B", 2)
- pinouts.quadspi("", ('B', 4), "B", 2)
- pinouts.uart("0", ('B', 16), "B", 2)
- pinouts.i2c("2", ('B', 18), "B", 2)
- pinouts.pwm("", ('B', 21), "B", 2, 0, 3)
- pinouts.sdmmc("0", ('B', 22), "B", 3)
- pinouts.eint("", ('B', 0), "B", 3, 0, 4)
- pinouts.eint("", ('B', 20), "B", 2, 4, 1)
- pinouts.eint("", ('B', 23), "B", 1, 5, 1)
- pinouts.sdmmc("1", ('B', 4), "B", 3)
- pinouts.jtag("1", ('B', 10), "B", 3)
- pinouts.uartfull("0", ('B', 14), "B", 3)
- pinouts.uartfull("1", ('B', 18), "B", 3)
- pinouts.jtag("0", ('B', 24), "B", 2)
- pinouts.spi("1", ('B', 24), "B", 1)
- pinouts.i2c("0", ('B', 0), "B", 2)
- pinouts.uart("1", ('B', 2), "B", 2)
- pinouts.uart("2", ('B', 14), "B", 2)
-
- of.write("""# Pinouts (PinMux)
-auto-generated by [[pinouts.py]]
-
-[[!toc ]]
-
-""")
- display(of, pinouts)
-
- of.write("\n# Pinouts (Fixed function)\n\n")
-
fixedpins = {
'CTRL_SYS': [
'TEST',
'VDD_GPIOB',
'GND_GPIOB',
]}
-
- fixedpins = display_fixed(of, fixedpins, len(pinouts))
-
- of.write("""# Functions (PinMux)
-
-auto-generated by [[pinouts.py]]
-
-""")
-
function_names = {'EINT': 'External Interrupt',
'FB': 'MC68k FlexBus',
'IIS': 'I2S Audio',
- 'JTAG0': 'JTAG (same as JTAG1, JTAG_SEL=LOW)',
- 'JTAG1': 'JTAG (same as JTAG0, JTAG_SEL=HIGH)',
+ 'JTAG': 'JTAG (JTAG_SEL=HI/LO)',
'LCD': '24-pin RGB/TTL LCD',
'RG': 'RGMII Ethernet',
'MMC': 'eMMC 1/2/4/8 pin',
'TWI0': 'I2C 0',
'TWI1': 'I2C 1',
'TWI2': 'I2C 2',
- 'UARTQ0': 'UART (TX/RX/CTS/RTS) 0',
- 'UARTQ1': 'UART (TX/RX/CTS/RTS) 1',
+ 'QUART0': 'UART (TX/RX/CTS/RTS) 0',
+ 'QUART1': 'UART (TX/RX/CTS/RTS) 1',
'UART0': 'UART (TX/RX) 0',
'UART1': 'UART (TX/RX) 1',
'UART2': 'UART (TX/RX) 2',
'ULPI2': 'ULPI (USB Low Pin-count) 2',
}
- fns = display_fns(of, bankspec, pinouts, function_names)
- of.write("\n")
+ ps = PinSpec(pinbanks, fixedpins, function_names)
+
+ # Bank A, 0-27
+ ps.gpio("", ('A', 0), 0, 0, 28)
+ ps.rgbttl("", ('A', 0), 1, limit=23)
+ ps.spi("0", ('A', 10), 2)
+ ps.quadspi("", ('A', 4), 2)
+ ps.uart("0", ('A', 16), 2)
+ ps.i2c("1", ('A', 18), 2)
+ ps.pwm("", ('A', 21), 2, 0, 3)
+ ps.sdmmc("0", ('A', 22), 3)
+ ps.eint("", ('A', 0), 3, 0, 4)
+ ps.eint("", ('A', 20), 2, 4, 1)
+ ps.eint("", ('A', 23), 1, 5, 1)
+ ps.sdmmc("1", ('A', 4), 3)
+ ps.jtag("", ('A', 10), 3)
+ ps.uartfull("0", ('A', 14), 3)
+ ps.uartfull("1", ('A', 18), 3)
+ ps.jtag("", ('A', 24), 2)
+ ps.spi("1", ('A', 24), 1)
+ ps.i2c("0", ('A', 0), 2)
+ ps.uart("1", ('A', 2), 2)
+ ps.uart("2", ('A', 14), 2)
# Scenarios below can be spec'd out as either "find first interface"
# by name/number e.g. SPI1, or as "find in bank/mux" which must be
minitest_pwm = ['B2:PWM_0']
descriptions = {
'MMC': 'internal (on Card)',
- 'SD0': 'user-facing: internal (on Card), multiplexed with JTAG1\n'
+ 'SD0': 'user-facing: internal (on Card), multiplexed with JTAG\n'
'and UART2, for debug purposes',
'TWI2': 'I2C.\n',
'E2:SD1': '',
'ULPI1': 'dual USB2 Host ULPI PHY'
}
- unused_pins = check_functions(of, "MiniTest", bankspec, fns, pinouts,
- minitest, minitest_eint, minitest_pwm,
- descriptions)
-
- of.write("""# Reference Datasheets
-
-datasheets and pinout links
-* <http://datasheets.chipdb.org/AMD/8018x/80186/amd-80186.pdf>
-* <http://hands.com/~lkcl/eoma/shenzen/frida/FRD144A2701.pdf>
-* <http://pinouts.ru/Memory/sdcard_pinout.shtml>
-* p8 <http://www.onfi.org/~/media/onfi/specs/onfi_2_0_gold.pdf?la=en>
-* <https://www.heyrick.co.uk/blog/files/datasheets/dm9000aep.pdf>
-* <http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4393.pdf>
-* <https://www.nxp.com/docs/en/data-sheet/MCF54418.pdf>
-* ULPI OTG PHY, ST <http://www.st.com/en/interfaces-and-transceivers/stulpi01a.html>
-* ULPI OTG PHY, TI TUSB1210 <http://ti.com/product/TUSB1210/>
-
-""")
+ ps.add_scenario("MiniTest", minitest, minitest_eint, minitest_pwm,
+ descriptions)
- return pinouts, bankspec, pinbanks, fixedpins
+ return ps