Condividi tramite


NdisMInitializeTimer function

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

NdisMInitializeTimer initializes a timer object associated with a driver's MiniportTimer function.

Syntax

VOID NdisMInitializeTimer(
  _Inout_ PNDIS_MINIPORT_TIMER Timer,
  _In_    NDIS_HANDLE          MiniportAdapterHandle,
  _In_    PNDIS_TIMER_FUNCTION TimerFunction,
  _In_    PVOID                FunctionContext
);

Parameters

  • Timer [in, out]
    Pointer to caller-supplied, resident storage for a timer object. The timer object is opaque to the caller, but, when it has been initialized, this pointer is a required parameter to the NdisM..Timer functions.

  • MiniportAdapterHandle [in]
    Specifies the handle input to MiniportInitialize.

  • TimerFunction [in]
    Specifies the entry point of a caller-supplied MiniportTimer function.

  • FunctionContext [in]
    Pointer to a caller-supplied context area to be passed to the given MiniportTimer function when it is called.

Return value

None

Remarks

After calling NdisMSetAttributes or NdisMSetAttributesEx, a miniport driver's MiniportInitialize function can call NdisMInitializeTimer to set up MiniportTimer function(s). MiniportInitialize must call NdisMInitializeTimer before the driver passes the MiniportTimer pointer to any other NdisM..Timer function.

Drivers of NICs that do not generate interrupts initialize at least one timer object for a polling MiniportTimer function that monitors the NIC state for incoming receives and for send completions.

Calls to the NdisMSet..Timer functions insert the timer object in the system timer queue. Calls to NdisMCancelTimer dequeue the timer object if it is currently queued. Only one instantiation of a particular timer object can be queued at any given moment.

When a driver calls NdisMSetTimer, the timer object at Timer is queued until the interval specified in the call expires. When it does, the timer object is dequeued and the caller-supplied TimerFunction is run once at IRQL = DISPATCH_LEVEL as soon as a processor becomes available. When a driver calls NdisMSetPeriodicTimer, the timer object is dequeued and the caller-supplied TimerFunction is run when the given interval expires, but the timer object is automatically requeued for the same fixed interval so the MiniportTimer function runs periodically, also at IRQL = DISPATCH_LEVEL.

MiniportInitialize can call NdisMInitializeTimer more than once to initialize more than one timer object, each associated with a distinct MiniportTimer function. For example, a NIC driver might have one MiniportTimer function that polls the NIC state periodically and another that the miniport driver uses only to time-out a particular operation on its NIC. Each such MiniportTimer function has different functionality, and each such function should be associated with a different timer object by calling NdisMInitializeTimer from MiniportInitialize.

Requirements

Target platform

Universal

Version

Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisAllocateTimerObjectinstead. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.

Header

Ndis.h (include Ndis.h)

Library

Ndis.lib

IRQL

<= DISPATCH_LEVEL

See also

MiniportInitialize

MiniportTimer

NdisMCancelTimer

NdisMSetAttributes

NdisMSetAttributesEx

NdisMSetPeriodicTimer

NdisMSetTimer

 

 

Send comments about this topic to Microsoft