读书笔记 <Bootstrap Yourself with Linux USB Stack>

本文详细探讨了Linux操作系统下的USB(通用串行总线)技术,从USB的基础概念、系统架构、主机与设备的交互,到Linux内核中的USB子系统、驱动模型和通知机制。还介绍了设备文件系统、电源管理、Hub、通用驱动、嵌入式控制器的Host驱动、Gadget驱动、Class驱动、OTG驱动、虚拟文件系统以及用户空间驱动的实现和调试方法。通过对Linux USB的深入剖析,为开发者提供了全面的技术指南。
摘要由CSDN通过智能技术生成

读书笔记 <Bootstrap Yourself with Linux USB Stack>

第一章 USB and Linux Introduction

  1. 关于USB的硬件
    三种类型:
    USB Transceiver, 通常包含一个USB core在芯片上
    Standalone USB Controller, transceiver + digital portion
    Integrated USB Controller,


第二章 USB: An Overview

  1. USB System Architecture


    分为三个主要部分:
        USB device
        USB host
        USB interconnect

  2. USB host

    HCD: host control driver
    USBD: USB driver
    IRP: input/output request packets

    它由以下几部分组成:
        Client Software
        USB System Software
        Host Controller

  3. USB Device

    它由以下3部分组成:
        Function
        USB Logical Device
        USB Bus Interface

  4. USB Host和USB Device之间如何交互


    Endpoint, 一个device可以根据其function提供多个endpoint, 每个以device address, endpoint number, endpoint direction唯一标识.
        Endpoint Zero是一个特殊的endpoint, 每个device都必须要实现它. 它供Usb host初始化和获得device的信息.
        Endpoint需要通过以下几点描述它自己:
        The bus access frequency/latency requirement
        The bandwidth requirement   
        The endpoint number
        The error-handling behavior requirements
        The maximum packet size that the endpoint is capable of sending or receiving
        The transfer type for the endpoint
        The direction in which data is transferred between the endpoint and thehost


    pipe, 它用来在逻辑上表示device endpoint和host software之间的联系. 最重要的一个pipe, 是用来连接host和endpoint zero的.
       stream pipe, 非USB-define format的数据
       message pipe, USB-define format的数据

  5. Enumeration
    它由host和device侧的USB logical layer共同配合完成.
    USB标准定义了标注流程:
    1. The USB device is attached to the host, which receives an event indicating a change in the pipe’s status. The USB device is in the powered state, and the port it is attached to is disabled.
    2. The host queries about the change in the bus.
    3. Once the host determines that a new device is attached, it waits for at least 100ms for the device to become stable after power, after which it enables and resets the port.
    4. After a successful reset, the USB device is in a default state and can draw power to a range of 100 mA from VBUS pin.
    5. Once the device is in a default state, the host assigns a unique address to the USB device, which moves the device to an address state.
    6. The host starts communicating with the USB device in the default control pipe and reads the device descriptor.
    7. Subsequently, the host reads the device configuration information.
    8. The host selects the configuration, which move the device to a configured state and makes it ready for use.


    Description
    标准定义device, configuration,interface, endpoint, string五类description.


  6. USB Transfers
    定义了4种transfer, 它们都描述了下述的属性:
    n Direction of communication flow
    n Constraint in the packet size
    n Bus access constraints
    n Latency constraints
    n Required data sequences
    n Error handling

    Control Transfer,
    Bulk Transfer, 大数据
    Interrupt Transfer, 小数据
    Isochronous Transfer, audio,video之类的实时大数据

  7. 一些重要术语
    Short packet. A short packet can be defined as a packet whose payload is
    shorter than the maximum size or zero length packet (ZLP). A short
    packet could indicate the end of a transfer.
    Zero length packet (ZLP). A zero length data packet transfer does not
    contain data as part of the transfer. When the data to be sent is an exact
    multiple of wMaxPacketSize, a ZLP has to be sent after the data transfer
    is complete to indicate the end of the transfer. Sometimes a ZLP feature
    is implemented as part of the hardware or has to be taken care when
    designing Chapter 9/USB.
    STALL. A STALL indicates that a function is unable to transmit or
    receive data or that even a control pipe request is not supported. The
    state of a function after returning a STALL is undefined.

第三章, Overview of the linux USB Subsystem

  1. Linux kernel中的USB相关代码结构



  2. 关于Gadget subsystem
    USB controller driver实现了USB device controller, 它
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值