[USBPORT] Add USBPORT_UpdateAllocatedBwTt().

This commit is contained in:
Vadim Galyant 2017-11-27 18:30:58 +09:00 committed by Amine Khaldi
parent 18702047a1
commit e48d6136ec
2 changed files with 39 additions and 0 deletions

View file

@ -31,6 +31,40 @@ USB2_InitTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint,
TtEndpoint->Tt = Tt;
}
VOID
NTAPI
USBPORT_UpdateAllocatedBwTt(IN PUSB2_TT_EXTENSION TtExtension)
{
ULONG BusBandwidth;
ULONG NewBusBandwidth;
ULONG MaxBusBandwidth = 0;
ULONG MinBusBandwidth;
ULONG ix;
DPRINT("USBPORT_UpdateAllocatedBwTt: TtExtension - %p\n", TtExtension);
BusBandwidth = TtExtension->BusBandwidth;
MinBusBandwidth = BusBandwidth;
for (ix = 0; ix < USB2_FRAMES; ix++)
{
NewBusBandwidth = BusBandwidth - TtExtension->Bandwidth[ix];
if (NewBusBandwidth > MaxBusBandwidth)
MaxBusBandwidth = NewBusBandwidth;
if (NewBusBandwidth < MinBusBandwidth)
MinBusBandwidth = NewBusBandwidth;
}
TtExtension->MaxBandwidth = MaxBusBandwidth;
if (MinBusBandwidth == BusBandwidth)
TtExtension->MinBandwidth = 0;
else
TtExtension->MinBandwidth = MinBusBandwidth;
}
BOOLEAN
NTAPI
USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice,

View file

@ -1296,6 +1296,11 @@ USBPORT_FreeBandwidthUSB2(
IN PDEVICE_OBJECT FdoDevice,
IN PUSBPORT_ENDPOINT Endpoint);
VOID
NTAPI
USBPORT_UpdateAllocatedBwTt(
IN PUSB2_TT_EXTENSION TtExtension);
VOID
NTAPI
USB2_InitTT(