mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[USBPORT] Implement USB2_PromotePeriods().
This commit is contained in:
parent
0558635f98
commit
bc9046c635
1 changed files with 94 additions and 2 deletions
|
@ -1692,8 +1692,100 @@ USB2_PromotePeriods(IN PUSB2_TT_ENDPOINT TtEndpoint,
|
|||
IN PUSB2_REBALANCE Rebalance,
|
||||
IN PULONG RebalanceListEntries)
|
||||
{
|
||||
DPRINT1("USB2_PromotePeriods: UNIMPLEMENTED. FIXME\n");
|
||||
ASSERT(FALSE);
|
||||
PUSB2_TT_ENDPOINT ttEndpoint;
|
||||
ULONG TransferType;
|
||||
ULONG ix;
|
||||
|
||||
TransferType = TtEndpoint->TtEndpointParams.TransferType;
|
||||
|
||||
if (TtEndpoint->ActualPeriod != ENDPOINT_INTERRUPT_1ms &&
|
||||
TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT &&
|
||||
(CHAR)TtEndpoint->StartMicroframe > 2 &&
|
||||
!USB2_ChangePeriod(TtEndpoint, Rebalance, RebalanceListEntries))
|
||||
{
|
||||
DPRINT("USB2_PromotePeriods: return FALSE\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (Rebalance->RebalanceEndpoint[0] == NULL)
|
||||
{
|
||||
DPRINT("USB2_PromotePeriods: return TRUE\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DPRINT("USB2_PromotePeriods: RebalanceListEntries - %X\n",
|
||||
*RebalanceListEntries);
|
||||
|
||||
for (ix = 0; Rebalance->RebalanceEndpoint[ix]; ix++)
|
||||
{
|
||||
Rebalance->RebalanceEndpoint[ix]->IsPromoted = FALSE;
|
||||
}
|
||||
|
||||
for (ix = 0; ; ix++)
|
||||
{
|
||||
ttEndpoint = Rebalance->RebalanceEndpoint[ix];
|
||||
TransferType = ttEndpoint->TtEndpointParams.TransferType;
|
||||
|
||||
if (ttEndpoint->ActualPeriod != ENDPOINT_INTERRUPT_1ms &&
|
||||
TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT &&
|
||||
ttEndpoint->StartMicroframe > 2)
|
||||
{
|
||||
USB2_DeallocateEndpointBudget(ttEndpoint,
|
||||
Rebalance,
|
||||
RebalanceListEntries,
|
||||
USB2_FRAMES);
|
||||
|
||||
ttEndpoint->IsPromoted = TRUE;
|
||||
ttEndpoint->PreviosPeriod = ttEndpoint->Period;
|
||||
ttEndpoint->Period = ENDPOINT_INTERRUPT_1ms;
|
||||
|
||||
if (!USB2_AllocateTimeForEndpoint(ttEndpoint,
|
||||
Rebalance,
|
||||
RebalanceListEntries))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Rebalance->RebalanceEndpoint[ix + 1] == NULL)
|
||||
{
|
||||
DPRINT("USB2_PromotePeriods: return TRUE\n");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
USB2_DeallocateEndpointBudget(TtEndpoint,
|
||||
Rebalance,
|
||||
RebalanceListEntries,
|
||||
USB2_FRAMES);
|
||||
|
||||
TtEndpoint->Period = TtEndpoint->PreviosPeriod;
|
||||
TtEndpoint->PreviosPeriod = 0;
|
||||
|
||||
for (ix = 0; Rebalance->RebalanceEndpoint[ix]; ix++)
|
||||
{
|
||||
ttEndpoint = Rebalance->RebalanceEndpoint[ix];
|
||||
|
||||
if (ttEndpoint->IsPromoted)
|
||||
{
|
||||
if (ttEndpoint->CalcBusTime)
|
||||
{
|
||||
USB2_DeallocateEndpointBudget(ttEndpoint,
|
||||
Rebalance,
|
||||
RebalanceListEntries,
|
||||
USB2_FRAMES);
|
||||
}
|
||||
|
||||
TtEndpoint->Period = TtEndpoint->PreviosPeriod;
|
||||
TtEndpoint->PreviosPeriod = 0;
|
||||
|
||||
USB2_AllocateTimeForEndpoint(ttEndpoint,
|
||||
Rebalance,
|
||||
RebalanceListEntries);
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT("USB2_PromotePeriods: return FALSE\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue