USB host control




app:  
-------------------------------------------
          USB设备驱动程序      // 知道数据含义
内核 --------------------------------------
          USB总线驱动程序      // 1. 识别, 2. 找到匹配的设备驱动, 3. 提供USB读写函数 (它不知道数据含义)
-------------------------------------------
           USB主机控制器
           UHCI OHCI EHCI
硬件        -----------
              USB设备

UHCI: intel,     低速(1.5Mbps)/全速(12Mbps)
OHCI: microsoft  低速/全速
EHCI:            高速(480Mbps)



USB总线驱动程序相当于USB主机控制器的驱动程序。
对于Linux USB主机驱动程序 可以分析

Freezer
Upon entering a suspended state the system will freeze all tasks. This is done by delivering pseudosignals. This affects kernel threads, too. To successfully freeze a kernel thread the thread has to check for the pseudo signal and enter the refrigerator. Code to do this looks like this:
 do { hub_events();
  wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); try_to_freeze(); } while (!signal_pending(current));
from drivers/usb/core/hub.c::hub_thread()

在内核目录下搜:
grep "USB device using" * -nR
drivers/usb/core/hub.c:2186:              "%s %s speed %sUSB device using %s and address %d\n",

hub_irq  //最终还是irq 中断得到USB设备来了。
 kick_khubd
  hub_thread
   hub_events
    hub_port_connect_change
    
     udev = usb_alloc_dev(hdev, hdev->bus, port1);
        dev->dev.bus = &usb_bus_type;
    
     choose_address(udev); // 给新设备分配编号(地址)
     
     
     hub_port_init   // usb 1-1: new full speed USB device using s3c2410-ohci and address 3
      
      hub_set_address  // 把编号(地址)告诉USB设备


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值