return ErrorCode;\r
\r
/* Send the data in the OUT pipe to the attached device */\r
- Pipe_ClearCurrentBank();\r
+ Pipe_ClearOUT();\r
\r
/* Some buggy devices require a delay here before the pipe freezing or they will lock up */\r
USB_Host_WaitMS(1);\r
Pipe_Unfreeze();\r
\r
/* Wait until data received in the IN pipe */\r
- while (!(Pipe_ReadWriteAllowed()))\r
+ while (!(Pipe_IsINReceived()))\r
{\r
/* Check to see if a new frame has been issued (1ms elapsed) */\r
if (USB_INT_HasOccurred(USB_INT_HSOFI))\r
/* Read in the block data from the pipe */\r
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_ERROR_NoError)\r
return ErrorCode;\r
+\r
+ /* Acknowledge the packet */\r
+ Pipe_ClearIN();\r
}\r
else\r
{\r
/* Write the block data to the pipe */\r
if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_ERROR_NoError)\r
return ErrorCode;\r
+\r
+ /* Acknowledge the packet */\r
+ Pipe_ClearOUT();\r
}\r
- \r
- /* Acknowledge the packet */\r
- Pipe_ClearCurrentBank();\r
\r
/* Some buggy devices require a delay here before the pipe freezing or they will lock up */\r
USB_Host_WaitMS(1);\r
uint8_t ErrorCode = PIPE_RWSTREAM_ERROR_NoError;\r
\r
/* If an error in the command ocurred, abort */\r
- if (MassStore_WaitForDataReceived() != NoError)\r
- return;\r
+ if ((ErrorCode == MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_ERROR_NoError)\r
+ return ErrorCode;\r
\r
/* Select the IN data pipe for data reception */\r
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);\r
return ErrorCode;\r
\r
/* Clear the data ready for next reception */\r
- Pipe_ClearCurrentBank();\r
+ Pipe_ClearIN();\r
\r
/* Some buggy devices require a delay here before the pipe freezing or they will lock up */\r
USB_Host_WaitMS(1);\r