[USBPORT] Add USB2_AllocateCheck().
authorVadim Galyant <vgal@rambler.ru>
Wed, 29 Nov 2017 13:33:35 +0000 (22:33 +0900)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 21 Jan 2018 18:35:43 +0000 (19:35 +0100)
drivers/usb/usbport/usb2.c

index ace40d1..080d48c 100644 (file)
 //#define NDEBUG
 #include <debug.h>
 
 //#define NDEBUG
 #include <debug.h>
 
+BOOLEAN
+NTAPI
+USB2_AllocateCheck(IN OUT PULONG OutTimeUsed,
+                   IN ULONG CalcBusTime,
+                   IN ULONG LimitAllocation)
+{
+    ULONG BusTime;
+    BOOLEAN Result = TRUE;
+
+    BusTime = *OutTimeUsed + CalcBusTime;
+    *OutTimeUsed += CalcBusTime;
+
+    if (BusTime > LimitAllocation)
+    {
+        DPRINT("USB2_AllocateCheck: BusTime > LimitAllocation\n");
+        Result = FALSE;
+    }
+
+    return Result;
+}
+
 USHORT
 NTAPI
 USB2_AddDataBitStuff(IN USHORT DataTime)
 USHORT
 NTAPI
 USB2_AddDataBitStuff(IN USHORT DataTime)