Enabling and Disabling Interrupts

[This topic applies to UMDF 1.x.]

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.



Send comments about this topic to Microsoft

© 2015 Microsoft