diff --git a/Bootloaders/CDC/Descriptors.c b/Bootloaders/CDC/Descriptors.c index 11b2e375d46d74c6e0f6bb9f0aef1c0c0d6b2f47..590b04130cfedf133df1633fd128c340596f4730 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 94f7404c6edbad4fed2dab128d5276a2fe5d950d..cff3cd523e5539dcf7a699a058edb23eb43ce0b7 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 b1642f16ba970bd5330de18d3a2b0ff03e3eca28..62e2d211143a66f877eb27a0f42f9a678d9a51ab 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 f15757ef6e407a6383529d467300be0c9b52ca9e..5be5061eba5f685acd92b9e852fedc407ba9f2ac 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 ba89b84afd5bc6bb7aa7cf3fa822c7011bd8475c..0c3873b41902647d368a753f9fa86744ba17377c 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 c147546f1b8a33b2916b26f259ea2a7664f5ef7c..2ec482db1bd85127961ef9667127b221f39e08e7 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 b128b4f48dec0d4687fda474a673f19474bb0084..d9689f76a6c971400727751b6340f7b216c897b8 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 612450ca335ca5dad1575ff824a361413527c9f2..0eed6e9f31caa5b0b0b9542f48cf153886971a8f 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 1bdce1c0d90b172855aa7dc5e4202c87c4b7867f..7ab6d46d599ad8570735349b28e4716eea18f33d 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 02a5b7c385e2704f38910952c98dd7c3c20558dc..428a6a1b5f5f2f8949cdf83bd06d0304e1ac2d5f 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 2eb2c6e2e3a8e50862b58c212d8b5de6c7572629..6a9d75a7f7b5c66e7bb3d222992b2e91fb04da75 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 51b54cddb7ff3993e0f299e48da3d7149d2e5e36..d4254110c63a61529026fffcc7dae4424727f853 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 dbb16d1de1758d5f6c31bedbb0f67b7f2372e14d..2351a0be212b0630daceff9bb69339faa67dedbc 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 c50ca3ddee10e283c2094aa79c05e40af6b8459f..1da8930b02431062dfe5121432962418706c359a 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 1a2b22ab239af82290cc1a416f7781fef032eac9..0a6cbde3695179ce44d6073986f29288c52937e7 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 93281f1de03ee748f61bbc1e28ed9667ef945bca..dfa4ba16b33f7a4b489ea6705dcf8e88af07541c 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 26ba2c77b462dfdfbc6d15aea7b0699ba2899fc8..d5ab8b754e042b0ff7f6a0eaea8ada2138050f83 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 96a07043900d1771ac0c0289e2a7cf290106435c..965ffb1bddc50a2949b6b05814509c2abb3f8083 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 303c4659aed7374da1cf8fa0d752fe445150c008..c6d72cf02c7cd1e77857955574c51606b83f4ef2 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 2de50584b4450cbb537c4226d7bc0c9c6da9f52e..390ac6b015a79b4cff6a82b6ca134b4919ba153a 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 c1a2e3c4303c21a23995c4ece6baf10bf9e17023..bd7374983ceffc2847f9012bed1211dee04f62d9 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. * * <b>Device Mode</b> * - 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 dd6b3fb63c0ede21ce8a01f852ac90c619420e06..3d9dd08f47db9cbc9d5e06c641c549f3986b914b 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; }