From e47932289dbea902df9cb3c16c1d0bf7109bc9ec Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 29 Jun 2018 09:09:30 +0100 Subject: [PATCH] set output-only via GPIO direction --- src/bsv/actual_pinmux.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/bsv/actual_pinmux.py b/src/bsv/actual_pinmux.py index d35757b..32e306c 100644 --- a/src/bsv/actual_pinmux.py +++ b/src/bsv/actual_pinmux.py @@ -47,16 +47,25 @@ def transfn(temp): # XXX this needs to move into interface_decl.py # and made to use ifaceoutfmtfn and ifaceinfmtfn -def fmt(ifaces, cell, idx, suffix=None): +def fmt(ifaces, cells, idx, suffix=None): """ blank entries need to output a 0 to the pin (it could just as well be a 1 but we choose 0). reason: blank entries in the pinmap.txt file indicate that there's nothing to choose from. however the user may still set the muxer to that value, and rather than throw an exception we choose to output... zero. + + NOTE: IMPORTANT. when a function is an output-only there + is a special-case assumption that: + * (a) GPIO is always the first mux entry + * (b) GPIO's outen is also used to set the pad + the reason for this is that it is assumed better that + multiple pads be switched simutaneously to outputs + by setting the GPIO direction rather than having them + set arbitrarily by changing the muxer registers. """ idx += 1 - if idx < len(cell): - cell = cell[idx] + if idx < len(cells): + cell = cells[idx] else: cell = '' if not cell: @@ -66,7 +75,7 @@ def fmt(ifaces, cell, idx, suffix=None): if x == 'input': return '0' # inputs don't get passed through to the out mux if suffix == '_outen' and x == 'out': - return '1' + return "wr%s%s" % (cells[1], suffix or '') # USE GPIO FOR SELECTION return "wr%s%s" % (cell, suffix or '') # XXX this needs to move into interface_decl.py -- 2.30.2