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/Core/AVR8 | |
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/Core/AVR8')
-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 |
3 files changed, 36 insertions, 1 deletions
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)) |