Universal USB Device Driver (USBIO)
USBIO Class Library
USB08 Evaluation Board
Designer Reference Manual
MOTOROLA
Universal USB Device Driver (USBIO)
221
For each device-related operation the USBIO driver supports, a member
function exists in the
CUsbIo
class. The function takes the parameters
that are required for the operation and returns the status that is reported
by the USBIO driver.
E.6.2 CUsbIoPipe Class
The class
CUsbIoPipe
extends the
CUsbIo
class by functions that are
related to an USBIO pipe object. An instance of the
CUsbIoPipe
class
is associated directly with an USBIO pipe object. In order to establish the
connection to the pipe the class provides a
Bind
function. After a
CUsbIoPipe
instance is bound, pipe-related functions can be
performed by using member functions of the class.
For each pipe-related operation that the USBIO driver supports a
member function exists in the
CUsbIoPipe
class. The function takes
the parameters that are required for the operation and returns the status
that is reported by the USBIO driver.
The
CusbIoPipe
class supports an asynchronous communication
model for data transfers from or to the pipe. The
Read
or
Write
function
is used to submit a data buffer to the USBIO driver. The function returns
immediately indicating success if the buffer was sent to the driver
successfully. There is no blocking within the
Read
or
Write
function.
Therefore, it is possible to send multiple buffers to the pipe. The buffers
are processed sequentially in the same order as they were submitted.
The
WaitForCompletion
member function is used to wait until the
data transfer from or to a particular buffer is finished. This function blocks
the calling thread until the USBIO driver has completed the I/O operation
with the buffer.
In order to use a data buffer with the
Read
,
Write
, and
WaitForCompletion
functions of the
CUsbIoPipe
class the buffer
has to be described by a
CUsbIoBuf
object. The
CUsbIoBuf
helper
class stores context information while the read or write operation is
pending.