- Synchronize up to trunk's revision r57864.
[reactos.git] / win32ss / drivers / videoprt / spinlock.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 /*
25 * @implemented
26 */
27
28 VP_STATUS NTAPI
29 VideoPortCreateSpinLock(
30 IN PVOID HwDeviceExtension,
31 OUT PSPIN_LOCK *SpinLock)
32 {
33 TRACE_(VIDEOPRT, "VideoPortCreateSpinLock\n");
34 *SpinLock = ExAllocatePool(NonPagedPool, sizeof(KSPIN_LOCK));
35 if (*SpinLock == NULL)
36 return ERROR_NOT_ENOUGH_MEMORY;
37 KeInitializeSpinLock((PKSPIN_LOCK)*SpinLock);
38 return NO_ERROR;
39 }
40
41 /*
42 * @implemented
43 */
44
45 VP_STATUS NTAPI
46 VideoPortDeleteSpinLock(
47 IN PVOID HwDeviceExtension,
48 IN PSPIN_LOCK SpinLock)
49 {
50 TRACE_(VIDEOPRT, "VideoPortDeleteSpinLock\n");
51 ExFreePool(SpinLock);
52 return NO_ERROR;
53 }
54
55 /*
56 * @implemented
57 */
58
59 VOID NTAPI
60 VideoPortAcquireSpinLock(
61 IN PVOID HwDeviceExtension,
62 IN PSPIN_LOCK SpinLock,
63 OUT PUCHAR OldIrql)
64 {
65 TRACE_(VIDEOPRT, "VideoPortAcquireSpinLock\n");
66 KeAcquireSpinLock((PKSPIN_LOCK)SpinLock, OldIrql);
67 }
68
69 /*
70 * @implemented
71 */
72
73 VOID NTAPI
74 VideoPortAcquireSpinLockAtDpcLevel(
75 IN PVOID HwDeviceExtension,
76 IN PSPIN_LOCK SpinLock)
77 {
78 TRACE_(VIDEOPRT, "VideoPortAcquireSpinLockAtDpcLevel\n");
79 KeAcquireSpinLockAtDpcLevel((PKSPIN_LOCK)SpinLock);
80 }
81
82 /*
83 * @implemented
84 */
85
86 VOID NTAPI
87 VideoPortReleaseSpinLock(
88 IN PVOID HwDeviceExtension,
89 IN PSPIN_LOCK SpinLock,
90 IN UCHAR NewIrql)
91 {
92 TRACE_(VIDEOPRT, "VideoPortReleaseSpinLock\n");
93 KeReleaseSpinLock((PKSPIN_LOCK)SpinLock, NewIrql);
94 }
95
96 /*
97 * @implemented
98 */
99
100 VOID NTAPI
101 VideoPortReleaseSpinLockFromDpcLevel(
102 IN PVOID HwDeviceExtension,
103 IN PSPIN_LOCK SpinLock)
104 {
105 TRACE_(VIDEOPRT, "VideoPortReleaseSpinLockFromDpcLevel\n");
106 KeReleaseSpinLockFromDpcLevel((PKSPIN_LOCK)SpinLock);
107 }