[USBPORT] Add USB2_InitTT().
authorVadim Galyant <vgal@rambler.ru>
Mon, 27 Nov 2017 08:50:47 +0000 (17:50 +0900)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 21 Jan 2018 18:35:37 +0000 (19:35 +0100)
drivers/usb/usbport/usb2.c

index c274e69..6d71769 100644 (file)
@@ -27,6 +27,63 @@ USBPORT_FreeBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice,
     DPRINT1("USBPORT_FreeBandwidthUSB2: UNIMPLEMENTED. FIXME. \n");
 }
 
+VOID
+NTAPI
+USB2_InitTT(IN PUSB2_HC_EXTENSION HcExtension,
+            IN PUSB2_TT Tt)
+{
+    ULONG ix;
+    ULONG jx;
+
+    DPRINT("USB2_InitTT: HcExtension - %p, Tt - %p\n", HcExtension, Tt);
+
+    Tt->HcExtension = HcExtension;
+    Tt->DelayTime = 1;
+    Tt->MaxTime = USB2_FS_MAX_PERIODIC_ALLOCATION;
+
+    for (ix = 0; ix < USB2_FRAMES; ix++)
+    {
+        Tt->FrameBudget[ix].TimeUsed = USB2_MAX_MICROFRAMES;
+        Tt->FrameBudget[ix].AltEndpoint = NULL;
+
+        for (jx = 0; jx < USB2_MICROFRAMES; jx++)
+        {
+            Tt->TimeCS[ix][jx] = 0;
+            Tt->NumStartSplits[ix][jx] = 0;
+        }
+
+        Tt->FrameBudget[ix].IsoEndpoint = &Tt->IsoEndpoint[ix];
+
+        USB2_InitTtEndpoint(&Tt->IsoEndpoint[ix],
+                            USBPORT_TRANSFER_TYPE_ISOCHRONOUS,
+                            USBPORT_TRANSFER_DIRECTION_OUT,
+                            UsbFullSpeed,
+                            USB2_FRAMES,
+                            0,
+                            Tt);
+
+        Tt->IsoEndpoint[ix].ActualPeriod = USB2_FRAMES;
+        Tt->IsoEndpoint[ix].CalcBusTime = USB2_FS_SOF_TIME + USB2_HUB_DELAY;
+        Tt->IsoEndpoint[ix].StartFrame = ix;
+        Tt->IsoEndpoint[ix].StartMicroframe = 0xFF;
+
+        Tt->FrameBudget[ix].IntEndpoint = &Tt->IntEndpoint[ix];
+
+        USB2_InitTtEndpoint(&Tt->IntEndpoint[ix],
+                            USBPORT_TRANSFER_TYPE_INTERRUPT,
+                            USBPORT_TRANSFER_DIRECTION_OUT,
+                            UsbFullSpeed,
+                            USB2_FRAMES,
+                            0,
+                            Tt);
+
+        Tt->IntEndpoint[ix].ActualPeriod = USB2_FRAMES;
+        Tt->IntEndpoint[ix].CalcBusTime = USB2_FS_SOF_TIME + USB2_HUB_DELAY;
+        Tt->IntEndpoint[ix].StartFrame = ix;
+        Tt->IntEndpoint[ix].StartMicroframe = 0xFF;
+    }
+}
+
 VOID
 NTAPI
 USB2_InitController(IN PUSB2_HC_EXTENSION HcExtension)