Fixed USB_RemoteWakeupEnabled flag never being set (the REMOTE WAKEUP Set Feature...
[pub/USBasp.git] / LUFA / Drivers / USB / LowLevel / Endpoint.h
index 172ab33..1e88e06 100644 (file)
                         */                             \r
                        #define ENDPOINT_DOUBLEBANK_SUPPORTED(n)      _ENDPOINT_GET_DOUBLEBANK(n)\r
 \r
-                       #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || defined(__DOXYGEN__)\r
-                               /** Total number of endpoints (including the default control endpoint at address 0) which may\r
-                                *  be used in the device. Different USB AVR models support different amounts of endpoints,\r
-                                *  this value reflects the maximum number of endpoints for the currently selected AVR model.\r
-                                */\r
-                               #define ENDPOINT_TOTAL_ENDPOINTS          7\r
+                       #if !defined(CONTROL_ONLY_DEVICE)\r
+                               #if defined(USB_FULL_CONTROLLER) || defined(USB_MODIFIED_FULL_CONTROLLER) || defined(__DOXYGEN__)\r
+                                       /** Total number of endpoints (including the default control endpoint at address 0) which may\r
+                                        *  be used in the device. Different USB AVR models support different amounts of endpoints,\r
+                                        *  this value reflects the maximum number of endpoints for the currently selected AVR model.\r
+                                        */\r
+                                       #define ENDPOINT_TOTAL_ENDPOINTS          7\r
+                               #else\r
+                                       #define ENDPOINT_TOTAL_ENDPOINTS          5                     \r
+                               #endif\r
                        #else\r
-                               #define ENDPOINT_TOTAL_ENDPOINTS          5                     \r
+                               #define ENDPOINT_TOTAL_ENDPOINTS              1\r
                        #endif\r
 \r
                        /** Interrupt definition for the endpoint SETUP interrupt (for CONTROL type endpoints). Should be\r
                                        #define Endpoint_BytesInEndpoint()        UEBCLX\r
                                #endif\r
                                \r
-                               #define Endpoint_GetCurrentEndpoint()         (UENUM & ENDPOINT_EPNUM_MASK)\r
+                               #if !defined(CONTROL_ONLY_DEVICE)\r
+                                       #define Endpoint_GetCurrentEndpoint()     (UENUM & ENDPOINT_EPNUM_MASK)\r
+                               #else\r
+                                       #define Endpoint_GetCurrentEndpoint()     ENDPOINT_CONTROLEP\r
+                               #endif\r
                                \r
-                               #define Endpoint_SelectEndpoint(epnum)        MACROS{ UENUM = epnum; }MACROE\r
+                               #if !defined(CONTROL_ONLY_DEVICE)\r
+                                       #define Endpoint_SelectEndpoint(epnum)    MACROS{ UENUM = epnum; }MACROE\r
+                               #else\r
+                                       #define Endpoint_SelectEndpoint(epnum)    (void)epnum\r
+                               #endif\r
 \r
                                #define Endpoint_ResetFIFO(epnum)             MACROS{ UERST = (1 << epnum); UERST = 0; }MACROE\r
 \r
 \r
                                #define Endpoint_IsEnabled()                  ((UECONX & (1 << EPEN)) ? true : false)\r
 \r
-                               #define Endpoint_IsReadWriteAllowed()         ((UEINTX & (1 << RWAL)) ? true : false)\r
-\r
+                               #if !defined(CONTROL_ONLY_DEVICE)\r
+                                       #define Endpoint_IsReadWriteAllowed()     ((UEINTX & (1 << RWAL)) ? true : false)\r
+                               #endif\r
+                               \r
                                #define Endpoint_IsConfigured()               ((UESTA0X & (1 << CFGOK)) ? true : false)\r
 \r
                                #define Endpoint_GetEndpointInterrupts()      UEINT\r
 \r
                                #define Endpoint_ClearSETUP()                 MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE\r
 \r
-                               #define Endpoint_ClearIN()                    MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << TXINI)); \\r
-                                                                                     UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE\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
+                               #else\r
+                                       #define Endpoint_ClearIN()                MACROS{ UEINTX &= ~(1 << TXINI); }MACROE\r
+                               #endif\r
 \r
-                               #define Endpoint_ClearOUT()                   MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << RXOUTI)); \\r
-                                                                                     UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE\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
+                               #else\r
+                                       #define Endpoint_ClearOUT()               MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE                     \r
+                               #endif\r
 \r
                                #define Endpoint_StallTransaction()           MACROS{ UECONX |= (1 << STALLRQ); }MACROE\r
 \r
                        bool Endpoint_ConfigureEndpoint(const uint8_t  Number, const uint8_t Type, const uint8_t Direction,\r
                                                        const uint16_t Size, const uint8_t Banks);\r
 \r
+                       #if !defined(CONTROL_ONLY_DEVICE)\r
+\r
                        /** Spinloops until the currently selected non-control endpoint is ready for the next packet of data\r
                         *  to be read or written to it.\r
                         *\r
                        #endif\r
                                                        ) ATTR_NON_NULL_PTR_ARG(1);\r
 \r
+                       #endif\r
+\r
                        /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian,\r
                         *  sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared\r
                         *  in both failure and success states; the user is responsible for manually clearing the setup OUT to\r