Getting the IRQ number (Was: Basic driver devel questions ?)
David Laight
David.Laight at ACULAB.COM
Mon Dec 6 23:17:23 EST 2010
> That's the idea. Communication between usermode and the driver is
limited to
> simple ioctl calls and the driver receives an interrupt when certain
data has
> been placed in memory blocks by the hardware (like a DMA).
> Then the user prog figures out where that latest data buffer is (mmap)
and saves it.
I've used pread() and pwrite() to directly copy data to/from a devices
PCI memory space.
The driver just verifies the offset and calls copy_to/from_user() [1].
High offsets can be used to access driver specific data.
The userspace code for pread/write is less painful than using ioctl()
for everything.
This also lets you dump the device memory space with hexdump.
I also made the device interrupt generate POLLIN (this needs a bit of
care since the interrupt can arrive before poll() is called).
David
[1] I actually had to use the PCIe dma controller to get adequate
throughput.
More information about the Linuxppc-dev
mailing list