All,
My custom PCI hardware asserts an interrupt when any of about sixteen events occur (ie: timer rolls over, data received on port, user presses ‘reset’, etc.). I need my kernel mode driver to somehow tell my client software that the interrupt occurred so that the software can do some IOCTLS to find out what the state of the hardware is and then do a ReadFile() or WriteFile() to transfer the event data.
My driver development knowledge is quite limited (newbie), so I’m familiar with IOCTLs, DMA Reads & Writes (and therefore IRQs and DPCs), but only in a synchronous context (more accurately, I know just enough to be very dangerous). My only ideas for solving this problem are:
-
Having the client software wait for an event (call to WaitForSingleObject()) that the driver can set once it detects and services an interrupt. This would be most simple and clean from a client stand point, but I have NO IDEA if a kernal mode driver can set an event for a user mode app, I would think it can’t.
-
Having the client software call an IOCTL where the IRP doesn’t get completed until the driver detects and serves an interrupt. That way the DeviceIoControl() call basically blocks similarly to calling WaitForSingleObject(), and returns once the IRP is completed. This would also require setting up the IRPs as asynchronous so that I can do other things while that IRP is hanging, which just doesn’t seem ideal for me and my lack of understanding.
I don’t want to poll the driver for data - I need more responsiveness than polling would provide. I’d think this is a common situation (ie hardware asynchronous events) that pretty much any hardware device would have, just wondering what the best industry-standard (but simple) solution is. I hope this post makes sense.
Thanks!
Ryan