USB Stack

From ReactOS Wiki
Revision as of 22:59, 30 January 2005 by 68.39.174.205 (talk) (Import from old Wiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ReactOS USB Subsystem

Roadmap of USB development for ReactOS

After some thinking and talking to X-Box guys, I decided to try implementing part of ReactOS USB Stack with help of a Linux USB Stack, but in a very special flavour - which is abstracted from Linux kernel, and from hardware also (this implementation is used in Cromwell). So now we have two concurrent tasks going on:

  • Porting Cromwell usb stuff to ReactOS (I already make it compiling into usbcore.sys and ohci.sys - this all is placed at reactos/drivers/usb/cromwell/, but hardware interface needs to be changed to use HAL)
  • Creating compatible interface to higher level of USB drivers (e.g. Class drivers, etc) - so we can have compatibility with Windows XP here. This involves creating a usbport.sys driver, which have all IRPs and IOCTLs stubbed, and then we can fill it with calls to the ported usbcore.sys and ohci.sys.
  • Creating drivers for other host controllers (currently only OpenHCI is done in Cromwell's usb drivers). Universal HCD would be a very nice thing to do, I think the best way is to get uhci hcd from linux stack, and adapt it to ReactOS.
  • Creating class drivers and other higher-level stuff -- we can test our lower level drivers with class drivers from WinXP.

Current Status

As there seems to be some interest in the current status of USB support on ReactOS, I'm going to keep a current status section on this wiki page.

 Jan 27 2005
  • Committed initial port of Cromwell's USB stack. Need to port all hw calls to HAL.
 Jan 17 2005 
  • USB stubs are committed to SVN with the paths listed on this page. Actually this happend earlier, but I figure that I might as well start this list somewhere.
  • Building the headers for the ROS ddk to spec in the USBHUB.SYS -> USBPORT.SYS interface. This interface is not documented super well, but much of the needed information can be gathered online.
  • Adding usb to the main ROS build.
  • Adding the usbuhci startup registry entries to hivesys.inf. After this we can see USBUHCI.SYS and USBPORT.SYS actually load. They won't do anything, but at least they will load. Well... it's a start.

Directory Layout

 /reactos/
 /reactos/drivers/
 /reactos/drivers/usb
 /reactos/drivers/usb/usbport
 /reactos/drivers/usb/miniport/usbuhci
 /reactos/drivers/usb/miniport/usbehci
 /reactos/drivers/usb/miniport/usbohci
 /reactos/drivers/usb/usbhub
 /reactos/drivers/usb/usbd
 /reactos/drivers/cromwell/...

USBPORT.SYS

This driver is the main port driver for USB host controllers. In a nutshell, it receives all IRPs and IOCTLs, and translates them into information that is useful for miniports. It is responsible for managing all the host controllers on the system. Each host controller type is managed by a miniport driver.

The interface between the port driver and its miniports is not published or documented anywhere. This means that we are relatively free to implement this any way we choose. The plan is to try to leverage the host controller driver implementation from the Linux kernel (at least as a reference), and define our own protocol.

USBPORT.SYS does provide a public interface, and it understands a known list of IOCTLs. We must make sure that our version of USBPORT.SYS manages its public interface in a manner consistent with the USB stack on Windows XP.

USBUHCI.SYS

This is the miniport for UHCI USB controllers.

USBEHCI.SYS

This is the miniport for EHCI (USB 2.0) controllers.

USBOHCI.SYS

This the miniport for OpenHCI USB controllers (this one is needed for XBOX-ReactOS project).

USBHUB.SYS

This is the USB hub driver.

USBD.SYS

This is a legacy USB bus driver from the Windows 2K system. In Windows XP it simply delegates all its methods to USBHUB.SYS and USBPORT.SYS. We will do the same thing in ReactOS (aiming WinXP was discussed many times, and considered finally a good choice than targeting old usb architecture of Win2k).

Windows XP (and ReactOS) USB Stack Startup

 --thoughtfully provided by Ryan O'Connor (Polonium)

usb_stack.png