- Update to r53061
[reactos.git] / drivers / video / videoprt / timer.c
1 /*
2 * VideoPort driver
3 *
4 * Copyright (C) 2002, 2003, 2004 ReactOS Team
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 #include "videoprt.h"
23
24 /* PRIVATE FUNCTIONS **********************************************************/
25
26 VOID NTAPI
27 IntVideoPortTimerRoutine(
28 IN PDEVICE_OBJECT DeviceObject,
29 IN PVOID ServiceContext)
30 {
31 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = ServiceContext;
32
33 ASSERT(DeviceExtension->DriverExtension->InitializationData.HwTimer != NULL);
34
35 DeviceExtension->DriverExtension->InitializationData.HwTimer(
36 &DeviceExtension->MiniPortDeviceExtension);
37 }
38
39 BOOLEAN NTAPI
40 IntVideoPortSetupTimer(
41 IN PDEVICE_OBJECT DeviceObject,
42 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension)
43 {
44 NTSTATUS Status;
45 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
46
47 DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
48
49 if (DriverExtension->InitializationData.HwTimer != NULL)
50 {
51 INFO_(VIDEOPRT, "Initializing timer\n");
52
53 Status = IoInitializeTimer(
54 DeviceObject,
55 IntVideoPortTimerRoutine,
56 DeviceExtension);
57
58 if (!NT_SUCCESS(Status))
59 {
60 WARN_(VIDEOPRT, "IoInitializeTimer failed with status 0x%08x\n", Status);
61 return FALSE;
62 }
63 }
64
65 return TRUE;
66 }
67
68 /* PUBLIC FUNCTIONS ***********************************************************/
69
70 /*
71 * @implemented
72 */
73
74 VOID NTAPI
75 VideoPortStartTimer(IN PVOID HwDeviceExtension)
76 {
77 TRACE_(VIDEOPRT, "VideoPortStartTimer\n");
78 IoStartTimer(VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->FunctionalDeviceObject);
79 }
80
81 /*
82 * @implemented
83 */
84
85 VOID NTAPI
86 VideoPortStopTimer(IN PVOID HwDeviceExtension)
87 {
88 TRACE_(VIDEOPRT, "VideoPortStopTimer\n");
89 IoStopTimer(VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->FunctionalDeviceObject);
90 }