adding documentation for generating pimux.bsv
[pinmux.git] / src / spec / minitest_old.py
1 #!/usr/bin/env python
2
3 from spec.base import PinSpec
4
5 from spec.ifaceprint import display, display_fns, check_functions
6 from spec.ifaceprint import display_fixed
7
8
9 def pinspec():
10 pinbanks = {
11 'A': (28, 4),
12 'B': (4, 1),
13 }
14 fixedpins = {
15 'CTRL_SYS': [
16 'TEST',
17 'JTAG_SEL',
18 'UBOOT_SEL',
19 'NMI#',
20 'RESET#',
21 'CLK24M_IN',
22 'CLK24M_OUT',
23 'PLLTEST',
24 'PLLREGIO',
25 'PLLVP25',
26 'PLLDV',
27 'PLLVREG',
28 'PLLGND',
29 ],
30 'POWER_GPIO': [
31 'VDD_GPIOB',
32 'GND_GPIOB',
33 ]}
34 function_names = {'EINT': 'External Interrupt',
35 'FB': 'MC68k FlexBus',
36 'IIS': 'I2S Audio',
37 'JTAG': 'JTAG (JTAG_SEL=HI/LO)',
38 'LCD': '24-pin RGB/TTL LCD',
39 'RG': 'RGMII Ethernet',
40 'MMC': 'eMMC 1/2/4/8 pin',
41 'PWM': 'PWM (pulse-width modulation)',
42 'SD0': 'SD/MMC 0',
43 'SD1': 'SD/MMC 1',
44 'SD2': 'SD/MMC 2',
45 'MSPI0': 'SPI (Serial Peripheral Interface) Master 0',
46 'MSPI1': 'SPI (Serial Peripheral Interface) Master 1',
47 'MQSPI': 'Quad SPI Master 0',
48 'TWI0': 'I2C 0',
49 'TWI1': 'I2C 1',
50 'TWI2': 'I2C 2',
51 'QUART0': 'UART (TX/RX/CTS/RTS) 0',
52 'QUART1': 'UART (TX/RX/CTS/RTS) 1',
53 'UART0': 'UART (TX/RX) 0',
54 'UART1': 'UART (TX/RX) 1',
55 'UART2': 'UART (TX/RX) 2',
56 'ULPI0': 'ULPI (USB Low Pin-count) 0',
57 'ULPI1': 'ULPI (USB Low Pin-count) 1',
58 'ULPI2': 'ULPI (USB Low Pin-count) 2',
59 }
60
61 ps = PinSpec(pinbanks, fixedpins, function_names)
62
63 # Bank A, 0-27
64 ps.gpio("", ('A', 0), 0, 0, 28)
65 ps.rgbttl("", ('A', 0), 1, limit=22)
66 ps.mspi("0", ('A', 10), 2)
67 ps.mquadspi("0", ('A', 4), 2)
68 ps.uart("0", ('A', 16), 2)
69 ps.i2c("1", ('A', 18), 2)
70 ps.pwm("", ('A', 21), 2, 0, 3)
71 ps.sdmmc("0", ('A', 22), 3)
72 ps.eint("", ('A', 0), 3, 0, 4)
73 ps.eint("", ('A', 20), 2, 4, 1)
74 ps.eint("", ('A', 23), 1, 5, 1)
75 ps.sdmmc("1", ('A', 4), 3)
76 ps.jtag("", ('A', 10), 3)
77 ps.uartfull("0", ('A', 14), 3)
78 ps.uartfull("1", ('A', 18), 3)
79 ps.jtag("", ('A', 24), 2)
80 ps.mspi("1", ('A', 24), 1)
81 ps.i2c("0", ('A', 0), 2)
82 ps.uart("1", ('A', 2), 2)
83 ps.uart("2", ('A', 14), 2)
84
85 ps.mquadspi("1", ('B', 0), 0)
86
87 # Scenarios below can be spec'd out as either "find first interface"
88 # by name/number e.g. SPI1, or as "find in bank/mux" which must be
89 # spec'd as "BM:Name" where B is bank (A-F), M is Mux (0-3)
90 # EINT and PWM are grouped together, specially, but may still be spec'd
91 # using "BM:Name". Pins are removed in-order as listed from
92 # lists (interfaces, EINTs, PWMs) from available pins.
93
94 minitest = ['ULPI0/8', 'ULPI1', 'MMC', 'SD0', 'UART0',
95 'TWI0', 'MSPI0', 'B3:SD1', ]
96 minitest_eint = ['EINT_0', 'EINT_1', 'EINT_2', 'EINT_3', 'EINT_4']
97 minitest_pwm = ['B2:PWM_0']
98 descriptions = {
99 'MMC': 'internal (on Card)',
100 'SD0': 'user-facing: internal (on Card), multiplexed with JTAG\n'
101 'and UART2, for debug purposes',
102 'TWI2': 'I2C.\n',
103 'E2:SD1': '',
104 'MSPI1': '',
105 'UART0': '',
106 'B1:LCD/22': '18-bit RGB/TTL LCD',
107 'ULPI0/8': 'user-facing: internal (on Card), USB-OTG ULPI PHY',
108 'ULPI1': 'dual USB2 Host ULPI PHY'
109 }
110
111 ps.add_scenario("MiniTest", minitest, minitest_eint, minitest_pwm,
112 descriptions)
113
114 return ps