Bewerken

Delen via


WUDF_INTERRUPT_ENABLE callback function (wudfinterrupt.h)

Warning

UMDF 2 is the latest version of UMDF and supersedes UMDF 1. All new UMDF drivers should be written using UMDF 2. No new features are being added to UMDF 1 and there is limited support for UMDF 1 on newer versions of Windows 10. Universal Windows drivers must use UMDF 2. For more info, see Getting Started with UMDF.

A driver's OnInterruptEnable event callback function enables a specified hardware interrupt.

Syntax

WUDF_INTERRUPT_ENABLE WudfInterruptEnable;

HRESULT WudfInterruptEnable(
  [in] IWDFInterrupt *Interrupt,
  [in] IWDFDevice *AssociatedDevice
)
{...}

Parameters

[in] Interrupt

A pointer to the IWDFInterrupt interface.

[in] AssociatedDevice

A pointer to the IWDFDevice interface that the driver used to call CreateInterrupt.

Return value

The callback function must return S_OK if the operation succeeds. Otherwise, the callback should return one of the error codes that are defined in Winerror.h.

Remarks

To register an OnInterruptEnable callback function, your driver must place the callback function's address in a WUDF_INTERRUPT_CONFIG structure before calling IWDFDevice::CreateInterrupt.

The framework calls the driver's OnInterruptEnable callback function each time the device enters its working (D0) state. Additionally, a driver can cause the framework to call the OnInterruptEnable callback function by calling IWDFInterrupt::Enable.

Before calling the OnInterruptEnable callback function, the framework acquires the user-mode interrupt lock.

After calling the OnInterruptEnable callback function, the framework calls the driver's OnD0EntryPostInterruptsEnabled event callback function.

For more information about handling interrupts in UMDF drivers, see Accessing Hardware and Handling Interrupts.

Examples

The function type is declared in Wudfinterrupt.h, as follows.

typedef
__drv_functionClass(WUDF_INTERRUPT_ENABLE)
HRESULT
WUDF_INTERRUPT_ENABLE(
    _In_
    IWDFInterrupt* Interrupt,
    _In_
    IWDFDevice* AssociatedDevice
    );

typedef WUDF_INTERRUPT_ENABLE *PFN_WUDF_INTERRUPT_ENABLE;

To define an OnInterruptEnable callback function that is named MyInterruptEnable, you must first provide a function declaration that SDV and other verification tools require, as follows:

WUDF_INTERRUPT_ENABLE  MyInterruptEnable;

Then, implement your callback function as follows:

HRESULT
  MyInterruptEnable (
    IN IWDFInterrupt* pInterrupt,
    IN IWDFDevice*  pAssociatedDevice
    )
  {…}

Requirements

Requirement Value
End of support Unavailable in UMDF 2.0 and later.
Target Platform Desktop
Minimum UMDF version 1.11
Header wudfinterrupt.h

See also