X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/0e6d5cf5b4fea133cbd3c16b958617deb42332cf..3d28d53c3e2ae529933283e63a8b05f2ab1ce2be:/LUFA/Drivers/USB/LowLevel/Pipe.h?ds=inline diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index 08935e1f1..c16822b0d 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.h +++ b/LUFA/Drivers/USB/LowLevel/Pipe.h @@ -28,6 +28,16 @@ this software. */ +/** \file + * \brief USB host pipe management definitions. + * + * This file contains structures, function prototypes and macros related to the management of the device's + * data pipes when the library is initialized in USB host 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_PipeManagement Pipe Management * @@ -74,16 +84,10 @@ #define __PIPE_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" @@ -99,7 +103,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: */ @@ -489,14 +493,11 @@ #define Pipe_IsSETUPSent() ((UPINTX & (1 << TXSTPI)) ? true : false) - #define Pipe_ClearIN() MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << RXINI)); \ - UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE + #define Pipe_ClearIN() MACROS{ UPINTX &= ~((1 << RXINI) | (1 << FIFOCON)); }MACROE - #define Pipe_ClearOUT() MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXOUTI)); \ - UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE + #define Pipe_ClearOUT() MACROS{ UPINTX &= ~((1 << TXOUTI) | (1 << FIFOCON)); }MACROE - #define Pipe_ClearSETUP() MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXSTPI)); \ - UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE + #define Pipe_ClearSETUP() MACROS{ UPINTX &= ~((1 << TXSTPI) | (1 << FIFOCON)); }MACROE #define Pipe_IsNAKReceived() ((UPINTX & (1 << NAKEDI)) ? true : false) @@ -553,11 +554,7 @@ static inline uint8_t Pipe_Read_Byte(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; static inline uint8_t Pipe_Read_Byte(void) { - #if defined(__AVR32__) - return 0; // TODO - #elif defined(__AVR__) return UPDATX; - #endif } /** Writes one byte from the currently selected pipe's bank, for IN direction pipes. @@ -569,11 +566,7 @@ static inline void Pipe_Write_Byte(const uint8_t Byte) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_Byte(const uint8_t Byte) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UPDATX = Byte; - #endif } /** Discards one byte from the currently selected pipe's bank, for OUT direction pipes. @@ -585,11 +578,7 @@ { uint8_t Dummy; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Dummy = UPDATX; - #endif } /** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT @@ -608,12 +597,8 @@ uint8_t Bytes[2]; } Data; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Data.Bytes[0] = UPDATX; Data.Bytes[1] = UPDATX; - #endif return Data.Word; } @@ -634,12 +619,8 @@ uint8_t Bytes[2]; } Data; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Data.Bytes[1] = UPDATX; Data.Bytes[0] = UPDATX; - #endif return Data.Word; } @@ -654,12 +635,8 @@ static inline void Pipe_Write_Word_LE(const uint16_t Word) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_Word_LE(const uint16_t Word) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UPDATX = (Word & 0xFF); UPDATX = (Word >> 8); - #endif } /** Writes two bytes to the currently selected pipe's bank in big endian format, for IN @@ -672,12 +649,8 @@ static inline void Pipe_Write_Word_BE(const uint16_t Word) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_Word_BE(const uint16_t Word) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UPDATX = (Word >> 8); UPDATX = (Word & 0xFF); - #endif } /** Discards two bytes from the currently selected pipe's bank, for OUT direction pipes. @@ -689,12 +662,8 @@ { uint8_t Dummy; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Dummy = UPDATX; Dummy = UPDATX; - #endif } /** Reads four bytes from the currently selected pipe's bank in little endian format, for OUT @@ -713,14 +682,10 @@ uint8_t Bytes[4]; } Data; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Data.Bytes[0] = UPDATX; Data.Bytes[1] = UPDATX; Data.Bytes[2] = UPDATX; Data.Bytes[3] = UPDATX; - #endif return Data.DWord; } @@ -741,9 +706,6 @@ uint8_t Bytes[4]; } Data; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Data.Bytes[3] = UPDATX; Data.Bytes[2] = UPDATX; Data.Bytes[1] = UPDATX; @@ -762,14 +724,10 @@ static inline void Pipe_Write_DWord_LE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_DWord_LE(const uint32_t DWord) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UPDATX = (DWord & 0xFF); UPDATX = (DWord >> 8); UPDATX = (DWord >> 16); UPDATX = (DWord >> 24); - #endif } /** Writes four bytes to the currently selected pipe's bank in big endian format, for IN @@ -782,14 +740,10 @@ static inline void Pipe_Write_DWord_BE(const uint32_t DWord) ATTR_ALWAYS_INLINE; static inline void Pipe_Write_DWord_BE(const uint32_t DWord) { - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) UPDATX = (DWord >> 24); UPDATX = (DWord >> 16); UPDATX = (DWord >> 8); UPDATX = (DWord & 0xFF); - #endif } /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes. @@ -801,14 +755,10 @@ { uint8_t Dummy; - #if defined(__AVR32__) - // TODO - #elif defined(__AVR__) Dummy = UPDATX; Dummy = UPDATX; Dummy = UPDATX; Dummy = UPDATX; - #endif } /* External Variables: */ @@ -850,7 +800,8 @@ * \ref Pipe_SetFiniteINRequests(). * * \note The default control pipe 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 pipe, and the pipe will remain selected once the * routine completes regardless of if the pipe configuration succeeds.