g_ncm Linux USB network gadget driver framework
2014-04-11 10:43
441 查看
由于项目关系,最近在拜读Linux USB gadget network driver,下面是整个USB network gadget驱动的架构图。
USB network Gadget 主要是通过两个end point来收发网络包。其中这个out and In 是以host的角度来看的。所以我们在device这一侧会发现,Out end point 是负责收数据,In endpoint 是负责发数据的。而endpoint0是Gadget default,主要用来收发usb control request。
要理解上面的架构图,必须先了解USB Specification一些关键的概念,详细可以参考USB 2.0 specification chapter 8 9 10:
USB Topology:
USB Device Hierarchy
USB device state
1. The hub to which the USB device is now attached informs the host of the event via a reply on its status change pipe (refer to Section 11.12.3 for more information). At this point, the USB device is in the Powered state
and the port to which it is attached is disabled.
2. The host determines the exact nature of the change by querying the hub.
3. Now that the host knows the port to which the new device has been attached, the host then waits for at least 100 ms to allow completion of an insertion process and for power at the device to become stable. The host then
issues a port enable and reset command to that port. Refer to Section 7.1.7.5 for sequence of events and timings of connection through device reset.
4. The hub performs the required reset processing for that port (see Section 11.5.1.5). When the reset signal is released, the port has been enabled. The USB device is now in the Default state and can draw no more than 100
mA from VBUS. All of its registers and state have been reset and it answers to the default address.
5. The host assigns a unique address to the USB device, moving the device to the Address state.
6. Before the USB device receives a unique address, its Default Control Pipe is still accessible via the default address. The host reads the device descriptor to determine what actual maximum data payload size this USB devices
default pipe can use.
7. The host reads the configuration information from the device by reading each configuration zero to n-1, where n is the number of configurations. This process may take several milliseconds to complete
8. Based on the configuration information and how the USB device will be used, the host assigns a configuration value to the device. The device is now in the Configured state and all of the endpoints in this configuration
have taken on their described characteristics. The USB device may now draw the amount of VBUS power described in its descriptor for the selected configuration. From the devices point of view, it is now ready for use.
9. When the USB device is removed, the hub again sends a notification to the host. Detaching a device disables the port to which it had been attached. Upon receiving the detach notification, the host will update its local
topological information.
USB network Gadget 主要是通过两个end point来收发网络包。其中这个out and In 是以host的角度来看的。所以我们在device这一侧会发现,Out end point 是负责收数据,In endpoint 是负责发数据的。而endpoint0是Gadget default,主要用来收发usb control request。
要理解上面的架构图,必须先了解USB Specification一些关键的概念,详细可以参考USB 2.0 specification chapter 8 9 10:
USB Topology:
USB Device Hierarchy
USB Composite Gadget description structure
USB device state
Bus Enumeration
When a USB device is attached to or removed from the USB, the host uses a process known as busenumeration to identify and manage the device state changes necessary. When a USB device is attached to a powered port, the following actions are taken:1. The hub to which the USB device is now attached informs the host of the event via a reply on its status change pipe (refer to Section 11.12.3 for more information). At this point, the USB device is in the Powered state
and the port to which it is attached is disabled.
2. The host determines the exact nature of the change by querying the hub.
3. Now that the host knows the port to which the new device has been attached, the host then waits for at least 100 ms to allow completion of an insertion process and for power at the device to become stable. The host then
issues a port enable and reset command to that port. Refer to Section 7.1.7.5 for sequence of events and timings of connection through device reset.
4. The hub performs the required reset processing for that port (see Section 11.5.1.5). When the reset signal is released, the port has been enabled. The USB device is now in the Default state and can draw no more than 100
mA from VBUS. All of its registers and state have been reset and it answers to the default address.
5. The host assigns a unique address to the USB device, moving the device to the Address state.
6. Before the USB device receives a unique address, its Default Control Pipe is still accessible via the default address. The host reads the device descriptor to determine what actual maximum data payload size this USB devices
default pipe can use.
7. The host reads the configuration information from the device by reading each configuration zero to n-1, where n is the number of configurations. This process may take several milliseconds to complete
8. Based on the configuration information and how the USB device will be used, the host assigns a configuration value to the device. The device is now in the Configured state and all of the endpoints in this configuration
have taken on their described characteristics. The USB device may now draw the amount of VBUS power described in its descriptor for the selected configuration. From the devices point of view, it is now ready for use.
9. When the USB device is removed, the hub again sends a notification to the host. Detaching a device disables the port to which it had been attached. Upon receiving the detach notification, the host will update its local
topological information.
相关文章推荐
- USB gadget driver framework
- UDC (usb device controller) Framework - USB gadget driver framework
- Device driver testing framework for OMAP Linux kernel
- Linux-USB Gadget : Part 6: dummy hcd 驱动简介
- Linux_USB_gadget设备驱动
- linux usb Gadget (usb设备侧驱动分析)
- understanding linux usb ehci device driver(1)
- linux cpufreq framework(5)_ARM big Little driver
- Linux USB Gadget--设备枚举
- Linux Gadget的一点研究之U盘和USB虚拟串口
- 开发板作为USB设备模拟网卡(linux usb 网卡)--gadget&&rndis|cdc
- Linux USB subsystem --- register generic usb driver
- Linux USB gadget 网络体验
- Linux下USB gadget设备详解
- Linux cpufreq framework(2)_cpufreq driver
- Linux USB Gadget --mini2440使用与测试
- Linux-USB Gadget : Part 2: USB Gadget API for Linux (From Linux kernel 2.6.25.10)
- USB driver linux
- usb gadget driver 之二 gadget设备层
- Android模拟器学framework和driver之battery & backlight-----1.battery in linux