Commit 72c2922e authored by Dean Camera's avatar Dean Camera
Browse files

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

parent eeba38e3
...@@ -220,22 +220,22 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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;
} }
......
...@@ -225,32 +225,32 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c ...@@ -225,32 +225,32 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c
const uint8_t DescriptorType = (wValue >> 8); const uint8_t DescriptorType = (wValue >> 8);
const uint8_t DescriptorNumber = (wValue & 0xFF); const uint8_t DescriptorNumber = (wValue & 0xFF);
void* Address = NULL; void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR; uint16_t Size = NO_DESCRIPTOR;
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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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);