- Merge aicom-network-fixes up to r36740
[reactos.git] / reactos / 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 Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 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 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; see the file COPYING.LIB.
18 * If not, write to the Free Software Foundation,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 */
22
23 #include "videoprt.h"
24
25 /* PRIVATE FUNCTIONS **********************************************************/
26
27 VOID NTAPI
28 IntVideoPortTimerRoutine(
29 IN PDEVICE_OBJECT DeviceObject,
30 IN PVOID ServiceContext)
31 {
32 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = ServiceContext;
33
34 ASSERT(DeviceExtension->DriverExtension->InitializationData.HwTimer != NULL);
35
36 DeviceExtension->DriverExtension->InitializationData.HwTimer(
37 &DeviceExtension->MiniPortDeviceExtension);
38 }
39
40 BOOLEAN NTAPI
41 IntVideoPortSetupTimer(
42 IN PDEVICE_OBJECT DeviceObject,
43 IN PVIDEO_PORT_DRIVER_EXTENSION DriverExtension)
44 {
45 NTSTATUS Status;
46 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
47
48 DeviceExtension = (PVIDEO_PORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
49
50 if (DriverExtension->InitializationData.HwTimer != NULL)
51 {
52 INFO_(VIDEOPRT, "Initializing timer\n");
53
54 Status = IoInitializeTimer(
55 DeviceObject,
56 IntVideoPortTimerRoutine,
57 DeviceExtension);
58
59 if (!NT_SUCCESS(Status))
60 {
61 WARN_(VIDEOPRT, "IoInitializeTimer failed with status 0x%08x\n", Status);
62 return FALSE;
63 }
64 }
65
66 return TRUE;
67 }
68
69 /* PUBLIC FUNCTIONS ***********************************************************/
70
71 /*
72 * @implemented
73 */
74
75 VOID NTAPI
76 VideoPortStartTimer(IN PVOID HwDeviceExtension)
77 {
78 TRACE_(VIDEOPRT, "VideoPortStartTimer\n");
79 IoStartTimer(VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->FunctionalDeviceObject);
80 }
81
82 /*
83 * @implemented
84 */
85
86 VOID NTAPI
87 VideoPortStopTimer(IN PVOID HwDeviceExtension)
88 {
89 TRACE_(VIDEOPRT, "VideoPortStopTimer\n");
90 IoStopTimer(VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->FunctionalDeviceObject);
91 }