EvtInterruptWorkItem function

[Applies to KMDF and UMDF]

A driver's EvtInterruptWorkItem event callback function processes interrupt information that the driver's EvtInterruptIsr callback function has stored.

Syntax


EVT_WDF_INTERRUPT_WORKITEM EvtInterruptWorkItem;

VOID EvtInterruptWorkItem(
  _In_  WDFINTERRUPT Interrupt,
  _In_  WDFOBJECT AssociatedObject
)
{ ... }

Parameters

Interrupt [in]

A handle to a framework interrupt object.

AssociatedObject [in]

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

Return value

None

Remarks

The EvtInterruptWorkItem callback function runs at IRQL = PASSIVE_LEVEL.

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

Most drivers use a single EvtInterruptWorkItem callback function for each type of interrupt.

To schedule execution of an EvtInterruptWorkItem callback function, the driver must call WdfInterruptQueueWorkItemForIsr from within the EvtInterruptIsr callback function.

If your driver creates multiple framework interrupt objects for each device, you might consider using a separate EvtInterruptWorkItem callback for each interrupt.

Drivers that implement either DIRQL interrupt handling or passive level interrupt handling can queue an EvtInterruptWorkItem callback.

A driver cannot queue both an EvtInterruptDpc and a EvtInterruptWorkItem callback.

If the driver has set the AutomaticSerialization member to TRUE in the interrupt's WDF_INTERRUPT_CONFIG structure, the framework synchronizes execution of the interrupt object's EvtInterruptWorkItem callback function with callback functions from other objects that are underneath the interrupt's parent object. For information about callback synchronization locks, see Using Framework Locks.

In general, if the driver needs to acquire the interrupt object's passive lock from within EvtInterruptWorkItem, the driver should set the AutomaticSerialization member of WDF_INTERRUPT_CONFIG to FALSE and then call WdfInterruptAcquireLock from within EvtInterruptWorkItem.

If AutomaticSerialization is set to TRUE, a driver's EvtInterruptWorkItem callback function should not call any of the following methods:

WdfInterruptAcquireLock
WdfInterruptSynchronize
WdfInterruptDisable
WdfInterruptEnable

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

Examples

To define an EvtInterruptWorkItem 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 EvtInterruptWorkItem callback function that is named MyInterruptWorkItem, use the EVT_WDF_INTERRUPT_WORKITEM type as shown in this code example:


EVT_WDF_INTERRUPT_WORKITEM MyInterruptWorkItem;

Then, implement your callback function as follows:


_Use_decl_annotations_
VOID
 MyInterruptWorkItem (
    WDFINTERRUPT  Interrupt,
    WDFOBJECT  AssociatedObject
    )
  {...}

The EVT_WDF_INTERRUPT_WORKITEM 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_WORKITEM 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

Minimum KMDF version

1.11

Minimum UMDF version

2.0

Header

Wdfinterrupt.h (include Wdf.h)

IRQL

PASSIVE_LEVEL

 

 

Send comments about this topic to Microsoft

Mostrar:
© 2014 Microsoft