[USBPORT] Use constants in USBPORT_CalculateUsbBandwidth().

This commit is contained in:
Vadim Galyant 2017-11-27 16:27:49 +09:00 committed by Amine Khaldi
parent 41f4814c44
commit a3dd5620d3

View file

@ -20,7 +20,7 @@ USBPORT_CalculateUsbBandwidth(IN PDEVICE_OBJECT FdoDevice,
{ {
PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties; PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties;
ULONG Bandwidth; ULONG Bandwidth;
ULONG Additional; ULONG Overhead;
DPRINT("USBPORT_CalculateUsbBandwidth ... \n"); DPRINT("USBPORT_CalculateUsbBandwidth ... \n");
@ -29,25 +29,25 @@ USBPORT_CalculateUsbBandwidth(IN PDEVICE_OBJECT FdoDevice,
switch (EndpointProperties->TransferType) switch (EndpointProperties->TransferType)
{ {
case USBPORT_TRANSFER_TYPE_ISOCHRONOUS: case USBPORT_TRANSFER_TYPE_ISOCHRONOUS:
Additional = 9; Overhead = USB2_FS_ISOCHRONOUS_OVERHEAD;
break; break;
case USBPORT_TRANSFER_TYPE_INTERRUPT: case USBPORT_TRANSFER_TYPE_INTERRUPT:
Additional = 13; Overhead = USB2_FS_INTERRUPT_OVERHEAD;
break; break;
default: //USBPORT_TRANSFER_TYPE_CONTROL or USBPORT_TRANSFER_TYPE_BULK default: //USBPORT_TRANSFER_TYPE_CONTROL or USBPORT_TRANSFER_TYPE_BULK
Additional = 0; Overhead = 0;
break; break;
} }
if (Additional == 0) if (Overhead == 0)
{ {
Bandwidth = 0; Bandwidth = 0;
} }
else else
{ {
Bandwidth = (EndpointProperties->TotalMaxPacketSize + Additional) * 8 * 7 / 6; Bandwidth = (EndpointProperties->TotalMaxPacketSize + Overhead) * 8 * 7 / 6;
} }
if (EndpointProperties->DeviceSpeed == UsbLowSpeed) if (EndpointProperties->DeviceSpeed == UsbLowSpeed)