Jungo WinDriver  
Official Documentation
windrvr.h
Go to the documentation of this file.
1/* @JUNGO_COPYRIGHT@ */
2
3/*
4 * W i n D r i v e r
5 * =================
6 *
7 * FOR DETAILS ON THE WinDriver FUNCTIONS, PLEASE SEE THE WinDriver MANUAL
8 * OR INCLUDED HELP FILES.
9 *
10 * This file may not be distributed, it may only be used for development
11 * or evaluation purposes. The only exception is distribution to Linux.
12 * For details refer to \WinDriver\docs\license.txt.
13 *
14 * Web site: https://www.jungo.com
15 * Email: [email protected]
16 */
17#ifndef _WINDRVR_H_
18#define _WINDRVR_H_
19
20#if defined(__cplusplus)
21 extern "C" {
22#endif
23
24#include "wd_ver.h"
25
26#if defined(WIN32) && !defined(__MINGW32__)
27 #define DLLCALLCONV __stdcall
28 #if !defined(_SAL_VERSION)
29 #include <sal.h>
30 #endif
31#else
32 #define DLLCALLCONV
33
34 /* the following macros are part of SAL annotations macros in Windows and
35 are used in prototype of API functions, therefore, must be defined in
36 Unix as well */
37 #define _In_
38 #define _Inout_
39 #define _Out_
40 #define _Outptr_
41#endif
42
43#if defined(WIN32)
44 #define WD_DRIVER_NAME_PREFIX "\\\\.\\"
45#elif defined(LINUX)
46 #define WD_DRIVER_NAME_PREFIX "/dev/"
47#else
48 #define WD_DRIVER_NAME_PREFIX ""
49#endif
50
51#if !defined(WIN32)
52 #define __FUNCTION__ __func__
53#endif
54
55#define WD_DEFAULT_DRIVER_NAME_BASE "windrvr" WD_VER_ITOA
56#define WD_DEFAULT_DRIVER_NAME \
57 WD_DRIVER_NAME_PREFIX WD_DEFAULT_DRIVER_NAME_BASE
58
59#define WD_MAX_DRIVER_NAME_LENGTH 128
60#define WD_MAX_KP_NAME_LENGTH 128
61#define WD_VERSION_STR_LENGTH 128
62
63#if defined(WD_DRIVER_NAME_CHANGE)
103 const char* DLLCALLCONV WD_DriverName(const char *sName);
105 #define WD_DRIVER_NAME WD_DriverName(NULL)
106#else
107 #define WD_DRIVER_NAME WD_DEFAULT_DRIVER_NAME
108#endif
109
110#define WD_PROD_NAME "WinDriver"
111
112#if defined(x86_64)
113#define KERNEL_64BIT
114#elif defined(ARM64)
115#define KERNEL_64BIT
116#elif defined(ARM)
117#elif defined(x86)
118#else
119#error No platform is defined. Please define either x86, x86_64, ARM or ARM64.
120#endif
121#if (defined(x86_64) && defined (ARM64)) || \
122 (defined(x86_64) && defined (ARM)) || \
123 (defined(x86_64) && defined (x86)) || \
124 (defined(ARM64) && defined (x86)) || \
125 (defined(ARM64) && defined (ARM)) || \
126 (defined(x86) && defined(ARM))
127#error Cannot have more than one platform defined in a WinDriver compilation.
128#endif
129
130
131#if defined(x86_64)
132 #define WD_CPU_SPEC " x86_64"
133#elif defined(ARM)
134 #define WD_CPU_SPEC " ARM"
135#elif defined(ARM64)
136 #define WD_CPU_SPEC " ARM64"
137#else
138 #define WD_CPU_SPEC " X86"
139#endif
140
141#if defined(WINNT)
142 #define WD_FILE_FORMAT " sys"
143#elif defined (APPLE)
144 #define WD_FILE_FORMAT " kext"
145#elif defined (LINUX)
146 #define WD_FILE_FORMAT " ko"
147#endif
148
149#if defined(KERNEL_64BIT)
150 #define WD_DATA_MODEL " 64bit"
151#else
152 #define WD_DATA_MODEL " 32bit"
153#endif
154
155#if defined(__KERNEL__) && defined(WINNT)
156 #if (NTDDI_VERSION >= NTDDI_WIN10_VB)
157 #define WD_VER_STR_SUFFIX ""
158 #else
159 #define WD_VER_STR_SUFFIX " for Windows 10 (Build 18632 and Lower)"
160 #endif
161#else
162 #define WD_VER_STR_SUFFIX ""
163#endif
164
165#define WD_VER_STR WD_PROD_NAME " v" WD_VERSION_STR \
166 " Jungo Connectivity (c) 1997 - " COPYRIGHTS_YEAR_STR \
167 " Build Date: " __DATE__ \
168 WD_CPU_SPEC WD_DATA_MODEL WD_FILE_FORMAT WD_VER_STR_SUFFIX
169
170#if !defined(POSIX) && defined(LINUX)
171 #define POSIX
172#endif
173
174#if !defined(UNIX) && defined(POSIX)
175 #define UNIX
176#endif
177
178#if !defined(WIN32) && defined(WINNT)
179 #define WIN32
180#endif
181
182#if !defined(WIN32) && !defined(UNIX) && !defined(APPLE)
183 #define WIN32
184#endif
185
186#if defined(_KERNEL_MODE) && !defined(KERNEL)
187 #define KERNEL
188#endif
189
190#if defined(KERNEL) && !defined(__KERNEL__)
191 #define __KERNEL__
192#endif
193
194#if defined(_KERNEL) && !defined(__KERNEL__)
195 #define __KERNEL__
196#endif
197
198#if defined( __KERNEL__) && !defined(_KERNEL)
199 #define _KERNEL
200#endif
201
202#if defined(LINUX) && defined(__x86_64__) && !defined(__KERNEL__)
203 /* This fixes binary compatibility with older version of GLIBC
204 * (64bit only) */
205 __asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
206#endif
207
208#if defined(UNIX)
209
210
211 #if !defined(__P_TYPES__)
212 #define __P_TYPES__
213 #include <wd_types.h>
214
215 typedef void VOID;
216 typedef unsigned char UCHAR;
217 typedef unsigned short USHORT;
218 typedef unsigned int UINT;
219 #if !defined (APPLE_USB)
220 typedef unsigned long ULONG;
221 #endif
222 typedef u32 BOOL;
223 typedef void *PVOID;
224 typedef unsigned char *PBYTE;
225 typedef char CHAR;
226 typedef char *PCHAR;
227 typedef unsigned short *PWORD;
228 typedef u32 DWORD, *PDWORD;
229 typedef PVOID HANDLE;
230 #endif
231 #if !defined(__KERNEL__)
232 #include <string.h>
233 #include <ctype.h>
234 #include <stdlib.h>
235 #endif
236 #ifndef TRUE
237 #define TRUE 1
238 #endif
239 #ifndef FALSE
240 #define FALSE 0
241 #endif
242 #define __cdecl
243 #define WINAPI
244
245 #if defined(__KERNEL__)
246 #if defined(LINUX)
247 /* For _IO macros and for mapping Linux status codes
248 * to WD status codes */
249 #include <asm-generic/ioctl.h>
250 #include <asm-generic/errno.h>
251 #endif
252 #else
253 #include <unistd.h>
254 #if defined(LINUX)
255 #include <sys/ioctl.h> /* for BSD ioctl() */
256 #include <sys/mman.h>
257 #endif
258 #include <sys/types.h>
259 #include <sys/stat.h>
260 #include <fcntl.h>
261 #endif
262 typedef unsigned long long UINT64;
263 #if defined(APPLE)
264 #include <libkern/OSTypes.h>
265 #include <libkern/OSAtomic.h>
266 typedef UInt16 UINT16;
267 typedef UInt8 UINT8;
268 typedef UInt8 u8;
269 typedef UInt16 u16;
270 typedef UInt32 u32;
271 #include <IOKit/IOTypes.h>
272 #if defined(__KERNEL__)
273 typedef struct OSObject* FILEHANDLE;
274 typedef UInt32 PRCHANDLE;
275 #else
276 #include <IOKit/IOKitLib.h>
277 #endif
278 enum {
279 kWinDriverMethodSyncIoctl = 0,
280 kWinDriverNumOfMethods,
281 };
282 #if !defined(__KERNEL__)
283 #include <string.h>
284 #include <ctype.h>
285 #endif
286 #ifndef TRUE
287 #define TRUE true
288 #endif
289 #ifndef FALSE
290 #define FALSE false
291 #endif
292 #define __cdecl
293 #define WINAPI
294 #ifdef __LP64__
295 #define PTR2INT(value) ((UInt64)(value))
296 #else
297 #define PTR2INT(value) ((UInt32)(value))
298 #endif
299 #define MAC_UC_MAGIC_MASK 0xFF0000FF
300 #define MAC_UC_MAGIC_NUM 0x7E000041
301 #define MAC_UC_64BIT_APP 0x100
302#endif
303
304#elif defined(WIN32)
305 #if defined(__KERNEL__)
306 #if !defined (CMAKE_WD_BUILD)
307 int sprintf(char *buffer, const char *format, ...);
308 #endif
309 #else
310 #include <windows.h>
311 #include <winioctl.h>
312 #endif
313 #define stricmp _stricmp
314 typedef unsigned __int64 UINT64;
315#endif
316
317#if !defined(__KERNEL__)
318 #include <stdarg.h>
319 #if !defined(va_copy) && !defined(__va_copy)
320 #define va_copy(ap2,ap1) (ap2)=(ap1)
321 #endif
322 #if !defined(va_copy) && defined(__va_copy)
323 #define va_copy __va_copy
324 #endif
325#endif
326
327#ifndef WINAPI
328 #define WINAPI
329#endif
330
331#if !defined(_WINDEF_)
332 typedef unsigned char BYTE;
333 typedef unsigned short int WORD;
334#endif
335
336#if !defined(_BASETSD_H_)
337 typedef unsigned int UINT32;
338#endif
339
340
342#if defined(UNIX)
343 #define PRI64 "ll"
344#elif defined(WIN32)
345 #define PRI64 "I64"
346#endif
347
349#if defined(KERNEL_64BIT)
350 #define KPRI PRI64
351 #if defined(WIN32)
352 #if defined(i386)
353 #define UPRI "z"
354 #else
355 #define UPRI KPRI
356 #endif
357 #else
358 #define UPRI "l"
359 #endif
360#else
361 #define KPRI ""
362 #define UPRI "l"
363#endif
364
365/*
366 * The KPTR is guaranteed to be the same size as a kernel-mode pointer
367 * The UPTR is guaranteed to be the same size as a user-mode pointer
368 */
369#if defined(KERNEL_64BIT)
370 typedef UINT64 KPTR;
371#else
372 typedef UINT32 KPTR;
373#endif
374
375#if defined(UNIX)
376 typedef unsigned long UPTR;
377#else
378 typedef size_t UPTR;
379#endif
380
383
384#include "windrvr_usb.h"
385
388typedef enum
389{
394 RP_BYTE = 10,
395 RP_WORD = 11,
396 RP_DWORD = 12,
397 WP_BYTE = 13,
398 WP_WORD = 14,
399 WP_DWORD = 15,
400 RP_QWORD = 16,
401 WP_QWORD = 17,
403 RP_SBYTE = 20,
404 RP_SWORD = 21,
406 WP_SBYTE = 23,
407 WP_SWORD = 24,
412 RM_BYTE = 30,
413 RM_WORD = 31,
414 RM_DWORD = 32,
415 WM_BYTE = 33,
416 WM_WORD = 34,
417 WM_DWORD = 35,
418 RM_QWORD = 36,
419 WM_QWORD = 37,
421 RM_SBYTE = 40,
422 RM_SWORD = 41,
424 WM_SBYTE = 43,
425 WM_SWORD = 44,
428 WM_SQWORD = 47
430
431enum { WD_DMA_PAGES = 256 };
432
433#ifndef DMA_BIT_MASK
434 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
435#endif
436
437typedef enum {
441 DMA_KBUF_BELOW_16M = 0x2,
444 DMA_LARGE_BUFFER = 0x4,
452 DMA_KERNEL_ONLY_MAP = 0x10,
455 DMA_FROM_DEVICE = 0x20,
471
482 DMA_TRANSACTION = 0x2000,
485 DMA_GPUDIRECT = 0x4000,
492
493#define DMA_ADDRESS_WIDTH_MASK 0x7f000000
494
495#define DMA_OPTIONS_ALL \
496 (DMA_KERNEL_BUFFER_ALLOC | DMA_KBUF_BELOW_16M | DMA_LARGE_BUFFER \
497 | DMA_ALLOW_CACHE | DMA_KERNEL_ONLY_MAP | DMA_FROM_DEVICE | DMA_TO_DEVICE \
498 | DMA_ALLOW_64BIT_ADDRESS | DMA_ALLOW_NO_HCARD | DMA_GET_EXISTING_BUF \
499 | DMA_RESERVED_MEM | DMA_KBUF_ALLOC_SPECIFY_ADDRESS_WIDTH \
500 | DMA_ADDRESS_WIDTH_MASK)
501
502#define DMA_DIRECTION_MASK DMA_TO_FROM_DEVICE
503
505#define DMA_READ_FROM_DEVICE DMA_FROM_DEVICE
506#define DMA_WRITE_TO_DEVICE DMA_TO_DEVICE
507
508#define DMA_OPTIONS_ADDRESS_WIDTH_SHIFT 24
513enum {
514 WD_MATCH_EXCLUDE = 0x1
515};
516
517#ifndef PAD_TO_64
518/* Use it to pad struct size to 64 bit, when using 32 on 64 bit applications */
519#if defined (i386) && defined(KERNEL_64BIT)
520 #define PAD_TO_64(pName) DWORD dwPad_##pName;
521#else
522 #define PAD_TO_64(pName)
523#endif
524#endif
526typedef struct
527{
528 DMA_ADDR pPhysicalAddr;
529 DWORD dwBytes;
530 PAD_TO_64(dwBytes)
533typedef void (DLLCALLCONV * DMA_TRANSACTION_CALLBACK)(PVOID pData);
535typedef struct
536{
537 DWORD hDma;
538 PAD_TO_64(hDma)
539
540 PVOID pUserAddr;
541 PAD_TO_64(pUserAddr)
543 KPTR pKernelAddr;
544 DWORD dwBytes;
545 DWORD dwOptions;
548 DWORD dwPages;
549 DWORD hCard;
552 /* Windows: The following 6 parameters are used for DMA transaction only */
553
554 DMA_TRANSACTION_CALLBACK DMATransactionCallback;
555 PAD_TO_64(DMATransactionCallback)
556
557 PVOID DMATransactionCallbackCtx;
558 PAD_TO_64(DMATransactionCallbackCtx)
560 DWORD dwAlignment;
561 DWORD dwMaxTransferSize;
562 DWORD dwTransferElementSize;
563 DWORD dwBytesTransferred;
567
568typedef enum {
569 /* KER_BUF_ALLOC_NON_CONTIG and KER_BUF_GET_EXISTING_BUF options are valid
570 * only as part of "WinDriver for Server" API and require
571 * "WinDriver for Server" license.
572 * @note "WinDriver for Server" APIs are included in WinDriver evaluation
573 * version. */
575 KER_BUF_ALLOC_CONTIG = 0x0002,
576 KER_BUF_ALLOC_CACHED = 0x0004,
580typedef struct
582 DWORD hKerBuf;
583 DWORD dwOptions;
584 UINT64 qwBytes;
585 KPTR pKernelAddr;
586 UPTR pUserAddr;
587 PAD_TO_64(pUserAddr)
590typedef struct
591{
592 KPTR pPort;
593 DWORD cmdTrans;
595 /* Parameters used for string transfers: */
596 DWORD dwBytes;
597 DWORD fAutoinc;
599 DWORD dwOptions;
600 union
602 BYTE Byte;
603 WORD Word;
604 UINT32 Dword;
605 UINT64 Qword;
606 PVOID pBuffer;
607 } Data;
609
610enum {
611 INTERRUPT_LATCHED = 0x00,
614 INTERRUPT_CMD_COPY = 0x02,
619 INTERRUPT_CE_INT_ID = 0x04,
621 INTERRUPT_MESSAGE = 0x10,
622 INTERRUPT_MESSAGE_X = 0x20,
626};
628typedef struct
630 DWORD hKernelPlugIn;
631 DWORD dwMessage;
632 PVOID pData;
634 DWORD dwResult;
635 PAD_TO_64(dwResult)
638typedef enum {
645typedef struct
646{
647 DWORD hInterrupt;
648 DWORD dwOptions;
650 WD_TRANSFER *Cmd;
651 PAD_TO_64(Cmd)
652 DWORD dwCmds;
653 PAD_TO_64(dwCmds)
655 /* For WD_IntEnable(): */
656 WD_KERNEL_PLUGIN_CALL kpCall;
657 DWORD fEnableOk;
660 /* For WD_IntWait() and WD_IntCount(): */
661 DWORD dwCounter;
662 DWORD dwLost;
663 DWORD fStopped;
664 DWORD dwLastMessage;
665 DWORD dwEnabledIntType;
668typedef struct
670 DWORD dwVer;
673
674#define WD_LICENSE_LENGTH 3072
675typedef struct
676{
677 CHAR cLicense[WD_LICENSE_LENGTH];
680enum
682 WD_BUS_USB = (int)0xfffffffe,
684 WD_BUS_ISA = 1,
686 WD_BUS_PCI = 5,
688typedef DWORD WD_BUS_TYPE;
690typedef struct
692 WD_BUS_TYPE dwBusType;
693 DWORD dwDomainNum;
694 DWORD dwBusNum;
695 DWORD dwSlotFunc;
698typedef enum
701 ITEM_INTERRUPT = 1,
703 ITEM_IO = 3,
705} ITEM_TYPE;
706
707typedef enum
708{
718typedef struct
720 DWORD item;
721 DWORD fNotSharable;
722 union I
723 {
725 struct Mem
727 PHYS_ADDR pPhysicalAddr;
728 UINT64 qwBytes;
729 KPTR pTransAddr;
733 UPTR pUserDirectAddr;
737 PAD_TO_64(pUserDirectAddr)
738 DWORD dwBar;
739 DWORD dwOptions;
741 KPTR pReserved;
743
745 struct IO
747 KPTR pAddr;
748 DWORD dwBytes;
749 DWORD dwBar;
750 } IO;
751
753 struct Int
754 {
755 DWORD dwInterrupt;
756 DWORD dwOptions;
761 DWORD hInterrupt;
763 DWORD dwReserved1;
764 KPTR pReserved2;
765 } Int;
766 WD_BUS Bus;
767 } I;
770enum { WD_CARD_ITEMS = 128 };
772typedef struct
774 DWORD dwItems;
775 PAD_TO_64(dwItems)
779typedef struct
780{
781 WD_CARD Card;
782 DWORD fCheckLockOnly;
784 DWORD hCard;
785 DWORD dwOptions;
786 CHAR cName[32];
787 CHAR cDescription[100];
789
790#define WD_PROCESS_NAME_LENGTH 128
791typedef struct
793 CHAR cProcessName[WD_PROCESS_NAME_LENGTH];
794 DWORD dwSubGroupID;
795 DWORD dwGroupID;
799 DWORD hIpc;
802typedef struct
804 WD_IPC_PROCESS procInfo;
805 DWORD dwOptions;
808enum { WD_IPC_MAX_PROCS = 0x40 };
810typedef struct
811{
812 DWORD hIpc;
815 DWORD dwNumProcs;
819enum
821 WD_IPC_UID_UNICAST = 0x1,
824};
826typedef struct
827{
828 DWORD hIpc;
829 DWORD dwOptions;
832 DWORD dwRecipientID;
833 DWORD dwMsgID;
834 UINT64 qwMsgData;
837typedef struct
839 DWORD hCard;
842 PAD_TO_64(Cmd)
843 DWORD dwCmds;
844 DWORD dwOptions;
847enum { WD_FORCE_CLEANUP = 0x1 };
849enum { WD_PCI_CARDS = 256 };
851typedef struct
853 DWORD dwDomain;
855 DWORD dwBus;
856 DWORD dwSlot;
857 DWORD dwFunction;
860typedef struct
861{
862 DWORD dwVendorId;
863 DWORD dwDeviceId;
864} WD_PCI_ID;
865
866typedef struct
867{
869 WD_PCI_ID searchId;
872 DWORD dwCards;
875 WD_PCI_ID cardId[WD_PCI_CARDS];
879 DWORD dwOptions;
882typedef enum {
889enum { WD_PCI_MAX_CAPS = 50 };
891enum { WD_PCI_CAP_ID_ALL = 0x0 };
893typedef struct
894{
895 DWORD dwCapId;
896 DWORD dwCapOffset;
898
899typedef enum {
904
905typedef struct
908 WD_PCI_SLOT pciSlot;
909 DWORD dwCapId;
911 DWORD dwOptions;
915 DWORD dwNumCaps;
916 WD_PCI_CAP pciCaps[WD_PCI_MAX_CAPS];
920typedef struct
922 WD_PCI_SLOT pciSlot;
923 DWORD dwNumVFs;
926typedef struct
928 WD_PCI_SLOT pciSlot;
929 WD_CARD Card;
932typedef enum
934 PCI_ACCESS_OK = 0,
936 PCI_BAD_BUS = 2,
940typedef struct
941{
942 WD_PCI_SLOT pciSlot;
943 PVOID pBuffer;
944 PAD_TO_64(pBuffer)
945
946 DWORD dwOffset;
947 DWORD dwBytes;
949 DWORD fIsRead;
950 DWORD dwResult;
952
953enum { SLEEP_BUSY = 0, SLEEP_NON_BUSY = 1 };
954typedef struct
956 DWORD dwMicroSeconds;
958 DWORD dwOptions;
961typedef enum
963 D_OFF = 0,
964 D_ERROR = 1,
966 D_INFO = 3,
970typedef enum
972 S_ALL = (int)0xffffffff,
973 S_IO = 0x00000008,
974 S_MEM = 0x00000010,
975 S_INT = 0x00000020,
976 S_PCI = 0x00000040,
977 S_DMA = 0x00000080,
978 S_MISC = 0x00000100,
979 S_LICENSE = 0x00000200,
980 S_PNP = 0x00001000,
981 S_CARD_REG = 0x00002000,
982 S_KER_DRV = 0x00004000,
983 S_USB = 0x00008000,
984 S_KER_PLUG = 0x00010000,
985 S_EVENT = 0x00020000,
986 S_IPC = 0x00040000,
987 S_KER_BUF = 0x00080000,
990typedef enum
1005typedef struct
1006{
1007 DWORD dwCmd;
1009 /* used for DEBUG_SET_FILTER */
1010 DWORD dwLevel;
1012 DWORD dwSection;
1014 DWORD dwLevelMessageBox;
1015 /* used for DEBUG_SET_BUFFER */
1016 DWORD dwBufferSize;
1018
1019#define DEBUG_USER_BUF_LEN 2048
1020typedef struct
1021{
1022 CHAR cBuffer[DEBUG_USER_BUF_LEN];
1025typedef struct
1027 CHAR pcBuffer[256];
1028 DWORD dwLevel;
1029 DWORD dwSection;
1032typedef struct
1034 DWORD hKernelPlugIn;
1035 CHAR cDriverName[WD_MAX_KP_NAME_LENGTH];
1036 CHAR cDriverPath[WD_MAX_KP_NAME_LENGTH];
1040 PAD_TO_64(hKernelPlugIn) /* 64 bit app has a 4 byte hole here */
1041 PVOID pOpenData;
1042 PAD_TO_64(pOpenData)
1044
1046typedef enum
1048 WD_DEVICE_PCI = 0x1,
1051
1052typedef struct
1054 union
1056 HANDLE hDevice;
1057 DWORD dwUniqueID;
1058 } h;
1059 PAD_TO_64(hDevice)
1060 PVOID pBuf;
1062 DWORD dwBytes;
1063 DWORD dwProperty;
1064 DWORD dwOptions;
1065 PAD_TO_64(dwOptions)
1068typedef enum {
1070 WD_STATUS_INVALID_WD_HANDLE = (int)0xffffffff,
1072 WD_WINDRIVER_STATUS_ERROR = 0x20000000L,
1074 WD_INVALID_HANDLE = 0x20000001L,
1087 WD_READ_WRITE_CONFLICT = 0x20000003L,
1090 WD_ZERO_PACKET_SIZE = 0x20000004L,
1092 WD_INSUFFICIENT_RESOURCES = 0x20000005L,
1097 WD_UNKNOWN_PIPE_TYPE = 0x20000006L,
1098 WD_SYSTEM_INTERNAL_ERROR = 0x20000007L,
1100 WD_DATA_MISMATCH = 0x20000008L,
1104 WD_NO_LICENSE = 0x20000009L,
1110 WD_NOT_IMPLEMENTED = 0x2000000aL,
1115 WD_KERPLUG_FAILURE = 0x2000000bL,
1119 WD_FAILED_ENABLING_INTERRUPT = 0x2000000cL,
1130 WD_INTERRUPT_NOT_ENABLED = 0x2000000dL,
1137 WD_RESOURCE_OVERLAP = 0x2000000eL,
1143 WD_DEVICE_NOT_FOUND = 0x2000000fL,
1146 WD_WRONG_UNIQUE_ID = 0x20000010L,
1149 WD_OPERATION_ALREADY_DONE = 0x20000011L,
1155 WD_USB_DESCRIPTOR_ERROR = 0x20000012L,
1163 WD_SET_CONFIGURATION_FAILED = 0x20000013L,
1168 WD_CANT_OBTAIN_PDO = 0x20000014L,
1169 WD_TIME_OUT_EXPIRED = 0x20000015L,
1173 WD_IRP_CANCELED = 0x20000016L,
1176 WD_FAILED_USER_MAPPING = 0x20000017L,
1185 WD_FAILED_KERNEL_MAPPING = 0x20000018L,
1195 WD_NO_RESOURCES_ON_DEVICE = 0x20000019L,
1205 WD_NO_EVENTS = 0x2000001aL,
1209 WD_INVALID_PARAMETER = 0x2000001bL,
1213 WD_INCORRECT_VERSION = 0x2000001cL,
1219 WD_TRY_AGAIN = 0x2000001dL,
1223 WD_WINDRIVER_NOT_FOUND = 0x2000001eL,
1224 WD_INVALID_IOCTL = 0x2000001fL,
1229 WD_OPERATION_FAILED = 0x20000020L,
1233 WD_INVALID_32BIT_APP = 0x20000021L,
1239 WD_TOO_MANY_HANDLES = 0x20000022L,
1245 WD_NO_DEVICE_OBJECT = 0x20000023L,
1258 WD_MORE_PROCESSING_REQUIRED = (int)0xC0000016L,
1266 /* The following status codes are returned by USBD:
1267 USBD status types: */
1271 WD_USBD_STATUS_ERROR = (int)0x80000000L,
1272 WD_USBD_STATUS_HALTED = (int)0xC0000000L,
1274 /* USBD status codes: */
1275 /* @note The following status codes are comprised of one of the status
1276 * types above and an error code [i.e. 0xXYYYYYYYL - where: X = status type;
1277 * YYYYYYY = error code].
1278 * The same error codes may also appear with one of the other status types
1279 * as well. */
1280
1281 /* HC (Host Controller) status codes.
1282 @note These status codes use the WD_USBD_STATUS_HALTED status type]: */
1283 WD_USBD_STATUS_CRC = (int)0xC0000001L,
1285 WD_USBD_STATUS_BTSTUFF = (int)0xC0000002L,
1291 WD_USBD_STATUS_STALL_PID = (int)0xC0000004L,
1293 WD_USBD_STATUS_DEV_NOT_RESPONDING = (int)0xC0000005L,
1296 WD_USBD_STATUS_PID_CHECK_FAILURE = (int)0xC0000006L,
1299 WD_USBD_STATUS_UNEXPECTED_PID = (int)0xC0000007L,
1302 WD_USBD_STATUS_DATA_OVERRUN = (int)0xC0000008L,
1305 WD_USBD_STATUS_DATA_UNDERRUN = (int)0xC0000009L,
1308 WD_USBD_STATUS_RESERVED1 = (int)0xC000000AL,
1310 WD_USBD_STATUS_RESERVED2 = (int)0xC000000BL,
1312 WD_USBD_STATUS_BUFFER_OVERRUN = (int)0xC000000CL,
1315 WD_USBD_STATUS_BUFFER_UNDERRUN = (int)0xC000000DL,
1318 WD_USBD_STATUS_NOT_ACCESSED = (int)0xC000000FL,
1320 WD_USBD_STATUS_FIFO = (int)0xC0000010L,
1323#if defined(WIN32)
1324 WD_USBD_STATUS_XACT_ERROR = (int)0xC0000011L,
1330 WD_USBD_STATUS_BABBLE_DETECTED = (int)0xC0000012L,
1333 WD_USBD_STATUS_DATA_BUFFER_ERROR = (int)0xC0000013L,
1336#endif
1338 WD_USBD_STATUS_CANCELED = (int)0xC0010000L,
1344 WD_USBD_STATUS_ENDPOINT_HALTED = (int)0xC0000030L,
1345
1346 /* Software status codes
1347 @note The following status codes have only the error bit set: */
1348 WD_USBD_STATUS_NO_MEMORY = (int)0x80000100L,
1351 WD_USBD_STATUS_INVALID_URB_FUNCTION = (int)0x80000200L,
1354 WD_USBD_STATUS_INVALID_PARAMETER = (int)0x80000300L,
1360 WD_USBD_STATUS_ERROR_BUSY = (int)0x80000400L,
1361
1366 WD_USBD_STATUS_REQUEST_FAILED = (int)0x80000500L,
1368 WD_USBD_STATUS_INVALID_PIPE_HANDLE = (int)0x80000600L,
1373
1375 WD_USBD_STATUS_INTERNAL_HC_ERROR = (int)0x80000800L,
1379 WD_USBD_STATUS_ERROR_SHORT_TRANSFER = (int)0x80000900L,
1380
1384 WD_USBD_STATUS_BAD_START_FRAME = (int)0xC0000A00L,
1388 WD_USBD_STATUS_ISOCH_REQUEST_FAILED = (int)0xC0000B00L,
1392 WD_USBD_STATUS_FRAME_CONTROL_OWNED = (int)0xC0000C00L,
1393
1397
1398#if defined(WIN32)
1399 ,
1400 /* Additional USB 2.0 software error codes added for USB 2.0: */
1401 WD_USBD_STATUS_NOT_SUPPORTED = (int)0xC0000E00L,
1414 WD_USBD_STATUS_SET_CONFIG_FAILED = (int)0xC0002000L,
1431 WD_USBD_STATUS_TIMEOUT = (int)0xC0006000L,
1434 WD_USBD_STATUS_DEVICE_GONE = (int)0xC0007000L,
1448 WD_USBD_STATUS_ISO_NOT_ACCESSED_BY_HW = (int)0xC0020000L,
1455 WD_USBD_STATUS_ISO_NA_LATE_USBPORT = (int)0xC0040000L,
1458 WD_USBD_STATUS_ISO_NOT_ACCESSED_LATE = (int)0xC0050000L
1459#endif
1462typedef enum
1464 WD_INSERT = 0x1,
1477 WD_POWER_SYSTEM_SHUTDOWN = 0x2000,
1478 WD_IPC_UNICAST_MSG = 0x4000,
1482#define WD_IPC_ALL_MSG (WD_IPC_UNICAST_MSG | WD_IPC_MULTICAST_MSG)
1484typedef enum
1486 WD_ACKNOWLEDGE = 0x1,
1489
1490#define WD_ACTIONS_POWER (WD_POWER_CHANGED_D0 | WD_POWER_CHANGED_D1 | \
1491 WD_POWER_CHANGED_D2 | WD_POWER_CHANGED_D3 | WD_POWER_SYSTEM_WORKING | \
1492 WD_POWER_SYSTEM_SLEEPING1 | WD_POWER_SYSTEM_SLEEPING3 | \
1493 WD_POWER_SYSTEM_HIBERNATE | WD_POWER_SYSTEM_SHUTDOWN)
1494#define WD_ACTIONS_ALL (WD_ACTIONS_POWER | WD_INSERT | WD_REMOVE)
1496enum
1503typedef DWORD WD_EVENT_TYPE;
1505typedef struct
1506{
1507 DWORD hEvent;
1508 DWORD dwEventType;
1510 DWORD dwAction;
1511 DWORD dwEventId;
1512 DWORD hKernelPlugIn;
1513 DWORD dwOptions;
1514 union u
1516 struct Pci
1519 WD_PCI_SLOT pciSlot;
1521 struct Usb
1523 DWORD dwUniqueID;
1525 struct Ipc
1526 {
1527 DWORD hIpc;
1528 DWORD dwSubGroupID;
1530 DWORD dwGroupID;
1531
1532 DWORD dwSenderUID;
1533 DWORD dwMsgID;
1534 PAD_TO_64(dwMsgID)
1535 UINT64 qwMsgData;
1536 } Ipc;
1537 } u;
1539 DWORD dwNumMatchTables;
1540 WDU_MATCH_TABLE matchTables[1];
1543typedef struct
1544{
1545 DWORD applications_num;
1546 DWORD devices_num;
1547} WD_USAGE;
1549enum
1554
1555#ifndef BZERO
1556 #define BZERO(buf) memset(&(buf), 0, sizeof(buf))
1557#endif
1558
1559#ifndef INVALID_HANDLE_VALUE
1560 #define INVALID_HANDLE_VALUE ((HANDLE)(-1))
1561#endif
1562
1563#ifndef CTL_CODE
1564 #define CTL_CODE(DeviceType, Function, Method, Access) ( \
1565 ((DeviceType)<<16) | ((Access)<<14) | ((Function)<<2) | (Method) \
1568 #define METHOD_BUFFERED 0
1569 #define METHOD_IN_DIRECT 1
1570 #define METHOD_OUT_DIRECT 2
1571 #define METHOD_NEITHER 3
1572 #define FILE_ANY_ACCESS 0
1573 #define FILE_READ_ACCESS 1
1574 #define FILE_WRITE_ACCESS 2
1575#endif
1576
1577#if defined(LINUX) && defined(KERNEL_64BIT)
1578 #define WD_TYPE 0
1579 #define WD_CTL_CODE(wFuncNum) \
1580 _IOC(_IOC_READ|_IOC_WRITE, WD_TYPE, wFuncNum, 0)
1581 #define WD_CTL_DECODE_FUNC(IoControlCode) _IOC_NR(IoControlCode)
1582 #define WD_CTL_DECODE_TYPE(IoControlCode) _IOC_TYPE(IoControlCode)
1583#elif defined(UNIX)
1584 #define WD_TYPE 0
1585 #define WD_CTL_CODE(wFuncNum) (wFuncNum)
1586 #define WD_CTL_DECODE_FUNC(IoControlCode) (IoControlCode)
1587 #define WD_CTL_DECODE_TYPE(IoControlCode) (WD_TYPE)
1588#else
1590 #define WD_TYPE 38200
1591 #if defined(KERNEL_64BIT)
1592 #define FUNC_MASK 0x400
1593 #else
1594 #define FUNC_MASK 0x0
1595 #endif
1596 #define WD_CTL_CODE(wFuncNum) CTL_CODE(WD_TYPE, (wFuncNum | FUNC_MASK), \
1597 METHOD_NEITHER, FILE_ANY_ACCESS)
1598 #define WD_CTL_DECODE_FUNC(IoControlCode) ((IoControlCode >> 2) & 0xfff)
1599 #define WD_CTL_DECODE_TYPE(IoControlCode) \
1600 DEVICE_TYPE_FROM_CTL_CODE(IoControlCode)
1601#endif
1602
1603#if defined(LINUX)
1604 #define WD_CTL_IS_64BIT_AWARE(IoControlCode) \
1605 (_IOC_DIR(IoControlCode) & (_IOC_READ|_IOC_WRITE))
1606#elif defined(UNIX)
1607 #define WD_CTL_IS_64BIT_AWARE(IoControlCode) TRUE
1608#else
1609 #define WD_CTL_IS_64BIT_AWARE(IoControlCode) \
1610 (WD_CTL_DECODE_FUNC(IoControlCode) & FUNC_MASK)
1611#endif
1612
1613/* WinDriver function IOCTL calls. For details on the WinDriver functions, */
1614/* see the WinDriver manual or included help files. */
1616#define IOCTL_WD_KERNEL_BUF_LOCK WD_CTL_CODE(0x9f3)
1617#define IOCTL_WD_KERNEL_BUF_UNLOCK WD_CTL_CODE(0x9f4)
1618#define IOCTL_WD_DMA_LOCK WD_CTL_CODE(0x9be)
1619#define IOCTL_WD_DMA_UNLOCK WD_CTL_CODE(0x902)
1620#define IOCTL_WD_TRANSFER WD_CTL_CODE(0x98c)
1621#define IOCTL_WD_MULTI_TRANSFER WD_CTL_CODE(0x98d)
1622#define IOCTL_WD_PCI_SCAN_CARDS WD_CTL_CODE(0x9fa)
1623#define IOCTL_WD_PCI_GET_CARD_INFO WD_CTL_CODE(0x9e8)
1624#define IOCTL_WD_VERSION WD_CTL_CODE(0x910)
1625#define IOCTL_WD_PCI_CONFIG_DUMP WD_CTL_CODE(0x91a)
1626#define IOCTL_WD_KERNEL_PLUGIN_OPEN WD_CTL_CODE(0x91b)
1627#define IOCTL_WD_KERNEL_PLUGIN_CLOSE WD_CTL_CODE(0x91c)
1628#define IOCTL_WD_KERNEL_PLUGIN_CALL WD_CTL_CODE(0x91d)
1629#define IOCTL_WD_INT_ENABLE WD_CTL_CODE(0x9b6)
1630#define IOCTL_WD_INT_DISABLE WD_CTL_CODE(0x9bb)
1631#define IOCTL_WD_INT_COUNT WD_CTL_CODE(0x9ba)
1632#define IOCTL_WD_SLEEP WD_CTL_CODE(0x927)
1633#define IOCTL_WD_DEBUG WD_CTL_CODE(0x928)
1634#define IOCTL_WD_DEBUG_DUMP WD_CTL_CODE(0x929)
1635#define IOCTL_WD_CARD_UNREGISTER WD_CTL_CODE(0x9e7)
1636#define IOCTL_WD_CARD_REGISTER WD_CTL_CODE(0x9e6)
1637#define IOCTL_WD_INT_WAIT WD_CTL_CODE(0x9b9)
1638#define IOCTL_WD_LICENSE WD_CTL_CODE(0x9f9)
1639#define IOCTL_WD_EVENT_REGISTER WD_CTL_CODE(0x9ef)
1640#define IOCTL_WD_EVENT_UNREGISTER WD_CTL_CODE(0x9f0)
1641#define IOCTL_WD_EVENT_PULL WD_CTL_CODE(0x9f1)
1642#define IOCTL_WD_EVENT_SEND WD_CTL_CODE(0x9f2)
1643#define IOCTL_WD_DEBUG_ADD WD_CTL_CODE(0x964)
1644#define IOCTL_WD_USAGE WD_CTL_CODE(0x976)
1645#define IOCTL_WDU_GET_DEVICE_DATA WD_CTL_CODE(0x9a7)
1646#define IOCTL_WDU_SET_INTERFACE WD_CTL_CODE(0x981)
1647#define IOCTL_WDU_RESET_PIPE WD_CTL_CODE(0x982)
1648#define IOCTL_WDU_TRANSFER WD_CTL_CODE(0x983)
1649#define IOCTL_WDU_HALT_TRANSFER WD_CTL_CODE(0x985)
1650#define IOCTL_WDU_WAKEUP WD_CTL_CODE(0x98a)
1651#define IOCTL_WDU_RESET_DEVICE WD_CTL_CODE(0x98b)
1652#define IOCTL_WD_GET_DEVICE_PROPERTY WD_CTL_CODE(0x990)
1653#define IOCTL_WD_CARD_CLEANUP_SETUP WD_CTL_CODE(0x995)
1654#define IOCTL_WD_DMA_SYNC_CPU WD_CTL_CODE(0x99f)
1655#define IOCTL_WD_DMA_SYNC_IO WD_CTL_CODE(0x9a0)
1656#define IOCTL_WDU_STREAM_OPEN WD_CTL_CODE(0x9a8)
1657#define IOCTL_WDU_STREAM_CLOSE WD_CTL_CODE(0x9a9)
1658#define IOCTL_WDU_STREAM_START WD_CTL_CODE(0x9af)
1659#define IOCTL_WDU_STREAM_STOP WD_CTL_CODE(0x9b0)
1660#define IOCTL_WDU_STREAM_FLUSH WD_CTL_CODE(0x9aa)
1661#define IOCTL_WDU_STREAM_GET_STATUS WD_CTL_CODE(0x9b5)
1662#define IOCTL_WDU_SELECTIVE_SUSPEND WD_CTL_CODE(0x9ae)
1663#define IOCTL_WD_PCI_SCAN_CAPS WD_CTL_CODE(0x9e5)
1664#define IOCTL_WD_IPC_REGISTER WD_CTL_CODE(0x9eb)
1665#define IOCTL_WD_IPC_UNREGISTER WD_CTL_CODE(0x9ec)
1666#define IOCTL_WD_IPC_SCAN_PROCS WD_CTL_CODE(0x9ed)
1667#define IOCTL_WD_IPC_SEND WD_CTL_CODE(0x9ee)
1668#define IOCTL_WD_PCI_SRIOV_ENABLE WD_CTL_CODE(0x9f5)
1669#define IOCTL_WD_PCI_SRIOV_DISABLE WD_CTL_CODE(0x9f6)
1670#define IOCTL_WD_PCI_SRIOV_GET_NUMVFS WD_CTL_CODE(0x9f7)
1671#define IOCTL_WD_IPC_SHARED_INT_ENABLE WD_CTL_CODE(0x9fc)
1672#define IOCTL_WD_IPC_SHARED_INT_DISABLE WD_CTL_CODE(0x9fd)
1673#define IOCTL_WD_DMA_TRANSACTION_INIT WD_CTL_CODE(0x9fe)
1674#define IOCTL_WD_DMA_TRANSACTION_EXECUTE WD_CTL_CODE(0x9ff)
1675#define IOCTL_WD_DMA_TRANSFER_COMPLETED_AND_CHECK WD_CTL_CODE(0xa00)
1676#define IOCTL_WD_DMA_TRANSACTION_RELEASE WD_CTL_CODE(0xa01)
1677
1678#if defined(UNIX)
1679 typedef struct
1680 {
1681 DWORD dwHeader;
1682 DWORD dwSize;
1683 PVOID pData;
1684 PAD_TO_64(pData)
1685 } WD_IOCTL_HEADER;
1686
1687 #define WD_IOCTL_HEADER_CODE 0xa410b413UL
1688#endif
1689
1690#if defined(__KERNEL__)
1691 HANDLE __cdecl WD_Open(void);
1692 void __cdecl WD_Close(HANDLE hWD);
1693 DWORD __cdecl KP_DeviceIoControl(DWORD dwFuncNum, HANDLE h, PVOID pParam,
1694 DWORD dwSize);
1695 #define WD_FUNCTION(wFuncNum, h, pParam, dwSize, fWait) \
1696 KP_DeviceIoControl((DWORD)wFuncNum, h, (PVOID)pParam, (DWORD)dwSize)
1697#else
1698 #define REGKEY_BUFSIZE 256
1699 #define OS_CAN_NOT_DETECT_TEXT "OS CAN NOT DETECT"
1700 #define INSTALLATION_TYPE_NOT_DETECT_TEXT "unknown"
1701 typedef struct
1702 {
1703 CHAR cProdName[REGKEY_BUFSIZE];
1704 CHAR cInstallationType[REGKEY_BUFSIZE];
1705 #ifdef WIN32
1706 CHAR cCurrentVersion[REGKEY_BUFSIZE];
1707 CHAR cBuild[REGKEY_BUFSIZE];
1708 CHAR cCsdVersion[REGKEY_BUFSIZE];
1709 DWORD dwMajorVersion;
1710 DWORD dwMinorVersion;
1711 #else
1712 CHAR cRelease[REGKEY_BUFSIZE];
1713 CHAR cReleaseVersion[REGKEY_BUFSIZE];
1714 #endif
1715 } WD_OS_INFO;
1716
1726
1738 #if defined(APPLE)
1739 DWORD WD_FUNCTION_LOCAL(int wFuncNum, HANDLE h,
1740 PVOID pParam, DWORD dwSize, BOOL fWait);
1741
1742 HANDLE WD_OpenLocal(void);
1743
1744 void WD_CloseLocal(HANDLE h);
1745
1746 #define WD_OpenStreamLocal(read,sync) INVALID_HANDLE_VALUE
1747
1748 #define WD_UStreamRead(hFile, pBuffer, dwNumberOfBytesToRead, \
1749 dwNumberOfBytesRead)\
1750 WD_NOT_IMPLEMENTED
1751
1752 #define WD_UStreamWrite(hFile, pBuffer, dwNumberOfBytesToWrite, \
1753 dwNumberOfBytesWritten)\
1754 WD_NOT_IMPLEMENTED
1755
1756 #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 120000
1757 #define IO_MASTER_PORT IOMainPort
1758 #else
1759 #define IO_MASTER_PORT IOMasterPort
1760 #endif
1761
1762 #elif defined(UNIX)
1763 static inline ULONG WD_FUNCTION_LOCAL(int wFuncNum, HANDLE h,
1764 PVOID pParam, DWORD dwSize, BOOL fWait)
1765 {
1766 WD_IOCTL_HEADER ioctl_hdr;
1767
1768 BZERO(ioctl_hdr);
1769 ioctl_hdr.dwHeader = WD_IOCTL_HEADER_CODE;
1770 ioctl_hdr.dwSize = dwSize;
1771 ioctl_hdr.pData = pParam;
1772 (void)fWait;
1773 #if defined(LINUX)
1774 return (ULONG)ioctl((int)(long)h, wFuncNum, &ioctl_hdr);
1775 #endif
1776 }
1777
1778 #define WD_OpenLocal()\
1779 ((HANDLE)(long)open(WD_DRIVER_NAME, O_RDWR | O_SYNC))
1780 #define WD_OpenStreamLocal(read,sync) \
1781 ((HANDLE)(long)open(WD_DRIVER_NAME, \
1782 ((read) ? O_RDONLY : O_WRONLY) | \
1783 ((sync) ? O_SYNC : O_NONBLOCK)))
1784
1785 #define WD_CloseLocal(h) close((int)(long)(h))
1786
1787 #define WD_UStreamRead(hFile, pBuffer, dwNumberOfBytesToRead, \
1788 dwNumberOfBytesRead)\
1789 WD_NOT_IMPLEMENTED
1790
1791 #define WD_UStreamWrite(hFile, pBuffer, dwNumberOfBytesToWrite, \
1792 dwNumberOfBytesWritten)\
1793 WD_NOT_IMPLEMENTED
1794
1795 #elif defined(WIN32)
1796 #define WD_CloseLocal(h) CloseHandle(h)
1797
1798 #define WD_UStreamRead(hFile, pBuffer, dwNumberOfBytesToRead, \
1799 dwNumberOfBytesRead)\
1800 ReadFile(hFile, pBuffer, dwNumberOfBytesToRead, \
1801 dwNumberOfBytesRead, NULL) ? WD_STATUS_SUCCESS : \
1802 WD_OPERATION_FAILED
1803
1804 #define WD_UStreamWrite(hFile, pBuffer, dwNumberOfBytesToWrite, \
1805 dwNumberOfBytesWritten)\
1806 WriteFile(hFile, pBuffer, dwNumberOfBytesToWrite, \
1807 dwNumberOfBytesWritten, NULL) ? WD_STATUS_SUCCESS : \
1808 WD_OPERATION_FAILED
1809
1810 #if defined(WIN32)
1811 #define WD_OpenLocal()\
1812 CreateFileA(\
1813 WD_DRIVER_NAME,\
1814 GENERIC_READ,\
1815 FILE_SHARE_READ | FILE_SHARE_WRITE,\
1816 NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL)
1817
1818 #define WD_OpenStreamLocal(read,sync) \
1819 CreateFileA(\
1820 WD_DRIVER_NAME,\
1821 (read) ? GENERIC_READ : GENERIC_WRITE,\
1822 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, \
1823 (sync) ? 0 : FILE_FLAG_OVERLAPPED, NULL)
1824
1825 static DWORD WD_FUNCTION_LOCAL(int wFuncNum, HANDLE h, PVOID pParam,
1826 DWORD dwSize, BOOL fWait)
1827 {
1828 DWORD dwTmp;
1829 HANDLE hWD = fWait ? WD_OpenLocal() : h;
1830 DWORD rc = WD_WINDRIVER_STATUS_ERROR;
1831
1832 if (hWD == INVALID_HANDLE_VALUE)
1833 return (DWORD)WD_STATUS_INVALID_WD_HANDLE;
1834
1835 DeviceIoControl(hWD, (DWORD)wFuncNum, pParam, dwSize, &rc,
1836 sizeof(DWORD), &dwTmp, NULL);
1837
1838 if (fWait)
1839 WD_CloseLocal(hWD);
1840
1841 return rc;
1842 }
1843 #endif
1844 #endif
1846 #define WD_FUNCTION WD_FUNCTION_LOCAL
1847 #define WD_Close WD_CloseLocal
1848 #define WD_Open WD_OpenLocal
1849 #define WD_StreamOpen WD_OpenStreamLocal
1850 #define WD_StreamClose WD_CloseLocal
1851#endif
1852
1853#define SIZE_OF_WD_DMA(pDma) \
1854 ((DWORD)(sizeof(WD_DMA) + ((pDma)->dwPages <= WD_DMA_PAGES ? \
1855 0 : ((pDma)->dwPages - WD_DMA_PAGES) * sizeof(WD_DMA_PAGE))))
1856#define SIZE_OF_WD_EVENT(pEvent) \
1857 ((DWORD)(sizeof(WD_EVENT) + ((pEvent)->dwNumMatchTables > 0 ? \
1858 sizeof(WDU_MATCH_TABLE) * ((pEvent)->dwNumMatchTables - 1) : 0)))
1859
1871#define WD_Debug(h,pDebug)\
1872 WD_FUNCTION(IOCTL_WD_DEBUG, h, pDebug, sizeof(WD_DEBUG), FALSE)
1873
1885#define WD_DebugDump(h,pDebugDump)\
1886 WD_FUNCTION(IOCTL_WD_DEBUG_DUMP, h, pDebugDump, sizeof(WD_DEBUG_DUMP), \
1887 FALSE)
1888
1900#define WD_DebugAdd(h, pDebugAdd)\
1901 WD_FUNCTION(IOCTL_WD_DEBUG_ADD, h, pDebugAdd, sizeof(WD_DEBUG_ADD), FALSE)
1902
1915#define WD_Transfer(h,pTransfer)\
1916 WD_FUNCTION(IOCTL_WD_TRANSFER, h, pTransfer, sizeof(WD_TRANSFER), FALSE)
1917
1934#define WD_MultiTransfer(h, pTransferArray, dwNumTransfers) \
1935 WD_FUNCTION(IOCTL_WD_MULTI_TRANSFER, h, pTransferArray, \
1936 sizeof(WD_TRANSFER) * (dwNumTransfers), FALSE)
1937
1951#define WD_KernelBufLock(h, pKerBuf)\
1952 WD_FUNCTION(IOCTL_WD_KERNEL_BUF_LOCK, h, pKerBuf, \
1953 sizeof(WD_KERNEL_BUFFER), FALSE)
1954
1966#define WD_KernelBufUnlock(h, pKerBuf)\
1967 WD_FUNCTION(IOCTL_WD_KERNEL_BUF_UNLOCK, h, pKerBuf, \
1968 sizeof(WD_KERNEL_BUFFER), FALSE)
1969
2032#define WD_DMALock(h,pDma)\
2033 WD_FUNCTION(IOCTL_WD_DMA_LOCK, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE)
2034
2047#define WD_DMAUnlock(h,pDma)\
2048 WD_FUNCTION(IOCTL_WD_DMA_UNLOCK, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE)
2049
2063#define WD_DMATransactionInit(h,pDma)\
2064 WD_FUNCTION(IOCTL_WD_DMA_TRANSACTION_INIT, h, pDma, SIZE_OF_WD_DMA(pDma), \
2065 FALSE)
2066
2077#define WD_DMATransactionExecute(h,pDma)\
2078 WD_FUNCTION(IOCTL_WD_DMA_TRANSACTION_EXECUTE, h, pDma, \
2079 SIZE_OF_WD_DMA(pDma), FALSE)
2080
2091#define WD_DMATransferCompletedAndCheck(h,pDma)\
2092 WD_FUNCTION(IOCTL_WD_DMA_TRANSFER_COMPLETED_AND_CHECK, h, pDma, \
2093 SIZE_OF_WD_DMA(pDma), FALSE)
2094
2106#define WD_DMATransactionRelease(h,pDma)\
2107 WD_FUNCTION(IOCTL_WD_DMA_TRANSACTION_RELEASE, h, pDma, \
2108 SIZE_OF_WD_DMA(pDma), FALSE)
2109
2121#define WD_DMATransactionUninit(h,pDma)\
2122 WD_FUNCTION(IOCTL_WD_DMA_UNLOCK, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE)
2123
2147#define WD_DMASyncCpu(h,pDma)\
2148 WD_FUNCTION(IOCTL_WD_DMA_SYNC_CPU, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE)
2149
2174#define WD_DMASyncIo(h,pDma)\
2175 WD_FUNCTION(IOCTL_WD_DMA_SYNC_IO, h, pDma, SIZE_OF_WD_DMA(pDma), FALSE)
2176
2228#define WD_CardRegister(h,pCard)\
2229 WD_FUNCTION(IOCTL_WD_CARD_REGISTER, h, pCard, sizeof(WD_CARD_REGISTER),\
2230 FALSE)
2231
2244#define WD_CardUnregister(h,pCard)\
2245 WD_FUNCTION(IOCTL_WD_CARD_UNREGISTER, h, pCard, sizeof(WD_CARD_REGISTER),\
2246 FALSE)
2247
2269#define WD_IpcRegister(h, pIpcRegister) \
2270 WD_FUNCTION(IOCTL_WD_IPC_REGISTER, h, pIpcRegister, \
2271 sizeof(WD_IPC_REGISTER), FALSE)
2272
2285#define WD_IpcUnRegister(h, pProcInfo) \
2286 WD_FUNCTION(IOCTL_WD_IPC_UNREGISTER, h, pProcInfo, sizeof(WD_IPC_PROCESS), \
2287 FALSE)
2288
2302#define WD_IpcScanProcs(h, pIpcScanProcs) \
2303 WD_FUNCTION(IOCTL_WD_IPC_SCAN_PROCS, h, pIpcScanProcs, \
2304 sizeof(WD_IPC_SCAN_PROCS), FALSE)
2305
2319#define WD_IpcSend(h, pIpcSend) \
2320 WD_FUNCTION(IOCTL_WD_IPC_SEND, h, pIpcSend, sizeof(WD_IPC_SEND), FALSE)
2321
2339#define WD_SharedIntEnable(h, pIpcRegister) \
2340 WD_FUNCTION(IOCTL_WD_IPC_SHARED_INT_ENABLE, h, pIpcRegister, \
2341 sizeof(WD_IPC_REGISTER), FALSE)
2342
2354#define WD_SharedIntDisable(h) \
2355 WD_FUNCTION(IOCTL_WD_IPC_SHARED_INT_DISABLE, h, 0, 0, FALSE)
2356
2370#define WD_PciSriovEnable(h,pPciSRIOV) \
2371 WD_FUNCTION(IOCTL_WD_PCI_SRIOV_ENABLE, h, pPciSRIOV, \
2372 sizeof(WD_PCI_SRIOV), FALSE)
2373
2387#define WD_PciSriovDisable(h,pPciSRIOV) \
2388 WD_FUNCTION(IOCTL_WD_PCI_SRIOV_DISABLE, h, pPciSRIOV, \
2389 sizeof(WD_PCI_SRIOV), FALSE)
2390
2406#define WD_PciSriovGetNumVFs(h,pPciSRIOV) \
2407 WD_FUNCTION(IOCTL_WD_PCI_SRIOV_GET_NUMVFS, h, pPciSRIOV, \
2408 sizeof(WD_PCI_SRIOV), FALSE)
2409
2432#define WD_CardCleanupSetup(h,pCardCleanup)\
2433 WD_FUNCTION(IOCTL_WD_CARD_CLEANUP_SETUP, h, pCardCleanup, \
2434 sizeof(WD_CARD_CLEANUP), FALSE)
2435
2450#define WD_PciScanCards(h,pPciScan)\
2451 WD_FUNCTION(IOCTL_WD_PCI_SCAN_CARDS, h, pPciScan,\
2452 sizeof(WD_PCI_SCAN_CARDS), FALSE)
2453
2467#define WD_PciScanCaps(h,pPciScanCaps) \
2468 WD_FUNCTION(IOCTL_WD_PCI_SCAN_CAPS, h, pPciScanCaps, \
2469 sizeof(WD_PCI_SCAN_CAPS), FALSE)
2470
2484#define WD_PciGetCardInfo(h,pPciCard)\
2485 WD_FUNCTION(IOCTL_WD_PCI_GET_CARD_INFO, h, pPciCard, \
2486 sizeof(WD_PCI_CARD_INFO), FALSE)
2487
2502#define WD_PciConfigDump(h,pPciConfigDump)\
2503 WD_FUNCTION(IOCTL_WD_PCI_CONFIG_DUMP, h, pPciConfigDump, \
2504 sizeof(WD_PCI_CONFIG_DUMP), FALSE)
2505
2518#define WD_Version(h,pVerInfo)\
2519 WD_FUNCTION(IOCTL_WD_VERSION, h, pVerInfo, sizeof(WD_VERSION), FALSE)
2520
2541#define WD_License(h,pLicense)\
2542 WD_FUNCTION(IOCTL_WD_LICENSE, h, pLicense, sizeof(WD_LICENSE), FALSE)
2543
2557#define WD_KernelPlugInOpen(h,pKernelPlugIn)\
2558 WD_FUNCTION(IOCTL_WD_KERNEL_PLUGIN_OPEN, h, pKernelPlugIn, \
2559 sizeof(WD_KERNEL_PLUGIN), FALSE)
2560
2573#define WD_KernelPlugInClose(h,pKernelPlugIn)\
2574 WD_FUNCTION(IOCTL_WD_KERNEL_PLUGIN_CLOSE, h, pKernelPlugIn, \
2575 sizeof(WD_KERNEL_PLUGIN), FALSE)
2576
2596#define WD_KernelPlugInCall(h,pKernelPlugInCall)\
2597 WD_FUNCTION(IOCTL_WD_KERNEL_PLUGIN_CALL, h, pKernelPlugInCall, \
2598 sizeof(WD_KERNEL_PLUGIN_CALL), FALSE)
2599
2623#define WD_IntEnable(h,pInterrupt)\
2624 WD_FUNCTION(IOCTL_WD_INT_ENABLE, h, pInterrupt, sizeof(WD_INTERRUPT), FALSE)
2625
2637#define WD_IntDisable(h,pInterrupt)\
2638 WD_FUNCTION(IOCTL_WD_INT_DISABLE, h, pInterrupt, sizeof(WD_INTERRUPT), \
2639 FALSE)
2640
2652#define WD_IntCount(h,pInterrupt)\
2653 WD_FUNCTION(IOCTL_WD_INT_COUNT, h, pInterrupt, sizeof(WD_INTERRUPT), FALSE)
2654
2671#define WD_IntWait(h,pInterrupt)\
2672 WD_FUNCTION(IOCTL_WD_INT_WAIT, h, pInterrupt, sizeof(WD_INTERRUPT), TRUE)
2673
2688#define WD_Sleep(h,pSleep)\
2689 WD_FUNCTION(IOCTL_WD_SLEEP, h, pSleep, sizeof(WD_SLEEP), FALSE)
2690
2691
2692#define WD_EventRegister(h, pEvent) \
2693 WD_FUNCTION(IOCTL_WD_EVENT_REGISTER, h, pEvent, SIZE_OF_WD_EVENT(pEvent), \
2694 FALSE)
2695#define WD_EventUnregister(h, pEvent) \
2696 WD_FUNCTION(IOCTL_WD_EVENT_UNREGISTER, h, pEvent, \
2697 SIZE_OF_WD_EVENT(pEvent), FALSE)
2698#define WD_EventPull(h,pEvent) \
2699 WD_FUNCTION(IOCTL_WD_EVENT_PULL, h, pEvent, SIZE_OF_WD_EVENT(pEvent), FALSE)
2700#define WD_EventSend(h,pEvent) \
2701 WD_FUNCTION(IOCTL_WD_EVENT_SEND, h, pEvent, SIZE_OF_WD_EVENT(pEvent), FALSE)
2702#define WD_Usage(h, pStop) \
2703 WD_FUNCTION(IOCTL_WD_USAGE, h, pStop, sizeof(WD_USAGE), FALSE)
2704
2705#define WD_UGetDeviceData(h, pGetDevData) \
2706 WD_FUNCTION(IOCTL_WDU_GET_DEVICE_DATA, h, pGetDevData, \
2707 sizeof(WDU_GET_DEVICE_DATA), FALSE);
2708#define WD_GetDeviceProperty(h, pGetDevProperty) \
2709 WD_FUNCTION(IOCTL_WD_GET_DEVICE_PROPERTY, h, pGetDevProperty, \
2710 sizeof(WD_GET_DEVICE_PROPERTY), FALSE);
2711#define WD_USetInterface(h, pSetIfc) \
2712 WD_FUNCTION(IOCTL_WDU_SET_INTERFACE, h, pSetIfc, \
2713 sizeof(WDU_SET_INTERFACE), FALSE);
2714#define WD_UResetPipe(h, pResetPipe) \
2715 WD_FUNCTION(IOCTL_WDU_RESET_PIPE, h, pResetPipe, sizeof(WDU_RESET_PIPE), \
2716 FALSE);
2717#define WD_UTransfer(h, pTrans) \
2718 WD_FUNCTION(IOCTL_WDU_TRANSFER, h, pTrans, sizeof(WDU_TRANSFER), TRUE);
2719#define WD_UHaltTransfer(h, pHaltTrans) \
2720 WD_FUNCTION(IOCTL_WDU_HALT_TRANSFER, h, pHaltTrans, \
2721 sizeof(WDU_HALT_TRANSFER), FALSE);
2722#define WD_UWakeup(h, pWakeup) \
2723 WD_FUNCTION(IOCTL_WDU_WAKEUP, h, pWakeup, sizeof(WDU_WAKEUP), FALSE);
2724#define WD_USelectiveSuspend(h, pSelectiveSuspend) \
2725 WD_FUNCTION(IOCTL_WDU_SELECTIVE_SUSPEND, h, pSelectiveSuspend, \
2726 sizeof(WDU_SELECTIVE_SUSPEND), FALSE);
2727#define WD_UResetDevice(h, pResetDevice) \
2728 WD_FUNCTION(IOCTL_WDU_RESET_DEVICE, h, pResetDevice, \
2729 sizeof(WDU_RESET_DEVICE), FALSE);
2730#define WD_UStreamOpen(h, pStream) \
2731 WD_FUNCTION(IOCTL_WDU_STREAM_OPEN, h, pStream, sizeof(WDU_STREAM), FALSE);
2732#define WD_UStreamClose(h, pStream) \
2733 WD_FUNCTION(IOCTL_WDU_STREAM_CLOSE, h, pStream, sizeof(WDU_STREAM), FALSE);
2734#define WD_UStreamStart(h, pStream) \
2735 WD_FUNCTION(IOCTL_WDU_STREAM_START, h, pStream, sizeof(WDU_STREAM), FALSE);
2736#define WD_UStreamStop(h, pStream) \
2737 WD_FUNCTION(IOCTL_WDU_STREAM_STOP, h, pStream, sizeof(WDU_STREAM), FALSE);
2738#define WD_UStreamFlush(h, pStream) \
2739 WD_FUNCTION(IOCTL_WDU_STREAM_FLUSH, h, pStream, sizeof(WDU_STREAM), FALSE);
2740#define WD_UStreamGetStatus(h, pStreamStatus) \
2741 WD_FUNCTION(IOCTL_WDU_STREAM_GET_STATUS, h, pStreamStatus, \
2742 sizeof(WDU_STREAM_STATUS), FALSE);
2743
2744#define __ALIGN_DOWN(val,alignment) ( (val) & ~((alignment) - 1) )
2745#define __ALIGN_UP(val,alignment) \
2746 ( ((val) + (alignment) - 1) & ~((alignment) - 1) )
2747
2748#ifdef WDLOG
2749 #include "wd_log.h"
2750#endif
2751
2752#ifndef MIN
2753 #define MIN(a,b) ((a) > (b) ? (b) : (a))
2754#endif
2755#ifndef MAX
2756 #define MAX(a,b) ((a) > (b) ? (a) : (b))
2757#endif
2758#define SAFE_STRING(s) ((s) ? (s) : "")
2759
2760#define UNUSED_VAR(x) (void)x
2761
2762#ifdef __cplusplus
2763}
2764#endif
2765
2766#endif /* _WINDRVR_H_ */
2767
#define NULL
Definition: kpstdlib.h:268
ITEM_IO.
Definition: windrvr.h:743
ITEM_INTERRUPT.
Definition: windrvr.h:751
ITEM_MEMORY.
Definition: windrvr.h:723
unsigned int u32
Definition: wd_types.h:10
unsigned short u16
Definition: wd_types.h:9
unsigned char u8
Definition: wd_types.h:8
struct WD_BUS WD_BUS_V30
ITEM_TYPE
Definition: windrvr.h:696
@ ITEM_INTERRUPT
Interrupt.
Definition: windrvr.h:698
@ ITEM_BUS
Bus.
Definition: windrvr.h:701
@ ITEM_NONE
Definition: windrvr.h:697
@ ITEM_IO
I/O.
Definition: windrvr.h:700
@ ITEM_MEMORY
Memory.
Definition: windrvr.h:699
@ WD_FORCE_CLEANUP
Definition: windrvr.h:844
@ WD_USB_HARD_RESET
Definition: windrvr.h:1548
@ WD_USB_CYCLE_PORT
Definition: windrvr.h:1549
struct WD_KERNEL_PLUGIN_CALL WD_KERNEL_PLUGIN_CALL_V40
@ WD_DMA_PAGES
Definition: windrvr.h:431
struct WD_PCI_CARD_INFO WD_PCI_CARD_INFO_V118
PCI_ACCESS_RESULT
Definition: windrvr.h:930
@ PCI_ACCESS_OK
Definition: windrvr.h:931
@ PCI_ACCESS_ERROR
Definition: windrvr.h:932
@ PCI_BAD_SLOT
Definition: windrvr.h:934
@ PCI_BAD_BUS
Definition: windrvr.h:933
WD_ITEM_MEM_OPTIONS
Definition: windrvr.h:705
@ WD_ITEM_MEM_DO_NOT_MAP_KERNEL
Skip the mapping of physical memory to the kernel address space.
Definition: windrvr.h:706
@ WD_ITEM_MEM_ALLOW_CACHE
Map physical memory as cached; applicable only to host RAM, not to local memory on the card.
Definition: windrvr.h:708
@ WD_ITEM_MEM_USER_MAP
Map physical memory from user mode, Linux only.
Definition: windrvr.h:711
WD_GET_DEVICE_PROPERTY_OPTION
IOCTL Structures.
Definition: windrvr.h:1044
@ WD_DEVICE_USB
Definition: windrvr.h:1046
@ WD_DEVICE_PCI
Definition: windrvr.h:1045
struct WD_ITEMS WD_ITEMS_V118
struct WD_DEBUG_ADD WD_DEBUG_ADD_V503
size_t UPTR
Definition: windrvr.h:378
#define WD_VERSION_STR_LENGTH
Definition: windrvr.h:61
struct WD_IPC_SCAN_PROCS WD_IPC_SCAN_PROCS_V121
DEBUG_LEVEL
Definition: windrvr.h:959
@ D_ERROR
Definition: windrvr.h:961
@ D_TRACE
Definition: windrvr.h:964
@ D_WARN
Definition: windrvr.h:962
@ D_INFO
Definition: windrvr.h:963
@ D_OFF
Definition: windrvr.h:960
struct WD_TRANSFER WD_TRANSFER_V61
unsigned short int WORD
Definition: windrvr.h:333
struct WD_KERNEL_BUFFER WD_KERNEL_BUFFER_V121
WD_KER_BUF_OPTION
Definition: windrvr.h:565
@ KER_BUF_ALLOC_NON_CONTIG
Definition: windrvr.h:571
@ KER_BUF_GET_EXISTING_BUF
Definition: windrvr.h:574
@ KER_BUF_ALLOC_CONTIG
Definition: windrvr.h:572
@ KER_BUF_ALLOC_CACHED
Definition: windrvr.h:573
@ WD_PCI_CAP_ID_ALL
Definition: windrvr.h:888
#define WD_OpenLocal()
Definition: windrvr.h:1808
DEBUG_COMMAND
Definition: windrvr.h:988
@ DEBUG_DUMP_SEC_ON
Definition: windrvr.h:993
@ KERNEL_DEBUGGER_OFF
Definition: windrvr.h:996
@ DEBUG_CLEAR_BUFFER
Definition: windrvr.h:992
@ DEBUG_DUMP_CLOCK_OFF
Definition: windrvr.h:998
@ DEBUG_DUMP_CLOCK_ON
Definition: windrvr.h:997
@ KERNEL_DEBUGGER_ON
Definition: windrvr.h:995
@ DEBUG_SET_FILTER
Definition: windrvr.h:990
@ DEBUG_SET_BUFFER
Definition: windrvr.h:991
@ DEBUG_CLOCK_RESET
Definition: windrvr.h:999
@ DEBUG_STATUS
Definition: windrvr.h:989
@ DEBUG_DUMP_SEC_OFF
Definition: windrvr.h:994
struct WD_SLEEP WD_SLEEP_V40
#define WD_LICENSE_LENGTH
Definition: windrvr.h:671
unsigned char BYTE
Definition: windrvr.h:332
WD_ERROR_CODES
Definition: windrvr.h:1065
@ WD_INVALID_32BIT_APP
[0x20000021] Invalid 32 Bit User Application.
Definition: windrvr.h:1230
@ WD_TRY_AGAIN
[0x2000001d] Try Again.
Definition: windrvr.h:1216
@ WD_USBD_STATUS_DATA_TOGGLE_MISMATCH
[0xC0000003] HC status: Data toggle mismatch
Definition: windrvr.h:1284
@ WD_RESOURCE_OVERLAP
[0x2000000e] Resource Overlap.
Definition: windrvr.h:1134
@ WD_FAILED_KERNEL_MAPPING
[0x20000018] Failed to map memory to Kernel Space.
Definition: windrvr.h:1182
@ WD_WINDRIVER_STATUS_ERROR
[0x20000000]
Definition: windrvr.h:1069
@ WD_USBD_STATUS_UNEXPECTED_PID
[0xC0000007] HC status: Unexpected PID
Definition: windrvr.h:1296
@ WD_USBD_STATUS_REQUEST_FAILED
[0x80000500] Returned by USBD if it cannot complete a URB request.
Definition: windrvr.h:1363
@ WD_USBD_STATUS_INTERFACE_NOT_FOUND
[0xC0004000] USBD: Interface not found
Definition: windrvr.h:1420
@ WD_USBD_STATUS_INAVLID_CONFIGURATION_DESCRIPTOR
[0xC0000F00] USBD: Invalid configuration descriptor
Definition: windrvr.h:1401
@ WD_TOO_MANY_HANDLES
[0x20000022] Too Many Handles.
Definition: windrvr.h:1236
@ WD_USBD_STATUS_ISO_NOT_ACCESSED_LATE
[0xC0050000] The packet was not sent because the client submitted it too late to transmit:
Definition: windrvr.h:1455
@ WD_USBD_STATUS_INVALID_URB_FUNCTION
[0x80000200] USBD: Invalid URB function
Definition: windrvr.h:1348
@ WD_USBD_STATUS_NOT_ACCESSED
[0xC000000F] HC status: Not accessed
Definition: windrvr.h:1315
@ WD_INTERRUPT_NOT_ENABLED
[0x2000000d] Interrupt not enabled.
Definition: windrvr.h:1127
@ WD_USBD_STATUS_ERROR_BUSY
[0x80000400] Returned if client driver attempts to close an endpoint/interface or configuration with ...
Definition: windrvr.h:1357
@ WD_USBD_STATUS_XACT_ERROR
[0xC0000011] HC status: The host controller has set the Transaction Error (XactErr) bit in the transf...
Definition: windrvr.h:1321
@ WD_MORE_PROCESSING_REQUIRED
[0xC0000016] More Processing Required.
Definition: windrvr.h:1255
@ WD_UNKNOWN_PIPE_TYPE
[0x20000006] Obsolete.
Definition: windrvr.h:1094
@ WD_INVALID_HANDLE
[0x20000001] Invalid WinDriver handle.
Definition: windrvr.h:1071
@ WD_USBD_STATUS_DATA_UNDERRUN
[0xC0000009] HC status: Data underrrun
Definition: windrvr.h:1302
@ WD_OPERATION_FAILED
[0x20000020] Operation Failed.
Definition: windrvr.h:1226
@ WD_USB_DESCRIPTOR_ERROR
[0x20000012] USB Descriptor Error.
Definition: windrvr.h:1152
@ WD_USBD_STATUS_RESERVED1
[0xC000000A] HC status: Reserved1
Definition: windrvr.h:1305
@ WD_USBD_STATUS_RESERVED2
[0xC000000B] HC status: Reserved1
Definition: windrvr.h:1307
@ WD_USBD_STATUS_NOT_SUPPORTED
[0xC0000E00] Returned for APIS not supported/implemented
Definition: windrvr.h:1398
@ WD_USBD_STATUS_DEVICE_GONE
[0xC0007000] USBD: Device Gone
Definition: windrvr.h:1431
@ WD_USBD_STATUS_ISO_NOT_ACCESSED_BY_HW
Extended isochronous error codes returned by USBD.
Definition: windrvr.h:1445
@ WD_USBD_STATUS_DATA_BUFFER_ERROR
[0xC0000013] HC status: Data buffer error
Definition: windrvr.h:1330
@ WD_USBD_STATUS_ISO_TD_ERROR
[0xC0030000] Controller reported an error in the TD.
Definition: windrvr.h:1449
@ WD_USBD_STATUS_DEV_NOT_RESPONDING
[0xC0000005] HC status: Device not responding
Definition: windrvr.h:1290
@ WD_USBD_STATUS_FIFO
[0xC0000010] HC status: FIFO
Definition: windrvr.h:1317
@ WD_NO_LICENSE
0x[20000009] No License.
Definition: windrvr.h:1101
@ WD_INVALID_PARAMETER
[0x2000001b] Invalid Parameter.
Definition: windrvr.h:1206
@ WD_WRONG_UNIQUE_ID
[0x20000010] Wrong unique ID (USB).
Definition: windrvr.h:1143
@ WD_USBD_STATUS_INVALID_PARAMETER
[0x80000300] USBD: Invalid parameter
Definition: windrvr.h:1351
@ WD_USBD_STATUS_BAD_START_FRAME
[0x80000A00] Returned if the requested start frame is not within
Definition: windrvr.h:1381
@ WD_USBD_STATUS_SUCCESS
[0x00000000] Success
Definition: windrvr.h:1265
@ WD_USBD_STATUS_ERROR
[0x80000000] Error
Definition: windrvr.h:1268
@ WD_DATA_MISMATCH
[0x20000008] Data Mismatch.
Definition: windrvr.h:1097
@ WD_NO_RESOURCES_ON_DEVICE
[0x20000019] No Resources On Device.
Definition: windrvr.h:1192
@ WD_NO_EVENTS
[0x2000001a] No Events.
Definition: windrvr.h:1202
@ WD_USBD_STATUS_NO_BANDWIDTH
[0x80000700] Returned when there is not enough bandwidth available
Definition: windrvr.h:1369
@ WD_USBD_STATUS_BUFFER_UNDERRUN
[0xC000000D] HC status: Buffer underrun
Definition: windrvr.h:1312
@ WD_NOT_IMPLEMENTED
[0x2000000a] Function not implemented.
Definition: windrvr.h:1107
@ WD_READ_WRITE_CONFLICT
[0x20000003] Request to read from an OUT (write) pipe or request to write to an IN (read) pipe
Definition: windrvr.h:1084
@ WD_USBD_STATUS_FRAME_CONTROL_NOT_OWNED
[0xC0000D00] Returned by USBD if the caller does not own frame length control and attempts to release...
Definition: windrvr.h:1393
@ WD_DEVICE_NOT_FOUND
[0x2000000f] Device not found.
Definition: windrvr.h:1140
@ WD_NO_DEVICE_OBJECT
[0x20000023] No Device Object.
Definition: windrvr.h:1242
@ WD_USBD_STATUS_CANCELED
[0xC0010000] USBD: Transfer canceled
Definition: windrvr.h:1335
@ WD_INCORRECT_VERSION
[0x2000001c] Incorrect version.
Definition: windrvr.h:1210
@ WD_USBD_STATUS_PENDING
[0x40000000] Operation pending
Definition: windrvr.h:1266
@ WD_USBD_STATUS_TIMEOUT
[0xC0006000] USBD: Timeout
Definition: windrvr.h:1428
@ WD_USBD_STATUS_ISOCH_REQUEST_FAILED
[0xC0000B00] Returned by HCD (Host Controller Driver) if all packets in an isochronous transfer compl...
Definition: windrvr.h:1385
@ WD_FAILED_ENABLING_INTERRUPT
[0x2000000c] Failed Enabling Interrupts.
Definition: windrvr.h:1116
@ WD_KERPLUG_FAILURE
[0x2000000b] Kernel PlugIn failure.
Definition: windrvr.h:1112
@ WD_WINDRIVER_NOT_FOUND
[0x2000001e] Obsolete
Definition: windrvr.h:1220
@ WD_SET_CONFIGURATION_FAILED
[0x20000013] Set Configuration Failed (USB).
Definition: windrvr.h:1160
@ WD_USBD_STATUS_CRC
[0xC0000001] HC status: CRC
Definition: windrvr.h:1280
@ WD_USBD_STATUS_ENDPOINT_HALTED
Returned by HCD (Host Controller Driver) if a transfer is submitted to an endpoint that is stalled:
Definition: windrvr.h:1341
@ WD_USBD_STATUS_INTERNAL_HC_ERROR
[0x80000800] Generic HC (Host Controller) error:
Definition: windrvr.h:1372
@ WD_FAILED_USER_MAPPING
[0x20000017] Failed to map memory to User Space.
Definition: windrvr.h:1173
@ WD_USBD_STATUS_INVALID_PIPE_HANDLE
[80000600] USBD: Invalid pipe handle
Definition: windrvr.h:1365
@ WD_STATUS_SUCCESS
[0] Operation completed successfully
Definition: windrvr.h:1066
@ WD_USBD_STATUS_INAVLID_PIPE_FLAGS
[0xC0005000] USBD: Invalid pipe flags
Definition: windrvr.h:1424
@ WD_INVALID_IOCTL
[0x2000001f] Invalid IOCTL.
Definition: windrvr.h:1221
@ WD_TIME_OUT_EXPIRED
[0x20000015] Time Out Expired.
Definition: windrvr.h:1166
@ WD_SYSTEM_INTERNAL_ERROR
[0x20000007] Internal System Error
Definition: windrvr.h:1095
@ WD_USBD_STATUS_BUFFER_TOO_SMALL
[0xC0003000] USBD: Buffer too small
Definition: windrvr.h:1416
@ WD_USBD_STATUS_INSUFFICIENT_RESOURCES
[0xC0001000] USBD: Insufficient resources
Definition: windrvr.h:1407
@ WD_USBD_STATUS_DATA_OVERRUN
[0xC0000008] HC status: Data overrun
Definition: windrvr.h:1299
@ WD_ZERO_PACKET_SIZE
[0x20000004] Maximum packet size is zero
Definition: windrvr.h:1087
@ WD_USBD_STATUS_ERROR_SHORT_TRANSFER
[0x80000900] Returned when a short packet terminates the transfer
Definition: windrvr.h:1376
@ WD_USBD_STATUS_STALL_PID
[0xC0000004] HC status: PID stall
Definition: windrvr.h:1288
@ WD_USBD_STATUS_PID_CHECK_FAILURE
[0xC0000006] HC status: PID check failed
Definition: windrvr.h:1293
@ WD_USBD_STATUS_ISO_NA_LATE_USBPORT
[0xC0040000] The packet was submitted in time by the client but
Definition: windrvr.h:1452
@ WD_CANT_OBTAIN_PDO
[0x20000014] Obsolete
Definition: windrvr.h:1165
@ WD_USBD_STATUS_BABBLE_DETECTED
[0xC0000012] HC status: Babble detected
Definition: windrvr.h:1327
@ WD_USBD_STATUS_HALTED
[0xC0000000] Halted
Definition: windrvr.h:1269
@ WD_INSUFFICIENT_RESOURCES
[0x20000005] Insufficient resources.
Definition: windrvr.h:1089
@ WD_USBD_STATUS_FRAME_CONTROL_OWNED
[0xC0000C00] Returned by USBD if the frame length control for a given
Definition: windrvr.h:1389
@ WD_USBD_STATUS_BTSTUFF
[0xC0000002] HC status: Bit stuffing
Definition: windrvr.h:1282
@ WD_USBD_STATUS_BUFFER_OVERRUN
[0xC000000C] HC status: Buffer overrun
Definition: windrvr.h:1309
@ WD_USBD_STATUS_SET_CONFIG_FAILED
[0xC0002000] USBD: Set configuration failed
Definition: windrvr.h:1411
@ WD_IRP_CANCELED
[0x20000016] IRP Cancelled.
Definition: windrvr.h:1170
@ WD_INVALID_PIPE_NUMBER
[0x20000002] USB: Invalid Pipe Number.
Definition: windrvr.h:1080
@ WD_OPERATION_ALREADY_DONE
[0x20000011] Operation Already Done.
Definition: windrvr.h:1146
@ WD_USBD_STATUS_STATUS_NOT_MAPPED
[0xC0008000] USBD: Status not mapped
Definition: windrvr.h:1434
@ WD_STATUS_INVALID_WD_HANDLE
[0xffffffff]
Definition: windrvr.h:1067
@ WD_USBD_STATUS_NO_MEMORY
[0x80000100] USBD: Out of memory
Definition: windrvr.h:1345
DEBUG_SECTION
Definition: windrvr.h:968
@ S_MISC
Definition: windrvr.h:975
@ S_IO
Definition: windrvr.h:970
@ S_DMA
Definition: windrvr.h:974
@ S_LICENSE
Definition: windrvr.h:976
@ S_EVENT
Definition: windrvr.h:982
@ S_INT
Definition: windrvr.h:972
@ S_USB
Definition: windrvr.h:980
@ S_ALL
Definition: windrvr.h:969
@ S_KER_PLUG
Definition: windrvr.h:981
@ S_MEM
Definition: windrvr.h:971
@ S_KER_BUF
Definition: windrvr.h:984
@ S_KER_DRV
Definition: windrvr.h:979
@ S_PCI
Definition: windrvr.h:973
@ S_PNP
Definition: windrvr.h:977
@ S_IPC
Definition: windrvr.h:983
@ S_CARD_REG
Definition: windrvr.h:978
struct WD_VERSION WD_VERSION_V30
struct WD_LICENSE WD_LICENSE_V122
WD_PCI_SCAN_OPTIONS
Definition: windrvr.h:879
@ WD_PCI_SCAN_BY_TOPOLOGY
Definition: windrvr.h:881
@ WD_PCI_SCAN_DEFAULT
Definition: windrvr.h:880
@ WD_PCI_SCAN_INCLUDE_DOMAINS
Definition: windrvr.h:883
@ WD_PCI_SCAN_REGISTERED
Definition: windrvr.h:882
WD_TRANSFER_CMD
IN WD_TRANSFER_CMD and WD_Transfer() DWORD stands for 32 bits and QWORD is 64 bit.
Definition: windrvr.h:389
@ WM_SWORD
Write memory string word.
Definition: windrvr.h:425
@ WM_SBYTE
Write memory string byte.
Definition: windrvr.h:424
@ RP_SDWORD
Read port string dword.
Definition: windrvr.h:405
@ WM_BYTE
Write memory byte.
Definition: windrvr.h:415
@ WM_SQWORD
Write memory string quad word.
Definition: windrvr.h:428
@ RM_DWORD
Read memory dword.
Definition: windrvr.h:414
@ WP_DWORD
Write port dword.
Definition: windrvr.h:399
@ RP_BYTE
Read port byte.
Definition: windrvr.h:394
@ WM_SDWORD
Write memory string dword.
Definition: windrvr.h:426
@ RM_WORD
Read memory word.
Definition: windrvr.h:413
@ RM_SBYTE
Read memory string byte.
Definition: windrvr.h:421
@ WP_SQWORD
Write port string qword.
Definition: windrvr.h:410
@ RM_BYTE
Read memory byte.
Definition: windrvr.h:412
@ WP_SBYTE
Write port string byte.
Definition: windrvr.h:406
@ WP_SWORD
Write port string word.
Definition: windrvr.h:407
@ RM_SWORD
Read memory string word.
Definition: windrvr.h:422
@ CMD_MASK
Interrupt Mask.
Definition: windrvr.h:392
@ WM_DWORD
Write memory dword.
Definition: windrvr.h:417
@ CMD_NONE
No command.
Definition: windrvr.h:390
@ RP_DWORD
Read port dword.
Definition: windrvr.h:396
@ CMD_END
End command.
Definition: windrvr.h:391
@ WP_BYTE
Write port byte.
Definition: windrvr.h:397
@ RP_QWORD
Read port qword.
Definition: windrvr.h:400
@ WM_QWORD
Write memory qword.
Definition: windrvr.h:419
@ RM_SDWORD
Read memory string dword.
Definition: windrvr.h:423
@ RM_QWORD
Read memory qword.
Definition: windrvr.h:418
@ WP_WORD
Write port word.
Definition: windrvr.h:398
@ WP_SDWORD
Write port string dword.
Definition: windrvr.h:408
@ RM_SQWORD
Read memory string quad word.
Definition: windrvr.h:427
@ RP_SWORD
Read port string word.
Definition: windrvr.h:404
@ WM_WORD
Write memory word.
Definition: windrvr.h:416
@ RP_SBYTE
Read port string byte.
Definition: windrvr.h:403
@ WP_QWORD
Write port qword.
Definition: windrvr.h:401
@ RP_WORD
Read port word.
Definition: windrvr.h:395
@ RP_SQWORD
Read port string qword.
Definition: windrvr.h:409
#define INVALID_HANDLE_VALUE
Definition: windrvr.h:1557
@ WD_IPC_MAX_PROCS
Definition: windrvr.h:805
#define WD_MAX_KP_NAME_LENGTH
Definition: windrvr.h:60
#define WIN32
Definition: windrvr.h:183
#define WD_Close
Definition: windrvr.h:1844
#define WD_CloseLocal(h)
Definition: windrvr.h:1793
@ WD_IPC_UID_UNICAST
Definition: windrvr.h:818
@ WD_IPC_SUBGROUP_MULTICAST
Definition: windrvr.h:819
@ WD_IPC_MULTICAST
Definition: windrvr.h:820
WD_EVENT_OPTION
Definition: windrvr.h:1482
@ WD_ACCEPT_CONTROL
used in WD_EVENT_SEND (acknowledge)
Definition: windrvr.h:1484
@ WD_ACKNOWLEDGE
Definition: windrvr.h:1483
#define BZERO(buf)
Definition: windrvr.h:1553
WD_PCI_SCAN_CAPS_OPTIONS
Definition: windrvr.h:896
@ WD_PCI_SCAN_CAPS_BASIC
Scan basic PCI capabilities.
Definition: windrvr.h:897
@ WD_PCI_SCAN_CAPS_EXTENDED
Scan extended (PCIe) PCI capabilities.
Definition: windrvr.h:898
struct WD_DEBUG WD_DEBUG_V40
DWORD WD_BUS_TYPE
Definition: windrvr.h:685
UINT64 PHYS_ADDR
Definition: windrvr.h:382
struct WD_DEBUG_DUMP WD_DEBUG_DUMP_V40
@ INTERRUPT_MESSAGE
Message-Signaled Interrupts (MSI).
Definition: windrvr.h:618
@ INTERRUPT_CMD_RETURN_VALUE
Obsolete.
Definition: windrvr.h:617
@ INTERRUPT_LATCHED
Legacy Latched Interrupts .
Definition: windrvr.h:608
@ INTERRUPT_MESSAGE_X
Extended Message-Signaled Interrupts (MSI-X).
Definition: windrvr.h:619
@ INTERRUPT_CMD_COPY
Copy any data read in the kernel as a result of a read transfer command, and return it to the user wi...
Definition: windrvr.h:611
@ INTERRUPT_LEVEL_SENSITIVE
Legacy Level Sensitive Interrupts.
Definition: windrvr.h:609
@ INTERRUPT_CE_INT_ID
Obsolete.
Definition: windrvr.h:616
@ INTERRUPT_DONT_GET_MSI_MESSAGE
Linux Only.
Definition: windrvr.h:621
struct WD_PCI_SCAN_CAPS WD_PCI_SCAN_CAPS_V118
struct WD_DMA_PAGE WD_DMA_PAGE_V80
struct WD_EVENT WD_EVENT_V121
struct WD_IPC_REGISTER WD_IPC_REGISTER_V121
struct WD_KERNEL_PLUGIN WD_KERNEL_PLUGIN_V40
DWORD DLLCALLCONV check_secureBoot_enabled(void)
Checks whether the Secure Boot feature is enabled on the system.
void(DLLCALLCONV * DMA_TRANSACTION_CALLBACK)(PVOID pData)
Definition: windrvr.h:530
struct WD_PCI_SRIOV WD_PCI_SRIOV_V122
const char *DLLCALLCONV WD_DriverName(const char *sName)
Sets the name of the WinDriver kernel module, which will be used by the calling application.
unsigned __int64 UINT64
Definition: windrvr.h:314
#define REGKEY_BUFSIZE
Definition: windrvr.h:1695
struct WD_IPC_SEND WD_IPC_SEND_V121
@ WD_PCI_MAX_CAPS
Definition: windrvr.h:886
#define WD_PROCESS_NAME_LENGTH
Definition: windrvr.h:787
@ SLEEP_BUSY
Definition: windrvr.h:950
@ SLEEP_NON_BUSY
Definition: windrvr.h:950
@ WD_BUS_EISA
EISA, including ISA PnP.
Definition: windrvr.h:682
@ WD_BUS_ISA
ISA.
Definition: windrvr.h:681
@ WD_BUS_UNKNOWN
Unknown bus type.
Definition: windrvr.h:680
@ WD_BUS_PCI
PCI.
Definition: windrvr.h:683
@ WD_BUS_USB
USB.
Definition: windrvr.h:679
#define DLLCALLCONV
Definition: windrvr.h:32
WD_EVENT_ACTION
Definition: windrvr.h:1460
@ WD_POWER_SYSTEM_WORKING
Definition: windrvr.h:1469
@ WD_POWER_SYSTEM_SLEEPING3
Definition: windrvr.h:1472
@ WD_POWER_SYSTEM_HIBERNATE
Definition: windrvr.h:1473
@ WD_POWER_CHANGED_D0
Power states for the power management.
Definition: windrvr.h:1464
@ WD_OBSOLETE
Obsolete.
Definition: windrvr.h:1463
@ WD_POWER_SYSTEM_SLEEPING2
Definition: windrvr.h:1471
@ WD_POWER_CHANGED_D3
Definition: windrvr.h:1468
@ WD_POWER_SYSTEM_SHUTDOWN
Definition: windrvr.h:1474
@ WD_POWER_CHANGED_D2
Definition: windrvr.h:1467
@ WD_INSERT
Definition: windrvr.h:1461
@ WD_POWER_CHANGED_D1
Definition: windrvr.h:1466
@ WD_POWER_SYSTEM_SLEEPING1
Definition: windrvr.h:1470
@ WD_REMOVE
Definition: windrvr.h:1462
@ WD_IPC_UNICAST_MSG
Definition: windrvr.h:1475
@ WD_IPC_MULTICAST_MSG
Definition: windrvr.h:1476
@ WD_PCI_CARDS
Definition: windrvr.h:846
@ WD_EVENT_TYPE_IPC
Definition: windrvr.h:1498
@ WD_EVENT_TYPE_UNKNOWN
Definition: windrvr.h:1495
@ WD_EVENT_TYPE_USB
Definition: windrvr.h:1497
@ WD_EVENT_TYPE_PCI
Definition: windrvr.h:1496
UINT64 DMA_ADDR
Definition: windrvr.h:381
DWORD WD_EVENT_TYPE
Definition: windrvr.h:1500
struct WD_PCI_SCAN_CARDS WD_PCI_SCAN_CARDS_V124
WD_DMA_OPTIONS
Definition: windrvr.h:437
@ DMA_KERNEL_BUFFER_ALLOC
The system allocates a contiguous buffer.
Definition: windrvr.h:438
@ DMA_DISABLE_MERGE_ADJACENT_PAGES
Disable merge adjacent pages.
Definition: windrvr.h:487
@ DMA_TRANSACTION
Use this flag to use the DMA transaction mechanism.
Definition: windrvr.h:482
@ DMA_TO_DEVICE
memory pages are locked to be read by device
Definition: windrvr.h:458
@ DMA_KBUF_BELOW_16M
If DMA_KERNEL_BUFFER_ALLOC is used, this will make sure it is under 16M.
Definition: windrvr.h:441
@ DMA_ALLOW_NO_HCARD
Allow memory lock without hCard.
Definition: windrvr.h:466
@ DMA_FROM_DEVICE
memory pages are locked to be written by device
Definition: windrvr.h:455
@ DMA_GET_PREALLOCATED_BUFFERS_ONLY
Windows: Try to allocate buffers from preallocated buffers pool ONLY (if none of them are available,...
Definition: windrvr.h:478
@ DMA_GET_EXISTING_BUF
Get existing buffer by hDma handle.
Definition: windrvr.h:468
@ DMA_ALLOW_64BIT_ADDRESS
Use this value for devices that support 64-bit DMA addressing.
Definition: windrvr.h:463
@ DMA_TO_FROM_DEVICE
memory pages are locked for both read and write
Definition: windrvr.h:460
@ DMA_LARGE_BUFFER
If DMA_LARGE_BUFFER is used, the maximum number of pages are dwPages, and not WD_DMA_PAGES.
Definition: windrvr.h:444
@ DMA_GPUDIRECT
Linux only.
Definition: windrvr.h:485
@ DMA_ALLOW_CACHE
Allow caching of contiguous memory.
Definition: windrvr.h:450
@ DMA_KERNEL_ONLY_MAP
Only map to kernel, dont map to user-mode.
Definition: windrvr.h:452
@ DMA_KBUF_ALLOC_SPECIFY_ADDRESS_WIDTH
When using this flag, the width of the address must be entered in the fourth byte of dwOptions and th...
Definition: windrvr.h:472
@ DMA_RESERVED_MEM
Definition: windrvr.h:470
@ WD_CARD_ITEMS
Definition: windrvr.h:767
@ WD_MATCH_EXCLUDE
Exclude if there is a match.
Definition: windrvr.h:511
unsigned int UINT32
Definition: windrvr.h:337
#define DEBUG_USER_BUF_LEN
Definition: windrvr.h:1016
struct WD_CARD_REGISTER WD_CARD_REGISTER_V118
WD_INTERRUPT_WAIT_RESULT
Definition: windrvr.h:635
@ INTERRUPT_INTERRUPTED
Wait was interrupted before an actual hardware interrupt was received.
Definition: windrvr.h:638
@ INTERRUPT_RECEIVED
Interrupt was received.
Definition: windrvr.h:636
@ INTERRUPT_STOPPED
Interrupt was disabled during wait.
Definition: windrvr.h:637
UINT32 KPTR
Definition: windrvr.h:372
#define WD_Open
Definition: windrvr.h:1845
struct WD_IPC_PROCESS WD_IPC_PROCESS_V121
WD_OS_INFO DLLCALLCONV get_os_type(void)
Retrieves the type of the operating system in section.
#define PAD_TO_64(pName)
Definition: windrvr_usb.h:15