/* Routine to receive the current CSW from the device. */
static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t *const SCSICommandStatus)
/* Routine to receive the current CSW from the device. */
static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t *const SCSICommandStatus)
{
	uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
	if ((ErrorCode = MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_NoError)
	  return ErrorCode;
	Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
	Pipe_Unfreeze();
	if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t), NULL)) !=
	                                     PIPE_RWSTREAM_NoError)
	{
		return ErrorCode;
	}
	Pipe_ClearIN();
	Pipe_Freeze();
	if (SCSICommandStatus->Status != MS_SCSI_COMMAND_Pass)
	  ErrorCode = MASS_STORE_SCSI_COMMAND_FAILED;
	return ErrorCode;
}