https://git.reactos.org/?p=reactos.git;a=commitdiff;h=754f749cfd5ec4b4065929...
commit 754f749cfd5ec4b40659293eb3d5d7ac96dbbdea Author: Vadim Galyant vgal@rambler.ru AuthorDate: Wed Nov 29 21:50:43 2017 +0900 Commit: Amine Khaldi amine.khaldi@reactos.org CommitDate: Sun Jan 21 19:35:42 2018 +0100
[USBPORT] Add USB2_GetOverhead(). --- drivers/usb/usbport/usb2.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 11429ec108..3755fb4e80 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -10,6 +10,54 @@ //#define NDEBUG #include <debug.h>
+ULONG +NTAPI +USB2_GetOverhead(IN PUSB2_TT_ENDPOINT TtEndpoint) +{ + ULONG TransferType; + ULONG Direction; + ULONG DeviceSpeed; + ULONG Overhead; + ULONG HostDelay; + + TransferType = TtEndpoint->TtEndpointParams.TransferType; + Direction = TtEndpoint->TtEndpointParams.Direction; + DeviceSpeed = TtEndpoint->TtEndpointParams.Direction; + + HostDelay = TtEndpoint->Tt->HcExtension->HcDelayTime; + + if (DeviceSpeed == UsbHighSpeed) + { + if (Direction == USBPORT_TRANSFER_DIRECTION_OUT) + { + if (TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS) + Overhead = HostDelay + USB2_HS_ISOCHRONOUS_OUT_OVERHEAD; + else + Overhead = HostDelay + USB2_HS_INTERRUPT_OUT_OVERHEAD; + } + else + { + if (TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS) + Overhead = HostDelay + USB2_HS_ISOCHRONOUS_IN_OVERHEAD; + else + Overhead = HostDelay + USB2_HS_ISOCHRONOUS_OUT_OVERHEAD; + } + } + else if (DeviceSpeed == UsbFullSpeed) + { + if (TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS) + Overhead = HostDelay + USB2_FS_ISOCHRONOUS_OVERHEAD; + else + Overhead = HostDelay + USB2_FS_INTERRUPT_OVERHEAD; + } + else + { + Overhead = HostDelay + USB2_LS_INTERRUPT_OVERHEAD; + } + + return Overhead; +} + VOID NTAPI USB2_InitTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint,