Information Technology Reference
In-Depth Information
Managing Transfers
The ProcessIO function manages transfers on the bulk endpoints. The func-
tion implements a state machine that determines what to do depending on
the value of MSD_State. The function calls the MSDCommandHandler
function in Chapter 6 to decode and respond to command blocks in the
CBW.
void ProcessIO(void)
{
byte
i;
dword
size;
// Is the bulk IN endpoint sending data to the host?
if (MSD_State == MSD_DATA_IN) {
// Has all of the data been sent?
if (gblCBW.dCBWDataTransferLength == 0)
{
// Prepare to send the CSW.
SendCSW();
}
else
{
// Prepare to send data.
MSDDataIn();
}
return;
} // End: sending data to host.
Search WWH ::
Custom Search