There may be nothing intelligent to do with it, but you must avoid doing
something stupid with it, such as trying to write the data to a
non-existent buffer or use the non-existent IRP. A huge number of drivers
fail in the field because their ISR tries to access an invalid address.
And for some devices, this is legitimate behavior, and you should either
ignore it or implement internal buffering so the data is not lost. In one
case, my copy routine was called at ISR level to copy one byte of data.
If (and this was in another OS, decades ago) there was no pending IRP, I
recorded the status register and the data byte in an internal buffer, and
when the IRP (or its equivalent) arrived, I passed the data byte and
status code to the copy routine, so that if there had been a data overrun
the app would see this. For that particular device, this was necessary.
So your choices are (a) ignore the interrupt, and silently lose data (b)
use internal buffering (c) include the status register in the internal
buffering (d) crash on an access fault. And these are just the
superficial choices; your device may require you handle far more subtle
cases. What you have to do is make sure (d) is never possible. Oh, yes,
and you must avoid (e) do nothing and the device hangs, failing to send
interrupts until it is in a “clean” state.
joe
xxxxx@verizon.net wrote:
> If interrupts occurred before the user request, there would be nothing
> intelligent do with them.
Then why would there be any? If you get an interrupt when you aren’t
expecting one, that’s an error condition, and you probably need to do
something about it, don’t you. Otherwise, you’re going to have an
unhandled interrupt pending at the time you enable your interrupts.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
NTDEV is sponsored by OSR
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer