3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/io/timer.c
7 * PROGRAMMER: David Welch (welch@mcmail.com)
12 /* INCLUDES *****************************************************************/
14 #include <ddk/ntddk.h>
15 #include <internal/pool.h>
18 #include <internal/debug.h>
20 /* GLBOALS *******************************************************************/
22 #define TAG_IO_TIMER TAG('I', 'O', 'T', 'M')
24 /* FUNCTIONS *****************************************************************/
31 IoInitializeTimer(PDEVICE_OBJECT DeviceObject,
32 PIO_TIMER_ROUTINE TimerRoutine,
35 * FUNCTION: Sets up a driver-supplied IoTimer routine associated with a given
38 * DeviceObject = Device object whose timer is be initialized
39 * TimerRoutine = Driver supplied routine which will be called once per
40 * second if the timer is active
41 * Context = Driver supplied context to be passed to the TimerRoutine
45 DeviceObject->Timer = ExAllocatePoolWithTag(NonPagedPool, sizeof(IO_TIMER),
47 KeInitializeTimer(&(DeviceObject->Timer->timer));
48 KeInitializeDpc(&(DeviceObject->Timer->dpc),
49 (PKDEFERRED_ROUTINE)TimerRoutine,Context);
51 return(STATUS_SUCCESS);
59 IoStartTimer(PDEVICE_OBJECT DeviceObject)
61 * FUNCTION: Starts a timer so the driver-supplied IoTimer routine will be
62 * called once per second
64 * DeviceObject = Device whose timer is to be started
71 li = *(LARGE_INTEGER *)&lli;
73 KeSetTimerEx(&DeviceObject->Timer->timer,
76 &(DeviceObject->Timer->dpc));
84 IoStopTimer(PDEVICE_OBJECT DeviceObject)
86 * FUNCTION: Disables for a specified device object so the driver-supplied
87 * IoTimer is not called
89 * DeviceObject = Device whose timer is to be stopped
92 KeCancelTimer(&(DeviceObject->Timer->timer));