Removed DESCRIPTOR_ADDRESS() macro as it was largely supurflous and only served to obfuscate code.

pull/1469/head
Dean Camera 16 years ago
parent eeba38e343
commit 72c2922e38

@ -220,22 +220,22 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
if (!(DescriptorNumber)) if (!(DescriptorNumber))
{ {
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = LanguageString.Header.Size; Size = LanguageString.Header.Size;
} }
else else
{ {
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = ProductString.Header.Size; Size = ProductString.Header.Size;
} }

@ -154,22 +154,22 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
if (!(DescriptorNumber)) if (!(DescriptorNumber))
{ {
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = &LanguageString;
Size = LanguageString.Header.Size; Size = LanguageString.Header.Size;
} }
else else
{ {
Address = DESCRIPTOR_ADDRESS(ProductString); Address = &ProductString;
Size = ProductString.Header.Size; Size = ProductString.Header.Size;
} }

@ -183,32 +183,32 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
if (!(DescriptorNumber)) if (!(DescriptorNumber))
{ {
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = LanguageString.Header.Size; Size = LanguageString.Header.Size;
} }
else else
{ {
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = ProductString.Header.Size; Size = ProductString.Header.Size;
} }
break; break;
case DTYPE_HID: case DTYPE_HID:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.HIDDescriptor); Address = (void*)&ConfigurationDescriptor.HIDDescriptor;
Size = sizeof(USB_Descriptor_HID_t); Size = sizeof(USB_Descriptor_HID_t);
break; break;
case DTYPE_Report: case DTYPE_Report:
Address = DESCRIPTOR_ADDRESS(HIDReport); Address = (void*)&HIDReport;
Size = sizeof(HIDReport); Size = sizeof(HIDReport);
break; break;
} }

@ -282,26 +282,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }

@ -282,26 +282,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }

@ -231,26 +231,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }

@ -353,26 +353,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }

@ -210,37 +210,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }
break; break;
case DTYPE_HID: case DTYPE_HID:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.GenericHID); Address = (void*)&ConfigurationDescriptor.GenericHID;
Size = sizeof(USB_Descriptor_HID_t); Size = sizeof(USB_Descriptor_HID_t);
break; break;
case DTYPE_Report: case DTYPE_Report:
Address = DESCRIPTOR_ADDRESS(GenericReport); Address = (void*)&GenericReport;
Size = sizeof(GenericReport); Size = sizeof(GenericReport);
break; break;
} }

@ -210,37 +210,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }
break; break;
case DTYPE_HID: case DTYPE_HID:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.JoystickHID); Address = (void*)&ConfigurationDescriptor.JoystickHID;
Size = sizeof(USB_Descriptor_HID_t); Size = sizeof(USB_Descriptor_HID_t);
break; break;
case DTYPE_Report: case DTYPE_Report:
Address = DESCRIPTOR_ADDRESS(JoystickReport); Address = (void*)&JoystickReport;
Size = sizeof(JoystickReport); Size = sizeof(JoystickReport);
break; break;
} }

@ -227,37 +227,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }
break; break;
case DTYPE_HID: case DTYPE_HID:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.KeyboardHID); Address = (void*)&ConfigurationDescriptor.KeyboardHID;
Size = sizeof(USB_Descriptor_HID_t); Size = sizeof(USB_Descriptor_HID_t);
break; break;
case DTYPE_Report: case DTYPE_Report:
Address = DESCRIPTOR_ADDRESS(KeyboardReport); Address = (void*)&KeyboardReport;
Size = sizeof(KeyboardReport); Size = sizeof(KeyboardReport);
break; break;
} }

@ -297,26 +297,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }
@ -325,24 +325,24 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
case DTYPE_HID: case DTYPE_HID:
if (!(wIndex)) if (!(wIndex))
{ {
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.KeyboardHID); Address = (void*)&ConfigurationDescriptor.KeyboardHID;
Size = sizeof(USB_Descriptor_HID_t); Size = sizeof(USB_Descriptor_HID_t);
} }
else else
{ {
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.MouseHID); Address = (void*)&ConfigurationDescriptor.MouseHID;
Size = sizeof(USB_Descriptor_HID_t); Size = sizeof(USB_Descriptor_HID_t);
} }
break; break;
case DTYPE_Report: case DTYPE_Report:
if (!(wIndex)) if (!(wIndex))
{ {
Address = DESCRIPTOR_ADDRESS(KeyboardReport); Address = (void*)&KeyboardReport;
Size = sizeof(KeyboardReport); Size = sizeof(KeyboardReport);
} }
else else
{ {
Address = DESCRIPTOR_ADDRESS(MouseReport); Address = (void*)&MouseReport;
Size = sizeof(MouseReport); Size = sizeof(MouseReport);
} }

@ -293,26 +293,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }

@ -187,30 +187,30 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
case 0x03: case 0x03:
Address = DESCRIPTOR_ADDRESS(SerialNumberString); Address = (void*)&SerialNumberString;
Size = pgm_read_byte(&SerialNumberString.Header.Size); Size = pgm_read_byte(&SerialNumberString.Header.Size);
break; break;
} }

@ -250,6 +250,11 @@ TASK(USB_MassStorage)
Endpoint_ResetFIFO(MASS_STORAGE_OUT_EPNUM); Endpoint_ResetFIFO(MASS_STORAGE_OUT_EPNUM);
Endpoint_ResetFIFO(MASS_STORAGE_IN_EPNUM); Endpoint_ResetFIFO(MASS_STORAGE_IN_EPNUM);
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_ClearStall();
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_ClearStall();
/* Clear the abort transfer flag */ /* Clear the abort transfer flag */
IsMassStoreReset = false; IsMassStoreReset = false;
} }

@ -210,37 +210,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }
break; break;
case DTYPE_HID: case DTYPE_HID:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.MouseHID); Address = (void*)&ConfigurationDescriptor.MouseHID;
Size = sizeof(USB_Descriptor_HID_t); Size = sizeof(USB_Descriptor_HID_t);
break; break;
case DTYPE_Report: case DTYPE_Report:
Address = DESCRIPTOR_ADDRESS(MouseReport); Address = (void*)&MouseReport;
Size = sizeof(MouseReport); Size = sizeof(MouseReport);
break; break;
} }

@ -231,26 +231,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }

@ -231,26 +231,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }

@ -155,26 +155,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }

@ -19,6 +19,7 @@
* interface is skipped * interface is skipped
* - Clarified the size of library tokens which accept integer values in the Compile Time Tokens page, values now use the smallest datatype * - Clarified the size of library tokens which accept integer values in the Compile Time Tokens page, values now use the smallest datatype
* inside the library that is able to hold their defined value to save space * inside the library that is able to hold their defined value to save space
* - Removed DESCRIPTOR_ADDRESS() macro as it was largely supurflous and only served to obfuscate code
* *
* *
* \section Sec_ChangeLog090510 Version 090510 * \section Sec_ChangeLog090510 Version 090510

@ -175,9 +175,6 @@
*/ */
#define ENDPOINT_USAGE_IMPLICIT_FEEDBACK (2 << 4) #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK (2 << 4)
/** Gives a void pointer to the specified descriptor (of any type). */
#define DESCRIPTOR_ADDRESS(Descriptor) ((void*)&Descriptor)
/* Events: */ /* Events: */
#if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)
/** This module raises the Device Error event while in device mode, if the \ref USB_GetDescriptor() /** This module raises the Device Error event while in device mode, if the \ref USB_GetDescriptor()
@ -483,7 +480,7 @@
* otherwise zero for standard descriptors, or as defined in a class-specific * otherwise zero for standard descriptors, or as defined in a class-specific
* standards. * standards.
* \param DescriptorAddress Pointer to the descriptor in memory. This should be set by the routine to * \param DescriptorAddress Pointer to the descriptor in memory. This should be set by the routine to
* the location of the descriptor, found by the \ref DESCRIPTOR_ADDRESS() macro. * the address of the descriptor.
* *
* \note By default, the library expects all descriptors to be located in flash memory via the PROGMEM attribute. * \note By default, the library expects all descriptors to be located in flash memory via the PROGMEM attribute.
* If descriptors should be located in RAM or EEPROM instead (to speed up access in the case of RAM, or to * If descriptors should be located in RAM or EEPROM instead (to speed up access in the case of RAM, or to

@ -17,6 +17,8 @@
* projects using interrupts on non-control endpoints should switch to polling. For control interrupts, the library can * projects using interrupts on non-control endpoints should switch to polling. For control interrupts, the library can
* manage the control endpoint via interrupts automatically by compiling with the INTERRUPT_CONTROL_ENDPOINT token defined. * manage the control endpoint via interrupts automatically by compiling with the INTERRUPT_CONTROL_ENDPOINT token defined.
* - The Endpoint_ClearEndpointInterrupt() macro has been deleted and references to it should be removed. * - The Endpoint_ClearEndpointInterrupt() macro has been deleted and references to it should be removed.
* - The DESCRIPTOR_ADDRESS() macro has been removed. User applications should use normal casts to obtain a descriptor's memory
* address.
* *
* <b>Device Mode</b> * <b>Device Mode</b>
* - Support for non-control data pipe interrupts has been dropped due to many issues in the implementation. All existing * - Support for non-control data pipe interrupts has been dropped due to many issues in the implementation. All existing

@ -207,37 +207,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
switch (DescriptorType) switch (DescriptorType)
{ {
case DTYPE_Device: case DTYPE_Device:
Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); Address = (void*)&DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t); Size = sizeof(USB_Descriptor_Device_t);
break; break;
case DTYPE_Configuration: case DTYPE_Configuration:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); Address = (void*)&ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t); Size = sizeof(USB_Descriptor_Configuration_t);
break; break;
case DTYPE_String: case DTYPE_String:
switch (DescriptorNumber) switch (DescriptorNumber)
{ {
case 0x00: case 0x00:
Address = DESCRIPTOR_ADDRESS(LanguageString); Address = (void*)&LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size); Size = pgm_read_byte(&LanguageString.Header.Size);
break; break;
case 0x01: case 0x01:
Address = DESCRIPTOR_ADDRESS(ManufacturerString); Address = (void*)&ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size); Size = pgm_read_byte(&ManufacturerString.Header.Size);
break; break;
case 0x02: case 0x02:
Address = DESCRIPTOR_ADDRESS(ProductString); Address = (void*)&ProductString;
Size = pgm_read_byte(&ProductString.Header.Size); Size = pgm_read_byte(&ProductString.Header.Size);
break; break;
} }
break; break;
case DTYPE_HID: case DTYPE_HID:
Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.KeyboardHID); Address = (void*)&ConfigurationDescriptor.KeyboardHID;
Size = sizeof(USB_Descriptor_HID_t); Size = sizeof(USB_Descriptor_HID_t);
break; break;
case DTYPE_Report: case DTYPE_Report:
Address = DESCRIPTOR_ADDRESS(KeyboardReport); Address = (void*)&KeyboardReport;
Size = sizeof(KeyboardReport); Size = sizeof(KeyboardReport);
break; break;
} }

Loading…
Cancel
Save