Using the QuickUSB Library
QuickUsbReadData
Purpose
Read a block of data values from the high-speed parallel port using the
QuickUSB module.
Parameters
hDevice: A HANDLE that was returned from a call to QuickUsbOpen.
data:
A pointer to a buffer in which to place data values read from the
HSPP.
See notes.
length:
A PULONG to a ULONG containing the number of bytes to read
from the HSPP.
See notes
.
Returns
A LONG that is non-zero on success, zero (0) on failure.
Notes
•
The maximum length is 16 megabytes (16777216 bytes).
•
The data buffer can receive data values of any type.
•
This function has a call latency of approximately 1ms for full-speed
connections and 250 us for hi-speed connections.
•
In order to obtain the maximum performance, call this function with
the largest appropriate length value. Each call to this function will
incur one call latency delay regardless of the transfer size. So to
minimize delays that erode the data transfer rate, make the transfers
as large as possible for your application.
•
In master mode, data values are transferred over the high-speed
parallel port with the CMD_DATA line set to ‘0’.
•
In slave mode, the USB will wait for ‘length’ transfers to occur before
returning. If the target interface does not write length transfers to the
slave FIFOs, the call will return with a value of 0 and set the last error
status to QUICKUSB_ERROR_TIMEOUT after the timeout value
specified by the QuickUsbSetTimeout function.
•
The address bus behavior for data transfers is defined by the
SETTING_DATAADDRESS setting.
High-Speed Parallel Port
57