Subject: GPIO abstraction [was "Re: wscons on a HD44780"]
To: Jesse Off <>
From: Jachym Holecek <>
List: tech-embed
Date: 03/04/2005 21:01:45

sorry for replying *so* late.

> [... bitbang PC/104 bus ...]
> PC/104 bus to give the embedded systems designer more GPIO.  As processor
> power in embedded systems increase, it also becomes feasible to implement
> an entire bit-banged ISA/PC104 bus with nothing but GPIO.

I'd just glue an gate array on the board and let it deal ;-).

> I've been toying with the idea of attempting a full abstraction of GPIO
> (aka bit-bang) buses for devices such as LCD's and keypads.  Drivers would
> register their pins and their capabilities (in, out, in/out,
> open-collector, pull-up/down resistors, current capabilities, TTL/CMOS
> levels, etc...) and then drivers like the hitachi LCD and matrix keypads
> could just be generically attached.  The code I wrote for the TS7200 could
> then just as well work for a PC and its parallel port.  I could be getting
> ahead of myself here though... :-)

I very much like this idea, and I've actually used a "pinbus" concept
in one project (targeted at JTAG and low-level circuit debugging[*]). As
you note, this could be used to "normalize" all the bitbang APIs NetBSD
has as of now (MII, I2C, ..., serial EEPROMs).

So, if you start to work on this, I'd be glad to help/test. My long term
TODO item is a clean JTAG bus interface (kernel provided), anyway. Note
that I'll be rather busy for following couple of weeks, though.

And to get a bit technical -- I'm not sure all the electrical details
should be dealt with in the API (such as signalling levels -- I haven't
seen a GPIO interface that would let you change it). Perhaps a simpler
model (pin direction + three state level?) would be enough to implement
individual bus protocols...

		-- Jachym Holecek

[*] Unlike any other JTAG software I've seen, my design was conceptually
    capable of running JTAG over JTAG (ie. drive JTAG over EXTEST scan
    of some chip, done via JTAG :-). But it was completely userland code.
    Unfortunately my employer at the time changed his priorities, so I
    couldn't finish the project.