【USB笔记】超高速设备功能描述符SuperSpeed Device Capability Descriptor

USB笔记 超高速设备功能描述符(SuperSpeed Device Capability Descriptor)

超高速设备功能描述符(SuperSpeed Device Capability Descriptor)是设备功能类型码(Device Capability Type Codes)为SUPERSPEED_USB的一个设备功能描述符(Device Capability Descriptor)。超高速设备功能描述符(SuperSpeed Device Capability Descriptor)定义了增强型超高速设备(Enhanced SuperSpeed devices)所需的设备级功能描述符,所有的增强型超高速设备(Enhanced SuperSpeed devices)都需要有该描述符。

超高速设备功能描述符(SuperSpeed Device Capability Descriptor)作为一种设备功能描述符(Device Capability Descriptor),总是作为GetDescriptor(BOS)请求所返回的BOS信息的一部分。主机端不能单独读取单个的超高速设备功能描述符(SuperSpeed Device Capability Descriptor),无法使用GetDescriptor()或SetDescriptor()请求直接读取或设置单独的设备功能,只能通过GetDescriptor()请求获取BOS描述符(BOS Descriptor)并通过wTotalLength字段得到长度来读取整个描述符集。

SuperSpeed Device Capability Descriptor

OffsetFieldSizeValueDescription
0bLength1Number以字节为单位的描述符大小
1bDescriptorType1Constant设备功能描述符类型DEVICE CAPABILITY
2bDevCapabilityType1Constant设备功能类型为SUPERSPEED_USB (03H)
3bmAttributes1Bitmap设备功能的属性
4wSpeedsSupported2Bitmap设备支持的速度
6bFunctionalitySupport1Number设备支持的所有功能对用户可用的最低速度
7bU1DevExitLat1NumberU1设备退出延迟
8wU2DevExitLat2NumberU2设备退出延迟

bLength以字节为单位的描述符大小 (0x0A)。

bDescriptorType设备功能描述符类型,为DEVICE CAPABILITY (0x10)。

bDevCapabilityType 设备功能类型,为SUPERSPEED_USB (0x03)。

bmAttributes 支持的设备级别功能。位(bit)置1表示支持该功能,置0表示不支持该功能。

Bits 0  保留,应该设置为0。

Bits 1  具有LTM功能。该位(bit)置1表示这个设备能够生成延迟容忍消息(Latency Tolerance Messages)。

Bits 7:2 保留,应该设置为0。

wSpeedsSupported 这个设备支持的速度。

Bits 0   如果这个位(bit)置1,那么这个设备支持低速USB(low-Speed USB)操作。

Bits 1   如果这个位(bit)置1,那么这个设备支持全速USB(full-Speed USB)操作。

Bits 2   如果这个位(bit)置1,那么这个设备支持高速USB(high-Speed USB)操作。

Bits 3  如果这个位(bit)置1,那么这个设备支持Gen 1 speed操作。

Bits 15:4 保留,应该设置为0。

bFunctionalitySupport 设备支持的所有功能对用户可用的最低速度。

例如,如果设备以全速及以上速度连接时支持所有功能,则将这个值设置为1。请参考wSpeedsSupported字段,了解可以放在该字段中的有效值。

bU1DevExitLat U1设备退出延迟(U1 Device Exit Latency)。

从 U1 到 U0 在最坏情况下的延迟,假设该延迟仅受设备而非设备的链路伙伴限制。

这个字段仅适用于与单个端口相关联的退出延迟,不适用于通过集线器(hub)的总延迟(例如,从下游端口到上游端口)。

有效值如下:

00H 0

01H 小于1 µs

02H 小于 2 µs

03H 小于 3 µs

04H 小于 4 µs

… …

0AH 小于 10 µs

0BH – FFH 保留

对于集线器(hub),这是其上游端口和下游端口的值。

wU2DevExitLat U2设备退出延迟(U2 Device Exit Latency)。

从 U2 到 U0 在最坏情况下的延迟,假设该延迟仅受设备而非设备的链路伙伴限制。适用于设备上的所有端口。

有效值如下:

0000H 0

0001H 小于1 µs

0002H 小于 2 µs

0003H 小于 3 µs

0004H 小于 4 µs

… …

07FFH 小于 2047 µs

0800H – FFFFH 保留

对于集线器(hub),这是其上游端口和下游端口的值。


获取设备功能描述符(Device Capability Descriptor) : 超高速设备功能描述符(SuperSpeed Device Capability Descriptor)

主机通过发送Get Descriptor请求,取得BOS描述符及其子描述符。超高速设备功能描述符(SuperSpeed Device Capability Descriptor)作为一种设备功能描述符(Device Capability Descriptor),总是作为BOS描述符的一部分返回。

Get DescriptorValue
bmRequestType0x80
  bmRequestType.Recipient0b00000(Device)
  bmRequestType.Type0b00(Standard)
  bmRequestType.Direction0b1(Device-to-Host)
bRequest0x06(Get Descriptor)
wValue0x0f00(BOS#0)
wIndex0x0000
wLength0x???

下面举例说明一个获取设备功能描述符(Device Capability Descriptor)的过程。使用USB分析仪抓包,软件Total Phase Data Center。这是一个增强型高速设备运行在高速模式下的抓包。

获取一个设备的设备功能描述符(Device Capability Descriptor),该设备的设备功能描述符(Device Capability Descriptor)如下所示,这是一个SuperSpeed Device Capability Descriptor:
0

使用USB分析仪抓包可以看到,获取BOS描述符(BOS Descriptor),而设备功能描述符(Device Capability Descriptor)就包含在其中:
1

设备功能描述符(Device Capability Descriptor)的获取过程如下:
2

再展开看到详细的过程:
3

接下来详细看整个获取过程的各个字段含义:
4

一开始的setup包过程:
5

setup data:
6

IN包过程
7

OUT包过程:
8

完成整个设备功能描述符(Device Capability Descriptor)的获取。


描述符示例

这里举例一个带有超高速设备功能描述符(SuperSpeed Device Capability Descriptor)的完整BOS描述符(BOS Descriptor)。

USB 3.x BOS Descriptor

OffsetFieldSizeValueDescription
0bLength10x05
1bDescriptorType10x0fBOS
2wTotalLength20x0016
4bNumDeviceCaps10x02

Device Capability Descriptor : USB 2.0 Extension Descriptor

OffsetFieldSizeValueDescription
0bLength10x07
1bDescriptorType10x10DEVICE_CAPABILITY
2bDevCapabilityType10x02USB 2.0 EXTENSION
3bmAttributes40x00000002LPM Supported

Device Capability Descriptor : SuperSpeed Device Capability Descriptor

OffsetFieldSizeValueDescription
0bLength10x0a
1bDescriptorType10x10DEVICE_CAPABILITY
2bDevCapabilityType10x03SUPERSPEED_USB
3bmAttributes10x00LTM Not Supported
4wSpeedsSupported20x000e
6bFunctionalitySupport10x02High Speed
7bU1DevExitLat10x0aLess than 10 us
8wU2DevExitLat20x0100Less than 256 us

附录

USB 3.0 Device Capability Descriptor : SuperSpeed Device Capability Descriptor

OffsetFieldSizeValueDescription
0bLength1NumberSize of descriptor
1bDescriptorType1ConstantDEVICE CAPABILITY Descriptor type
2bDevCapabilityType1ConstantCapability type: SUPERSPEED_USB
3bmAttributes1BitmapBitmap encoding of supported device level features. A value of one in a bit location indicates a feature is supported; a value of zero indicates it is not supported.
Encodings are:
BitEncoding
 0  Reserved. Shall be set to zero.
 1  LTM Capable. A value of one in this bit location indicates that this device has is capable of generating Latency Tolerance Messages.
 7:2 Reserved. Shall be set to zero.
4wSpeedsSupported2BitmapBitmap encoding of the speed supported by this device when operating in SuperSpeed mode.
BitEncoding
 0  If this bit is set, then the device supports operation at low-Speed USB.
 1  If this bit is set, then the device supports operation at full-Speed USB.
 2  If this bit is set, then the device supports operation at high-Speed USB.
 3  If this bit is set, then the device supports operation at 5 Gbps.
 15:4 Reserved. Shall be set to zero.
6bFunctionalitySupport1NumberThe lowest speed at which all the functionality supported by the device is available to the user. For example if the device supports all its functionality when connected at full speed and above then it sets this value to 1.
Refer to the wSpeedsSupported field for valid values that can be placed in this field.
7bU1DevExitLat1NumberU1 Device Exit Latency. Worst case latency to transition from U1 to U0, assuming the latency is limited only by the device and not the device’s link partner.
This field applies only to the exit latency associated with an individual port, and does not apply to the total latency through a hub (e.g., from downstream port to upstream port).
The following are permissible values:
ValueMeaning
 00H  Zero.
 01H  Less than 1 µs
 02H  Less than 2 µs
 03H  Less than 3 µs
 04H  Less than 4 µs
 … …
 0AH  Less than 10 µs
 0BH –  Reserved
 FFH
For a hub, this is the value for both its upstream and downstream ports.
8wU2DevExitLat2NumberU2 Device Exit Latency. Worst case latency to transition from U2 to U0, assuming the latency is limited only by the device and not the device’s link partner. Applies to all ports on a device.
The following are permissible values:
Value  Meaning
 0000H  Zero
 0001H  Less than 1 µs
 0002H  Less than 2 µs
 0003H  Less than 3 µs
 0004H  Less than 4 µs
 … …
 07FFH  Less than 2047 µs
 0800H –  Reserved
 FFFFH
For a hub, this is the value for both its upstream and downstream ports.

USB 3.1/USB 3.2 Device Capability Descriptor : SuperSpeed Device Capability Descriptor

OffsetFieldSizeValueDescription
0bLength1NumberSize of descriptor
1bDescriptorType1ConstantDEVICE CAPABILITY Descriptor type
2bDevCapabilityType1ConstantCapability type: SUPERSPEED_USB
3bmAttributes1BitmapBitmap encoding of supported device level features. A value of one in a bit location indicates a feature is supported; a value of zero indicates it is not supported.
Encodings are:
BitEncoding
 0  Reserved. Shall be set to zero.
 1  LTM Capable. A value of one in this bit location indicates that this device has is capable of generating Latency Tolerance Messages.
 7:2 Reserved. Shall be set to zero.
4wSpeedsSupported2BitmapBitmap encoding of the speed supported by this device.
BitEncoding
 0  If this bit is set, then the device supports operation at low-Speed USB.
 1  If this bit is set, then the device supports operation at full-Speed USB.
 2  If this bit is set, then the device supports operation at high-Speed USB.
 3  If this bit is set, then the device supports operation at Gen 1 speed.
 15:4 Reserved. Shall be set to zero.
6bFunctionalitySupport1NumberThe lowest speed at which all the functionality supported by the device is available to the user. For example if the device supports all its functionality when connected at full speed and above then it sets this value to 1.
Refer to the wSpeedsSupported field for valid values that can be placed in this field.
7bU1DevExitLat1NumberU1 Device Exit Latency. Worst case latency to transition from U1 to U0, assuming the latency is limited only by the device and not the device’s link partner.
This field applies only to the exit latency associated with an individual port, and does not apply to the total latency through a hub (e.g., from downstream port to upstream port).
The following are permissible values:
ValueMeaning
 00H  Zero.
 01H  Less than 1 µs
 02H  Less than 2 µs
 03H  Less than 3 µs
 04H  Less than 4 µs
 … …
 0AH  Less than 10 µs
 0BH –  Reserved
 FFH
For a hub, this is the value for both its upstream and downstream ports.
8wU2DevExitLat2NumberU2 Device Exit Latency. Worst case latency to transition from U2 to U0, assuming the latency is limited only by the device and not the device’s link partner. Applies to all ports on a device.
The following are permissible values:
Value  Meaning
 0000H  Zero
 0001H  Less than 1 µs
 0002H  Less than 2 µs
 0003H  Less than 3 µs
 0004H  Less than 4 µs
 … …
 07FFH  Less than 2047 µs
 0800H –  Reserved
 FFFFH
For a hub, this is the value for both its upstream and downstream ports.

[参考资料]

Universal Serial Bus 3.0 Specification

Universal Serial Bus 3.1 Specification

Universal Serial Bus 3.2 Specification

USB Complete, 5th Edition

USB开发大全


本文链接:https://blog.csdn.net/u012028275/article/details/110307047

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值