X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/0e6d5cf5b4fea133cbd3c16b958617deb42332cf..57fe6b4fb97668eb15c4fa56095c0abd746d6c99:/LUFA/Drivers/USB/LowLevel/Endpoint.h diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h index cf6fbc632..93412f500 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.h +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h @@ -28,6 +28,16 @@ this software. */ +/** \file + * \brief USB device endpoint management definitions. + * + * This file contains structures, function prototypes and macros related to the management of the device's + * data endpoints when the library is initialized in USB device mode. + * + * \note This file should not be included directly. It is automatically included as needed by the USB driver + * dispatch header located in LUFA/Drivers/USB/USB.h. + */ + /** \ingroup Group_USB * @defgroup Group_EndpointManagement Endpoint Management * @@ -66,17 +76,11 @@ #define __ENDPOINT_H__ /* Includes: */ - #if defined(__AVR32__) - #include - #include - #include - #elif defined(__AVR__) - #include - #include - #include - #include - #endif - + #include + #include + #include + #include + #include "../../../Common/Common.h" #include "../HighLevel/USBTask.h" @@ -91,7 +95,7 @@ /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_USB_DRIVER) - #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. #endif /* Public Interface - May be used in end-application: */ @@ -401,15 +405,13 @@ #define Endpoint_ClearSETUP() MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE #if !defined(CONTROL_ONLY_DEVICE) - #define Endpoint_ClearIN() MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << TXINI)); \ - UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE + #define Endpoint_ClearIN() MACROS{ UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); }MACROE #else #define Endpoint_ClearIN() MACROS{ UEINTX &= ~(1 << TXINI); }MACROE #endif #if !defined(CONTROL_ONLY_DEVICE) - #define Endpoint_ClearOUT() MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << RXOUTI)); \ - UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE + #define Endpoint_ClearOUT() MACROS{ UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); }MACROE #else #define Endpoint_ClearOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE #endif @@ -440,8 +442,12 @@ */ ENDPOINT_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while * waiting for the endpoint to become ready. - */ - ENDPOINT_READYWAIT_Timeout = 3, /**< The host failed to accept or send the next packet + */ + ENDPOINT_READYWAIT_BusSuspended = 3, /**< The USB bus has been suspended by the host and + * no USB endpoint traffic can occur until the bus + * has resumed. + */ + ENDPOINT_READYWAIT_Timeout = 4, /**< The host failed to accept or send the next packet * within the software timeout period set by the * \ref USB_STREAM_TIMEOUT_MS macro. */ @@ -460,11 +466,15 @@ ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during * the transfer. */ - ENDPOINT_RWSTREAM_Timeout = 3, /**< The host failed to accept or send the next packet + ENDPOINT_RWSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and + * no USB endpoint traffic can occur until the bus + * has resumed. + */ + ENDPOINT_RWSTREAM_Timeout = 4, /**< 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 = 4, /**< Indicates that the stream's callback function + ENDPOINT_RWSTREAM_CallbackAborted = 5, /**< Indicates that the stream's callback function * aborted the transfer early. */ }; @@ -480,6 +490,10 @@ ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during * the transfer. */ + ENDPOINT_RWCSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and + * no USB endpoint traffic can occur until the bus + * has resumed. + */ }; /* Inline Functions: */ @@ -492,11 +506,7 @@ static inline uint8_t Endpoint_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint8_t Endpoint_Read_Byte(void) { - #if defined(__AVR32__) - return 0; // TODO - #elif defined(__AVR__) return UEDATX; - #endif } /** Writes one byte from the currently selected endpoint's bank, for IN direction endpoints. @@ -508,11 +518,7 @@ static inline void Endpoint_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_Byte(const uint8_t Byte) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UEDATX = Byte; - #endif } /** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints. @@ -524,11 +530,7 @@ { uint8_t Dummy; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Dummy = UEDATX; - #endif } /** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT @@ -547,12 +549,8 @@ uint8_t Bytes[2]; } Data; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Data.Bytes[0] = UEDATX; Data.Bytes[1] = UEDATX; - #endif return Data.Word; } @@ -573,12 +571,8 @@ uint8_t Bytes[2]; } Data; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Data.Bytes[1] = UEDATX; Data.Bytes[0] = UEDATX; - #endif return Data.Word; } @@ -593,12 +587,8 @@ static inline void Endpoint_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_Word_LE(const uint16_t Word) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UEDATX = (Word & 0xFF); UEDATX = (Word >> 8); - #endif } /** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN @@ -611,12 +601,8 @@ static inline void Endpoint_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_Word_BE(const uint16_t Word) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UEDATX = (Word >> 8); UEDATX = (Word & 0xFF); - #endif } /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints. @@ -628,12 +614,8 @@ { uint8_t Dummy; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Dummy = UEDATX; Dummy = UEDATX; - #endif } /** Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT @@ -652,14 +634,10 @@ uint8_t Bytes[4]; } Data; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Data.Bytes[0] = UEDATX; Data.Bytes[1] = UEDATX; Data.Bytes[2] = UEDATX; Data.Bytes[3] = UEDATX; - #endif return Data.DWord; } @@ -680,14 +658,10 @@ uint8_t Bytes[4]; } Data; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Data.Bytes[3] = UEDATX; Data.Bytes[2] = UEDATX; Data.Bytes[1] = UEDATX; Data.Bytes[0] = UEDATX; - #endif return Data.DWord; } @@ -702,14 +676,10 @@ static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_DWord_LE(const uint32_t DWord) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UEDATX = (DWord & 0xFF); UEDATX = (DWord >> 8); UEDATX = (DWord >> 16); UEDATX = (DWord >> 24); - #endif } /** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN @@ -722,14 +692,10 @@ static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Endpoint_Write_DWord_BE(const uint32_t DWord) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UEDATX = (DWord >> 24); UEDATX = (DWord >> 16); UEDATX = (DWord >> 8); UEDATX = (DWord & 0xFF); - #endif } /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints. @@ -741,14 +707,10 @@ { uint8_t Dummy; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Dummy = UEDATX; Dummy = UEDATX; Dummy = UEDATX; Dummy = UEDATX; - #endif } /* External Variables: */ @@ -795,7 +757,8 @@ * The banking mode may be either \ref ENDPOINT_BANK_SINGLE or \ref ENDPOINT_BANK_DOUBLE. * * \note The default control endpoint does not have to be manually configured, as it is automatically - * configured by the library internally. + * configured by the library internally. + * \n\n * * \note This routine will select the specified endpoint, and the endpoint will remain selected * once the routine completes regardless of if the endpoint configuration succeeds. @@ -1019,6 +982,7 @@ * * \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. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. * @@ -1038,6 +1002,7 @@ * * \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. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. * @@ -1057,8 +1022,10 @@ * * \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. + * \n\n * * \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. * @@ -1081,6 +1048,7 @@ * * \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. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. * @@ -1100,6 +1068,7 @@ * * \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. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. * @@ -1119,8 +1088,10 @@ * * \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. + * \n\n * * \note The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. * @@ -1143,6 +1114,7 @@ * * \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. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. * @@ -1162,6 +1134,7 @@ * * \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. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. * @@ -1184,6 +1157,7 @@ * * \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. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. * @@ -1203,6 +1177,7 @@ * * \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. + * \n\n * * \note This routine should only be used on CONTROL type endpoints. *