aboutsummaryrefslogtreecommitdiff
path: root/LUFA
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-08-25 14:30:42 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2009-08-25 14:30:42 +0000
commitece225e3e3002dcfa563cf452a2d6179bf3218b5 (patch)
tree492d6749327209f720a40115528a7c38c745b1dd /LUFA
parent35af666d335e065d5355c4ff07b24d7e67256782 (diff)
Optimized Endpoint_Read_Word_* and Pipe_Read_Word_* macros to reduce compiled size.
Fixed Programmer's Notepad project file to reflect new location of AVRISP project. git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@773 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'LUFA')
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.h24
-rw-r--r--LUFA/Drivers/USB/LowLevel/Pipe.h24
-rw-r--r--LUFA/ManPages/ChangeLog.txt1
3 files changed, 33 insertions, 16 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h
index 977c63cf..652ee804 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.h
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h
@@ -511,12 +511,16 @@
static inline uint16_t Endpoint_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Endpoint_Read_Word_LE(void)
{
- uint16_t Data;
+ union
+ {
+ uint16_t Word;
+ uint8_t Bytes[2];
+ } Data;
- Data = UEDATX;
- Data |= (((uint16_t)UEDATX) << 8);
+ Data.Bytes[0] = UEDATX;
+ Data.Bytes[1] = UEDATX;
- return Data;
+ return Data.Word;
}
/** Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT
@@ -529,12 +533,16 @@
static inline uint16_t Endpoint_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Endpoint_Read_Word_BE(void)
{
- uint16_t Data;
+ union
+ {
+ uint16_t Word;
+ uint8_t Bytes[2];
+ } Data;
- Data = (((uint16_t)UEDATX) << 8);
- Data |= UEDATX;
+ Data.Bytes[1] = UEDATX;
+ Data.Bytes[0] = UEDATX;
- return Data;
+ return Data.Word;
}
/** Writes two bytes to the currently selected endpoint's bank in little endian format, for IN
diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h
index 3931f853..beee2eb8 100644
--- a/LUFA/Drivers/USB/LowLevel/Pipe.h
+++ b/LUFA/Drivers/USB/LowLevel/Pipe.h
@@ -566,12 +566,16 @@
static inline uint16_t Pipe_Read_Word_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Pipe_Read_Word_LE(void)
{
- uint16_t Data;
+ union
+ {
+ uint16_t Word;
+ uint8_t Bytes[2];
+ } Data;
- Data = UPDATX;
- Data |= (((uint16_t)UPDATX) << 8);
+ Data.Bytes[0] = UPDATX;
+ Data.Bytes[1] = UPDATX;
- return Data;
+ return Data.Word;
}
/** Reads two bytes from the currently selected pipe's bank in big endian format, for OUT
@@ -584,12 +588,16 @@
static inline uint16_t Pipe_Read_Word_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t Pipe_Read_Word_BE(void)
{
- uint16_t Data;
+ union
+ {
+ uint16_t Word;
+ uint8_t Bytes[2];
+ } Data;
- Data = (((uint16_t)UPDATX) << 8);
- Data |= UPDATX;
+ Data.Bytes[1] = UPDATX;
+ Data.Bytes[0] = UPDATX;
- return Data;
+ return Data.Word;
}
/** Writes two bytes to the currently selected pipe's bank in little endian format, for IN
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index 6c4fea56..981ff1de 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -24,6 +24,7 @@
* - Added explicit attribute masks to the device mode demos' descriptors
* - Added return values to the CDC and MIDI class driver transmit functions
* - Added extra masks to the SPI driver, changed SPI_Init() so that the clock polarity and sample modes can be set
+ * - Optimized Endpoint_Read_Word_* and Pipe_Read_Word_* macros to reduce compiled size
*
* <b>Fixed:</b>
* - Fixed possible lockup in the CDC device class driver, when the host sends data that is a multiple of the