
Designer Reference Manual USB08 Evaluation Board
182 Universal USB Device Driver (USBIO) MOTOROLA
Universal USB Device Driver (USBIO)
E.5.3 Data Transfer Requests
The USBIO device driver exports an interface to USB pi pes that is similar
to files. For that reason the Win32 API functions ReadFile and
WriteFile are used to transfer data from or to a pi pe. T he h andle tha t
is associated with the USB pipe is passed as hFile to this function.
The ReadFile function is defined as follows:
BOOL ReadFile (
HANDLE hFile, // handle of file to re ad
LPVOID lpBuffer, // pointer to buffer that rec eives data
DWORD nNumberOfBytesToRea d, // number of bytes to read
LPDWORD lpNumberOfBytes Read, // pointer to number of bytes read
LPOVERLAPPED lpOverlapp ed // pointer to OVERLAPPE D structure
);
The WriteFile function is defined as follows:
BOOL WriteFile (
HANDLE hFile, // handle of file to wr ite
LPVOID lpBuffer, // pointer to data to write to file
DWORD nNumberOfBytesToWri te, // num be r of bytes to write
LPDWORD lpNumberOfBytesWritten,// pointer to number of bytes written
LPOVERLAPPED lpOverlapp ed // pointer to OVERLAPPE D structure
);
By using these functions it is possible to implement both synchronous
and asynchronous data transfer operations. Both methods are fully
supported by the USBIO driver. Refer to the Microsoft Platform SDK
documentation for more information on using the ReadFile and
WriteFile functions.
E.5.3.1 Bulk and Interrupt Transfers
For interrupt and bulk transfers the buffer size can be larger than the
maximum packet size of the endpoint (physical FIFO size) as reported
in the endpoint descriptor. But the buffer size has to be equal or smaller
than the value specified in the MaximumTransferSize field of the
USBIO_INTERFACE_SETTING (page 194) structure on the Set
Configuration call.