Content originally posted in LPCWare by Madara on Mon Nov 25 03:29:33 MST 2013
I changed the code to following where instead of requesting 512 bytes of data using Endpoint_Read_Stream_LE((void *)Buffer, 512, ((void *)0)); I am using Endpoint_Read_8() inside USB_get_data to reveive 16 bytes of out transfer.But the result is the same.I have ran out of options.
while(TotalBlocks--){
offset = 0;
length = 512;
memset(Buffer,0,512);
while(!Endpoint_IsReadWriteAllowed());
while(length > 0){
bytestowrite = USB_get_data(temp);
TRACE("B%d",bytestowrite);
if(!bytestowrite)
break;
memcpy(Buffer + offset, temp, bytestowrite);
offset += bytestowrite;
length -= bytestowrite;
}
sdmmc_write(Buffer, BlockAddress,1);
if (MSInterfaceInfo->State.IsMassStoreReset)
return 0;
BlockAddress++;
}
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearOUT();