aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-04-12 03:03:56 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-04-12 03:03:56 +0000
commit995195a2b06142fb0882cf116a12bdab8e19603f (patch)
treeb560fb306c067c44266a494f2d40f16132e0a9f4 /LUFA/Drivers/USB
parent852b5e612d549d1f086ceca4df0b589ac24cb37f (diff)
downloadlufa-995195a2b06142fb0882cf116a12bdab8e19603f.tar.gz
lufa-995195a2b06142fb0882cf116a12bdab8e19603f.tar.bz2
lufa-995195a2b06142fb0882cf116a12bdab8e19603f.zip
Add missing function attributes to the pipe/endpoint functions for all architectures.
Perform endianness correction in the HID report parser for big-endian platforms.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r--LUFA/Drivers/USB/Class/Common/HIDParser.c4
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.c4
-rw-r--r--LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h3
-rw-r--r--LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h1
-rw-r--r--LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h1
-rw-r--r--LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h2
-rw-r--r--LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h3
-rw-r--r--LUFA/Drivers/USB/Core/UC3/Device_UC3.h3
-rw-r--r--LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h1
-rw-r--r--LUFA/Drivers/USB/Core/UC3/Host_UC3.h1
-rw-r--r--LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h3
-rw-r--r--LUFA/Drivers/USB/Core/USBTask.h2
12 files changed, 17 insertions, 11 deletions
diff --git a/LUFA/Drivers/USB/Class/Common/HIDParser.c b/LUFA/Drivers/USB/Class/Common/HIDParser.c
index f6c48fdad..20fceab64 100644
--- a/LUFA/Drivers/USB/Class/Common/HIDParser.c
+++ b/LUFA/Drivers/USB/Class/Common/HIDParser.c
@@ -61,12 +61,12 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
switch (HIDReportItem & HID_RI_DATA_SIZE_MASK)
{
case HID_RI_DATA_BITS_32:
- ReportItemData = *((uint32_t*)ReportData);
+ ReportItemData = le32_to_cpu(*((uint32_t*)ReportData));
ReportSize -= 4;
ReportData += 4;
break;
case HID_RI_DATA_BITS_16:
- ReportItemData = *((uint16_t*)ReportData);
+ ReportItemData = le16_to_cpu(*((uint16_t*)ReportData));
ReportSize -= 2;
ReportData += 2;
break;
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.c b/LUFA/Drivers/USB/Class/Device/Audio.c
index 986e73f9c..f18db7456 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.c
+++ b/LUFA/Drivers/USB/Class/Device/Audio.c
@@ -88,9 +88,7 @@ bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioIn
}
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size, ENDPOINT_BANK_DOUBLE)))
- {
- return false;
- }
+ return false;
}
return true;
diff --git a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
index 47f58b27d..f88c2f1b2 100644
--- a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
+++ b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
@@ -137,6 +137,7 @@
/** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host)
* the frame number is incremented by one.
*/
+ static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint16_t USB_Device_GetFrameNumber(void)
{
return UDFNUM;
@@ -191,7 +192,7 @@
UDADDR |= (1 << ADDEN);
}
- static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE;
+ static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline bool USB_Device_IsAddressSet(void)
{
return (UDADDR & (1 << ADDEN));
diff --git a/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
index 166a49c7d..1727da0d8 100644
--- a/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
+++ b/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
@@ -394,6 +394,7 @@
*
* \return Total number of busy banks in the selected endpoint.
*/
+ static inline uint8_t Endpoint_GetBusyBanks(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Endpoint_GetBusyBanks(void)
{
return (UESTA0X & (0x03 << NBUSYBK0));
diff --git a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h
index 2bf13cd26..836c83b67 100644
--- a/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h
+++ b/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h
@@ -140,6 +140,7 @@
/** Returns the current USB frame number, when in host mode. Every millisecond the USB bus is active (i.e. not suspended)
* the frame number is incremented by one.
*/
+ static inline uint16_t USB_Host_GetFrameNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t USB_Host_GetFrameNumber(void)
{
return UHFNUM;
diff --git a/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h
index a79033753..fda145c1e 100644
--- a/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h
+++ b/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h
@@ -93,7 +93,7 @@
*
* \return Boolean \c true if currently sending a HNP to the other connected device, \c false otherwise
*/
- static inline bool USB_OTG_Device_IsSendingHNP(void) ATTR_ALWAYS_INLINE;
+ static inline bool USB_OTG_Device_IsSendingHNP(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool USB_OTG_Device_IsSendingHNP(void)
{
return ((OTGCON & (1 << HNPREQ)) ? true : false);
diff --git a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
index 2e89f6de4..8022a812a 100644
--- a/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
+++ b/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
@@ -273,7 +273,7 @@
*
* \return The current pipe token, as a \c PIPE_TOKEN_* mask.
*/
- static inline uint8_t Pipe_GetPipeToken(void) ATTR_ALWAYS_INLINE;
+ static inline uint8_t Pipe_GetPipeToken(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetPipeToken(void)
{
return (UPCFG0X & (0x03 << PTOKEN0));
@@ -433,6 +433,7 @@
*
* \return Total number of busy banks in the selected pipe.
*/
+ static inline uint8_t Pipe_GetBusyBanks(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetBusyBanks(void)
{
return (UPSTAX & (0x03 << NBUSYBK0));
diff --git a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h
index 2a029bf08..ed7409856 100644
--- a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h
+++ b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h
@@ -127,6 +127,7 @@
/** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host)
* the frame number is incremented by one.
*/
+ static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint16_t USB_Device_GetFrameNumber(void)
{
return AVR32_USBB.UDFNUM.fnum;
@@ -179,7 +180,7 @@
AVR32_USBB.UDCON.adden = true;
}
- static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE;
+ static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline bool USB_Device_IsAddressSet(void)
{
return AVR32_USBB.UDCON.adden;
diff --git a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
index 43e432b04..4f31a0d86 100644
--- a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
+++ b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
@@ -402,6 +402,7 @@
*
* \return Total number of busy banks in the selected endpoint.
*/
+ static inline uint8_t Endpoint_GetBusyBanks(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Endpoint_GetBusyBanks(void)
{
return (&AVR32_USBB.UESTA0)[USB_SelectedEndpoint].nbusybk;
diff --git a/LUFA/Drivers/USB/Core/UC3/Host_UC3.h b/LUFA/Drivers/USB/Core/UC3/Host_UC3.h
index 4d08a4c98..6040eb32b 100644
--- a/LUFA/Drivers/USB/Core/UC3/Host_UC3.h
+++ b/LUFA/Drivers/USB/Core/UC3/Host_UC3.h
@@ -141,6 +141,7 @@
/** Returns the current USB frame number, when in host mode. Every millisecond the USB bus is active (i.e. not suspended)
* the frame number is incremented by one.
*/
+ static inline uint16_t USB_Host_GetFrameNumber(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint16_t USB_Host_GetFrameNumber(void)
{
return AVR32_USBB_UHFNUM;
diff --git a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
index 7edfb3e1b..bda3e8e2c 100644
--- a/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
+++ b/LUFA/Drivers/USB/Core/UC3/Pipe_UC3.h
@@ -284,7 +284,7 @@
*
* \return The current pipe token, as a \c PIPE_TOKEN_* mask.
*/
- static inline uint8_t Pipe_GetPipeToken(void) ATTR_ALWAYS_INLINE;
+ static inline uint8_t Pipe_GetPipeToken(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetPipeToken(void)
{
return (&AVR32_USBB.UPCFG0)[USB_SelectedPipe].ptoken;
@@ -451,6 +451,7 @@
*
* \return Total number of busy banks in the selected pipe.
*/
+ static inline uint8_t Pipe_GetBusyBanks(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_GetBusyBanks(void)
{
return (&AVR32_USBB.UPSTA0)[USB_SelectedPipe].nbusybk;
diff --git a/LUFA/Drivers/USB/Core/USBTask.h b/LUFA/Drivers/USB/Core/USBTask.h
index 267c7e08e..30231bf16 100644
--- a/LUFA/Drivers/USB/Core/USBTask.h
+++ b/LUFA/Drivers/USB/Core/USBTask.h
@@ -191,7 +191,7 @@
/* Macros: */
#define HOST_TASK_NONBLOCK_WAIT(Duration, NextState) MACROS{ USB_HostState = HOST_STATE_WaitForDevice; \
WaitMSRemaining = (Duration); \
- PostWaitState = (NextState); }MACROE
+ PostWaitState = (NextState); }MACROE
#endif
/* Disable C linkage for C++ Compilers: */