Edit

Share via


Servicing Timers

NDIS calls the NetTimerCallback function when an NDIS 6.0 timer fires. The FunctionContext parameter of this function contains a pointer to a driver-supplied context area. The default value for FunctionContext is specified in an NDIS_TIMER_CHARACTERISTICS structure. The driver passed the structure to the NdisAllocateTimerObject function to allocate and initialize the associated timer object.

If the driver specified a non-NULL value in the FunctionContext parameter that is passed to the NdisSetTimerObject function, NDIS passes that value to the FunctionContext parameter of the NetTimerCallback function. Otherwise, NDIS passes the default value that is specified in the NDIS_TIMER_CHARACTERISTICS structure.

Any NDIS driver can have more than one NetTimerCallback function. Each such NetTimerCallback function must be associated with a different driver-allocated and initialized timer object.

A call to the NdisSetTimerObject function causes the NetTimerCallback function that is associated with the timer object to be run after a specified interval or periodically.

To stop calls to a NetTimerCallback function, call the NdisCancelTimerObject function. NDIS might still call NetTimerCallback if the timeout has already expired before the call to NdisCancelTimerObject.

If a NetTimerCallback function shares resources with other driver functions, the driver should synchronize access to those resources with a spin lock.