https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c3803bed8a31f9ac138b1…
commit c3803bed8a31f9ac138b1625d5c86187676d7bca
Author: Vadim Galyant <vgal(a)rambler.ru>
AuthorDate: Wed Nov 29 23:25:12 2017 +0900
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sun Jan 21 19:35:43 2018 +0100
[USBPORT] Add USB2_CheckTtEndpointInsert().
---
drivers/usb/usbport/usb2.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c
index 080d48cf21..ad8375db20 100644
--- a/drivers/usb/usbport/usb2.c
+++ b/drivers/usb/usbport/usb2.c
@@ -38,6 +38,52 @@ USB2_AddDataBitStuff(IN USHORT DataTime)
return (DataTime + (DataTime / 16));
}
+BOOLEAN
+NTAPI
+USB2_CheckTtEndpointInsert(IN PUSB2_TT_ENDPOINT nextTtEndpoint,
+ IN PUSB2_TT_ENDPOINT TtEndpoint)
+{
+ ULONG TransferType;
+
+ DPRINT("USB2_CheckTtEndpointInsert: nextTtEndpoint - %p, TtEndpoint -
%p\n",
+ nextTtEndpoint,
+ TtEndpoint);
+
+ ASSERT(TtEndpoint);
+
+ if (TtEndpoint->CalcBusTime >= (USB2_FS_MAX_PERIODIC_ALLOCATION / 2))
+ {
+ DPRINT1("USB2_CheckTtEndpointInsert: Result - FALSE\n");
+ return FALSE;
+ }
+
+ if (!nextTtEndpoint)
+ {
+ DPRINT("USB2_CheckTtEndpointInsert: Result - TRUE\n");
+ return TRUE;
+ }
+
+ TransferType = TtEndpoint->TtEndpointParams.TransferType;
+
+ if (nextTtEndpoint->ActualPeriod < TtEndpoint->ActualPeriod &&
+ TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT)
+ {
+ DPRINT("USB2_CheckTtEndpointInsert: Result - TRUE\n");
+ return TRUE;
+ }
+
+ if ((nextTtEndpoint->ActualPeriod <= TtEndpoint->ActualPeriod &&
+ TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS) ||
+ nextTtEndpoint == TtEndpoint)
+ {
+ DPRINT("USB2_CheckTtEndpointInsert: Result - TRUE\n");
+ return TRUE;
+ }
+
+ DPRINT("USB2_CheckTtEndpointInsert: Result - FALSE\n");
+ return FALSE;
+}
+
ULONG
NTAPI
USB2_GetOverhead(IN PUSB2_TT_ENDPOINT TtEndpoint)