Don't cast the line encoding baud rate to a uint16_t before performing the baud rate...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Endpoint.h
index 6d98b78..93412f5 100644 (file)
   this software.\r
 */\r
 \r
+/** \file\r
+ *  \brief USB device endpoint management definitions.\r
+ *\r
+ *  This file contains structures, function prototypes and macros related to the management of the device's\r
+ *  data endpoints when the library is initialized in USB device mode.\r
+ *\r
+ *  \note This file should not be included directly. It is automatically included as needed by the USB driver\r
+ *        dispatch header located in LUFA/Drivers/USB/USB.h.\r
+ */\r
+\r
 /** \ingroup Group_USB\r
  *  @defgroup Group_EndpointManagement Endpoint Management\r
  *\r
@@ -85,7 +95,7 @@
 \r
        /* Preprocessor Checks: */\r
                #if !defined(__INCLUDE_FROM_USB_DRIVER)\r
-                       #error Do not include this file directly. Include LUFA/Drivers/USB.h instead.\r
+                       #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.\r
                #endif\r
                \r
        /* Public Interface - May be used in end-application: */\r
                                #define Endpoint_ClearSETUP()                 MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE\r
 \r
                                #if !defined(CONTROL_ONLY_DEVICE)\r
-                                       #define Endpoint_ClearIN()                MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << TXINI)); \\r
-                                                                                         UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+                                       #define Endpoint_ClearIN()                MACROS{ UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); }MACROE\r
                                #else\r
                                        #define Endpoint_ClearIN()                MACROS{ UEINTX &= ~(1 << TXINI); }MACROE\r
                                #endif\r
 \r
                                #if !defined(CONTROL_ONLY_DEVICE)\r
-                                       #define Endpoint_ClearOUT()               MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << RXOUTI)); \\r
-                                                                                         UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE\r
+                                       #define Endpoint_ClearOUT()               MACROS{ UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); }MACROE\r
                                #else\r
                                        #define Endpoint_ClearOUT()               MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE                     \r
                                #endif\r
                                                                                 */\r
                                ENDPOINT_READYWAIT_DeviceDisconnected      = 2, /**< Device was disconnected from the host while\r
                                                                                 *   waiting for the endpoint to become ready.\r
-                                                                                */     \r
-                               ENDPOINT_READYWAIT_Timeout                 = 3, /**< The host failed to accept or send the next packet\r
+                                                                                */\r
+                               ENDPOINT_READYWAIT_BusSuspended            = 3, /**< The USB bus has been suspended by the host and\r
+                                                                                *   no USB endpoint traffic can occur until the bus\r
+                                                                                *   has resumed.\r
+                                                                                */\r
+                               ENDPOINT_READYWAIT_Timeout                 = 4, /**< 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_DeviceDisconnected = 2, /**< Device was disconnected from the host during\r
                                                                           *   the transfer.\r
                                                                           */\r
-                               ENDPOINT_RWSTREAM_Timeout            = 3, /**< The host failed to accept or send the next packet\r
+                               ENDPOINT_RWSTREAM_BusSuspended       = 3, /**< The USB bus has been suspended by the host and\r
+                                                                          *   no USB endpoint traffic can occur until the bus\r
+                                                                          *   has resumed.\r
+                                                                          */\r
+                               ENDPOINT_RWSTREAM_Timeout            = 4, /**< 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    = 4, /**< Indicates that the stream's callback function\r
+                               ENDPOINT_RWSTREAM_CallbackAborted    = 5, /**< Indicates that the stream's callback function\r
                                                                       *   aborted the transfer early.\r
                                                                           */\r
                        };\r
                                ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during\r
                                                                            *   the transfer.\r
                                                                            */\r
+                               ENDPOINT_RWCSTREAM_BusSuspended       = 3, /**< The USB bus has been suspended by the host and\r
+                                                                           *   no USB endpoint traffic can occur until the bus\r
+                                                                           *   has resumed.\r
+                                                                           */\r
                        };\r
 \r
                /* Inline Functions: */\r
                         *  The banking mode may be either \ref ENDPOINT_BANK_SINGLE or \ref ENDPOINT_BANK_DOUBLE.\r
                         *\r
                         *  \note The default control endpoint does not have to be manually configured, as it is automatically\r
-                        *  configured by the library internally.\r
+                        *        configured by the library internally.\r
+                        *        \n\n\r
                         *\r
                         *  \note This routine will select the specified endpoint, and the endpoint will remain selected\r
                         *        once the routine completes regardless of if the endpoint configuration succeeds.\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
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\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
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\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
+                        *        \n\n\r
                         *\r
                         *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\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
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\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
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\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
+                        *        \n\n\r
                         *\r
                         *  \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.\r
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\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
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\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
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\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
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\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
+                        *        \n\n\r
                         *\r
                         *  \note This routine should only be used on CONTROL type endpoints.\r
                         *\r