https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e701da4923f0ba5061d67649219771d8510d91d0

commit e701da4923f0ba5061d67649219771d8510d91d0
Author:     Vadim Galyant <v...@rambler.ru>
AuthorDate: Wed Nov 29 22:33:35 2017 +0900
Commit:     Amine Khaldi <amine.kha...@reactos.org>
CommitDate: Sun Jan 21 19:35:43 2018 +0100

    [USBPORT] Add USB2_AllocateCheck().
---
 drivers/usb/usbport/usb2.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c
index ace40d1e1c..080d48cf21 100644
--- a/drivers/usb/usbport/usb2.c
+++ b/drivers/usb/usbport/usb2.c
@@ -10,6 +10,27 @@
 //#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)

Reply via email to