Ensure the library builds cleanly in device mode for architectures lacking multiple address spaces.

pull/1469/head
Dean Camera 14 years ago
parent 8f5ab27dc9
commit 06d00bb99b

@ -138,6 +138,7 @@ static void USB_Device_SetConfiguration(void)
#else #else
USB_Descriptor_Device_t* DevDescriptorPtr; USB_Descriptor_Device_t* DevDescriptorPtr;
#if defined(ARCH_HAS_MULTI_ADDRESS_SPACE)
#if defined(USE_FLASH_DESCRIPTORS) #if defined(USE_FLASH_DESCRIPTORS)
#define MemoryAddressSpace MEMSPACE_FLASH #define MemoryAddressSpace MEMSPACE_FLASH
#elif defined(USE_EEPROM_DESCRIPTORS) #elif defined(USE_EEPROM_DESCRIPTORS)
@ -147,9 +148,11 @@ static void USB_Device_SetConfiguration(void)
#else #else
uint8_t MemoryAddressSpace; uint8_t MemoryAddressSpace;
#endif #endif
#endif
if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DevDescriptorPtr if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DevDescriptorPtr
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS) #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \
!(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS))
, &MemoryAddressSpace , &MemoryAddressSpace
#endif #endif
) == NO_DESCRIPTOR) ) == NO_DESCRIPTOR)
@ -157,6 +160,7 @@ static void USB_Device_SetConfiguration(void)
return; return;
} }
#if defined(ARCH_HAS_MULTI_ADDRESS_SPACE)
if (MemoryAddressSpace == MEMSPACE_FLASH) if (MemoryAddressSpace == MEMSPACE_FLASH)
{ {
if (((uint8_t)USB_ControlRequest.wValue > pgm_read_byte(&DevDescriptorPtr->NumberOfConfigurations))) if (((uint8_t)USB_ControlRequest.wValue > pgm_read_byte(&DevDescriptorPtr->NumberOfConfigurations)))
@ -172,6 +176,10 @@ static void USB_Device_SetConfiguration(void)
if ((uint8_t)USB_ControlRequest.wValue > DevDescriptorPtr->NumberOfConfigurations) if ((uint8_t)USB_ControlRequest.wValue > DevDescriptorPtr->NumberOfConfigurations)
return; return;
} }
#else
if ((uint8_t)USB_ControlRequest.wValue > DevDescriptorPtr->NumberOfConfigurations)
return;
#endif
#endif #endif
Endpoint_ClearSETUP(); Endpoint_ClearSETUP();
@ -224,7 +232,8 @@ static void USB_Device_GetDescriptor(void)
const void* DescriptorPointer; const void* DescriptorPointer;
uint16_t DescriptorSize; uint16_t DescriptorSize;
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS) #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \
!(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS))
uint8_t DescriptorAddressSpace; uint8_t DescriptorAddressSpace;
#endif #endif

Loading…
Cancel
Save