diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2013-03-29 10:40:40 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2013-03-29 10:40:40 +0000 |
commit | ddd663229597b4b680b0192933cd37d2189cbed3 (patch) | |
tree | c473a7391cdc904754960bd9f76b9f8c8e5c8bce /Bootloaders/MassStorage | |
parent | 907cb2459c5ea18d9853367a30d94eb232652ca4 (diff) | |
download | lufa-ddd663229597b4b680b0192933cd37d2189cbed3.tar.gz lufa-ddd663229597b4b680b0192933cd37d2189cbed3.tar.bz2 lufa-ddd663229597b4b680b0192933cd37d2189cbed3.zip |
Oops - ensure the SCSI transfer length is correct in the Mass Storage bootloader.
Diffstat (limited to 'Bootloaders/MassStorage')
-rw-r--r-- | Bootloaders/MassStorage/Lib/SCSI.c | 8 | ||||
-rw-r--r-- | Bootloaders/MassStorage/Lib/VirtualFAT.h | 10 |
2 files changed, 8 insertions, 10 deletions
diff --git a/Bootloaders/MassStorage/Lib/SCSI.c b/Bootloaders/MassStorage/Lib/SCSI.c index b23a5a07b..eeb2c252a 100644 --- a/Bootloaders/MassStorage/Lib/SCSI.c +++ b/Bootloaders/MassStorage/Lib/SCSI.c @@ -255,14 +255,12 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa } /* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */ - while (TotalBlocks--) + for (uint16_t i = 0; i < TotalBlocks; i++) { if (IsDataRead == DATA_READ) - VirtualFAT_ReadBlock(BlockAddress); + VirtualFAT_ReadBlock(BlockAddress + i); else - VirtualFAT_WriteBlock(BlockAddress); - - BlockAddress++; + VirtualFAT_WriteBlock(BlockAddress + i); } /* Update the bytes transferred counter and succeed the command */ diff --git a/Bootloaders/MassStorage/Lib/VirtualFAT.h b/Bootloaders/MassStorage/Lib/VirtualFAT.h index 58f5723f9..d01f9be53 100644 --- a/Bootloaders/MassStorage/Lib/VirtualFAT.h +++ b/Bootloaders/MassStorage/Lib/VirtualFAT.h @@ -139,15 +139,15 @@ enum { /** Boot sector disk block. */ - DISK_BLOCK_BootBlock = 0, + DISK_BLOCK_BootBlock = 0, /** First copy of the FAT table block. */ - DISK_BLOCK_FATBlock1 = 1, + DISK_BLOCK_FATBlock1 = 1, /** Second copy of the FAT table block. */ - DISK_BLOCK_FATBlock2 = 2, + DISK_BLOCK_FATBlock2 = 2, /** Root file and directory entries block. */ - DISK_BLOCK_RootFilesBlock = 3, + DISK_BLOCK_RootFilesBlock = 3, /** Start block of the disk data section. */ - DISK_BLOCK_DataStartBlock = 4, + DISK_BLOCK_DataStartBlock = 4, }; /* Type Definitions: */ |