mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 13:56:56 +00:00
[USBPORT] Implement USBPORT_AllocateBandwidth().
This commit is contained in:
parent
c6ca2a8f02
commit
aae6dd6073
1 changed files with 78 additions and 9 deletions
|
@ -68,9 +68,19 @@ USBPORT_AllocateBandwidth(IN PDEVICE_OBJECT FdoDevice,
|
||||||
ULONG TransferType;
|
ULONG TransferType;
|
||||||
ULONG TotalBusBandwidth;
|
ULONG TotalBusBandwidth;
|
||||||
ULONG EndpointBandwidth;
|
ULONG EndpointBandwidth;
|
||||||
|
ULONG MinBandwidth;
|
||||||
|
PULONG Bandwidth;
|
||||||
|
ULONG MaxBandwidth = 0;
|
||||||
|
ULONG ix;
|
||||||
|
ULONG Offset;
|
||||||
|
LONG ScheduleOffset = -1;
|
||||||
ULONG Period;
|
ULONG Period;
|
||||||
|
ULONG Factor;
|
||||||
|
UCHAR Bit;
|
||||||
|
|
||||||
DPRINT("USBPORT_AllocateBandwidth: ... \n");
|
DPRINT("USBPORT_AllocateBandwidth: FdoDevice - %p, Endpoint - %p\n",
|
||||||
|
FdoDevice,
|
||||||
|
Endpoint);
|
||||||
|
|
||||||
FdoExtension = FdoDevice->DeviceExtension;
|
FdoExtension = FdoDevice->DeviceExtension;
|
||||||
EndpointProperties = &Endpoint->EndpointProperties;
|
EndpointProperties = &Endpoint->EndpointProperties;
|
||||||
|
@ -87,16 +97,75 @@ USBPORT_AllocateBandwidth(IN PDEVICE_OBJECT FdoDevice,
|
||||||
TotalBusBandwidth = FdoExtension->TotalBusBandwidth;
|
TotalBusBandwidth = FdoExtension->TotalBusBandwidth;
|
||||||
EndpointBandwidth = EndpointProperties->UsbBandwidth;
|
EndpointBandwidth = EndpointProperties->UsbBandwidth;
|
||||||
Period = EndpointProperties->Period;
|
Period = EndpointProperties->Period;
|
||||||
|
Factor = USB2_FRAMES / Period;
|
||||||
|
ASSERT(Factor);
|
||||||
|
|
||||||
DPRINT1("USBPORT_AllocateBandwidth: FIXME. \n");
|
for (Offset = 0; Offset < Period; Offset++)
|
||||||
DPRINT1("USBPORT_AllocateBandwidth: Endpoint - %p, Type - %x, TotalBandwidth - %x, EpBandwidth - %x, Period - %x\n",
|
{
|
||||||
Endpoint,
|
MinBandwidth = TotalBusBandwidth;
|
||||||
TransferType,
|
Bandwidth = &FdoExtension->Bandwidth[Offset * Factor];
|
||||||
TotalBusBandwidth,
|
|
||||||
EndpointBandwidth,
|
|
||||||
Period);
|
|
||||||
|
|
||||||
return TRUE;
|
for (ix = 0; *Bandwidth >= EndpointBandwidth; ix++)
|
||||||
|
{
|
||||||
|
if (MinBandwidth > *Bandwidth)
|
||||||
|
{
|
||||||
|
MinBandwidth = *Bandwidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bandwidth++;
|
||||||
|
|
||||||
|
if (Factor <= (ix + 1))
|
||||||
|
{
|
||||||
|
if (MinBandwidth > MaxBandwidth)
|
||||||
|
{
|
||||||
|
MaxBandwidth = MinBandwidth;
|
||||||
|
ScheduleOffset = Offset;
|
||||||
|
|
||||||
|
DPRINT("USBPORT_AllocateBandwidth: ScheduleOffset - %X\n",
|
||||||
|
ScheduleOffset);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("USBPORT_AllocateBandwidth: ScheduleOffset - %X\n", ScheduleOffset);
|
||||||
|
|
||||||
|
if (ScheduleOffset != -1)
|
||||||
|
{
|
||||||
|
EndpointProperties->ScheduleOffset = ScheduleOffset;
|
||||||
|
|
||||||
|
Bandwidth = &FdoExtension->Bandwidth[ScheduleOffset * Factor];
|
||||||
|
|
||||||
|
for (Factor = USB2_FRAMES / Period; Factor; Factor--)
|
||||||
|
{
|
||||||
|
FdoExtension->Bandwidth[ScheduleOffset * Factor] -= EndpointBandwidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT)
|
||||||
|
{
|
||||||
|
for (Bit = 0x80; Bit != 0; Bit >>= 1)
|
||||||
|
{
|
||||||
|
if ((Period & Bit) != 0)
|
||||||
|
{
|
||||||
|
Period = Bit;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("USBPORT_AllocateBandwidth: FIXME AllocedInterrupt_XXms\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT("USBPORT_AllocateBandwidth: FIXME AllocedIso\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("USBPORT_AllocateBandwidth: FIXME USBPORT_UpdateAllocatedBw\n");
|
||||||
|
|
||||||
|
DPRINT("USBPORT_AllocateBandwidth: ScheduleOffset - %X\n", ScheduleOffset);
|
||||||
|
return ScheduleOffset != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue