Information Technology Reference
In-Depth Information
if (status) {
// The sector write failed.
msd_csw.bCSWStatus = 0x01;
// Store sense data to describe the error.
gblSenseData.SenseKey = S_MEDIUM_ERROR;
gblSenseData.ASC = ASC_PERIPHERAL_DEVICE_WRITE_FAULT;
gblSenseData.ASCQ = ASCQ_PERIPHERAL_DEVICE_WRITE_FAULT;
}
// Increment the LBA. Decrement the number of blocks remaining to write.
LBA._dword++;
TransferLength._word--;
if (TransferLength._word > 0){
// There is more data to receive.
// Configure the endpoint's buffer descriptor to prepare for the data.
MSD_BD_OUT.Cnt = MSD_OUT_EP_SIZE;
MSD_BD_OUT.ADR = (byte*)&msd_buffer[0];
} else {
// All of the data has been received.
// Configure the endpoint's buffer descriptor to prepare for the next command.
MSD_BD_OUT.Cnt = sizeof(msd_cbw);
MSD_BD_OUT.ADR = (byte*)&msd_cbw;
}
} // End: while (TransferLength._word > 0)
return;
}
Search WWH ::




Custom Search