[USBPORT] Add USB2_CommonFrames().
authorVadim Galyant <vgal@rambler.ru>
Mon, 11 Dec 2017 09:01:07 +0000 (18:01 +0900)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 21 Jan 2018 18:35:52 +0000 (19:35 +0100)
drivers/usb/usbport/usb2.c

index ade65b4..0e305b4 100644 (file)
@@ -711,6 +711,33 @@ USB2_MoveTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint,
     return TRUE;
 }
 
+BOOLEAN
+NTAPI
+USB2_CommonFrames(IN PUSB2_TT_ENDPOINT NextTtEndpoint,
+                  IN PUSB2_TT_ENDPOINT TtEndpoint)
+{
+    UCHAR Frame;
+
+    DPRINT("USB2_CommonFrames: \n");
+
+    if (NextTtEndpoint->ActualPeriod == ENDPOINT_INTERRUPT_1ms ||
+        TtEndpoint->ActualPeriod == ENDPOINT_INTERRUPT_1ms)
+    {
+        return TRUE;
+    }
+
+    if (NextTtEndpoint->ActualPeriod < TtEndpoint->ActualPeriod)
+    {
+        Frame = TtEndpoint->StartFrame % TtEndpoint->ActualPeriod;
+    }
+    else
+    {
+        Frame = NextTtEndpoint->StartFrame % TtEndpoint->ActualPeriod;
+    }
+
+    return (Frame == TtEndpoint->StartFrame);
+}
+
 VOID
 NTAPI
 USB2_ConvertFrame(IN UCHAR Frame,