aboutsummaryrefslogtreecommitdiffstats
path: root/Bootloaders/MassStorage/Lib/SCSI.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2013-03-20 19:02:29 +0000
committerDean Camera <dean@fourwalledcubicle.com>2013-03-20 19:02:29 +0000
commit199cf8f1830ef1a8db14d311d6bfff26b82ef623 (patch)
tree4c7066af22f99a29827b435636e4f42a2398242b /Bootloaders/MassStorage/Lib/SCSI.c
parent6e8642185a8db602628ea18e6d03d3f71e8be448 (diff)
downloadlufa-199cf8f1830ef1a8db14d311d6bfff26b82ef623.tar.gz
lufa-199cf8f1830ef1a8db14d311d6bfff26b82ef623.tar.bz2
lufa-199cf8f1830ef1a8db14d311d6bfff26b82ef623.zip
Significantly reduce the size of the Mass Storage class bootloader, by removing dependencies on large LUFA internal functions.
Diffstat (limited to 'Bootloaders/MassStorage/Lib/SCSI.c')
-rw-r--r--Bootloaders/MassStorage/Lib/SCSI.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Bootloaders/MassStorage/Lib/SCSI.c b/Bootloaders/MassStorage/Lib/SCSI.c
index 3df8d3001..ea0700a27 100644
--- a/Bootloaders/MassStorage/Lib/SCSI.c
+++ b/Bootloaders/MassStorage/Lib/SCSI.c
@@ -212,11 +212,8 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
*/
static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
- uint32_t LastBlockAddressInLUN = (LUN_MEDIA_BLOCKS - 1);
- uint32_t MediaBlockSize = SECTOR_SIZE_BYTES;
-
- Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NULL);
- Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NULL);
+ Endpoint_Write_32_BE(LUN_MEDIA_BLOCKS - 1);
+ Endpoint_Write_32_BE(SECTOR_SIZE_BYTES);
Endpoint_ClearIN();
/* Succeed the command and update the bytes transferred counter */
@@ -237,7 +234,7 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const bool IsDataRead)
{
- uint32_t BlockAddress;
+ uint16_t BlockAddress;
uint16_t TotalBlocks;
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
@@ -259,9 +256,9 @@ 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 */
if (IsDataRead == DATA_READ)
- VirtualFAT_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
+ VirtualFAT_ReadBlocks(BlockAddress, TotalBlocks);
else
- VirtualFAT_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
+ VirtualFAT_WriteBlocks(BlockAddress, TotalBlocks);
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * SECTOR_SIZE_BYTES);