Added new USB_DeviceState variable to keep track of the current Device mode USB state.
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Endpoint.h
index 2caea83..a9ec122 100644 (file)
                                ENDPOINT_RWSTREAM_EndpointStalled    = 1, /**< The endpoint was stalled during the stream\r
                                                                           *   transfer by the host or device.\r
                                                                           */\r
-                               ENDPOINT_RWSTREAM_DeviceDisconnected = 1, /**< Device was disconnected from the host during\r
+                               ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during\r
                                                                           *   the transfer.\r
                                                                           */\r
-                               ENDPOINT_RWSTREAM_Timeout            = 2, /**< The host failed to accept or send the next packet\r
+                               ENDPOINT_RWSTREAM_Timeout            = 3, /**< The host failed to accept or send the next packet\r
                                                                           *   within the software timeout period set by the\r
                                                                           *   \ref USB_STREAM_TIMEOUT_MS macro.\r
                                                                           */\r
-                               ENDPOINT_RWSTREAM_CallbackAborted    = 3, /**< Indicates that the stream's callback function\r
+                               ENDPOINT_RWSTREAM_CallbackAborted    = 4, /**< Indicates that the stream's callback function\r
                                                                       *   aborted the transfer early.\r
                                                                           */\r
                        };\r
                        {\r
                                ENDPOINT_RWCSTREAM_NoError            = 0, /**< Command completed successfully, no error. */\r
                                ENDPOINT_RWCSTREAM_HostAborted        = 1, /**< The aborted the transfer prematurely. */\r
+                               ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during\r
+                                                                           *   the transfer.\r
+                                                                           */\r
                        };\r
 \r
                /* Inline Functions: */\r
                         *  \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum.\r
                         */\r
                        uint8_t Endpoint_WaitUntilReady(void);\r
+                       \r
+                       /** Completes the status stage of a control transfer on a CONTROL type endpoint automatically,\r
+                        *  with respect to the data direction. This is a convenience function which can be used to\r
+                        *  simplify user control request handling.\r
+                        */\r
+                       void Endpoint_ClearStatusStage(void);\r
 \r
                        /** Reads and discards the given number of bytes from the endpoint from the given buffer,\r
                         *  discarding fully read packets from the host as needed. The last packet is not automatically\r
                         *  in both failure and success states; the user is responsible for manually clearing the setup OUT to\r
                         *  finalize the transfer via the \ref Endpoint_ClearOUT() macro.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\r
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
 \r
                        /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\r
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
 \r
                        /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *  in both failure and success states; the user is responsible for manually clearing the setup OUT to\r
                         *  finalize the transfer via the \ref Endpoint_ClearOUT() macro.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\r
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
 \r
                        /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\r
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
 \r
                        /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *  automatically sent after success or failure states; the user is responsible for manually sending the\r
                         *  setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\r
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
 \r
                        /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\r
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
                         *  automatically sent after success or failure states; the user is responsible for manually sending the\r
                         *  setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\r
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r
                        \r
                        /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE.\r
                         *\r
+                        *  \note This function automatically clears the control transfer's status stage. Do not manually attempt\r
+                        *        to clear the status stage when using this routine in a control transaction.\r
+                        *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\r
                         *  \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained\r