Remove the unused USB_DeviceSetSpeed() function.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user