Add missing const qualifier to the parameters of the USB_GetNextDescriptorComp()...
[pub/USBasp.git] / Demos / Device / LowLevel / MassStorage / Lib / SCSI.c
index 46c71c3..d718e7e 100644 (file)
@@ -136,7 +136,7 @@ bool SCSI_DecodeSCSICommand(void)
  */
 static void SCSI_Command_Inquiry(void)
 {
  */
 static void SCSI_Command_Inquiry(void)
 {
-       uint16_t AllocationLength  = SwapEndian_16(*(uint32_t*)&CommandBlock.SCSICommandData[3]);
+       uint16_t AllocationLength  = SwapEndian_16(*(uint16_t*)&CommandBlock.SCSICommandData[3]);
        uint16_t BytesTransferred  = (AllocationLength < sizeof(InquiryData))? AllocationLength :
                                                                               sizeof(InquiryData);
 
        uint16_t BytesTransferred  = (AllocationLength < sizeof(InquiryData))? AllocationLength :
                                                                               sizeof(InquiryData);
 
@@ -252,14 +252,8 @@ static void SCSI_Command_Send_Diagnostic(void)
  */
 static void SCSI_Command_ReadWrite_10(const bool IsDataRead)
 {
  */
 static void SCSI_Command_ReadWrite_10(const bool IsDataRead)
 {
-       uint32_t BlockAddress;
-       uint16_t TotalBlocks;
-       
-       /* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
-       BlockAddress = SwapEndian_32(*(uint32_t*)&CommandBlock.SCSICommandData[2]);
-
-       /* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
-       TotalBlocks  = SwapEndian_16(*(uint32_t*)&CommandBlock.SCSICommandData[7]);
+       uint32_t BlockAddress = SwapEndian_32(*(uint32_t*)&CommandBlock.SCSICommandData[2]);
+       uint16_t TotalBlocks  = SwapEndian_16(*(uint16_t*)&CommandBlock.SCSICommandData[7]);
 
        /* Check if the block address is outside the maximum allowable value for the LUN */
        if (BlockAddress >= LUN_MEDIA_BLOCKS)
 
        /* Check if the block address is outside the maximum allowable value for the LUN */
        if (BlockAddress >= LUN_MEDIA_BLOCKS)