projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unused makefile macro from the DFU bootloader.
[pub/USBasp.git]
/
LUFA
/
Common
/
Endianness.h
diff --git
a/LUFA/Common/Endianness.h
b/LUFA/Common/Endianness.h
index
123ad42
..
2a618ac
100644
(file)
--- a/
LUFA/Common/Endianness.h
+++ b/
LUFA/Common/Endianness.h
@@
-1,13
+1,13
@@
/*
LUFA Library
/*
LUFA Library
- Copyright (C) Dean Camera, 201
1
.
+ Copyright (C) Dean Camera, 201
2
.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 201
1
Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 201
2
Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
@@
-65,7
+65,7
@@
#if !defined(__INCLUDE_FROM_COMMON_H)
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
#endif
#if !defined(__INCLUDE_FROM_COMMON_H)
#error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality.
#endif
-
+
#if !(defined(ARCH_BIG_ENDIAN) || defined(ARCH_LITTLE_ENDIAN))
#error ARCH_BIG_ENDIAN or ARCH_LITTLE_ENDIAN not set for the specified architecture.
#endif
#if !(defined(ARCH_BIG_ENDIAN) || defined(ARCH_LITTLE_ENDIAN))
#error ARCH_BIG_ENDIAN or ARCH_LITTLE_ENDIAN not set for the specified architecture.
#endif
@@
-102,24
+102,24
@@
#if defined(ARCH_BIG_ENDIAN) && !defined(le16_to_cpu)
#define le16_to_cpu(x) SwapEndian_16(x)
#define le32_to_cpu(x) SwapEndian_32(x)
#if defined(ARCH_BIG_ENDIAN) && !defined(le16_to_cpu)
#define le16_to_cpu(x) SwapEndian_16(x)
#define le32_to_cpu(x) SwapEndian_32(x)
- #define be16_to_cpu(x)
x
- #define be32_to_cpu(x)
x
+ #define be16_to_cpu(x)
(x)
+ #define be32_to_cpu(x)
(x)
#define cpu_to_le16(x) SwapEndian_16(x)
#define cpu_to_le32(x) SwapEndian_32(x)
#define cpu_to_le16(x) SwapEndian_16(x)
#define cpu_to_le32(x) SwapEndian_32(x)
- #define cpu_to_be16(x)
x
- #define cpu_to_be32(x)
x
+ #define cpu_to_be16(x)
(x)
+ #define cpu_to_be32(x)
(x)
#define LE16_TO_CPU(x) SWAPENDIAN_16(x)
#define LE32_TO_CPU(x) SWAPENDIAN_32(x)
#define LE16_TO_CPU(x) SWAPENDIAN_16(x)
#define LE32_TO_CPU(x) SWAPENDIAN_32(x)
- #define BE16_TO_CPU(x)
x
- #define BE32_TO_CPU(x)
x
+ #define BE16_TO_CPU(x)
(x)
+ #define BE32_TO_CPU(x)
(x)
#define CPU_TO_LE16(x) SWAPENDIAN_16(x)
#define CPU_TO_LE32(x) SWAPENDIAN_32(x)
#define CPU_TO_LE16(x) SWAPENDIAN_16(x)
#define CPU_TO_LE32(x) SWAPENDIAN_32(x)
- #define CPU_TO_BE16(x)
x
- #define CPU_TO_BE32(x)
x
+ #define CPU_TO_BE16(x)
(x)
+ #define CPU_TO_BE32(x)
(x)
#elif !defined(le16_to_cpu)
/** \name Run-time endianness conversion */
//@{
#elif !defined(le16_to_cpu)
/** \name Run-time endianness conversion */
//@{
-
+
/** Performs a conversion between a Little Endian encoded 16-bit piece of data and the
* Endianness of the currently selected CPU architecture.
*
/** Performs a conversion between a Little Endian encoded 16-bit piece of data and the
* Endianness of the currently selected CPU architecture.
*
@@
-134,7
+134,7
@@
*
* \return Endian corrected version of the input value.
*/
*
* \return Endian corrected version of the input value.
*/
- #define le16_to_cpu(x)
x
+ #define le16_to_cpu(x)
(x)
/** Performs a conversion between a Little Endian encoded 32-bit piece of data and the
* Endianness of the currently selected CPU architecture.
/** Performs a conversion between a Little Endian encoded 32-bit piece of data and the
* Endianness of the currently selected CPU architecture.
@@
-150,7
+150,7
@@
*
* \return Endian corrected version of the input value.
*/
*
* \return Endian corrected version of the input value.
*/
- #define le32_to_cpu(x)
x
+ #define le32_to_cpu(x)
(x)
/** Performs a conversion between a Big Endian encoded 16-bit piece of data and the
* Endianness of the currently selected CPU architecture.
/** Performs a conversion between a Big Endian encoded 16-bit piece of data and the
* Endianness of the currently selected CPU architecture.
@@
-198,7
+198,7
@@
*
* \return Endian corrected version of the input value.
*/
*
* \return Endian corrected version of the input value.
*/
- #define cpu_to_le16(x)
x
+ #define cpu_to_le16(x)
(x)
/** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it
* is in Little Endian format regardless of the currently selected CPU architecture.
/** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it
* is in Little Endian format regardless of the currently selected CPU architecture.
@@
-214,7
+214,7
@@
*
* \return Endian corrected version of the input value.
*/
*
* \return Endian corrected version of the input value.
*/
- #define cpu_to_le32(x)
x
+ #define cpu_to_le32(x)
(x)
/** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it
* is in Big Endian format regardless of the currently selected CPU architecture.
/** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it
* is in Big Endian format regardless of the currently selected CPU architecture.
@@
-267,7
+267,7
@@
*
* \return Endian corrected version of the input value.
*/
*
* \return Endian corrected version of the input value.
*/
- #define LE16_TO_CPU(x)
x
+ #define LE16_TO_CPU(x)
(x)
/** Performs a conversion between a Little Endian encoded 32-bit piece of data and the
* Endianness of the currently selected CPU architecture.
/** Performs a conversion between a Little Endian encoded 32-bit piece of data and the
* Endianness of the currently selected CPU architecture.
@@
-283,7
+283,7
@@
*
* \return Endian corrected version of the input value.
*/
*
* \return Endian corrected version of the input value.
*/
- #define LE32_TO_CPU(x)
x
+ #define LE32_TO_CPU(x)
(x)
/** Performs a conversion between a Big Endian encoded 16-bit piece of data and the
* Endianness of the currently selected CPU architecture.
/** Performs a conversion between a Big Endian encoded 16-bit piece of data and the
* Endianness of the currently selected CPU architecture.
@@
-331,7
+331,7
@@
*
* \return Endian corrected version of the input value.
*/
*
* \return Endian corrected version of the input value.
*/
- #define CPU_TO_LE16(x)
x
+ #define CPU_TO_LE16(x)
(x)
/** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it
* is in Little Endian format regardless of the currently selected CPU architecture.
/** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it
* is in Little Endian format regardless of the currently selected CPU architecture.
@@
-347,7
+347,7
@@
*
* \return Endian corrected version of the input value.
*/
*
* \return Endian corrected version of the input value.
*/
- #define CPU_TO_LE32(x)
x
+ #define CPU_TO_LE32(x)
(x)
/** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it
* is in Big Endian format regardless of the currently selected CPU architecture.
/** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it
* is in Big Endian format regardless of the currently selected CPU architecture.
@@
-390,10
+390,15
@@
* \ingroup Group_ByteSwapping
*
* \param[in] Word Word of data whose bytes are to be swapped.
* \ingroup Group_ByteSwapping
*
* \param[in] Word Word of data whose bytes are to be swapped.
+ *
+ * \return Input data with the individual bytes reversed.
*/
static inline uint16_t SwapEndian_16(const uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint16_t SwapEndian_16(const uint16_t Word)
{
*/
static inline uint16_t SwapEndian_16(const uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint16_t SwapEndian_16(const uint16_t Word)
{
+ if (GCC_IS_COMPILE_CONST(Word))
+ return SWAPENDIAN_16(Word);
+
uint8_t Temp;
union
uint8_t Temp;
union
@@
-416,10
+421,15
@@
* \ingroup Group_ByteSwapping
*
* \param[in] DWord Double word of data whose bytes are to be swapped.
* \ingroup Group_ByteSwapping
*
* \param[in] DWord Double word of data whose bytes are to be swapped.
+ *
+ * \return Input data with the individual bytes reversed.
*/
static inline uint32_t SwapEndian_32(const uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint32_t SwapEndian_32(const uint32_t DWord)
{
*/
static inline uint32_t SwapEndian_32(const uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
static inline uint32_t SwapEndian_32(const uint32_t DWord)
{
+ if (GCC_IS_COMPILE_CONST(DWord))
+ return SWAPENDIAN_32(DWord);
+
uint8_t Temp;
union
uint8_t Temp;
union
@@
-447,6
+457,8
@@
*
* \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed.
* \param[in] Length Length of the data in bytes.
*
* \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed.
* \param[in] Length Length of the data in bytes.
+ *
+ * \return Input data with the individual bytes reversed.
*/
static inline void SwapEndian_n(void* const Data,
uint8_t Length) ATTR_NON_NULL_PTR_ARG(1);
*/
static inline void SwapEndian_n(void* const Data,
uint8_t Length) ATTR_NON_NULL_PTR_ARG(1);
@@
-474,3
+486,4
@@
#endif
/** @} */
#endif
/** @} */
+