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
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
----- 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
39/77: [USBPORT] Start implementation USB2_AllocateTimeForEndpoint().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7553e5419936d978b3f5e…
commit 7553e5419936d978b3f5ec3408feee067c48afb1 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Fri Dec 8 20:21:08 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:48 2018 +0100 [USBPORT] Start implementation USB2_AllocateTimeForEndpoint(). --- drivers/usb/usbport/usb2.c | 161 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 86e45a1adc..1811b541c0 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -491,6 +491,167 @@ USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, IN PUSB2_REBALANCE Rebalance, IN PULONG RebalanceListEntries) { + PUSB2_TT Tt; + PUSB2_HC_EXTENSION HcExtension; + ULONG Speed; + ULONG TimeUsed; + ULONG MinTimeUsed; + ULONG ix; + ULONG frame; + ULONG uframe; + ULONG Microframe; + ULONG TransferType; + ULONG Overhead; + BOOLEAN Result = TRUE; + + DPRINT("USB2_AllocateTimeForEndpoint: TtEndpoint - %p\n", TtEndpoint); + + Tt = TtEndpoint->Tt; + HcExtension = Tt->HcExtension; + + TtEndpoint->Nums.NumStarts = 0; + TtEndpoint->Nums.NumCompletes = 0; + + TtEndpoint->StartFrame = 0; + TtEndpoint->StartMicroframe = 0; + + if (TtEndpoint->CalcBusTime) + { + DPRINT("USB2_AllocateTimeForEndpoint: TtEndpoint already allocated!\n"); + return FALSE; + } + + Speed = TtEndpoint->TtEndpointParams.DeviceSpeed; + + if (Speed == UsbHighSpeed) + { + if (TtEndpoint->Period > USB2_MAX_MICROFRAMES) + TtEndpoint->ActualPeriod = USB2_MAX_MICROFRAMES; + else + TtEndpoint->ActualPeriod = TtEndpoint->Period; + + MinTimeUsed = HcExtension->TimeUsed[0][0]; + + for (ix = 1; ix < TtEndpoint->ActualPeriod; ix++) + { + frame = ix / USB2_MICROFRAMES; + uframe = ix % (USB2_MICROFRAMES - 1); + + TimeUsed = HcExtension->TimeUsed[frame][uframe]; + + if (TimeUsed < MinTimeUsed) + { + MinTimeUsed = TimeUsed; + TtEndpoint->StartFrame = frame; + TtEndpoint->StartMicroframe = uframe; + } + } + + TtEndpoint->CalcBusTime = USB2_GetOverhead(TtEndpoint) + + USB2_AddDataBitStuff(TtEndpoint->MaxPacketSize); + + DPRINT("USB2_AllocateTimeForEndpoint: StartFrame - %X, StartMicroframe - %X, CalcBusTime - %X\n", + TtEndpoint->StartFrame, + TtEndpoint->StartMicroframe, + TtEndpoint->CalcBusTime); + + Microframe = TtEndpoint->StartFrame * USB2_MICROFRAMES + + TtEndpoint->StartMicroframe; + + if (Microframe >= USB2_MAX_MICROFRAMES) + { + DPRINT("USB2_AllocateTimeForEndpoint: Microframe >= 256. Result - TRUE\n"); + return TRUE; + } + + for (ix = Microframe; + ix < USB2_MAX_MICROFRAMES; + ix += TtEndpoint->ActualPeriod) + { + frame = ix / USB2_MICROFRAMES; + uframe = ix % (USB2_MICROFRAMES - 1); + + DPRINT("USB2_AllocateTimeForEndpoint: frame - %X, uframe - %X, TimeUsed[f][uf] - %X\n", + frame, + uframe, + HcExtension->TimeUsed[frame][uframe]); + + if (!USB2_AllocateCheck(&HcExtension->TimeUsed[frame][uframe], + TtEndpoint->CalcBusTime, + USB2_MAX_MICROFRAME_ALLOCATION)) + { + DPRINT("USB2_AllocateTimeForEndpoint: Result = FALSE\n"); + Result = FALSE; + } + } + + if (!Result) + { + for (ix = Microframe; + ix < USB2_MAX_MICROFRAMES; + ix += TtEndpoint->ActualPeriod) + { + frame = ix / USB2_MICROFRAMES; + uframe = ix % (USB2_MICROFRAMES - 1); + + HcExtension->TimeUsed[frame][uframe] -= TtEndpoint->CalcBusTime; + } + } + + DPRINT("USB2_AllocateTimeForEndpoint: Result - TRUE\n"); + return TRUE; + } + + /* Speed != UsbHighSpeed (FS/LS) */ + + if (TtEndpoint->Period > USB2_FRAMES) + TtEndpoint->ActualPeriod = USB2_FRAMES; + else + TtEndpoint->ActualPeriod = TtEndpoint->Period; + + MinTimeUsed = Tt->FrameBudget[0].TimeUsed; + + for (ix = 1; ix < TtEndpoint->ActualPeriod; ix++) + { + if ((Tt->FrameBudget[ix].TimeUsed) < MinTimeUsed) + { + MinTimeUsed = Tt->FrameBudget[ix].TimeUsed; + TtEndpoint->StartFrame = ix; + } + } + + TransferType = TtEndpoint->TtEndpointParams.TransferType; + + if (TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS) + { + if (Speed == UsbFullSpeed) + { + Overhead = USB2_FS_ISOCHRONOUS_OVERHEAD + Tt->DelayTime; + } + else + { + DPRINT("USB2_AllocateTimeForEndpoint: ISO can not be on a LS bus!\n"); + return FALSE; + } + } + else + { + if (Speed == UsbFullSpeed) + Overhead = USB2_FS_INTERRUPT_OVERHEAD + Tt->DelayTime; + else + Overhead = USB2_LS_INTERRUPT_OVERHEAD + Tt->DelayTime; + } + + if (Speed == UsbLowSpeed) + { + TtEndpoint->CalcBusTime = TtEndpoint->MaxPacketSize * 8 + Overhead; + } + else + { + TtEndpoint->CalcBusTime = TtEndpoint->MaxPacketSize + Overhead; + } + + DPRINT("USB2_AllocateTimeForEndpoint: UNIMPLEMENTED. FIXME\n"); ASSERT(FALSE); return FALSE;
6 years, 9 months
1
0
0
0
38/77: [USBPORT] Continue implementation USBPORT_AllocateBandwidthUSB2().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=65f8f961a3c0f59400808…
commit 65f8f961a3c0f59400808634596709e6fa501333 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Fri Dec 8 18:28:36 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:47 2018 +0100 [USBPORT] Continue implementation USBPORT_AllocateBandwidthUSB2(). --- drivers/usb/usbport/usb2.c | 78 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index a4a8745537..86e45a1adc 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -555,13 +555,19 @@ USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice, ULONG RebalanceListEntries; PUSB2_TT_ENDPOINT TtEndpoint; PUSB2_TT_ENDPOINT RebalanceTtEndpoint; - PUSB2_TT Tt; USB_DEVICE_SPEED DeviceSpeed; ULONG Period; - + ULONG AllocedBusTime; + ULONG EndpointBandwidth; + ULONG ScheduleOffset; + ULONG Factor; ULONG ix; + ULONG n; BOOLEAN Direction; + UCHAR SMask; + UCHAR CMask; + UCHAR ActualPeriod; BOOLEAN Result; DPRINT("USBPORT_AllocateBandwidthUSB2: FdoDevice - %p, Endpoint - %p\n", @@ -619,9 +625,10 @@ USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice, case UsbFullSpeed: { Tt = &TtExtension->Tt; + Period = USB2_FRAMES; - while (Period && Period > EndpointProperties->Period) + while (Period > 0 && Period > EndpointProperties->Period) { Period >>= 1; } @@ -633,18 +640,22 @@ USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice, case UsbHighSpeed: { Tt = &FdoExtension->Usb2Extension->HcTt; - Period = EndpointProperties->Period; if (EndpointProperties->Period > USB2_MAX_MICROFRAMES) Period = USB2_MAX_MICROFRAMES; + else + Period = EndpointProperties->Period; break; } default: { - DPRINT1("USBPORT_AllocateBandwidthUSB2: DeviceSpeed - %X!\n", DeviceSpeed); + DPRINT1("USBPORT_AllocateBandwidthUSB2: DeviceSpeed - %X!\n", + DeviceSpeed); + DbgBreakPoint(); + Tt = &TtExtension->Tt; break; } @@ -690,23 +701,66 @@ USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice, for (ix = 0; ix < RebalanceListEntries; ix++) { - DPRINT("USBPORT_AllocateBandwidthUSB2: RebalanceEndpoint[%X] - %X\n", - ix, - Rebalance->RebalanceEndpoint[ix]); - RebalanceTtEndpoint = Rebalance->RebalanceEndpoint[ix]; + DPRINT("USBPORT_AllocateBandwidthUSB2: RebalanceTtEndpoint[%X] - %p, RebalanceTtEndpoint - %p, RebalanceLink - %p\n", + ix, + RebalanceTtEndpoint, + &RebalanceTtEndpoint->Endpoint->RebalanceLink); + InsertTailList(&RebalanceList, &RebalanceTtEndpoint->Endpoint->RebalanceLink); } if (Rebalance) - ExFreePool(Rebalance); + ExFreePoolWithTag(Rebalance, USB_PORT_TAG); if (Result) { - DPRINT1("USBPORT_AllocateBandwidthUSB2: UNIMPLEMENTED. FIXME. \n"); - ASSERT(FALSE); + SMask = USB2_GetSMASK(Endpoint->TtEndpoint); + EndpointProperties->InterruptScheduleMask = SMask; + + CMask = USB2_GetCMASK(Endpoint->TtEndpoint); + EndpointProperties->SplitCompletionMask = CMask; + + AllocedBusTime = TtEndpoint->CalcBusTime; + + EndpointBandwidth = USB2_MICROFRAMES * AllocedBusTime; + EndpointProperties->UsbBandwidth = EndpointBandwidth; + + ActualPeriod = Endpoint->TtEndpoint->ActualPeriod; + EndpointProperties->Period = ActualPeriod; + + ScheduleOffset = Endpoint->TtEndpoint->StartFrame; + EndpointProperties->ScheduleOffset = ScheduleOffset; + + Factor = USB2_FRAMES / ActualPeriod; + ASSERT(Factor); + + n = ScheduleOffset * Factor; + + if (TtExtension) + { + for (ix = 0; ix < Factor; ix++) + { + TtExtension->Bandwidth[n + ix] -= EndpointBandwidth; + } + } + else + { + for (ix = 1; ix < Factor; ix++) + { + FdoExtension->Bandwidth[n + ix] -= EndpointBandwidth; + } + } + + USBPORT_DumpingEndpointProperties(EndpointProperties); + USBPORT_DumpingTtEndpoint(Endpoint->TtEndpoint); + + if (AllocedBusTime >= (USB2_FS_MAX_PERIODIC_ALLOCATION / 2)) + { + DPRINT1("USBPORT_AllocateBandwidthUSB2: AllocedBusTime >= 0.5 * MAX_ALLOCATION \n"); + } } //USB2_Rebalance(FdoDevice, &RebalanceList);
6 years, 9 months
1
0
0
0
37/77: [USBPORT] Use ExFreePoolWithTag() instead ExFreePool() for TtExtension. Add debug info.
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=67138e7d547469b6ac127…
commit 67138e7d547469b6ac127626ab975a47e6186833 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Fri Dec 8 18:19:55 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:47 2018 +0100 [USBPORT] Use ExFreePoolWithTag() instead ExFreePool() for TtExtension. Add debug info. --- drivers/usb/usbport/device.c | 5 +++-- drivers/usb/usbport/endpoint.c | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/usb/usbport/device.c b/drivers/usb/usbport/device.c index 7ea2fda5ca..43ec4a58dc 100644 --- a/drivers/usb/usbport/device.c +++ b/drivers/usb/usbport/device.c @@ -7,7 +7,7 @@ #include "usbport.h" -#define NDEBUG +//#define NDEBUG #include <debug.h> NTSTATUS @@ -1654,7 +1654,8 @@ USBPORT_RemoveDevice(IN PDEVICE_OBJECT FdoDevice, FdoExtension->Bandwidth[ix] += TtExtension->MaxBandwidth; } - ExFreePool(TtExtension); + DPRINT("USBPORT_RemoveDevice: ExFreePoolWithTag TtExtension - %p\n", TtExtension); + ExFreePoolWithTag(TtExtension, USB_PORT_TAG); } KeReleaseSpinLock(&FdoExtension->TtSpinLock, OldIrql); diff --git a/drivers/usb/usbport/endpoint.c b/drivers/usb/usbport/endpoint.c index 8633d9be8f..8bf9ca9cf7 100644 --- a/drivers/usb/usbport/endpoint.c +++ b/drivers/usb/usbport/endpoint.c @@ -504,7 +504,7 @@ USBPORT_DeleteEndpoint(IN PDEVICE_OBJECT FdoDevice, BOOLEAN Result; KIRQL OldIrql; - DPRINT("USBPORT_DeleteEndpoint: Endpoint - %p\n", Endpoint); + DPRINT1("USBPORT_DeleteEndpoint: Endpoint - %p\n", Endpoint); FdoExtension = FdoDevice->DeviceExtension; @@ -602,7 +602,7 @@ USBPORT_ClosePipe(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, BOOLEAN IsReady; KIRQL OldIrql; - DPRINT("USBPORT_ClosePipe \n"); + DPRINT1("USBPORT_ClosePipe \n"); FdoExtension = FdoDevice->DeviceExtension; @@ -679,6 +679,7 @@ USBPORT_ClosePipe(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, KeAcquireSpinLock(&FdoExtension->TtSpinLock, &OldIrql); TtExtension = Endpoint->TtExtension; + DPRINT1("USBPORT_ClosePipe: TtExtension - %p\n", TtExtension); if (TtExtension) { @@ -698,7 +699,8 @@ USBPORT_ClosePipe(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, FdoExtension->Bandwidth[ix] += TtExtension->MaxBandwidth; } - ExFreePool(TtExtension); + DPRINT1("USBPORT_ClosePipe: ExFreePoolWithTag TtExtension - %p\n", TtExtension); + ExFreePoolWithTag(TtExtension, USB_PORT_TAG); } } } @@ -785,7 +787,7 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice, USHORT AdditionalTransaction; BOOLEAN IsAllocatedBandwidth; - DPRINT("USBPORT_OpenPipe: DeviceHandle - %p, FdoDevice - %p, PipeHandle - %p\n", + DPRINT1("USBPORT_OpenPipe: DeviceHandle - %p, FdoDevice - %p, PipeHandle - %p\n", DeviceHandle, FdoDevice, PipeHandle); @@ -1172,7 +1174,7 @@ USBPORT_ReopenPipe(IN PDEVICE_OBJECT FdoDevice, KIRQL MiniportOldIrql; NTSTATUS Status; - DPRINT("USBPORT_ReopenPipe ... \n"); + DPRINT1("USBPORT_ReopenPipe ... \n"); FdoExtension = FdoDevice->DeviceExtension; Packet = &FdoExtension->MiniPortInterface->Packet;
6 years, 9 months
1
0
0
0
36/77: [USBPORT] Add USBPORT_DumpingEndpointProperties() and USBPORT_DumpingTtEndpoint().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3bda39fcb84c7bd731b12…
commit 3bda39fcb84c7bd731b12937695a658849490559 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Fri Dec 8 18:16:49 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:47 2018 +0100 [USBPORT] Add USBPORT_DumpingEndpointProperties() and USBPORT_DumpingTtEndpoint(). --- drivers/usb/usbport/debug.c | 37 +++++++++++++++++++++++++++++++++++++ drivers/usb/usbport/usbdebug.h | 19 +++++++++++++++++++ drivers/usb/usbport/usbport.h | 10 ++++++++++ 3 files changed, 66 insertions(+) diff --git a/drivers/usb/usbport/debug.c b/drivers/usb/usbport/debug.c index 67ca9f6f98..1d2662d5e3 100644 --- a/drivers/usb/usbport/debug.c +++ b/drivers/usb/usbport/debug.c @@ -12,6 +12,7 @@ #define NDEBUG_USBPORT_MINIPORT #define NDEBUG_USBPORT_URB +//#define NDEBUG_USBPORT_USB2 #include "usbdebug.h" ULONG @@ -275,3 +276,39 @@ USBPORT_DumpingIDs(IN PVOID Buffer) DPRINT("\n"); } +VOID +NTAPI +USBPORT_DumpingEndpointProperties(IN PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties) +{ + DPRINT_USB2("DeviceAddress - %X\n", EndpointProperties->DeviceAddress); + DPRINT_USB2("EndpointAddress - %X\n", EndpointProperties->EndpointAddress); + DPRINT_USB2("TotalMaxPacketSize - %X\n", EndpointProperties->TotalMaxPacketSize); + DPRINT_USB2("Period - %X\n", EndpointProperties->Period); + DPRINT_USB2("DeviceSpeed - %X\n", EndpointProperties->DeviceSpeed); + DPRINT_USB2("UsbBandwidth - %X\n", EndpointProperties->UsbBandwidth); + DPRINT_USB2("ScheduleOffset - %X\n", EndpointProperties->ScheduleOffset); + DPRINT_USB2("TransferType - %X\n", EndpointProperties->TransferType); + DPRINT_USB2("MaxTransferSize - %X\n", EndpointProperties->MaxTransferSize); + DPRINT_USB2("HubAddr - %X\n", EndpointProperties->HubAddr); + DPRINT_USB2("PortNumber - %X\n", EndpointProperties->PortNumber); + DPRINT_USB2("InterruptScheduleMask - %X\n", EndpointProperties->InterruptScheduleMask); + DPRINT_USB2("SplitCompletionMask - %X\n", EndpointProperties->SplitCompletionMask); + DPRINT_USB2("MaxPacketSize - %X\n", EndpointProperties->MaxPacketSize); +} + +VOID +NTAPI +USBPORT_DumpingTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint) +{ + DPRINT_USB2("MaxPacketSize - %X\n", TtEndpoint->MaxPacketSize); + DPRINT_USB2("Period - %X\n", TtEndpoint->Period); + DPRINT_USB2("TtEndpointParams- %X\n", TtEndpoint->TtEndpointParams.AsULONG); + DPRINT_USB2("CalcBusTime - %X\n", TtEndpoint->CalcBusTime); + DPRINT_USB2("StartTime - %X\n", TtEndpoint->StartTime); + DPRINT_USB2("ActualPeriod - %X\n", TtEndpoint->ActualPeriod); + DPRINT_USB2("StartFrame - %X\n", TtEndpoint->StartFrame); + DPRINT_USB2("StartMicroframe - %X\n", TtEndpoint->StartMicroframe); + DPRINT_USB2("Nums - %X\n", TtEndpoint->Nums.AsULONG); + DPRINT_USB2("nextTtEndpoint - %X\n", TtEndpoint->NextTtEndpoint); +} + diff --git a/drivers/usb/usbport/usbdebug.h b/drivers/usb/usbport/usbdebug.h index 98484f64f3..53e65b25db 100644 --- a/drivers/usb/usbport/usbdebug.h +++ b/drivers/usb/usbport/usbdebug.h @@ -112,6 +112,23 @@ #endif + #ifndef NDEBUG_USBPORT_USB2 + + #define DPRINT_USB2(fmt, ...) do { \ + if (DbgPrint("(%s:%d) " fmt, __RELFILE__, __LINE__, ##__VA_ARGS__)) \ + DbgPrint("(%s:%d) DbgPrint() failed!\n", __RELFILE__, __LINE__); \ + } while (0) + + #else + +#if defined(_MSC_VER) + #define DPRINT_USB2 __noop +#else + #define DPRINT_USB2(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) +#endif + + #endif + #else /* not DBG */ #if defined(_MSC_VER) @@ -121,6 +138,7 @@ #define DPRINT_INT __noop #define DPRINT_TIMER __noop #define DPRINT_QUEUE __noop + #define DPRINT_USB2 __noop #else #define DPRINT_MINIPORT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) #define DPRINT_CORE(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) @@ -128,6 +146,7 @@ #define DPRINT_INT(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) #define DPRINT_TIMER(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) #define DPRINT_QUEUE(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) + #define DPRINT_USB2(...) do { if(0) { DbgPrint(__VA_ARGS__); } } while(0) #endif /* _MSC_VER */ #endif /* not DBG */ diff --git a/drivers/usb/usbport/usbport.h b/drivers/usb/usbport/usbport.h index 88277167c4..8df658b12d 100644 --- a/drivers/usb/usbport/usbport.h +++ b/drivers/usb/usbport/usbport.h @@ -1335,4 +1335,14 @@ NTAPI USB2_InitController( IN PUSB2_HC_EXTENSION HcExtension); +VOID +NTAPI +USBPORT_DumpingEndpointProperties( + IN PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties); + +VOID +NTAPI +USBPORT_DumpingTtEndpoint( + IN PUSB2_TT_ENDPOINT TtEndpoint); + #endif /* USBPORT_H__ */
6 years, 9 months
1
0
0
0
35/77: [USBPORT] Implement USB2_AllocateHS().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=698f092ab17c33051f162…
commit 698f092ab17c33051f162ff3f2ac4468efad99d9 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Tue Dec 5 18:13:37 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:46 2018 +0100 [USBPORT] Implement USB2_AllocateHS(). --- drivers/usb/usbport/usb2.c | 173 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 170 insertions(+), 3 deletions(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 0ca831befe..a4a8745537 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -300,10 +300,177 @@ USB2_InitTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, BOOLEAN NTAPI USB2_AllocateHS(IN PUSB2_TT_ENDPOINT TtEndpoint, - IN ULONG Frame) + IN LONG Frame) { - DPRINT("USB2_AllocateHS: UNIMPLEMENTED FIXME\n"); - return FALSE; + PUSB2_HC_EXTENSION HcExtension; + PUSB2_TT Tt; + ULONG TransferType; + ULONG Direction; + ULONG DataTime; + ULONG RemainDataTime; + ULONG OverheadCS; + ULONG OverheadSS; + ULONG ix; + USHORT PktSize; + UCHAR frame; + UCHAR uframe; + BOOL Result = TRUE; + + DPRINT("USB2_AllocateHS: TtEndpoint - %p, Frame - %X, TtEndpoint->StartFrame - %X\n", + TtEndpoint, + Frame, + TtEndpoint->StartFrame); + + Tt = TtEndpoint->Tt; + HcExtension = Tt->HcExtension; + + TransferType = TtEndpoint->TtEndpointParams.TransferType; + Direction = TtEndpoint->TtEndpointParams.Direction; + + if (Frame == 0) + { + TtEndpoint->StartMicroframe = + TtEndpoint->StartTime / USB2_FS_RAW_BYTES_IN_MICROFRAME - 1; + + DPRINT("USB2_AllocateHS: TtEndpoint->StartMicroframe - %X\n", + TtEndpoint->StartMicroframe); + } + + USB2_GetHsOverhead(TtEndpoint, &OverheadSS, &OverheadCS); + + if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT) + { + if (Frame == 0) + { + TtEndpoint->Nums.NumStarts = 1; + + if ((CHAR)TtEndpoint->StartMicroframe < 5) + { + TtEndpoint->Nums.NumCompletes = 3; + } + else + { + TtEndpoint->Nums.NumCompletes = 2; + } + } + } + else + { + if (Direction == USBPORT_TRANSFER_DIRECTION_OUT) + { + DPRINT("USB2_AllocateHS: ISO UNIMPLEMENTED\n"); + ASSERT(FALSE); + } + else + { + DPRINT("USB2_AllocateHS: ISO UNIMPLEMENTED\n"); + ASSERT(FALSE); + } + } + + frame = TtEndpoint->StartFrame + Frame; + uframe = TtEndpoint->StartMicroframe; + + if (TtEndpoint->StartMicroframe == 0xFF) + USB2_GetPrevMicroFrame(&frame, &uframe); + + for (ix = 0; ix < TtEndpoint->Nums.NumStarts; ix++) + { + if (!USB2_AllocateCheck(&HcExtension->TimeUsed[frame][uframe], + OverheadSS, + USB2_MAX_MICROFRAME_ALLOCATION)) + { + Result = FALSE; + } + + if (Tt->NumStartSplits[frame][uframe] > (USB2_MAX_FS_LS_TRANSACTIONS_IN_UFRAME - 1)) + { + DPRINT1("USB2_AllocateHS: Num Start Splits - %X\n", + Tt->NumStartSplits[frame][uframe] + 1); + + ASSERT(FALSE); + Result = FALSE; + } + + ++Tt->NumStartSplits[frame][uframe]; + USB2_IncMicroFrame(&frame, &uframe); + } + + frame = TtEndpoint->StartFrame + Frame; + uframe = TtEndpoint->StartMicroframe + TtEndpoint->Nums.NumStarts + 1; + + for (ix = 0; ix < TtEndpoint->Nums.NumCompletes; ix++) + { + if (!USB2_AllocateCheck(&HcExtension->TimeUsed[frame][uframe], + OverheadCS, + USB2_MAX_MICROFRAME_ALLOCATION)) + { + Result = FALSE; + } + + USB2_IncMicroFrame(&frame, &uframe); + } + + if (Direction == USBPORT_TRANSFER_DIRECTION_OUT) + { + DPRINT("USB2_AllocateHS: DIRECTION OUT UNIMPLEMENTED\n"); + ASSERT(FALSE); + } + else + { + frame = TtEndpoint->StartFrame + Frame; + uframe = TtEndpoint->StartMicroframe + TtEndpoint->Nums.NumStarts + 1; + + for (ix = 0; ix < TtEndpoint->Nums.NumCompletes; ix++) + { + if (Tt->TimeCS[frame][uframe] < USB2_FS_RAW_BYTES_IN_MICROFRAME) + { + if (Tt->TimeCS[frame][uframe] < USB2_FS_RAW_BYTES_IN_MICROFRAME) + { + RemainDataTime = USB2_FS_RAW_BYTES_IN_MICROFRAME - + Tt->TimeCS[frame][uframe]; + } + else + { + RemainDataTime = 0; + } + + PktSize = TtEndpoint->MaxPacketSize; + + if (RemainDataTime >= USB2_AddDataBitStuff(PktSize)) + { + DataTime = USB2_AddDataBitStuff(PktSize); + } + else + { + DataTime = RemainDataTime; + } + + if (!USB2_AllocateCheck(&HcExtension->TimeUsed[frame][uframe], + DataTime, + USB2_MAX_MICROFRAME_ALLOCATION)) + { + Result = FALSE; + } + } + + PktSize = TtEndpoint->MaxPacketSize; + + if (USB2_AddDataBitStuff(PktSize) < USB2_FS_RAW_BYTES_IN_MICROFRAME) + { + Tt->TimeCS[frame][uframe] += USB2_AddDataBitStuff(PktSize); + } + else + { + Tt->TimeCS[frame][uframe] += USB2_FS_RAW_BYTES_IN_MICROFRAME; + } + + USB2_IncMicroFrame(&frame, &uframe); + } + } + + DPRINT("USB2_AllocateHS: Result - %X\n", Result); + return Result; } BOOLEAN
6 years, 9 months
1
0
0
0
34/77: [USBPORT] Add USB2_GetHsOverhead().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=720d7cfd9b95b20f8cb1b…
commit 720d7cfd9b95b20f8cb1bb534a4c4160a4457266 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Tue Dec 5 16:56:07 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:46 2018 +0100 [USBPORT] Add USB2_GetHsOverhead(). --- drivers/usb/usbport/usb2.c | 47 +++++++++++++++++++++++++++++++++++++++++++ drivers/usb/usbport/usbport.h | 9 +++++++++ 2 files changed, 56 insertions(+) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index a91650ebdd..0ca831befe 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -159,6 +159,53 @@ USB2_GetOverhead(IN PUSB2_TT_ENDPOINT TtEndpoint) return Overhead; } +VOID +NTAPI +USB2_GetHsOverhead(IN PUSB2_TT_ENDPOINT TtEndpoint, + IN PULONG OverheadSS, + IN PULONG OverheadCS) +{ + ULONG TransferType; + ULONG Direction; + ULONG HostDelay; + + TransferType = TtEndpoint->TtEndpointParams.TransferType; + Direction = TtEndpoint->TtEndpointParams.Direction; + + HostDelay = TtEndpoint->Tt->HcExtension->HcDelayTime; + + if (Direction == USBPORT_TRANSFER_DIRECTION_OUT) + { + if (TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS) + { + *OverheadSS = HostDelay + USB2_HS_SS_ISOCHRONOUS_OUT_OVERHEAD; + *OverheadCS = 0; + } + else + { + *OverheadSS = HostDelay + USB2_HS_SS_INTERRUPT_OUT_OVERHEAD; + *OverheadCS = HostDelay + USB2_HS_CS_INTERRUPT_OUT_OVERHEAD; + } + } + else + { + if (TransferType == USBPORT_TRANSFER_TYPE_ISOCHRONOUS) + { + *OverheadSS = HostDelay + USB2_HS_SS_ISOCHRONOUS_IN_OVERHEAD; + *OverheadCS = HostDelay + USB2_HS_CS_ISOCHRONOUS_IN_OVERHEAD; + } + else + { + *OverheadSS = HostDelay + USB2_HS_SS_INTERRUPT_IN_OVERHEAD; + *OverheadCS = HostDelay + USB2_HS_CS_INTERRUPT_IN_OVERHEAD; + } + + DPRINT("USB2_GetHsOverhead: *OverheadSS - %X, *OverheadCS - %X\n", + *OverheadSS, + *OverheadCS); + } +} + ULONG NTAPI USB2_GetLastIsoTime(IN PUSB2_TT_ENDPOINT TtEndpoint, diff --git a/drivers/usb/usbport/usbport.h b/drivers/usb/usbport/usbport.h index bb68680216..88277167c4 100644 --- a/drivers/usb/usbport/usbport.h +++ b/drivers/usb/usbport/usbport.h @@ -469,6 +469,15 @@ typedef struct _TIMER_WORK_QUEUE_ITEM { #define USB2_HS_ISOCHRONOUS_OUT_OVERHEAD 38 #define USB2_HS_ISOCHRONOUS_IN_OVERHEAD 18 +#define USB2_HS_SS_INTERRUPT_OUT_OVERHEAD 58 +#define USB2_HS_CS_INTERRUPT_OUT_OVERHEAD 36 +#define USB2_HS_SS_INTERRUPT_IN_OVERHEAD 39 +#define USB2_HS_CS_INTERRUPT_IN_OVERHEAD 38 + +#define USB2_HS_SS_ISOCHRONOUS_OUT_OVERHEAD 58 +#define USB2_HS_SS_ISOCHRONOUS_IN_OVERHEAD 39 +#define USB2_HS_CS_ISOCHRONOUS_IN_OVERHEAD 38 + typedef union _USB2_TT_ENDPOINT_PARAMS { struct { ULONG TransferType : 4;
6 years, 9 months
1
0
0
0
33/77: [USBPORT] Reduces output of debug messages.
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2d4bd7b74449bb5af1f82…
commit 2d4bd7b74449bb5af1f82551ec31985aae9825b2 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Sun Dec 3 14:06:06 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:46 2018 +0100 [USBPORT] Reduces output of debug messages. --- drivers/usb/usbport/ioctl.c | 8 ++++---- drivers/usb/usbport/trfsplit.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/usbport/ioctl.c b/drivers/usb/usbport/ioctl.c index 7322958889..6502c6549a 100644 --- a/drivers/usb/usbport/ioctl.c +++ b/drivers/usb/usbport/ioctl.c @@ -326,10 +326,10 @@ USBPORT_PdoInternalDeviceControl(IN PDEVICE_OBJECT PdoDevice, IoStack = IoGetCurrentIrpStackLocation(Irp); IoCtl = IoStack->Parameters.DeviceIoControl.IoControlCode; - DPRINT("USBPORT_PdoInternalDeviceControl: PdoDevice - %p, Irp - %p, IoCtl - %x\n", - PdoDevice, - Irp, - IoCtl); + //DPRINT("USBPORT_PdoInternalDeviceControl: PdoDevice - %p, Irp - %p, IoCtl - %x\n", + // PdoDevice, + // Irp, + // IoCtl); if (IoCtl == IOCTL_INTERNAL_USB_SUBMIT_URB) { diff --git a/drivers/usb/usbport/trfsplit.c b/drivers/usb/usbport/trfsplit.c index 1964e8d2dd..bc1efe34e2 100644 --- a/drivers/usb/usbport/trfsplit.c +++ b/drivers/usb/usbport/trfsplit.c @@ -148,8 +148,8 @@ USBPORT_SplitBulkInterruptTransfer(IN PDEVICE_OBJECT FdoDevice, InitializeListHead(&tmplist); - DPRINT1("USBPORT_SplitBulkInterruptTransfer: TransferBufferLength - %x, NeedSplits - %x\n", - TransferBufferLength, NeedSplits); + DPRINT("USBPORT_SplitBulkInterruptTransfer: TransferBufferLength - %x, NeedSplits - %x\n", + TransferBufferLength, NeedSplits); if (!NeedSplits) { @@ -214,7 +214,7 @@ Exit: while (!IsListEmpty(&tmplist)) { - DPRINT1("USBPORT_SplitBulkInterruptTransfer: ... \n"); + DPRINT("USBPORT_SplitBulkInterruptTransfer: ... \n"); SplitTransfer = CONTAINING_RECORD(tmplist.Flink, USBPORT_TRANSFER,
6 years, 9 months
1
0
0
0
32/77: [USBPORT] Remove unnecessary semicolon.
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=816b3a572c67922a6fa64…
commit 816b3a572c67922a6fa6428dda2a487b578d2046 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Sun Dec 3 13:59:59 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:45 2018 +0100 [USBPORT] Remove unnecessary semicolon. --- drivers/usb/usbport/usb2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 5e0ace37c6..a91650ebdd 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -407,7 +407,7 @@ USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice, Tt = &TtExtension->Tt; Period = USB2_FRAMES; - while (Period && Period > EndpointProperties->Period); + while (Period && Period > EndpointProperties->Period) { Period >>= 1; }
6 years, 9 months
1
0
0
0
31/77: [USBPORT] Add stubs for USB2_AllocateHS() and USB2_DeallocateEndpointBudget().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5654674e8c711e02a6092…
commit 5654674e8c711e02a60922007ec3954c4eca94e4 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Fri Dec 1 10:18:50 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:45 2018 +0100 [USBPORT] Add stubs for USB2_AllocateHS() and USB2_DeallocateEndpointBudget(). --- 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 a3c0d1449d..5e0ace37c6 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -250,6 +250,27 @@ USB2_InitTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, TtEndpoint->Tt = Tt; } +BOOLEAN +NTAPI +USB2_AllocateHS(IN PUSB2_TT_ENDPOINT TtEndpoint, + IN ULONG Frame) +{ + DPRINT("USB2_AllocateHS: UNIMPLEMENTED FIXME\n"); + return FALSE; +} + +BOOLEAN +NTAPI +USB2_DeallocateEndpointBudget(IN PUSB2_TT_ENDPOINT TtEndpoint, + IN PUSB2_REBALANCE Rebalance, + IN PULONG RebalanceListEntries, + IN ULONG MaxFrames) +{ + DPRINT("USB2_DeallocateEndpointBudget: UNIMPLEMENTED FIXME\n"); + ASSERT(FALSE); + return FALSE; +} + BOOLEAN NTAPI USB2_AllocateTimeForEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint,
6 years, 9 months
1
0
0
0
30/77: [USBPORT] Add USB2_GetPrevMicroFrame().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e39b88e3e79f832ba4d52…
commit e39b88e3e79f832ba4d52b3f4766772e148c8679 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Fri Dec 1 10:16:24 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:45 2018 +0100 [USBPORT] Add USB2_GetPrevMicroFrame(). --- drivers/usb/usbport/usb2.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index d8d5da9af1..a3c0d1449d 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -52,6 +52,19 @@ USB2_IncMicroFrame(OUT PUCHAR frame, } } +VOID +NTAPI +USB2_GetPrevMicroFrame(OUT PUCHAR frame, + OUT PUCHAR uframe) +{ + *uframe = USB2_MICROFRAMES - 1; + + if (*frame) + --*frame; + else + *frame = USB2_FRAMES - 1; +} + BOOLEAN NTAPI USB2_CheckTtEndpointInsert(IN PUSB2_TT_ENDPOINT nextTtEndpoint,
6 years, 9 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
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