[USBPORT] Use constants in USBPORT_OpenPipe().

This commit is contained in:
Vadim Galyant 2017-11-27 16:56:19 +09:00 committed by Amine Khaldi
parent d2b088e9d6
commit 0b78ad8eb2

View file

@ -642,7 +642,7 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice,
if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2) if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2)
{ {
DPRINT1("USBPORT_OpenPipe: FIXME USB2 EndpointSize\n"); EndpointSize += sizeof(USB2_TT_ENDPOINT);
} }
if (PipeHandle->EndpointDescriptor.wMaxPacketSize == 0) if (PipeHandle->EndpointDescriptor.wMaxPacketSize == 0)
@ -739,14 +739,14 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice,
Interval = EndpointDescriptor->bInterval; Interval = EndpointDescriptor->bInterval;
} }
EndpointProperties->Period = 32; EndpointProperties->Period = ENDPOINT_INTERRUPT_32ms;
if (Interval && (Interval < 32)) if (Interval && (Interval < USB2_FRAMES))
{ {
if ((EndpointProperties->DeviceSpeed != UsbLowSpeed) || if ((EndpointProperties->DeviceSpeed != UsbLowSpeed) ||
(Interval >= 8)) (Interval >= ENDPOINT_INTERRUPT_8ms))
{ {
if (!(Interval & 0x20)) if (!(Interval & ENDPOINT_INTERRUPT_32ms))
{ {
Period = EndpointProperties->Period; Period = EndpointProperties->Period;
@ -761,7 +761,7 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice,
} }
else else
{ {
EndpointProperties->Period = 8; EndpointProperties->Period = ENDPOINT_INTERRUPT_8ms;
} }
} }
} }
@ -775,10 +775,15 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice,
} }
else else
{ {
EndpointProperties->Period = 1; EndpointProperties->Period = ENDPOINT_INTERRUPT_1ms;
} }
} }
if ((DeviceHandle->Flags & DEVICE_HANDLE_FLAG_ROOTHUB) != 0)
{
Endpoint->Flags |= ENDPOINT_FLAG_ROOTHUB_EP0;
}
if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2) if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2)
{ {
IsAllocatedBandwidth = USBPORT_AllocateBandwidthUSB2(FdoDevice, Endpoint); IsAllocatedBandwidth = USBPORT_AllocateBandwidthUSB2(FdoDevice, Endpoint);