【USB笔记】超高速端点伙伴描述符SuperSpeed Endpoint Companion Descriptor

USB笔记 超高速端点伙伴描述符 (SuperSpeed Endpoint Companion Descriptor)

超高速端点伙伴描述符 (SuperSpeed Endpoint Companion Descriptor)用于支持增强型超高速功能(Enhanced SuperSpeed capabilities)。

只有运行于Gen X速度(Gen X speed)的增强型超高速设备(Enhanced SuperSpeed devices)才能返回。接口中描述的每个端点后面都有一个超高速端点伙伴描述符 (SuperSpeed Endpoint Companion Descriptor)。超高速端点伙伴描述符 (SuperSpeed Endpoint Companion Descriptor)总是在配置信息中,跟随在与其相关联的端点描述符(Endpoint Descriptor)之后。

默认的控制管道(Control Pipe)没有超高速端点伙伴描述符 (SuperSpeed Endpoint Companion Descriptor)用于支持增强型超高速功能(Enhanced SuperSpeed capabilities)。

主机端获取超高速端点伙伴描述符 (SuperSpeed Endpoint Companion Descriptor),总是作为配置描述符(Configuration Descriptor)的一部分返回,不能直接用Get Descriptor或者Set Descriptor请求访问。

SuperSpeed Endpoint Companion Descriptor

OffsetFieldSizeValueDescription
0bLength1Number以字节为单位的描述符大小
1bDescriptorType1Constant超高速端点伙伴描述符类型
2bMaxBurst1Number端点突发的数据包最大数量
3bmAttributes1Bitmap端点的属性
4wBytesPerInterval2Number端点在每个服务间隔中将要传输的总字节数

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

bDescriptorType超高速端点伙伴描述符类型,为SUPERSPEED_USB_ENDPOINT_COMPANION (0x30)。

bMaxBurst 端点突发的数据包最大数量。端点在一次突发中可以发送或接收的数据包的最大数量。bMaxBurst的值等于这个突发数据包最大数量减1。有效值为0到15。值为0表示端点每次突发只能1个包,而15表示端点每次突发最多可以16个包。

对于控制端点(control endpoints),这个字段应设置为0。

bmAttributes端点的属性。

如果这是一个批量端点(Bulk Endpoint),用于确认支持的流(streams)的最大数量。

Bits 4…0 MaxStreams值,表明端点支持的流(streams)的最大数量。有效值为0到16,0表示端点未定义流(streams)。值1到16表示,支持的流(streams)的数量等于 2 M a x S t r e a m 2^{MaxStream} 2MaxStream,范围2 - 65536。

Bits 7…5 保留,这些bits都要设置为0。

如果这是一个控制端点(Control Endpoint)或者中断端点(Interrupt Endpoint)

Bits 7…0 保留,这些bits都要设置为0。

如果这是一个等时端点(isochronous endpoint),用于确定服务间隔(service interval)中的最大数据包数

Bits 1…0  Mult值。如果Bits 7 字段的值为0,那么这个Mult值和bMaxBurst值将一起确定这个端点支持的服务间隔(service interval)内的最大数据包数量。
      最大数据包数 = (bMaxBurst + 1) x (Mult + 1)
      Mult值的有效值为0到2。如果bMaxBurst字段设置为零,则该字段应设置为零。

      因此,允许的最大数据包数 = (bMaxBurst + 1) x (Mult + 1) = (15 + 1) × (2 + 1) = 48。当wMaxPacketSize = 1024时,吞吐量为每个服务间隔49152B,就是最大48KB。

      如果每个服务间隔(service interval)传输超过48 KB的SuperSpeedPlus端点使用规范(USB 3.1及以上)中的超高速加等时端点伙伴描述符(SuperSpeedPlus Isochronous Endpoint Companion Descriptor)来指定每个服务间隔的最大数据包数。

      在USB3.0中,该字段不受Bits 7 字段的影响。因为Bits 7 字段保留,被设置为0。


Bits 6…2  保留,这些bits都要设置为0。

Bits 7    SSP ISO Companion(SuperSpeedPlus Isochronous Endpoint Companion)。这个字段用于确认是否使用那么超高速加等时端点伙伴描述符(SuperSpeedPlus Isochronous Endpoint Companion Descriptor)。如果这个字段被设置为1,那么超高速加等时端点伙伴描述符(SuperSpeedPlus Isochronous Endpoint Companion Descriptor)就应该跟随在该描述符之后出现,并且Bits 1…0的Mult字段无效。

      实际的Mult应该确定如下:
      dwBytesPerInterval/bMaxBurst/wMaxPacketSize向上取整到最近的整数值。

      该字段在USB 3.1中开始被定义,在USB 3.0协议中该字段保留,被设置为0。

wBytesPerInterval端点在每个服务间隔(service interval (SI))中将要传输的总字节数。

该字段只对周期性端点有效,即只对中断(interrupt)和等时(isochronous)端点有效。

对于控制(control)和批量(bulk)端点,该字段未使用,被保留的,必须将其设置为零。

对于等时(isochronous)端点:

  • 如果bmAttributes字段中SSP ISO Companion位的值设置为0,那么这个字段的值用于保留调度(schedule)中的总线时间(bus time),这是每个服务间隔(service interval (SI))的帧数据有效载荷(frame data payloads)所需的。 在持续运行的基础上(on an ongoing basis),管道实际使用的带宽可能少于保留的带宽。 如有必要,设备会通过其正常的,非USB定义的机制报告(non-USB defined mechanisms)实际使用的带宽。
  • 如果bmAttributes字段中SSP ISO Companion位的值设置为1,那么这个字段的值应被设置为1,并且这个端点的将要传输的总字节数,应该通过超高速加等时端点伙伴描述符(SuperSpeedPlus Isochronous Endpoint Companion Descriptor)来上报。

获取超高速端点伙伴描述符

主机通过发送Get Descriptor请求,取得配置描述符,接口描述符,端点描述符及超高速端点伙伴描述符。超高速端点伙伴描述符 (SuperSpeed Endpoint Companion Descriptor)总是作为配置描述符的一部分返回。

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

下面举例说明一个获取超高速端点伙伴描述符的过程。

获取一个超高速端点伙伴描述符SuperSpeed Endpoint Companion Descriptor,该超高速端点伙伴描述符 SuperSpeed Endpoint Companion Descriptor如下所示:
0

使用USB分析仪抓包可以看到,获取配置描述符Configuration Descriptor,而超高速端点伙伴描述符 SuperSpeed Endpoint Companion Descriptor就包含在其中:
1

超高速端点伙伴描述符SuperSpeed Endpoint Companion Descriptor的获取过程如下:
2

setup data:
3

完成整个超高速端点伙伴描述符SuperSpeed Endpoint Companion Descriptor的获取。


描述符示例

这里举例一个带有超高速端点伙伴描述符SuperSpeed Endpoint Companion Descriptor的示例设备。

Device Descriptor

OffsetFieldSizeValueDescription
0bLength10x12
1bDescriptorType10x01DEVICE
2bcdUSB20x03003.00
4bDeviceClass10x09
5bDeviceSubClass10x00
6bDeviceProtocol10x03
7bMaxPacketSize010x09
8idVendor20x046d
10idProduct20xc31c
12bcdDevice20x640064.00
14iManufacturer10x01
15iProduct10x02
16iSerialNumber10x00
17bNumConfigurations10x01

Configuration Descriptor

OffsetFieldSizeValueDescription
0bLength10x09
1bDescriptorType10x02CONFIGURATION
2wTotalLength20x001f
4bNumInterfaces10x01
5bConfigurationValue10x01
6iConfiguration10x00
7bmAttributes10xe0
8bMaxPower10x12

Interface Descriptor

OffsetFieldSizeValueDescription
0bLength10x09
1bDescriptorType10x04INTERFACE
2bInterfaceNumber10x00
3bAlternateSetting10x00
4bNumEndpoints10x01
5bInterfaceClass10x09
6bInterfaceSubClass10x00
7bInterfaceProtocol10x00
8iInterface10x00

Endpoint Descriptor

OffsetFieldSizeValueDescription
0bLength10x07
1bDescriptorType10x05ENDPOINT
2bEndpointAddress10x833 IN
3bmAttributes10x13Interrupt
4wMaxPacketSize20x0002
6bInterval10x10

SuperSpeed Endpoint Companion Descriptor

OffsetFieldSizeValueDescription
0bLength10x06
1bDescriptorType10x30SUPERSPEED_USB_ENDPOINT_COMPANION
2bMaxBurst10x00
3bmAttributes10x00
4wBytesPerInterval20x0002

附录

USB 3.1/3.2 SuperSpeed Endpoint Companion Descriptor

OffsetFieldSizeValueDescription
0bLength1NumberSize of this descriptor in bytes
1bDescriptorType1ConstantSUPERSPEED_USB_ENDPOINT_COMPANION Descriptor Type
2bMaxBurst1NumberThe maximum number of packets the endpoint can send or receive as part of a burst. Valid values are from 0 to 15. A value of 0 indicates that the endpoint can only burst one packet at a time and a value of 15 indicates that the endpoint can burst up to 16 packets at a time.
For endpoints of type control this shall be set to 0.
3bmAttributes1BitmapIf this is a Bulk Endpoint:
BitsDescription
 4:0 MaxStreams. The maximum number of streams this endpoint supports. Valid values are from 0 to 16, where a value of 0 indicates that the endpoint does not define streams. For the values 1 to 16, the number of streams supported equals 2 M a x S t r e a m 2^{MaxStream} 2MaxStream .
 7:5 Reserved. These bits are reserved and shall be set to zero.

If this is a Control or Interrupt Endpoint:
BitsDescription
 7:0 Reserved. These bits are reserved and shall be set to zero.

If this is an isochronous endpoint:
BitsDescription
 1:0 Mult. A zero based value that determines the maximum number of packets within a service interval that this endpoint supports.
Maximum number of packets = (bMaxBurst + 1) x (Mult + 1)
The maximum value that can be set in this field is 2. This field shall be set to zero if the bMaxBurst field is set to zero.
 6:2 Reserved. These bits are reserved and shall be set to zero.
 7 SSP ISO Companion. If this field is set to one then a SuperSpeedPlus Isochronous Endpoint Companion descriptor shall immediately follow this descriptor and the value in the Mult field shall be ignored.
The actual Mult shall be determined as follows:
dwBytesPerInterval/bMaxBurst/wMaxPacketSize rounded up to the nearest integer value…
4wBytesPerInterval2NumberThe total number of bytes this endpoint will transfer every service interval (SI). This field is only valid for periodic endpoints. For isochronous endpoints:
•  If the SSP ISO Companion bit in the bmAttributes field is set to zero, this value is used to reserve the bus time in the schedule, required for the frame data payloads per SI. The pipe may, on an ongoing basis, actually use less bandwidth than that reserved. The device reports, if necessary, the actual bandwidth used via its normal, non-USB defined mechanisms.
•  If the SSP ISO Companion bit in the bmAttributes field is set to one, this field shall be set to one, and the total number of bytes this endpoint will transfer shall be reported via the endpoint’s SuperSpeedPlus Isochronous Endpoint Companion descriptor.
wBytesPerInterval is reserved and must be set to zero for control and bulk endpoints.

USB 3.0 SuperSpeed Endpoint Companion Descriptor

OffsetFieldSizeValueDescription
0bLength1NumberSize of this descriptor in bytes
1bDescriptorType1ConstantSUPERSPEED_USB_ENDPOINT_COMPANION Descriptor Type
2bMaxBurst1NumberThe maximum number of packets the endpoint can send or receive as part of a burst. Valid values are from 0 to 15. A value of 0 indicates that the endpoint can only burst one packet at a time and a value of 15 indicates that the endpoint can burst up to 16 packets at a time.
For endpoints of type control this shall be set to 0.
3bmAttributes1BitmapIf this is a Bulk Endpoint:
BitsDescription
 4:0 MaxStreams. The maximum number of streams this endpoint supports. Valid values are from 0 to 16, where a value of 0 indicates that the endpoint does not define streams. For the values 1 to 16, the number of streams supported equals 2 M a x S t r e a m 2^{MaxStream} 2MaxStream .
 7:5 Reserved. These bits are reserved and shall be set to zero.

If this is a Control or Interrupt Endpoint:
BitsDescription
 7:0 Reserved. These bits are reserved and shall be set to zero.

If this is an isochronous endpoint:
BitsDescription
 1:0 Mult. A zero based value that determines the maximum number of packets within a service interval that this endpoint supports.
Maximum number of packets = bMaxBurst x (Mult + 1)
The maximum value that can be set in this field is 2.
 7:2 Reserved. These bits are reserved and shall be set to zero.
4wBytesPerInterval2NumberThe total number of bytes this endpoint will transfer every service interval. This field is only valid for periodic endpoints.
For isochronous endpoints, this value is used to reserve the bus time in the schedule, required for the frame data payloads per 125 μs. The pipe may, on an ongoing basis, actually use less bandwidth than that reserved. The device reports, if necessary, the actual bandwidth used via its normal, non-USB defined mechanisms.

[参考资料]

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/110210073

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值