beautypg.com

E.5.3 data transfer requests, E.5.3.1 bulk and interrupt transfers, E.5.3 – Motorola USB08 User Manual

Page 182: Data transfer requests, E.5.3.1, Bulk and interrupt transfers, Universal usb device driver (usbio)

background image

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 pipes that is similar
to files. For that reason the Win32 API functions

ReadFile

and

WriteFile

are used to transfer data from or to a pipe. The handle that

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 read

LPVOID lpBuffer,

// pointer to buffer that receives data

DWORD nNumberOfBytesToRead,

// number of bytes to read

LPDWORD lpNumberOfBytesRead,

// pointer to number of bytes read

LPOVERLAPPED lpOverlapped

// pointer to OVERLAPPED structure

);

The

WriteFile

function is defined as follows:

BOOL WriteFile (

HANDLE hFile,

// handle of file to write

LPVOID lpBuffer,

// pointer to data to write to file

DWORD nNumberOfBytesToWrite,

// number of bytes to write

LPDWORD lpNumberOfBytesWritten,// pointer to number of bytes written

LPOVERLAPPED lpOverlapped

// pointer to OVERLAPPED 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.