aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Device/MassStorage.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-07-11 09:50:54 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-07-11 09:50:54 +0000
commit85e85befc41a9a66a49db0afd08e04c88ba38556 (patch)
tree7a056c1f10c57743eb66aefc125e224b61660506 /LUFA/Drivers/USB/Class/Device/MassStorage.c
parent7c7778e3cec4cf8df7ec235bbf78557d4abe17af (diff)
downloadlufa-85e85befc41a9a66a49db0afd08e04c88ba38556.tar.gz
lufa-85e85befc41a9a66a49db0afd08e04c88ba38556.tar.bz2
lufa-85e85befc41a9a66a49db0afd08e04c88ba38556.zip
More endianness porting of the LUFA device mode class drivers.
Add endianness information to the class driver and core structure definitions. Move out the unused Ethernet_Frame_Info_t structure definition to the RNDIS device demos where it is needed.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Device/MassStorage.c')
-rw-r--r--LUFA/Drivers/USB/Class/Device/MassStorage.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.c b/LUFA/Drivers/USB/Class/Device/MassStorage.c
index efc9cd4b3..4f1542ae9 100644
--- a/LUFA/Drivers/USB/Class/Device/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Device/MassStorage.c
@@ -124,17 +124,15 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
if (MSInterfaceInfo->State.CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
- MSInterfaceInfo->State.CommandStatus.Status = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo) ?
- MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
- MSInterfaceInfo->State.CommandStatus.Signature = MS_CSW_SIGNATURE;
+ bool SCSICommandResult = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo);
+
+ MSInterfaceInfo->State.CommandStatus.Status = (SCSICommandResult) ? MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
+ MSInterfaceInfo->State.CommandStatus.Signature = CPU_TO_LE32(MS_CSW_SIGNATURE);
MSInterfaceInfo->State.CommandStatus.Tag = MSInterfaceInfo->State.CommandBlock.Tag;
MSInterfaceInfo->State.CommandStatus.DataTransferResidue = MSInterfaceInfo->State.CommandBlock.DataTransferLength;
- if ((MSInterfaceInfo->State.CommandStatus.Status == MS_SCSI_COMMAND_Fail) &&
- (MSInterfaceInfo->State.CommandStatus.DataTransferResidue))
- {
- Endpoint_StallTransaction();
- }
+ if (!(SCSICommandResult) && (le32_to_cpu(MSInterfaceInfo->State.CommandStatus.DataTransferResidue)))
+ Endpoint_StallTransaction();
MS_Device_ReturnCommandStatus(MSInterfaceInfo);
}
@@ -167,11 +165,15 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
(sizeof(MS_CommandBlockWrapper_t) - 16), &BytesProcessed) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
+ #if !defined(INTERRUPT_CONTROL_ENDPOINT)
+ USB_USBTask();
+ #endif
+
if (MSInterfaceInfo->State.IsMassStoreReset)
return false;
}
- if ((MSInterfaceInfo->State.CommandBlock.Signature != MS_CBW_SIGNATURE) ||
+ if ((MSInterfaceInfo->State.CommandBlock.Signature != CPU_TO_LE32(MS_CBW_SIGNATURE)) ||
(MSInterfaceInfo->State.CommandBlock.LUN >= MSInterfaceInfo->Config.TotalLUNs) ||
(MSInterfaceInfo->State.CommandBlock.Flags & 0x1F) ||
(MSInterfaceInfo->State.CommandBlock.SCSICommandLength == 0) ||
@@ -189,6 +191,10 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
MSInterfaceInfo->State.CommandBlock.SCSICommandLength, &BytesProcessed) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
+ #if !defined(INTERRUPT_CONTROL_ENDPOINT)
+ USB_USBTask();
+ #endif
+
if (MSInterfaceInfo->State.IsMassStoreReset)
return false;
}
@@ -229,6 +235,10 @@ static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInt
sizeof(MS_CommandStatusWrapper_t), &BytesProcessed) ==
ENDPOINT_RWSTREAM_IncompleteTransfer)
{
+ #if !defined(INTERRUPT_CONTROL_ENDPOINT)
+ USB_USBTask();
+ #endif
+
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}