How to create a USB host controller extension driver

Zhou 0 Reputation points
2023-11-06T06:09:17.36+00:00

We have created a pci-e USB bus extension device using FPGA. To use it on Windows, it is necessary to create a driver. How can we obtain the programmable source code of xhci. sys or related examples of USB host controller extension (UCX)

Windows for business | Windows Client for IT Pros | Devices and deployment | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wesley Li-MSFT 4,571 Reputation points Microsoft External Staff
    2023-11-23T07:11:11.7866667+00:00

    Hello

    Creating a USB host controller extension driver involves several steps. Here’s a general overview:

    Understand the Architecture: The USB host controller extension (UCX) is a system-supplied driver (Ucx01000.sys). It serves as an abstraction layer to the hub driver above in the stack, and provides a generic mechanism for queuing requests to the underlying host controller driver.

    Create a Host Controller Object: The host controller object represents the host controller that is created by the host controller driver. The driver must create only one host controller object per host controller instance.

    Create a Root Hub Object: The root hub object gets and controls the status of the root ports of the host controller. There should be only one root hub object per host controller instance.

    Implement Callback Functions: When the host controller driver creates the object, the driver registers its implementation of callback functions that are invoked by UCX.

    Use UCX Programming Interfaces: The bidirectional communication that takes place between UCX and the host controller driver takes place by using USB host controller extension (UCX) programming interfaces.

    As for obtaining the programmable source code of xhci.sys or related examples of USB host controller extension (UCX), Microsoft does not provide the source code for their USB drivers, including xhci.sys. However, you can refer to the Windows Driver Kit (WDK) for resources required for driver development, such as headers, libraries, tools, and samples.

    For non-XHCI hardware, such as a PCI-E USB bus extension device using FPGA, you may need to write your own host controller driver. You can also refer to open-source projects like FreeBSD, which has source code for an xHCI PCI driver.

    Please note that writing a driver involves understanding the hardware at a very low level and requires a good knowledge of C and C++ programming languages, Windows system architecture, and the Windows Driver Model (WDM). It’s a complex task and should be undertaken by experienced developers.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.