Chapter 6. Host Controller APIs

Table of Contents

usb_calc_bus_time — approximate periodic transaction time in nanoseconds
usb_hcd_link_urb_to_ep — add an URB to its endpoint queue
usb_hcd_check_unlink_urb — check whether an URB may be unlinked
usb_hcd_unlink_urb_from_ep — remove an URB from its endpoint queue
usb_hcd_giveback_urb — return URB from HCD to device driver
usb_alloc_streams — allocate bulk endpoint stream IDs.
usb_free_streams — free bulk endpoint stream IDs.
usb_hcd_resume_root_hub — called by HCD to resume its root hub
usb_bus_start_enum — start immediate enumeration (for OTG)
usb_hcd_irq — hook IRQs to HCD framework (bus glue)
usb_hc_died — report abnormal shutdown of a host controller (bus glue)
usb_create_shared_hcd — create and initialize an HCD structure
usb_create_hcd — create and initialize an HCD structure
usb_add_hcd — finish generic HCD structure initialization and register
usb_remove_hcd — shutdown processing for generic HCDs
usb_hcd_pci_probe — initialize PCI-based HCDs
usb_hcd_pci_remove — shutdown processing for PCI-based HCDs
usb_hcd_pci_shutdown — shutdown host controller
hcd_buffer_create — initialize buffer pools
hcd_buffer_destroy — deallocate buffer pools

These APIs are only for use by host controller drivers, most of which implement standard register interfaces such as EHCI, OHCI, or UHCI. UHCI was one of the first interfaces, designed by Intel and also used by VIA; it doesn't do much in hardware. OHCI was designed later, to have the hardware do more work (bigger transfers, tracking protocol state, and so on). EHCI was designed with USB 2.0; its design has features that resemble OHCI (hardware does much more work) as well as UHCI (some parts of ISO support, TD list processing).

There are host controllers other than the "big three", although most PCI based controllers (and a few non-PCI based ones) use one of those interfaces. Not all host controllers use DMA; some use PIO, and there is also a simulator.

The same basic APIs are available to drivers for all those controllers. For historical reasons they are in two layers: struct usb_bus is a rather thin layer that became available in the 2.2 kernels, while struct usb_hcd is a more featureful layer (available in later 2.4 kernels and in 2.5) that lets HCDs share common code, to shrink driver size and significantly reduce hcd-specific behaviors.