}
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
- if (IsDataRead == DATA_READ)
- VirtualFAT_ReadBlocks(BlockAddress, TotalBlocks);
- else
- VirtualFAT_WriteBlocks(BlockAddress, TotalBlocks);
+ while (TotalBlocks--)
+ {
+ if (IsDataRead == DATA_READ)
+ VirtualFAT_ReadBlock(BlockAddress);
+ else
+ VirtualFAT_WriteBlock(BlockAddress);
+
+ BlockAddress++;
+ }
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * SECTOR_SIZE_BYTES);