EvtTimerFunc function

[Applies to KMDF and UMDF]

The EvtTimerFunc event callback function is called when a specified time period has elapsed.

Syntax


EVT_WDF_TIMER EvtTimerFunc;

VOID EvtTimerFunc(
  _In_  WDFTIMER Timer 
)
{ ... }

Parameters

Timer [in]

A handle to a framework timer object that was obtained from a previous call to WdfTimerCreate.

Return value

None

Remarks

To register an EvtTimerFunc callback function and specify the time period that should elapse before the framework calls this function, your driver must call WdfTimerCreate.

In KMDF versions prior to version 1.9, the framework implements EvtTimerFunc callback functions as deferred procedure calls (DPCs). Therefore, when a time period elapses, the system adds a call to an EvtTimerFunc callback function to a DPC queue. The system calls the EvtTimerFunc callback function at IRQL = DISPATCH_LEVEL when it reaches the front of the queue and a CPU that is running at IRQL < DISPATCH_LEVEL is available.

In KMDF versions 1.9 and later, by default the framework implements EvtTimerFunc callback functions as DPCs. Alternatively, if the driver sets the timer object's execution level to WdfExecutionLevelPassive, the framework calls the EvtTimerFunc callback function from a work item at IRQL = PASSIVE_LEVEL. (Callback functions that are called at PASSIVE_LEVEL cannot delete timer objects.)

Starting in UMDF version 2.0, a UMDF driver's EvtTimerFunc callback functions always run at PASSIVE_LEVEL.

For more information about framework timer objects, see Using Timers.

Examples

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

To define an EvtTimerFunc callback function that is named MyTimerFunc, you must first provide a function declaration that SDV and other verification tools require, as follows:


EVT_WDF_TIMER  MyTimerFunc;

Then, implement your callback function as follows:


_Use_decl_annotations_
VOID
 MyTimerFunc (
    WDFTIMER  Timer
    )
  {...}

The EVT_WDF_TIMER function type is defined in the Wdftimer.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_TIMER 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

Wdftimer.h (include Wdf.h)

IRQL

See Remarks section.

See also

WdfTimerCreate

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft