/** Structure to hold the latest Command Block Wrapper issued by the host, containing a SCSI command to execute. */\r
CommandBlockWrapper_t CommandBlock;\r
\r
/** Structure to hold the latest Command Block Wrapper issued by the host, containing a SCSI command to execute. */\r
CommandBlockWrapper_t CommandBlock;\r
\r
/** Flag to asynchronously abort any in-progress data transfers upon the reception of a mass storage reset command. */\r
volatile bool IsMassStoreReset = false;\r
\r
/** Flag to asynchronously abort any in-progress data transfers upon the reception of a mass storage reset command. */\r
volatile bool IsMassStoreReset = false;\r
\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the Mass Storage management task.\r
*/\r
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via\r
* the status LEDs and stops the Mass Storage management task.\r
*/\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the Mass Storage management task started.\r
*/\r
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration\r
* of the USB device after enumeration - the device endpoints are configured and the Mass Storage management task started.\r
*/\r
* control requests that are not handled internally by the USB library (including the Mass Storage class-specific\r
* requests) so that they can be handled appropriately for the application.\r
*/\r
* control requests that are not handled internally by the USB library (including the Mass Storage class-specific\r
* requests) so that they can be handled appropriately for the application.\r
*/\r
if (CommandBlock.Flags & COMMAND_DIRECTION_DATA_IN)\r
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);\r
\r
if (CommandBlock.Flags & COMMAND_DIRECTION_DATA_IN)\r
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);\r
\r
- /* Decode the received SCSI command */\r
- SCSI_DecodeSCSICommand();\r
+ /* Decode the received SCSI command, set returned status code */\r
+ CommandStatus.Status = SCSI_DecodeSCSICommand() ? Command_Pass : Command_Fail; \r
\r
/* Load in the CBW tag into the CSW to link them together */\r
CommandStatus.Tag = CommandBlock.Tag;\r
\r
/* Load in the data residue counter into the CSW */\r
CommandStatus.DataTransferResidue = CommandBlock.DataTransferLength;\r
\r
/* Load in the CBW tag into the CSW to link them together */\r
CommandStatus.Tag = CommandBlock.Tag;\r
\r
/* Load in the data residue counter into the CSW */\r
CommandStatus.DataTransferResidue = CommandBlock.DataTransferLength;\r
/* Stall the selected data pipe if command failed (if data is still to be transferred) */\r
if ((CommandStatus.Status == Command_Fail) && (CommandStatus.DataTransferResidue))\r
Endpoint_StallTransaction();\r
/* Stall the selected data pipe if command failed (if data is still to be transferred) */\r
if ((CommandStatus.Status == Command_Fail) && (CommandStatus.DataTransferResidue))\r
Endpoint_StallTransaction();\r