I'm uhci-the Linux stuff. __linux

Source: Internet
Author: User
Tags goto

Write a uhci bar, also miss Intel, as well as the Intel's several female colleagues, long time no contact, how are you?

UHCI was proposed by Intel. I've been away from Intel for over a year, but I've always felt like I'm going back to Intel one day. So I'm going to be a little concerned about Intel. I really miss Intel, though it's not much, but I just graduated. I didn't think much of the money problem.

UHCI Full Name Universal host Controller Interface, which is a USB host Controller interface specification, the hardware in the lake is called the UHCI Host controller. In Linux, this hardware is called HC, or host Controller, and the corresponding software is called HCD. That is, the HCD module in HC Driver.linux is called UHCI-HCD.

When we look at a module, we first look at the Kconfig and makefile files. In the Drivers/usb/host/kconfig file:

161 Config USB_UHCI_HCD

162 TriState "UHCI HCD (most Intel and VIA) support"

163 depends on USB && PCI

164---help---

165 the Universal Host Controller Interface is a standard by Intel for

166 Accessing the USB hardware in the PC (which is also called the USB

167 host controller). If your USB host controller conforms to this

Standard want to say Y, but-below. All recent Boards

169 with the Intel PCI chipsets (like Intel 430TX, 440FX, 440LX, 440BX,

170 i810, i820) conform to this standard. Also all VIA PCI chipsets

171 (like VIA VP2, VP3, MVP3, Apollo Pro, Apollo Pro II or Apollo Pro

172 133). If unsure, say Y.

173

174 to compile this driver as a module, choose M here:the

175 module would be called UHCI-HCD.

The crowd searched for him. After thousands of years, I found the above text, note that depends on USB && PCI. This means that this option is dependent on the other two options, Config_usb and Config_pci, Obviously these two options represent the core code of USB in Linux and the core code of PCI.

UHCI as a USB host controller interface, it relies on the USB core which is normal, but why does it also rely on the PCI core? The reason is simple: the UHCI host controller itself is typically a PCI device, which is usually plugged into a PCI slot or directly integrated into the motherboard. But in short, Most of the UHCI host controllers are connected to the PCI bus. So, very helpless, write the UHCI driver will have to understand a bit of PCI device driver.

Take a look at the LSPCI command first,

Localhost:/usr/src/linux-2.6.22.1/drivers/usb/host # Lspci | grep USB

00:1d.0 USB Controller:intel Corporation Enterprise southbridge UHCI USB #1 (rev 09)

00:1d.1 USB Controller:intel Corporation Enterprise southbridge UHCI USB #2 (rev 09)

00:1d.2 USB Controller:intel Corporation Enterprise southbridge UHCI USB #3 (rev 09)

00:1d.7 USB Controller:intel Corporation Enterprise Southbridge EHCI USB (rev 09)

In My computer, for example, there are three UHCI host controllers, and another host controller, EHCI host controllers, all of which are PCI devices.

Then we'll look at makefile.

Localhost:/usr/src/linux-2.6.22.1/drivers/usb/host # Cat Makefile

#

# Makefile for USB Host Controller Drivers

#

Ifeq ($ (config_usb_debug), y)

Extra_cflags + +-ddebug

endif

obj-$ (CONFIG_PCI) + + PCI-QUIRKS.O

obj-$ (CONFIG_USB_EHCI_HCD) + + EHCI-HCD.O

obj-$ (CONFIG_USB_ISP116X_HCD) + + ISP116X-HCD.O

obj-$ (CONFIG_USB_OHCI_HCD) + + OHCI-HCD.O

obj-$ (CONFIG_USB_UHCI_HCD) + + UHCI-HCD.O

obj-$ (CONFIG_USB_SL811_HCD) + + SL811-HCD.O

obj-$ (Config_usb_sl811_cs) + + SL811_CS.O

obj-$ (CONFIG_USB_U132_HCD) + + U132-HCD.O

Obviously, what we want is the UHCI-HCD.O module that corresponds to the CONFIG_USB_UHCI_HCD. The most relevant to UHCI-HCD.O is the C file with the same name. This is its source file. In drivers/usb/host/ The last 7 lines of UHCI-HCD.C, we see:

969 Module_init (Uhci_hcd_init);

970 module_exit (Uhci_hcd_cleanup);

971

972 Module_author (Driver_author);

973 Module_description (DRIVER_DESC);

974 Module_license ("GPL");

Just as every woman should have a lipstick, each module should have two macros, which are Module_init and module_exit, which are used to initialize and unregister themselves. And these two lines of code means Uhci_hcd_ The INIT function will be invoked when you load the module, and Uhci_hcd_cleanup will be executed when you uninstall the module.

So we have no choice but to start our story from Uhci_hcd_init.

917 static int __init uhci_hcd_init (void)

918 {

919 int retval =-enomem;

920

921 PRINTK (kern_info driver_desc "driver_version"%s/n ",

922 Ignore_oc? ", Overcurrent ignored": "");

923

924 if (usb_disabled ())

925 Return-enodev;

926

927 if (debug_configured) {

928 errbuf = Kmalloc (Errbuf_len, Gfp_kernel);

929 if (!ERRBUF)

930 Goto errbuf_failed;

931 uhci_debugfs_root = Debugfs_create_dir ("UHCI", NULL);

932 if (!uhci_debugfs_root)

933 goto debug_failed;

934}

935

936 Uhci_up_cachep = kmem_cache_create ("Uhci_urb_priv",

937 sizeof (struct urb_priv), 0, 0, NULL, NULL);

938 if (!uhci_up_cachep)

939 goto up_failed;

940

941 retval = Pci_register_driver (&uhci_pci_driver);

942 if (retval)

943 Goto init_failed;

944

945 return 0;

946

947 init_failed:

948 Kmem_cache_destroy (UHCI_UP_CACHEP);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.