X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/c24027f3b5f1ca7bceababc82ea5b897b18dbac1..3d28d53c3e2ae529933283e63a8b05f2ab1ce2be:/LUFA/Common/Common.h diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index 67bbb9295..a59a213a8 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -29,9 +29,10 @@ */ /** \file + * \brief Common library convenience macros and functions. * * This file contains macros which are common to all library elements, and which may be useful in user code. It - * also includes other common headers, such as Atomic.h, FunctionAttributes.h and BoardTypes.h. + * also includes other common headers, such as Atomic.h, Attributes.h and BoardTypes.h. */ /** @defgroup Group_Common Common Utility Headers - LUFA/Drivers/Common/Common.h @@ -56,18 +57,9 @@ #define __COMMON_H__ /* Includes: */ - #if defined(__AVR32__) - #include - #include - - #include "Atomic.h" - - #define PROGMEM const - #else - #include - #endif - - #include "FunctionAttributes.h" + #include + + #include "Attributes.h" #include "BoardTypes.h" /* Public Interface - May be used in end-application: */ @@ -172,36 +164,22 @@ * \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed * \param[in] Bytes Length of the data in bytes */ - static inline void SwapEndian_n(uint8_t* Data, uint8_t Bytes); - static inline void SwapEndian_n(uint8_t* Data, uint8_t Bytes) + static inline void SwapEndian_n(void* Data, uint8_t Bytes); + static inline void SwapEndian_n(void* Data, uint8_t Bytes) { - uint8_t Temp; - + uint8_t* CurrDataPos = Data; + while (Bytes) { - Temp = *Data; - *Data = *(Data + Bytes - 1); - *(Data + Bytes - 1) = Temp; + uint8_t Temp = *CurrDataPos; + *CurrDataPos = *(CurrDataPos + Bytes - 1); + *(CurrDataPos + Bytes - 1) = Temp; - Data++; + CurrDataPos++; Bytes -= 2; } } - /* Type Defines: */ - #if defined(__AVR32__) - /** Type define for an unsigned native word-sized chunk of data. */ - typedef uint32_t uintN_t; - - /** Type define for a signed native word-sized chunk of data. */ - typedef int32_t intN_t; - #else - /** Type define for an unsigned native word-sized chunk of data. */ - typedef uint8_t uintN_t; - - /** Type define for a signed native word-sized chunk of data. */ - typedef int8_t intN_t; - #endif #endif /** @} */