The real, definitive, Visual C++ support branch. Accept no substitutes
[reactos.git] / drivers / video / videoprt / event.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 /* PUBLIC FUNCTIONS ***********************************************************/
26
27 /*
28 * @implemented
29 */
30
31 VP_STATUS NTAPI
32 VideoPortCreateEvent(
33 IN PVOID HwDeviceExtension,
34 IN ULONG EventFlag,
35 IN PVOID Unused,
36 OUT PEVENT *Event)
37 {
38 EVENT_TYPE Type;
39
40 (*Event) = ExAllocatePoolWithTag(
41 NonPagedPool,
42 sizeof(KEVENT),
43 TAG_VIDEO_PORT);
44
45 if ((*Event) == NULL)
46 return ERROR_NOT_ENOUGH_MEMORY;
47
48 if (EventFlag & NOTIFICATION_EVENT)
49 Type = NotificationEvent;
50 else
51 Type = SynchronizationEvent;
52
53 KeInitializeEvent((PKEVENT)*Event, Type, EventFlag & INITIAL_EVENT_SIGNALED);
54 return NO_ERROR;
55 }
56
57 /*
58 * @implemented
59 */
60
61 VP_STATUS NTAPI
62 VideoPortDeleteEvent(
63 IN PVOID HwDeviceExtension,
64 IN PEVENT Event)
65 {
66 ExFreePool(Event);
67 return NO_ERROR;
68 }
69
70 /*
71 * @implemented
72 */
73
74 LONG NTAPI
75 VideoPortSetEvent(
76 IN PVOID HwDeviceExtension,
77 IN PEVENT Event)
78 {
79 return KeSetEvent((PKEVENT)Event, IO_NO_INCREMENT, FALSE);
80 }
81
82 /*
83 * @implemented
84 */
85
86 VOID NTAPI
87 VideoPortClearEvent(
88 IN PVOID HwDeviceExtension,
89 IN PEVENT Event)
90 {
91 KeClearEvent((PKEVENT)Event);
92 }
93
94 /*
95 * @implemented
96 */
97
98 VP_STATUS NTAPI
99 VideoPortWaitForSingleObject(
100 IN PVOID HwDeviceExtension,
101 IN PVOID Object,
102 IN PLARGE_INTEGER Timeout OPTIONAL)
103 {
104 return KeWaitForSingleObject(
105 Object,
106 Executive,
107 KernelMode,
108 FALSE,
109 Timeout);
110 }