From: Andrey Miroshnikov Date: Tue, 27 Sep 2022 16:44:32 +0000 (+0000) Subject: feat(stage2): extracting bank and pin information from PinSpec for later use in the... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1e599e3a6ef092f5dd5d0c85e235bce0fd0b4e4a;p=pinmux.git feat(stage2): extracting bank and pin information from PinSpec for later use in the pinmux block --- diff --git a/src/spec/stage2.py b/src/spec/stage2.py index 3cd7fba..2219616 100644 --- a/src/spec/stage2.py +++ b/src/spec/stage2.py @@ -434,9 +434,45 @@ if __name__ == '__main__': 'UART0': 'UART (TX/RX) 0', } ps = PinSpec(pinbanks, fixedpins, function_names) + # Unit number, (Bank, pin #), mux, start, num # pins ps.gpio("", ('A', 0), 0, 0, 4) ps.uart("0", ('A', 0), 1) ps.i2c("0", ('A', 0), 2) print(dir(ps.gpio)) - print(ps.gpio.pinouts, ps.gpio.bankspec, ps.gpio.pinfn, ps.gpio.fname) + #print(ps.gpio.pinouts, ps.gpio.bankspec, ps.gpio.pinfn, ps.gpio.fname) + """ + desc_dict_keys = ['UART0', 'TWI0', 'GPIOA_A0', 'GPIOA_A1', 'GPIOA_A2', 'GPIOA_A3'] + eint = [] + pwm = [] + desc = {'UART0': 'Basic serial TX/RX serial port', + 'TWI0': 'I2C interface', + 'GPIOA_A0': 'Test GPIO0', + 'GPIOA_A1': 'Test GPIO1', + 'GPIOA_A2': 'Test GPIO2', + 'GPIOA_A3': 'Test GPIO3'} + ps.add_scenario("Test Manual Pinmux", desc_dict_keys, eint, pwm, desc) + """ + print("---------------------------------") + #with open("test.mdwn", "w") as of: + # pinout, bankspec, pin_spec, fixedpins = ps.write(of) + #print("---------------------------------") + + bk = ps.pinbanks.keys() + for bank in bk: + muxwidth = ps.muxwidths[bank] + print(bank, muxwidth) + pinidx = sorted(ps.keys()) + for pin in pinidx: + print("---------------------------------") + print(pin) + pdata = ps.get(pin) + for mux in range(muxwidth): + if mux not in pdata: + print("Mux %d : NC" % mux) + else: + name, assigned_bank = pdata[mux] + print("Mux %d : %s" % (mux, name)) + + +