Add top level documentation to the Mass Storage class bootloader.
[pub/USBasp.git] / Bootloaders / Incomplete / MassStorage / Lib / SCSI.c
index c6596d4..154fe48 100644 (file)
@@ -116,6 +116,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
                case SCSI_CMD_MODE_SENSE_6:
                        CommandSuccess = SCSI_Command_ModeSense_6(MSInterfaceInfo);
                        break;
+               case SCSI_CMD_START_STOP_UNIT:
                case SCSI_CMD_TEST_UNIT_READY:
                case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL:
                case SCSI_CMD_VERIFY_10:
@@ -214,7 +215,7 @@ 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        = VIRTUAL_MEMORY_BLOCK_SIZE;
+       uint32_t MediaBlockSize        = SECTOR_SIZE_BYTES;
 
        Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NULL);
        Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NULL);
@@ -292,7 +293,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
          VirtualFAT_WriteBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
 
        /* Update the bytes transferred counter and succeed the command */
-       MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
+       MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * SECTOR_SIZE_BYTES);
 
        return true;
 }
@@ -306,11 +307,8 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
  */
 static bool SCSI_Command_ModeSense_6(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
 {
-       /* Send an empty header response with the Write Protect flag status */
-       Endpoint_Write_8(0x00);
-       Endpoint_Write_8(0x00);
-       Endpoint_Write_8(0x00);
-       Endpoint_Write_8(0x00);
+       /* Send an empty header response indicating Write Protect flag is off */
+       Endpoint_Write_32_LE(0);
        Endpoint_ClearIN();
 
        /* Update the bytes transferred counter and succeed the command */