From 72c2922e38a2dfd14eb2d8e3692171704b5508f4 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 17 May 2009 07:44:00 +0000 Subject: Removed DESCRIPTOR_ADDRESS() macro as it was largely supurflous and only served to obfuscate code. --- Bootloaders/CDC/Descriptors.c | 8 ++++---- Bootloaders/DFU/Descriptors.c | 8 ++++---- Bootloaders/TeensyHID/Descriptors.c | 12 ++++++------ Demos/Device/AudioInput/Descriptors.c | 10 +++++----- Demos/Device/AudioOutput/Descriptors.c | 10 +++++----- Demos/Device/CDC/Descriptors.c | 14 +++++++------- Demos/Device/DualCDC/Descriptors.c | 10 +++++----- Demos/Device/GenericHID/Descriptors.c | 14 +++++++------- Demos/Device/Joystick/Descriptors.c | 14 +++++++------- Demos/Device/Keyboard/Descriptors.c | 14 +++++++------- Demos/Device/KeyboardMouse/Descriptors.c | 18 +++++++++--------- Demos/Device/MIDI/Descriptors.c | 10 +++++----- Demos/Device/MassStorage/Descriptors.c | 12 ++++++------ Demos/Device/MassStorage/MassStorage.c | 5 +++++ Demos/Device/Mouse/Descriptors.c | 14 +++++++------- Demos/Device/RNDISEthernet/Descriptors.c | 10 +++++----- Demos/Device/USBtoSerial/Descriptors.c | 10 +++++----- Demos/OTG/TestApp/Descriptors.c | 10 +++++----- LUFA/ChangeLog.txt | 1 + LUFA/Drivers/USB/HighLevel/StdDescriptors.h | 5 +---- LUFA/MigrationInformation.txt | 2 ++ Projects/Magstripe/Descriptors.c | 14 +++++++------- 22 files changed, 115 insertions(+), 110 deletions(-) diff --git a/Bootloaders/CDC/Descriptors.c b/Bootloaders/CDC/Descriptors.c index 11b2e375d..590b04130 100644 --- a/Bootloaders/CDC/Descriptors.c +++ b/Bootloaders/CDC/Descriptors.c @@ -220,22 +220,22 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: if (!(DescriptorNumber)) { - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = LanguageString.Header.Size; } else { - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = ProductString.Header.Size; } diff --git a/Bootloaders/DFU/Descriptors.c b/Bootloaders/DFU/Descriptors.c index 94f7404c6..cff3cd523 100644 --- a/Bootloaders/DFU/Descriptors.c +++ b/Bootloaders/DFU/Descriptors.c @@ -154,22 +154,22 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = &DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = &ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: if (!(DescriptorNumber)) { - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = &LanguageString; Size = LanguageString.Header.Size; } else { - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = &ProductString; Size = ProductString.Header.Size; } diff --git a/Bootloaders/TeensyHID/Descriptors.c b/Bootloaders/TeensyHID/Descriptors.c index b1642f16b..62e2d2111 100644 --- a/Bootloaders/TeensyHID/Descriptors.c +++ b/Bootloaders/TeensyHID/Descriptors.c @@ -183,32 +183,32 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: if (!(DescriptorNumber)) { - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = LanguageString.Header.Size; } else { - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = ProductString.Header.Size; } break; case DTYPE_HID: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.HIDDescriptor); + Address = (void*)&ConfigurationDescriptor.HIDDescriptor; Size = sizeof(USB_Descriptor_HID_t); break; case DTYPE_Report: - Address = DESCRIPTOR_ADDRESS(HIDReport); + Address = (void*)&HIDReport; Size = sizeof(HIDReport); break; } diff --git a/Demos/Device/AudioInput/Descriptors.c b/Demos/Device/AudioInput/Descriptors.c index f15757ef6..5be5061eb 100644 --- a/Demos/Device/AudioInput/Descriptors.c +++ b/Demos/Device/AudioInput/Descriptors.c @@ -282,26 +282,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } diff --git a/Demos/Device/AudioOutput/Descriptors.c b/Demos/Device/AudioOutput/Descriptors.c index ba89b84af..0c3873b41 100644 --- a/Demos/Device/AudioOutput/Descriptors.c +++ b/Demos/Device/AudioOutput/Descriptors.c @@ -282,26 +282,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } diff --git a/Demos/Device/CDC/Descriptors.c b/Demos/Device/CDC/Descriptors.c index c147546f1..2ec482db1 100644 --- a/Demos/Device/CDC/Descriptors.c +++ b/Demos/Device/CDC/Descriptors.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 DescriptorNumber = (wValue & 0xFF); - void* Address = NULL; - uint16_t Size = NO_DESCRIPTOR; + void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } diff --git a/Demos/Device/DualCDC/Descriptors.c b/Demos/Device/DualCDC/Descriptors.c index b128b4f48..d9689f76a 100644 --- a/Demos/Device/DualCDC/Descriptors.c +++ b/Demos/Device/DualCDC/Descriptors.c @@ -353,26 +353,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } diff --git a/Demos/Device/GenericHID/Descriptors.c b/Demos/Device/GenericHID/Descriptors.c index 612450ca3..0eed6e9f3 100644 --- a/Demos/Device/GenericHID/Descriptors.c +++ b/Demos/Device/GenericHID/Descriptors.c @@ -210,37 +210,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } break; case DTYPE_HID: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.GenericHID); + Address = (void*)&ConfigurationDescriptor.GenericHID; Size = sizeof(USB_Descriptor_HID_t); break; case DTYPE_Report: - Address = DESCRIPTOR_ADDRESS(GenericReport); + Address = (void*)&GenericReport; Size = sizeof(GenericReport); break; } diff --git a/Demos/Device/Joystick/Descriptors.c b/Demos/Device/Joystick/Descriptors.c index 1bdce1c0d..7ab6d46d5 100644 --- a/Demos/Device/Joystick/Descriptors.c +++ b/Demos/Device/Joystick/Descriptors.c @@ -210,37 +210,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } break; case DTYPE_HID: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.JoystickHID); + Address = (void*)&ConfigurationDescriptor.JoystickHID; Size = sizeof(USB_Descriptor_HID_t); break; case DTYPE_Report: - Address = DESCRIPTOR_ADDRESS(JoystickReport); + Address = (void*)&JoystickReport; Size = sizeof(JoystickReport); break; } diff --git a/Demos/Device/Keyboard/Descriptors.c b/Demos/Device/Keyboard/Descriptors.c index 02a5b7c38..428a6a1b5 100644 --- a/Demos/Device/Keyboard/Descriptors.c +++ b/Demos/Device/Keyboard/Descriptors.c @@ -227,37 +227,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } break; case DTYPE_HID: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.KeyboardHID); + Address = (void*)&ConfigurationDescriptor.KeyboardHID; Size = sizeof(USB_Descriptor_HID_t); break; case DTYPE_Report: - Address = DESCRIPTOR_ADDRESS(KeyboardReport); + Address = (void*)&KeyboardReport; Size = sizeof(KeyboardReport); break; } diff --git a/Demos/Device/KeyboardMouse/Descriptors.c b/Demos/Device/KeyboardMouse/Descriptors.c index 2eb2c6e2e..6a9d75a7f 100644 --- a/Demos/Device/KeyboardMouse/Descriptors.c +++ b/Demos/Device/KeyboardMouse/Descriptors.c @@ -297,26 +297,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } @@ -325,24 +325,24 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c case DTYPE_HID: if (!(wIndex)) { - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.KeyboardHID); + Address = (void*)&ConfigurationDescriptor.KeyboardHID; Size = sizeof(USB_Descriptor_HID_t); } else { - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.MouseHID); + Address = (void*)&ConfigurationDescriptor.MouseHID; Size = sizeof(USB_Descriptor_HID_t); } break; case DTYPE_Report: if (!(wIndex)) { - Address = DESCRIPTOR_ADDRESS(KeyboardReport); + Address = (void*)&KeyboardReport; Size = sizeof(KeyboardReport); } else { - Address = DESCRIPTOR_ADDRESS(MouseReport); + Address = (void*)&MouseReport; Size = sizeof(MouseReport); } diff --git a/Demos/Device/MIDI/Descriptors.c b/Demos/Device/MIDI/Descriptors.c index 51b54cddb..d4254110c 100644 --- a/Demos/Device/MIDI/Descriptors.c +++ b/Demos/Device/MIDI/Descriptors.c @@ -293,26 +293,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } diff --git a/Demos/Device/MassStorage/Descriptors.c b/Demos/Device/MassStorage/Descriptors.c index dbb16d1de..2351a0be2 100644 --- a/Demos/Device/MassStorage/Descriptors.c +++ b/Demos/Device/MassStorage/Descriptors.c @@ -187,30 +187,30 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; case 0x03: - Address = DESCRIPTOR_ADDRESS(SerialNumberString); + Address = (void*)&SerialNumberString; Size = pgm_read_byte(&SerialNumberString.Header.Size); break; } diff --git a/Demos/Device/MassStorage/MassStorage.c b/Demos/Device/MassStorage/MassStorage.c index c50ca3dde..1da8930b0 100644 --- a/Demos/Device/MassStorage/MassStorage.c +++ b/Demos/Device/MassStorage/MassStorage.c @@ -249,6 +249,11 @@ TASK(USB_MassStorage) /* Reset the data endpoint banks */ Endpoint_ResetFIFO(MASS_STORAGE_OUT_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 */ IsMassStoreReset = false; diff --git a/Demos/Device/Mouse/Descriptors.c b/Demos/Device/Mouse/Descriptors.c index 1a2b22ab2..0a6cbde36 100644 --- a/Demos/Device/Mouse/Descriptors.c +++ b/Demos/Device/Mouse/Descriptors.c @@ -210,37 +210,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } break; case DTYPE_HID: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.MouseHID); + Address = (void*)&ConfigurationDescriptor.MouseHID; Size = sizeof(USB_Descriptor_HID_t); break; case DTYPE_Report: - Address = DESCRIPTOR_ADDRESS(MouseReport); + Address = (void*)&MouseReport; Size = sizeof(MouseReport); break; } diff --git a/Demos/Device/RNDISEthernet/Descriptors.c b/Demos/Device/RNDISEthernet/Descriptors.c index 93281f1de..dfa4ba16b 100644 --- a/Demos/Device/RNDISEthernet/Descriptors.c +++ b/Demos/Device/RNDISEthernet/Descriptors.c @@ -231,26 +231,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } diff --git a/Demos/Device/USBtoSerial/Descriptors.c b/Demos/Device/USBtoSerial/Descriptors.c index 26ba2c77b..d5ab8b754 100644 --- a/Demos/Device/USBtoSerial/Descriptors.c +++ b/Demos/Device/USBtoSerial/Descriptors.c @@ -231,26 +231,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } diff --git a/Demos/OTG/TestApp/Descriptors.c b/Demos/OTG/TestApp/Descriptors.c index 96a070439..965ffb1bd 100644 --- a/Demos/OTG/TestApp/Descriptors.c +++ b/Demos/OTG/TestApp/Descriptors.c @@ -155,26 +155,26 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt index 303c4659a..c6d72cf02 100644 --- a/LUFA/ChangeLog.txt +++ b/LUFA/ChangeLog.txt @@ -19,6 +19,7 @@ * 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 * 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 diff --git a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h index 2de50584b..390ac6b01 100644 --- a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h +++ b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h @@ -175,9 +175,6 @@ */ #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: */ #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) /** 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 * standards. * \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. * If descriptors should be located in RAM or EEPROM instead (to speed up access in the case of RAM, or to diff --git a/LUFA/MigrationInformation.txt b/LUFA/MigrationInformation.txt index c1a2e3c43..bd7374983 100644 --- a/LUFA/MigrationInformation.txt +++ b/LUFA/MigrationInformation.txt @@ -17,6 +17,8 @@ * 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. * - 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. * * Device Mode * - Support for non-control data pipe interrupts has been dropped due to many issues in the implementation. All existing diff --git a/Projects/Magstripe/Descriptors.c b/Projects/Magstripe/Descriptors.c index dd6b3fb63..3d9dd08f4 100644 --- a/Projects/Magstripe/Descriptors.c +++ b/Projects/Magstripe/Descriptors.c @@ -207,37 +207,37 @@ uint16_t USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** c switch (DescriptorType) { case DTYPE_Device: - Address = DESCRIPTOR_ADDRESS(DeviceDescriptor); + Address = (void*)&DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor); + Address = (void*)&ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = DESCRIPTOR_ADDRESS(LanguageString); + Address = (void*)&LanguageString; Size = pgm_read_byte(&LanguageString.Header.Size); break; case 0x01: - Address = DESCRIPTOR_ADDRESS(ManufacturerString); + Address = (void*)&ManufacturerString; Size = pgm_read_byte(&ManufacturerString.Header.Size); break; case 0x02: - Address = DESCRIPTOR_ADDRESS(ProductString); + Address = (void*)&ProductString; Size = pgm_read_byte(&ProductString.Header.Size); break; } break; case DTYPE_HID: - Address = DESCRIPTOR_ADDRESS(ConfigurationDescriptor.KeyboardHID); + Address = (void*)&ConfigurationDescriptor.KeyboardHID; Size = sizeof(USB_Descriptor_HID_t); break; case DTYPE_Report: - Address = DESCRIPTOR_ADDRESS(KeyboardReport); + Address = (void*)&KeyboardReport; Size = sizeof(KeyboardReport); break; } -- cgit v1.2.3