Subject: Re: GPIO abstraction [was "Re: wscons on a HD44780"]
To: Jesse Off <>
From: Alexander Yurchenko <>
List: tech-embed
Date: 03/22/2005 16:55:09
On Fri, Mar 04, 2005 at 03:54:12PM -0700, Jesse Off wrote:
> I've since noticed OpenBSD implemented something very similar to what is 
> being discussed here in their gpio(4) driver.
> "pinbus" sounds like exactly the perfect word for the abstraction.  A 
> wishlist item that I'd like to see enabled is the general attachment of 
> certain pins to full devices and functions such that a "pinbus" could be 
> attached at bootup and then individual pins could be arbitrarily aggregated 
> into devices that could be "hot-plugged"  e.g. a matrixkp, hd44780 LCD, 
> serial-port,  SPI-based ADC's.    Remaining pins might be assigned to a 
> generic OpenBSD style gpio(4) device for user programs to twiddle.  I was 

OpenBSD's gpio(4) has initial config glue of gpio bit-banging, it's
possible to attach devices to gpio controller specifying a set of pins
via locators like:

somedevice0 at gpio0 pin 10 mask 0x5

It means that somedevice uses first and third pins starting from pin 10,
i.e. pins 10 and 12.

> I would really love to see NetBSD start distinguishing itself more in the 
> embedded world by providing more functionality like this that might be of 
> more practical use to embedded.  Another thing that would be great is a 
> general API for high frequency low-latency timers.  Something such that 
> some devices would be providers of timing hardware and and the timers could 
> be allocated, used and deallocated by device drivers.   Extra hardware 

Like this?

> timers might be "emulated" using the one-shot modes of a single real timer. 
> I'd like MD timers that can bypass as much of the normal IRQ preamble as 
> possible such that if I wanted to use a GPIO pin to generate a 10Khz square 
> wave in software on a 200Mhz processor with a 4 insn intr handler, it'd be 
> possible.
> I'm also not sure how much time I have to implement something like this, 
> but maybe I can bribe some extra help with free TS-7200 boards... :-)
> //Jesse Off

   Alexander Yurchenko (aka grange)