https://git.reactos.org/?p=reactos.git;a=commitdiff;h=22b8777f8498a0bfa657a…
commit 22b8777f8498a0bfa657af86ef3c08bbc4a414d9
Author: Vadim Galyant <vgal(a)rambler.ru>
AuthorDate: Thu Nov 30 00:11:48 2017 +0900
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sun Jan 21 19:35:44 2018 +0100
[USBPORT] Add USB2_GetStartTime().
---
drivers/usb/usbport/usb2.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c
index 94c2844bd7..b70ac11851 100644
--- a/drivers/usb/usbport/usb2.c
+++ b/drivers/usb/usbport/usb2.c
@@ -159,6 +159,49 @@ USB2_GetLastIsoTime(IN PUSB2_TT_ENDPOINT TtEndpoint,
return Result;
}
+ULONG
+NTAPI
+USB2_GetStartTime(IN PUSB2_TT_ENDPOINT nextTtEndpoint,
+ IN PUSB2_TT_ENDPOINT TtEndpoint,
+ IN PUSB2_TT_ENDPOINT prevTtEndpoint,
+ IN ULONG Frame)
+{
+ PUSB2_TT_ENDPOINT ttEndpoint;
+ ULONG TransferType;
+
+ DPRINT("USB2_GetStartTime: nextTtEndpoint - %p, TtEndpoint - %p, prevTtEndpoint
- %p, Frame - %X\n",
+ nextTtEndpoint,
+ TtEndpoint,
+ prevTtEndpoint,
+ Frame);
+
+ TransferType = TtEndpoint->TtEndpointParams.TransferType;
+
+ if (nextTtEndpoint && TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS)
+ {
+ return nextTtEndpoint->StartTime + nextTtEndpoint->CalcBusTime;
+ }
+
+ if (TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS)
+ {
+ ttEndpoint = TtEndpoint->Tt->FrameBudget[Frame].AltEndpoint;
+
+ if (ttEndpoint)
+ return ttEndpoint->StartTime + ttEndpoint->CalcBusTime;
+ else
+ return USB2_FS_SOF_TIME;
+ }
+ else
+ {
+ ttEndpoint = prevTtEndpoint;
+
+ if (ttEndpoint == TtEndpoint->Tt->FrameBudget[Frame].IntEndpoint)
+ return USB2_GetLastIsoTime(TtEndpoint, Frame);
+ else
+ return ttEndpoint->StartTime + ttEndpoint->CalcBusTime;
+ }
+}
+
VOID
NTAPI
USB2_InitTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint,