1 /* $Id: timer.c,v 1.6 2001/03/07 16:48:42 dwelch Exp $
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 *****************************************************************/
28 IoInitializeTimer(PDEVICE_OBJECT DeviceObject
,
29 PIO_TIMER_ROUTINE TimerRoutine
,
32 * FUNCTION: Sets up a driver-supplied IoTimer routine associated with a given
35 * DeviceObject = Device object whose timer is be initialized
36 * TimerRoutine = Driver supplied routine which will be called once per
37 * second if the timer is active
38 * Context = Driver supplied context to be passed to the TimerRoutine
42 DeviceObject
->Timer
= ExAllocatePoolWithTag(NonPagedPool
, sizeof(IO_TIMER
),
44 KeInitializeTimer(&(DeviceObject
->Timer
->timer
));
45 KeInitializeDpc(&(DeviceObject
->Timer
->dpc
),
46 (PKDEFERRED_ROUTINE
)TimerRoutine
,Context
);
48 return(STATUS_SUCCESS
);
53 IoStartTimer(PDEVICE_OBJECT DeviceObject
)
55 * FUNCTION: Starts a timer so the driver-supplied IoTimer routine will be
56 * called once per second
58 * DeviceObject = Device whose timer is to be started
65 li
= *(LARGE_INTEGER
*)&lli
;
67 KeSetTimerEx(&DeviceObject
->Timer
->timer
,
70 &(DeviceObject
->Timer
->dpc
));
75 IoStopTimer(PDEVICE_OBJECT DeviceObject
)
77 * FUNCTION: Disables for a specified device object so the driver-supplied
78 * IoTimer is not called
80 * DeviceObject = Device whose timer is to be stopped
83 KeCancelTimer(&(DeviceObject
->Timer
->timer
));