When handling the interrupts from the user mode you must acknowledge (clear) the interrupt on the card whether your card generated the interrupt or not (in case of shared IRQs). However, this does not necessarily present a problem. To determine which card generated the interrupt, and activate your ISR only in case the interrupt was generated by your card, you can set up the transfer commands of the
WD_INTERRUPT structure, which is passed to
InterruptThreadEnable() — in versions 4.30–5.22), or to the lower level
WD_IntEnable() function —
int.Cmds — to include a command to read from the interrupt register before clearing the interrupt. The register will then be read in the kernel, immediately when an interrupt is received and before it is cleared, and you will be able to access the read value from your user mode interrupt handler routine when it is activated. Please notethat in order to save the read value you must set the
INTERRUPT_CMD_COPYflag in the
dwOptions field of the
WD_INTERRUPT structure (
int.dwOptions |= INTERRUPT_CMD_COPY). For more information — see the WinDriver User’s Manual and Technical Document #75, which describes the user mode interrupt handling with WinDriver.
When using WinDriver’s Kernel PlugIn feature to handle the interrupts directly in the kernel, you can read the value of the interrupt status register on your card directly when an interrupt is received, from within your
KP_IntAtIrql() routine, and proceed to acknowledge (clear) the interrupt and execute your ISR only if the value of the status register indicates that the interrupt was indeed generated by your card. For more information on how to handle shared PCI interrupts from the Kernel PlugIn, refer to Technical Document #125.