Dataflash_SendAddressBytes(0, CurrDFPageByte);\r
\r
/* Wait until endpoint is ready before continuing */\r
- while (!(Endpoint_IsReadWriteAllowed()))\r
- {\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)\r
- return;\r
- }\r
+ if (Endpoint_WaitUntilReady())\r
+ return;\r
\r
while (TotalBlocks)\r
{\r
Endpoint_ClearOUT();\r
\r
/* Wait until the host has sent another packet */\r
- while (!(Endpoint_IsReadWriteAllowed()))\r
- {\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)\r
- return;\r
- }\r
+ if (Endpoint_WaitUntilReady())\r
+ return;\r
}\r
\r
/* Check if end of dataflash page reached */\r
Dataflash_SendByte(0x00);\r
\r
/* Wait until endpoint is ready before continuing */\r
- while (!(Endpoint_IsReadWriteAllowed()))\r
- {\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)\r
- return;\r
- }\r
+ if (Endpoint_WaitUntilReady())\r
+ return;\r
\r
while (TotalBlocks)\r
{\r
Endpoint_ClearIN();\r
\r
/* Wait until the endpoint is ready for more data */\r
- while (!(Endpoint_IsReadWriteAllowed()))\r
- {\r
- if (USB_DeviceState == DEVICE_STATE_Unattached)\r
- return;\r
- }\r
+ if (Endpoint_WaitUntilReady())\r
+ return;\r
}\r
\r
/* Check if end of dataflash page reached */\r