////////////////////////////////////////////////////////////////////// // File - sli6_lib.h // // Library for accessing the SLI6 card, // Code was generated by DriverWizard v6.03 - http://www.jungo.com. // The library accesses the hardware via WinDriver functions. // // Copyright (c) 2003 Jungo Ltd. http://www.jungo.com // ////////////////////////////////////////////////////////////////////// #ifndef _SLI6_LIB_H_ #define _SLI6_LIB_H_ #include "windrvr.h" #include "windrvr_int_thread.h" #include "windrvr_events.h" #include "pci_regs.h" #include "bits.h" #include "sli6_conf.h" #ifdef __cplusplus extern "C" { #endif enum { SLI6_DEFAULT_VENDOR_ID = 0x1172 }; enum { SLI6_DEFAULT_DEVICE_ID = 0x3333 }; enum { SLI6_MODE_BYTE = 0, SLI6_MODE_WORD = 1, SLI6_MODE_DWORD = 2 }; typedef DWORD SLI6_MODE; enum { SLI6_AD_BAR0 = AD_PCI_BAR0, SLI6_AD_BAR1 = AD_PCI_BAR1, SLI6_AD_BAR2 = AD_PCI_BAR2, SLI6_AD_BAR3 = AD_PCI_BAR3, SLI6_AD_BAR4 = AD_PCI_BAR4, SLI6_AD_BAR5 = AD_PCI_BAR5, SLI6_AD_EPROM = AD_PCI_BAR_EPROM, }; typedef DWORD SLI6_ADDR; // Number of IO and memory ranges enum { SLI6_ITEMS = AD_PCI_BARS }; // SLI6 register definitions enum { SLI6_RegisterG_INT_EN_SPACE = SLI6_AD_BAR0 }; enum { SLI6_RegisterG_INT_EN_OFFSET = 0xc }; typedef struct SLI6_STRUCT *SLI6_HANDLE; typedef struct { DWORD dwCounter; // number of interrupts received DWORD dwLost; // number of interrupts yet to be handled BOOL fStopped; // was the interrupt disabled during wait } SLI6_INT_RESULT; typedef void (*SLI6_INT_HANDLER)(SLI6_HANDLE hSLI6, SLI6_INT_RESULT *intResult); // Function: SLI6_Open() // Register a PCI card that meets the given criteria to enable working with it. // The handle returned from this function is used by most of the functions in this file. BOOL SLI6_Open (SLI6_HANDLE *phSLI6, DWORD dwVendorID, DWORD dwDeviceID, DWORD nCardNum); // Function: SLI6_RegisterWinDriver() // Enter a license string into WinDriver module. void SLI6_RegisterWinDriver(); // Function: SLI6_Close() // Unregister an opened card. void SLI6_Close(SLI6_HANDLE hSLI6); // Function: SLI6_CountCards() // Count the number of PCI cards that meets the given criteria. DWORD SLI6_CountCards (DWORD dwVendorID, DWORD dwDeviceID); // Function: SLI6_IsAddrSpaceActive() // Check if the given address space is configured and active. BOOL SLI6_IsAddrSpaceActive(SLI6_HANDLE hSLI6, SLI6_ADDR addrSpace); // Function: SLI6_GetPciSlot() // Return the logical location (bus, slot and function) of the PCI card. void SLI6_GetPciSlot(SLI6_HANDLE hSLI6, WD_PCI_SLOT *pPciSlot); // General read/write functions // Function: SLI6_ReadWriteBlock() // Read/Write data from/to the card's memory/IO into/from a given buffer. void SLI6_ReadWriteBlock(SLI6_HANDLE hSLI6, SLI6_ADDR addrSpace, DWORD dwOffset, BOOL fRead, PVOID buf, DWORD dwBytes, SLI6_MODE mode); // Function: SLI6_ReadByte() // Read a Byte from the card's memory/IO. BYTE SLI6_ReadByte (SLI6_HANDLE hSLI6, SLI6_ADDR addrSpace, DWORD dwOffset); // Function: SLI6_ReadWord() // Read a Word from the card's memory/IO. WORD SLI6_ReadWord (SLI6_HANDLE hSLI6, SLI6_ADDR addrSpace, DWORD dwOffset); // Function: SLI6_ReadDword() // Read a Dword from the card's memory/IO. DWORD SLI6_ReadDword (SLI6_HANDLE hSLI6, SLI6_ADDR addrSpace, DWORD dwOffset); // Function: SLI6_WriteByte() // Write a Byte to the card's memory/IO. void SLI6_WriteByte (SLI6_HANDLE hSLI6, SLI6_ADDR addrSpace, DWORD dwOffset, BYTE data); // Function: SLI6_WriteWord() // Write a Word to the card's memory/IO. void SLI6_WriteWord (SLI6_HANDLE hSLI6, SLI6_ADDR addrSpace, DWORD dwOffset, WORD data); // Function: SLI6_WriteDword() // Write a Dword to the card's memory/IO. void SLI6_WriteDword (SLI6_HANDLE hSLI6, SLI6_ADDR addrSpace, DWORD dwOffset, DWORD data); // Interrupts handling functions // Function: SLI6_IntIsEnabled() // Check if the interrupt is enabled. BOOL SLI6_IntIsEnabled (SLI6_HANDLE hSLI6); // Function: SLI6_IntEnable() // Enable the interrupt. BOOL SLI6_IntEnable (SLI6_HANDLE hSLI6, SLI6_INT_HANDLER funcIntHandler); // Function: SLI6_IntDisable() // Disable the interrupt. void SLI6_IntDisable (SLI6_HANDLE hSLI6); // Access to PCI configuration registers // Function: SLI6_WritePCIReg() // Write a DWORD to the PCI configuration space. void SLI6_WritePCIReg(SLI6_HANDLE hSLI6, DWORD dwReg, DWORD dwData); // Function: SLI6_ReadPCIReg() // Read a DWORD from the PCI configuration space. DWORD SLI6_ReadPCIReg(SLI6_HANDLE hSLI6, DWORD dwReg); // Function: SLI6_RegisterEvent() // Register to receive Plug-and-Play and power notification events according to the given criteria. BOOL SLI6_RegisterEvent(SLI6_HANDLE hSLI6, DWORD dwAction, DWORD dwVendorID, DWORD dwDeviceID, WD_PCI_SLOT pciSlot, EVENT_HANDLER funcHandler); // Function: SLI6_UnregisterEvent() // Unregister events notification. void SLI6_UnregisterEvent(SLI6_HANDLE hSLI6); // If an error occurs, this string will be set to contain a relevant error message extern CHAR SLI6_ErrorString[]; #ifdef __cplusplus } #endif #endif