adding documentation for generating pimux.bsv
[pinmux.git] / src / spec / minitest.py
index f0e104e4fbae67be855e1a07ea8bd6ac8ea0073e..a9d8a09371b08aa41a3626b912c75ae4cf987628 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
-
-from spec.interfaces import Pinouts
+# aardonyx file
+from spec.base import PinSpec
 
 from spec.ifaceprint import display, display_fns, check_functions
 from spec.ifaceprint import display_fixed
@@ -8,49 +8,8 @@ from spec.ifaceprint import display_fixed
 
 def pinspec():
     pinbanks = {
-                'B': 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, 28, 0)
-    pinouts.rgbttl("", ('B', 0), "B", 1, limit=23)
-    pinouts.spi("1", ('B', 10), "B", 2)
-    pinouts.quadspi("", ('B', 4), "B", 2)
-    pinouts.uart("3", ('B', 16), "B", 2)
-    pinouts.i2c("3", ('B', 18), "B", 2)
-    pinouts.pwm("", ('B', 21), "B", 0, 3, mux=2)
-    pinouts.sdmmc("1", ('B', 22), "B", 3)
-    pinouts.eint("", ('B', 0), "B", 0, 4, mux=3)
-    pinouts.eint("", ('B', 20), "B", 4, 1, mux=2)
-    pinouts.eint("", ('B', 23), "B", 5, 1, mux=1)
-    pinouts.sdmmc("2", ('B', 4), "B", 3)
-    pinouts.jtag("2", ('B', 10), "B", 3)
-    pinouts.uartfull("0", ('B', 14), "B", 3)
-    pinouts.uartfull("1", ('B', 18), "B", 3)
-    pinouts.jtag("1", ('B', 24), "B", 2)
-    pinouts.spi("2", ('B', 24), "B", 1)
-    pinouts.i2c("1", ('B', 0), "B", 2)
-    pinouts.uart("2", ('B', 2), "B", 2)
-    pinouts.uart("4", ('B', 14), "B", 2)
-
-
-    print ("""# Pinouts (PinMux)
-auto-generated by [[pinouts.py]]
-
-[[!toc  ]]
-""")
-    display(pinouts)
-
-    print ("\n# Pinouts (Fixed function)\n")
-
+        'A': (16, 4),
+    }
     fixedpins = {
         'CTRL_SYS': [
             'TEST',
@@ -71,44 +30,45 @@ auto-generated by [[pinouts.py]]
             'VDD_GPIOB',
             'GND_GPIOB',
         ]}
+    function_names = {
+                      'PWM': 'PWM (pulse-width modulation)',
+                      'MSPI2': 'SPI (Serial Peripheral Interface) Master 1',
+                      'UART1': 'UART (TX/RX) 1',
+                      'UART3': 'UART (TX/RX) 2',
+                      }
 
-    fixedpins = display_fixed(fixedpins, len(pinouts))
+    ps = PinSpec(pinbanks, fixedpins, function_names)
 
-    print ("""# Functions (PinMux)
+    ps.gpio("", ('A', 1), 0, 0, 1)
+    ps.gpio("", ('A', 0), 0, 1, 1)
+    ps.gpio("", ('A', 3), 0, 2, 1)
+    ps.gpio("", ('A', 2), 0, 3, 1)
+    ps.gpio("", ('A', 4), 0, 5, 2)
+    ps.gpio("", ('A', 6), 0, 9, 1)
 
-auto-generated by [[pinouts.py]]
-""")
+    ps.gpio("", ('A', 7), 0, 13, 1)
+    ps.gpio("", ('A', 8), 0, 10, 1)
+    ps.gpio("", ('A', 9), 0, 12, 1)
+    ps.gpio("", ('A', 10), 0, 11, 1)
+
+    ps.gpio("", ('A', 11), 0, 4, 1)
+    ps.gpio("", ('A', 12), 0, 7, 2)
+    ps.gpio("", ('A', 14), 0, 14, 2)
 
-    function_names = {'EINT': 'External Interrupt',
-                      'FB': 'MC68k FlexBus',
-                      'IIS': 'I2S Audio',
-                      'JTAG1': 'JTAG (same as JTAG2, JTAG_SEL=LOW)',
-                      'JTAG2': 'JTAG (same as JTAG1, JTAG_SEL=HIGH)',
-                      'LCD': '24-pin RGB/TTL LCD',
-                      'RG': 'RGMII Ethernet',
-                      'MMC': 'eMMC 1/2/4/8 pin',
-                      'PWM': 'PWM (pulse-width modulation)',
-                      'SD1': 'SD/MMC 1',
-                      'SD2': 'SD/MMC 2',
-                      'SD3': 'SD/MMC 3',
-                      'SPI1': 'SPI (Serial Peripheral Interface) 1',
-                      'SPI2': 'SPI (Serial Peripheral Interface) 2',
-                      'QSPI': 'Quad SPI (Serial Peripheral Interface) 1',
-                      'TWI1': 'I2C 1',
-                      'TWI2': 'I2C 2',
-                      'TWI3': 'I2C 3',
-                      'UARTQ0': 'UART (TX/RX/CTS/RTS) 0',
-                      'UARTQ1': 'UART (TX/RX/CTS/RTS) 1',
-                      'UART2': 'UART (TX/RX) 2',
-                      'UART3': 'UART (TX/RX) 3',
-                      'UART4': 'UART (TX/RX) 4',
-                      'ULPI1': 'ULPI (USB Low Pin-count) 1',
-                      'ULPI2': 'ULPI (USB Low Pin-count) 2',
-                      'ULPI3': 'ULPI (USB Low Pin-count) 3',
-                      }
 
-    fns = display_fns(bankspec, pinouts, function_names)
-    print
+
+
+
+    ps.pwm("", ('A', 2), 2, 0, 1)
+    ps.pwm("", ('A', 4), 2, 1, 3)
+    ps.pwm("", ('A', 8), 2, 4, 1)
+    ps.pwm("", ('A', 10), 2, 5, 1)
+    #ps.pwm("", ('A', 13), 2, 5, 1)
+    ps.mspi("2", ('A', 7), 1)
+    ps.uart("1", ('A', 0), 1)
+    ps.uart("3", ('A', 2), 1)
+
+    #ps.mquadspi("1", ('B', 0), 0)
 
     # 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
@@ -117,41 +77,24 @@ auto-generated by [[pinouts.py]]
     # using "BM:Name".  Pins are removed in-order as listed from
     # lists (interfaces, EINTs, PWMs) from available pins.
 
-    minitest = ['B1:LCD/22', 'ULPI1/8', 'ULPI2', 'MMC', 'SD1', 'UART3',
-              'TWI3', 'SPI2', 'E2:SD2', ]
-    minitest_eint = ['EINT_0', 'EINT_1', 'EINT_2', 'EINT_3']
-    minitest_pwm = ['D1:PWM_2']
+    minitest = ['ULPI0/8', 'ULPI1', 'MMC', 'SD0', 'UART0',
+                'TWI0', 'MSPI0', 'B3:SD1', ]
+    minitest_eint = []
+    minitest_pwm = ['B2:PWM_0']
     descriptions = {
         'MMC': 'internal (on Card)',
-        'SD1': 'user-facing: internal (on Card), multiplexed with JTAG1\n'
+        'SD0': 'user-facing: internal (on Card), multiplexed with JTAG\n'
         'and UART2, for debug purposes',
-        'TWI3': 'EOMA68-compliance: must be entirely free of devices.\n'
-        'Address 0x51 used (externally) for EOMA68 EEPROM Id',
-        'E2:SD2': 'EOMA68-compliance',
-        'SPI2': 'EOMA68-compliance',
-        'UART3': 'EOMA68-compliance',
-        'B1:LCD/22': 'EOMA68-compliance, 18-bit RGB/TTL LCD',
-        'ULPI1/8': 'user-facing: internal (on Card), USB-OTG ULPI PHY',
-        'ULPI2': 'EOMA68-compliance: dual USB2 Host ULPI PHY'
+        'TWI2': 'I2C.\n',
+        'E2:SD1': '',
+        'MSPI1': '',
+        'UART0': '',
+        'B1:LCD/22': '18-bit RGB/TTL LCD',
+        'ULPI0/8': 'user-facing: internal (on Card), USB-OTG ULPI PHY',
+        'ULPI1': 'dual USB2 Host ULPI PHY'
     }
 
-    unused_pins = check_functions("MiniTest", bankspec, fns, pinouts,
-                                  minitest, minitest_eint, minitest_pwm,
-                                  descriptions)
-
-
-    print ("""# 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