Enabling and Disabling Interrupts (UMDF 1)

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.

The archived UMDF 1 samples can be found in the Windows 11, version 22H2 - May 2022 Driver Samples Update.

For more info, see Getting Started with UMDF.

If your driver handles device interrupts, it must provide OnInterruptEnable and OnInterruptDisable callback functions that enable and disable the interrupts. These callback functions must do whatever is necessary to enable and disable a device's interrupt mechanism.

If your driver must perform additional operations that are related to enabling or disabling interrupts, the driver can also provide IPnpCallbackHardwareInterrupt::OnD0EntryPostInterruptsEnabled and IPnpCallbackHardwareInterrupt::OnD0ExitPreInterruptsDisabled callback functions.

The framework calls the driver's OnInterruptEnable and IPnpCallbackHardwareInterrupt::OnD0EntryPostInterruptsEnabled callback functions each time the device enters its working (D0) state, after the framework has called the driver's OnD0Entry callback function. The framework calls the driver's IPnpCallbackHardwareInterrupt::OnD0ExitPreInterruptsDisabled and OnInterruptDisable callback functions each time the device leaves its working state, before the framework calls the driver's OnD0Exit callback function. For more information about when the framework calls a driver's callback functions, see PnP and Power Management in UMDF-based Drivers.

You must not assume that a device will use the same interrupt resources each time the framework calls your driver's OnInterruptEnable callback function. Sometimes the PnP manager redistributes system resources, and it might assign new interrupt resources to your device.

The driver can call IWDFInterrupt::GetInfo to determine a device's interrupt resources. The driver can call IWDFInterrupt::GetDevice to determine the device that an interrupt object belongs to.

To enable and disable interrupts directly, the driver can call the interrupt object's IWDFInterrupt::Enable and IWDFInterrupt::Disable methods, which call the driver's OnInterruptEnable and OnInterruptDisable event callback functions. However, most drivers should just allow the framework to call the OnInterruptEnable and OnInterruptDisable callback functions at the proper times.