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
April 2011
----- 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
19 participants
296 discussions
Start a n
N
ew thread
[rharabien] 51373: [CMAKE/RAPPS] * Inform compiler about encoding in resource files using pragma. No pragmas caused problem because *.mc parser in cmake branch inserts pragma in its output files, w...
by rharabien@svn.reactos.org
Author: rharabien Date: Sun Apr 17 09:31:31 2011 New Revision: 51373 URL:
http://svn.reactos.org/svn/reactos?rev=51373&view=rev
Log: [CMAKE/RAPPS] * Inform compiler about encoding in resource files using pragma. No pragmas caused problem because *.mc parser in cmake branch inserts pragma in its output files, which was included before other rc files * Change RC files encoding to UTF-8 (without BOM) * Fixes broken non-latin characters in rapps Modified: branches/cmake-bringup/base/applications/rapps/lang/bg-BG.rc branches/cmake-bringup/base/applications/rapps/lang/cs-CZ.rc branches/cmake-bringup/base/applications/rapps/lang/de-DE.rc branches/cmake-bringup/base/applications/rapps/lang/en-US.rc branches/cmake-bringup/base/applications/rapps/lang/es-ES.rc branches/cmake-bringup/base/applications/rapps/lang/fr-FR.rc branches/cmake-bringup/base/applications/rapps/lang/it-IT.rc branches/cmake-bringup/base/applications/rapps/lang/ja-JP.rc branches/cmake-bringup/base/applications/rapps/lang/no-NO.rc branches/cmake-bringup/base/applications/rapps/lang/pl-PL.rc branches/cmake-bringup/base/applications/rapps/lang/ru-RU.rc branches/cmake-bringup/base/applications/rapps/lang/sk-SK.rc branches/cmake-bringup/base/applications/rapps/lang/sv-SE.rc branches/cmake-bringup/base/applications/rapps/lang/uk-UA.rc [This mail would be too long, it was shortened to contain the URLs only.] Modified: branches/cmake-bringup/base/applications/rapps/lang/bg-BG.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/cs-CZ.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/de-DE.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/en-US.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/es-ES.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/fr-FR.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/it-IT.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/ja-JP.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/no-NO.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/pl-PL.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/ru-RU.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/sk-SK.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/sv-SE.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
Modified: branches/cmake-bringup/base/applications/rapps/lang/uk-UA.rc URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/base/applications…
13 years, 8 months
1
0
0
0
[janderwald] 51372: [USBEHCI_NEW] - Fix bug in CDMAMemoryManager initialization, which calculated the bitmap length wrong - Create interface IUSBDevice, which will be used to abstract connected usb...
by janderwald@svn.reactos.org
Author: janderwald Date: Sun Apr 17 08:20:40 2011 New Revision: 51372 URL:
http://svn.reactos.org/svn/reactos?rev=51372&view=rev
Log: [USBEHCI_NEW] - Fix bug in CDMAMemoryManager initialization, which calculated the bitmap length wrong - Create interface IUSBDevice, which will be used to abstract connected usb devices - Implement support functions for the device interface. - Implement USBHI_CreateUsbDevice, USBHI_InitializeUsbDevice, USBHI_GetUsbDescriptors, USBHI_RemoveUsbDevice, USBHI_GetExtendedHubInformation, USBHI_RootHubInitNotification, USBHI_SetDeviceHandleData, USBDI_GetUSBDIVersion, USBDI_IsDeviceHighSpeed - Partly implement USBHI_QueryDeviceInformation - Based on mjmartin usbehci Added: branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp (with props) Modified: branches/usb-bringup/drivers/usb/usbehci_new/CMakeLists.txt branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h branches/usb-bringup/drivers/usb/usbehci_new/memory_manager.cpp branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h Modified: branches/usb-bringup/drivers/usb/usbehci_new/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/CMakeLists.txt [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/CMakeLists.txt [iso-8859-1] Sun Apr 17 08:20:40 2011 @@ -6,6 +6,7 @@ add_library(usbehci SHARED usbehci.cpp + usb_device.cpp hcd_controller.cpp hardware.cpp misc.cpp Modified: branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp [iso-8859-1] Sun Apr 17 08:20:40 2011 @@ -47,6 +47,13 @@ NTSTATUS SetDeviceInterface(BOOLEAN bEnable); NTSTATUS CreatePDO(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT * OutDeviceObject); NTSTATUS GetHubControllerDeviceObject(PDEVICE_OBJECT * HubDeviceObject); + PUSBHARDWAREDEVICE GetUsbHardware(); + ULONG AcquireDeviceAddress(); + VOID ReleaseDeviceAddress(ULONG DeviceAddress); + BOOLEAN ValidateUsbDevice(PUSBDEVICE UsbDevice); + NTSTATUS AddUsbDevice(PUSBDEVICE UsbDevice); + NTSTATUS RemoveUsbDevice(PUSBDEVICE UsbDevice); + VOID SetNotification(PVOID CallbackContext, PRH_INIT_CALLBACK CallbackRoutine); // constructor / destructor CHubController(IUnknown *OuterUnknown){} @@ -63,7 +70,23 @@ UNICODE_STRING m_HubDeviceInterfaceString; PDEVICE_OBJECT m_HubControllerDeviceObject; PDRIVER_OBJECT m_DriverObject; + + PVOID m_HubCallbackContext; + PRH_INIT_CALLBACK m_HubCallbackRoutine; + + + KSPIN_LOCK m_Lock; + RTL_BITMAP m_DeviceAddressBitmap; + PULONG m_DeviceAddressBitmapBuffer; + LIST_ENTRY m_UsbDeviceList; }; + +typedef struct +{ + LIST_ENTRY Entry; + PUSBDEVICE Device; +}USBDEVICE_ENTRY, *PUSBDEVICE_ENTRY; + //---------------------------------------------------------------------------------------- NTSTATUS @@ -96,6 +119,26 @@ m_IsRootHubDevice = IsRootHubDevice; m_DeviceAddress = DeviceAddress; m_DriverObject = DriverObject; + KeInitializeSpinLock(&m_Lock); + + // + // allocate device address bitmap buffer + // + m_DeviceAddressBitmapBuffer = (PULONG)ExAllocatePoolWithTag(NonPagedPool, 16, TAG_USBEHCI); + if (!m_DeviceAddressBitmapBuffer) + { + // + // no memory + // + return STATUS_INSUFFICIENT_RESOURCES; + } + + // + // initialize device address bitmap + // + RtlInitializeBitMap(&m_DeviceAddressBitmap, m_DeviceAddressBitmapBuffer, 128); + RtlClearAllBits(&m_DeviceAddressBitmap); + // // create PDO @@ -197,9 +240,7 @@ // Status = m_Hardware->GetDeviceDetails(&VendorID, &DeviceID, &NumPorts, &HiSpeed); - HiSpeed = TRUE; - - if (HiSpeed) + if (HiSpeed == 0x200) { // // USB 2.0 hub @@ -261,8 +302,6 @@ // Status = m_Hardware->GetDeviceDetails(&VendorID, &DeviceID, &NumPorts, &HiSpeed); - HiSpeed = TRUE; - if (!NT_SUCCESS(Status)) { DPRINT1("CHubController::HandlePnp> failed to get hardware id %x\n", Status); @@ -270,7 +309,7 @@ DeviceID = 0x3A37; } - if (HiSpeed) + if (HiSpeed == 0x200) { // // USB 2.0 hub @@ -479,6 +518,7 @@ { PIO_STACK_LOCATION IoStack; PCOMMON_DEVICE_EXTENSION DeviceExtension; + PURB Urb; NTSTATUS Status = STATUS_NOT_IMPLEMENTED; // @@ -505,7 +545,13 @@ { case IOCTL_INTERNAL_USB_SUBMIT_URB: { - DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB UNIMPLEMENTED\n"); + // + // get urb + // + Urb = (PURB)IoStack->Parameters.Others.Argument1; + PC_ASSERT(Urb); + + DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB Function %x Length %lu Status %x Handle %p Flags %x UNIMPLEMENTED\n", Urb->UrbHeader.Function, Urb->UrbHeader.Length, Urb->UrbHeader.Status, Urb->UrbHeader.UsbdDeviceHandle, Urb->UrbHeader.UsbdFlags); // // request completed @@ -597,6 +643,283 @@ return Status; } +//----------------------------------------------------------------------------------------- +PUSBHARDWAREDEVICE +CHubController::GetUsbHardware() +{ + return m_Hardware; +} + +//----------------------------------------------------------------------------------------- +ULONG +CHubController::AcquireDeviceAddress() +{ + KIRQL OldLevel; + ULONG DeviceAddress; + + // + // acquire device lock + // + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // + // find address + // + DeviceAddress = RtlFindClearBits(&m_DeviceAddressBitmap, 1, 0); + if (DeviceAddress != MAXULONG) + { + // + // reserve address + // + RtlSetBit(&m_DeviceAddressBitmap, DeviceAddress); + + // + // device addresses start from 0x1 - 0xFF + // + DeviceAddress++; + } + + // + // release spin lock + // + KeReleaseSpinLock(&m_Lock, OldLevel); + + // + // return device address + // + return DeviceAddress; +} +//----------------------------------------------------------------------------------------- +VOID +CHubController::ReleaseDeviceAddress( + ULONG DeviceAddress) +{ + KIRQL OldLevel; + + // + // acquire device lock + // + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // + // sanity check + // + PC_ASSERT(DeviceAddress != 0); + + // + // convert back to bit number + // + DeviceAddress--; + + // + // clear bit + // + RtlClearBit(&m_DeviceAddressBitmap, DeviceAddress); + + // + // release lock + // + KeReleaseSpinLock(&m_Lock, OldLevel); +} +//----------------------------------------------------------------------------------------- +NTSTATUS +CHubController::RemoveUsbDevice( + PUSBDEVICE UsbDevice) +{ + PUSBDEVICE_ENTRY DeviceEntry; + PLIST_ENTRY Entry; + NTSTATUS Status = STATUS_UNSUCCESSFUL; + KIRQL OldLevel; + + // + // acquire lock + // + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // + // point to first entry + // + Entry = m_UsbDeviceList.Flink; + + // + // find matching entry + // + while(Entry != &m_UsbDeviceList) + { + // + // get entry + // + DeviceEntry = (PUSBDEVICE_ENTRY)CONTAINING_RECORD(Entry, USBDEVICE_ENTRY, Entry); + + // + // is it current entry + // + if (DeviceEntry->Device == UsbDevice) + { + // + // remove entry + // + RemoveEntryList(Entry); + + // + // free entry + // + ExFreePoolWithTag(DeviceEntry, TAG_USBEHCI); + + // + // done + // + Status = STATUS_SUCCESS; + break; + } + + // + // goto next device + // + Entry = Entry->Flink; + } + + // + // release lock + // + KeReleaseSpinLock(&m_Lock, OldLevel); + + // + // return result + // + return Status; +} +//----------------------------------------------------------------------------------------- +BOOLEAN +CHubController::ValidateUsbDevice(PUSBDEVICE UsbDevice) +{ + PUSBDEVICE_ENTRY DeviceEntry; + PLIST_ENTRY Entry; + KIRQL OldLevel; + BOOLEAN Result = FALSE; + + // + // acquire lock + // + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // + // point to first entry + // + Entry = m_UsbDeviceList.Flink; + + // + // find matching entry + // + while(Entry != &m_UsbDeviceList) + { + // + // get entry + // + DeviceEntry = (PUSBDEVICE_ENTRY)CONTAINING_RECORD(Entry, USBDEVICE_ENTRY, Entry); + + // + // is it current entry + // + if (DeviceEntry->Device == UsbDevice) + { + // + // device is valid + // + Result = TRUE; + break; + } + + // + // goto next device + // + Entry = Entry->Flink; + } + + // + // release lock + // + KeReleaseSpinLock(&m_Lock, OldLevel); + + // + // return result + // + return Result; + +} + +//----------------------------------------------------------------------------------------- +NTSTATUS +CHubController::AddUsbDevice( + PUSBDEVICE UsbDevice) +{ + PUSBDEVICE_ENTRY DeviceEntry; + NTSTATUS Status; + KIRQL OldLevel; + + // + // allocate device entry + // + DeviceEntry = (PUSBDEVICE_ENTRY)ExAllocatePoolWithTag(NonPagedPool, sizeof(USBDEVICE_ENTRY), TAG_USBEHCI); + if (!DeviceEntry) + { + // + // no memory + // + return STATUS_INSUFFICIENT_RESOURCES; + } + + // + // initialize entry + // + DeviceEntry->Device = UsbDevice; + + // + // acquire lock + // + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // + // insert entry + // + InsertTailList(&m_UsbDeviceList, &DeviceEntry->Entry); + + // + // release spin lock + // + KeReleaseSpinLock(&m_Lock, OldLevel); + + // + // done + // + return STATUS_SUCCESS; +} + +//----------------------------------------------------------------------------------------- +VOID +CHubController::SetNotification( + PVOID CallbackContext, + PRH_INIT_CALLBACK CallbackRoutine) +{ + KIRQL OldLevel; + + // + // acquire hub controller lock + // + KeAcquireSpinLock(&m_Lock, &OldLevel); + + // + // now set the callback routine and context of the hub + // + m_HubCallbackContext = CallbackContext; + m_HubCallbackRoutine = CallbackRoutine; + + // + // release hub controller lock + // + KeReleaseSpinLock(&m_Lock, OldLevel); +} + //================================================================================================= // // Generic Interface functions @@ -643,8 +966,86 @@ USHORT PortStatus, USHORT PortNumber) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + PUSBDEVICE NewUsbDevice; + CHubController * Controller; + NTSTATUS Status; + + DPRINT1("USBHI_CreateUsbDevice\n"); + + // + // first get hub controller + // + Controller = (CHubController *)BusContext; + + // + // sanity check + // + PC_ASSERT(Controller); + PC_ASSERT(BusContext == HubDeviceHandle); + + // + // now allocate usb device + // + Status = CreateUSBDevice(&NewUsbDevice); + + // + // check for success + // + if (!NT_SUCCESS(Status)) + { + // + // release controller + // + Controller->Release(); + DPRINT1("USBHI_CreateUsbDevice: failed to create usb device %x\n", Status); + return Status; + } + + // + // now initialize device + // + Status = NewUsbDevice->Initialize(PHUBCONTROLLER(Controller), Controller->GetUsbHardware(),PVOID(Controller), PortNumber); + + // + // check for success + // + if (!NT_SUCCESS(Status)) + { + // + // release usb device + // + NewUsbDevice->Release(); + DPRINT1("USBHI_CreateUsbDevice: failed to initialize usb device %x\n", Status); + return Status; + } + + // + // insert into list + // + Status = Controller->AddUsbDevice(NewUsbDevice); + // + // check for success + // + if (!NT_SUCCESS(Status)) + { + // + // release usb device + // + NewUsbDevice->Release(); + + DPRINT1("USBHI_CreateUsbDevice: failed to add usb device %x\n", Status); + return Status; + } + + // + // store the handle + // + *NewDevice = NewUsbDevice; + + // + // done + // + return STATUS_SUCCESS; } NTSTATUS @@ -653,8 +1054,93 @@ PVOID BusContext, PUSB_DEVICE_HANDLE DeviceHandle) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + PUSBDEVICE UsbDevice; + CHubController * Controller; + ULONG DeviceAddress; + NTSTATUS Status; + ULONG Index = 0; + + DPRINT1("USBHI_InitializeUsbDevice\n"); + + // + // first get controller + // + Controller = (CHubController *)BusContext; + PC_ASSERT(Controller); + + // + // get device object + // + UsbDevice = (PUSBDEVICE)DeviceHandle; + PC_ASSERT(UsbDevice); + + // + // validate device handle + // + if (!Controller->ValidateUsbDevice(UsbDevice)) + { + DPRINT1("USBHI_InitializeUsbDevice invalid device handle %p\n", DeviceHandle); + + // + // invalid device handle + // + return STATUS_DEVICE_NOT_CONNECTED; + } + + // + // now reserve an address + // + DeviceAddress = Controller->AcquireDeviceAddress(); + + // + // is the device address valid + // + if (DeviceAddress == MAXULONG) + { + // + // failed to get an device address from the device address pool + // + DPRINT1("USBHI_InitializeUsbDevice failed to get device address\n"); + return STATUS_DEVICE_DATA_ERROR; + } + + do + { + // + // now set the device address + // + Status = UsbDevice->SetDeviceAddress(DeviceAddress); + + if (NT_SUCCESS(Status)) + break; + + }while(Index++ < 3 ); + + // + // check for failure + // + if (!NT_SUCCESS(Status)) + { + // + // failed to set device address + // + DPRINT1("USBHI_InitializeUsbDevice failed to set address with %x\n", Status); + + // + // release address + // + Controller->ReleaseDeviceAddress(DeviceAddress); + + // + // return error + // + return STATUS_DEVICE_DATA_ERROR; + } + + // + // done + // + return STATUS_SUCCESS; } NTSTATUS @@ -667,8 +1153,103 @@ PUCHAR ConfigDescriptorBuffer, PULONG ConfigDescriptorBufferLength) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + PUSBDEVICE UsbDevice; + CHubController * Controller; + NTSTATUS Status; + PURB Urb; + + DPRINT1("USBHI_GetUsbDescriptors\n"); + + // + // sanity check + // + PC_ASSERT(DeviceDescriptorBuffer); + PC_ASSERT(*DeviceDescriptorBufferLength >= sizeof(USB_DEVICE_DESCRIPTOR)); + + // + // first get controller + // + Controller = (CHubController *)BusContext; + PC_ASSERT(Controller); + + + // + // get device object + // + UsbDevice = (PUSBDEVICE)DeviceHandle; + PC_ASSERT(UsbDevice); + + // + // validate device handle + // + if (!Controller->ValidateUsbDevice(UsbDevice)) + { + DPRINT1("USBHI_GetUsbDescriptors invalid device handle %p\n", DeviceHandle); + + // + // invalid device handle + // + return STATUS_DEVICE_NOT_CONNECTED; + } + + // + // get device descriptor + // + UsbDevice->GetDeviceDescriptor((PUSB_DEVICE_DESCRIPTOR)DeviceDescriptorBuffer); + + // + // store result length + // + *DeviceDescriptorBufferLength = sizeof(USB_DEVICE_DESCRIPTOR); + + // + // allocate urb + // + Urb = (PURB)ExAllocatePoolWithTag(NonPagedPool, sizeof(URB), TAG_USBEHCI); + if (!Urb) + { + // + // no memory + // + return STATUS_INSUFFICIENT_RESOURCES; + } + + // + // zero request + // + RtlZeroMemory(Urb, sizeof(URB)); + + // + // initialize request + // + Urb->UrbHeader.Function = URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE; + Urb->UrbHeader.Length = sizeof(_URB_CONTROL_DESCRIPTOR_REQUEST); + Urb->UrbControlDescriptorRequest.DescriptorType = USB_CONFIGURATION_DESCRIPTOR_TYPE; + Urb->UrbControlDescriptorRequest.TransferBuffer = ConfigDescriptorBuffer; + Urb->UrbControlDescriptorRequest.TransferBufferLength = *ConfigDescriptorBufferLength; + + // + // submit urb + // + Status = UsbDevice->SubmitUrb(Urb); + + if (NT_SUCCESS(Status)) + { + // + // TransferBufferLength holds the number of bytes transferred + // + *ConfigDescriptorBufferLength = Urb->UrbControlDescriptorRequest.TransferBufferLength; + } + + // + // free urb + // + ExFreePoolWithTag(Urb, TAG_USBEHCI); + + // + // complete the request + // + return Status; } NTSTATUS @@ -678,8 +1259,71 @@ PUSB_DEVICE_HANDLE DeviceHandle, ULONG Flags) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + PUSBDEVICE UsbDevice; + CHubController * Controller; + NTSTATUS Status; + + DPRINT1("USBHI_RemoveUsbDevice\n"); + + // + // first get controller + // + Controller = (CHubController *)BusContext; + PC_ASSERT(Controller); + + // + // get device object + // + UsbDevice = (PUSBDEVICE)DeviceHandle; + PC_ASSERT(UsbDevice); + + // + // validate device handle + // + if (!Controller->ValidateUsbDevice(UsbDevice)) + { + DPRINT1("USBHI_RemoveUsbDevice invalid device handle %p\n", DeviceHandle); + + // + // invalid device handle + // + return STATUS_DEVICE_NOT_CONNECTED; + } + + // + // check if there were flags passed + // + if (Flags & USBD_KEEP_DEVICE_DATA || Flags & USBD_MARK_DEVICE_BUSY) + { + // + // ignore flags for now + // + return STATUS_SUCCESS; + } + + // + // remove device + // + Status = Controller->RemoveUsbDevice(UsbDevice); + if (!NT_SUCCESS(Status)) + { + // + // invalid device handle + // + DPRINT1("USBHI_RemoveUsbDevice Invalid device handle %p\n", UsbDevice); + PC_ASSERT(0); + return STATUS_DEVICE_NOT_CONNECTED; + } + + // + // release usb device + // + UsbDevice->Release(); + + // + // done + // + return STATUS_SUCCESS; } NTSTATUS @@ -712,8 +1356,78 @@ ULONG DeviceInformationBufferLength, PULONG LengthReturned) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + PUSB_DEVICE_INFORMATION_0 DeviceInfo; + PUSBDEVICE UsbDevice; + CHubController * Controller; + NTSTATUS Status; + + DPRINT1("USBHI_QueryDeviceInformation\n"); + + // + // sanity check + // + PC_ASSERT(DeviceInformationBufferLength >= sizeof(USB_DEVICE_INFORMATION_0)); + PC_ASSERT(DeviceInformationBuffer); + PC_ASSERT(LengthReturned); + + // + // get controller object + // + Controller = (CHubController*)BusContext; + PC_ASSERT(Controller); + + // + // get device object + // + UsbDevice = (PUSBDEVICE)DeviceHandle; + PC_ASSERT(UsbDevice); + + // + // validate device handle + // + if (!Controller->ValidateUsbDevice(UsbDevice)) + { + DPRINT1("USBHI_QueryDeviceInformation invalid device handle %p\n", DeviceHandle); + + // + // invalid device handle + // + return STATUS_DEVICE_NOT_CONNECTED; + } + + // + // access information buffer + // + DeviceInfo = (PUSB_DEVICE_INFORMATION_0)DeviceInformationBuffer; + + // + // initialize with default values + // + DeviceInfo->InformationLevel = 0; + DeviceInfo->ActualLength = sizeof(USB_DEVICE_INFORMATION_0); + DeviceInfo->PortNumber = UsbDevice->GetPort(); + DeviceInfo->CurrentConfigurationValue = UsbDevice->GetConfigurationValue(); + DeviceInfo->DeviceAddress = 0; UsbDevice->GetDeviceAddress(); + DeviceInfo->HubAddress = 0; //FIXME + DeviceInfo->DeviceSpeed = UsbDevice->GetSpeed(); + DeviceInfo->DeviceType = UsbDevice->GetType(); + DeviceInfo->NumberOfOpenPipes = 0; //FIXME + + // + // get device descriptor + // + UsbDevice->GetDeviceDescriptor(&DeviceInfo->DeviceDescriptor); + + // + // FIXME return pipe information + // + + // + // store result length + // + *LengthReturned = sizeof(USB_DEVICE_INFORMATION_0); + + return STATUS_SUCCESS; } NTSTATUS @@ -747,8 +1461,87 @@ ULONG HubInformationBufferLength, PULONG LengthReturned) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + PUSB_EXTHUB_INFORMATION_0 HubInfo; + CHubController * Controller; + PUSBHARDWAREDEVICE Hardware; + ULONG Index; + ULONG NumPort, Dummy2; + USHORT Dummy1; + NTSTATUS Status; + + DPRINT1("USBHI_GetExtendedHubInformation\n"); + + // + // sanity checks + // + PC_ASSERT(HubInformationBuffer); + PC_ASSERT(HubInformationBufferLength == sizeof(USB_EXTHUB_INFORMATION_0)); + PC_ASSERT(LengthReturned); + + // + // get hub controller + // + Controller = (CHubController *)BusContext; + PC_ASSERT(Controller); + + // + // get usb hardware device + // + Hardware = Controller->GetUsbHardware(); + + // + // retrieve number of ports + // + Status = Hardware->GetDeviceDetails(&Dummy1, &Dummy1, &NumPort, &Dummy2); + if (!NT_SUCCESS(Status)) + { + // + // failed to get hardware details, ouch ;) + // + DPRINT1("USBHI_GetExtendedHubInformation failed to get hardware details with %x\n", Status); + return Status; + } + + // + // get hub information buffer + // + HubInfo = (PUSB_EXTHUB_INFORMATION_0)HubInformationBuffer; + + // + // initialize hub information + // + HubInfo->InformationLevel = 0; + + // + // store port count + // + HubInfo->NumberOfPorts = NumPort; + + // + // initialize port information + // + for(Index = 0; Index < NumPort; Index++) + { + HubInfo->Port[Index].PhysicalPortNumber = Index + 1; + HubInfo->Port[Index].PortLabelNumber = Index + 1; + HubInfo->Port[Index].VidOverride = 0; + HubInfo->Port[Index].PidOverride = 0; + HubInfo->Port[Index].PortAttributes = USB_PORTATTR_SHARED_USB2; //FIXME + } + + // + // store result length + // +#ifdef _MSC_VER + *LengthReturned = FIELD_OFFSET(USB_EXTHUB_INFORMATION_0, Port[HubInfo->NumberOfPorts]); +#else + *LengthReturned = FIELD_OFFSET(USB_EXTHUB_INFORMATION_0, Port) + sizeof(USB_EXTPORT_INFORMATION_0) * HubInfo->NumberOfPorts; +#endif + + // + // done + // + return STATUS_SUCCESS; } NTSTATUS @@ -791,8 +1584,25 @@ PVOID CallbackContext, PRH_INIT_CALLBACK CallbackRoutine) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + CHubController * Controller; + + DPRINT1("USBHI_RootHubInitNotification\n"); + + // + // get controller object + // + Controller = (CHubController*)BusContext; + PC_ASSERT(Controller); + + // + // set notification routine + // + Controller->SetNotification(CallbackContext, CallbackRoutine); + + // + // done + // + return STATUS_SUCCESS; } VOID @@ -811,7 +1621,37 @@ PVOID DeviceHandle, PDEVICE_OBJECT UsbDevicePdo) { - UNIMPLEMENTED + PUSBDEVICE UsbDevice; + CHubController * Controller; + + // + // get controller + // + Controller = (CHubController *)BusContext; + PC_ASSERT(Controller); + + // + // get device handle + // + UsbDevice = (PUSBDEVICE)DeviceHandle; + + // + // validate device handle + // + if (!Controller->ValidateUsbDevice(UsbDevice)) + { + DPRINT1("USBHI_SetDeviceHandleData DeviceHandle %p is invalid\n", DeviceHandle); + + // + // invalid handle + // + return; + } + + // + // set device handle data + // + UsbDevice->SetDeviceHandleData(UsbDevicePdo); } //================================================================================================= @@ -826,7 +1666,46 @@ PUSBD_VERSION_INFORMATION VersionInformation, PULONG HcdCapabilites) { - UNIMPLEMENTED + CHubController * Controller; + PUSBHARDWAREDEVICE Device; + ULONG Speed, Dummy2; + USHORT Dummy1; + + DPRINT1("USBDI_GetUSBDIVersion\n"); + + // + // get controller + // + Controller = (CHubController*)BusContext; + + // + // get usb hardware + // + Device = Controller->GetUsbHardware(); + PC_ASSERT(Device); + + if (VersionInformation) + { + // + // windows xp supported + // + VersionInformation->USBDI_Version = 0x00000500; + + // + // get device speed + // + Device->GetDeviceDetails(&Dummy1, &Dummy1, &Dummy2, &Speed); + + // + // store speed details + // + VersionInformation->Supported_USB_Version = Speed; + } + + // + // no flags supported + // + *HcdCapabilites = 0; } NTSTATUS @@ -867,8 +1746,33 @@ USBDI_IsDeviceHighSpeed( PVOID BusContext) { - UNIMPLEMENTED - return TRUE; + CHubController * Controller; + PUSBHARDWAREDEVICE Device; + ULONG Speed, Dummy2; + USHORT Dummy1; + + DPRINT1("USBDI_IsDeviceHighSpeed\n"); + + // + // get controller + // + Controller = (CHubController*)BusContext; + + // + // get usb hardware + // + Device = Controller->GetUsbHardware(); + PC_ASSERT(Device); + + // + // get device speed + // + Device->GetDeviceDetails(&Dummy1, &Dummy1, &Dummy2, &Speed); + + // + // USB 2.0 equals 0x200 + // + return (Speed == 0x200); } NTSTATUS Modified: branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] Sun Apr 17 08:20:40 2011 @@ -475,4 +475,127 @@ typedef IDispatchIrp *PDISPATCHIRP; +//========================================================================================= +// +// class IUSBDevice +// +// Description: This class is used to abstract details of a usb device +// + +DECLARE_INTERFACE_(IUSBDevice, IUnknown) +{ + DEFINE_ABSTRACT_UNKNOWN() + +//---------------------------------------------------------------------------------------- +// +// Initialize +// +// Description: Initializes the usb device + + virtual NTSTATUS Initialize(IN PHUBCONTROLLER HubController, + IN PUSBHARDWAREDEVICE Device, + IN PVOID Parent, + IN ULONG Port) = 0; + +//----------------------------------------------------------------------------------------- +// +// IsHub +// +// Description: returns true when device is a hub + + virtual BOOLEAN IsHub() = 0; + +//----------------------------------------------------------------------------------------- +// +// GetParent +// +// Description: gets the parent device of the this device + + virtual NTSTATUS GetParent(PVOID * Parent) = 0; + +//----------------------------------------------------------------------------------------- +// +// GetDeviceAddress +// +// Description: gets the device address of the this device + + virtual ULONG GetDeviceAddress() = 0; + + +//----------------------------------------------------------------------------------------- +// +// GetPort +// +// Description: gets the port to which this device is connected + + virtual ULONG GetPort() = 0; + +//----------------------------------------------------------------------------------------- +// +// GetSpeed +// +// Description: gets the speed of the device + + virtual USB_DEVICE_SPEED GetSpeed() = 0; + +//----------------------------------------------------------------------------------------- +// +// GetType +// +// Description: gets the type of the device, either 1.1 or 2.0 device + + virtual USB_DEVICE_TYPE GetType() = 0; + +//----------------------------------------------------------------------------------------- +// +// GetState +// +// Description: gets the device state + + virtual ULONG GetState() = 0; + +//----------------------------------------------------------------------------------------- +// +// SetDeviceHandleData +// +// Description: sets device handle data + + virtual void SetDeviceHandleData(PVOID Data) = 0; + +//----------------------------------------------------------------------------------------- +// +// SetDeviceAddress +// +// Description: sets device handle data + + virtual NTSTATUS SetDeviceAddress(ULONG DeviceAddress) = 0; + +//----------------------------------------------------------------------------------------- +// +// GetDeviceDescriptor +// +// Description: sets device handle data + + virtual void GetDeviceDescriptor(PUSB_DEVICE_DESCRIPTOR DeviceDescriptor) = 0; + +//----------------------------------------------------------------------------------------- +// +// GetConfigurationValue +// +// Description: gets current selected configuration index + + virtual UCHAR GetConfigurationValue(); + +//----------------------------------------------------------------------------------------- +// +// SubmitUrb +// +// Description: submits an urb + + virtual NTSTATUS SubmitUrb(PURB Urb) = 0; + +}; + +typedef IUSBDevice *PUSBDEVICE; + #endif Modified: branches/usb-bringup/drivers/usb/usbehci_new/memory_manager.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/memory_manager.cpp [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/memory_manager.cpp [iso-8859-1] Sun Apr 17 08:20:40 2011 @@ -85,7 +85,7 @@ // // calculate bitmap length // - BitmapLength = (DmaBufferSize / DefaultBlockSize) / sizeof(ULONG); + BitmapLength = (DmaBufferSize / DefaultBlockSize) / 8; // // allocate bitmap buffer @@ -102,7 +102,7 @@ // // initialize bitmap // - RtlInitializeBitMap(&m_Bitmap, m_BitmapBuffer, BitmapLength); + RtlInitializeBitMap(&m_Bitmap, m_BitmapBuffer, BitmapLength * 8); // // clear all bits Added: branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp (added) +++ branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp [iso-8859-1] Sun Apr 17 08:20:40 2011 @@ -1,0 +1,22 @@ +/* + * PROJECT: ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/usb/usbehci/usb_device.cpp + * PURPOSE: USB EHCI device driver. + * PROGRAMMERS: + * Michael Martin (michael.martin(a)reactos.org) + * Johannes Anderwald (johannes.anderwald(a)reactos.org) + */ + +#define INITGUID +#include "usbehci.h" + + +NTSTATUS +CreateUSBDevice( + PUSBDEVICE *OutDevice) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + Propchange: branches/usb-bringup/drivers/usb/usbehci_new/usb_device.cpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h [iso-8859-1] Sun Apr 17 08:20:40 2011 @@ -54,7 +54,6 @@ // misc.cpp // NTSTATUS NTAPI SyncForwardIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp); - NTSTATUS NTAPI GetBusInterface(PDEVICE_OBJECT DeviceObject, PBUS_INTERFACE_STANDARD busInterface); // @@ -67,4 +66,10 @@ // NTSTATUS CreateDMAMemoryManager(PDMAMEMORYMANAGER *OutMemoryManager); + +// +// usb_device.cpp +// +NTSTATUS CreateUSBDevice(PUSBDEVICE *OutDevice); + #endif
13 years, 8 months
1
0
0
0
[osiejka] 51371: [CALC] - Swedish translation by Jaix Bly. See issue #6113 for more details.
by osiejka@svn.reactos.org
Author: osiejka Date: Sat Apr 16 22:29:55 2011 New Revision: 51371 URL:
http://svn.reactos.org/svn/reactos?rev=51371&view=rev
Log: [CALC] - Swedish translation by Jaix Bly. See issue #6113 for more details. Added: trunk/reactos/base/applications/calc/lang/sv-SE.rc (with props) Modified: trunk/reactos/base/applications/calc/resource.rc Added: trunk/reactos/base/applications/calc/lang/sv-SE.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/calc/lan…
============================================================================== --- trunk/reactos/base/applications/calc/lang/sv-SE.rc (added) +++ trunk/reactos/base/applications/calc/lang/sv-SE.rc [iso-8859-1] Sat Apr 16 22:29:55 2011 @@ -1,0 +1,738 @@ +/* + * PROJECT: ReactOS RAPPS + * FILE: \base\applications\calc\lang\sv-SE.rc + * PURPOSE: Swedish resource file + * Translation: Jaix Bly + */ +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + +// Dialog + +IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 +STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "ReactOS Kalkylator" +MENU IDR_MENU_SCIENTIFIC_1 +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "",IDC_STATIC,4,16,132,21 + CONTROL "Hex",IDC_RADIO_HEX,"Button",BS_AUTORADIOBUTTON,8,24,29,10 + CONTROL "Dec",IDC_RADIO_DEC,"Button",BS_AUTORADIOBUTTON,40,24,29,10 + CONTROL "Okt",IDC_RADIO_OCT,"Button",BS_AUTORADIOBUTTON,72,24,27,10 + CONTROL "Bin",IDC_RADIO_BIN,"Button",BS_AUTORADIOBUTTON,100,24,26,10 + GROUPBOX "",IDC_STATIC,4,36,76,21 + CONTROL "Inv",IDC_CHECK_INV,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,8,44,26,10 + CONTROL "Hyp",IDC_CHECK_HYP,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,40,44,29,10 + CTEXT "",IDC_TEXT_PARENT,84,40,24,17,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + CTEXT "",IDC_TEXT_MEMORY,112,40,24,17,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + PUSHBUTTON "Sta",IDC_BUTTON_STA,4,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Ave",IDC_BUTTON_AVE,4,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Sum",IDC_BUTTON_SUM,4,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "s",IDC_BUTTON_S,4,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Dat",IDC_BUTTON_DAT,4,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "F-E",IDC_BUTTON_FE,38,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "dms",IDC_BUTTON_DMS,38,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "sin",IDC_BUTTON_SIN,38,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "cos",IDC_BUTTON_COS,38,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "tan",IDC_BUTTON_TAN,38,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "(",IDC_BUTTON_LEFTPAR,64,64,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Exp",IDC_BUTTON_EXP,64,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "x^y",IDC_BUTTON_XeY,64,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "x^2",IDC_BUTTON_Xe2,64,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "x^3",IDC_BUTTON_Xe3,64,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON ")",IDC_BUTTON_RIGHTPAR,90,64,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "ln",IDC_BUTTON_LN,90,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "log",IDC_BUTTON_LOG,90,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "n!",IDC_BUTTON_NF,90,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "1/x",IDC_BUTTON_RX,90,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MC",IDC_BUTTON_MC,124,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MR",IDC_BUTTON_MR,124,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MS",IDC_BUTTON_MS,124,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "M+",IDC_BUTTON_MP,124,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "pi",IDC_BUTTON_PI,124,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "7",IDC_BUTTON_7,158,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "4",IDC_BUTTON_4,158,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "1",IDC_BUTTON_1,158,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "0",IDC_BUTTON_0,158,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "A",IDC_BUTTON_A,158,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "8",IDC_BUTTON_8,184,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "5",IDC_BUTTON_5,184,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "2",IDC_BUTTON_2,184,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "+/-",IDC_BUTTON_SIGN,184,121,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "B",IDC_BUTTON_B,184,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "9",IDC_BUTTON_9,210,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "6",IDC_BUTTON_6,210,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "3",IDC_BUTTON_3,210,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON ",",IDC_BUTTON_DOT,210,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "C",IDC_BUTTON_C,210,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "/",IDC_BUTTON_DIV,236,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "*",IDC_BUTTON_MULT,236,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "-",IDC_BUTTON_SUB,236,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "+",IDC_BUTTON_ADD,236,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "D",IDC_BUTTON_D,236,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Mod",IDC_BUTTON_MOD,262,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Or",IDC_BUTTON_OR,262,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Lsh",IDC_BUTTON_LSH,262,102,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "=",IDC_BUTTON_EQU,262,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "E",IDC_BUTTON_E,262,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "And",IDC_BUTTON_AND,288,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Xor",IDC_BUTTON_XOR,288,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Not",IDC_BUTTON_NOT,288,102,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Int",IDC_BUTTON_INT,288,121,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "F",IDC_BUTTON_F,288,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + GROUPBOX "",IDC_STATIC,140,16,172,21 + CONTROL "Qword",IDC_RADIO_QWORD,"Button",BS_AUTORADIOBUTTON | + NOT WS_VISIBLE,148,24,37,10 + CONTROL "Dword",IDC_RADIO_DWORD,"Button",BS_AUTORADIOBUTTON | + NOT WS_VISIBLE,188,24,37,10 + CONTROL "Word",IDC_RADIO_WORD,"Button",BS_AUTORADIOBUTTON | NOT + WS_VISIBLE,232,24,33,10 + CONTROL "Byte",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT + WS_VISIBLE,272,24,30,10 + CONTROL "Grader",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, + 42,10 + CONTROL "Radianer",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, + 24,42,10 + CONTROL "Gradienter",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, + 236,24,48,10 + PUSHBUTTON "C",IDC_BUTTON_CANC,272,40,40,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "CE",IDC_BUTTON_CE,228,40,40,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Backsteg",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + RTEXT "",IDC_TEXT_OUTPUT,4,4,308,12,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + DEFPUSHBUTTON "",IDC_BUTTON_FOCUS,0,0,5,5, NOT WS_VISIBLE +END + +IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 +STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "ReactOS Kalkylator" +MENU IDR_MENU_STANDARD +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + PUSHBUTTON "C",IDC_BUTTON_CANC,128,24,40,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "CE",IDC_BUTTON_CE,84,24,40,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Backsteg",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + RTEXT "",IDC_TEXT_OUTPUT,4,4,164,12,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + PUSHBUTTON "7",IDC_BUTTON_7,40,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "4",IDC_BUTTON_4,40,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "1",IDC_BUTTON_1,40,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "0",IDC_BUTTON_0,40,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "8",IDC_BUTTON_8,66,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "5",IDC_BUTTON_5,66,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "2",IDC_BUTTON_2,66,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "+/-",IDC_BUTTON_SIGN,66,105,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "9",IDC_BUTTON_9,92,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "6",IDC_BUTTON_6,92,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "3",IDC_BUTTON_3,92,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON ",",IDC_BUTTON_DOT,92,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "/",IDC_BUTTON_DIV,118,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "*",IDC_BUTTON_MULT,118,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "-",IDC_BUTTON_SUB,118,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "+",IDC_BUTTON_ADD,118,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Sqrt",IDC_BUTTON_SQRT,144,48,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "%",IDC_BUTTON_PERCENT,144,67,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "1/x",IDC_BUTTON_RX,144,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "=",IDC_BUTTON_EQU,144,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + CTEXT "",IDC_TEXT_MEMORY,4,24,24,17,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + PUSHBUTTON "MC",IDC_BUTTON_MC,4,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MR",IDC_BUTTON_MR,4,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MS",IDC_BUTTON_MS,4,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "M+",IDC_BUTTON_MP,4,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + DEFPUSHBUTTON "",IDC_BUTTON_FOCUS,0,0,5,5, NOT WS_VISIBLE +END + +IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 +STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "ReactOS Kalkylator" +MENU IDR_MENU_STANDARD +FONT 8, "MS Shell Dlg" +BEGIN + PUSHBUTTON "Konvertera",IDC_BUTTON_CONVERT,35,105,76,17 + COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP | CBS_SORT + LTEXT "Kategori:",IDC_STATIC,4,20,56,8 + COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP | CBS_SORT + LTEXT "Konvertera från:",IDC_STATIC,4,49,56,8 + COMBOBOX IDC_COMBO_TO,4,87,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP | CBS_SORT + LTEXT "Konvertera till:",IDC_STATIC,4,76,56,8 + CONTROL "C",IDC_BUTTON_CANC,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 + CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,232,24,40,17 + CONTROL "Backsteg",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | + BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,24, + 40,17 + RTEXT "",IDC_TEXT_OUTPUT,4,4,312,12,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + CONTROL "7",IDC_BUTTON_7,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,48,24,17 + CONTROL "4",IDC_BUTTON_4,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,67,24,17 + CONTROL "1",IDC_BUTTON_1,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,86,24,17 + CONTROL "0",IDC_BUTTON_0,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,105,24,17 + CONTROL "8",IDC_BUTTON_8,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,214,48,24,17 + CONTROL "5",IDC_BUTTON_5,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,214,67,24,17 + CONTROL "2",IDC_BUTTON_2,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,214,86,24,17 + CONTROL "+/-",IDC_BUTTON_SIGN,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,214,105,24,17 + CONTROL "9",IDC_BUTTON_9,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,240,48,24,17 + CONTROL "6",IDC_BUTTON_6,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,240,67,24,17 + CONTROL "3",IDC_BUTTON_3,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,240,86,24,17 + CONTROL ",",IDC_BUTTON_DOT,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,240,105,24,17 + CONTROL "/",IDC_BUTTON_DIV,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,48,24,17 + CONTROL "*",IDC_BUTTON_MULT,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,67,24,17 + CONTROL "-",IDC_BUTTON_SUB,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,86,24,17 + CONTROL "+",IDC_BUTTON_ADD,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,105,24,17 + CONTROL "sqrt",IDC_BUTTON_SQRT,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,48,24,17 + CONTROL "%",IDC_BUTTON_PERCENT,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,67,24,17 + CONTROL "1/x",IDC_BUTTON_RX,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,86,24,17 + CONTROL "=",IDC_BUTTON_EQU,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,105,24,17 + CTEXT "",IDC_TEXT_MEMORY,152,24,24,17,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + CONTROL "MC",IDC_BUTTON_MC,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,152,48,24,17 + CONTROL "MR",IDC_BUTTON_MR,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,152,67,24,17 + CONTROL "MS",IDC_BUTTON_MS,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,152,86,24,17 + CONTROL "M+",IDC_BUTTON_MP,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,152,105,24,17 + DEFPUSHBUTTON "",IDC_BUTTON_FOCUS,0,0,5,5,NOT WS_VISIBLE +END + +IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Om ReactOS Kalkylator" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK",IDOK,105,148,52,16 + CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | + SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 + LTEXT "ReactOS Kalkylator",IDC_STATIC,120,12,132,8, + SS_CENTERIMAGE + LTEXT "Version ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE + LTEXT "Skriven av Carlo Bramini",IDC_STATIC,120,32,132,8, + SS_CENTERIMAGE + GROUPBOX "",IDC_STATIC,112,0,148,52 + GROUPBOX "",IDC_STATIC,4,56,256,88 + EDITTEXT IDC_EDIT_LICENSE,12,68,240,68,ES_MULTILINE | ES_READONLY | + WS_VSCROLL +END + +IDD_DIALOG_STAT DIALOGEX DISCARDABLE 0, 0, 163, 85 +STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Statistik box" +FONT 8, "MS Shell Dlg" +BEGIN + LISTBOX IDC_LIST_STAT,4,4,156,40,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "RET",IDC_BUTTON_RET,4,48,36,16 + PUSHBUTTON "LOAD",IDC_BUTTON_LOAD,44,48,36,16 + PUSHBUTTON "CD",IDC_BUTTON_CD,84,48,36,16 + PUSHBUTTON "CAD",IDC_BUTTON_CAD,124,48,36,16 + CTEXT "n=0",IDC_TEXT_NITEMS,4,68,156,12,SS_CENTERIMAGE | + SS_SUNKEN +END + +// Menus + +IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE +BEGIN + POPUP "Redigera" + BEGIN + MENUITEM "Kopiera\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Klistra in\tCTRL-V", IDM_EDIT_PASTE + END + POPUP "Visa" + BEGIN + MENUITEM "Standard", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Vetenskaplig", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Konvertering", IDM_VIEW_CONVERSION + MENUITEM SEPARATOR + MENUITEM "Hexadecimal\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Desimal\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Oktal\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Binär\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM SEPARATOR + MENUITEM "Grader\tF2", IDM_VIEW_DEG, CHECKED + MENUITEM "Radianer\tF3", IDM_VIEW_RAD, CHECKED + MENUITEM "Gradienter\tF4", IDM_VIEW_GRAD, CHECKED + MENUITEM SEPARATOR + MENUITEM "Siffergruppering", IDM_VIEW_GROUP, CHECKED + END + POPUP "Hjälp" + BEGIN + MENUITEM "Visa hjälp", IDM_HELP_HELP + MENUITEM SEPARATOR + MENUITEM "Om ReactOS Kalkylator", IDM_HELP_ABOUT + END +END + +IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE +BEGIN + POPUP "Redigera" + BEGIN + MENUITEM "Kopiera\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Klistra in\tCTRL-V", IDM_EDIT_PASTE + END + POPUP "Vis" + BEGIN + MENUITEM "Standard", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Vetenskaplig", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Konvertering", IDM_VIEW_CONVERSION + MENUITEM SEPARATOR + MENUITEM "Hexadecimal\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Desimal\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Oktal\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Binär\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM SEPARATOR + MENUITEM "Qword\tF12", IDM_VIEW_QWORD, CHECKED + MENUITEM "Dword\tF2", IDM_VIEW_DWORD, CHECKED + MENUITEM "Word\tF3", IDM_VIEW_WORD, CHECKED + MENUITEM "Byte\tF4", IDM_VIEW_BYTE, CHECKED + MENUITEM SEPARATOR + MENUITEM "Siffergruppering", IDM_VIEW_GROUP, CHECKED + END + POPUP "Hjälp" + BEGIN + MENUITEM "Visa hjälp", IDM_HELP_HELP + MENUITEM SEPARATOR + MENUITEM "Om ReactOS Kalkylator", IDM_HELP_ABOUT + END +END + +IDR_MENU_STANDARD MENU DISCARDABLE +BEGIN + POPUP "Redigera" + BEGIN + MENUITEM "Kopiera\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Klistra in\tCTRL-V", IDM_EDIT_PASTE + END + POPUP "Visa" + BEGIN + MENUITEM "Standard", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Vetenskapelig", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Konvertering", IDM_VIEW_CONVERSION + MENUITEM SEPARATOR + MENUITEM "Siffergruppering", IDM_VIEW_GROUP, CHECKED + END + POPUP "Hjälp" + BEGIN + MENUITEM "Visa hjälp", IDM_HELP_HELP + MENUITEM SEPARATOR + MENUITEM "Om Reactos Kalkylator", IDM_HELP_ABOUT + END +END + +// String Tables + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING_LICENSE "ReactOS Kalkylator är gratis programvara utgivet under GNU GPL licensen.\r\n\r\nDu kan få en kopia av GNU GPL licensen
her:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nDu
kan också få en översättning av GNU GPL lisensen
her:\r\nhttp://www.gnu.org/licenses/translations.html
" + IDS_MATH_ERROR "Fel" + IDS_QUICKHELP "Snabb hjälp" +END + +// Types of conversion +STRINGTABLE DISCARDABLE +BEGIN + IDS_CONV_ANGLE "Vinkel" + IDS_CONV_AREA "Område" + IDS_CONV_CONSUMPTION "Förbrukning (motor)" + IDS_CONV_CURRENCY "Valuta" + IDS_CONV_ENERGY "Energi" + IDS_CONV_LENGTH "Längd" + IDS_CONV_POWER "Ström" + IDS_CONV_PRESSURE "Tryck" + IDS_CONV_TEMPERATURE "Temperatur" + IDS_CONV_TIME "Tid" + IDS_CONV_VELOCITY "Hastighet" + IDS_CONV_VOLUME "Volym" + IDS_CONV_WEIGHT "Vikt" +END + +// TYPES OF ANGLES +STRINGTABLE DISCARDABLE +BEGIN + IDS_ANGLE_DEGREES "Grader" + IDS_ANGLE_GRADIANS "Gradianer" + IDS_ANGLE_RADIANS "Radianer" +END + +// TYPES OF AREAS +STRINGTABLE DISCARDABLE +BEGIN + IDS_AREA_ACRES "Tunnland" + IDS_AREA_ACRES_BRAZIL "Tunnland (Brasil)" + IDS_AREA_ACRES_FRANCE "Tunnland (France)" + IDS_AREA_ACRES_SCOTS "Tunnland (Scots)" + IDS_AREA_ACRES_US "Tunnland (US)" + IDS_AREA_ARES "Tunnland" + IDS_AREA_CHOU "Chou" + IDS_AREA_DANBO "Danbo" + IDS_AREA_HECTARES "Hektar" + IDS_AREA_JEONGBO "Jeongbo" + IDS_AREA_MORGEN_HUNGARY "Morgen (Hungary)" + IDS_AREA_MU "Mu" + IDS_AREA_PING "Ping" + IDS_AREA_PYEONG "Pyeong" + IDS_AREA_PYEONGBANGJA "Pyeongbangja" + IDS_AREA_RAI "Rai" + IDS_AREA_SE "Se" + IDS_AREA_SQUARE_CENTIMETERS "Kvadrat centimeter" + IDS_AREA_SQUARE_CHR "Kvadrat chr" + IDS_AREA_SQUARE_FATHOMS "Kvadrat fathoms" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "Kvadrat fathoms (Hungary)" + IDS_AREA_SQUARE_FEET "Kvadrat fot" + IDS_AREA_SQUARE_INCHES "Kvadrat tum" + IDS_AREA_SQUARE_KILOMETERS "Kvadrat kilometer" + IDS_AREA_SQUARE_LAR "kvadrat lar" + IDS_AREA_SQUARE_METER "Kvadrat meter" + IDS_AREA_SQUARE_MILES "Kvadrat mil" + IDS_AREA_SQUARE_MILLIMETERS "Kvadrat millimeter" + IDS_AREA_SQUARE_SHAKU "Kvadrat shaku" + IDS_AREA_SQUARE_TSUEN "Kvadrat tsuen" + IDS_AREA_SQUARE_VA "Kvadrat va" + IDS_AREA_SQUARE_YARD "Kvadrat yard" + IDS_AREA_TAN "Tan" + IDS_AREA_TSUBO "Tsubo" +END + +// TYPES OF COMSUMPTIONS +STRINGTABLE DISCARDABLE +BEGIN + IDS_CONSUMPTION_KM_PER_L "Kilometer/liter" + IDS_CONSUMPTION_L_PER_100_KM "Liter/100 kilometer" + IDS_CONSUMPTION_MILES_GALLON_UK "Mil/gallon (UK)" + IDS_CONSUMPTION_MILES_GALLON_US "Mil/gallon (US)" +END + +// TYPES OF CURRENCIES +STRINGTABLE DISCARDABLE +BEGIN + IDS_CURRENCY_AUSTRIAN_SCHILLING "Österriksk schilling" + IDS_CURRENCY_BELGIAN_FRANC "Belgisk franc" + IDS_CURRENCY_CYPRIOT_POUND "Cypriotisk pound" + IDS_CURRENCY_CZECH_KORUNA "Tjeckisk koruna" + IDS_CURRENCY_DEUTSCHE_MARK "Tysk Mark" + IDS_CURRENCY_DUTCH_GUILDER "Nederlänsk guilder" + IDS_CURRENCY_EURO "Euro" + IDS_CURRENCY_FINNISH_MARKKA "Finisk mark" + IDS_CURRENCY_FRENCH_FRANC "Fransk franc" + IDS_CURRENCY_GREEK_DRACHMA "Gresk Drachma" + IDS_CURRENCY_IRISH_POUND "Irisk pound" + IDS_CURRENCY_ITALIAN_LIRA "Italiask lire" + IDS_CURRENCY_LUXEMBOURG_FRANC "Luxembourg franc" + IDS_CURRENCY_MALTESE_LIRA "Maltesisk lire" + IDS_CURRENCY_PORTOGUESE_ESCUDO "Portogisisk escudo" + IDS_CURRENCY_SLOVAK_KORUNA "Slovansk koruna" + IDS_CURRENCY_SLOVENIAN_TOLAR "Slovenansk tolar" + IDS_CURRENCY_SPANISH_PESETA "Spansk peseta" +END + +// TYPES OF ENERGIES +STRINGTABLE DISCARDABLE +BEGIN + IDS_ENERGY_15_C_CALORIES "15 °C calories" + IDS_ENERGY_BTUS "Britisk värme-enhet" + IDS_ENERGY_ERGS "Ergs" + IDS_ENERGY_EVS "Electron-Volt" + IDS_ENERGY_FOOT_POUNDS "Fot-Pound" + IDS_ENERGY_IT_CALORIES "International Table Calories" + IDS_ENERGY_IT_KILOCALORIES "International Table Kilocalories" + IDS_ENERGY_JOULES "Joules" + IDS_ENERGY_KILOJOULES "Kilojoules" + IDS_ENERGY_KILOWATT_HOURS "Kilowatt timmar" + IDS_ENERGY_NUTRITION_CALORIES "Närings kalorier" + IDS_ENERGY_TH_CALORIES "Termokemiska kalorier" +END + +// TYPES OF LENGTHS +STRINGTABLE DISCARDABLE +BEGIN + IDS_LENGTH_ANGSTROMS "Ångström" + IDS_LENGTH_ASTRONOMICAL_UNITS "Astronomical units" + IDS_LENGTH_BARLEYCORNS "Barleycorns" + IDS_LENGTH_CENTIMETERS "Centimeter" + IDS_LENGTH_CHAINS_UK "Chains (UK)" + IDS_LENGTH_CHI "Chi" + IDS_LENGTH_CHOU "Chou" + IDS_LENGTH_CHR "Chr" + IDS_LENGTH_CUN "Cun" + IDS_LENGTH_FATHOMS "Fathoms" + IDS_LENGTH_FATHOMS_HUNGARY "Fathoms (Ungarn)" + IDS_LENGTH_FEET "Fot" + IDS_LENGTH_FURLONGS "Furlongs" + IDS_LENGTH_GAN "Gan" + IDS_LENGTH_HANDS "Hand" + IDS_LENGTH_HUNH "Hunh" + IDS_LENGTH_INCHES "Tum" + IDS_LENGTH_JA "Ja" + IDS_LENGTH_JEONG "Jeong" + IDS_LENGTH_KABIET "Kabiet" + IDS_LENGTH_KEN "Ken" + IDS_LENGTH_KEUB "Keub" + IDS_LENGTH_KILOMETERS "Kilometer" + IDS_LENGTH_LAR "Lar" + IDS_LENGTH_LIGHT_YEARS "Ljus år" + IDS_LENGTH_LINKS_UK "Linker (UK)" + IDS_LENGTH_METERS "Meter" + IDS_LENGTH_MICRONS "Micron" + IDS_LENGTH_MILES "Mil" + IDS_LENGTH_MILLIMETERS "Millimeter" + IDS_LENGTH_NAUTICAL_MILES "Nautisk mil" + IDS_LENGTH_NIEU "Nieu" + IDS_LENGTH_PARSECS "Parsecs" + IDS_LENGTH_PICAS "Picas" + IDS_LENGTH_RI_JAPAN "Ri (Japan)" + IDS_LENGTH_RI_KOREA "Ri (Korea)" + IDS_LENGTH_RODS "Rods" + IDS_LENGTH_SAWK "Sawk" + IDS_LENGTH_SEN "Sen" + IDS_LENGTH_SHAKU "Shaku" + IDS_LENGTH_SPAN "Span" + IDS_LENGTH_SUN "Sun" + IDS_LENGTH_TSUEN "Tsuen" + IDS_LENGTH_VA "Va" + IDS_LENGTH_YARDS "Yard" + IDS_LENGTH_YOTE "Yote" + IDS_LENGTH_ZHANG "Zhang" +END + +// TYPES OF POWERS +STRINGTABLE DISCARDABLE +BEGIN + IDS_POWER_BTUS_PER_MINUTE "Britisk värme-enhet per minut" + IDS_POWER_FPS_PER_MINUTE "Fot-pund per minut" + IDS_POWER_HORSEPOWER "Hästekrafter" + IDS_POWER_KILOWATTS "Kilowatt" + IDS_POWER_MEGAWATTS "Megawatt" + IDS_POWER_WATTS "Watt" +END + +// TYPE OF PRESSURES +STRINGTABLE DISCARDABLE +BEGIN + IDS_PRESSURE_ATMOSPHERES "Atmosfär" + IDS_PRESSURE_BARS "Bar" + IDS_PRESSURE_HECTOPASCALS "Hectopascal" + IDS_PRESSURE_KILOPASCALS "Kilopascal" + IDS_PRESSURE_MM_OF_MERCURY "Millimeters kvicksilver" + IDS_PRESSURE_PASCALS "Pascal" + IDS_PRESSURE_PSI "Pond per kvadrattum" +END + +// TYPES OF TEMPERATURES +STRINGTABLE DISCARDABLE +BEGIN + IDS_TEMPERATURE_CELSIUS "Celsius" + IDS_TEMPERATURE_FAHRENHEIT "Fahrenheit" + IDS_TEMPERATURE_KELVIN "Kelvin" + IDS_TEMPERATURE_RANKINE "Rankine" +END + +// TYPES OF TIME +STRINGTABLE DISCARDABLE +BEGIN + IDS_TIME_DAYS "**" + IDS_TIME_HOURS "**" + IDS_TIME_NANOSECONDS "Nanoseconds" + IDS_TIME_MICROSECONDS "**" + IDS_TIME_MILLISECONDS "**" + IDS_TIME_MINUTES "**" + IDS_TIME_SECONDS "**" + IDS_TIME_WEEKS "**" + IDS_TIME_YEARS "**" +END + +// TYPES OF VELOCITIES +STRINGTABLE DISCARDABLE +BEGIN + IDS_VELOCITY_CMS_SECOND "Centimeter/time" + IDS_VELOCITY_FEET_HOUR "Fot/timme" + IDS_VELOCITY_FEET_SECOND "Fot/sekund" + IDS_VELOCITY_KILOMETERS_HOUR "Kilometer/timme" + IDS_VELOCITY_KNOTS "Knop" + IDS_VELOCITY_MACH "Mach" + IDS_VELOCITY_METERS_SECOND "Meter/sekund" + IDS_VELOCITY_MILES_HOUR "Mil/timme" +END + +// TYPES OF VOLUMES +STRINGTABLE DISCARDABLE +BEGIN + IDS_VOLUME_BARRELS_UK "Barrels (UK)" + IDS_VOLUME_BARRELS_OIL "Barrels oil" + IDS_VOLUME_BUN "Bun" + IDS_VOLUME_BUSHELS_UK "Bushels (UK)" + IDS_VOLUME_BUSHELS_US "Bushels (US)" + IDS_VOLUME_CUBIC_CENTIMETERS "Kubikcentimeter" + IDS_VOLUME_CUBIC_FEET "Kubikfot" + IDS_VOLUME_CUBIC_INCHES "Kubiktumm" + IDS_VOLUME_CUBIC_METERS "Kubikmeter" + IDS_VOLUME_CUBIC_YARDS "Kubikyards" + IDS_VOLUME_DOE "Doe" + IDS_VOLUME_FLUID_OUNCES_UK "Fluid ounces (UK)" + IDS_VOLUME_FLUID_OUNCES_US "Fluid ounces (US)" + IDS_VOLUME_GALLONS_UK "Gallons (UK)" + IDS_VOLUME_GALLONS_DRY_US "Gallons, dry (US)" + IDS_VOLUME_GALLONS_LIQUID_US "Gallons, liquid (US)" + IDS_VOLUME_GOU "Gou" + IDS_VOLUME_HOP "Hop" + IDS_VOLUME_ICCE "Icce" + IDS_VOLUME_KWIAN "Kwian" + IDS_VOLUME_LITERS "Liter" + IDS_VOLUME_MAL "Mal" + IDS_VOLUME_MILLILITERS "Milliliter" + IDS_VOLUME_PINTS_UK "Pints (UK)" + IDS_VOLUME_PINTS_DRY_US "Pints, dry (US)" + IDS_VOLUME_PINTS_LIQUID_US "Pints, liquid (US)" + IDS_VOLUME_QUARTS_UK "Quarts (UK)" + IDS_VOLUME_QUARTS_DRY_US "Quarts, dry (US)" + IDS_VOLUME_QUARTS_LIQUID_US "Quarts, liquid (US)" + IDS_VOLUME_SEKI "Seki" + IDS_VOLUME_SYOU "Syou" + IDS_VOLUME_TANANLOUNG "Tananloung" + IDS_VOLUME_TANG "Tang" + IDS_VOLUME_TO "To" +END + +// TYPES OF WEIGHTS +STRINGTABLE DISCARDABLE +BEGIN + IDS_WEIGHT_BAHT "Baht" + IDS_WEIGHT_CARATS "Carats" + IDS_WEIGHT_CHUNG "Chung" + IDS_WEIGHT_DON "Don" + IDS_WEIGHT_GEUN "Geun" + IDS_WEIGHT_GRAMS "Gram" + IDS_WEIGHT_GWAN "Gwan" + IDS_WEIGHT_HARB "Harb" + IDS_WEIGHT_JIN_CHINA "Jin (Kina)" + IDS_WEIGHT_JIN_TAIWAN "Jin (Taiwaner)" + IDS_WEIGHT_KAN "Kan" + IDS_WEIGHT_KILOGRAMS "Kilogram" + IDS_WEIGHT_KIN "Kin" + IDS_WEIGHT_LIANG_CHINA "Liang (Kina)" + IDS_WEIGHT_LIANG_TAIWAN "Liang (Taiwaner)" + IDS_WEIGHT_MONME "Monme" + IDS_WEIGHT_OUNCES_AVOIRDUPOIS "Ounces, avoirdupois" + IDS_WEIGHT_OUNCES_TROY "Ounces, troy" + IDS_WEIGHT_POUNDS "Pund" + IDS_WEIGHT_QUINTAL_METRIC "Quintal (metric)" + IDS_WEIGHT_SALOUNG "Saloung" + IDS_WEIGHT_STONES "Sten" + IDS_WEIGHT_TAMLUNG "Tamlung" + IDS_WEIGHT_TONNES "Ton" + IDS_WEIGHT_TONS_UK "Ton (UK)" + IDS_WEIGHT_TONS_US "Ton (US)" +END Propchange: trunk/reactos/base/applications/calc/lang/sv-SE.rc ------------------------------------------------------------------------------ svn:eol-style = native Propchange: trunk/reactos/base/applications/calc/lang/sv-SE.rc ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: trunk/reactos/base/applications/calc/resource.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/calc/res…
============================================================================== --- trunk/reactos/base/applications/calc/resource.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/calc/resource.rc [iso-8859-1] Sat Apr 16 22:29:55 2011 @@ -60,5 +60,6 @@ #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" #include "lang/sk-SK.rc" +#include "lang/sv-SE.rc" #include "lang/th-TH.rc" #include "lang/uk-UA.rc"
13 years, 8 months
1
0
0
0
[osiejka] 51370: [VIDEOPRT] - Fix whitespace and logic order (formatting only). Patch by Thomas Faber See issue #6123 for more details.
by osiejka@svn.reactos.org
Author: osiejka Date: Sat Apr 16 22:16:25 2011 New Revision: 51370 URL:
http://svn.reactos.org/svn/reactos?rev=51370&view=rev
Log: [VIDEOPRT] - Fix whitespace and logic order (formatting only). Patch by Thomas Faber See issue #6123 for more details. Modified: trunk/reactos/drivers/video/videoprt/videoprt.c Modified: trunk/reactos/drivers/video/videoprt/videoprt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/videoprt/vid…
============================================================================== --- trunk/reactos/drivers/video/videoprt/videoprt.c [iso-8859-1] (original) +++ trunk/reactos/drivers/video/videoprt/videoprt.c [iso-8859-1] Sat Apr 16 22:16:25 2011 @@ -89,13 +89,13 @@ AfterControlSet = *DriverRegistryPath; /* Check if path begins with \\REGISTRY\\MACHINE\\SYSTEM\\ */ Valid = (DriverRegistryPath->Length > sizeof(RegistryMachineSystem) && - 0 == _wcsnicmp(DriverRegistryPath->Buffer, RegistryMachineSystem, + 0 == _wcsnicmp(DriverRegistryPath->Buffer, RegistryMachineSystem, wcslen(RegistryMachineSystem))); if (Valid) { AfterControlSet.Buffer += wcslen(RegistryMachineSystem); AfterControlSet.Length -= sizeof(RegistryMachineSystem) - sizeof(UNICODE_NULL); - + /* Check if path contains CURRENTCONTROLSET */ if (AfterControlSet.Length > sizeof(CurrentControlSet) && 0 == _wcsnicmp(AfterControlSet.Buffer, CurrentControlSet, wcslen(CurrentControlSet))) @@ -110,8 +110,8 @@ AfterControlSet.Buffer += wcslen(ControlSet); AfterControlSet.Length -= sizeof(ControlSet) - sizeof(UNICODE_NULL); while (AfterControlSet.Length > 0 && - L'0' <= *AfterControlSet.Buffer && - L'9' <= *AfterControlSet.Buffer) + *AfterControlSet.Buffer >= L'0' && + *AfterControlSet.Buffer >= L'9') { AfterControlSet.Buffer++; AfterControlSet.Length -= sizeof(WCHAR); @@ -133,21 +133,21 @@ DeviceRegistryPath->Buffer = ExAllocatePoolWithTag(PagedPool, DeviceRegistryPath->MaximumLength, TAG_VIDEO_PORT); - if (NULL != DeviceRegistryPath->Buffer) + if (DeviceRegistryPath->Buffer != NULL) { /* Build device path */ - wcsncpy(DeviceRegistryPath->Buffer, + wcsncpy(DeviceRegistryPath->Buffer, DriverRegistryPath->Buffer, AfterControlSet.Buffer - DriverRegistryPath->Buffer); DeviceRegistryPath->Length = (AfterControlSet.Buffer - DriverRegistryPath->Buffer) * sizeof(WCHAR); RtlAppendUnicodeToString(DeviceRegistryPath, Insert1); RtlAppendUnicodeStringToString(DeviceRegistryPath, &AfterControlSet); RtlAppendUnicodeToString(DeviceRegistryPath, Insert2); - + /* Check if registry key exists */ Valid = NT_SUCCESS(RtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE, DriverRegistryPath->Buffer)); - - if(!Valid) + + if (!Valid) ExFreePoolWithTag(DeviceRegistryPath->Buffer, TAG_VIDEO_PORT); } else @@ -168,14 +168,14 @@ NonPagedPool, DeviceRegistryPath->MaximumLength, TAG_VIDEO_PORT); - + if (!DeviceRegistryPath->Buffer) return STATUS_NO_MEMORY; - + RtlCopyUnicodeString(DeviceRegistryPath, DriverRegistryPath); RtlAppendUnicodeToString(DeviceRegistryPath, Insert2); } - + return STATUS_SUCCESS; }
13 years, 8 months
1
0
0
0
[janderwald] 51369: [USBEHCI_NEW] - Implement IDMAMemoryManager interface, with IDMAMemoryManager::Allocate, IDMAMemoryManager::Free - Fix interface of IDMAMemoryManager - Will be used by IUSBHardw...
by janderwald@svn.reactos.org
Author: janderwald Date: Sat Apr 16 12:26:06 2011 New Revision: 51369 URL:
http://svn.reactos.org/svn/reactos?rev=51369&view=rev
Log: [USBEHCI_NEW] - Implement IDMAMemoryManager interface, with IDMAMemoryManager::Allocate, IDMAMemoryManager::Free - Fix interface of IDMAMemoryManager - Will be used by IUSBHardwareDevice Added: branches/usb-bringup/drivers/usb/usbehci_new/memory_manager.cpp (with props) Modified: branches/usb-bringup/drivers/usb/usbehci_new/CMakeLists.txt branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h Modified: branches/usb-bringup/drivers/usb/usbehci_new/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/CMakeLists.txt [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/CMakeLists.txt [iso-8859-1] Sat Apr 16 12:26:06 2011 @@ -11,6 +11,7 @@ misc.cpp purecall.cpp hub_controller.cpp + memory_manager.cpp usbehci.rc) target_link_libraries(usbehci Modified: branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] Sat Apr 16 12:26:06 2011 @@ -253,7 +253,7 @@ virtual NTSTATUS Allocate(IN ULONG Size, OUT PVOID *OutVirtualBase, - OUT PPHYSICAL_ADDRESS *OutPhysicalAddress) = 0; + OUT PPHYSICAL_ADDRESS OutPhysicalAddress) = 0; //----------------------------------------------------------------------------------------- Added: branches/usb-bringup/drivers/usb/usbehci_new/memory_manager.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/memory_manager.cpp (added) +++ branches/usb-bringup/drivers/usb/usbehci_new/memory_manager.cpp [iso-8859-1] Sat Apr 16 12:26:06 2011 @@ -1,0 +1,339 @@ +/* + * PROJECT: ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface + * LICENSE: GPL - See COPYING in the top level directory + * FILE: drivers/usb/usbehci/memory_manager.cpp + * PURPOSE: USB EHCI device driver. + * PROGRAMMERS: + * Michael Martin (michael.martin(a)reactos.org) + * Johannes Anderwald (johannes.anderwald(a)reactos.org) + */ + +#include "usbehci.h" + +class CDMAMemoryManager : public IDMAMemoryManager +{ +public: + STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface); + + STDMETHODIMP_(ULONG) AddRef() + { + InterlockedIncrement(&m_Ref); + return m_Ref; + } + STDMETHODIMP_(ULONG) Release() + { + InterlockedDecrement(&m_Ref); + + if (!m_Ref) + { + delete this; + return 0; + } + return m_Ref; + } + + // IDMAMemoryManager interface functions + virtual NTSTATUS Initialize(IN PUSBHARDWAREDEVICE Device, IN PKSPIN_LOCK Lock, IN ULONG DmaBufferSize, IN PVOID VirtualBase, IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG DefaultBlockSize); + virtual NTSTATUS Allocate(IN ULONG Size, OUT PVOID *OutVirtualBase, OUT PPHYSICAL_ADDRESS OutPhysicalAddress); + virtual NTSTATUS Release(IN PVOID VirtualBase, IN ULONG Size); + + // constructor / destructor + CDMAMemoryManager(IUnknown *OuterUnknown){} + virtual ~CDMAMemoryManager(){} + +protected: + LONG m_Ref; + PUSBHARDWAREDEVICE m_Device; + PKSPIN_LOCK m_Lock; + LONG m_DmaBufferSize; + PVOID m_VirtualBase; + PHYSICAL_ADDRESS m_PhysicalAddress; + ULONG m_BlockSize; + + PULONG m_BitmapBuffer; + RTL_BITMAP m_Bitmap; +}; + +//---------------------------------------------------------------------------------------- +NTSTATUS +STDMETHODCALLTYPE +CDMAMemoryManager::QueryInterface( + IN REFIID refiid, + OUT PVOID* Output) +{ + return STATUS_UNSUCCESSFUL; +} + +NTSTATUS +CDMAMemoryManager::Initialize( + IN PUSBHARDWAREDEVICE Device, + IN PKSPIN_LOCK Lock, + IN ULONG DmaBufferSize, + IN PVOID VirtualBase, + IN PHYSICAL_ADDRESS PhysicalAddress, + IN ULONG DefaultBlockSize) +{ + ULONG BitmapLength; + + // + // sanity checks + // + PC_ASSERT(DmaBufferSize >= PAGE_SIZE); + PC_ASSERT(DmaBufferSize % PAGE_SIZE == 0); + PC_ASSERT(DefaultBlockSize == 32 || DefaultBlockSize == 64 || DefaultBlockSize == 128); + + // + // calculate bitmap length + // + BitmapLength = (DmaBufferSize / DefaultBlockSize) / sizeof(ULONG); + + // + // allocate bitmap buffer + // + m_BitmapBuffer = (PULONG)ExAllocatePoolWithTag(NonPagedPool, BitmapLength, TAG_USBEHCI); + if (!m_BitmapBuffer) + { + // + // no memory + // + return STATUS_INSUFFICIENT_RESOURCES; + } + + // + // initialize bitmap + // + RtlInitializeBitMap(&m_Bitmap, m_BitmapBuffer, BitmapLength); + + // + // clear all bits + // + RtlClearAllBits(&m_Bitmap); + + // + // initialize rest of memory allocator + // + m_PhysicalAddress = PhysicalAddress; + m_VirtualBase = VirtualBase; + m_DmaBufferSize = DmaBufferSize; + m_BitmapBuffer = m_BitmapBuffer; + m_Lock = Lock; + m_BlockSize = DefaultBlockSize; + + /* done */ + return STATUS_SUCCESS; +} + +NTSTATUS +CDMAMemoryManager::Allocate( + IN ULONG Size, + OUT PVOID *OutVirtualAddress, + OUT PPHYSICAL_ADDRESS OutPhysicalAddress) +{ + ULONG Length, BlockCount, FreeIndex, StartPage, EndPage; + KIRQL OldLevel; + + // + // sanity checks + // + ASSERT(Size < PAGE_SIZE); + ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL); + + // + // align request + // + Length = (Size + m_BlockSize -1) & ~(m_BlockSize -1); + + // + // sanity check + // + ASSERT(Length); + + // + // convert to block count + // + BlockCount = Length / m_BlockSize; + + // + // acquire lock + // + KeAcquireSpinLock(m_Lock, &OldLevel); + + // + // start search + // + FreeIndex = 0; + do + { + // + // search for an free index + // + FreeIndex = RtlFindClearBits(&m_Bitmap, BlockCount, FreeIndex); + + // + // check if there was a block found + // + if (FreeIndex == MAXULONG) + { + // + // no free block found + // + break; + } + + // + // check that the allocation does not spawn over page boundaries + // + StartPage = (FreeIndex * m_BlockSize); + StartPage = (StartPage != 0 ? StartPage / PAGE_SIZE : 0); + EndPage = ((FreeIndex + BlockCount) * m_BlockSize) / PAGE_SIZE; + + // + // does the request start and end on the same page + // + if (StartPage == EndPage) + { + // + // reserve block + // + RtlSetBits(&m_Bitmap, FreeIndex, BlockCount); + + // + // reserve block + // + break; + } + else + { + // + // request spawned over page boundary + // restart search on next page + // + FreeIndex = (EndPage * PAGE_SIZE) / m_BlockSize; + } + } + while(TRUE); + + // + // release lock + // + KeReleaseSpinLock(m_Lock, OldLevel); + + // + // did allocation succeed + // + if (FreeIndex == MAXULONG) + { + // + // failed to allocate block, requestor must retry + // + return STATUS_UNSUCCESSFUL; + } + + // + // return result + // + *OutVirtualAddress = (PVOID)((ULONG_PTR)m_VirtualBase + FreeIndex * m_BlockSize); + OutPhysicalAddress->QuadPart = m_PhysicalAddress.QuadPart + FreeIndex * m_BlockSize; + + // + // clear block + // + RtlZeroMemory(*OutVirtualAddress, Length); + + // + // done + // + return STATUS_SUCCESS; +} + +NTSTATUS +CDMAMemoryManager::Release( + IN PVOID VirtualAddress, + IN ULONG Size) +{ + KIRQL OldLevel; + ULONG BlockOffset = 0, BlockLength; + + // + // sanity checks + // + PC_ASSERT(VirtualAddress); + PC_ASSERT((ULONG_PTR)VirtualAddress >= (ULONG_PTR)m_VirtualBase); + PC_ASSERT((ULONG_PTR)m_VirtualBase + m_DmaBufferSize > (ULONG_PTR)m_VirtualBase); + + // + // calculate block length + // + BlockLength = ((ULONG_PTR)VirtualAddress - (ULONG_PTR)m_VirtualBase); + + // + // check if its the first block + // + if (BlockLength) + { + // + // divide by base block size + // + BlockOffset = BlockLength / m_BlockSize; + } + + // + // align length to block size + // + Size = (Size + m_BlockSize - 1) & ~(m_BlockSize - 1); + + // + // acquire lock + // + KeAcquireSpinLock(m_Lock, &OldLevel); + + // + // release buffer + // + RtlClearBits(&m_Bitmap, BlockOffset, Size); + + // + // release lock + // + KeReleaseSpinLock(m_Lock, OldLevel); + + // + // done + // + return STATUS_SUCCESS; +} + +NTSTATUS +CreateDMAMemoryManager( + PDMAMEMORYMANAGER *OutMemoryManager) +{ + CDMAMemoryManager* This; + + // + // allocate controller + // + This = new(NonPagedPool, TAG_USBEHCI) CDMAMemoryManager(0); + if (!This) + { + // + // failed to allocate + // + return STATUS_INSUFFICIENT_RESOURCES; + } + + // + // add reference count + // + This->AddRef(); + + // + // return result + // + *OutMemoryManager = (PDMAMEMORYMANAGER)This; + + // + // done + // + return STATUS_SUCCESS; +} + Propchange: branches/usb-bringup/drivers/usb/usbehci_new/memory_manager.cpp ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h [iso-8859-1] Sat Apr 16 12:26:06 2011 @@ -62,4 +62,9 @@ // NTSTATUS CreateHubController(PHUBCONTROLLER * OutHubController); +// +// memory_manager.cpp +// +NTSTATUS CreateDMAMemoryManager(PDMAMEMORYMANAGER *OutMemoryManager); + #endif
13 years, 8 months
1
0
0
0
[janderwald] 51368: [USBEHCI_NEW] - Add reference count when the hub controller is created. Necessary to prevent the controller from getting deleted when the hub driver performs interface reference...
by janderwald@svn.reactos.org
Author: janderwald Date: Sat Apr 16 09:47:43 2011 New Revision: 51368 URL:
http://svn.reactos.org/svn/reactos?rev=51368&view=rev
Log: [USBEHCI_NEW] - Add reference count when the hub controller is created. Necessary to prevent the controller from getting deleted when the hub driver performs interface reference removes - Implement IRP_MN_QUERY_ID, based on mjmartin ehci driver - Fix bug in IRP_MN_QUERY_BUS_INFORMATION, it is supposed to return a PNP_BUS_INFORMATION not a simple guid - Implement IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE, IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO, IOCTL_INTERNAL_USB_GET_HUB_COUNT based on mjmartin ehci driver - Add interfaces for communicating with the hub driver - Dispatch internal device requests not wmi requests (EHCI_Dispatch) Modified: branches/usb-bringup/drivers/usb/usbehci_new/hcd_controller.cpp branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp branches/usb-bringup/drivers/usb/usbehci_new/usbehci.cpp Modified: branches/usb-bringup/drivers/usb/usbehci_new/hcd_controller.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/hcd_controller.cpp [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/hcd_controller.cpp [iso-8859-1] Sat Apr 16 09:47:43 2011 @@ -417,6 +417,11 @@ // break; } + + // + // add reference to prevent it from getting deleting while hub driver adds / removes references + // + m_HubController->AddRef(); } if (IoStack->Parameters.QueryDeviceRelations.Type == BusRelations) @@ -511,7 +516,7 @@ } default: { - DPRINT1("CHCDController::HandlePnp Dispatch to lower device object %lu\n", IoStack->MinorFunction); + DPRINT1("CHCDController::HandlePnp Dispatch to lower device object %lx\n", IoStack->MinorFunction); // // forward irp to next device object // Modified: branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/hub_controller.cpp [iso-8859-1] Sat Apr 16 09:47:43 2011 @@ -150,9 +150,13 @@ PIO_STACK_LOCATION IoStack; PCOMMON_DEVICE_EXTENSION DeviceExtension; PDEVICE_CAPABILITIES DeviceCapabilities; - LPGUID Guid; + PPNP_BUS_INFORMATION BusInformation; NTSTATUS Status; - ULONG Index; + ULONG Index = 0, Length; + USHORT VendorID, DeviceID; + ULONG HiSpeed, NumPorts; + WCHAR Buffer[300]; + LPWSTR DeviceName; // // get device extension @@ -178,6 +182,147 @@ // register device interface // Status = SetDeviceInterface(TRUE); + break; + } + case IRP_MN_QUERY_ID: + { + DPRINT1("CHubController::HandlePnp IRP_MN_QUERY_ID Type %x\n", IoStack->Parameters.QueryId.IdType); + + if (IoStack->Parameters.QueryId.IdType == BusQueryDeviceID) + { + if (m_Hardware) + { + // + // query device id + // + Status = m_Hardware->GetDeviceDetails(&VendorID, &DeviceID, &NumPorts, &HiSpeed); + + HiSpeed = TRUE; + + if (HiSpeed) + { + // + // USB 2.0 hub + // + swprintf(Buffer, L"USB\\ROOT_HUB20"); + } + else + { + // + // USB 1.1 hub + // + swprintf(Buffer, L"USB\\ROOT_HUB"); + } + + DPRINT1("Name %S\n", Buffer); + + // + // calculate length + // + Length = (wcslen(Buffer) + 1); + + // + // allocate buffer + // + DeviceName = (LPWSTR)ExAllocatePoolWithTag(PagedPool, Length * sizeof(WCHAR), TAG_USBEHCI); + + if (!DeviceName) + { + // + // no memory + // + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + // + // copy device name + // + wcscpy(DeviceName, Buffer); + + // + // store result + // + Irp->IoStatus.Information = (ULONG_PTR)DeviceName; + Status = STATUS_SUCCESS; + break; + } + Status = STATUS_UNSUCCESSFUL; + PC_ASSERT(0); + break; + } + + if (IoStack->Parameters.QueryId.IdType == BusQueryHardwareIDs) + { + if (m_Hardware) + { + // + // query device id + // + Status = m_Hardware->GetDeviceDetails(&VendorID, &DeviceID, &NumPorts, &HiSpeed); + + HiSpeed = TRUE; + + if (!NT_SUCCESS(Status)) + { + DPRINT1("CHubController::HandlePnp> failed to get hardware id %x\n", Status); + VendorID = 0x8086; + DeviceID = 0x3A37; + } + + if (HiSpeed) + { + // + // USB 2.0 hub + // + Index += swprintf(&Buffer[Index], L"USB\\ROOT_HUB20&VID%04x&PID%04x&REV0000", VendorID, DeviceID) + 1; + Index += swprintf(&Buffer[Index], L"USB\\ROOT_HUB20&VID%04x&PID%04x", VendorID, DeviceID) + 1; + Index += swprintf(&Buffer[Index], L"USB\\ROOT_HUB20") + 1; + } + else + { + // + // USB 1.1 hub + // + Index += swprintf(&Buffer[Index], L"USB\\ROOT_HUB&VID%04x&PID%04x&REV0000", VendorID, DeviceID) + 1; + Index += swprintf(&Buffer[Index], L"USB\\ROOT_HUB&VID%04x&PID%04x", VendorID, DeviceID) + 1; + Index += swprintf(&Buffer[Index], L"USB\\ROOT_HUB") + 1; + } + + Buffer[Index] = UNICODE_NULL; + Index++; + + + DPRINT1("Name %S\n", Buffer); + + // + // allocate buffer + // + DeviceName = (LPWSTR)ExAllocatePoolWithTag(PagedPool, Index * sizeof(WCHAR), TAG_USBEHCI); + + if (!DeviceName) + { + // + // no memory + // + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + // + // copy device name + // + RtlMoveMemory(DeviceName, Buffer, Index * sizeof(WCHAR)); + + // + // store result + // + Irp->IoStatus.Information = (ULONG_PTR)DeviceName; + Status = STATUS_SUCCESS; + break; + } + } + Status = STATUS_SUCCESS; break; } case IRP_MN_QUERY_CAPABILITIES: @@ -246,6 +391,10 @@ // nullify pointer // m_HubControllerDeviceObject = 0; + + // + // done + // return STATUS_SUCCESS; } case IRP_MN_QUERY_BUS_INFORMATION: @@ -253,17 +402,24 @@ DPRINT1("CHubController::HandlePnp IRP_MN_QUERY_BUS_INFORMATION\n"); // - // allocate buffer for bus guid - // - Guid = (LPGUID)ExAllocatePool(PagedPool, sizeof(GUID)); - if (Guid) + // allocate buffer for bus information + // + BusInformation = (PPNP_BUS_INFORMATION)ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION)); + if (BusInformation) { // // copy BUS guid // - RtlMoveMemory(Guid, &GUID_BUS_TYPE_USB, sizeof(GUID)); + RtlMoveMemory(&BusInformation->BusTypeGuid, &GUID_BUS_TYPE_USB, sizeof(GUID)); + + // + // set bus type + // + BusInformation->LegacyBusType = PNPBus; + BusInformation->BusNumber = 0; + Status = STATUS_SUCCESS; - Irp->IoStatus.Information = (ULONG_PTR)Guid; + Irp->IoStatus.Information = (ULONG_PTR)BusInformation; } else { @@ -286,7 +442,7 @@ default: { DPRINT1("CHubController::HandlePnp Unhandeled %x\n", IoStack->MinorFunction); - Status = STATUS_NOT_SUPPORTED; + Status = Irp->IoStatus.Status; break; } } @@ -310,6 +466,8 @@ IN OUT PIRP Irp) { UNIMPLEMENTED + Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_NOT_IMPLEMENTED; } @@ -319,26 +477,567 @@ IN PDEVICE_OBJECT DeviceObject, IN OUT PIRP Irp) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; -} - + PIO_STACK_LOCATION IoStack; + PCOMMON_DEVICE_EXTENSION DeviceExtension; + NTSTATUS Status = STATUS_NOT_IMPLEMENTED; + + // + // get current stack location + // + IoStack = IoGetCurrentIrpStackLocation(Irp); + + // + // get device extension + // + DeviceExtension = (PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + + + DPRINT1("HandleDeviceControl>Type: FDO %u IoCtl %x InputBufferLength %lu OutputBufferLength %lu\n", + DeviceExtension->IsFDO, + IoStack->Parameters.DeviceIoControl.IoControlCode, + IoStack->Parameters.DeviceIoControl.InputBufferLength, + IoStack->Parameters.DeviceIoControl.OutputBufferLength); + + // + // determine which request should be performed + // + switch(IoStack->Parameters.DeviceIoControl.IoControlCode) + { + case IOCTL_INTERNAL_USB_SUBMIT_URB: + { + DPRINT1("IOCTL_INTERNAL_USB_SUBMIT_URB UNIMPLEMENTED\n"); + + // + // request completed + // + Status = STATUS_NOT_IMPLEMENTED; + break; + } + case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE: + { + DPRINT1("IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE\n"); + + if (IoStack->Parameters.Others.Argument1) + { + // + // store object as device handle + // + *(PVOID *)IoStack->Parameters.Others.Argument1 = (PVOID)this; + Status = STATUS_SUCCESS; + } + else + { + // + // mis-behaving hub driver + // + Status = STATUS_INVALID_DEVICE_REQUEST; + } + + // + // request completed + // + break; + } + case IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO: + { + DPRINT1("IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO\n"); + + // + // this is the first request send, it delivers the PDO to the caller + // + if (IoStack->Parameters.Others.Argument1) + { + // + // store root hub pdo object + // + *(PVOID *)IoStack->Parameters.Others.Argument1 = DeviceObject; + } + + if (IoStack->Parameters.Others.Argument2) + { + // + // documentation claims to deliver the hcd controller object, although it is wrong + // + *(PVOID *)IoStack->Parameters.Others.Argument2 = DeviceObject; + } + + // + // request completed + // + Status = STATUS_SUCCESS; + break; + } + case IOCTL_INTERNAL_USB_GET_HUB_COUNT: + { + DPRINT1("IOCTL_INTERNAL_USB_GET_HUB_COUNT\n"); + + // + // after IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO is delivered, the usbhub driver + // requests this ioctl to deliver the number of presents. + + if (IoStack->Parameters.Others.Argument1) + { + // + // FIXME / verify: there is only one hub + // + *(PULONG)IoStack->Parameters.Others.Argument1 = 1; + } + + // + // request completed + // + Status = STATUS_SUCCESS; + Irp->IoStatus.Information = sizeof(ULONG); + break; + } + } + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; +} + +//================================================================================================= +// +// Generic Interface functions +// +VOID +USB_BUSIFFN +USBI_InterfaceReference( + PVOID BusContext) +{ + CHubController * Controller = (CHubController*)BusContext; + + DPRINT1("USBH_InterfaceReference\n"); + + // + // add reference + // + Controller->AddRef(); +} + +VOID +USB_BUSIFFN +USBI_InterfaceDereference( + PVOID BusContext) +{ + CHubController * Controller = (CHubController*)BusContext; + + DPRINT1("USBH_InterfaceDereference\n"); + + // + // release + // + Controller->Release(); +} +//================================================================================================= +// +// USB Hub Interface functions +// +NTSTATUS +USB_BUSIFFN +USBHI_CreateUsbDevice( + PVOID BusContext, + PUSB_DEVICE_HANDLE *NewDevice, + PUSB_DEVICE_HANDLE HubDeviceHandle, + USHORT PortStatus, + USHORT PortNumber) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_InitializeUsbDevice( + PVOID BusContext, + PUSB_DEVICE_HANDLE DeviceHandle) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_GetUsbDescriptors( + PVOID BusContext, + PUSB_DEVICE_HANDLE DeviceHandle, + PUCHAR DeviceDescriptorBuffer, + PULONG DeviceDescriptorBufferLength, + PUCHAR ConfigDescriptorBuffer, + PULONG ConfigDescriptorBufferLength) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_RemoveUsbDevice( + PVOID BusContext, + PUSB_DEVICE_HANDLE DeviceHandle, + ULONG Flags) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_RestoreUsbDevice( + PVOID BusContext, + PUSB_DEVICE_HANDLE OldDeviceHandle, + PUSB_DEVICE_HANDLE NewDeviceHandle) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_GetPortHackFlags( + PVOID BusContext, + PULONG Flags) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_QueryDeviceInformation( + PVOID BusContext, + PUSB_DEVICE_HANDLE DeviceHandle, + PVOID DeviceInformationBuffer, + ULONG DeviceInformationBufferLength, + PULONG LengthReturned) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_GetControllerInformation( + PVOID BusContext, + PVOID ControllerInformationBuffer, + ULONG ControllerInformationBufferLength, + PULONG LengthReturned) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_ControllerSelectiveSuspend( + PVOID BusContext, + BOOLEAN Enable) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_GetExtendedHubInformation( + PVOID BusContext, + PDEVICE_OBJECT HubPhysicalDeviceObject, + PVOID HubInformationBuffer, + ULONG HubInformationBufferLength, + PULONG LengthReturned) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_GetRootHubSymbolicName( + PVOID BusContext, + PVOID HubSymNameBuffer, + ULONG HubSymNameBufferLength, + PULONG HubSymNameActualLength) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +PVOID +USB_BUSIFFN +USBHI_GetDeviceBusContext( + PVOID HubBusContext, + PVOID DeviceHandle) +{ + UNIMPLEMENTED + return NULL; +} + +NTSTATUS +USB_BUSIFFN +USBHI_Initialize20Hub( + PVOID BusContext, + PUSB_DEVICE_HANDLE HubDeviceHandle, + ULONG TtCount) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBHI_RootHubInitNotification( + PVOID BusContext, + PVOID CallbackContext, + PRH_INIT_CALLBACK CallbackRoutine) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +VOID +USB_BUSIFFN +USBHI_FlushTransfers( + PVOID BusContext, + PVOID DeviceHandle) +{ + UNIMPLEMENTED +} + +VOID +USB_BUSIFFN +USBHI_SetDeviceHandleData( + PVOID BusContext, + PVOID DeviceHandle, + PDEVICE_OBJECT UsbDevicePdo) +{ + UNIMPLEMENTED +} + +//================================================================================================= +// +// USB Device Interface functions +// + +VOID +USB_BUSIFFN +USBDI_GetUSBDIVersion( + PVOID BusContext, + PUSBD_VERSION_INFORMATION VersionInformation, + PULONG HcdCapabilites) +{ + UNIMPLEMENTED +} + +NTSTATUS +USB_BUSIFFN +USBDI_QueryBusTime( + PVOID BusContext, + PULONG CurrentFrame) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBDI_SubmitIsoOutUrb( + PVOID BusContext, + PURB Urb) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +USB_BUSIFFN +USBDI_QueryBusInformation( + PVOID BusContext, + ULONG Level, + PVOID BusInformationBuffer, + PULONG BusInformationBufferLength, + PULONG BusInformationActualLength) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + +BOOLEAN +USB_BUSIFFN +USBDI_IsDeviceHighSpeed( + PVOID BusContext) +{ + UNIMPLEMENTED + return TRUE; +} + +NTSTATUS +USB_BUSIFFN +USBDI_EnumLogEntry( + PVOID BusContext, + ULONG DriverTag, + ULONG EnumTag, + ULONG P1, + ULONG P2) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} NTSTATUS CHubController::HandleQueryInterface( PIO_STACK_LOCATION IoStack) { + PUSB_BUS_INTERFACE_HUB_V5 InterfaceHub; + PUSB_BUS_INTERFACE_USBDI_V2 InterfaceDI; UNICODE_STRING GuidBuffer; NTSTATUS Status; if (IsEqualGUIDAligned(*IoStack->Parameters.QueryInterface.InterfaceType, USB_BUS_INTERFACE_HUB_GUID)) { - DPRINT1("HandleQueryInterface> UNIMPLEMENTED USB_BUS_INTERFACE_HUB_GUID Version %x\n", IoStack->Parameters.QueryInterface.Version); - + // + // get request parameters + // + InterfaceHub = (PUSB_BUS_INTERFACE_HUB_V5)IoStack->Parameters.QueryInterface.Interface; + InterfaceHub->Version = IoStack->Parameters.QueryInterface.Version; + + // + // check version + // + if (IoStack->Parameters.QueryInterface.Version >= 6) + { + DPRINT1("USB_BUS_INTERFACE_HUB_GUID version %x not supported!\n", IoStack->Parameters.QueryInterface.Version); + + // + // version not supported + // + return STATUS_NOT_SUPPORTED; + } + + // + // Interface version 0 + // + if (IoStack->Parameters.QueryInterface.Version >= 0) + { + InterfaceHub->Size = IoStack->Parameters.QueryInterface.Size; + InterfaceHub->BusContext = PVOID(this); + InterfaceHub->InterfaceReference = USBI_InterfaceReference; + InterfaceHub->InterfaceDereference = USBI_InterfaceDereference; + } + + // + // Interface version 1 + // + if (IoStack->Parameters.QueryInterface.Version >= 1) + { + InterfaceHub->CreateUsbDevice = USBHI_CreateUsbDevice; + InterfaceHub->InitializeUsbDevice = USBHI_InitializeUsbDevice; + InterfaceHub->GetUsbDescriptors = USBHI_GetUsbDescriptors; + InterfaceHub->RemoveUsbDevice = USBHI_RemoveUsbDevice; + InterfaceHub->RestoreUsbDevice = USBHI_RestoreUsbDevice; + InterfaceHub->GetPortHackFlags = USBHI_GetPortHackFlags; + InterfaceHub->QueryDeviceInformation = USBHI_QueryDeviceInformation; + } + + // + // Interface version 2 + // + if (IoStack->Parameters.QueryInterface.Version >= 2) + { + InterfaceHub->GetControllerInformation = USBHI_GetControllerInformation; + InterfaceHub->ControllerSelectiveSuspend = USBHI_ControllerSelectiveSuspend; + InterfaceHub->GetExtendedHubInformation = USBHI_GetExtendedHubInformation; + InterfaceHub->GetRootHubSymbolicName = USBHI_GetRootHubSymbolicName; + InterfaceHub->GetDeviceBusContext = USBHI_GetDeviceBusContext; + InterfaceHub->Initialize20Hub = USBHI_Initialize20Hub; + + } + + // + // Interface version 3 + // + if (IoStack->Parameters.QueryInterface.Version >= 3) + { + InterfaceHub->RootHubInitNotification = USBHI_RootHubInitNotification; + } + + // + // Interface version 4 + // + if (IoStack->Parameters.QueryInterface.Version >= 4) + { + InterfaceHub->FlushTransfers = USBHI_FlushTransfers; + } + + // + // Interface version 5 + // + if (IoStack->Parameters.QueryInterface.Version >= 5) + { + InterfaceHub->SetDeviceHandleData = USBHI_SetDeviceHandleData; + } + + // + // request completed + // + return STATUS_SUCCESS; } else if (IsEqualGUIDAligned(*IoStack->Parameters.QueryInterface.InterfaceType, USB_BUS_INTERFACE_USBDI_GUID)) { - DPRINT1("HandleQueryInterface> UNIMPLEMENTED USB_BUS_INTERFACE_USBDI_GUID Version %x\n", IoStack->Parameters.QueryInterface.Version); + // + // get request parameters + // + InterfaceDI = (PUSB_BUS_INTERFACE_USBDI_V2) IoStack->Parameters.QueryInterface.Interface; + InterfaceDI->Version = IoStack->Parameters.QueryInterface.Version; + + // + // check version + // + if (IoStack->Parameters.QueryInterface.Version >= 3) + { + DPRINT1("USB_BUS_INTERFACE_USBDI_GUID version %x not supported!\n", IoStack->Parameters.QueryInterface.Version); + + // + // version not supported + // + return STATUS_NOT_SUPPORTED; + } + + // + // interface version 0 + // + if (IoStack->Parameters.QueryInterface.Version >= 0) + { + InterfaceDI->Size = IoStack->Parameters.QueryInterface.Size; + InterfaceDI->BusContext = PVOID(this); + InterfaceDI->InterfaceReference = USBI_InterfaceReference; + InterfaceDI->InterfaceDereference = USBI_InterfaceDereference; + InterfaceDI->GetUSBDIVersion = USBDI_GetUSBDIVersion; + InterfaceDI->QueryBusTime = USBDI_QueryBusTime; + InterfaceDI->SubmitIsoOutUrb = USBDI_SubmitIsoOutUrb; + InterfaceDI->QueryBusInformation = USBDI_QueryBusInformation; + } + + // + // interface version 1 + // + if (IoStack->Parameters.QueryInterface.Version >= 1) + { + InterfaceDI->IsDeviceHighSpeed = USBDI_IsDeviceHighSpeed; + } + + // + // interface version 2 + // + if (IoStack->Parameters.QueryInterface.Version >= 2) + { + InterfaceDI->EnumLogEntry = USBDI_EnumLogEntry; + } + + // + // request completed + // + return STATUS_SUCCESS; } else { @@ -351,7 +1050,7 @@ // // print interface // - DPRINT1("HandleQueryInterface GUID: %wZ Version %x\n", &GuidBuffer, IoStack->Parameters.QueryInterface.Version); + DPRINT1("HandleQueryInterface UNKNOWN INTERFACE GUID: %wZ Version %x\n", &GuidBuffer, IoStack->Parameters.QueryInterface.Version); // // free guid buffer Modified: branches/usb-bringup/drivers/usb/usbehci_new/usbehci.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/usbehci.cpp [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/usbehci.cpp [iso-8859-1] Sat Apr 16 09:47:43 2011 @@ -98,7 +98,7 @@ // return DeviceExtension->Dispatcher->HandlePower(DeviceObject, Irp); } - case IRP_MJ_SYSTEM_CONTROL: + case IRP_MJ_INTERNAL_DEVICE_CONTROL: case IRP_MJ_DEVICE_CONTROL: { //
13 years, 8 months
1
0
0
0
[mjmartin] 51367: [USBEHCI_NEW] - Change VendorId and DeviceId to the same size as PciConfig members, PUSHORT. - Add support function GetBusInterface. - Implement GetDeviceDetails and ResetPort.
by mjmartin@svn.reactos.org
Author: mjmartin Date: Sat Apr 16 06:59:45 2011 New Revision: 51367 URL:
http://svn.reactos.org/svn/reactos?rev=51367&view=rev
Log: [USBEHCI_NEW] - Change VendorId and DeviceId to the same size as PciConfig members, PUSHORT. - Add support function GetBusInterface. - Implement GetDeviceDetails and ResetPort. Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h branches/usb-bringup/drivers/usb/usbehci_new/misc.cpp branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] Sat Apr 16 06:59:45 2011 @@ -51,7 +51,7 @@ NTSTATUS PnpStart(PCM_RESOURCE_LIST RawResources, PCM_RESOURCE_LIST TranslatedResources); NTSTATUS PnpStop(void); NTSTATUS HandlePower(PIRP Irp); - NTSTATUS GetDeviceDetails(PULONG VendorId, PULONG DeviceId, PULONG NumberOfPorts, PULONG Speed); + NTSTATUS GetDeviceDetails(PUSHORT VendorId, PUSHORT DeviceId, PULONG NumberOfPorts, PULONG Speed); NTSTATUS GetDmaMemoryManager(OUT struct IDMAMemoryManager **OutMemoryManager); NTSTATUS GetUSBQueue(OUT struct IUSBQueue **OutUsbQueue); NTSTATUS StartController(); @@ -85,6 +85,8 @@ ULONG m_MapRegisters; PQUEUE_HEAD m_AsyncListQueueHead; EHCI_CAPS m_Capabilities; + USHORT m_VendorID; + USHORT m_DeviceID; VOID SetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd); VOID GetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd); @@ -118,6 +120,10 @@ PDEVICE_OBJECT PhysicalDeviceObject, PDEVICE_OBJECT LowerDeviceObject) { + BUS_INTERFACE_STANDARD BusInterface; + PCI_COMMON_CONFIG PciConfig; + NTSTATUS Status; + ULONG BytesRead; DPRINT1("CUSBHardwareDevice::Initialize\n"); @@ -133,6 +139,36 @@ // initialize device lock // KeInitializeSpinLock(&m_Lock); + + m_VendorID = 0; + m_DeviceID = 0; + + Status = GetBusInterface(PhysicalDeviceObject, &BusInterface); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to get BusInteface!\n"); + return Status; + } + + BytesRead = (*BusInterface.GetBusData)(BusInterface.Context, + PCI_WHICHSPACE_CONFIG, + &PciConfig, + 0, + PCI_COMMON_HDR_LENGTH); + + if (BytesRead != PCI_COMMON_HDR_LENGTH) + { + DPRINT1("Failed to get pci config information!\n"); + return STATUS_SUCCESS; + } + + if (!(PciConfig.Command & PCI_ENABLE_BUS_MASTER)) + { + DPRINT1("PCI Configuration shows this as a non Bus Mastering device!\n"); + } + + m_VendorID = PciConfig.VendorID; + m_DeviceID = PciConfig.DeviceID; return STATUS_SUCCESS; } @@ -314,24 +350,26 @@ NTSTATUS CUSBHardwareDevice::GetDeviceDetails( - OUT OPTIONAL PULONG VendorId, - OUT OPTIONAL PULONG DeviceId, + OUT OPTIONAL PUSHORT VendorId, + OUT OPTIONAL PUSHORT DeviceId, OUT OPTIONAL PULONG NumberOfPorts, OUT OPTIONAL PULONG Speed) { + *VendorId = m_VendorID; + *DeviceId = m_DeviceID; + *NumberOfPorts = m_Capabilities.HCSParams.PortCount; + //FIXME: What to returned here? + *Speed = 0; + return STATUS_SUCCESS; +} + +NTSTATUS +CUSBHardwareDevice::GetDmaMemoryManager( + OUT struct IDMAMemoryManager **OutMemoryManager) +{ UNIMPLEMENTED return STATUS_NOT_IMPLEMENTED; } - - -NTSTATUS -CUSBHardwareDevice::GetDmaMemoryManager( - OUT struct IDMAMemoryManager **OutMemoryManager) -{ - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; -} - NTSTATUS CUSBHardwareDevice::GetUSBQueue( @@ -392,7 +430,7 @@ // // FIXME: Assign the AsyncList Register // - + // // Set Schedules to Enable and Interrupt Threshold to 1ms. // @@ -403,7 +441,7 @@ UsbCmd.IntThreshold = 1; // FIXME: Set framelistsize when periodic is implemented. SetCommandRegister(&UsbCmd); - + // // Enable Interrupts and start execution // @@ -412,7 +450,7 @@ UsbCmd.Run = TRUE; SetCommandRegister(&UsbCmd); - + // // Wait for execution to start // @@ -420,7 +458,7 @@ { KeStallExecutionProcessor(10); UsbSts = EHCI_READ_REGISTER_ULONG(EHCI_USBSTS); - + if (!(UsbSts & EHCI_STS_HALT)) { break; @@ -450,7 +488,7 @@ // // Disable Interrupts and stop execution EHCI_WRITE_REGISTER_ULONG (EHCI_USBINTR, 0); - + GetCommandRegister(&UsbCmd); UsbCmd.Run = FALSE; SetCommandRegister(&UsbCmd); @@ -470,7 +508,7 @@ DPRINT1("EHCI ERROR: Controller is not responding to Stop request!\n"); return STATUS_UNSUCCESSFUL; } - + return STATUS_SUCCESS; } @@ -485,8 +523,44 @@ CUSBHardwareDevice::ResetPort( IN ULONG PortIndex) { - UNIMPLEMENTED - return STATUS_NOT_IMPLEMENTED; + ULONG PortStatus; + + PortStatus = EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * PortIndex)); + if (PortStatus & EHCI_PRT_SLOWSPEEDLINE) + { + DPRINT1("Non HighSpeed device. Releasing Ownership\n"); + EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * PortIndex), EHCI_PRT_RELEASEOWNERSHIP); + return STATUS_DEVICE_NOT_CONNECTED; + } + + // + // Reset and clean enable + // + PortStatus |= EHCI_PRT_RESET; + PortStatus &= ~EHCI_PRT_ENABLED; + EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * PortIndex), PortStatus); + + KeStallExecutionProcessor(100); + + // + // Clear reset + // + PortStatus = EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * PortIndex)); + PortStatus &= ~EHCI_PRT_RESET; + EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * PortIndex), PortStatus); + + KeStallExecutionProcessor(100); + + // + // Check that the port reset + // + PortStatus = EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * PortIndex)); + if (PortStatus & EHCI_PRT_RESET) + { + DPRINT1("Port did not reset\n"); + return STATUS_RETRY; + } + return STATUS_SUCCESS; } KIRQL @@ -524,26 +598,26 @@ This = (CUSBHardwareDevice*) ServiceContext; CStatus = This->EHCI_READ_REGISTER_ULONG(EHCI_USBSTS); - + CStatus &= (EHCI_ERROR_INT | EHCI_STS_INT | EHCI_STS_IAA | EHCI_STS_PCD | EHCI_STS_FLR); // // Check that it belongs to EHCI // if (!CStatus) return FALSE; - + // // Clear the Status // This->EHCI_WRITE_REGISTER_ULONG(EHCI_USBSTS, CStatus); - + if (CStatus & EHCI_STS_FATAL) { This->StopController(); DPRINT1("EHCI: Host System Error!\n"); return TRUE; } - + if (CStatus & EHCI_ERROR_INT) { DPRINT1("EHCI Status = 0x%x\n", CStatus); @@ -572,13 +646,13 @@ This = (CUSBHardwareDevice*) SystemArgument1; CStatus = (ULONG) SystemArgument2; - + if (CStatus & EHCI_STS_PCD) { for (i = 0; i < This->m_Capabilities.HCSParams.PortCount; i++) { PortStatus = This->EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * i)); - + // // Device connected or removed // @@ -592,7 +666,7 @@ if (PortStatus & EHCI_PRT_CONNECTED) { DPRINT1("Device connected on port %d\n", i); - + // //FIXME: Determine device speed // @@ -602,14 +676,14 @@ { DPRINT1("Misbeaving controller. Port should be disabled at this point\n"); } - + if (PortStatus & EHCI_PRT_SLOWSPEEDLINE) { DPRINT1("Non HighSeped device connected. Release ownership\n"); This->EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * i), EHCI_PRT_RELEASEOWNERSHIP); continue; } - + // // FIXME: Is a port reset needed, or does hub driver request this? // @@ -619,7 +693,7 @@ { DPRINT1("Device disconnected on port %d\n", i); } - + // // FIXME: This needs to be saved somewhere // Modified: branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] Sat Apr 16 06:59:45 2011 @@ -157,8 +157,8 @@ // // Description: returns the device details such as vendor id, device id, number of ports and speed - virtual NTSTATUS GetDeviceDetails(OUT OPTIONAL PULONG VendorId, - OUT OPTIONAL PULONG DeviceId, + virtual NTSTATUS GetDeviceDetails(OUT OPTIONAL PUSHORT VendorId, + OUT OPTIONAL PUSHORT DeviceId, OUT OPTIONAL PULONG NumberOfPorts, OUT OPTIONAL PULONG Speed) = 0; Modified: branches/usb-bringup/drivers/usb/usbehci_new/misc.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/misc.cpp [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/misc.cpp [iso-8859-1] Sat Apr 16 06:59:45 2011 @@ -80,3 +80,52 @@ return Status; } +NTSTATUS NTAPI +GetBusInterface(PDEVICE_OBJECT DeviceObject, PBUS_INTERFACE_STANDARD busInterface) +{ + KEVENT Event; + NTSTATUS Status; + PIRP Irp; + IO_STATUS_BLOCK IoStatus; + PIO_STACK_LOCATION Stack; + + if ((!DeviceObject) || (!busInterface)) + return STATUS_UNSUCCESSFUL; + + KeInitializeEvent(&Event, NotificationEvent, FALSE); + + Irp = IoBuildSynchronousFsdRequest(IRP_MJ_PNP, + DeviceObject, + NULL, + 0, + NULL, + &Event, + &IoStatus); + + if (Irp == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + + Stack=IoGetNextIrpStackLocation(Irp); + Stack->MajorFunction = IRP_MJ_PNP; + Stack->MinorFunction = IRP_MN_QUERY_INTERFACE; + Stack->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD); + Stack->Parameters.QueryInterface.InterfaceType = (LPGUID)&GUID_BUS_INTERFACE_STANDARD; + Stack->Parameters.QueryInterface.Version = 1; + Stack->Parameters.QueryInterface.Interface = (PINTERFACE)busInterface; + Stack->Parameters.QueryInterface.InterfaceSpecificData = NULL; + Irp->IoStatus.Status=STATUS_NOT_SUPPORTED ; + + Status=IoCallDriver(DeviceObject, Irp); + + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); + + Status=IoStatus.Status; + } + + return Status; +} + Modified: branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/usbehci.h [iso-8859-1] Sat Apr 16 06:59:45 2011 @@ -55,6 +55,8 @@ // NTSTATUS NTAPI SyncForwardIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp); +NTSTATUS NTAPI GetBusInterface(PDEVICE_OBJECT DeviceObject, PBUS_INTERFACE_STANDARD busInterface); + // // root_hub_controller.cpp //
13 years, 8 months
1
0
0
0
[mjmartin] 51366: [USBEHCI_NEW] - Add flags for Port Status Control Register and remove structiures for Port Status Control Register. - Remove USB Status Register and use the flags instead. - Remov...
by mjmartin@svn.reactos.org
Author: mjmartin Date: Sat Apr 16 05:55:02 2011 New Revision: 51366 URL:
http://svn.reactos.org/svn/reactos?rev=51366&view=rev
Log: [USBEHCI_NEW] - Add flags for Port Status Control Register and remove structiures for Port Status Control Register. - Remove USB Status Register and use the flags instead. - Remove functions that are not used and never will be. - Implement InterruptServiceRoutine and Deffered Procedure Routine. - Partially implement port status change to detect device insert and removal. Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp branches/usb-bringup/drivers/usb/usbehci_new/hardware.h Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] Sat Apr 16 05:55:02 2011 @@ -17,6 +17,13 @@ InterruptServiceRoutine( IN PKINTERRUPT Interrupt, IN PVOID ServiceContext); + +VOID NTAPI +EhciDefferedRoutine( + IN PKDPC Dpc, + IN PVOID DeferredContext, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2); class CUSBHardwareDevice : public IUSBHardwareDevice { @@ -58,6 +65,7 @@ // friend function friend BOOLEAN NTAPI InterruptServiceRoutine(IN PKINTERRUPT Interrupt, IN PVOID ServiceContext); + friend VOID NTAPI EhciDefferedRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2); // constructor / destructor CUSBHardwareDevice(IUnknown *OuterUnknown){} @@ -71,24 +79,17 @@ PDEVICE_OBJECT m_NextDeviceObject; KSPIN_LOCK m_Lock; PKINTERRUPT m_Interrupt; + KDPC m_IntDpcObject; PULONG m_Base; PDMA_ADAPTER m_Adapter; ULONG m_MapRegisters; - PQUEUE_HEAD AsyncListQueueHead; + PQUEUE_HEAD m_AsyncListQueueHead; EHCI_CAPS m_Capabilities; VOID SetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd); VOID GetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd); - VOID SetStatusRegister(PEHCI_USBSTS_CONTENT UsbSts); - VOID GetStatusRegister(PEHCI_USBSTS_CONTENT UsbSts); - //VOID SetPortRegister(PEHCI_USBPORTSC_CONTENT UsbPort); - //VOID GetPortRegister(PEHCI_USBPORTSC_CONTENT UsbPort); ULONG EHCI_READ_REGISTER_ULONG(ULONG Offset); - ULONG EHCI_READ_REGISTER_USHORT(ULONG Offset); - ULONG EHCI_READ_REGISTER_UCHAR(ULONG Offset); VOID EHCI_WRITE_REGISTER_ULONG(ULONG Offset, ULONG Value); - VOID EHCI_WRITE_REGISTER_USHORT(ULONG Offset, ULONG Value); - VOID EHCI_WRITE_REGISTER_UCHAR(ULONG Offset, ULONG Value); }; //================================================================================================= @@ -152,57 +153,16 @@ *Register = READ_REGISTER_ULONG((PULONG)((ULONG)m_Base + EHCI_USBCMD)); } - -VOID -CUSBHardwareDevice::SetStatusRegister(PEHCI_USBSTS_CONTENT UsbSts) -{ - PULONG Register; - Register = (PULONG)UsbSts; - WRITE_REGISTER_ULONG((PULONG)((ULONG)m_Base + EHCI_USBSTS), *Register); -} - -VOID -CUSBHardwareDevice::GetStatusRegister(PEHCI_USBSTS_CONTENT UsbSts) -{ - PULONG CmdRegister; - CmdRegister = (PULONG)UsbSts; - *CmdRegister = READ_REGISTER_ULONG((PULONG)((ULONG)m_Base + EHCI_USBSTS)); -} - ULONG CUSBHardwareDevice::EHCI_READ_REGISTER_ULONG(ULONG Offset) { return READ_REGISTER_ULONG((PULONG)((ULONG)m_Base + Offset)); } -ULONG -CUSBHardwareDevice::EHCI_READ_REGISTER_USHORT(ULONG Offset) -{ - return READ_REGISTER_USHORT((PUSHORT)((ULONG)m_Base + Offset)); -} - -ULONG -CUSBHardwareDevice::EHCI_READ_REGISTER_UCHAR(ULONG Offset) -{ - return READ_REGISTER_UCHAR((PUCHAR)((ULONG)m_Base + Offset)); -} - VOID CUSBHardwareDevice::EHCI_WRITE_REGISTER_ULONG(ULONG Offset, ULONG Value) { WRITE_REGISTER_ULONG((PULONG)((ULONG)m_Base + Offset), Value); -} - -VOID -CUSBHardwareDevice::EHCI_WRITE_REGISTER_USHORT(ULONG Offset, ULONG Value) -{ - WRITE_REGISTER_USHORT((PUSHORT)((ULONG)m_Base + Offset), Value); -} - -VOID -CUSBHardwareDevice::EHCI_WRITE_REGISTER_UCHAR(ULONG Offset, ULONG Value) -{ - WRITE_REGISTER_UCHAR((PUCHAR)((ULONG)m_Base + Offset), Value); } NTSTATUS @@ -228,6 +188,10 @@ { case CmResourceTypeInterrupt: { + KeInitializeDpc(&m_IntDpcObject, + EhciDefferedRoutine, + this); + Status = IoConnectInterrupt(&m_Interrupt, InterruptServiceRoutine, (PVOID)this, @@ -324,7 +288,7 @@ // // FIXME: Create a QueueHead that will always be the address of the AsyncList // - AsyncListQueueHead = NULL; + m_AsyncListQueueHead = NULL; // // Start the controller @@ -381,20 +345,19 @@ CUSBHardwareDevice::StartController(void) { EHCI_USBCMD_CONTENT UsbCmd; - EHCI_USBSTS_CONTENT UsbSts; - LONG FailSafe; + ULONG UsbSts, FailSafe; // // Stop the controller if its running // - GetStatusRegister(&UsbSts); - if (UsbSts.HCHalted) + UsbSts = EHCI_READ_REGISTER_ULONG(EHCI_USBSTS); + if (!(UsbSts & EHCI_STS_HALT)) StopController(); // // Reset the device. Bit is set to 0 on completion. // - SetCommandRegister(&UsbCmd); + GetCommandRegister(&UsbCmd); UsbCmd.HCReset = TRUE; SetCommandRegister(&UsbCmd); @@ -438,7 +401,7 @@ UsbCmd.AsyncEnable = FALSE; //FIXME: Need USB Memory Manager UsbCmd.IntThreshold = 1; - // FIXME: Set framlistsize when periodic is implemented. + // FIXME: Set framelistsize when periodic is implemented. SetCommandRegister(&UsbCmd); // @@ -456,15 +419,15 @@ for (FailSafe = 100; FailSafe > 1; FailSafe--) { KeStallExecutionProcessor(10); - GetStatusRegister(&UsbSts); + UsbSts = EHCI_READ_REGISTER_ULONG(EHCI_USBSTS); - if (!UsbSts.HCHalted) + if (!(UsbSts & EHCI_STS_HALT)) { break; } } - if (!UsbSts.HCHalted) + if (UsbSts & EHCI_STS_HALT) { DPRINT1("Could not start execution on the controller\n"); return STATUS_UNSUCCESSFUL; @@ -482,8 +445,7 @@ CUSBHardwareDevice::StopController(void) { EHCI_USBCMD_CONTENT UsbCmd; - EHCI_USBSTS_CONTENT UsbSts; - LONG FailSafe; + ULONG UsbSts, FailSafe; // // Disable Interrupts and stop execution @@ -496,14 +458,14 @@ for (FailSafe = 100; FailSafe > 1; FailSafe--) { KeStallExecutionProcessor(10); - GetStatusRegister(&UsbSts); - if (UsbSts.HCHalted) + UsbSts = EHCI_READ_REGISTER_ULONG(EHCI_USBSTS); + if (UsbSts & EHCI_STS_HALT) { break; } } - if (!UsbSts.HCHalted) + if (!(UsbSts & EHCI_STS_HALT)) { DPRINT1("EHCI ERROR: Controller is not responding to Stop request!\n"); return STATUS_UNSUCCESSFUL; @@ -557,8 +519,114 @@ IN PKINTERRUPT Interrupt, IN PVOID ServiceContext) { - UNIMPLEMENTED - return FALSE; + CUSBHardwareDevice *This; + ULONG CStatus; + + This = (CUSBHardwareDevice*) ServiceContext; + CStatus = This->EHCI_READ_REGISTER_ULONG(EHCI_USBSTS); + + CStatus &= (EHCI_ERROR_INT | EHCI_STS_INT | EHCI_STS_IAA | EHCI_STS_PCD | EHCI_STS_FLR); + // + // Check that it belongs to EHCI + // + if (!CStatus) + return FALSE; + + // + // Clear the Status + // + This->EHCI_WRITE_REGISTER_ULONG(EHCI_USBSTS, CStatus); + + if (CStatus & EHCI_STS_FATAL) + { + This->StopController(); + DPRINT1("EHCI: Host System Error!\n"); + return TRUE; + } + + if (CStatus & EHCI_ERROR_INT) + { + DPRINT1("EHCI Status = 0x%x\n", CStatus); + } + + if (CStatus & EHCI_STS_HALT) + { + DPRINT1("Host Error Unexpected Halt\n"); + // FIXME: Reset controller\n"); + return TRUE; + } + + KeInsertQueueDpc(&This->m_IntDpcObject, This, (PVOID)CStatus); + return TRUE; +} + +VOID NTAPI +EhciDefferedRoutine( + IN PKDPC Dpc, + IN PVOID DeferredContext, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2) +{ + CUSBHardwareDevice *This; + ULONG CStatus, PortStatus, i; + + This = (CUSBHardwareDevice*) SystemArgument1; + CStatus = (ULONG) SystemArgument2; + + if (CStatus & EHCI_STS_PCD) + { + for (i = 0; i < This->m_Capabilities.HCSParams.PortCount; i++) + { + PortStatus = This->EHCI_READ_REGISTER_ULONG(EHCI_PORTSC + (4 * i)); + + // + // Device connected or removed + // + if (PortStatus & EHCI_PRT_CONNECTSTATUSCHAGE) + { + // + // Clear the port change status + // + This->EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * i), PortStatus & EHCI_PRT_CONNECTSTATUSCHAGE); + + if (PortStatus & EHCI_PRT_CONNECTED) + { + DPRINT1("Device connected on port %d\n", i); + + // + //FIXME: Determine device speed + // + if (This->m_Capabilities.HCSParams.CHCCount) + { + if (PortStatus & EHCI_PRT_ENABLED) + { + DPRINT1("Misbeaving controller. Port should be disabled at this point\n"); + } + + if (PortStatus & EHCI_PRT_SLOWSPEEDLINE) + { + DPRINT1("Non HighSeped device connected. Release ownership\n"); + This->EHCI_WRITE_REGISTER_ULONG(EHCI_PORTSC + (4 * i), EHCI_PRT_RELEASEOWNERSHIP); + continue; + } + + // + // FIXME: Is a port reset needed, or does hub driver request this? + // + } + } + else + { + DPRINT1("Device disconnected on port %d\n", i); + } + + // + // FIXME: This needs to be saved somewhere + // + } + } + } + return; } NTSTATUS Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/hardware.h [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/hardware.h [iso-8859-1] Sat Apr 16 05:55:02 2011 @@ -41,6 +41,22 @@ #define EHCI_STS_PSS 0x4000 #define EHCI_STS_ASS 0x8000 #define EHCI_ERROR_INT (EHCI_STS_FATAL | EHCI_STS_ERR) + +// +// Port Register Flags +// +#define EHCI_PRT_CONNECTED 0x01 +#define EHCI_PRT_CONNECTSTATUSCHAGE 0x02 +#define EHCI_PRT_ENABLED 0x04 +#define EHCI_PRT_ENABLEDSTATUSCHANGE 0x08 +#define EHCI_PRT_OVERCURRENTACTIVE 0x10 +#define EHCI_PRT_OVERCURRENTCHANGE 0x20 +#define EHCI_PRT_FORCERESUME 0x40 +#define EHCI_PRT_SUSPEND 0x80 +#define EHCI_PRT_RESET 0x100 +#define EHCI_PRT_SLOWSPEEDLINE 0x400 +#define EHCI_PRT_POWER 0x1000 +#define EHCI_PRT_RELEASEOWNERSHIP 0x2000 // // Terminate Pointer used for QueueHeads and Element Transfer Descriptors to mark Pointers as the end @@ -202,41 +218,6 @@ ULONG Reserved2 : 8; } EHCI_USBCMD_CONTENT, *PEHCI_USBCMD_CONTENT; -// -// Status register content -// -typedef struct _EHCI_USBSTS_CONTENT -{ - ULONG USBInterrupt:1; - ULONG ErrorInterrupt:1; - ULONG DetectChangeInterrupt:1; - ULONG FrameListRolloverInterrupt:1; - ULONG HostSystemErrorInterrupt:1; - ULONG AsyncAdvanceInterrupt:1; - ULONG Reserved:6; - ULONG HCHalted:1; - ULONG Reclamation:1; - ULONG PeriodicScheduleStatus:1; - ULONG AsynchronousScheduleStatus:1; -} EHCI_USBSTS_CONTENT, *PEHCI_USBSTS_CONTENT; - -typedef struct _EHCI_USBPORTSC_CONTENT -{ - ULONG CurrentConnectStatus:1; - ULONG ConnectStatusChange:1; - ULONG PortEnabled:1; - ULONG PortEnableChanged:1; - ULONG OverCurrentActive:1; - ULONG OverCurrentChange:1; - ULONG ForcePortResume:1; - ULONG Suspend:1; - ULONG PortReset:1; - ULONG Reserved:1; - ULONG LineStatus:2; - ULONG PortPower:1; - ULONG PortOwner:1; -} EHCI_USBPORTSC_CONTENT, *PEHCI_USBPORTSC_CONTENT; - typedef struct _EHCI_HCS_CONTENT { ULONG PortCount : 4;
13 years, 8 months
1
0
0
0
[mjmartin] 51365: [USBEHCI_NEW] - Add flags and structures needed for communicating with controller and handling schedules. - Add support routines for modifying operational registers on controller....
by mjmartin@svn.reactos.org
Author: mjmartin Date: Sat Apr 16 02:20:23 2011 New Revision: 51365 URL:
http://svn.reactos.org/svn/reactos?rev=51365&view=rev
Log: [USBEHCI_NEW] - Add flags and structures needed for communicating with controller and handling schedules. - Add support routines for modifying operational registers on controller. - Implement getting the controller capabilties, starting and stopping the controller. Added: branches/usb-bringup/drivers/usb/usbehci_new/hardware.h (with props) Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp Modified: branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] (original) +++ branches/usb-bringup/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] Sat Apr 16 02:20:23 2011 @@ -10,6 +10,13 @@ #define INITGUID #include "usbehci.h" +#include "hardware.h" + +BOOLEAN +NTAPI +InterruptServiceRoutine( + IN PKINTERRUPT Interrupt, + IN PVOID ServiceContext); class CUSBHardwareDevice : public IUSBHardwareDevice { @@ -40,6 +47,8 @@ NTSTATUS GetDeviceDetails(PULONG VendorId, PULONG DeviceId, PULONG NumberOfPorts, PULONG Speed); NTSTATUS GetDmaMemoryManager(OUT struct IDMAMemoryManager **OutMemoryManager); NTSTATUS GetUSBQueue(OUT struct IUSBQueue **OutUsbQueue); + NTSTATUS StartController(); + NTSTATUS StopController(); NTSTATUS ResetController(); NTSTATUS ResetPort(ULONG PortIndex); KIRQL AcquireDeviceLock(void); @@ -65,6 +74,21 @@ PULONG m_Base; PDMA_ADAPTER m_Adapter; ULONG m_MapRegisters; + PQUEUE_HEAD AsyncListQueueHead; + EHCI_CAPS m_Capabilities; + + VOID SetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd); + VOID GetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd); + VOID SetStatusRegister(PEHCI_USBSTS_CONTENT UsbSts); + VOID GetStatusRegister(PEHCI_USBSTS_CONTENT UsbSts); + //VOID SetPortRegister(PEHCI_USBPORTSC_CONTENT UsbPort); + //VOID GetPortRegister(PEHCI_USBPORTSC_CONTENT UsbPort); + ULONG EHCI_READ_REGISTER_ULONG(ULONG Offset); + ULONG EHCI_READ_REGISTER_USHORT(ULONG Offset); + ULONG EHCI_READ_REGISTER_UCHAR(ULONG Offset); + VOID EHCI_WRITE_REGISTER_ULONG(ULONG Offset, ULONG Value); + VOID EHCI_WRITE_REGISTER_USHORT(ULONG Offset, ULONG Value); + VOID EHCI_WRITE_REGISTER_UCHAR(ULONG Offset, ULONG Value); }; //================================================================================================= @@ -112,13 +136,81 @@ return STATUS_SUCCESS; } +VOID +CUSBHardwareDevice::SetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd) +{ + PULONG Register; + Register = (PULONG)UsbCmd; + WRITE_REGISTER_ULONG((PULONG)((ULONG)m_Base + EHCI_USBCMD), *Register); +} + +VOID +CUSBHardwareDevice::GetCommandRegister(PEHCI_USBCMD_CONTENT UsbCmd) +{ + PULONG Register; + Register = (PULONG)UsbCmd; + *Register = READ_REGISTER_ULONG((PULONG)((ULONG)m_Base + EHCI_USBCMD)); +} + + +VOID +CUSBHardwareDevice::SetStatusRegister(PEHCI_USBSTS_CONTENT UsbSts) +{ + PULONG Register; + Register = (PULONG)UsbSts; + WRITE_REGISTER_ULONG((PULONG)((ULONG)m_Base + EHCI_USBSTS), *Register); +} + +VOID +CUSBHardwareDevice::GetStatusRegister(PEHCI_USBSTS_CONTENT UsbSts) +{ + PULONG CmdRegister; + CmdRegister = (PULONG)UsbSts; + *CmdRegister = READ_REGISTER_ULONG((PULONG)((ULONG)m_Base + EHCI_USBSTS)); +} + +ULONG +CUSBHardwareDevice::EHCI_READ_REGISTER_ULONG(ULONG Offset) +{ + return READ_REGISTER_ULONG((PULONG)((ULONG)m_Base + Offset)); +} + +ULONG +CUSBHardwareDevice::EHCI_READ_REGISTER_USHORT(ULONG Offset) +{ + return READ_REGISTER_USHORT((PUSHORT)((ULONG)m_Base + Offset)); +} + +ULONG +CUSBHardwareDevice::EHCI_READ_REGISTER_UCHAR(ULONG Offset) +{ + return READ_REGISTER_UCHAR((PUCHAR)((ULONG)m_Base + Offset)); +} + +VOID +CUSBHardwareDevice::EHCI_WRITE_REGISTER_ULONG(ULONG Offset, ULONG Value) +{ + WRITE_REGISTER_ULONG((PULONG)((ULONG)m_Base + Offset), Value); +} + +VOID +CUSBHardwareDevice::EHCI_WRITE_REGISTER_USHORT(ULONG Offset, ULONG Value) +{ + WRITE_REGISTER_USHORT((PUSHORT)((ULONG)m_Base + Offset), Value); +} + +VOID +CUSBHardwareDevice::EHCI_WRITE_REGISTER_UCHAR(ULONG Offset, ULONG Value) +{ + WRITE_REGISTER_UCHAR((PUCHAR)((ULONG)m_Base + Offset), Value); +} NTSTATUS CUSBHardwareDevice::PnpStart( PCM_RESOURCE_LIST RawResources, PCM_RESOURCE_LIST TranslatedResources) { - ULONG Index; + ULONG Index, Count; PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor; DEVICE_DESCRIPTION DeviceDescription; PVOID ResourceBase; @@ -174,8 +266,26 @@ } // - //FIXME: query capabilities and update m_Base + // Get controllers capabilities // + m_Capabilities.Length = READ_REGISTER_UCHAR((PUCHAR)ResourceBase); + m_Capabilities.HCIVersion = READ_REGISTER_USHORT((PUSHORT)((ULONG)ResourceBase + 2)); + m_Capabilities.HCSParamsLong = READ_REGISTER_ULONG((PULONG)((ULONG)ResourceBase + 4)); + m_Capabilities.HCCParamsLong = READ_REGISTER_ULONG((PULONG)((ULONG)ResourceBase + 8)); + + DPRINT1("Controller has %d Ports\n", m_Capabilities.HCSParams.PortCount); + if (m_Capabilities.HCSParams.PortRouteRules) + { + for (Count = 0; Count < m_Capabilities.HCSParams.PortCount; Count++) + { + m_Capabilities.PortRoute[Count] = READ_REGISTER_UCHAR((PUCHAR)(ULONG)ResourceBase + 12 + Count); + } + } + + // + // Set m_Base to the address of Operational Register Space + // + m_Base = (PULONG)((ULONG)ResourceBase + m_Capabilities.Length); break; } } @@ -211,7 +321,16 @@ return STATUS_INSUFFICIENT_RESOURCES; } - return STATUS_SUCCESS; + // + // FIXME: Create a QueueHead that will always be the address of the AsyncList + // + AsyncListQueueHead = NULL; + + // + // Start the controller + // + DPRINT1("Starting Controller\n"); + return StartController(); } NTSTATUS @@ -258,6 +377,140 @@ return STATUS_NOT_IMPLEMENTED; } +NTSTATUS +CUSBHardwareDevice::StartController(void) +{ + EHCI_USBCMD_CONTENT UsbCmd; + EHCI_USBSTS_CONTENT UsbSts; + LONG FailSafe; + + // + // Stop the controller if its running + // + GetStatusRegister(&UsbSts); + if (UsbSts.HCHalted) + StopController(); + + // + // Reset the device. Bit is set to 0 on completion. + // + SetCommandRegister(&UsbCmd); + UsbCmd.HCReset = TRUE; + SetCommandRegister(&UsbCmd); + + // + // Check that the controller reset + // + for (FailSafe = 100; FailSafe > 1; FailSafe--) + { + KeStallExecutionProcessor(10); + GetCommandRegister(&UsbCmd); + if (!UsbCmd.HCReset) + { + break; + } + } + + // + // If the controller did not reset then fail + // + if (UsbCmd.HCReset) + { + DPRINT1("EHCI ERROR: Controller failed to reset. Hardware problem!\n"); + return STATUS_UNSUCCESSFUL; + } + + // + // Disable Interrupts and clear status + // + EHCI_WRITE_REGISTER_ULONG(EHCI_USBINTR, 0); + EHCI_WRITE_REGISTER_ULONG(EHCI_USBSTS, 0x0000001f); + + // + // FIXME: Assign the AsyncList Register + // + + // + // Set Schedules to Enable and Interrupt Threshold to 1ms. + // + GetCommandRegister(&UsbCmd); + UsbCmd.PeriodicEnable = FALSE; + UsbCmd.AsyncEnable = FALSE; //FIXME: Need USB Memory Manager + + UsbCmd.IntThreshold = 1; + // FIXME: Set framlistsize when periodic is implemented. + SetCommandRegister(&UsbCmd); + + // + // Enable Interrupts and start execution + // + EHCI_WRITE_REGISTER_ULONG(EHCI_USBINTR, EHCI_USBINTR_INTE | EHCI_USBINTR_ERR | EHCI_USBINTR_ASYNC | EHCI_USBINTR_HSERR + /*| EHCI_USBINTR_FLROVR*/ | EHCI_USBINTR_PC); + + UsbCmd.Run = TRUE; + SetCommandRegister(&UsbCmd); + + // + // Wait for execution to start + // + for (FailSafe = 100; FailSafe > 1; FailSafe--) + { + KeStallExecutionProcessor(10); + GetStatusRegister(&UsbSts); + + if (!UsbSts.HCHalted) + { + break; + } + } + + if (!UsbSts.HCHalted) + { + DPRINT1("Could not start execution on the controller\n"); + return STATUS_UNSUCCESSFUL; + } + + // + // Set port routing to EHCI controller + // + EHCI_WRITE_REGISTER_ULONG(EHCI_CONFIGFLAG, 1); + DPRINT1("EHCI Started!\n"); + return STATUS_SUCCESS; +} + +NTSTATUS +CUSBHardwareDevice::StopController(void) +{ + EHCI_USBCMD_CONTENT UsbCmd; + EHCI_USBSTS_CONTENT UsbSts; + LONG FailSafe; + + // + // Disable Interrupts and stop execution + EHCI_WRITE_REGISTER_ULONG (EHCI_USBINTR, 0); + + GetCommandRegister(&UsbCmd); + UsbCmd.Run = FALSE; + SetCommandRegister(&UsbCmd); + + for (FailSafe = 100; FailSafe > 1; FailSafe--) + { + KeStallExecutionProcessor(10); + GetStatusRegister(&UsbSts); + if (UsbSts.HCHalted) + { + break; + } + } + + if (!UsbSts.HCHalted) + { + DPRINT1("EHCI ERROR: Controller is not responding to Stop request!\n"); + return STATUS_UNSUCCESSFUL; + } + + return STATUS_SUCCESS; +} NTSTATUS CUSBHardwareDevice::ResetController(void) @@ -314,7 +567,8 @@ { PUSBHARDWAREDEVICE This; - This = new(NonPagedPool, 0) CUSBHardwareDevice(0); + This = new(NonPagedPool, TAG_USBEHCI) CUSBHardwareDevice(0); + if (!This) return STATUS_INSUFFICIENT_RESOURCES; Added: branches/usb-bringup/drivers/usb/usbehci_new/hardware.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup/drivers/usb/usbehci…
============================================================================== --- branches/usb-bringup/drivers/usb/usbehci_new/hardware.h (added) +++ branches/usb-bringup/drivers/usb/usbehci_new/hardware.h [iso-8859-1] Sat Apr 16 02:20:23 2011 @@ -1,0 +1,306 @@ +#pragma once + +#include <ntddk.h> + +// +// EHCI Operational Registers +// +#define EHCI_USBCMD 0x00 +#define EHCI_USBSTS 0x04 +#define EHCI_USBINTR 0x08 +#define EHCI_FRINDEX 0x0C +#define EHCI_CTRLDSSEGMENT 0x10 +#define EHCI_PERIODICLISTBASE 0x14 +#define EHCI_ASYNCLISTBASE 0x18 +#define EHCI_CONFIGFLAG 0x40 +#define EHCI_PORTSC 0x44 + +// +// Interrupt Register Flags +// +#define EHCI_USBINTR_INTE 0x01 +#define EHCI_USBINTR_ERR 0x02 +#define EHCI_USBINTR_PC 0x04 +#define EHCI_USBINTR_FLROVR 0x08 +#define EHCI_USBINTR_HSERR 0x10 +#define EHCI_USBINTR_ASYNC 0x20 +// Bits 6:31 Reserved + +// +// Status Register Flags +// +#define EHCI_STS_INT 0x01 +#define EHCI_STS_ERR 0x02 +#define EHCI_STS_PCD 0x04 +#define EHCI_STS_FLR 0x08 +#define EHCI_STS_FATAL 0x10 +#define EHCI_STS_IAA 0x20 +// Bits 11:6 Reserved +#define EHCI_STS_HALT 0x1000 +#define EHCI_STS_RECL 0x2000 +#define EHCI_STS_PSS 0x4000 +#define EHCI_STS_ASS 0x8000 +#define EHCI_ERROR_INT (EHCI_STS_FATAL | EHCI_STS_ERR) + +// +// Terminate Pointer used for QueueHeads and Element Transfer Descriptors to mark Pointers as the end +// +#define TERMINATE_POINTER 0x01 + +// +// QUEUE ELEMENT TRANSFER DESCRIPTOR, defines and structs +// + +// +// Token Flags +// +#define PID_CODE_OUT_TOKEN 0x00 +#define PID_CODE_IN_TOKEN 0x01 +#define PID_CODE_SETUP_TOKEN 0x02 + +#define DO_START_SPLIT 0x00 +#define DO_COMPLETE_SPLIT 0x01 + +#define PING_STATE_DO_OUT 0x00 +#define PING_STATE_DO_PING 0x01 + +typedef struct _PERIODICFRAMELIST +{ + PULONG VirtualAddr; + PHYSICAL_ADDRESS PhysicalAddr; + ULONG Size; +} PERIODICFRAMELIST, *PPERIODICFRAMELIST; + +// +// QUEUE ELEMENT TRANSFER DESCRIPTOR TOKEN +// +typedef struct _QETD_TOKEN_BITS +{ + ULONG PingState:1; + ULONG SplitTransactionState:1; + ULONG MissedMicroFrame:1; + ULONG TransactionError:1; + ULONG BabbleDetected:1; + ULONG DataBufferError:1; + ULONG Halted:1; + ULONG Active:1; + ULONG PIDCode:2; + ULONG ErrorCounter:2; + ULONG CurrentPage:3; + ULONG InterruptOnComplete:1; + ULONG TotalBytesToTransfer:15; + ULONG DataToggle:1; +} QETD_TOKEN_BITS, *PQETD_TOKEN_BITS; + +// +// QUEUE ELEMENT TRANSFER DESCRIPTOR +// +typedef struct _QUEUE_TRANSFER_DESCRIPTOR +{ + //Hardware + ULONG NextPointer; + ULONG AlternateNextPointer; + union + { + QETD_TOKEN_BITS Bits; + ULONG DWord; + } Token; + ULONG BufferPointer[5]; + + //Software + ULONG PhysicalAddr; + struct _QUEUE_TRANSFER_DESCRIPTOR *PreviousDescriptor; + struct _QUEUE_TRANSFER_DESCRIPTOR *NextDescriptor; +} QUEUE_TRANSFER_DESCRIPTOR, *PQUEUE_TRANSFER_DESCRIPTOR; + +// +// EndPointSpeeds Flags and END_POINT_CHARACTERISTICS +// +#define QH_ENDPOINT_FULLSPEED 0x00 +#define QH_ENDPOINT_LOWSPEED 0x01 +#define QH_ENDPOINT_HIGHSPEED 0x02 +typedef struct _END_POINT_CHARACTERISTICS +{ + ULONG DeviceAddress:7; + ULONG InactiveOnNextTransaction:1; + ULONG EndPointNumber:4; + ULONG EndPointSpeed:2; + ULONG QEDTDataToggleControl:1; + ULONG HeadOfReclamation:1; + ULONG MaximumPacketLength:11; + ULONG ControlEndPointFlag:1; + ULONG NakCountReload:4; +} END_POINT_CHARACTERISTICS, *PEND_POINT_CHARACTERISTICS; + +// +// Capabilities +// +typedef struct _END_POINT_CAPABILITIES +{ + ULONG InterruptScheduleMask:8; + ULONG SplitCompletionMask:8; + ULONG HubAddr:6; + ULONG PortNumber:6; + ULONG NumberOfTransactionPerFrame:2; +} END_POINT_CAPABILITIES, *PEND_POINT_CAPABILITIES; + +// +// QUEUE HEAD Flags and Struct +// +#define QH_TYPE_IDT 0x00 +#define QH_TYPE_QH 0x02 +#define QH_TYPE_SITD 0x04 +#define QH_TYPE_FSTN 0x06 + +typedef struct _QUEUE_HEAD +{ + //Hardware + ULONG HorizontalLinkPointer; + END_POINT_CHARACTERISTICS EndPointCharacteristics; + END_POINT_CAPABILITIES EndPointCapabilities; + // TERMINATE_POINTER not valid for this member + ULONG CurrentLinkPointer; + // TERMINATE_POINTER valid + ULONG NextPointer; + // TERMINATE_POINTER valid, bits 1:4 is NAK_COUNTERd + ULONG AlternateNextPointer; + // Only DataToggle, InterruptOnComplete, ErrorCounter, PingState valid + union + { + QETD_TOKEN_BITS Bits; + ULONG DWord; + } Token; + ULONG BufferPointer[5]; + + //Software + ULONG PhysicalAddr; + struct _QUEUE_HEAD *PreviousQueueHead; + struct _QUEUE_HEAD *NextQueueHead; + PQUEUE_TRANSFER_DESCRIPTOR TransferDescriptor; + PIRP IrpToComplete; + PMDL MdlToFree; + PKEVENT Event; +} QUEUE_HEAD, *PQUEUE_HEAD; + +// +// Command register content +// +typedef struct _EHCI_USBCMD_CONTENT +{ + ULONG Run : 1; + ULONG HCReset : 1; + ULONG FrameListSize : 2; + ULONG PeriodicEnable : 1; + ULONG AsyncEnable : 1; + ULONG DoorBell : 1; + ULONG LightReset : 1; + ULONG AsyncParkCount : 2; + ULONG Reserved : 1; + ULONG AsyncParkEnable : 1; + ULONG Reserved1 : 4; + ULONG IntThreshold : 8; + ULONG Reserved2 : 8; +} EHCI_USBCMD_CONTENT, *PEHCI_USBCMD_CONTENT; + +// +// Status register content +// +typedef struct _EHCI_USBSTS_CONTENT +{ + ULONG USBInterrupt:1; + ULONG ErrorInterrupt:1; + ULONG DetectChangeInterrupt:1; + ULONG FrameListRolloverInterrupt:1; + ULONG HostSystemErrorInterrupt:1; + ULONG AsyncAdvanceInterrupt:1; + ULONG Reserved:6; + ULONG HCHalted:1; + ULONG Reclamation:1; + ULONG PeriodicScheduleStatus:1; + ULONG AsynchronousScheduleStatus:1; +} EHCI_USBSTS_CONTENT, *PEHCI_USBSTS_CONTENT; + +typedef struct _EHCI_USBPORTSC_CONTENT +{ + ULONG CurrentConnectStatus:1; + ULONG ConnectStatusChange:1; + ULONG PortEnabled:1; + ULONG PortEnableChanged:1; + ULONG OverCurrentActive:1; + ULONG OverCurrentChange:1; + ULONG ForcePortResume:1; + ULONG Suspend:1; + ULONG PortReset:1; + ULONG Reserved:1; + ULONG LineStatus:2; + ULONG PortPower:1; + ULONG PortOwner:1; +} EHCI_USBPORTSC_CONTENT, *PEHCI_USBPORTSC_CONTENT; + +typedef struct _EHCI_HCS_CONTENT +{ + ULONG PortCount : 4; + ULONG PortPowerControl: 1; + ULONG Reserved : 2; + ULONG PortRouteRules : 1; + ULONG PortPerCHC : 4; + ULONG CHCCount : 4; + ULONG PortIndicator : 1; + ULONG Reserved2 : 3; + ULONG DbgPortNum : 4; + ULONG Reserved3 : 8; + +} EHCI_HCS_CONTENT, *PEHCI_HCS_CONTENT; + +typedef struct _EHCI_HCC_CONTENT +{ + ULONG CurAddrBits : 1; + ULONG VarFrameList : 1; + ULONG ParkMode : 1; + ULONG Reserved : 1; + ULONG IsoSchedThreshold : 4; + ULONG EECPCapable : 8; + ULONG Reserved2 : 16; + +} EHCI_HCC_CONTENT, *PEHCI_HCC_CONTENT; + +typedef struct _EHCI_CAPS { + UCHAR Length; + UCHAR Reserved; + USHORT HCIVersion; + union + { + EHCI_HCS_CONTENT HCSParams; + ULONG HCSParamsLong; + }; + union + { + EHCI_HCC_CONTENT HCCParams; + ULONG HCCParamsLong; + }; + UCHAR PortRoute [8]; +} EHCI_CAPS, *PEHCI_CAPS; + + +typedef struct +{ + PKSPIN_LOCK Lock; + RTL_BITMAP Bitmap; + PULONG BitmapBuffer; + ULONG BlockSize; + PVOID VirtualBase; + PHYSICAL_ADDRESS PhysicalBase; + ULONG Length; +}DMA_MEMORY_ALLOCATOR, *LPDMA_MEMORY_ALLOCATOR; + +typedef struct _EHCI_HOST_CONTROLLER +{ + ULONG OpRegisters; + EHCI_CAPS ECHICaps; + PVOID CommonBufferVA; + PHYSICAL_ADDRESS CommonBufferPA; + ULONG CommonBufferSize; + PQUEUE_HEAD AsyncListQueue; + KSPIN_LOCK Lock; + LPDMA_MEMORY_ALLOCATOR DmaMemAllocator; +} EHCI_HOST_CONTROLLER, *PEHCI_HOST_CONTROLLER; Propchange: branches/usb-bringup/drivers/usb/usbehci_new/hardware.h ------------------------------------------------------------------------------ svn:eol-style = native
13 years, 8 months
1
0
0
0
[akhaldi] 51364: [CMAKE] * browseui: Don't link to mingw32 and coldname unconditionally (msvc).
by akhaldi@svn.reactos.org
Author: akhaldi Date: Fri Apr 15 22:54:00 2011 New Revision: 51364 URL:
http://svn.reactos.org/svn/reactos?rev=51364&view=rev
Log: [CMAKE] * browseui: Don't link to mingw32 and coldname unconditionally (msvc). Modified: branches/cmake-bringup/dll/win32/browseui/CMakeLists.txt Modified: branches/cmake-bringup/dll/win32/browseui/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/dll/win32/browseu…
============================================================================== --- branches/cmake-bringup/dll/win32/browseui/CMakeLists.txt [iso-8859-1] (original) +++ branches/cmake-bringup/dll/win32/browseui/CMakeLists.txt [iso-8859-1] Fri Apr 15 22:54:00 2011 @@ -47,9 +47,7 @@ target_link_libraries(browseui atlnew uuid - wine - -lmingw32 - -lcoldname) + wine) add_importlibs(browseui shlwapi
13 years, 8 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
30
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
Results per page:
10
25
50
100
200