⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 windrvr.h

📁 一个用vc编写的基于串口的边界扫描测试源程序代码
💻 H
📖 第 1 页 / 共 5 页
字号:

    // 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;

enum
{ 
    INTERRUPT_STOPPED = 1,
    INTERRUPT_INTERRUPTED,
};

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 = 0x1,
    LICENSE_WD = 0x4,
    LICENSE_IO = 0x8,
    LICENSE_MEM = 0x10,
    LICENSE_INT = 0x20,
    LICENSE_PCI = 0x40,
    LICENSE_DMA = 0x80,
    LICENSE_NT = 0x100,
    LICENSE_95 = 0x200,
    LICENSE_ISAPNP = 0x400,
    LICENSE_PCMCIA = 0x800,
    LICENSE_PCI_DUMP = 0x1000,
    LICENSE_MSG_GEN = 0x2000,
    LICENSE_MSG_EDU = 0x4000,
    LICENSE_MSG_INT = 0x8000,
    LICENSE_KER_PLUG = 0x10000,
    LICENSE_LINUX = 0x20000,
    LICENSE_CE = 0x80000,
    LICENSE_VXWORKS = 0x10000000,
    LICENSE_THIS_PC = 0x100000,
    LICENSE_WIZARD = 0x200000,
    LICENSE_KD = 0x400000,
    LICENSE_SOLARIS = 0x800000,
    LICENSE_CPU0 = 0x40000,
    LICENSE_CPU1 = 0x1000000,
    LICENSE_CPU2 = 0x2000000,
    LICENSE_CPU3 = 0x4000000,
    LICENSE_USB = 0x8000000,
};

enum
{
    LICENSE2_EVENT = 0x8,
    LICENSE2_WDLIB = 0x10,
};

enum
{
    LICENSE_OS_WITH_WIZARD = LICENSE_95 | LICENSE_NT,
    LICENSE_OS_WITHOUT_WIZARD = LICENSE_LINUX | LICENSE_CE | LICENSE_VXWORKS | LICENSE_SOLARIS,
};

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,
};

#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 struct
{
    DWORD item; // ITEM_TYPE
    DWORD fNotSharable;
    DWORD dwContext; // Reserved for internal use
    DWORD dwPad1;    // Reserved for internal use
    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.
            DWORD dwUserDirectAddr;   // Returns the address for direct user read/write.
            DWORD dwCpuPhysicalAddr;  // Returns the CPU physical address of card.
            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, dw5, dw6;
        } 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.
} WD_PCI_SCAN_CARDS, WD_PCI_SCAN_CARDS_V30;

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.
    WD_ISAPNP_COMP_ID cLogicalDeviceId; // Logical device ID.
    DWORD dwCompatibleDevices;  // Number of compatible device IDs.
    WD_ISAPNP_COMP_ID CompatibleDevice[WD_ISAPNP_COMPATIBLE_IDS]; // Compatible device IDs.
    WD_ISAPNP_ANSI cIdent;      // Device identifier.
    WD_CARD Card;               // Get card parameters for the ISA PnP card.
} WD_ISAPNP_CARD_INFO, WD_ISAPNP_CARD_INFO_V40;

typedef enum
{
    ISAPNP_ACCESS_OK = 0,
    ISAPNP_ACCESS_ERROR = 1,
    ISAPNP_BAD_ID = 2,
} ISAPNP_ACCESS_RESULT;

typedef struct
{
    WD_ISAPNP_CARD_ID cardId; // VendorID and serial number of card.
    DWORD dwOffset;   // Offset in ISA PnP configuration space to read/write from.
    DWORD fIsRead;    // If 1 then read ISA PnP config, 0 write ISA PnP config.
    BYTE  bData;      // Result data of byte read/write.
    DWORD dwResult;   // ISAPNP_ACCESS_RESULT.
} WD_ISAPNP_CONFIG_DUMP, WD_ISAPNP_CONFIG_DUMP_V40;

// PCMCIA Card Services

// Extreme case - two PCMCIA slots and two multi-function (4 functions) cards
enum
{
    WD_PCMCIA_CARDS = 8,
    WD_PCMCIA_VERSION_LEN = 4,
    WD_PCMCIA_MANUFACTURER_LEN = 48,
    WD_PCMCIA_PRODUCTNAME_LEN = 48,
    WD_PCMCIA_MAX_SOCKET = 2,
    WD_PCMCIA_MAX_FUNCTION = 2,
};

typedef struct
{
    BYTE uBus;         // bus number (first bus is 0)
    BYTE uSocket;      // socket number (first socket is 0)
    BYTE uFunction;    // function number (first function is 0)
    BYTE uPadding;     // 1 byte padding so structure will be 4 bytes aligned
} WD_PCMCIA_SLOT, WD_PCMCIA_SLOT_V622;

typedef struct
{
    WORD wManufacturerId; // card manufacturer
    WORD wCardId;         // card type and model
} WD_PCMCIA_ID;

typedef struct
{
    WD_PCMCIA_ID searchId;           // device ID to search for
    DWORD dwCards;                   // number of cards found
    WD_PCMCIA_ID cardId[WD_PCMCIA_CARDS]; // device IDs of cards found
    WD_PCMCIA_SLOT cardSlot[WD_PCMCIA_CARDS]; // pcmcia slot info of cards found
    DWORD dwOptions;  // reserved for future use, set to 0
} WD_PCMCIA_SCAN_CARDS, WD_PCMCIA_SCAN_CARDS_V622;

typedef struct
{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -