EvtInterruptDpc function

[Applies to KMDF and UMDF]

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

Syntax


EVT_WDF_INTERRUPT_DPC EvtInterruptDpc;

void EvtInterruptDpc(
  _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

This function does not return a value.

Remarks

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

Drivers typically complete I/O requests in their EvtInterruptDpc callback functions.

The EvtInterruptDpc callback function executes at DISPATCH_LEVEL and must not access pageable code. If an EvtInterruptDpc callback function must perform operations at IRQL = PASSIVE_LEVEL, it can use framework work items.

In KMDF version 1.11 and later, your driver can support passive-level interrupts and provide either an EvtInterruptWorkItem or an EvtInterruptDpc callback function. If your driver supports passive-level interrupts and provides an EvtInterruptDpc callback function, the driver cannot acquire the passive-level interrupt lock from within the callback.

Most drivers use a single EvtInterruptDpc callback function for each type of interrupt. If your driver creates multiple framework queue objects for each device, you might consider using a separate DPC object and EvtDpcFunc callback function for each queue.

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

When a driver schedules the execution of an EvtInterruptDpc callback function, the system adds a DPC object to the system's DPC queue. If the system is not executing higher-priority tasks, it removes the object from the queue and calls the EvtInterruptDpc callback function.

The system does not add the DPC object to the DPC queue if the object is already queued. An EvtInterruptIsr callback function might be called several times before the system calls the EvtInterruptDpc callback function. Therefore, the EvtInterruptDpc callback function must be able to process information from several interrupts, and it must process all interrupts that have occurred since the last time it was called.

Typically, it is necessary to synchronize the execution of a driver's EvtInterruptDpc callback function with the execution of other callback functions. For more information, see Synchronizing Interrupt Code.

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

Examples

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


EVT_WDF_INTERRUPT_DPC MyInterruptDpc;

Then, implement your callback function as follows.


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

The EVT_WDF_INTERRUPT_DPC 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_DPC 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.0

Minimum UMDF version

2.0

Header

Wdfinterrupt.h (include Wdf.h)

IRQL

(See Remarks section.)

See also

WdfInterruptCreate
WdfInterruptQueueDpcForIsr
WDF_INTERRUPT_CONFIG
EvtDpcFunc
EvtInterruptIsr

 

 

Send comments about this topic to Microsoft

Mostra:
© 2014 Microsoft