ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2018
----- 2025 -----
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
25 participants
436 discussions
Start a n
N
ew thread
59/77: [USBPORT] Implement USB2_PromotePeriods().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bc9046c635c69d97ffc42…
commit bc9046c635c69d97ffc4247678497e4c3cc39853 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Sat Dec 16 22:30:13 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:55 2018 +0100 [USBPORT] Implement USB2_PromotePeriods(). --- drivers/usb/usbport/usb2.c | 96 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 2 deletions(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 642271903a..cfaf122fba 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -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; }
7 years
1
0
0
0
58/77: [USBPORT] Add USB2_ChangePeriod().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0558635f98c236568a7fe…
commit 0558635f98c236568a7fe36ca297b377962b5348 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Sat Dec 16 22:26:50 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:55 2018 +0100 [USBPORT] Add USB2_ChangePeriod(). --- drivers/usb/usbport/usb2.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index a9ba071b08..642271903a 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -1660,6 +1660,32 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, return Result; } +BOOLEAN +NTAPI +USB2_ChangePeriod(IN PUSB2_TT_ENDPOINT TtEndpoint, + IN PUSB2_REBALANCE Rebalance, + IN PULONG RebalanceListEntries) +{ + BOOLEAN Result; + + DPRINT("USB2_ChangePeriod: RebalanceListEntries - %X\n", + *RebalanceListEntries); + + USB2_DeallocateEndpointBudget(TtEndpoint, + Rebalance, + RebalanceListEntries, + USB2_FRAMES); + + TtEndpoint->PreviosPeriod = TtEndpoint->Period; + TtEndpoint->Period = ENDPOINT_INTERRUPT_1ms; + + Result = USB2_AllocateTimeForEndpoint(TtEndpoint, + Rebalance, + RebalanceListEntries); + + return Result; +} + BOOLEAN NTAPI USB2_PromotePeriods(IN PUSB2_TT_ENDPOINT TtEndpoint,
7 years
1
0
0
0
57/77: [USBPORT] Implement USB2_DeallocateEndpointBudget().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=69406c26280eea5a096aa…
commit 69406c26280eea5a096aada5c8bc104c9e946458 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Sat Dec 16 13:03:00 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:54 2018 +0100 [USBPORT] Implement USB2_DeallocateEndpointBudget(). --- drivers/usb/usbport/usb2.c | 198 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 196 insertions(+), 2 deletions(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 459b293736..a9ba071b08 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -1102,10 +1102,204 @@ USB2_DeallocateEndpointBudget(IN PUSB2_TT_ENDPOINT TtEndpoint, /* Speed != UsbHighSpeed (FS/LS) */ - DPRINT("USB2_DeallocateEndpointBudget: UNIMPLEMENTED FIXME\n"); - ASSERT(FALSE); + TransferType = TtEndpoint->TtEndpointParams.TransferType; + + for (ix = MaxFrames, Frame = (MaxFrames - 1) - TtEndpoint->StartFrame; + ix > 0; + ix--, Frame--) + { + frame = TtEndpoint->StartFrame + Frame; + + DPRINT("USB2_DeallocateEndpointBudget: frame - %X, Frame - %X, StartFrame - %X\n", + frame, + Frame, + TtEndpoint->StartFrame); + + if ((Frame % TtEndpoint->ActualPeriod) == 0) + { + USB2_DeallocateHS(TtEndpoint, Frame); + Tt->FrameBudget[frame].TimeUsed -= TtEndpoint->CalcBusTime; + } + + if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT) + { + endpoint = Tt->FrameBudget[frame].IntEndpoint; + } + else + { + endpoint = Tt->FrameBudget[frame].IsoEndpoint; + } + + nextEndpoint = endpoint->NextTtEndpoint; + + DPRINT("USB2_DeallocateEndpointBudget: TtEndpoint - %p, nextEndpoint - %p\n", + TtEndpoint, + nextEndpoint); + + if (TtEndpoint->CalcBusTime > (USB2_FS_MAX_PERIODIC_ALLOCATION / 2)) + { + while (nextEndpoint) + { + endpoint = nextEndpoint; + nextEndpoint = nextEndpoint->NextTtEndpoint; + } + + nextEndpoint = TtEndpoint; + + DPRINT("USB2_DeallocateEndpointBudget: endpoint - %p, nextEndpoint - %p\n", + endpoint, + nextEndpoint); + } + else + { + while (nextEndpoint && + !USB2_CheckTtEndpointInsert(nextEndpoint, TtEndpoint)) + { + endpoint = nextEndpoint; + nextEndpoint = nextEndpoint->NextTtEndpoint; + } + + if (TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS && + nextEndpoint) + { + DPRINT1("USB2_DeallocateEndpointBudget: Iso Ep UNIMPLEMENTED. FIXME\n"); + ASSERT(FALSE); + } + + DPRINT("USB2_DeallocateEndpointBudget: endpoint - %p, nextEndpoint - %p\n", + endpoint, + nextEndpoint); + } + + if ((Frame % TtEndpoint->ActualPeriod) == 0) + { + if (TtEndpoint->CalcBusTime > (USB2_FS_MAX_PERIODIC_ALLOCATION / 2)) + { + Tt->FrameBudget[frame].AltEndpoint = NULL; + } + else if (nextEndpoint) + { + nextEndpoint = nextEndpoint->NextTtEndpoint; + endpoint->NextTtEndpoint = nextEndpoint; + + DPRINT("USB2_DeallocateEndpointBudget: endpoint - %p, nextEndpoint - %p\n", + endpoint, + nextEndpoint); + } + } + + if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT) + { + if (endpoint == Tt->FrameBudget[frame].IntEndpoint) + { + if (Tt->FrameBudget[frame].IsoEndpoint->NextTtEndpoint) + { + endpoint = Tt->FrameBudget[frame].IsoEndpoint->NextTtEndpoint; + DPRINT("USB2_DeallocateEndpointBudget: endpoint - %p\n", endpoint); + } + else if (Tt->FrameBudget[frame].AltEndpoint) + { + endpoint = Tt->FrameBudget[frame].AltEndpoint; + DPRINT("USB2_DeallocateEndpointBudget: endpoint - %p\n", endpoint); + } + } + } + else + { + DPRINT1("USB2_DeallocateEndpointBudget: Iso Ep UNIMPLEMENTED. FIXME\n"); + ASSERT(FALSE); + } + + Period = TtEndpoint->ActualPeriod; + + for (; + nextEndpoint; + endpoint = nextEndpoint, + nextEndpoint = nextEndpoint->NextTtEndpoint) + { + DPRINT("USB2_DeallocateEndpointBudget: endpoint - %p, nextEndpoint - %p\n", + endpoint, + nextEndpoint); + + endTime = endpoint->StartTime + endpoint->CalcBusTime; + maxEndTime = endTime; + + if (Period > nextEndpoint->ActualPeriod || + TtEndpoint->StartFrame != nextEndpoint->StartFrame) + { + if (USB2_CommonFrames(nextEndpoint, TtEndpoint)) + Factor = Period / nextEndpoint->ActualPeriod; + else + Factor = USB2_FRAMES / nextEndpoint->ActualPeriod; + + maxEndTime = endTime; + + for (jx = 0, frame = nextEndpoint->StartFrame; + jx < Factor; + jx++, frame += nextEndpoint->ActualPeriod) + { + if (nextEndpoint->StartFrame != TtEndpoint->StartFrame) + { + lastEndpoint = Tt->FrameBudget[frame].IntEndpoint; + + if (Tt->FrameBudget[frame].IsoEndpoint->NextTtEndpoint) + { + lastEndpoint = Tt->FrameBudget[frame].IsoEndpoint->NextTtEndpoint; + } + else if (Tt->FrameBudget[frame].AltEndpoint) + { + lastEndpoint = Tt->FrameBudget[frame].AltEndpoint; + } + + for (tmpEndpoint = Tt->FrameBudget[frame].IntEndpoint->NextTtEndpoint; + tmpEndpoint && tmpEndpoint != nextEndpoint; + tmpEndpoint = tmpEndpoint->NextTtEndpoint) + { + lastEndpoint = tmpEndpoint; + } + + lastEndTime = lastEndpoint->StartTime + lastEndpoint->CalcBusTime; + + if (endTime < (lastEndTime - 1)) + { + maxEndTime = lastEndTime; + endTime = maxEndTime; + + if (nextEndpoint->StartTime == maxEndTime) + break; + } + else + { + maxEndTime = endTime; + } + } + } + } + + if (maxEndTime >= nextEndpoint->StartTime) + break; + + if (!USB2_MoveTtEndpoint(nextEndpoint, + maxEndTime - nextEndpoint->StartTime, + Rebalance, + *RebalanceListEntries, + &IsMoved)) + { + if (!IsMoved) + { + DPRINT("USB2_DeallocateEndpointBudget: Not moved!\n"); + } + + break; + } + + if (Period > nextEndpoint->ActualPeriod) + Period = nextEndpoint->ActualPeriod; + } + } TtEndpoint->CalcBusTime = 0; + DPRINT("USB2_DeallocateEndpointBudget: return TRUE\n"); return TRUE; }
7 years
1
0
0
0
56/77: [USBPORT] Implement USB2_RebalanceEndpoint().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5ad7a2faa535316595e96…
commit 5ad7a2faa535316595e962da72ed497934fdd233 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Fri Dec 15 19:01:36 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:54 2018 +0100 [USBPORT] Implement USB2_RebalanceEndpoint(). --- drivers/usb/usbport/usb2.c | 86 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 84 insertions(+), 2 deletions(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index d1dce19f3f..459b293736 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -877,8 +877,90 @@ NTAPI USB2_RebalanceEndpoint(IN PDEVICE_OBJECT FdoDevice, IN PLIST_ENTRY List) { - DPRINT1("USB2_RebalanceEndpoint: UNIMPLEMENTED. FIXME\n"); - ASSERT(FALSE); + PUSBPORT_DEVICE_EXTENSION FdoExtension; + PUSBPORT_REGISTRATION_PACKET Packet; + PUSBPORT_ENDPOINT Endpoint; + PLIST_ENTRY Entry; + ULONG AllocedBusTime; + ULONG EndpointBandwidth; + ULONG Factor; + ULONG ScheduleOffset; + ULONG Bandwidth; + ULONG n; + ULONG ix; + KIRQL OldIrql; + UCHAR NewPeriod; + UCHAR SMask; + UCHAR CMask; + + FdoExtension = FdoDevice->DeviceExtension; + Packet = &FdoExtension->MiniPortInterface->Packet; + + while (!IsListEmpty(List)) + { + Entry = RemoveHeadList(List); + + Endpoint = CONTAINING_RECORD(Entry, + USBPORT_ENDPOINT, + RebalanceLink.Flink); + + DPRINT("USB2_RebalanceEndpoint: Endpoint - %p\n", Endpoint); + + Endpoint->RebalanceLink.Flink = NULL; + Endpoint->RebalanceLink.Blink = NULL; + + KeAcquireSpinLock(&Endpoint->EndpointSpinLock, + &Endpoint->EndpointOldIrql); + + SMask = USB2_GetSMASK(Endpoint->TtEndpoint); + CMask = USB2_GetCMASK(Endpoint->TtEndpoint); + + ScheduleOffset = Endpoint->TtEndpoint->StartFrame; + NewPeriod = Endpoint->TtEndpoint->ActualPeriod; + + AllocedBusTime = Endpoint->TtEndpoint->CalcBusTime; + EndpointBandwidth = USB2_MICROFRAMES * AllocedBusTime; + + Endpoint->EndpointProperties.InterruptScheduleMask = SMask; + Endpoint->EndpointProperties.SplitCompletionMask = CMask; + + if (Endpoint->EndpointProperties.Period != NewPeriod) + { + Factor = USB2_FRAMES / Endpoint->EndpointProperties.Period; + ASSERT(Factor); + + for (ix = 0; ix < Factor; ix++) + { + Bandwidth = Endpoint->EndpointProperties.UsbBandwidth; + n = Factor * Endpoint->EndpointProperties.ScheduleOffset; + Endpoint->TtExtension->Bandwidth[n + ix] += Bandwidth; + } + + Endpoint->EndpointProperties.Period = NewPeriod; + Endpoint->EndpointProperties.ScheduleOffset = ScheduleOffset; + Endpoint->EndpointProperties.UsbBandwidth = EndpointBandwidth; + + Factor = USB2_FRAMES / NewPeriod; + ASSERT(Factor); + + for (ix = 0; ix < Factor; ix++) + { + n = Factor * ScheduleOffset; + Endpoint->TtExtension->Bandwidth[n + ix] += EndpointBandwidth; + } + } + + KeAcquireSpinLock(&FdoExtension->MiniportSpinLock, &OldIrql); + + Packet->RebalanceEndpoint(FdoExtension->MiniPortExt, + &Endpoint->EndpointProperties, + (PVOID)((ULONG_PTR)Endpoint + sizeof(USBPORT_ENDPOINT))); + + KeReleaseSpinLock(&FdoExtension->MiniportSpinLock, OldIrql); + + KeReleaseSpinLock(&Endpoint->EndpointSpinLock, + Endpoint->EndpointOldIrql); + } } VOID
7 years
1
0
0
0
55/77: [USBPORT] Implement USB2_Rebalance().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=522c0d3c69dc3993b851d…
commit 522c0d3c69dc3993b851d8aa3fa77b95deb93a9a Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Thu Dec 14 04:06:48 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:54 2018 +0100 [USBPORT] Implement USB2_Rebalance(). --- drivers/usb/usbport/usb2.c | 86 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index de399d8a52..d1dce19f3f 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -881,6 +881,90 @@ USB2_RebalanceEndpoint(IN PDEVICE_OBJECT FdoDevice, ASSERT(FALSE); } +VOID +NTAPI +USB2_Rebalance(IN PDEVICE_OBJECT FdoDevice, + IN PLIST_ENTRY RebalanceList) +{ + PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties; + PUSBPORT_ENDPOINT Endpoint; + PLIST_ENTRY Entry; + LIST_ENTRY BalanceListInt1; + LIST_ENTRY BalanceListInt2; + ULONG TransferType; + ULONG ScheduleOffset; + UCHAR SMask; + UCHAR CMask; + UCHAR ActualPeriod; + + DPRINT("USB2_Rebalance: FdoDevice - %p, RebalanceList - %p\n", + FdoDevice, + RebalanceList); + + InitializeListHead(&BalanceListInt1); + InitializeListHead(&BalanceListInt2); + + while (!IsListEmpty(RebalanceList)) + { + Entry = RebalanceList->Flink; + + Endpoint = CONTAINING_RECORD(Entry, + USBPORT_ENDPOINT, + RebalanceLink.Flink); + + DPRINT("USBPORT_Rebalance: Entry - %p, Endpoint - %p\n", + Entry, + Endpoint); + + RemoveHeadList(RebalanceList); + Entry->Flink = NULL; + Entry->Blink = NULL; + + SMask = USB2_GetSMASK(Endpoint->TtEndpoint); + CMask = USB2_GetCMASK(Endpoint->TtEndpoint); + + ScheduleOffset = Endpoint->TtEndpoint->StartFrame; + ActualPeriod = Endpoint->TtEndpoint->ActualPeriod; + + EndpointProperties = &Endpoint->EndpointProperties; + TransferType = EndpointProperties->TransferType; + + switch (TransferType) + { + case USBPORT_TRANSFER_TYPE_ISOCHRONOUS: + DPRINT("USBPORT_Rebalance: USBPORT_TRANSFER_TYPE_ISOCHRONOUS. FIXME\n"); + ASSERT(FALSE); + break; + + case USBPORT_TRANSFER_TYPE_INTERRUPT: + if (SMask != EndpointProperties->InterruptScheduleMask || + CMask != EndpointProperties->SplitCompletionMask || + ScheduleOffset != EndpointProperties->ScheduleOffset || + ActualPeriod != EndpointProperties->Period) + { + if (ActualPeriod == EndpointProperties->Period && + ScheduleOffset == EndpointProperties->ScheduleOffset) + { + InsertTailList(&BalanceListInt1, Entry); + } + else + { + InsertTailList(&BalanceListInt2, Entry); + } + } + break; + + default: + ASSERT(FALSE); + break; + } + } + + USB2_RebalanceEndpoint(FdoDevice, &BalanceListInt2); + USB2_RebalanceEndpoint(FdoDevice, &BalanceListInt1); + //USB2_RebalanceEndpoint(FdoDevice, &BalanceListIso); +} + BOOLEAN NTAPI USB2_DeallocateEndpointBudget(IN PUSB2_TT_ENDPOINT TtEndpoint, @@ -1567,7 +1651,7 @@ USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice, } } - //USB2_Rebalance(FdoDevice, &RebalanceList); + USB2_Rebalance(FdoDevice, &RebalanceList); if (!TtExtension) {
7 years
1
0
0
0
54/77: [USBPORT] Add stub for USB2_RebalanceEndpoint().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5d12e3040c5ee4543b360…
commit 5d12e3040c5ee4543b360f27fad17e1ac5439357 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Thu Dec 14 04:05:06 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:53 2018 +0100 [USBPORT] Add stub for USB2_RebalanceEndpoint(). --- drivers/usb/usbport/usb2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index ebdd2594fe..de399d8a52 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -872,6 +872,15 @@ USB2_GetCMASK(IN PUSB2_TT_ENDPOINT TtEndpoint) return Result; } +VOID +NTAPI +USB2_RebalanceEndpoint(IN PDEVICE_OBJECT FdoDevice, + IN PLIST_ENTRY List) +{ + DPRINT1("USB2_RebalanceEndpoint: UNIMPLEMENTED. FIXME\n"); + ASSERT(FALSE); +} + BOOLEAN NTAPI USB2_DeallocateEndpointBudget(IN PUSB2_TT_ENDPOINT TtEndpoint,
7 years
1
0
0
0
53/77: [USBPORT] Rename variables only in USB2_AllocateTimeForEndpoint().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bbbcb1dc7567e84485e92…
commit bbbcb1dc7567e84485e9264a3de3e4a93594f20e Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Wed Dec 13 19:46:18 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:53 2018 +0100 [USBPORT] Rename variables only in USB2_AllocateTimeForEndpoint(). --- drivers/usb/usbport/usb2.c | 56 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index a6a2f218ee..ebdd2594fe 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -953,8 +953,8 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, ULONG TransferType; ULONG Overhead; ULONG LatestStart; - PUSB2_TT_ENDPOINT prevTtEndpoint; - PUSB2_TT_ENDPOINT nextTtEndpoint; + PUSB2_TT_ENDPOINT prevEndpoint; + PUSB2_TT_ENDPOINT nextEndpoint; PUSB2_TT_ENDPOINT IntEndpoint; ULONG StartTime; ULONG calcBusTime; @@ -1123,25 +1123,25 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, } if (TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS) - prevTtEndpoint = Tt->FrameBudget[frame].IsoEndpoint; + prevEndpoint = Tt->FrameBudget[frame].IsoEndpoint; else - prevTtEndpoint = Tt->FrameBudget[frame].IntEndpoint; + prevEndpoint = Tt->FrameBudget[frame].IntEndpoint; - for (nextTtEndpoint = prevTtEndpoint->NextTtEndpoint; - nextTtEndpoint; - nextTtEndpoint = nextTtEndpoint->NextTtEndpoint) + for (nextEndpoint = prevEndpoint->NextTtEndpoint; + nextEndpoint; + nextEndpoint = nextEndpoint->NextTtEndpoint) { - if (USB2_CheckTtEndpointInsert(nextTtEndpoint, TtEndpoint)) + if (USB2_CheckTtEndpointInsert(nextEndpoint, TtEndpoint)) { break; } - prevTtEndpoint = nextTtEndpoint; + prevEndpoint = nextEndpoint; } - StartTime = USB2_GetStartTime(nextTtEndpoint, + StartTime = USB2_GetStartTime(nextEndpoint, TtEndpoint, - prevTtEndpoint, + prevEndpoint, frame); if (StartTime > LatestStart) @@ -1174,15 +1174,15 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, else { IntEndpoint = Tt->FrameBudget[ix].IntEndpoint; - nextTtEndpoint = IntEndpoint->NextTtEndpoint; + nextEndpoint = IntEndpoint->NextTtEndpoint; - for (nextTtEndpoint = IntEndpoint->NextTtEndpoint; - nextTtEndpoint; - nextTtEndpoint = nextTtEndpoint->NextTtEndpoint) + for (nextEndpoint = IntEndpoint->NextTtEndpoint; + nextEndpoint; + nextEndpoint = nextEndpoint->NextTtEndpoint) { - if (USB2_CheckTtEndpointInsert(nextTtEndpoint, TtEndpoint)) + if (USB2_CheckTtEndpointInsert(nextEndpoint, TtEndpoint)) break; - IntEndpoint = nextTtEndpoint; + IntEndpoint = nextEndpoint; } if ((frame % TtEndpoint->ActualPeriod) == 0) @@ -1191,10 +1191,10 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, } else { - if (nextTtEndpoint) + if (nextEndpoint) { calcBusTime = LatestStart + TtEndpoint->CalcBusTime - - nextTtEndpoint->StartTime; + nextEndpoint->StartTime; } else { @@ -1215,21 +1215,21 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, } } - if (nextTtEndpoint != TtEndpoint) + if (nextEndpoint != TtEndpoint) { if ((frame % TtEndpoint->ActualPeriod) == 0) { if (frame == 0) { DPRINT("USB2_AllocateTimeForEndpoint: frame == 0\n"); - TtEndpoint->NextTtEndpoint = nextTtEndpoint; + TtEndpoint->NextTtEndpoint = nextEndpoint; } IntEndpoint->NextTtEndpoint = TtEndpoint; - DPRINT("USB2_AllocateTimeForEndpoint: TtEndpoint - %p, nextTtEndpoint - %p\n", + DPRINT("USB2_AllocateTimeForEndpoint: TtEndpoint - %p, nextEndpoint - %p\n", TtEndpoint, - nextTtEndpoint); + nextEndpoint); } if (calcBusTime > 0) @@ -1237,15 +1237,15 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, BOOLEAN IsMoved; BOOLEAN MoveResult; - DPRINT("USB2_AllocateTimeForEndpoint: nextTtEndpoint - %p, calcBusTime - %X\n", - nextTtEndpoint, + DPRINT("USB2_AllocateTimeForEndpoint: nextEndpoint - %p, calcBusTime - %X\n", + nextEndpoint, calcBusTime); for (; - nextTtEndpoint; - nextTtEndpoint = nextTtEndpoint->NextTtEndpoint) + nextEndpoint; + nextEndpoint = nextEndpoint->NextTtEndpoint) { - MoveResult = USB2_MoveTtEndpoint(nextTtEndpoint, + MoveResult = USB2_MoveTtEndpoint(nextEndpoint, calcBusTime, Rebalance, *RebalanceListEntries,
7 years
1
0
0
0
52/77: [USBPORT] Start implementation USB2_DeallocateEndpointBudget().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3ba9fffbb2594b1909366…
commit 3ba9fffbb2594b1909366fba1ce5af69ab28a44b Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Wed Dec 13 03:51:54 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:53 2018 +0100 [USBPORT] Start implementation USB2_DeallocateEndpointBudget(). --- drivers/usb/usbport/usb2.c | 53 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 0e305b4d11..a6a2f218ee 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -879,9 +879,60 @@ USB2_DeallocateEndpointBudget(IN PUSB2_TT_ENDPOINT TtEndpoint, IN PULONG RebalanceListEntries, IN ULONG MaxFrames) { + PUSB2_TT Tt; + PUSB2_HC_EXTENSION HcExtension; + ULONG Speed; + ULONG StartMicroframe; + ULONG ix; + + UCHAR frame; + UCHAR uframe; + + DPRINT("USB2_DeallocateEndpointBudget: TtEndpoint - %p, MaxFrames - %X\n", + TtEndpoint, + MaxFrames); + + if (TtEndpoint->CalcBusTime == 0) + { + DPRINT("USB2_DeallocateEndpointBudget: endpoint not allocated\n");//error((int)"endpoint not allocated"); + return FALSE; + } + + Tt = TtEndpoint->Tt; + HcExtension = Tt->HcExtension; + + Speed = TtEndpoint->TtEndpointParams.DeviceSpeed; + DPRINT("USB2_DeallocateEndpointBudget: DeviceSpeed - %X\n", Speed); + + StartMicroframe = TtEndpoint->StartFrame * USB2_MICROFRAMES + + TtEndpoint->StartMicroframe; + + if (Speed == UsbHighSpeed) + { + for (ix = StartMicroframe; + ix < USB2_MAX_MICROFRAMES; + ix += TtEndpoint->ActualPeriod) + { + frame = ix / USB2_MICROFRAMES; + uframe = ix % (USB2_MICROFRAMES - 1); + + HcExtension->TimeUsed[frame][uframe] -= TtEndpoint->CalcBusTime; + } + + TtEndpoint->CalcBusTime = 0; + + DPRINT("USB2_DeallocateEndpointBudget: return TRUE\n"); + return TRUE; + } + + /* Speed != UsbHighSpeed (FS/LS) */ + DPRINT("USB2_DeallocateEndpointBudget: UNIMPLEMENTED FIXME\n"); ASSERT(FALSE); - return FALSE; + + TtEndpoint->CalcBusTime = 0; + DPRINT("USB2_DeallocateEndpointBudget: return TRUE\n"); + return TRUE; } BOOLEAN
7 years
1
0
0
0
51/77: [USBPORT] Add USB2_CommonFrames().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3031695100f018ffb6f64…
commit 3031695100f018ffb6f648fc0fda0a85bf5e42d1 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Mon Dec 11 18:01:07 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:52 2018 +0100 [USBPORT] Add USB2_CommonFrames(). --- drivers/usb/usbport/usb2.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index ade65b4357..0e305b4d11 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -711,6 +711,33 @@ USB2_MoveTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, return TRUE; } +BOOLEAN +NTAPI +USB2_CommonFrames(IN PUSB2_TT_ENDPOINT NextTtEndpoint, + IN PUSB2_TT_ENDPOINT TtEndpoint) +{ + UCHAR Frame; + + DPRINT("USB2_CommonFrames: \n"); + + if (NextTtEndpoint->ActualPeriod == ENDPOINT_INTERRUPT_1ms || + TtEndpoint->ActualPeriod == ENDPOINT_INTERRUPT_1ms) + { + return TRUE; + } + + if (NextTtEndpoint->ActualPeriod < TtEndpoint->ActualPeriod) + { + Frame = TtEndpoint->StartFrame % TtEndpoint->ActualPeriod; + } + else + { + Frame = NextTtEndpoint->StartFrame % TtEndpoint->ActualPeriod; + } + + return (Frame == TtEndpoint->StartFrame); +} + VOID NTAPI USB2_ConvertFrame(IN UCHAR Frame,
7 years
1
0
0
0
50/77: [USBPORT] Implement USB2_MoveTtEndpoint().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ae800da85bd34ad2ce6b1…
commit ae800da85bd34ad2ce6b19cb049090f95e1787bc Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Mon Dec 11 16:24:26 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:52 2018 +0100 [USBPORT] Implement USB2_MoveTtEndpoint(). --- drivers/usb/usbport/usb2.c | 78 +++++++++++++++++++++++++++++++++++++++++-- drivers/usb/usbport/usbport.h | 2 +- 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 14512d771d..ade65b4357 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -634,9 +634,81 @@ USB2_MoveTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, IN ULONG RebalanceListEntries, OUT BOOLEAN * OutResult) { - DPRINT("USB2_MoveTtEndpoint: UNIMPLEMENTED FIXME\n"); - ASSERT(FALSE); - return FALSE; + ULONG EndBusTime; + ULONG TransferType; + ULONG Num; + UCHAR ix; + + DPRINT("USB2_MoveTtEndpoint: TtEndpoint - %p, BusTime - %X\n", + TtEndpoint, + BusTime); + + *OutResult = TRUE; + + for (Num = 0; Rebalance->RebalanceEndpoint[Num]; Num++) + { + if (Rebalance->RebalanceEndpoint[Num] == TtEndpoint) + break; + } + + DPRINT("USB2_MoveTtEndpoint: Num - %X\n", Num); + + TransferType = TtEndpoint->TtEndpointParams.TransferType; + + if (Rebalance->RebalanceEndpoint[Num] && + TtEndpoint->TtEndpointParams.EndpointMoved == TRUE && + (TransferType != USBPORT_TRANSFER_TYPE_INTERRUPT || BusTime >= 0)) + { + DPRINT("USB2_MoveTtEndpoint: result - FALSE\n"); + return FALSE; + } + + for (ix = 0; + (TtEndpoint->StartFrame + ix) < USB2_FRAMES; + ix += TtEndpoint->ActualPeriod) + { + USB2_DeallocateHS(TtEndpoint, ix); + } + + TtEndpoint->StartTime += BusTime; + + EndBusTime = TtEndpoint->StartTime + TtEndpoint->CalcBusTime; + + if (EndBusTime > USB2_FS_MAX_PERIODIC_ALLOCATION) + { + DPRINT("USB2_MoveTtEndpoint: EndBusTime is too large!\n"); + *OutResult = FALSE; + } + + TtEndpoint->TtEndpointParams.EndpointMoved = TRUE; + + if (Rebalance->RebalanceEndpoint[Num] == NULL) + { + if (Num >= RebalanceListEntries) + { + DPRINT("USB2_MoveTtEndpoint: Too many changes!\n"); + *OutResult = FALSE; + } + else + { + Rebalance->RebalanceEndpoint[Num] = TtEndpoint; + Rebalance->RebalanceEndpoint[Num + 1] = NULL; + } + } + + for (ix = 0; + (TtEndpoint->StartFrame + ix) < USB2_FRAMES; + ix += TtEndpoint->ActualPeriod) + { + if (!USB2_AllocateHS(TtEndpoint, ix)) + { + DPRINT("USB2_MoveTtEndpoint: OutResult - FALSE\n"); + OutResult = FALSE; + } + } + + DPRINT("USB2_MoveTtEndpoint: result - TRUE\n"); + return TRUE; } VOID diff --git a/drivers/usb/usbport/usbport.h b/drivers/usb/usbport/usbport.h index 8df658b12d..b98ac15e00 100644 --- a/drivers/usb/usbport/usbport.h +++ b/drivers/usb/usbport/usbport.h @@ -483,7 +483,7 @@ typedef union _USB2_TT_ENDPOINT_PARAMS { ULONG TransferType : 4; ULONG Direction : 1; USB_DEVICE_SPEED DeviceSpeed : 2; - ULONG EndpointMoved : 1; + BOOL EndpointMoved : 1; ULONG Reserved : 24; }; ULONG AsULONG;
7 years
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200