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