Does anyone have a simple UIO driver that uses an interrupt handler?

Hans-Jürgen Koch hjk at linutronix.de
Tue Feb 19 00:09:33 EST 2008


Am Sun, 17 Feb 2008 18:13:07 -0500
schrieb Nick Droogh <ndroogh at cadlink.com>:

> Hi everyone,

Hi Nick,

> 
> I am looking for a driver example for a user space driver utilizing
> an interrupt handler.  I am having trouble registering a handler in
> my driver attempt and would like to see an example of a working UIO
> driver.

Did you have a look at uio-howto in Documentation/DocBook/ in the
kernel sources? Just do a "make htmldocs", and you get the UIO howto in
html format in its own subdirectory.

You don't have to "register" the userspace part of an UIO driver. You
simply open /dev/uio0, mmap() your device's memory, and wait for
interrupts using a blocking read() or select() on /dev/uio0.

If you want to do it properly, you should use sysfs to find the right
UIO device (there could be others...) and the size of the memory to
map. Have a look at the sources of lsuio to see how this is done:

http://www.osadl.org/projects/downloads/UIO/user/

You find the userspace part of the uio_cif driver there, too.

If you still got problems after reading this, feel free to ask me. Note
that I'm not subscribed to linuxppc-embedded. The preferred list for
UIO questions is LKML. If you don't want to subscribe to LKML, you can
also ask me by private mail. You should ask detailed questions, ideally
accompanied by a piece of your code that shows the problem.

Thanks,
Hans



More information about the Linuxppc-embedded mailing list