diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-05-03 07:41:22 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-05-03 07:41:22 +0000 |
commit | eed7d4df6ae3da8616ec294d303ceea26078c707 (patch) | |
tree | 49b2ff97d0c9c97035853fd9910a3502624720bd /LUFA/Drivers/USB/LowLevel/Template | |
parent | 5c0c0327d56cfe682913ad04eb4df5c6286d3661 (diff) | |
download | lufa-eed7d4df6ae3da8616ec294d303ceea26078c707.tar.gz lufa-eed7d4df6ae3da8616ec294d303ceea26078c707.tar.bz2 lufa-eed7d4df6ae3da8616ec294d303ceea26078c707.zip |
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.
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Template')
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c | 4 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c index 6948296a5..92b5396d7 100644 --- a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c +++ b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_R.c @@ -12,6 +12,8 @@ uint8_t TEMPLATE_FUNC_NAME (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_IsOUTReceived())
{
@@ -29,6 +31,8 @@ uint8_t TEMPLATE_FUNC_NAME (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;
}
return ENDPOINT_RWCSTREAM_NoError;
diff --git a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c index 7868060fe..8a5be11f1 100644 --- a/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c +++ b/LUFA/Drivers/USB/LowLevel/Template/Template_Endpoint_Control_W.c @@ -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;
|