Information Technology Reference
In-Depth Information
// Is the bulk OUT endpoint receiving data from the host?
if (MSD_State == MSD_DATA_OUT) {
// Has all of the data been received?
if (gblCBW.dCBWDataTransferLength == 0) {
// If dCSWDataResidue isn't zero, the quantity of received data
// doesn't match the quantity expected.
if ((msd_csw.bCSWStatus == 0x00) && (msd_csw.dCSWDataResidue != 0))
// Set bCSWStatus to phase error (02h).
msd_csw.bCSWStatus = 0x02;
// Prepare to send the CSW.
SendCSW();
}
return;
} // End: receiving data from the host
// If the CPU owns the OUT endpoint's buffer descriptor,
// was the device waiting for a CBW?
if ((MSD_BD_OUT.Stat.UOWN == _UCPU) && (MSD_State == MSD_WAIT))
{
// Copy the received CBW into the gblCBW structure.
gblCBW.dCBWSignature = msd_cbw.dCBWSignature;
gblCBW.dCBWTag = msd_cbw.dCBWTag;
gblCBW.dCBWDataTransferLength = msd_cbw.dCBWDataTransferLength;
gblCBW.bCBWFlags = msd_cbw.bCBWFlags;
gblCBW.bCBWLUN = msd_cbw.bCBWLUN;
gblCBW.bCBWCBLength = msd_cbw.bCBWCBLength;
for (i = 0; i < msd_cbw.bCBWCBLength; i++)
gblCBW.CBWCB[i] =
msd_cbw.CBWCB[i];
Search WWH ::




Custom Search