aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/LowLevel/Endpoint.h
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-07-21 13:31:21 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-07-21 13:31:21 +0000
commite071f3897a0946c6be1e1b5e1f78eda8dcbf6fc7 (patch)
tree51ac5c80564fd76c93a357ee4d52a347384ac84b /LUFA/Drivers/USB/LowLevel/Endpoint.h
parent44179abcf85acb14fb3aff72ce50ae84281c0f2e (diff)
downloadlufa-e071f3897a0946c6be1e1b5e1f78eda8dcbf6fc7.tar.gz
lufa-e071f3897a0946c6be1e1b5e1f78eda8dcbf6fc7.tar.bz2
lufa-e071f3897a0946c6be1e1b5e1f78eda8dcbf6fc7.zip
Added new USB_DeviceState variable to keep track of the current Device mode USB state.
Added new Endpoint_ClearStatusStage() convenience function to assist with the status stages of control transfers. Removed vague USB_IsConnected global - test USB_DeviceState or USB_HostState explicitly to gain previous functionality. Removed USB_IsSuspended global - test USB_DeviceState against DEVICE_STATE_Suspended instead. Fixed possible enumeration errors from spinloops which may fail to exit if the USB connection is severed before the exit condition becomes true.
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Endpoint.h')
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.h45
1 files changed, 42 insertions, 3 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h
index 2caea8343..a9ec122a2 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.h
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h
@@ -431,14 +431,14 @@
ENDPOINT_RWSTREAM_EndpointStalled = 1, /**< The endpoint was stalled during the stream
* transfer by the host or device.
*/
- ENDPOINT_RWSTREAM_DeviceDisconnected = 1, /**< Device was disconnected from the host during
+ ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
* the transfer.
*/
- ENDPOINT_RWSTREAM_Timeout = 2, /**< The host failed to accept or send the next packet
+ ENDPOINT_RWSTREAM_Timeout = 3, /**< The host failed to accept or send the next packet
* within the software timeout period set by the
* \ref USB_STREAM_TIMEOUT_MS macro.
*/
- ENDPOINT_RWSTREAM_CallbackAborted = 3, /**< Indicates that the stream's callback function
+ ENDPOINT_RWSTREAM_CallbackAborted = 4, /**< Indicates that the stream's callback function
* aborted the transfer early.
*/
};
@@ -451,6 +451,9 @@
{
ENDPOINT_RWCSTREAM_NoError = 0, /**< Command completed successfully, no error. */
ENDPOINT_RWCSTREAM_HostAborted = 1, /**< The aborted the transfer prematurely. */
+ ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
+ * the transfer.
+ */
};
/* Inline Functions: */
@@ -726,6 +729,12 @@
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum.
*/
uint8_t Endpoint_WaitUntilReady(void);
+
+ /** Completes the status stage of a control transfer on a CONTROL type endpoint automatically,
+ * with respect to the data direction. This is a convenience function which can be used to
+ * simplify user control request handling.
+ */
+ void Endpoint_ClearStatusStage(void);
/** Reads and discards the given number of bytes from the endpoint from the given buffer,
* discarding fully read packets from the host as needed. The last packet is not automatically
@@ -922,6 +931,9 @@
* in both failure and success states; the user is responsible for manually clearing the setup OUT to
* finalize the transfer via the \ref Endpoint_ClearOUT() macro.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
@@ -938,6 +950,9 @@
/** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
@@ -954,6 +969,9 @@
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \note This routine should only be used on CONTROL type endpoints.
@@ -975,6 +993,9 @@
* in both failure and success states; the user is responsible for manually clearing the setup OUT to
* finalize the transfer via the \ref Endpoint_ClearOUT() macro.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
@@ -991,6 +1012,9 @@
/** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
@@ -1007,6 +1031,9 @@
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
*
* \note This routine should only be used on CONTROL type endpoints.
@@ -1028,6 +1055,9 @@
* automatically sent after success or failure states; the user is responsible for manually sending the
* setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
@@ -1044,6 +1074,9 @@
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
@@ -1063,6 +1096,9 @@
* automatically sent after success or failure states; the user is responsible for manually sending the
* setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
@@ -1079,6 +1115,9 @@
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE.
*
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ *
* \note This routine should only be used on CONTROL type endpoints.
*
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained