Added new ENDPOINT_*_BusSuspended error code to the Endpoint function, so that the stream functions early-abort if the bus is suspended before or during a transfer.

This commit is contained in:
Dean Camera committed 2010-05-03 07:41:22 +00:00
1 parent 5c0c0327d5
commit eed7d4df6a
9 files changed
+34 -10

No files matched your search

@@ -18,6 +18,8 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length)
if (USB_DeviceState == DEVICE_STATE_Unattached)
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
else if (USB_DeviceState == DEVICE_STATE_Suspended)
return ENDPOINT_RWCSTREAM_BusSuspended;
if (Endpoint_IsINReady())
{
@@ -38,7 +40,9 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer, uint16_t Length)
while (!(Endpoint_IsOUTReceived()))
{
if (USB_DeviceState == DEVICE_STATE_Unattached)
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
else if (USB_DeviceState == DEVICE_STATE_Suspended)
return ENDPOINT_RWCSTREAM_BusSuspended;
}
return ENDPOINT_RWCSTREAM_NoError;