xref: /reactos/win32ss/drivers/videoprt/funclist.c (revision 5100859e)
1 /*
2  * VideoPort driver
3  *
4  * Copyright (C) 2007 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 typedef struct _VIDEO_PORT_FUNCTION_TABLE {
28     PVOID Address;
29     PCSZ Name;
30 } *PVIDEO_PORT_FUNCTION_TABLE, VIDEO_PORT_FUNCTION_TABLE;
31 
32 /* GLOBAL VARIABLES ***********************************************************/
33 
34 /* Create an array of entries with pfn, psz, for IntVideoPortGetProcAddress */
35 #define MAKE_ENTRY(FUNCTIONNAME) { FUNCTIONNAME, #FUNCTIONNAME }
36 const VIDEO_PORT_FUNCTION_TABLE VideoPortExports[] = {
37     MAKE_ENTRY(VideoPortDDCMonitorHelper),
38     MAKE_ENTRY(VideoPortDoDma),
39     MAKE_ENTRY(VideoPortGetCommonBuffer),
40     MAKE_ENTRY(VideoPortGetMdl),
41     MAKE_ENTRY(VideoPortLockPages),
42     MAKE_ENTRY(VideoPortSignalDmaComplete),
43     MAKE_ENTRY(VideoPortUnlockPages),
44     MAKE_ENTRY(VideoPortAssociateEventsWithDmaHandle),
45     MAKE_ENTRY(VideoPortGetBytesUsed),
46     MAKE_ENTRY(VideoPortSetBytesUsed),
47     MAKE_ENTRY(VideoPortGetDmaContext),
48     MAKE_ENTRY(VideoPortSetDmaContext),
49     MAKE_ENTRY(VideoPortMapDmaMemory),
50     MAKE_ENTRY(VideoPortUnmapDmaMemory),
51     MAKE_ENTRY(VideoPortGetAgpServices),
52     MAKE_ENTRY(VideoPortAllocateContiguousMemory),
53     MAKE_ENTRY(VideoPortGetRomImage),
54     MAKE_ENTRY(VideoPortGetAssociatedDeviceExtension),
55     MAKE_ENTRY(VideoPortGetAssociatedDeviceID),
56     MAKE_ENTRY(VideoPortAcquireDeviceLock),
57     MAKE_ENTRY(VideoPortReleaseDeviceLock),
58     MAKE_ENTRY(VideoPortAllocateBuffer),
59     MAKE_ENTRY(VideoPortFreeCommonBuffer),
60     MAKE_ENTRY(VideoPortReleaseBuffer),
61     MAKE_ENTRY(VideoPortInterlockedIncrement),
62     MAKE_ENTRY(VideoPortInterlockedDecrement),
63     MAKE_ENTRY(VideoPortInterlockedExchange),
64     MAKE_ENTRY(VideoPortGetVgaStatus),
65     MAKE_ENTRY(VideoPortQueueDpc),
66     MAKE_ENTRY(VideoPortEnumerateChildren),
67     MAKE_ENTRY(VideoPortQueryServices),
68     MAKE_ENTRY(VideoPortGetDmaAdapter),
69     MAKE_ENTRY(VideoPortPutDmaAdapter),
70     MAKE_ENTRY(VideoPortAllocateCommonBuffer),
71     MAKE_ENTRY(VideoPortReleaseCommonBuffer),
72     MAKE_ENTRY(VideoPortLockBuffer),
73     MAKE_ENTRY(VideoPortUnlockBuffer),
74     MAKE_ENTRY(VideoPortStartDma),
75     MAKE_ENTRY(VideoPortCompleteDma),
76     MAKE_ENTRY(VideoPortCreateEvent),
77     MAKE_ENTRY(VideoPortDeleteEvent),
78     MAKE_ENTRY(VideoPortSetEvent),
79     MAKE_ENTRY(VideoPortClearEvent),
80     MAKE_ENTRY(VideoPortReadStateEvent),
81     MAKE_ENTRY(VideoPortWaitForSingleObject),
82     MAKE_ENTRY(VideoPortAllocatePool),
83     MAKE_ENTRY(VideoPortFreePool),
84     MAKE_ENTRY(VideoPortCreateSpinLock),
85     MAKE_ENTRY(VideoPortDeleteSpinLock),
86     MAKE_ENTRY(VideoPortAcquireSpinLock),
87     MAKE_ENTRY(VideoPortAcquireSpinLockAtDpcLevel),
88     MAKE_ENTRY(VideoPortReleaseSpinLock),
89     MAKE_ENTRY(VideoPortReleaseSpinLockFromDpcLevel),
90     MAKE_ENTRY(VideoPortCheckForDeviceExistence),
91     MAKE_ENTRY(VideoPortCreateSecondaryDisplay),
92     MAKE_ENTRY(VideoPortFlushRegistry),
93     MAKE_ENTRY(VideoPortQueryPerformanceCounter),
94     MAKE_ENTRY(VideoPortGetVersion),
95     MAKE_ENTRY(VideoPortRegisterBugcheckCallback),
96 };
97 #undef MAKE_ENTRY
98 
99 PVOID NTAPI
100 IntVideoPortGetProcAddress(
101     IN PVOID HwDeviceExtension,
102     IN PUCHAR FunctionName)
103 {
104     ULONG i;
105 
106     TRACE_(VIDEOPRT, "VideoPortGetProcAddress(%s)\n", FunctionName);
107 
108    /* Search by name */
109     for (i = 0; i < ARRAYSIZE(VideoPortExports); i++)
110     {
111         if (!strcmp((PCHAR)FunctionName, VideoPortExports[i].Name))
112         {
113             return (PVOID)VideoPortExports[i].Address;
114         }
115     }
116 
117     ERR_(VIDEOPRT, "VideoPortGetProcAddress: Can't resolve symbol %s\n", FunctionName);
118 
119     return NULL;
120 }
121