3.3. WD_IntWait()

Purpose

Waits for an interrupt.

Prototype
DWORD WD_IntWait(
    HANDLE hWD,
    WD_INTERRUPT *pInterrupt);
Parameters
NameTypeInput/Output
hWDHANDLEInput
pInterruptWD_INTERRUPT* 
• hInterruptHANDLEInput
• dwOptionsDWORDN/A
• CmdWD_TRANSFER*N/A
• dwCmdsDWORDN/A
• kpCallWD_KERNEL_PLUGIN_CALLN/A
• fEnableOkDWORDN/A
• dwCounterDWORDOutput
• dwLostDWORDOutput
• fStoppedDWORDOutput
• dwLastMessageDWORDOutput
• dwEnabledIntTypeDWORDN/A
Description
NameDescription
hWDHandle to WinDriver's kernel-mode driver as received from WD_Open() [5.2]
pInterruptPointer to an interrupt information structure:
• hInterrupt Interrupt handle. The handle is returned by WD_CardRegister() [2.8] in pCardReg->Card.Item[i].I.Int.hInterrupt.
• dwCounterNumber of interrupts received
• dwLost Number of interrupts that were acknowledged in the kernel mode but not yet handled in the user mode
• fStopped Set by the function to any of the following values:
• 0 — an interrupt occurred.
INTERRUPT_STOPPED — an interrupt was disabled while waiting for interrupts.
INTERRUPT_INTERRUPTED — while waiting for an interrupt, WD_IntWait() [3.3] was interrupted without an actual hardware interrupt (refer also to the remark below).
• dwLastMessage Relevant only for MSI/MSI-X interrupts on Windows Vista and higher (see information in the WinDriver PCI Manual):
When an interrupt occurs, WinDriver's kernel-mode interrupt handler sets this field to the interrupt's message data.
Return Value

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [A].

Remarks
  • The INTERRUPT_INTERRUPTED status (set in pInterrupt->fStopped) can occur on Linux if the application that waits on the interrupt is stopped (e.g., by pressing CTRL+Z).

Example
for (;;)
{
    WD_IntWait(hWD, &Intrp);
    if (Intrp.fStopped)
        break;

    ProcessInterrupt(Intrp.dwCounter);
}