From e8d7341e5a36ddd6d4096951a8e756fc6d0bcaae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Wed, 24 Feb 2016 20:20:38 +0100 Subject: [PATCH] Remove the unused USB_DeviceSetSpeed() function. --- right/usb_device_descriptor.c | 73 ----------------------------------- right/usb_device_descriptor.h | 2 - 2 files changed, 75 deletions(-) diff --git a/right/usb_device_descriptor.c b/right/usb_device_descriptor.c index c7291ea..5d7e98f 100644 --- a/right/usb_device_descriptor.c +++ b/right/usb_device_descriptor.c @@ -492,76 +492,3 @@ usb_status_t USB_DeviceGetHidPhysicalDescriptor(usb_device_handle handle, { return kStatus_USB_InvalidRequest; } - -/* Due to the difference of HS and FS descriptors, the device descriptors and configurations need to be updated to match - * current speed. - * As the default, the device descriptors and configurations are configured by using FS parameters for both EHCI and - * KHCI. - * When the EHCI is enabled, the application needs to call this function to update device by using current speed. - * The updated information includes endpoint max packet size, endpoint interval, etc. */ -usb_status_t USB_DeviceSetSpeed(usb_device_handle handle, uint8_t speed) -{ - usb_descriptor_union_t *descriptorHead; - usb_descriptor_union_t *descriptorTail; - - descriptorHead = (usb_descriptor_union_t *)&g_UsbDeviceConfigurationDescriptor[0]; - descriptorTail = - (usb_descriptor_union_t *)(&g_UsbDeviceConfigurationDescriptor[USB_DESCRIPTOR_LENGTH_CONFIGURATION_ALL - 1U]); - - while (descriptorHead < descriptorTail) { - if (descriptorHead->common.bDescriptorType == USB_DESCRIPTOR_TYPE_ENDPOINT) { - if (USB_SPEED_HIGH == speed) { - if (((descriptorHead->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_IN) == - USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_IN) && - (USB_HID_MOUSE_ENDPOINT_IN == - (descriptorHead->endpoint.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK))) - { - descriptorHead->endpoint.bInterval = HS_HID_MOUSE_INTERRUPT_IN_INTERVAL; - USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(HS_HID_MOUSE_INTERRUPT_IN_PACKET_SIZE, - descriptorHead->endpoint.wMaxPacketSize); - } else if (((descriptorHead->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_IN) == - USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_IN) && - (USB_HID_KEYBOARD_ENDPOINT_IN == - (descriptorHead->endpoint.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK))) - { - descriptorHead->endpoint.bInterval = HS_HID_KEYBOARD_INTERRUPT_IN_INTERVAL; - USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(HS_HID_KEYBOARD_INTERRUPT_IN_PACKET_SIZE, - descriptorHead->endpoint.wMaxPacketSize); - } - } else { - if (((descriptorHead->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_IN) == - USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_IN) && - (USB_HID_MOUSE_ENDPOINT_IN == - (descriptorHead->endpoint.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK))) - { - descriptorHead->endpoint.bInterval = FS_HID_MOUSE_INTERRUPT_IN_INTERVAL; - USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(FS_HID_MOUSE_INTERRUPT_IN_PACKET_SIZE, - descriptorHead->endpoint.wMaxPacketSize); - } else if (((descriptorHead->endpoint.bEndpointAddress & USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_IN) == - USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_IN) && - (USB_HID_KEYBOARD_ENDPOINT_IN == - (descriptorHead->endpoint.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK))) - { - descriptorHead->endpoint.bInterval = FS_HID_KEYBOARD_INTERRUPT_IN_INTERVAL; - USB_SHORT_TO_LITTLE_ENDIAN_ADDRESS(FS_HID_KEYBOARD_INTERRUPT_IN_PACKET_SIZE, - descriptorHead->endpoint.wMaxPacketSize); - } - } - } - descriptorHead = (usb_descriptor_union_t *)((uint8_t *)descriptorHead + descriptorHead->common.bLength); - } - - if (USB_SPEED_HIGH == speed) { - g_UsbDeviceHidMouseEndpoints[0].maxPacketSize = HS_HID_MOUSE_INTERRUPT_IN_PACKET_SIZE; - } else { - g_UsbDeviceHidMouseEndpoints[0].maxPacketSize = FS_HID_MOUSE_INTERRUPT_IN_PACKET_SIZE; - } - - if (USB_SPEED_HIGH == speed) { - g_UsbDeviceHidKeyboardEndpoints[0].maxPacketSize = HS_HID_KEYBOARD_INTERRUPT_IN_PACKET_SIZE; - } else { - g_UsbDeviceHidKeyboardEndpoints[0].maxPacketSize = FS_HID_KEYBOARD_INTERRUPT_IN_PACKET_SIZE; - } - - return kStatus_USB_Success; -} diff --git a/right/usb_device_descriptor.h b/right/usb_device_descriptor.h index 451057b..70894c1 100644 --- a/right/usb_device_descriptor.h +++ b/right/usb_device_descriptor.h @@ -66,8 +66,6 @@ /* Function prototypes: */ - extern usb_status_t USB_DeviceSetSpeed(usb_device_handle handle, uint8_t speed); - usb_status_t USB_DeviceGetDeviceDescriptor( usb_device_handle handle, usb_device_get_device_descriptor_struct_t *deviceDescriptor);