📄 windrvr.h
字号:
// option and allocate memory for pages.
DMA_ALLOW_CACHE = 0x8, // allow caching of contiguous memory
DMA_KERNEL_ONLY_MAP = 0x10, // Only map to kernel, dont map to user-mode.
// relevant with DMA_KERNEL_BUFFER_ALLOC flag only
DMA_FROM_DEVICE = 0x20, // memory pages are locked to be written by device
DMA_TO_DEVICE = 0x40, // memory pages are locked to be read by device
DMA_TO_FROM_DEVICE = (DMA_FROM_DEVICE | DMA_TO_DEVICE), // memory pages are
// locked for both read and write
DMA_ALLOW_64BIT_ADDRESS = 0x80 // use this for devices that support
// 64bit DMA address
};
#define DMA_DIRECTION_MASK DMA_TO_FROM_DEVICE
/* Macros for backwards compatibility */
#define DMA_READ_FROM_DEVICE DMA_FROM_DEVICE
#define DMA_WRITE_TO_DEVICE DMA_TO_DEVICE
enum {
WD_MATCH_EXCLUDE = 0x1 // exclude if there is a match
};
enum {
WD_CPCI_PNP_SUPPORT = 0x1 // set this flag in case we want to use OS PnP support
};
typedef struct
{
DMA_ADDR pPhysicalAddr; // Physical address of page.
DWORD dwBytes; // Size of page.
} WD_DMA_PAGE, WD_DMA_PAGE_V80;
typedef struct
{
DWORD hDma; // Handle of dma buffer.
PVOID pUserAddr; // Beginning of buffer.
KPTR pKernelAddr; // Kernel mapping of kernel allocated buffer
DWORD dwBytes; // Size of buffer.
DWORD dwOptions; // Allocation options:
// DMA_KERNEL_BUFFER_ALLOC, DMA_KBUF_BELOW_16M, DMA_LARGE_BUFFER
// DMA_ALLOW_CACHE, DMA_KERNEL_ONLY_MAP, DMA_FROM_DEVICE,
// DMA_TO_DEVICE, DMA_ALLOW_64BIT_ADDRESS
DWORD dwPages; // Number of pages in buffer.
DWORD hCard; // Handle of relevant card as received from WD_CardRegister()
WD_DMA_PAGE Page[WD_DMA_PAGES];
} WD_DMA, WD_DMA_V80;
typedef struct
{
KPTR dwPort; // IO port for transfer or kernel memory address.
DWORD cmdTrans; // Transfer command WD_TRANSFER_CMD.
// Parameters used for string transfers:
DWORD dwBytes; // For string transfer.
DWORD fAutoinc; // Transfer from one port/address
// or use incremental range of addresses.
DWORD dwOptions; // Must be 0.
union
{
BYTE Byte; // Use for 8 bit transfer.
WORD Word; // Use for 16 bit transfer.
UINT32 Dword; // Use for 32 bit transfer.
UINT64 Qword; // Use for 64 bit transfer.
PVOID pBuffer; // Use for string transfer.
} Data;
} WD_TRANSFER, WD_TRANSFER_V61;
enum { INTERRUPT_LEVEL_SENSITIVE = 1 };
enum { INTERRUPT_CMD_COPY = 2 };
enum { INTERRUPT_CE_INT_ID = 4 };
typedef struct
{
DWORD hKernelPlugIn;
DWORD dwMessage;
PVOID pData;
DWORD dwResult;
} WD_KERNEL_PLUGIN_CALL, WD_KERNEL_PLUGIN_CALL_V40;
typedef enum {
INTERRUPT_RECEIVED = 0, /* Interrupt was received */
INTERRUPT_STOPPED, /* Interrupt was disabled during wait */
INTERRUPT_INTERRUPTED /* Wait was interrupted before an actual hardware interrupt was received */
} WD_INTERRUPT_WAIT_RESULT;
typedef struct
{
DWORD hInterrupt; // Handle of interrupt.
DWORD dwOptions; // Interrupt options: can be INTERRUPT_CMD_COPY
WD_TRANSFER *Cmd; // Commands to do on interrupt.
DWORD dwCmds; // Number of commands.
// For WD_IntEnable():
WD_KERNEL_PLUGIN_CALL kpCall; // Kernel PlugIn call.
DWORD fEnableOk; // TRUE if interrupt was enabled (WD_IntEnable() succeed).
// For WD_IntWait() and WD_IntCount():
DWORD dwCounter; // Number of interrupts received.
DWORD dwLost; // Number of interrupts not yet dealt with.
DWORD fStopped; // Was interrupt disabled during wait.
} WD_INTERRUPT, WD_INTERRUPT_V40;
typedef struct
{
DWORD dwVer;
CHAR cVer[128];
} WD_VERSION, WD_VERSION_V30;
enum
{
LICENSE_DEMO = 0x00000001,
LICENSE_WD = 0x00000004,
LICENSE_IO = 0x00000008,
LICENSE_MEM = 0x00000010,
LICENSE_INT = 0x00000020,
LICENSE_PCI = 0x00000040,
LICENSE_DMA = 0x00000080,
LICENSE_NT = 0x00000100,
LICENSE_95 = 0x00000200,
LICENSE_ISAPNP = 0x00000400,
LICENSE_PCMCIA = 0x00000800,
LICENSE_PCI_DUMP = 0x00001000,
LICENSE_MSG_GEN = 0x00002000,
LICENSE_MSG_EDU = 0x00004000,
LICENSE_MSG_INT = 0x00008000,
LICENSE_KER_PLUG = 0x00010000,
LICENSE_LINUX = 0x00020000,
LICENSE_CE = 0x00080000,
LICENSE_VXWORKS = 0x10000000,
LICENSE_THIS_PC = 0x00100000,
LICENSE_WIZARD = 0x00200000,
LICENSE_KD = 0x00400000,
LICENSE_SOLARIS = 0x00800000,
LICENSE_CPU0 = 0x00040000,
LICENSE_CPU1 = 0x01000000,
LICENSE_CPU2 = 0x02000000,
LICENSE_CPU3 = 0x04000000,
LICENSE_USB = 0x08000000
};
enum
{
LICENSE2_EVENT = 0x00000008,
LICENSE2_WDLIB = 0x00000010,
LICENSE2_WDF = 0x00000020,
LICENSE2_WDF_MSD = 0x00000040
};
enum
{
LICENSE_OS_WITH_WIZARD = LICENSE_95 | LICENSE_NT | LICENSE_LINUX | LICENSE_SOLARIS,
LICENSE_OS_WITHOUT_WIZARD = LICENSE_CE | LICENSE_VXWORKS
};
enum
{
LICENSE_CPU_ALL = LICENSE_CPU3 | LICENSE_CPU2 | LICENSE_CPU1 |
LICENSE_CPU0,
LICENSE_X86 = LICENSE_CPU0,
LICENSE_ALPHA = LICENSE_CPU1,
LICENSE_SPARC = LICENSE_CPU1 | LICENSE_CPU0,
LICENSE_PPC = LICENSE_CPU2,
LICENSE_X86_64 = LICENSE_CPU2 | LICENSE_CPU0,
LICENSE_IA64 = LICENSE_CPU1 | LICENSE_CPU2
};
#define WD_LICENSE_LENGTH 128
typedef struct
{
CHAR cLicense[WD_LICENSE_LENGTH]; // Buffer with license string to put.
// If empty string then get current license setting
// into dwLicense.
DWORD dwLicense; // Returns license settings: LICENSE_DEMO, LICENSE_WD
// etc..., or 0 for invalid license.
DWORD dwLicense2; // Returns additional license settings, if dwLicense
// could not hold all the information.
// Then dwLicense will return 0.
} WD_LICENSE, WD_LICENSE_V44;
enum
{
WD_BUS_USB = (int)0xfffffffe,
WD_BUS_UNKNOWN = 0,
WD_BUS_ISA = 1,
WD_BUS_EISA = 2, // ISA PnP belongs to this classification
WD_BUS_PCI = 5,
WD_BUS_PCMCIA = 8
};
typedef DWORD WD_BUS_TYPE;
typedef struct
{
WD_BUS_TYPE dwBusType; // Bus Type: ISA, EISA, PCI, PCMCIA.
DWORD dwBusNum; // Bus number.
DWORD dwSlotFunc; // Slot number on Bus.
} WD_BUS, WD_BUS_V30;
typedef enum
{
ITEM_NONE=0,
ITEM_INTERRUPT=1,
ITEM_MEMORY=2,
ITEM_IO=3,
ITEM_BUS=5
} ITEM_TYPE;
typedef enum
{
WD_ITEM_DO_NOT_MAP_KERNEL = 1, // skip the mapping of physical memory to kernel address space
WD_ITEM_ALLOW_CACHE = 2 // map physical memory as cached (not applicable for PCI memory)
} WD_ITEM_OPTIONS;
typedef struct
{
DWORD item; // ITEM_TYPE
DWORD fNotSharable;
DWORD dwReserved; // Reserved for internal use
DWORD dwOptions; // WD_ITEM_OPTIONS
union
{
struct
{ // ITEM_MEMORY
DWORD dwPhysicalAddr; // Physical address on card.
DWORD dwBytes; // Address range.
KPTR dwTransAddr; // Returns the address to pass on to transfer commands.
UPTR dwUserDirectAddr; // Returns the address for direct user read/write.
DWORD dwCpuPhysicalAddr; // Returns the CPU physical address
DWORD dwBar; // Base Address Register number of PCI card.
} Mem;
struct
{ // ITEM_IO
KPTR dwAddr; // Beginning of io address.
DWORD dwBytes; // IO range.
DWORD dwBar; // Base Address Register number of PCI card.
} IO;
struct
{ // ITEM_INTERRUPT
DWORD dwInterrupt; // Number of interrupt to install.
DWORD dwOptions; // Interrupt options. For level sensitive
// interrupts - set to: INTERRUPT_LEVEL_SENSITIVE.
DWORD hInterrupt; // Returns the handle of the interrupt installed.
} Int;
WD_BUS Bus; // ITEM_BUS
struct
{
DWORD dw1, dw2, dw3, dw4; // Reserved for internal use
KPTR dw5; // Reserved for internal use
} Val;
} I;
} WD_ITEMS, WD_ITEMS_V30;
enum { WD_CARD_ITEMS = 20 };
typedef struct
{
DWORD dwItems;
WD_ITEMS Item[WD_CARD_ITEMS];
} WD_CARD, WD_CARD_V30;
enum { CARD_VX_NO_MMU_INIT = 0x4000000 };
typedef struct
{
WD_CARD Card; // Card to register.
DWORD fCheckLockOnly; // Only check if card is lockable, return hCard=1 if OK.
DWORD hCard; // Handle of card.
DWORD dwOptions; // Should be zero.
CHAR cName[32]; // Name of card.
CHAR cDescription[100]; // Description.
} WD_CARD_REGISTER, WD_CARD_REGISTER_V40;
typedef struct
{
DWORD hCard; // Handle of card.
WD_TRANSFER *Cmd; // Buffer with WD_TRANSFER commands
DWORD dwCmds; // Number of commands.
DWORD dwOptions; // 0 (default) or WD_FORCE_CLEANUP
} WD_CARD_CLEANUP;
enum { WD_FORCE_CLEANUP = 0x1 };
enum { WD_PCI_CARDS = 100 };
typedef struct
{
DWORD dwBus;
DWORD dwSlot;
DWORD dwFunction;
} WD_PCI_SLOT;
typedef struct
{
DWORD dwVendorId;
DWORD dwDeviceId;
} WD_PCI_ID;
typedef struct
{
WD_PCI_ID searchId; // If dwVendorId==0 - scan all vendor IDs.
// If dwDeviceId==0 - scan all device IDs.
DWORD dwCards; // Number of cards found.
WD_PCI_ID cardId[WD_PCI_CARDS]; // VendorID & DeviceID of cards found.
WD_PCI_SLOT cardSlot[WD_PCI_CARDS]; // Pci slot info of cards found.
DWORD dwOptions;
} WD_PCI_SCAN_CARDS, WD_PCI_SCAN_CARDS_V80;
enum {
WD_PCI_SCAN_DEFAULT = 0x0,
WD_PCI_SCAN_BY_TOPOLOGY = 0x1
};
typedef struct
{
WD_PCI_SLOT pciSlot; // Pci slot.
WD_CARD Card; // Get card parameters for pci slot.
} WD_PCI_CARD_INFO, WD_PCI_CARD_INFO_V30;
typedef enum
{
PCI_ACCESS_OK = 0,
PCI_ACCESS_ERROR = 1,
PCI_BAD_BUS = 2,
PCI_BAD_SLOT = 3
} PCI_ACCESS_RESULT;
typedef enum
{
PCMCIA_ACCESS_OK = 0,
PCMCIA_BAD_SOCKET = 1,
PCMCIA_BAD_OFFSET = 2,
PCMCIA_ACCESS_ERROR =3
} PCMCIA_ACCESS_RESULT;
typedef struct
{
WD_PCI_SLOT pciSlot; // Pci bus, slot and function number.
PVOID pBuffer; // Buffer for read/write.
DWORD dwOffset; // Offset in pci configuration space to read/write from.
DWORD dwBytes; // Bytes to read/write from/to buffer.
// Returns the number of bytes read/written.
DWORD fIsRead; // If 1 then read pci config, 0 write pci config.
DWORD dwResult; // PCI_ACCESS_RESULT
} WD_PCI_CONFIG_DUMP, WD_PCI_CONFIG_DUMP_V30;
enum { WD_ISAPNP_CARDS = 16 };
enum { WD_ISAPNP_COMPATIBLE_IDS = 10 };
enum { WD_ISAPNP_COMP_ID_LENGTH = 7 }; // ISA compressed ID is 7 chars long.
enum { WD_ISAPNP_ANSI_LENGTH = 32 }; // ISA ANSI ID is limited to 32 chars long.
typedef CHAR WD_ISAPNP_COMP_ID[WD_ISAPNP_COMP_ID_LENGTH+1];
typedef CHAR WD_ISAPNP_ANSI[WD_ISAPNP_ANSI_LENGTH+1+3]; // Add 3 bytes for DWORD alignment.
typedef struct
{
WD_ISAPNP_COMP_ID cVendor; // Vendor ID.
DWORD dwSerial; // Serial number of card.
} WD_ISAPNP_CARD_ID;
typedef struct
{
WD_ISAPNP_CARD_ID cardId; // VendorID & serial number of cards found.
DWORD dwLogicalDevices; // Logical devices on the card.
BYTE bPnPVersionMajor; // ISA PnP version Major.
BYTE bPnPVersionMinor; // ISA PnP version Minor.
BYTE bVendorVersionMajor; // Vendor version Major.
BYTE bVendorVersionMinor; // Vendor version Minor.
WD_ISAPNP_ANSI cIdent; // Device identifier.
} WD_ISAPNP_CARD, WD_ISAPNP_CARD_V40;
typedef struct
{
WD_ISAPNP_CARD_ID searchId; // If searchId.cVendor[0]==0 - scan all vendor IDs.
// If searchId.dwSerial==0 - scan all serial numbers.
DWORD dwCards; // Number of cards found.
WD_ISAPNP_CARD Card[WD_ISAPNP_CARDS]; // Cards found.
} WD_ISAPNP_SCAN_CARDS, WD_ISAPNP_SCAN_CARDS_V40;
typedef struct
{
WD_ISAPNP_CARD_ID cardId; // VendorID and serial number of card.
DWORD dwLogicalDevice; // Logical device in card.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -