linux下的ehci控制器调试
1 调试方法
- mount -t debugfs debugfs /sys/kernel/debug
- cat /sys/kernel/debug/usb/devices
- cat /sys/kernel/debug/usb/usbmon/$(bus_num)u
- ehci控制器下的async、periodic、registers等字段的解析
2 解读
2.1 usbfs
2.1.1 Topology Tag
"procusb ti"), we have:
T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
Physically this looks like (or could be converted to):
Or, in a more tree-like structure (ports [Connectors] without
connections could be omitted):
PC: Dev# 1, root hub, 2 ports, 12 Mbps
|_ CN.0: Dev# 2, hub, 4 ports, 12 Mbps
|_ CN.0: Dev #3, mouse, 1.5 Mbps
|_ CN.1:
|_ CN.2: Dev #4, serial, 12 Mbps
|_ CN.3:
|_ CN.1:
2.1.2 Bandwidth Tag
Bandwidth allocation is an approximation of how much of one frame
(millisecond) is in use. It reflects only periodic transfers, which
are the only transfers that reserve bandwidth. Control and bulk
transfers use all other bandwidth, including reserved bandwidth that
is not used for transfers (such as for short packets).
The percentage is how much of the "reserved" bandwidth is scheduled by
those transfers. For a low or full speed bus (loosely, "USB 1.1"),
90% of the bus bandwidth is reserved. For a high speed bus (loosely,
"USB 2.0") 80% is reserved.
2.1.3 Device descriptor andProduct ID Tag
D: Ver=x.xx Cls=xx(s) Sub=xx Prot=xx MxPS=dd #Cfgs=dd
P: Vendor=xxxx ProdID=xxxx Rev=xx.xx
MaxPacketSize of Default Endpoint:即是控制端点的最大包大小
2.1.4 Configuration Tag
USB devices may have multiple configurations, each of which act
rather differently. For example, a bus-powered configuration
might be much less capable than one that is self-powered. Only
one device configuration can be active at a time; most devices
have only one configuration.
Each configuration consists of one or more interfaces. Each
interface serves a distinct "function", which is typically bound
to a different USB device driver. One common example is a USB
speaker with an audio interface for playback, and a HID interface
for use with software volume control.
2.1.5 Interface Tag
A given interface may have one or more "alternate" settings.
For example, default settings may not use more than a small
amount of periodic bandwidth. To use significant fractions
of bus bandwidth, drivers must select a non-default altsetting.
Only one setting for an interface may be active at a time, and
only one driver may bind to an interface at a time. Most devices
have only one alternate setting per interface.
2.1.6 Endpoint Tag
The interval is nonzero for all periodic (interrupt or isochronous)
endpoints. For high speed endpoints the transfer interval may be
measured in microseconds rather than milliseconds.
For high speed periodic endpoints, the "MaxPacketSize" reflects
the per-microframe data transfer size. For "high bandwidth"
endpoints, that can reflect two or three packets (for up to
3KBytes every 125 usec) per endpoint.
With the Linux-USB stack, periodic bandwidth reservations use the
transfer intervals and sizes provided by URBs, which can be less
than those found in endpoint descriptor.
2.1.7 实例分析
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 //该设备属于复合设置(misc),包含一个配置( #Cfgs= 1),控制端点的最大包长度为64(MxPS=64)
P: Vendor=0c45 ProdID=6366 Rev= 1.00 // VID,PID
S: Manufacturer=Sonix Technology Co., Ltd. //String descriptor info
S: Product=USB 2.0 Camera
S: SerialNumber=SN0001
C:* #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=500mA // “ * ”表示这个是当前生效的配置,且配置标号是1(Cfg#= 1)
A: FirstIf#= 0 IfCount= 3 Cls=0e(video) Sub=03 Prot=00
A: FirstIf#= 3 IfCount= 2 Cls=01(audio) Sub=00 Prot=00
I:*If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo //I后面的*号,表示当前是活跃的接口,接口编号是0,且包含一个端点( #EPs= 1),是视频类接口(Cls=0e),该接口绑定的驱动为:uvcvideo
E: Ad=83(I) Atr=03(Int.) MxPS= 16 Ivl=4ms //这个是interface0下面的中断端点(Atr=03),且是地址为0x3的输入端点(Ad=83),该中断端点的最大包长度为16(MxPS= 16),间隔为4ms
I: If#= 1 Alt= 0 #EPs= 0 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口编号为1的可选设置0( If#= 1 Alt= 0),该设置是默认设置,不包含任何端点
I: If#= 1 Alt= 1 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口编号为1的可选设置1,该设置包含一个端点
E: Ad=81(I) Atr=05(Isoc) MxPS= 128 Ivl=125us//接口1的设置1包含的一个地址为1的输入端点( Ad=81(I)),且是同步端点(Atr=05),最大包长度为128,间隔为125us,即一个微帧的时间
I: If#= 1 Alt= 2 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口编号为1的可选设置2
E: Ad=81(I) Atr=05(Isoc) MxPS= 256 Ivl=125us//各个不同设置之间的差别是同步带宽的不同
I: If#= 1 Alt= 3 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口编号为1的可选设置3
E: Ad=81(I) Atr=05(Isoc) MxPS= 800 Ivl=125us
I:* If#= 1 Alt= 4 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口编号为1的可选设置4
E: Ad=81(I) Atr=05(Isoc) MxPS=1600 Ivl=125us
I: If#= 1 Alt= 5 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口编号为1的可选设置5
E: Ad=81(I) Atr=05(Isoc) MxPS=2400 Ivl=125us
I: If#= 1 Alt= 6 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口编号为1的可选设置6
E: Ad=81(I) Atr=05(Isoc) MxPS=3072 Ivl=125us //对于高速同步端点,端点的最大包长度为:3KBytes,即3072Byte(80%的同步带宽)
I:* If#= 2 Alt= 0 #EPs= 0 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口2的设置0( If#= 2 Alt= 0),I后面的*表示,当前设置是生效的设置,不包含任何端点,是默认设置。对应视频类接口(Cls=0e)
I: If#= 2 Alt= 1 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口2的设置1,包含一个端点
E: Ad=82(I) Atr=05(Isoc) MxPS= 128 Ivl=125us //接口2的设置1包含一个地址为2的输入端点(Ad=82(I) ),且是同步端点( Atr=05),最大包长度为128,间隔为125us,即每个微帧一次同步传输
I: If#= 2 Alt= 2 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口2的设置2,包含一个端点
E: Ad=82(I) Atr=05(Isoc) MxPS= 256 Ivl=125us
I: If#= 2 Alt= 3 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口2的设置3,包含一个端点
E: Ad=82(I) Atr=05(Isoc) MxPS= 800 Ivl=125us
I: If#= 2 Alt= 4 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口2的设置4,包含一个端点
E: Ad=82(I) Atr=05(Isoc) MxPS=1600 Ivl=125us
I: If#= 2 Alt= 5 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口2的设置5,包含一个端点
E: Ad=82(I) Atr=05(Isoc) MxPS=2400 Ivl=125us
I: If#= 2 Alt= 6 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo //对应接口2的设置6,包含一个端点
E: Ad=82(I) Atr=05(Isoc) MxPS=3072 Ivl=125us //接口2的不同设置之间的唯一不同就是,传输视频帧所占用的同步带宽不同。
I:* If#= 3 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I:* If#= 4 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I: If#= 4 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
E: Ad=84(I) Atr=05(Isoc) MxPS= 402 Ivl=1ms
2.2 snapshot of async and periodic shedule
2.2.1 periodic schedule snapshot
size = 512 //即为周期调度列表的长度,有如下合法的值(1024,512,256),该周期列表连接了一个间隔为1uframe的同步传输(itd),和一个pollrate为4的中断IN传输
0: itd/ffc791e0 // 表项0,只有同步传输,没有安排中断传输
1: itd/ffc79140 qh4-0001/c61ccb80 (h2 ep3in [1/0] q1 p16)
2: itd/ffc5e960
3: itd/ffc5e6e0
4: itd/ffc79500
5: itd/ffc79460 qh4-0001/c61ccb80
6: itd/ffc793c0
7: itd/ffc79280
8: itd/ffc79780
9: itd/ffc796e0 qh4-0001/c61ccb80
10: itd/ffc79640
11: itd/ffc790a0
12: itd/ffc79a00
13: itd/ffc79960 qh4-0001/c61ccb80
14: itd/ffc798c0
15: itd/ffc79320
16: itd/ffc79c80
17: itd/ffc79be0 qh4-0001/c61ccb80
18: itd/ffc79b40
19: itd/ffc795a0
20: itd/ffc79f00
21: itd/ffc79e60 qh4-0001/c61ccb80
22: itd/ffc79dc0
23: itd/ffc79820
24: itd/ffc5f1e0
25: itd/ffc5f140 qh4-0001/c61ccb80
26: itd/ffc5f0a0
27: itd/ffc79aa0
28: itd/ffc5f460
29: itd/ffc5f3c0 qh4-0001/c61ccb80
30: itd/ffc5f320
31: itd/ffc79d20
32: itd/ffc5f6e0
33: itd/ffc5f640 qh4-0001/c61ccb80
34: itd/ffc5f5a0
35: itd/ffc5f000
36: itd/ffc5f960
37: itd/ffc5f8c0 qh4-0001/c61ccb80
38: itd/ffc5f820
39: itd/ffc5f280
41: qh4-0001/c61ccb80
45: qh4-0001/c61ccb80
473: qh4-0001/c61ccb80
477: qh4-0001/c61ccb80
481: qh4-0001/c61ccb80
485: qh4-0001/c61ccb80
488: itd/ffc5faa0
489: itd/ffc5fb40 qh4-0001/c61ccb80 // 在周期表项为第489个frame的时候,连接了一个同步itd传输,一个pollrate 为4的中断IN传输
490: itd/ffc5fbe0
491: itd/ffc5f780
492: itd/ffc5fd20
493: itd/ffc5fdc0 qh4-0001/c61ccb80
494: itd/ffc5fe60
495: itd/ffc5fa00
496: itd/ffc5e000
497: itd/ffc5e0a0 qh4-0001/c61ccb80
498: itd/ffc5e140
499: itd/ffc5fc80
500: itd/ffc5e280
501: itd/ffc5e320 qh4-0001/c61ccb80
502: itd/ffc5e3c0
503: itd/ffc5ff00
504: itd/ffc5e500
505: itd/ffc5e5a0 qh4-0001/c61ccb80
506: itd/ffc5e640
507: itd/ffc5e1e0
508: itd/ffc5e780
509: itd/ffc5e820 qh4-0001/c61ccb80
510: itd/ffc5e8c0
511: itd/ffc5e460 // 达到511时,会翻转到周期列表的0表项
2.2.2 async schedule snapshot
qh/c5e5f280 dev4 hs ep2 42002204 40000000 (08000d80* data0 nak0) //qh结构,对应设备地址4的端点2,“*”表示当前qh是活跃的。
ffdcb960 in len=0 00001d00 urb da10e300 //qtd结构
ffdcb2a0 in len=0 00001d00 urb da10e300
ffdcb900 in len=0 00001d00 urb da10e300
ffdcb360 in len=0 00001d00 urb da10e300
ffdcb600 in len=0 00001d00 urb da10e300
ffdcb720 in len=0 00001d00 urb da10e300
ffdcba80 in len=0 00001d00 urb da10e300
ffdcbb40 in len=0 00001d00 urb da10e300 //qtd的数据长度为0,表示controller已经传输完这个qtd包含的数据
ffdcb4e0 in len=0 00001d00 urb da10e300
ffdcb1e0 in len=0 00001d00 urb da10e300
ffdcbc00 in len=0 00001d00 urb da10e300
ffdcb780 in len=0 00001d00 urb da10e300
ffdcbc60 in len=0 00001d00 urb da10e300
ffdcb0c0 in len=0 00001d00 urb da10e300
ffdcb9c0 in len=0 00001d00 urb da10e300
ffdcb420 in len=0 00001d00 urb da10e300
ffdcb6c0 in len=0 00001d00 urb da10e300
ffdcb3c0 in len=0 00001d00 urb da10e300
ffdcb300 in len=0 00001d00 urb da10e300
ffdcba20 in len=0 00001d00 urb da10e300
ffdcb7e0 in len=0 00001d00 urb da10e300
ffdcbae0*in len=409610000d80 urb da10e300 //“ * ”当前正在被controller执行的qtd结构
ffdcb540+in len=409690000d80 urb da10e300 // " + "表示当前qtd的下一个将被执行的qtd
ffdcb840#in len=4096 10000d80 urb da10e300
ffdcb180#in len=4096 90000d80 urb da10e300
ffdcb660#in len=4096 10000d80 urb da10e300 //长度为4096,表该qtd的传输还为被controller处理
ffdcb240#in len=4096 90000d80 urb da10e300
ffdcb8a0#in len=4096 10000d80 urb da10e300
ffdcb480#in len=4096 90008d80 urb da10e300 //8对应hw_token的IOC位,说明qtd完成后,会产生中断。
qh/c5e5fe00 dev4 hs ep1 42002104 40000000 (00008c01 data0 nak4) //另一个qh结构,对应设备地址4的端点1,方向是输入;
2.2.3 ehci运行状态统计和寄存器现场
/sys/kernel/debug/usb/ehci/0000:00:04.0 # cat registersbus pci, device 0000:00:04.0EHCI Host ControllerEHCI 1.00, rh state suspendedstructural params 0x00102203capability params 0x00006872status 1008 Halt FLRcommand 0010004 (park)=0 ithresh=1 period=512 HALTintrenable 37 IAA FATAL PCD ERR INTuframe 1b7dport:1 status 401885 0 ACK POWER sig=j SUSPEND PE CONNECTport:2 status 401000 0 ACK POWER sig=se0port:3 status 401000 0 ACK POWER sig=se0irq normal 211390 err 49 reclaim 13 (lost 3)complete 211398 unlink 17
3 参考资料
linux下的ehci控制器调试相关推荐
- linux音量模块,Linux下的音量控制器alsamixer
Linux下的音量控制器alsamixer xfce下的混音器mixer alsamixer是alsa驱动的一个插件,是一个命令行下的图形设置工具.网上有人说Linux默认自动带有这个小软件,不知道是 ...
- linux常用调试,linux下gdb常用的调试命令
用gdb调试程序时,常常很困惑一些命令的使用,要么是不知道这个命令,要么忘了命令的使用方法.接下来是小编为大家收集的linux下gdb常用的调试命令,希望能帮到大家. linux下gdb常用的调试命令 ...
- Linux下使用GDB进行调试
Linux下使用GDB进行调试的常用命令记于此. $ sudo su # g++ -g test.cpp -o test -pthread # gdb test <------- ...
- linux下c/c++程序调试拾遗
linux下c/c++程序调试拾遗 以下为整理c++程序调试过程中经常用到的工具链 1. 调试利器GDB linux下c++程序的调试,绕不过去的第一个就是gdb无疑了: 1.1 启动gdb gdb ...
- Linux 下打core并调试core
我们在Linux下工作时,经常会挺别人说程序崩溃了,会打出一个 core 文件在当前目录下,那个是怎么做到的呢? 首先,我们需要看看自己的系统有没有开启 core 的开关,如果没有,我们需 ...
- LINUX下GDB反汇编和调试
Linux下的汇编与Windows汇编最大的不同就是第一个操作数是原操作数,第二个是目的操作数.而Windows下却是相反. 1. 基本操作指令 简单的操作数类型说明.一般有三种. (1)马上数操作数 ...
- Linux下C语言的调试--转
调试是每个程序员都会面临的问题. 如何提高程序员的调试效率, 更好更快地定位程序中的问题从而加快程序开发的进度, 是大家共同面对的问题. 可能Windows用户顺口就会说出:用VC呗 :-) , 它提 ...
- linux下Qt编写串口调试助手,如何在linux下用QT写一个简单的串口调试助手
如何在linux下用QT写一个简单的串口调试助手 QT5串口类 在QT5以前,编写串口一般使用的是qextserialport类,但在QT5之后有了QT自带的串口类SerialPort(串口基础类)和 ...
- jlink怎么调试linux程序_纯Linux下的 ARM裸机调试环境搭建(GDB + JLink)
一直想摆脱windows环境,在纯linux下进行arm裸机开发,但是由于一直不知道JLink如何在linux下运行和配置,一直无法进行下去. 以前都是windows+AXD调试.包括本人用的FL24 ...
最新文章
- centos7 安装kubernetes1.4(kubeadm版)
- vue学习笔记(WebStorm安装)
- CTF(pwn) 堆利用 之 unlink 介绍
- python基础开发环境_Python基础教程,第一讲,开发环境搭建
- 深入浅出 ASP.NET Core 与 Docker 入门课程说明
- CSDN-Markdown-图片设置(大小,居中)
- 给各位ACMer,OIer详细介绍一下Codeforces比赛
- DirectSound开发
- 用Flask封装下Ansible提供后端API
- SpringMVC jsp界面值渲染不出来
- java程序示例_Java程序中的Google搜索示例
- ssh连接缓慢 ssh连接失败问题 Linux 脚本解决ssh连接缓慢问题,windows解决本地ssh连接失败
- OPPO R9s成为情侣最喜欢礼物,今年情人节就送它了!
- visio机柜设备图标_弱电各个设备安装设计大样图,可编辑!(CAD版本)
- 必看! 为什么“吉祥物”可以提高UI设计以及品牌影响力
- 刷BOIS的要点方法
- 初赛知识点汇总(阶段性完结
- 【空气质量数据分析专题四】超标状况分析
- 计算机专业—毕业设计题目大全
- 实测发现,微软 Win11 并不比 Win10 更快
热门文章
- android 变量onchange,Android内容查看器-onChange方法检查上一个呼...
- ​浅谈UWB基本定位原理
- 对付新上司,“三做四不做”,害人害己惹小人,吃亏是自己!
- tensorflow函数中minimize()函数
- scipy.optimize.minimize
- 龙族幻想微信一区哪个服务器人多,龙族幻想微信一区-命运之刃开服时间表_龙族幻想新区开服预告_第一手游网手游开服表...
- Tomcat部署war包
- 深入理解MySQL——数据库分区
- 设计一个Windows应用程序,要求如下: 构造一个产品基类。 分别定义家电、日用百货、衣服等派生类,具体要求有不同的特征和行为。 定义一个泛型货架类,约束参数类型为产品
- 「JVM 内存管理」低延迟的 Shenandoah GC 与 ZGC