next up previous contents
Next: 2.12 WD_MultiTransfer() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.10 WD_CardUnregister()   Contents


2.11 WD_Transfer()


PURPOSE

$\bullet$Executes a single read/write instruction to an I/O port or to a memory address.


PROTOTYPE

DWORD WD_Transfer(
    HANDLE hWD,
    WD_TRANSFER *pTrans);


PARAMETERS

Name Type Input/Output
$\bullet$hWD HANDLE Input
$\bullet$pTrans WD_TRANSFER*  
$\gg$cmdTrans DWORD Input
$\gg$dwPort KPTR Input
$\gg$dwBytes DWORD Input
$\gg$fAutoinc DWORD Input
$\gg$dwOptions DWORD Input
$\gg$Data union  
$\gg$Data.Byte BYTE Input/Output
$\gg$Data.Word WORD Input/Output
$\gg$Data.Dword UINT32 Input/Output
$\gg$Data.Qword UINT64 Input/Output
$\gg$Data.pBuffer PVOID Input/Output


DESCRIPTION

Name Description
hWD The handle to WinDriver's kernel-mode driver received from WD_Open() [5.2]
pTrans Pointer to a transfer information structure:
cmdTrans A value indicating the type of transfer to perform - see definition of the WD_TRANSFER_CMD enumeration in windrvr.h.

In calls to WD_Transfer() the transfer command should be a read/write transfer command that conforms to the following format: <dir><p>_[S]<size>
Explanation:
<dir>: R for read, W for write
<p>: P for I/O, M for memory
<S>: signifies a string (block) transfer, as opposed to a single transfer
<size>: BYTE, WORD, DWORD or QWORD .
dwPort The memory or I/O address to access.

For a memory transfer, use the kernel-mapping of the base address received from WD_CardRegister() [2.8] in pCardReg->Card.Item[i]I.Mem.dwTransAddr (where 'i' is the index of the relevant memory item) + the desired offset from the beginning of the address range.

For an I/O transfer, use the base address received from WD_CardRegister() [2.8] in pCardReg->Card.Item[i]I.IO.dwAddr (where 'i' is the index of the relevant I/O item) + the desired offset from the beginning of the address range.
dwBytes Used in string transfers - number of bytes to transfer
fAutoinc Used for string transfers.
If TRUE, I/O or memory address should be incremented for transfer.
If FALSE, all data is transferred to the same port/address.
dwOptions Must be set to 0
Data The transfer data - input for read transfers, output for write transfers:
Data.Byte Used for 8-bit transfers
Data.Word Used for 16-bit transfers
Data.Dword Used for 32-bit transfers
Data.Qword Used for 64-bit transfers
Data.pBuffer Used for string (block) transfers


RETURN VALUE

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


REMARKS


EXAMPLE

WD_TRANSFER Trans;
BYTE read_data;

BZERO(Trans);
Trans.cmdTrans = RP_BYTE; /* Read Port BYTE */
Trans.dwPort = 0x210;
WD_Transfer(hWD, &Trans);
read_data = Trans.Data.Byte;


next up previous contents
Next: 2.12 WD_MultiTransfer() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.10 WD_CardUnregister()   Contents