Bewerken

Delen via


HW_TIMER callback function (storport.h)

The HwStorTimer routine is called after the interval that is specified when the miniport driver called StorPortNotification with RequestTimerCall specified for the NotificationType parameter.

Syntax

HW_TIMER HwTimer;

void HwTimer(
  PVOID DeviceExtension
)
{...}

Parameters

DeviceExtension

A pointer to the miniport driver's per HBA storage area.

Return value

None

Remarks

The name HwStorTimer is only a placeholder. The actual prototype of this routine is defined in Srb.h as follows:

typedef
VOID
HW_TIMER (
  _In_ PVOID  DeviceExtension
  );

If the miniport opts into multi-channel support, the StartIo spin lock is still taken. However, if the miniport has requested multiple channel support via PERF_CONFIGURATION_DATA, the StartIo spin lock is not taken or checked before the call to HwStorStartIo in the miniport. This means that the HwStorStartIo callback is not synchronized with the callback to the HwStorTimer routine when multi-channel support is used. The miniport must do this on its own by using a compiler interlocked intrinsic, for example using InterlockedCompareExchange.

A HwStorTimer routine is optional.

To define an HwStorTimer 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 a HwStorTimer callback routine that is named MyHwTimer, use the following HW_TIMER type and implement your callback routine as follows:

HW_TIMER MyHwTimer;

_Use_decl_annotations_
VOID
MyHwTimer (
  _In_ PVOID  DeviceExtension
  );
  {
      ...
  }

The HW_TIMER function type is defined in the Storport.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 HW_TIMER function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions Using Function Role Types for Storport Drivers. For information about Use_decl_annotations, see Annotating Function Behavior.

Requirements

Requirement Value
Target Platform Universal
Header storport.h (include Storport.h)
IRQL DISPATCH_LEVEL

See also

StorPortNotification