diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-06-20 04:32:34 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-06-20 04:32:34 +0000 |
commit | d784baaa3a97929fc9a7fed7fff84ff7b0f5bc17 (patch) | |
tree | 47153f33a68172f62b6daec089e64fc717863d2f /LUFA/Drivers/USB | |
parent | dab7e06a4a914ebc67dd6a9a28c0987b49703c88 (diff) | |
download | lufa-d784baaa3a97929fc9a7fed7fff84ff7b0f5bc17.tar.gz lufa-d784baaa3a97929fc9a7fed7fff84ff7b0f5bc17.tar.bz2 lufa-d784baaa3a97929fc9a7fed7fff84ff7b0f5bc17.zip |
Fixed compile error when FIXED_CONTROL_ENDPOINT_SIZE compile time option was disabled, and a USE_*_DESCRIPTORS compile time option was not enabled on the AVR8s.
Add C++ compatibility to some header files currently missing extern "C" linkage.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r-- | LUFA/Drivers/USB/Class/Common/HID.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c | 17 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/ConfigDescriptor.c | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/ConfigDescriptor.h | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/Device.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/Endpoint.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/EndpointStream.h | 12 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/Host.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/OTG.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/Pipe.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/PipeStream.h | 5 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/StdRequestType.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/Device_UC3.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/USBController.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/USBInterrupt.h | 12 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Core/USBMode.h | 10 |
18 files changed, 165 insertions, 5 deletions
diff --git a/LUFA/Drivers/USB/Class/Common/HID.h b/LUFA/Drivers/USB/Class/Common/HID.h index a860b6569..ce28d34e3 100644 --- a/LUFA/Drivers/USB/Class/Common/HID.h +++ b/LUFA/Drivers/USB/Class/Common/HID.h @@ -54,6 +54,11 @@ #include "../../Core/StdDescriptors.h" #include "HIDParser.h" + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_HID_DRIVER) #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. @@ -634,6 +639,11 @@ /** Type define for the data type used to store HID report descriptor elements. */ typedef uint8_t USB_Descriptor_HIDReport_Datatype_t; + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + #endif /** @} */ diff --git a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h index c98e17cd5..e9696089f 100644 --- a/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h @@ -54,6 +54,11 @@ #include "../USBInterrupt.h" #include "../Endpoint.h" + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_USB_DRIVER) #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. @@ -234,6 +239,11 @@ #endif + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + #endif /** @} */ diff --git a/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h index e9b92c047..03b816e70 100644 --- a/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h +++ b/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h @@ -51,6 +51,11 @@ /* Includes: */ #include "../../../../Common/Common.h" + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_USB_DRIVER) #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. @@ -143,6 +148,11 @@ return ((OTGCON & (1 << HNPREQ)) ? true : false); } + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + #endif /** @} */ diff --git a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c index 27eabc3d4..4802463f0 100644 --- a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c @@ -191,7 +191,21 @@ static void USB_Init_Device(void) #if !defined(FIXED_CONTROL_ENDPOINT_SIZE) USB_Descriptor_Device_t* DeviceDescriptorPtr; + + #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ + !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) + uint8_t DescriptorAddressSpace; + if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr, &DescriptorAddressSpace) != NO_DESCRIPTOR) + { + if (DescriptorAddressSpace == MEMSPACE_FLASH) + USB_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + else if (DescriptorAddressSpace == MEMSPACE_EEPROM) + USB_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + else + USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; + } + #else if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR) { #if defined(USE_RAM_DESCRIPTORS) @@ -201,7 +215,8 @@ static void USB_Init_Device(void) #else USB_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size); #endif - } + } + #endif #endif #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)) diff --git a/LUFA/Drivers/USB/Core/ConfigDescriptor.c b/LUFA/Drivers/USB/Core/ConfigDescriptor.c index a7f4d3ba0..35a01995d 100644 --- a/LUFA/Drivers/USB/Core/ConfigDescriptor.c +++ b/LUFA/Drivers/USB/Core/ConfigDescriptor.c @@ -118,7 +118,7 @@ void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem, uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, void** const CurrConfigLoc, - const ConfigComparatorPtr_t const ComparatorRoutine) + ConfigComparatorPtr_t const ComparatorRoutine) { uint8_t ErrorCode; diff --git a/LUFA/Drivers/USB/Core/ConfigDescriptor.h b/LUFA/Drivers/USB/Core/ConfigDescriptor.h index 634dc8ff9..85cee466e 100644 --- a/LUFA/Drivers/USB/Core/ConfigDescriptor.h +++ b/LUFA/Drivers/USB/Core/ConfigDescriptor.h @@ -256,7 +256,7 @@ */ uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, void** const CurrConfigLoc, - const ConfigComparatorPtr_t const ComparatorRoutine); + ConfigComparatorPtr_t const ComparatorRoutine); /* Inline Functions: */ /** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then diff --git a/LUFA/Drivers/USB/Core/Device.h b/LUFA/Drivers/USB/Core/Device.h index 0e8662417..85fdfacf1 100644 --- a/LUFA/Drivers/USB/Core/Device.h +++ b/LUFA/Drivers/USB/Core/Device.h @@ -56,6 +56,11 @@ #include "USBInterrupt.h"
#include "Endpoint.h"
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
@@ -141,6 +146,11 @@ #include "UC3/Device_UC3.h"
#endif
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
/** @} */
diff --git a/LUFA/Drivers/USB/Core/Endpoint.h b/LUFA/Drivers/USB/Core/Endpoint.h index bbd75467f..d61c5b13f 100644 --- a/LUFA/Drivers/USB/Core/Endpoint.h +++ b/LUFA/Drivers/USB/Core/Endpoint.h @@ -76,6 +76,11 @@ #include "../../../Common/Common.h"
#include "USBMode.h"
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
@@ -105,6 +110,11 @@ #include "UC3/Endpoint_UC3.h"
#endif
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
/** @} */
diff --git a/LUFA/Drivers/USB/Core/EndpointStream.h b/LUFA/Drivers/USB/Core/EndpointStream.h index 54f2d8395..296dfe51f 100644 --- a/LUFA/Drivers/USB/Core/EndpointStream.h +++ b/LUFA/Drivers/USB/Core/EndpointStream.h @@ -53,6 +53,11 @@ #include "../../../Common/Common.h"
#include "USBMode.h"
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
@@ -105,7 +110,12 @@ #elif (ARCH == ARCH_UC3)
#include "UC3/EndpointStream_UC3.h"
#endif
-
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
/** @} */
diff --git a/LUFA/Drivers/USB/Core/Host.h b/LUFA/Drivers/USB/Core/Host.h index da8194fe8..53a6b9a6c 100644 --- a/LUFA/Drivers/USB/Core/Host.h +++ b/LUFA/Drivers/USB/Core/Host.h @@ -53,6 +53,11 @@ #include "../../../Common/Common.h"
#include "USBMode.h"
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
@@ -169,6 +174,11 @@ #include "UC3/Host_UC3.h"
#endif
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
/** @} */
diff --git a/LUFA/Drivers/USB/Core/OTG.h b/LUFA/Drivers/USB/Core/OTG.h index 918b2ca8b..69caa7c59 100644 --- a/LUFA/Drivers/USB/Core/OTG.h +++ b/LUFA/Drivers/USB/Core/OTG.h @@ -54,6 +54,11 @@ #include "../../../Common/Common.h"
#include "USBMode.h"
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
@@ -64,6 +69,11 @@ #include "AVR8/OTG_AVR8.h"
#endif
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
/** @} */
diff --git a/LUFA/Drivers/USB/Core/Pipe.h b/LUFA/Drivers/USB/Core/Pipe.h index cf9971940..5f82937f4 100644 --- a/LUFA/Drivers/USB/Core/Pipe.h +++ b/LUFA/Drivers/USB/Core/Pipe.h @@ -86,6 +86,11 @@ #include "../../../Common/Common.h"
#include "USBMode.h"
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
@@ -120,6 +125,11 @@ #include "UC3/Pipe_UC3.h"
#endif
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
/** @} */
diff --git a/LUFA/Drivers/USB/Core/PipeStream.h b/LUFA/Drivers/USB/Core/PipeStream.h index 91f465257..ffb2cd46b 100644 --- a/LUFA/Drivers/USB/Core/PipeStream.h +++ b/LUFA/Drivers/USB/Core/PipeStream.h @@ -88,6 +88,11 @@ #elif (ARCH == ARCH_UC3)
#include "UC3/PipeStream_UC3.h"
#endif
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
#endif
diff --git a/LUFA/Drivers/USB/Core/StdRequestType.h b/LUFA/Drivers/USB/Core/StdRequestType.h index 9a9e6f214..4b3bf33fb 100644 --- a/LUFA/Drivers/USB/Core/StdRequestType.h +++ b/LUFA/Drivers/USB/Core/StdRequestType.h @@ -53,6 +53,11 @@ #include "../../../Common/Common.h" #include "USBMode.h" + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_USB_DRIVER) #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. @@ -242,6 +247,11 @@ #define FEATURE_REMOTE_WAKEUP_ENABLED (1 << 1) #endif + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + #endif /** @} */ diff --git a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h index 8bc8188d2..22e17464d 100644 --- a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h @@ -54,6 +54,11 @@ #include "../USBInterrupt.h"
#include "../Endpoint.h"
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
@@ -222,6 +227,11 @@ #endif
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
/** @} */
diff --git a/LUFA/Drivers/USB/Core/USBController.h b/LUFA/Drivers/USB/Core/USBController.h index 0568deef6..ac3b9ca17 100644 --- a/LUFA/Drivers/USB/Core/USBController.h +++ b/LUFA/Drivers/USB/Core/USBController.h @@ -52,6 +52,11 @@ #include "../../../Common/Common.h"
#include "USBMode.h"
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Preprocessor Checks and Defines: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
@@ -64,6 +69,11 @@ #include "UC3/USBController_UC3.h"
#endif
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
/** @} */
diff --git a/LUFA/Drivers/USB/Core/USBInterrupt.h b/LUFA/Drivers/USB/Core/USBInterrupt.h index 3217bda89..c1a2b6227 100644 --- a/LUFA/Drivers/USB/Core/USBInterrupt.h +++ b/LUFA/Drivers/USB/Core/USBInterrupt.h @@ -44,7 +44,12 @@ /* Includes: */
#include "../../../Common/Common.h"
#include "USBMode.h"
-
+
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
@@ -57,5 +62,10 @@ #include "UC3/USBInterrupt_UC3.h"
#endif
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
#endif
diff --git a/LUFA/Drivers/USB/Core/USBMode.h b/LUFA/Drivers/USB/Core/USBMode.h index 4fb65be38..905b5687b 100644 --- a/LUFA/Drivers/USB/Core/USBMode.h +++ b/LUFA/Drivers/USB/Core/USBMode.h @@ -55,6 +55,11 @@ #ifndef __USBMODE_H__ #define __USBMODE_H__ + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + /* Preprocessor Checks: */ #if !defined(__INCLUDE_FROM_USB_DRIVER) #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. @@ -202,6 +207,11 @@ #endif #endif + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + #endif /** @} */ |