next up previous contents
Next: 2.13 WD_DMALock() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.11 WD_Transfer()   Contents


2.12 WD_MultiTransfer()


PURPOSE

$\bullet$Executes multiple read/write instructions to I/O ports and/or memory addresses.


PROTOTYPE

DWORD WD_MultiTransfer(
    HANDLE hWD,
    WD_TRANSFER *pTransferArray,
    DWORD dwNumTransfers);


PARAMETERS

Name Type Input/Output
$\bullet$hWD HANDLE Input
$\bullet$pTransferArray 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  
$\diamond$Byte BYTE Input/Output
$\diamond$Word WORD Input/Output
$\diamond$Dword UINT32 Input/Output
$\diamond$Qword UINT64 Input/Output
$\diamond$pBuffer PVOID Input/Output
$\bullet$dwNumTransfers DWORD Input


DESCRIPTION

Name Description
hWD Handle to WinDriver's kernel-mode driver as received from WD_Open() [5.2]
pTransferArray Pointer to a beginning of an array of transfer information structures:
$\bullet$ 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_MultiTransfer() 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 .
$\bullet$ 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.
$\bullet$ dwBytes Used in string transfers - number of bytes to transfer
$\bullet$ 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.
$\bullet$ dwOptions Must be set to 0
$\bullet$ Data The transfer data - input for read transfers, output for write transfers:
$\gg$ Byte Used for 8-bit transfers
$\gg$ Word Used for 16-bit transfers
$\gg$ Dword Used for 32-bit transfers
$\gg$ Qword Used for 64-bit transfers
$\gg$ pBuffer Used for string (block) transfers
dwNumTransfers The number of transfers to perform (the pTransferArray array should contain at least dwNumTransfers elements)


RETURN VALUE

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


REMARKS


EXAMPLE

WD_TRANSFER Trans[4];
DWORD dwResult;
char *cData = "Message to send\n";

BZERO(Trans);
Trans[0].cmdTrans = WP_WORD;  /* Write Port WORD */
Trans[0].dwPort = 0x1e0;
Trans[0].Data.Word = 0x1023;

Trans[1].cmdTrans = WP_WORD;
Trans[1].dwPort = 0x1e0;
Trans[1].Data.Word = 0x1022;

Trans[2].cmdTrans = WP_SBYTE; /* Write Port String BYTE */
Trans[2].dwPort = 0x1f0;
Trans[2].dwBytes = strlen(cdata);
Trans[2].fAutoinc = FALSE;
Trans[2].dwOptions = 0;
Trans[2].Data.pBuffer = cData;

Trans[3].cmdTrans = RP_DWORD; /* Read Port Dword */
Trans[3].dwPort = 0x1e4;

WD_MultiTransfer(hWD, &Trans, 4);
dwResult = Trans[3].Data.Dword;


next up previous contents
Next: 2.13 WD_DMALock() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.11 WD_Transfer()   Contents