LINUX下USB1.1设备学习小记(4)_uhci(2)
时间:2009-03-14 来源:superfight
现在谈一下uhci硬件的组成,uhci的硬件分为两个大的部分,主机控制器和根集线器,如下图
500)this.width=500;" border=0> 当提交uhci硬件的注册到pci总线后,经过一轮匹配,终于找到了uhci,进入到uhci_pci_driver->probe这个函数下 usb_hcd_pci_probe在/drivers/usb/host/uhci-hcd.c中
int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) |
usb_create_hcd在/drivers/usb/core/hcd.c中
struct usb_hcd *usb_create_hcd (const struct hc_driver *driver, |
500)this.width=500;" border=0> 为什么会有个白框呢?还记得hcd = kzalloc(sizeof(*hcd) + driver->hcd_priv_size, GFP_KERNEL);
这句么,这个白框就是所申请的hcd_priv_size大小的空间,里面是什么我们还不知道,所以是一片白的,等用到的时候我再把它画出来 hcd准备好之后,就要进入更深一个层次的初始化了, usb_add_hcd负责这部分的工作 usb_add_hcd在/drivers/usb/core/hcd.c中
int usb_add_hcd(struct usb_hcd *hcd, |
int hcd_buffer_create(struct usb_hcd *hcd) |
usb_register_bus用于注册uhci自己的总线,管理连接到uhci的所有设备
static int usb_register_bus(struct usb_bus *bus) |
500)this.width=500;" border=0> 然后到usb_alloc_dev,这个函数负责分配一个usb设备数据结构,在这里,这个usb数据结构用于描述主机控制器的根集线器,这个根集线器也是usb设备的一种 usb_alloc_dev在/drivers/usb/core/usb.c中
struct usb_device *usb_alloc_dev(struct usb_device *parent, |
500)this.width=500;" border=0> 现在到hcd->driver->reset,这个函数为uhci_init uhci_init在/drivers/usb/host/uhci-hcd.c中
static int uhci_init(struct usb_hcd *hcd) |