next up previous contents
Next: B.4 WDC Low Level Up: B. API Reference Previous: B.2 WDC Library Overview   Contents

Subsections


B.3 WDC High Level API

This section describes the WDC API defined in the WinDriver/include/wdc_lib.h header file.


B.3.1 Structures, Types and General Definitions


B.3.1.1 WDC_DEVICE_HANDLE

Handle to a WDC device information structure [B.4.3] type:

 typedef void * WDC_DEVICE_HANDLE;


B.3.1.2 WDC_DRV_OPEN_OPTIONS Definitions

typedef DWORD WDC_DRV_OPEN_OPTIONS;

Preprocessor definitions of flags that describe tasks to be performed when opening a handle to the WDC library (see WDC_DriverOpen() [B.3.2]):

Name Description
WDC_DRV_OPEN_CHECK_VER Compare the version of the WinDriver source files used by the code with the version of the loaded WinDriver kernel
WDC_DRV_OPEN_REG_LIC Register a WinDriver license registration string

The following preprocessor definitions provide convenient WDC driver open options, which can be passed to WDC_DriverOpen() [B.3.2]:

Name Description
WDC_DRV_OPEN_BASIC Instructs WDC_Driveropen() [B.3.2] to perform only the basic WDC open tasks, mainly open a handle to WinDriver's kernel module.

NOTE: The value of this option is zero (<=> no driver open flags), therefore this option cannot be combined with any of the other WDC driver open options.
WDC_DRV_OPEN_KP Convenience option when calling WDC_DriverOpen() [B.3.2] from the Kernel PlugIn. This option is equivalent to setting the WDC_DRV_OPEN_BASIC flag, which is the recommended option to set when opening a handle to the WDC library from the Kernel PlugIn.
WDC_DRV_OPEN_ALL A convenience mask of all the basic WDC driver open flags - WDC_DRV_OPEN_CHECK_VER and WDC_DRV_OPEN_REG_REG_LIC. (The basic functionality of opening a handle to WinDriver's kernel module is always performed by WDC_DriverOpen() [B.3.2], so there is no need to also set the WDC_DRV_OPEN_BASIC flag).
WDC_DRV_OPEN_DEFAULT Use the default WDC open options:
\bgroup\color{NavyBlue}$\bullet$\egroupFor user-mode applications: equivalent to setting WDC_DRV_OPEN_ALL ;
\bgroup\color{NavyBlue}$\bullet$\egroupFor a Kernel PlugIn: equivalent to setting WDC_DRV_OPEN_KP


B.3.1.3 WDC_DIRECTION Enumeration

Enumeration of a device's address/register access directions:

Enum Value Description
WDC_READ Read from the address
WDC_WRITE Write to the address
WDC_READ_WRITE Read from the address or write to it.
This value is used, for example, in the WinDriver samples and generated DriverWizard diagnostics code in order to describe a register's access mode, indicating that the register can either be read from or written to.


B.3.1.4 WDC_ADDR_MODE Enumeration

Enumeration of memory or I/O addresses/registers read/write modes.
The enumeration values are used to determine whether a memory or I/O address/register is read/written in multiples of 8, 16, 32 or 64 bits (i.e. 1, 2, 4 or 8 bytes).

Enum Value Description
WDC_MODE_8 8 bits (1 byte) mode
WDC_MODE_16 16 bits (2 bytes) mode
WDC_MODE_32 32 bits (4 bytes) mode
WDC_MODE_64 64 bits (8 bytes) mode


B.3.1.5 WDC_ADDR_RW_OPTIONS Enumeration

Enumeration of flags that are used to determine how a memory or I/O address will be read/written:

Enum Value Description
WDC_RW_OPT_DEFAULT Use the default read/write options: memory addresses are accessed directly from the calling process; block transfers are performed from subsequent addresses (automatic increment).

NOTE: The value of this flag is zero (<=> no read/write flags), therefore it can not be combined in a bit-mask with any of the other read/write options flags.

This option is used by the WDC_ReadAddr8/16/32/64() [B.3.20] and WDC_WriteAddr8/16/32/64() [B.3.21] functions.
WDC_ADDR_RW_NO_AUTOINC Do no automatically increment the read/write address in block transfers, i.e. hold the device address constant while reading/writing a block of memory or I/O addresses (relevant only for block (string) transfers).


B.3.1.6 WDC_ADDR_SIZE Definitions

typedef DWORD WDC_ADDR_SIZE;

Preprocessor definitions that depict memory or I/O address/register sizes:

Name Description
WDC_SIZE_8 8 bits (1 byte)
WDC_SIZE_16 16 bits (2 bytes)
WDC_SIZE_32 32 bits (4 bytes)
WDC_SIZE_64 64 bits (8 bytes)


B.3.1.7 WDC_SLEEP_OPTIONS Definitions

typedef DWORD WDC_SLEEP_OPTIONS;

Preprocessor definitions depict the sleep options that can be passed to WDC_Sleep() [B.3.55]:

Name Description
WDC_SLEEP_BUSY Perform busy sleep (consumes the CPU)
WDC_SLEEP_NON_BUSY Perform non-busy sleep (does not consume the CPU)


B.3.1.8 WDC_DBG_OPTIONS Definitions

typedef DWORD WDC_DBG_OPTIONS;

Preprocessor definitions that depict the possible debug options for the WDC library, which are passed to WDC_SetDebugOptions() [B.3.49].

The following flags determine the output file for the WDC library's debug messages:

Name Description
WDC_DBG_OUT_DBM Send debug messages from the WDC library to the Debug Monitor [6.2]
WDC_DBG_OUT_FILE Send debug messages from the WDC library to a debug file. By default, the debug file will be stderr, unless a different file is set in the sDbgFile parameter of the WDC_SetDebugOptions() function [B.3.49].
This option is only supported from the user mode (as opposed to the Kernel PlugIn).

The following flags determine the debug level - i.e. what type of WDC debug messages to display, if at all:

Name Description
WDC_DBG_LEVEL_ERR Display only WDC error debug messages
WDC_DBG_LEVEL_TRACE Display both error and trace WDC debug messages
WDC_DBG_NONE Do not display WDC debug messages

The following preprocessor definitions provide convenient debug flags combinations, which can be passed to WDC_SetDebugOptions() [B.3.49]:

\bgroup\color{NavyBlue}$\bullet$\egroupUser-mode and Kernel PlugIn convenience debug options:

Name Description
WDC_DBG_DEFAULT WDC_DBG_OUT_DBM | WDC_DBG_LEVEL_TRACE :
Use the default debug options - send WDC error and trace messages to the Debug Monitor [6.2]
WDC_DBG_DBM_ERR WDC_DBG_OUT_DBM | WDC_DBG_LEVEL_ERR :
Send WDC error debug messages to the Debug Monitor [6.2]
WDC_DBG_DBM_TRACE WDC_DBG_OUT_DBM | WDC_DBG_LEVEL_TRACE :
Send WDC error and trace debug messages to the Debug Monitor [6.2]
WDC_DBG_FULL Full WDC debugging:
\bgroup\color{NavyBlue}$\bullet$\egroupFrom the user mode:
WDC_DBG_OUT_DBM | WDC_DBG_OUT_FILE | WDC_DBG_LEVEL_TRACE :
Send WDC error and trace debug messages both to the Debug Monitor [6.2] and to a debug output file (default file: stderr)
\bgroup\color{NavyBlue}$\bullet$\egroupFrom the Kernel PlugIn:
WDC_DBG_OUT_DBM | WDC_DBG_LEVEL_TRACE :
Send WDC error and trace messages to the Debug Monitor [6.2]

\bgroup\color{NavyBlue}$\bullet$\egroupUser-mode only convenience debug options:

Name Description
WDC_DBG_FILE_ERR WDC_DBG_OUT_FILE | WDC_DBG_LEVEL_ERR :
Send WDC error debug messages to a debug file (default file: stderr)
WDC_DBG_FILE_TRACE WDC_DBG_OUT_FILE | WDC_DBG_LEVEL_TRACE :
Send WDC error and trace debug messages to a debug file (default file: stderr)
WDC_DBG_DBM_FILE_ERR WDC_DBG_OUT_DBM | WDC_DBG_OUT_FILE | WDC_DBG_LEVEL_ERR :
Send WDC error debug messages both to the Debug Monitor [6.2] and to a debug file (default file: stderr)
WDC_DBG_DBM_FILE_TRACE WDC_DBG_OUT_DBM | WDC_DBG_OUT_FILE | WDC_DBG_LEVEL_TRACE :
Send WDC error and trace debug messages both to the Debug Monitor [6.2] and to a debug file (default file: stderr)


B.3.1.9 WDC_SLOT_U Union

WDC PCI/PCMCIA device location information union type:

Name Type Description
\bgroup\color{NavyBlue}$\bullet$\egroup pciSlot WD_PCI_SLOT PCI device location information structure [B.5.8]
\bgroup\color{NavyBlue}$\bullet$\egroup pcmciaSlot WD_PCMCIA_SLOT PCMCIA device location information structure [B.5.9]


B.3.1.10 WDC_PCI_SCAN_RESULT Structure

Structure type for holding the results of a PCI bus scan (see WDC_PciScanDevices() [B.3.4]):

Name Type Description
\bgroup\color{NavyBlue}$\bullet$\egroup dwNumDevices DWORD Number of devices found on the PCI bus that match the search criteria (vendor & device IDs)
\bgroup\color{NavyBlue}$\bullet$\egroup deviceId WD_PCI_ID[WD_PCI_CARDS] Array of matching vendor and device IDs found on the PCI bus [B.5.6]
\bgroup\color{NavyBlue}$\bullet$\egroup deviceSlot WD_PCI_SLOT[WD_PCI_CARDS] Array of PCI device location information structures [B.5.8] for the detected devices matching the search criteria


B.3.1.11 WDC_PCMCIA_SCAN_RESULT Structure

Structure type for holding the results of a PCMCIA bus scan (see WDC_PcmciaScanDevices() [B.3.6]):

Name Type Description
\bgroup\color{NavyBlue}$\bullet$\egroup dwNumDevices DWORD Number of devices found on the PCMCIA bus that match the search criteria (manufacturer & device IDs)
\bgroup\color{NavyBlue}$\bullet$\egroup deviceId WD_PCMCIA_ID[WD_PCMCIA_CARDS] Array of matching vendor and device IDs found on the PCMCIA bus [B.5.7]
\bgroup\color{NavyBlue}$\bullet$\egroup deviceSlot WD_PCMCIA_SLOT[WD_PCMCIA_CARDS] Array of PCMCIA device location information structures [B.5.9] for the detected devices matching the search criteria


B.3.2 WDC_DriverOpen()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupOpens and stores a handle to WinDriver's kernel module and initializes the WDC library according to the open options passed to it.
This function should be called once before calling any other WDC API.


PROTOTYPE

DWORD DLLCALLCONV WDC_DriverOpen(
    WDC_DRV_OPEN_OPTIONS openOptions,
    const CHAR *sLicense);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupopenOptions WDC_DRV_OPEN_OPTIONS Input
\bgroup\color{NavyBlue}$\bullet$\egroupsLicense const CHAR* Input


DESCRIPTION

Name Description
openOptions A mask of any of the supported open flags [B.3.1.2], which determines the initialization actions that will be performed by the function.
sLicense WinDriver license registration string.
This argument is ignored if the WDC_DRV_OPEN_REG_LIC flag is not [B.3.1.2] set in the openOptions argument.
If this parameter is a NULL pointer or an empty string, the function will attempt to register the demo WinDriver evaluation license. Therefore, when evaluating WinDriver pass NULL as this parameter. After registering your WinDriver toolkit, modify the code to pass your WinDriver license registration string.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.3 WDC_DriverClose()

\bgroup\color{NavyBlue}$\bullet$\egroupCloses the WDC WinDriver handle (acquired and stored by a previous call to WDC_DriverOpen() [B.3.2]) and un-initializes the WDC library.

Every WDC_DriverOpen() call should have a matching WDC_DriverClose() call, which should be issued when you no longer need to use the WDC library.


PROTOTYPE

DWORD DLLCALLCONV WDC_DriverClose(void);


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.4 WDC_PciScanDevices()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupScans the PCI bus for all devices with the specified vendor and device ID combination and returns information regarding the matching devices that were found and their location.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciScanDevices(
    DWORD dwVendorId,
    DWORD dwDeviceId,
    WDC_PCI_SCAN_RESULT *pPciScanResult);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupdwVendorId DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwDeviceId DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppPciScanResult WDC_PCI_SCAN_RESULT* Output


DESCRIPTION

Name Description
dwVendorId Vendor ID to search for (hexadecimal).
Zero (0) - all vendor IDs.
dwDeviceId Device ID to search for (hexadecimal).
Zero (0) - all device IDs.
pPciScanResult A pointer to a structure that will be updated by the function with the results of the PCI bus scan [B.3.1.10]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.5 WDC_PciScanDevicesByTopology()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupScans the PCI bus for all devices with the specified vendor and device ID combination and returns information regarding the matching devices that were found and their location. The function performs a scan by topology.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciScanDevicesByTopology(
    DWORD dwVendorId,
    DWORD dwDeviceId,
    WDC_PCI_SCAN_RESULT *pPciScanResult);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupdwVendorId DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwDeviceId DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppPciScanResult WDC_PCI_SCAN_RESULT* Output


DESCRIPTION

Name Description
dwVendorId Vendor ID to search for (hexadecimal).
Zero (0) - all vendor IDs.
dwDeviceId Device ID to search for (hexadecimal).
Zero (0) - all device IDs.
pPciScanResult A pointer to a structure that will be updated by the function with the results of the PCI bus scan [B.3.1.10]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.6 WDC_PcmciaScanDevices()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupScans the PCMCIA bus for all devices with the specified manufacturer and device ID combination and returns information regarding the matching devices that were found and their location.


PROTOTYPE

DWORD DLLCALLCONV WDC_PcmciaScanDevices(
    WORD wManufacturerId,
    WORD wDeviceId,
    WDC_PCMCIA_SCAN_RESULT *pPcmciaScanResult);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupwManufacturerId WORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupwDeviceId WORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppPcmciaScanResult WDC_PCMCIA_SCAN_RESULT* Output


DESCRIPTION

Name Description
wManufacturerId Manufacturer ID to search for (hexadecimal).
Zero (0) - all manufacturer IDs.
wDeviceId Device ID to search for (hexadecimal).
Zero (0) - all device IDs.
pPcmciaScanResult A pointer to a structure that will be updated by the function with the results of the PCMCIA bus scan [B.3.1.11]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.7 WDC_PciGetDeviceInfo()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupRetrieves a PCI device's resources information (memory and I/O ranges and interrupt information).


PROTOTYPE

DWORD DLLCALLCONV WDC_PciGetDeviceInfo(
    WD_PCI_CARD_INFO *pDeviceInfo);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppDeviceInfo WD_PCI_CARD_INFO* Input/Output
\bgroup\color{NavyBlue}$\gg$\egroup pciSlot WD_PCI_SLOT Input
\bgroup\color{NavyBlue}$\gg$\egroup Card WD_CARD Output


DESCRIPTION

Name Description
pDeviceInfo Pointer to a PCI device information structure [B.5.11]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.8 WDC_PcmciaGetDeviceInfo()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupRetrieves a PCMCIA device's resources information (memory and I/O ranges and interrupt information).


PROTOTYPE

DWORD DLLCALLCONV WDC_PcmciaGetDeviceInfo(
    WD_PCMCIA_CARD_INFO *pDeviceInfo);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppDeviceInfo WD_PCMCIA_CARD_INFO* Input/Output
\bgroup\color{NavyBlue}$\gg$\egroup pcmciaSlot WD_PCMCIA_SLOT Input
\bgroup\color{NavyBlue}$\gg$\egroup Card WD_CARD Output
\bgroup\color{NavyBlue}$\gg$\egroup cVersion CHAR
Output
\bgroup\color{NavyBlue}$\gg$\egroup cManufacturer CHAR [WD_PCMCIA_
MANUFACTURER_LEN]
Output
\bgroup\color{NavyBlue}$\gg$\egroup cProductName CHAR [WD_PCMCIA_
PRODUCTNAME_LEN]
Output
\bgroup\color{NavyBlue}$\gg$\egroup wManufacturerId WORD Output
\bgroup\color{NavyBlue}$\gg$\egroup wCardId WORD Output
\bgroup\color{NavyBlue}$\gg$\egroup wFuncId WORD Output


DESCRIPTION

Name Description
pDeviceInfo Pointer to a PCMCIA device information structure [B.5.12]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.9 WDC_PciDeviceOpen()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupAllocates and initializes a WDC PCI device structure, registers the device with WinDriver, and returns a handle to the device.

Among the operations performed by this function:

\bgroup\color{NavyBlue}$\bullet$\egroupVerifies that a non-shareable memory or I/O resource on the device has not already been registered exclusively.

\bgroup\color{NavyBlue}$\bullet$\egroupMaps the physical memory ranges found on the device both to kernel-mode and user-mode address space, and stores the mapped addresses in the allocated device structure for future use.

\bgroup\color{NavyBlue}$\bullet$\egroupSaves device resources information required for supporting the communication with the device. For example, the function saves the Interrupt Request (IRQ) number and the interrupt type (should be level sensitive for PCI), as well as retrieves and saves an interrupt handle, which are later used when the user calls functions to handle the device's interrupts.

\bgroup\color{NavyBlue}$\bullet$\egroupIf the caller selects to use a Kernel PlugIn driver to communicate with the device, the function opens a handle to this driver and stores it for future use.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciDeviceOpen(
    WDC_DEVICE_HANDLE *phDev,
    const WD_PCI_CARD_INFO *pDeviceInfo,
    const PVOID pDevCtx,
    PVOID reserved,
    const CHAR *pcKPDriverName,
    PVOID pKPOpenData);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroup phDev WDC_DEVICE_HANDLE* Output
\bgroup\color{NavyBlue}$\bullet$\egroup pDeviceInfo const WD_PCI_CARD_INFO* Input
\bgroup\color{NavyBlue}$\gg$\egroup pciSlot WD_PCI_SLOT Input
\bgroup\color{NavyBlue}$\gg$\egroup Card WD_CARD Input
\bgroup\color{NavyBlue}$\diamond$\egroup dwItems DWORD Input
\bgroup\color{NavyBlue}$\diamond$\egroup Item WD_ITEMS[WD_CARD_ITEMS] Input
\bgroup\color{NavyBlue}$\triangleright$\egroup item DWORD Input
\bgroup\color{NavyBlue}$\triangleright$\egroup fNotSharable DWORD Input
\bgroup\color{NavyBlue}$\triangleright$\egroup I union Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup Mem struct Input
\bgroup\color{NavyBlue}$\star$\egroup dwPhysicalAddr DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwBytes DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwTransAddr DWORD N/A
\bgroup\color{NavyBlue}$\star$\egroup dwUserDirectAddr DWORD N/A
\bgroup\color{NavyBlue}$\star$\egroup dwCpuPhysicalAddr DWORD N/A
\bgroup\color{NavyBlue}$\star$\egroup dwBar DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup IO struct Input
\bgroup\color{NavyBlue}$\star$\egroup dwAddr DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwBytes DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwBar DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup Int struct Input
\bgroup\color{NavyBlue}$\star$\egroup dwInterrupt DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwOptions DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup hInterrupt DWORD N/A
\bgroup\color{NavyBlue}$\rightarrow$\egroup Bus struct Input
\bgroup\color{NavyBlue}$\star$\egroup dwBusType WD_BUS_TYPE Input
\bgroup\color{NavyBlue}$\star$\egroup dwBusNum DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwSlotFunc DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup Val struct N/A
\bgroup\color{NavyBlue}$\bullet$\egrouppDevCtx const PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupreserved PVOID  
\bgroup\color{NavyBlue}$\bullet$\egrouppcKPDriverName const CHAR* Input
\bgroup\color{NavyBlue}$\bullet$\egrouppKPOpenData PVOID Input


DESCRIPTION

Name Description
phDev Pointer to a handle to the WDC device allocated by the function
pDeviceInfo Pointer to a PCI device information structure [B.5.11], which contains information regarding the device to open
pDevCtx Pointer to device context information, which will be stored in the device structure
reserved Reserved for future use
pcKPDriverName Kernel PlugIn driver name.
If your application does not use a Kernel PlugIn driver, pass a NULL pointer for this argument.
pKPOpenData Kernel PlugIn driver open data to be passed to WD_KernelPlugInOpen() (see the WinDriver PCI Low-Level API Reference).
If your application does not use a Kernel PlugIn driver, pass a NULL pointer for this argument.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.10 WDC_PcmciaDeviceOpen()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupAllocates and initializes a WDC PCMCIA device structure, registers the device with WinDriver, and returns a handle to the device.

Among the operations performed by this function:

\bgroup\color{NavyBlue}$\bullet$\egroupVerifies that a non-shareable memory or I/O resource on the device has not already been registered exclusively.

\bgroup\color{NavyBlue}$\bullet$\egroupMaps the device's physical memory ranges device both to kernel-mode and user-mode address space, and stores the mapped addresses in the allocated device structure for future use.

\bgroup\color{NavyBlue}$\bullet$\egroupSaves device resources information required for supporting future communication with the device. For example, the function saves the Interrupt Request (IRQ) number and the interrupt type (edge-triggered / level sensitive), as well as retrieves and saves an interrupt handle, which are later used when the user calls functions to handle the device's interrupts.

\bgroup\color{NavyBlue}$\bullet$\egroupIf the caller selects to use a Kernel PlugIn driver to communicate with the device, the function opens a handle to this driver and stores it for future use.


PROTOTYPE

DWORD DLLCALLCONV WDC_PcmciaDeviceOpen(
    WDC_DEVICE_HANDLE *phDev,
    const WD_PCMCIA_CARD_INFO *pDeviceInfo,
    const PVOID pDevCtx,
    PVOID reserved,
    const CHAR *pcKPDriverName,
    PVOID pKPOpenData);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroup phDev WDC_DEVICE_HANDLE* Output
\bgroup\color{NavyBlue}$\bullet$\egroup pDeviceInfo const WD_PCMCIA_CARD_INFO* Input
\bgroup\color{NavyBlue}$\gg$\egroup pcmciaSlot WD_PCMCIA_SLOT Input
\bgroup\color{NavyBlue}$\gg$\egroup Card WD_CARD Input
\bgroup\color{NavyBlue}$\diamond$\egroup dwItems DWORD Input
\bgroup\color{NavyBlue}$\diamond$\egroup Item WD_ITEMS[WD_CARD_ITEMS] Input
\bgroup\color{NavyBlue}$\triangleright$\egroup item DWORD Input
\bgroup\color{NavyBlue}$\triangleright$\egroup fNotSharable DWORD Input
\bgroup\color{NavyBlue}$\triangleright$\egroup I union Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup Mem struct Input
\bgroup\color{NavyBlue}$\star$\egroup dwPhysicalAddr DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwBytes DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwTransAddr DWORD N/A
\bgroup\color{NavyBlue}$\star$\egroup dwUserDirectAddr DWORD N/A
\bgroup\color{NavyBlue}$\star$\egroup dwCpuPhysicalAddr DWORD N/A
\bgroup\color{NavyBlue}$\star$\egroup dwBar DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup IO struct Input
\bgroup\color{NavyBlue}$\star$\egroup dwAddr DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwBytes DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwBar DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup Int struct N/A
\bgroup\color{NavyBlue}$\star$\egroup dwInterrupt DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwOptions DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup hInterrupt DWORD N/A
\bgroup\color{NavyBlue}$\rightarrow$\egroup Bus struct Input
\bgroup\color{NavyBlue}$\star$\egroup dwBusType WD_BUS_TYPE Input
\bgroup\color{NavyBlue}$\star$\egroup dwBusNum DWORD Input
\bgroup\color{NavyBlue}$\star$\egroup dwSlotFunc DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup Val struct N/A
\bgroup\color{NavyBlue}$\gg$\egroup cVersion CHAR
Input
\bgroup\color{NavyBlue}$\gg$\egroup cManufacturer CHAR [WD_PCMCIA_
MANUFACTURER_LEN]
Input
\bgroup\color{NavyBlue}$\gg$\egroup cProductName CHAR [WD_PCMCIA_
PRODUCTNAME_LEN]
Input
\bgroup\color{NavyBlue}$\gg$\egroup wManufacturerId WORD Input
\bgroup\color{NavyBlue}$\gg$\egroup wCardId WORD Input
\bgroup\color{NavyBlue}$\gg$\egroup wFuncId WORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppDevCtx const PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupreserved PVOID  
\bgroup\color{NavyBlue}$\bullet$\egrouppcKPDriverName const CHAR* Input
\bgroup\color{NavyBlue}$\bullet$\egrouppKPOpenData PVOID Input


DESCRIPTION

Name Description
phDev Pointer to a handle to the WDC device allocated by the function
pDeviceInfo Pointer to a PCMCIA device information structure [B.5.12], which contains information regarding the device to open
pDevCtx Pointer to device context information, which will be stored in the device structure
reserved Reserved for future use
pcKPDriverName Kernel PlugIn driver name.
If your application does not use a Kernel PlugIn driver, pass a NULL pointer for this argument.
pKPOpenData Kernel PlugIn driver open data to be passed to WD_KernelPlugInOpen() (see the WinDriver PCI Low-Level API Reference).
If your application does not use a Kernel PlugIn driver, pass a NULL pointer for this argument.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.11 WDC_IsaDeviceOpen()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupAllocates and initializes a WDC ISA device structure, registers the device with WinDriver, and returns a handle to the device.

Among the operations performed by this function:

\bgroup\color{NavyBlue}$\bullet$\egroupVerifies that a non-shareable memory or I/O resource on the device has not already been registered exclusively.

\bgroup\color{NavyBlue}$\bullet$\egroupMaps the device's physical memory ranges device both to kernel-mode and user-mode address space, and stores the mapped addresses in the allocated device structure for future use.

\bgroup\color{NavyBlue}$\bullet$\egroupSaves device resources information required for supporting future communication with the device. For example, the function saves the Interrupt Request (IRQ) number and the interrupt type (edge-triggered / level sensitive), as well as retrieves and saves an interrupt handle, which are later used when the user calls functions to handle the device's interrupts.

\bgroup\color{NavyBlue}$\bullet$\egroupIf the caller selects to use a Kernel PlugIn driver to communicate with the device, the function opens a handle to this driver and stores it for future use.


PROTOTYPE

DWORD DLLCALLCONV WDC_IsaDeviceOpen(
    WDC_DEVICE_HANDLE *phDev,
    const WD_CARD *pDeviceInfo,
    const PVOID pDevCtx,
    PVOID reserved,
    const CHAR *pcKPDriverName,
    PVOID pKPOpenData);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroup phDev WDC_DEVICE_HANDLE* Output
\bgroup\color{NavyBlue}$\bullet$\egroup pDeviceInfo const WD_CARD* Input
\bgroup\color{NavyBlue}$\gg$\egroup dwItems DWORD Input
\bgroup\color{NavyBlue}$\gg$\egroup Item WD_ITEMS[WD_CARD_ITEMS] Input
\bgroup\color{NavyBlue}$\diamond$\egroup item DWORD Input
\bgroup\color{NavyBlue}$\diamond$\egroup fNotSharable DWORD Input
\bgroup\color{NavyBlue}$\diamond$\egroup dwOptions DWORD Input
\bgroup\color{NavyBlue}$\diamond$\egroup I union Input
\bgroup\color{NavyBlue}$\triangleright$\egroup Mem struct Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwPhysicalAddr DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwBytes DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwTransAddr DWORD N/A
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwUserDirectAddr DWORD N/A
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwCpuPhysicalAddr DWORD N/A
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwBar DWORD Input
\bgroup\color{NavyBlue}$\triangleright$\egroup IO struct Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwAddr DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwBytes DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwBar DWORD Input
\bgroup\color{NavyBlue}$\triangleright$\egroup Int struct Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwInterrupt DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwOptions DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup hInterrupt DWORD N/A
\bgroup\color{NavyBlue}$\triangleright$\egroup Bus struct Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwBusType WD_BUS_TYPE Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwBusNum DWORD Input
\bgroup\color{NavyBlue}$\rightarrow$\egroup dwSlotFunc DWORD Input
\bgroup\color{NavyBlue}$\triangleright$\egroup Val struct N/A
\bgroup\color{NavyBlue}$\bullet$\egrouppDevCtx const PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupreserved PVOID N/A
\bgroup\color{NavyBlue}$\bullet$\egrouppcKPDriverName const CHAR* Input
\bgroup\color{NavyBlue}$\bullet$\egrouppKPOpenData PVOID Input


DESCRIPTION

Name Description
phDev Pointer to a handle to the WDC device allocated by the function
pDeviceInfo Pointer to a card information structure [B.5.10], which contains information regarding the device to open
pDevCtx Pointer to device context information, which will be stored in the device structure
reserved Reserved for future use
pcKPDriverName Kernel PlugIn driver name.
If your application does not use a Kernel PlugIn driver, pass a NULL pointer for this argument.
pKPOpenData Kernel PlugIn driver open data to be passed to WD_KernelPlugInOpen() (see the WinDriver PCI Low-Level API Reference).
If your application does not use a Kernel PlugIn driver, pass a NULL pointer for this argument.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.12 WDC_PciDeviceClose()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupUn-initializes a WDC PCI device structure and frees the memory allocated for it.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciDeviceClose(WDC_DEVICE_HANDLE hDev);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input


DESCRIPTION

Name Description
hDev Handle to a WDC PCI device structure, returned by WDC_PciDeviceOpen() [B.3.9]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.13 WDC_PcmciaDeviceClose()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupUn-initializes a WDC PCMCIA device structure and frees the memory allocated for it.


PROTOTYPE

DWORD DLLCALLCONV WDC_PcmciaDeviceClose(WDC_DEVICE_HANDLE hDev);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input


DESCRIPTION

Name Description
hDev Handle to a WDC PCMCIA device structure, returned by WDC_PcmciaDeviceOpen() [B.3.10]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.14 WDC_IsaDeviceClose()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupUn-initializes a WDC ISA device structure and frees the memory allocated for it.


PROTOTYPE

DWORD DLLCALLCONV WDC_IsaDeviceClose(WDC_DEVICE_HANDLE hDev);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input


DESCRIPTION

Name Description
hDev Handle to a WDC ISA device structure, returned by WDC_IsaDeviceOpen() [B.3.11]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.15 WDC_CardCleanupSetup()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupSets a list of transfer cleanup commands to be performed for the specified card on any of the following occasions:


PROTOTYPE

DWORD WDC_CardCleanupSetup(
    WDC_DEVICE_HANDLE hDev,
    WD_TRANSFER *Cmd,
    DWORD dwCmds,
    BOOL bForceCleanup);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroup hDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroup Cmd WD_TRANSFER* Input
\bgroup\color{NavyBlue}$\bullet$\egroup dwCmds DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroup bForceCleanup BOOL Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
Cmd Pointer to an array of cleanup transfer commands to be performed [B.5.14]
dwCmds Number of cleanup commands in the Cmd array
bForceCleanup If FALSE: The cleanup transfer commands (Cmd) will be performed in either of the following cases:
\bgroup\color{NavyBlue}$\bullet$\egroupWhen the application exist abnormally.
\bgroup\color{NavyBlue}$\bullet$\egroupWhen the application exits normally without closing the card by calling the relevant WDC_xxxDeviceClose() function (PCI [B.3.12] / PCMCIA [B.3.13] / ISA [B.3.14]).

If TRUE: The cleanup transfer commands will be performed both in the two cases described above, as well as in the following case:
\bgroup\color{NavyBlue}$\bullet$\egroupWhen the relevant WD_xxxDeviceClose() function is called for the card.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.16 WDC_KernelPlugInOpen()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupOpens a handle to a Kernel PlugIn driver.


PROTOTYPE

DWORD DLLCALLCONV WDC_KernelPlugInOpen(
    WDC_DEVICE_HANDLE hDev,
    const CHAR *pcKPDriverName,
    PVOID pKPOpenData);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppcKPDriverName const CHAR* Input
\bgroup\color{NavyBlue}$\bullet$\egrouppKPOpenData PVOID Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
pcKPDriverName Kernel PlugIn driver name
pKPOpenData Kernel PlugIn driver open data to be passed to WD_KernelPlugInOpen() (see the WinDriver PCI Low-Level API Reference)


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.17 WDC_CallKerPlug()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupSends a message from a user-mode application to a Kernel PlugIn driver. The function passes a message ID from the application to the Kernel PlugIn's KP_Call() [B.6.4] function, which should be implemented to handle the specified message ID, and returns the result from the Kernel PlugIn to the user-mode application.


PROTOTYPE

DWORD DLLCALLCONV WDC_CallKerPlug(
    WDC_DEVICE_HANDLE hDev,
    DWORD dwMsg,
    PVOID pData,
    PDWORD pdwResult);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwMsg DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppdwResult pdwResult Output


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
dwMsg A message ID to pass to the Kernel PlugIn driver (specifically to KP_Call() [B.6.4])
pData Pointer to data to pass between the Kernel PlugIn driver and the user-mode application
pdwResult Result returned by the Kernel PlugIn driver (KP_Call()) for the operation performed in the kernel as a result of the message that was sent


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.18 WDC_ReadMemXXX()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWDC_ReadMem8/16/32/64() reads 1 byte (8 bits) / 2 bytes (16 bits) / 4 bytes (32 bits) / 8 bytes (64 bits), respectively, from a specified memory address. The address is read directly in the calling context (user mode / kernel mode).


PROTOTYPE

BYTE WDC_ReadMem8(addr, off);
WORD WDC_ReadMem16(addr, off);
UINT32 WDC_ReadMem32(addr, off);
UINT64 WDC_ReadMem64(addr, off);
Note: The WDC_ReadMemXXX APIs are implemented as macros. The prototypes above use functions declaration syntax to emphasize the expected return values.


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupaddr DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupoff DWORD Input


DESCRIPTION

Name Description
addr The memory address space to read from
off The offset from the beginning of the specified address space (addr) to read from


RETURN VALUE

Returns the data that was read from the specified address.


B.3.19 WDC_WriteMemXXX()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWDC_WriteMem8/16/32/64() writes 1 byte (8 bits) / 2 bytes (16 bits) / 4 bytes (32 bits) / 8 bytes (64 bits), respectively, to a specified memory address. The address is written to directly in the calling context (user mode / kernel mode).


PROTOTYPE

void WDC_WriteMem8(addr, off, val);
void WDC_WriteMem16(addr, off, val);
void WDC_WriteMem32(addr, off, val);
void WDC_WriteMem64(addr, off, val);
Note: The WDC_WriteMemXXX APIs are implemented as macros. The prototypes above use functions declaration syntax to emphasize the expected return values.


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupaddr DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupoff DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupval BYTE / WORD /
UINT32 / UINT64
Input


DESCRIPTION

Name Description
addr The memory address space to read from
off The offset from the beginning of the specified address space (addr) to read from
val The data to write to the specified address


RETURN VALUE

None


B.3.20 WDC_ReadAddrXXX()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWDC_ReadAddr8/16/32/64() reads 1 byte (8 bits) / 2 bytes (16 bits) / 4 bytes (32 bits) / 8 bytes (64 bits), respectively, from a specified memory or I/O address.


PROTOTYPE

DWORD DLLCALLCONV WDC_ReadAddr8(WDC_DEVICE_HANDLE hDev,
    DWORD dwAddrSpace, KPTR dwOffset, BYTE *val);

DWORD DLLCALLCONV WDC_ReadAddr16(WDC_DEVICE_HANDLE hDev, DWORD dwAddrSpace, KPTR dwOffset, WORD *val);

DWORD DLLCALLCONV WDC_ReadAddr32(WDC_DEVICE_HANDLE hDev, DWORD dwAddrSpace, KPTR dwOffset, UINT32 *val);

DWORD DLLCALLCONV WDC_ReadAddr64(WDC_DEVICE_HANDLE hDev, DWORD dwAddrSpace, KPTR dwOffset, UINT64 *val);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwAddrSpace DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset KPTR Input
\bgroup\color{NavyBlue}$\bullet$\egroupval BYTE* / WORD* /
UINT32* / UINT64*
Output


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
dwAddrSpace The memory or I/O address space to read from
dwOffset The offset from the beginning of the specified address space (dwAddrSpace) to read from
val Pointer to a buffer to be filled with the data that is read from the specified address


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.21 WDC_WriteAddrXXX()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWDC_WriteAddr8/16/32/64() writes 1 byte (8 bits) / 2 bytes (16 bits) / 4 bytes (32 bits) / 8 bytes (64 bits), respectively, to a specified memory or I/O address.


PROTOTYPE

DWORD DLLCALLCONV WDC_WriteAddr8(WDC_DEVICE_HANDLE hDev,
    DWORD dwAddrSpace, KPTR dwOffset, BYTE val)

DWORD DLLCALLCONV WDC_WriteAddr16(WDC_DEVICE_HANDLE hDev, DWORD dwAddrSpace, KPTR dwOffset, WORD val);

DWORD DLLCALLCONV WDC_WriteAddr32(WDC_DEVICE_HANDLE hDev, DWORD dwAddrSpace, KPTR dwOffset, UINT32 val);

DWORD DLLCALLCONV WDC_WriteAddr64(WDC_DEVICE_HANDLE hDev, DWORD dwAddrSpace, KPTR dwOffset, UINT64 val);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwAddrSpace DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset KPTR Input
\bgroup\color{NavyBlue}$\bullet$\egroupval BYTE / WORD /
UINT32 / UINT64
Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
dwAddrSpace The memory or I/O address space to write to
dwOffset The offset from the beginning of the specified address space (dwAddrSpace) to write to
val The data to write to the specified address


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.22 WDC_ReadAddrBlock()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupReads a block of data from the device.


PROTOTYPE

DWORD DLLCALLCONV WDC_ReadAddrBlock(
    WDC_DEVICE_HANDLE hDev,
    DWORD dwAddrSpace,
    KPTR dwOffset,
    DWORD dwBytes,
    PVOID pData,
    WDC_ADDR_MODE mode,
    WDC_ADDR_RW_OPTIONS options);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwAddrSpace DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset KPTR Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwBytes DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Output
\bgroup\color{NavyBlue}$\bullet$\egroupmode WDC_ADDR_MODE Input
\bgroup\color{NavyBlue}$\bullet$\egroupoptions WDC_ADDR_RW_OPTIONS Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
dwAddrSpace The memory or I/O address space to read from
dwOffset The offset from the beginning of the specified address space (dwAddrSpace) to read from
dwBytes The number of bytes to read
pData Pointer to a buffer to be filled with the data that is read from the device
mode The read access mode - see WDC_ADDR_MODE [B.3.1.4]
options A bit mask that determines how the data will be read - see WDC_ADDR_RW_OPTIONS [B.3.1.5].
The function automatically sets the WDC_RW_BLOCK flag.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.23 WDC_WriteAddrBlock()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWrites a block of data to the device.


PROTOTYPE

DWORD DLLCALLCONV WDC_WriteAddrBlock(
    WDC_DEVICE_HANDLE hDev,
    DWORD dwAddrSpace,
    KPTR dwOffset,
    DWORD dwBytes,
    PVOID pData,
    WDC_ADDR_MODE mode,
    WDC_ADDR_RW_OPTIONS options);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwAddrSpace DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset KPTR Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwBytes DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupmode WDC_ADDR_MODE Input
\bgroup\color{NavyBlue}$\bullet$\egroupoptions WDC_ADDR_RW_OPTIONS Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
dwAddrSpace The memory or I/O address space to write to
dwOffset The offset from the beginning of the specified address space (dwAddrSpace) to write to
dwBytes The number of bytes to write
pData Pointer to a buffer that holds the data to write to the device
mode The write access mode - see WDC_ADDR_MODE [B.3.1.4]
options A bit mask that determines how the data will be written - see WDC_ADDR_RW_OPTIONS [B.3.1.5].
The function automatically sets the WDC_RW_BLOCK flag.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.24 WDC_MultiTransfer()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupPerforms a group of memory and/or I/O read/write transfers.


PROTOTYPE

DWORD DLLCALLCONV WDC_MultiTransfer(
    WD_TRANSFER *pTrans,
    DWORD dwNumTrans);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppTrans WD_TRANSFER*  
\bgroup\color{NavyBlue}$\bullet$\egroupdwNumTrans DWORD Input


DESCRIPTION

Name Description
pTrans Pointer to an array of transfer commands information structures [B.5.14]
dwNumTrans Number of transfer commands in the pTrans array


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.25 WDC_AddrSpaceIsActive()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupChecks if the specified memory or I/O address space is active - i.e. if its size is not zero.


PROTOTYPE

BOOL DLLCALLCONV WDC_AddrSpaceIsActive(
    WDC_DEVICE_HANDLE hDev,
    DWORD dwAddrSpace);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwAddrSpace DWORD Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
dwAddrSpace The memory or I/O address space to look for


RETURN VALUE

Returns TRUE if the specified address space is active; otherwise returns FALSE.


B.3.26 WDC_PciReadCfgBySlot()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupReads data from a specified offset in a PCI device's configuration space or a PCI Express device's extended configuration space (on Windows/Linux).
The device is identified by its location on the PCI bus.

For Windows/Linux, all references to ''PCI'' in the description below also include PCI Express.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciReadCfgBySlot(
    WD_PCI_SLOT *pPciSlot,
    DWORD dwOffset,
    PVOID pData,
    DWORD dwBytes);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppPciSlot WD_PCI_SLOT* Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Output
\bgroup\color{NavyBlue}$\bullet$\egroupdwBytes DWORD Input


DESCRIPTION

Name Description
pPciSlot Pointer to a PCI device location information structure [B.5.8], which can be acquired by calling WDC_PciScanDevices() [B.3.4]
dwOffset The offset from the beginning of the PCI configuration space to read from
pData Pointer to a buffer to be filled with the data that is read from the PCI configuration space
dwBytes The number of bytes to read


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.27 WDC_PciWriteCfgBySlot()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWrite data to a specified offset in a PCI device's configuration space or a PCI Express device's extended configuration space (on Windows/Linux).
The device is identified by its location on the PCI bus.

For Windows/Linux, all references to ''PCI'' in the description below also include PCI Express.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciWriteCfgBySlot(
    WD_PCI_SLOT *pPciSlot,
    DWORD dwOffset,
    PVOID pData,
    DWORD dwBytes);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppPciSlot WD_PCI_SLOT* Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwBytes DWORD Input


DESCRIPTION

Name Description
pPciSlot Pointer to a PCI device location information structure [B.5.8], which can be acquired by calling WDC_PciScanDevices() [B.3.4]
dwOffset The offset from the beginning of the PCI configuration space to write to
pData Pointer to a data buffer that holds the data to write
dwBytes The number of bytes to write


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.28 WDC_PciReadCfg()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupReads data from a specified offset in a PCI device's configuration space or a PCI Express device's extended configuration space (on Windows/Linux).
For Windows/Linux, all references to ''PCI'' in the description below also include PCI Express.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciReadCfg(
    WDC_DEVICE_HANDLE hDev, 
    DWORD dwOffset,
    PVOID pData,
    DWORD dwBytes);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Output
\bgroup\color{NavyBlue}$\bullet$\egroupdwBytes DWORD Input


DESCRIPTION

Name Description
hDev Handle to a WDC PCI device structure, returned by WDC_PciDeviceOpen() [B.3.9]
dwOffset The offset from the beginning of the PCI configuration space to read from
pData Pointer to a buffer to be filled with the data that is read from the PCI configuration space
dwBytes The number of bytes to read


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.29 WDC_PciWriteCfg()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWrites data to a specified offset in a PCI device's configuration space or a PCI Express device's extended configuration space (on Windows/Linux).

For Windows/Linux, all references to ''PCI'' in the description below also include PCI Express.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciWriteCfg(
    WDC_DEVICE_HANDLE hDev, 
    DWORD dwOffset,
    PVOID pData,
    DWORD dwBytes);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwBytes DWORD Input


DESCRIPTION

Name Description
hDev Handle to a WDC PCI device structure, returned by WDC_PciDeviceOpen() [B.3.9]
dwOffset The offset from the beginning of the PCI configuration space to write to
pData Pointer to a data buffer that holds the data to write
dwBytes The number of bytes to write


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.30 WDC_PciReadCfgBySlotXXX()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWDC_PciReadCfgBySlot8/16/32/64() reads 1 byte (8 bits) / 2 bytes (16 bits) / 4 bytes (32 bits) / 8 bytes (64 bits), respectively, from a specified offset in a PCI device's configuration space or a PCI Express device's extended configuration space (on Windows/Linux). The device is identified by its location on the PCI bus.

For Windows/Linux, all references to ''PCI'' in the description below also include PCI Express.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciReadCfgRegBySlot8(
    WD_PCI_SLOT *pPciSlot, DWORD dwOffset, BYTE *val);

DWORD DLLCALLCONV WDC_PciReadCfgReg1BySlot6( WD_PCI_SLOT *pPciSlot, DWORD dwOffset, WORD *val);

DWORD DLLCALLCONV WDC_PciReadCfgReg32BySlot( WD_PCI_SLOT *pPciSlot, DWORD dwOffset, UINT32 *val);

DWORD DLLCALLCONV WDC_PciReadCfgReg64BySlot( WD_PCI_SLOT *pPciSlot, DWORD dwOffset, UINT64 *val);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppPciSlot WD_PCI_SLOT* Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupval BYTE* / WORD* /
UINT32* / UINT64*
Output


DESCRIPTION

Name Description
pPciSlot Pointer to a PCI device location information structure [B.5.8], which can be acquired by calling WDC_PciScanDevices() [B.3.4]
dwOffset The offset from the beginning of the PCI configuration space to read from
val Pointer to a buffer to be filled with the data that is read from the PCI configuration space


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.31 WDC_PciWriteCfgBySlotXXX()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWDC_PciWriteCfgBySlot8/16/32/64() writes 1 byte (8 bits) / 2 bytes (16 bits) / 4 bytes (32 bits) / 8 bytes (64 bits), respectively, to a specified offset in a PCI device's configuration space or a PCI Express device's extended configuration space (on Windows/Linux). The device is identified by its location on the PCI bus.

For Windows/Linux, all references to ''PCI'' in the description below also include PCI Express.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciWriteCfgRegBySlot8(
    WD_PCI_SLOT *pPciSlot, DWORD dwOffset, BYTE val);

DWORD DLLCALLCONV WDC_PciWriteCfgRegBySlot16( WD_PCI_SLOT *pPciSlot, DWORD dwOffset, WORD val);

DWORD DLLCALLCONV WDC_PciWriteCfgRegBySlot32( WD_PCI_SLOT *pPciSlot, DWORD dwOffset, UINT32 val);

DWORD DLLCALLCONV WDC_PciWriteCfgRegBySlot64( WD_PCI_SLOT *pPciSlot, DWORD dwOffset, UINT64 val);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppPciSlot WD_PCI_SLOT* Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupval BYTE / WORD /
UINT32 / UINT64
Input


DESCRIPTION

Name Description
pPciSlot Pointer to a PCI device location information structure [B.5.8], which can be acquired by calling WDC_PciScanDevices() [B.3.4]
dwOffset The offset from the beginning of the PCI configuration space to read from
val The data to write to the PCI configuration space


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.32 WDC_PciReadCfgXXX()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWDC_PciReadCfg8/16/32/64() reads 1 byte (8 bits) / 2 bytes (16 bits) / 4 bytes (32 bits) / 8 bytes (64 bits), respectively, from a specified offset in a PCI device's configuration space or a PCI Express device's extended configuration space (on Windows/Linux).

For Windows/Linux, all references to ''PCI'' in the description below also include PCI Express.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciReadCfgReg8(WDC_DEVICE_HANDLE hDev,
    DWORD dwOffset, BYTE *val);

DWORD DLLCALLCONV WDC_PciReadCfgReg16(WDC_DEVICE_HANDLE hDev, DWORD dwOffset, WORD *val);

DWORD DLLCALLCONV WDC_PciReadCfgReg32(WDC_DEVICE_HANDLE hDev, DWORD dwOffset, UINT32 *val);

DWORD DLLCALLCONV WDC_PciReadCfgReg64(WDC_DEVICE_HANDLE hDev, DWORD dwOffset, UINT64 *val);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupval BYTE* / WORD* /
UINT32* / UINT64*
Output


DESCRIPTION

Name Description
hDev Handle to a WDC PCI device structure, returned by WDC_PciDeviceOpen() [B.3.9]
dwOffset The offset from the beginning of the PCI configuration space to read from
val Pointer to a buffer to be filled with the data that is read from the PCI configuration space


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.33 WDC_PciWriteCfgXXX()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWDC_PciWriteCfg8/16/32/64() writes 1 byte (8 bits) / 2 bytes (16 bits) / 4 bytes (32 bits) / 8 bytes (64 bits), respectively, to a specified offset in a PCI device's configuration space or a PCI Express device's extended configuration space (on Windows/Linux).

For Windows/Linux, all references to ''PCI'' in the description below also include PCI Express.


PROTOTYPE

DWORD DLLCALLCONV WDC_PciWriteCfgReg8(WDC_DEVICE_HANDLE hDev,
    DWORD dwOffset, BYTE val);

DWORD DLLCALLCONV WDC_PciWriteCfgReg16(WDC_DEVICE_HANDLE hDev, DWORD dwOffset, WORD val);

DWORD DLLCALLCONV WDC_PciWriteCfgReg32(WDC_DEVICE_HANDLE hDev, DWORD dwOffset, UINT32 val);

DWORD DLLCALLCONV WDC_PciWriteCfgReg64(WDC_DEVICE_HANDLE hDev, DWORD dwOffset, UINT64 val);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupval BYTE / WORD /
UINT32 / UINT64
Input


DESCRIPTION

Name Description
hDev Handle to a WDC PCI device structure, returned by WDC_PciDeviceOpen() [B.3.9]
dwOffset The offset from the beginning of the PCI configuration space to read from
val The data to write to the PCI configuration space


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.34 WDC_PcmciaReadAttribSpace()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupReads data from a specified offset in a PCMCIA device's attribute space.


PROTOTYPE

DWORD DLLCALLCONV WDC_PcmciaReadAttribSpace(
    WDC_DEVICE_HANDLE hDev,
    DWORD dwOffset,
    PVOID pData,
    DWORD dwBytes);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Output
\bgroup\color{NavyBlue}$\bullet$\egroupdwBytes DWORD Input


DESCRIPTION

Name Description
hDev Handle to a WDC PCMCIA device structure, returned by WDC_PcmciaDeviceOpen() [B.3.10]
dwOffset The offset from the beginning of the PCMCIA attribute space to read from
pData Pointer to a buffer to be filled with the data that is read from the PCMCIA attribute space
dwBytes The number of bytes to read


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.35 WDC_PcmciaWriteAttribSpace()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupWrites data to a specified offset in a PCMCIA device's attribute space.


PROTOTYPE

DWORD DLLCALLCONV WDC_PcmciaWriteAttribSpace(
    WDC_DEVICE_HANDLE hDev,
    DWORD dwOffset,
    PVOID pData,
    DWORD dwBytes);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOffset DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwBytes DWORD Input


DESCRIPTION

Name Description
hDev Handle to a WDC PCMCIA device structure, returned by WDC_PcmciaDeviceOpen() [B.3.10]
dwOffset The offset from the beginning of the PCMCIA attribute space to write to
pData Pointer to a data buffer that holds the data to write
dwBytes The number of bytes to write


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.36 WDC_PcmciaSetWindow()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupModifies the settings of the PCMCIA bus controller's memory window.


PROTOTYPE

DWORD DLLCALLCONV WDC_PcmciaSetWindow(
    WDC_DEVICE_HANDLE hDev,
    WD_PCMCIA_ACC_SPEED speed,
    WD_PCMCIA_ACC_WIDTH width,
    DWORD dwCardBase);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupspeed WD_PCMCIA_ACC_SPEED Input
\bgroup\color{NavyBlue}$\bullet$\egroupwidth WD_PCMCIA_ACC_WIDTH Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwCardBase DWORD Input


DESCRIPTION

Name Description
hDev Handle to a WDC PCMCIA device structure, returned by WDC_PcmciaDeviceOpen() [B.3.10]
speed The access speed to the PCMCIA bus - see the WD_PCMCIA_ACC_SPEED enumeration [B.5.3]
width The PCMCIA bus width - see the WD_PCMCIA_ACC_WIDTH enumeration [B.5.4]
dwCardBase The offset in the PCMCIA device's memory from which the memory mapping begins


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.37 WDC_PcmciaSetVpp()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupModifies the power level of the PCMCIA bus controller's Voltage Power Pin (Vpp).


PROTOTYPE

DWORD DLLCALLCONV WDC_PcmciaSetVpp(
    WDC_DEVICE_HANDLE hDev,
    WD_PCMCIA_VPP vpp);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupvpp WD_PCMCIA_VPP Input


DESCRIPTION

Name Description
hDev Handle to a WDC PCMCIA device structure, returned by WDC_PcmciaDeviceOpen() [B.3.10]
vpp The power level of the PCMCIA controller's Voltage Power Pin (Vpp) - see the WD_PCMCIA_VPP enumeration [B.5.5]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.38 WDC_DMAContigBufLock()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupAllocates a DMA buffer and returns mappings of the allocated buffer to physical address space and to user-mode and kernel virtual address spaces.


PROTOTYPE

DWORD DLLCALLCONV WDC_DMAContigBufLock(
    WDC_DEVICE_HANDLE hDev,
    PVOID *ppBuf,
    DWORD dwOptions,
    DWORD dwDMABufSize,
    WD_DMA **ppDma);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupppBuf PVOID* Output
\bgroup\color{NavyBlue}$\bullet$\egroupdwOptions DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwDMABufSize DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupppDma WD_DMA** Output


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11]).
NOTE: This field can also be set to NULL in order to lock a contiguous physical memory buffer with no relation to a specific device.
ppBuf Pointer to a pointer to be filled by the function with the user-mode mapped address of the allocated DMA buffer
dwOptions A bit mask of any of the following flags (defined in an enumeration in windrvr.h):
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_FROM_DEVICE: Synchronize the DMA buffer for transfers from the device to memory.
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_TO_DEVICE: Synchronize the DMA buffer for transfers from memory to the device.
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_TO_FROM_DEVICE: Synchronize the DMA buffer for transfers in both directions - i.e. from the device to memory and from memory to the device (<=> DMA_FROM_DEVICE | DMA_TO_DEVICE).
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_ALLOW_CACHE: Allow caching of the memory.
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_CTG_KBUF_BELOW_16M: Allocate the physical DMA buffer within the lower 16MB of the main memory.
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_ALLOW_64BIT_ADDRESS: Allow allocation of 64-bit DMA addresses, if supported by the target platform. This flag is supported on Windows, Linux and Solaris.
dwDMABufSize The size (in bytes) of the DMA buffer
ppDma Pointer to a pointer to a DMA buffer information structure [B.5.13], which is allocated by the function.
The pointer to this structure (*ppDma) should be passed to WDC_DMABufUnlock() [B.3.40] when the DMA buffer is no longer needed.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.39 WDC_DMASGBufLock()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupLocks a pre-allocated user-mode memory buffer for DMA and returns the corresponding physical mappings of the locked DMA pages. On Windows 98/Me/2000/XP/Server 2003/Vista the function also returns a kernel-mode mapping of the buffer.


PROTOTYPE

DWORD DLLCALLCONV WDC_DMASGBufLock(
    WDC_DEVICE_HANDLE hDev,
    PVOID pBuf,
    DWORD dwOptions,
    DWORD dwDMABufSize,
    WD_DMA **ppDma);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egrouppBuf PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOptions DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwDMABufSize DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupppDma WD_DMA** Output


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
pBuf Pointer to a user-mode buffer to be mapped to the allocated physical DMA buffer(s)
dwOptions A bit mask of any of the following flags (defined in an enumeration in windrvr.h):
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_FROM_DEVICE: Synchronize the DMA buffer for transfers from the device to memory.
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_TO_DEVICE: Synchronize the DMA buffer for transfers from memory to the device.
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_TO_FROM_DEVICE: Synchronize the DMA buffer for transfers in both directions - i.e. from the device to memory and from memory to the device (<=> DMA_FROM_DEVICE | DMA_TO_DEVICE).
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_ALLOW_CACHE: Allow caching of the memory.
\bgroup\color{NavyBlue}$\bullet$\egroupDMA_ALLOW_64BIT_ADDRESS: Allow allocation of 64-bit DMA addresses, if supported by the target platform. This flag is supported on Windows, Linux and Solaris.
dwDMABufSize The size (in bytes) of the DMA buffer
ppDma Pointer to a pointer to a DMA buffer information structure [B.5.13], which is allocated by the function.
The pointer to this structure (*ppDma) should be passed to WDC_DMABufUnlock() [B.3.40] when the DMA buffer is no longer needed.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.40 WDC_DMABufUnlock()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupUnlocks and frees the memory allocated for a DMA buffer by a previous call to WDC_DMAContigBufLock() [B.3.38] or WDC_DMASGBufLock() [B.3.39].


PROTOTYPE

DWORD DLLCALLCONV WDC_DMABufUnlock(WD_DMA *pDma);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppDma WD_DMA* Input


DESCRIPTION

Name Description
pDma Pointer to a DMA information structure [B.5.13], received from a previous call to WDC_DMAContigBufLock() [B.3.38] (for a Contiguous DMA buffer) or WDC_DMASGBufLock() [B.3.39] (for a Scatter/Gather DMA buffer) - *ppDma returned by these functions


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.41 WDC_DMASyncCpu()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupSynchronizes the cache of all CPUs with the DMA buffer, by flushing the data from the CPU caches.

NOTE: This function should be called before performing a DMA transfer (see Remarks below).


PROTOTYPE

DWORD DLLCALLCONV WDC_DMASyncCpu(WD_DMA *pDma);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppDma WD_DMA* Input


DESCRIPTION

Name Description
pDma Pointer to a DMA information structure [B.5.13], received from a previous call to WDC_DMAContigBufLock() [B.3.38] (for a Contiguous DMA buffer) or WDC_DMASGBufLock() [B.3.39] (for a Scatter/Gather DMA buffer) - *ppDma returned by these functions


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.42 WDC_DMASyncIo()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupSynchronizes the I/O caches with the DMA buffer, by flushing the data from the I/O caches and updating the CPU caches.

NOTE: This function should be called after performing a DMA transfer (see Remarks below).


PROTOTYPE

DWORD DLLCALLCONV WDC_DMASyncIo(WD_DMA *pDma);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouppDma WD_DMA* Input


DESCRIPTION

Name Description
pDma Pointer to a DMA information structure, received from a previous call to WDC_DMAContigBufLock() [B.3.38] (for a Contiguous DMA buffer) or WDC_DMASGBufLock() [B.3.39] (for a Scatter/Gather DMA buffer) - *ppDma returned by these functions


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.43 WDC_IntEnable()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupEnable interrupt handling for the device.

\bgroup\color{NavyBlue}$\bullet$\egroupIf the caller selects to handle the interrupts in the kernel, using a Kernel PlugIn driver, the Kernel PlugIn KP_IntAtIrql() function [B.6.8], which runs at high IRQ (Interrupt Request) level, will be invoked immediately when an an interrupt is received.

\bgroup\color{NavyBlue}$\bullet$\egroupThe function can receive transfer commands information, which will be performed by WinDriver at the kernel, at high IRQ level, when an interrupt is received. If a Kernel PlugIn driver is used to handle the interrupts, any transfer commands set by the caller will be executed by WinDriver after the Kernel PlugIn KP_IntAtIrql() function [B.6.8] completes its execution.
When handling level sensitive interrupts (such as PCI interrupts) from the user mode, without a Kernel PlugIn driver, you must prepare and pass to the function transfer commands for acknowledging the interrupt. When using a Kernel PlugIn driver, the information for acknowledging the interrupts should be implemented in the Kernel PlugIn KP_IntAtIrql() function [B.6.8], so the transfer commands are not required.

\bgroup\color{NavyBlue}$\bullet$\egroupThe function receives a user-mode interrupt handler routine, which will be called by WinDriver after the kernel-mode interrupt processing is completed.
If the interrupts are handled using a Kernel PlugIn driver, the return value of the Kernel PlugIn deferred interrupt handler function (KP_IntAtDpc() [B.6.9]) will determine how many times (if at all) the user-mode interrupt handler will be called (provided KP_IntAtDpc() itself is executed - which is determined by the return value of the Kernel PlugIn KP_IntAtIrql() function [B.6.8]).


PROTOTYPE

DWORD DLLCALLCONV WDC_IntEnable(
    WDC_DEVICE_HANDLE hDev,
    WD_TRANSFER *pTransCmds,
    DWORD dwNumCmds,
    DWORD dwOptions,
    INT_HANDLER funcIntHandler,
    PVOID pData,
    BOOL fUseKP);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egrouppTransCmds WD_TRANSFER* Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwNumCmds DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwOptions DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupfuncIntHandler INT_HANDLER Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupfUseKP BOOL Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])
pTransCmds An array of transfer commands information structures that define the operations to be performed at the kernel level upon the detection of an interrupt, or NULL if no transfer commands are required.

NOTE: When handling level sensitive interrupts (such as PCI interrupts) without a Kernel PlugIn [[*]], you must use this array to define the hardware-specific commands for acknowledging the interrupts in the kernel, immediately when they are received - see section 9.2 for details.

For an explanation on how to set the transfer commands, refer to the description of WD_TRANSFER in section B.5.14.
dwNumCmds Number of transfer commands in the pTransCmds array
dwOptions A bit mask of interrupt handling flags.
Can be zero for no option, or:
\bgroup\color{NavyBlue}$\bullet$\egroupINTERRUPT_CMD_COPY: If set, WinDriver will copy any data read in the kernel as a result of a read transfer command, and return it to the user within the relevant transfer command structure
funcIntHandler A user-mode interrupt handler callback function, which will be executed after an interrupt is received and processed in the kernel. (The prototype of the interrupt handler - INT_HANDLER - is defined in windrvr_int_thread.h).
pData Data for the user-mode interrupt handler callback routine (funcIntHandler)
fUseKP If TRUE - The device's Kernel PlugIn driver's KP_IntAtIrql() function [B.6.8], which runs at high IRQ (Interrupt Request) level, will be executed immediately when an interrupt is received. (The Kernel PlugIn driver to be used for the device is passed to WDC_xxxDeviceOpen() and stored in the WDC device structure).
If the caller also passes transfer commands to the function (pTransCmds), these commands will be executed by WinDriver at the kernel, at high IRQ level, after KP_IntAtIrql() completes its execution.
If KP_IntAtIrql() returns TRUE, the Kernel PlugIn deferred interrupt processing routine - KP_IntAtDpc() [B.6.9] - will be invoked. The return value of this function determines how many times (if at all) the user-mode interrupt handler (funcIntHandler) will be executed once the control returns to the user mode.
If FALSE - When an interrupt is received, any transfer commands set by the user in pTransCmds will be executed by WinDriver at the kernel, at high IRQ level, and the user-mode interrupt handler routine (funcIntHandler) will be executed when the control returns to the user mode.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.44 WDC_IntDisable()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupDisables interrupt interrupt handling for the device, pursuant to a previous call to WDC_IntEnable() [B.3.43].


PROTOTYPE

DWORD DLLCALLCONV WDC_IntDisable(WDC_DEVICE_HANDLE hDev);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.45 WDC_IntIsEnabled()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupChecks if a device's interrupts are currently enabled.


PROTOTYPE

BOOL DLLCALLCONV WDC_IntIsEnabled(WDC_DEVICE_HANDLE hDev);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])


RETURN VALUE

Returns TRUE if the device's interrupts are enabled; otherwise returns FALSE.


B.3.46 WDC_EventRegister()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupRegisters the application to receive Plug-and-Play and power management events notifications for the device.


PROTOTYPE

DWORD DLLCALLCONV WDC_EventRegister(
    WDC_DEVICE_HANDLE hDev,
    DWORD dwActions,
    EVENT_HANDLER funcEventHandler,
    PVOID pData,
    BOOL fUseKP);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input
\bgroup\color{NavyBlue}$\bullet$\egroupdwActions DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupfuncEventHandler WDC_EVENT_HANDLER Input
\bgroup\color{NavyBlue}$\bullet$\egrouppData PVOID Input
\bgroup\color{NavyBlue}$\bullet$\egroupfUseKP BOOL Input


DESCRIPTION

Name Description
hDev Handle to a Plug and Play WDC device, returned by WDC_PciDeviceOpen() [B.3.9] or WDC_PcmciaDeviceOpen() [B.3.10]
dwActions A bit mask of flags indicating which events to register to:
Plug and Play events:
\bgroup\color{NavyBlue}$\bullet$\egroupWD_INSERT - Device inserted
\bgroup\color{NavyBlue}$\bullet$\egroupWD_REMOVE - Device removed
Device power state change events:
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_CHANGED_D0 - Full power
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_CHANGED_D1 - Low sleep
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_CHANGED_D2 - Medium sleep
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_CHANGED_D3 - Full sleep
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_SYSTEM_WORKING - Fully on
Systems power state:
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_SYSTEM_SLEEPING1 - Fully on but sleeping
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_SYSTEM_SLEEPING2 - CPU off, memory on, PCI/PCMCIA on
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_SYSTEM_SLEEPING3 - CPU off, Memory is in refresh, PCI/PCMCIA on aux power
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_SYSTEM_HIBERNATE - OS saves context before shutdown
\bgroup\color{NavyBlue}$\bullet$\egroupWD_POWER_SYSTEM_SHUTDOWN - No context saved
funcEventHandler A user-mode event handler callback function, which will be called when an event for which the caller registered to receive notifications (see dwActions) occurs . (The prototype of the event handler - EVENT_HANDLER - is defined in windrvr_events.h).
pData Data for the user-mode event handler callback routine (funcEventHandler)
fUseKP If TRUE - When an event for which the caller registered to receive notifications (dwActions) occurs, the device's Kernel PlugIn driver's KP_Event() function [B.6.5] will be called. (The Kernel PlugIn driver to be used for the device is passed to WDC_xxxDeviceOpen() and stored in the WDC device structure).
If this function returns TRUE, the user-mode events handler callback function (funcEventHandler) will be called when the kernel-mode event processing is completed.
If FALSE - When an event for which the caller registered to receive notifications (dwActions) occurs, the user-mode events handler callback function will be called.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.47 WDC_EventUnregister()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupUn-registers an application from a receiving Plug-and-Play and power management notifications for a device, pursuant to a previous call to WDC_EventRegister() [B.3.46].


PROTOTYPE

DWORD DLLCALLCONV WDC_EventUnregister(WDC_DEVICE_HANDLE hDev);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input


DESCRIPTION

Name Description
hDev Handle to a Plug and Play WDC device, returned by WDC_PciDeviceOpen() [B.3.9] or WDC_PcmciaDeviceOpen() [B.3.10]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


REMARKS


B.3.48 WDC_EventIsRegistered()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupChecks if the application is currently registered to receive Plug-and-Play and power management notifications for the device.


PROTOTYPE

BOOL DLLCALLCONV WDC_EventIsRegistered(WDC_DEVICE_HANDLE hDev);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input


DESCRIPTION

Name Description
hDev Handle to a Plug and Play WDC device, returned by WDC_PciDeviceOpen() [B.3.9] or WDC_PcmciaDeviceOpen() [B.3.10]


RETURN VALUE

Returns TRUE if the application is currently registered to receive Plug-and-Play and power management notifications for the device; otherwise returns FALSE.


B.3.49 WDC_SetDebugOptions()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupSets debug options for the WDC library - see the description of WDC_DBG_OPTIONS [B.3.1.8] for details regarding the possible debug options to set.

\bgroup\color{NavyBlue}$\bullet$\egroupThis function is typically called at the beginning of the application, after the call to WDC_DriverOpen() [B.3.2], and can be re-called at any time while the WDC library is in use (i.e. WDC_DriverClose() [B.3.3] has not been called) in order to change the debug settings.

\bgroup\color{NavyBlue}$\bullet$\egroupUntil the function is called, the WDC library uses the default debug options - see WDC_DEBG_DEFAULT [B.3.1.8].

When the function is recalled, it performs any required cleanup for the previous debug settings and sets the default debug options before attempting to set the new options specified by the caller.


PROTOTYPE

DWORD DLLCALLCONV WDC_SetDebugOptions(
    WDC_DBG_OPTIONS dbgOptions,
    const CHAR *sDbgFile);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupdbgOptions WDC_DBG_OPTIONS Input
\bgroup\color{NavyBlue}$\bullet$\egroupsDbgFile const CHAR* Input


DESCRIPTION

Name Description
dbgOptions A bit mask of flags indicating the desired debug settings - see WDC_DBG_OPTIONS [B.3.1.8].
If this parameter is set to zero, the default debug options will be used - see WDC_DBG_DEFAULT [B.3.1.8].
sDbgFile WDC debug output file.
This parameter is relevant only if the WDC_DBG_OUT_FILE flag is set in the debug options (dbgOptions) (either directly or via one of the convenience debug options combinations - see WDC_DBG_OPTIONS [B.3.1.8]).
If the WDC_DBG_OUT_FILE debug flag is set and sDbgFile is NULL, WDC debug messages will be logged to the default debug file - stderr.


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.50 WDC_Err()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupDisplays debug error messages according to the WDC debug options - see WDC_DBG_OPTIONS [B.3.1.8] and WDC_SetDebugOptions() [B.3.49].


PROTOTYPE

void DLLCALLCONV WDC_Err(
    const CHAR *format
     ...);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupformat const CHAR* Input
\bgroup\color{NavyBlue}$\bullet$\egroupargument   Input


DESCRIPTION

Name Description
format Format-control string, which contains the error message to display. The string is limited to 256 characters (CHAR)
argument Optional arguments for the format string


RETURN VALUE

None


B.3.51 WDC_Trace()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupDisplays debug trace messages according to the WDC debug options - see WDC_DBG_OPTIONS [B.3.1.8] and WDC_SetDebugOptions() [B.3.49].


PROTOTYPE

void DLLCALLCONV WDC_Trace(
    const CHAR *format
     ...);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupformat const CHAR* Input
\bgroup\color{NavyBlue}$\bullet$\egroupargument   Input


DESCRIPTION

Name Description
format Format-control string, which contains the trace message to display. The string is limited to 256 characters (CHAR)
argument Optional arguments for the format string

RETURN VALUE

None


B.3.52 WDC_GetWDHandle()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupReturns a handle to WinDriver's kernel module, which is required by the basic WD_xxx WinDriver PCI/PCMCIA/ISA API, described in the WinDriver PCI Low-Level API Reference (see Remarks below).


PROTOTYPE

HANDLE DLLCALLCONV WDC_GetWDHandle(void);


RETURN VALUE

Returns a handle to WinDriver's kernel module, or INVALID_HANDLE_VALUE in case of a failure


REMARKS


B.3.53 WDC_GetDevContext()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupReturns the device's user context information.


PROTOTYPE

PVOID DLLCALLCONV WDC_GetDevContext(WDC_DEVICE_HANDLE hDev);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])


RETURN VALUE

Returns a pointer to the device's user context, or NULL if not context has been set.


B.3.54 WDC_GetBusType()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupReturns the device's bus type: WD_BUS_PCI, WD_BUS_PCMCIA, WD_BUS_ISA or WD_BUS_UNKNOWN.


PROTOTYPE

WD_BUS_TYPE DLLCALLCONV WDC_GetBusType(WDC_DEVICE_HANDLE hDev);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egrouphDev WDC_DEVICE_HANDLE Input


DESCRIPTION

Name Description
hDev Handle to a WDC device, returned by WDC_xxxDeviceOpen() (PCI [B.3.9] / PCMCIA [B.3.10] / ISA [B.3.11])


RETURN VALUE

Returns the device's bus type [B.5.1].


B.3.55 WDC_Sleep()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupDelays execution for the specified duration of time (in microseconds).
By default the function performs a busy sleep (consumes the CPU).


PROTOTYPE

DWORD DLLCALLCONV WDC_Sleep(
    DWORD dwMicroSecs,
    WDC_SLEEP_OPTIONS options);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupdwMicroSecs DWORD Input
\bgroup\color{NavyBlue}$\bullet$\egroupoptions WDC_SLEEP_OPTIONS Input


DESCRIPTION

Name Description
dwMicroSecs The number of microseconds to sleep
options Sleep options [B.3.1.7]


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


B.3.56 WDC_Version()


PURPOSE

\bgroup\color{NavyBlue}$\bullet$\egroupReturns the version number of the WinDriver kernel module used by the WDC library.


PROTOTYPE

DWORD DLLCALLCONV WDC_Version(
    CHAR *sVersion,
    DWORD *pdwVersion);


PARAMETERS

Name Type Input/Output
\bgroup\color{NavyBlue}$\bullet$\egroupsVersion CHAR* Output
\bgroup\color{NavyBlue}$\bullet$\egrouppdwVersion DWORD* Output


DESCRIPTION

Name Description
sVersion Pointer to a pre-allocated buffer to be filled by the function with the driver's version information string.
The size of the version string buffer must be at least 128 bytes (characters).
pdwVersion Pointer to a value indicating the version number of the WinDriver kernel module used by the WDC library


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [B.9].


next up previous contents
Next: B.4 WDC Low Level Up: B. API Reference Previous: B.2 WDC Library Overview   Contents