Information Technology Reference
In-Depth Information
} else {
// Read blocks from the media and send the contents to the USB host
// until TransferLength = 0.
while (TransferLength._word > 0) {
// Decrement the number of blocks remaining.
TransferLength._word--;
// Copy the specified block's data into msd_buffer.
status = SectorRead(LBA._dword, (byte*)&msd_buffer[0]);
// Increment the LBA.
LBA._dword++;
if (status == sdcValid) {
// The sector-read operation succeeded.
// Prepare to send 512 bytes to the USB host.
// Set fields in the CSW.
msd_csw.bCSWStatus = 0x00;
msd_csw.dCSWDataResidue = 0x200; // 512 bytes
// The next block to read begins where this one ended.
ptrNextData = (byte *)&msd_buffer[0];
while (msd_csw.dCSWDataResidue > 0)
// The MSDDataIn function sends the data to the USB host.
// dCSWDataResidue is decremented as the data is sent.
// Continue until dCSWDataResidue = 0.
MSDDataIn();
// Reset dCSWDataResidue.
msd_csw.dCSWDataResidue = 0x0;
Search WWH ::




Custom Search