Changed default value for the reset polarity parameter in the AVRISP-MKII project...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / MassStorage.c
index 82746cd..0366703 100644 (file)
@@ -166,19 +166,21 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInf
 
 static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)
 {
 
 static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)
 {
-       uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS;
+       uint16_t TimeoutMSRem        = COMMAND_DATA_TIMEOUT_MS;
+       uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber();
 
        Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
        Pipe_Unfreeze();
 
        while (!(Pipe_IsINReceived()))
        {
 
        Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
        Pipe_Unfreeze();
 
        while (!(Pipe_IsINReceived()))
        {
-               if (USB_INT_HasOccurred(USB_INT_HSOFI))
+               uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber();
+               
+               if (CurrentFrameNumber != PreviousFrameNumber)
                {
                {
-                       USB_INT_Clear(USB_INT_HSOFI);
-                       TimeoutMSRem--;
+                       PreviousFrameNumber = CurrentFrameNumber;
 
 
-                       if (!(TimeoutMSRem))
+                       if (!(TimeoutMSRem--))
                          return PIPE_RWSTREAM_Timeout;
                }
        
                          return PIPE_RWSTREAM_Timeout;
                }
        
@@ -282,7 +284,7 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf
        Pipe_ClearIN();
        Pipe_Freeze();
        
        Pipe_ClearIN();
        Pipe_Freeze();
        
-       if (SCSICommandStatus->Status != SCSI_Command_Pass)
+       if (SCSICommandStatus->Status != MS_SCSI_COMMAND_Pass)
          ErrorCode = MS_ERROR_LOGICAL_CMD_FAILED;
        
        return ErrorCode;
          ErrorCode = MS_ERROR_LOGICAL_CMD_FAILED;
        
        return ErrorCode;
@@ -546,7 +548,7 @@ uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
                                        (BlockAddress >> 16),
                                        (BlockAddress >> 8),
                                        (BlockAddress & 0xFF),  // LSB of Block Address
                                        (BlockAddress >> 16),
                                        (BlockAddress >> 8),
                                        (BlockAddress & 0xFF),  // LSB of Block Address
-                                       0x00,                   // Unused (reserved)
+                                       0x00,                   // Reserved
                                        0x00,                   // MSB of Total Blocks to Read
                                        Blocks,                 // LSB of Total Blocks to Read
                                        0x00                    // Unused (control)
                                        0x00,                   // MSB of Total Blocks to Read
                                        Blocks,                 // LSB of Total Blocks to Read
                                        0x00                    // Unused (control)
@@ -590,7 +592,7 @@ uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo
                                        (BlockAddress >> 16),
                                        (BlockAddress >> 8),
                                        (BlockAddress & 0xFF),  // LSB of Block Address
                                        (BlockAddress >> 16),
                                        (BlockAddress >> 8),
                                        (BlockAddress & 0xFF),  // LSB of Block Address
-                                       0x00,                   // Unused (reserved)
+                                       0x00,                   // Reserved
                                        0x00,                   // MSB of Total Blocks to Write
                                        Blocks,                 // LSB of Total Blocks to Write
                                        0x00                    // Unused (control)
                                        0x00,                   // MSB of Total Blocks to Write
                                        Blocks,                 // LSB of Total Blocks to Write
                                        0x00                    // Unused (control)