EvtInterruptEnable function

[Applies to KMDF and UMDF]

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

Syntax


EVT_WDF_INTERRUPT_ENABLE EvtInterruptEnable;

NTSTATUS EvtInterruptEnable(
  _In_  WDFINTERRUPT Interrupt,
  _In_  WDFDEVICE    AssociatedDevice
)
{ ... }

Parameters

Interrupt [in]

A handle to a framework interrupt object.

AssociatedDevice [in]

A handle to the framework device object that the driver passed to WdfInterruptCreate.

Return value

The EvtInterruptEnable callback function must return STATUS_SUCCESS or another status value for which NT_SUCCESS(status) equals TRUE if the function encounters no errors. Otherwise, this function must return a status value for which NT_SUCCESS(status) equals FALSE.

Remarks

To register an EvtInterruptEnable callback function, your driver must place the callback function's address in a WDF_INTERRUPT_CONFIG structure before calling WdfInterruptCreate.

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

Before calling the EvtInterruptEnable callback function, the framework raises the processor's IRQL to the device's DIRQL and acquires the spin lock that the driver specified in the interrupt object's WDF_INTERRUPT_CONFIG structure.

Beginning with version 1.11 of KMDF, your driver can provide passive-level interrupt handling. If the driver has requested passive-level interrupt handling, then before calling the EvtInterruptEnable function at IRQL = PASSIVE_LEVEL, the framework acquires the passive-level interrupt lock that the driver configured in the interrupt object's WDF_INTERRUPT_CONFIG structure.

After the EvtInterruptEnable callback function returns, the framework calls the driver's EvtDeviceD0EntryPostInterruptsEnabled event callback function at IRQL = PASSIVE_LEVEL.

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

For more information about handling interrupts in framework-based drivers, see Handling Hardware Interrupts.

Examples

To define an EvtInterruptEnable callback function, you must first provide a function declaration that identifies the type of callback function you’re defining. Windows provides a set of callback function types for drivers. Declaring a function using the callback function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it’s a requirement for writing drivers for the Windows operating system.

For example, to define an EvtInterruptEnable callback function that is named MyInterruptEnable, use the EVT_WDF_INTERRUPT_ENABLE type as shown in this code example:


EVT_WDF_INTERRUPT_ENABLE  MyInterruptEnable;

Then, implement your callback function:


_Use_decl_annotations_
NTSTATUS
 MyInterruptEnable (
    WDFINTERRUPT  Interrupt,
    WDFDEVICE  AssociatedDevice
    )
  {...}

The EVT_WDF_INTERRUPT_ENABLE function type is defined in the Wdfinterrupt.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the EVT_WDF_INTERRUPT_ENABLE function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for KMDF Drivers. For information about _Use_decl_annotations_, see Annotating Function Behavior.

Requirements

Target platform

Universal

Minimum KMDF version

1.0

Minimum UMDF version

2.0

Header

Wdfinterrupt.h (include Wdf.h)

IRQL

(See Remarks section.)

See also

WdfInterruptCreate
WdfInterruptEnable
WdfInterruptGetInfo
WDF_INTERRUPT_CONFIG
EvtDeviceD0EntryPostInterruptsEnabled
EvtInterruptDisable

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft