现在的位置: 首页 > 综合 > 正文

USB Descriptor (一)

2014年02月16日 ⁄ 综合 ⁄ 共 3535字 ⁄ 字号 评论关闭
USB 有很多的描述符下面一一列举:(整理人BOX)关于一些其他的不太清楚(二)会贴出来···希望得到补齐!
1.Device descriptor:设备描述符包含以下的信息。
    0x00,0x03,                      /* USB 3.0 */
    0x00,                           /* Device class 类代码接口描述符中获取*/
    0x00,                           /* Device sub-class 子类代码*/
    0x00,                           /* Device protocol 协议代码,00表示不使用任何设备类协议*/
    0x09,                           /* Maxpacket size for EP0 : 2^9 端点0支持最大数据包长度*/
    0xB4,0x04,                      /* Vendor ID 供应商ID*/
    0xF0,0x00,                      /* Product ID 产品ID*/
    0x00,0x00,                      /* Device release number 设备版本号*/
    0x01,                           /* Manufacture string index 供应商字符串描述符索引:用于表示供应商字符

串描述符的索引值。具体字符串的内容在后面字符串描述符中定义。如果没有供应商字符串,可以置0。*/
    0x02,                           /* Product string index 产品字符串描述符索引*/
    0x00,                           /* Serial number string index 用于表示设备序列号字符串描述符的索引值,

如果没有,可以置为0。*/
    0x01                            /* Number of configurations 用于表示该USB设备所支持的配置数。*/  

 
2.Device descriptor type BOS for Super Speed:待续!

3.Configuration descriptor配置描述符:
    0x09,                           /* Descriptor size 接下来的描述信息的长度*/
    CY_U3P_USB_CONFIG_DESCR,        /* Configuration descriptor type 描述符的类型*/
    0x2C,0x00,                      /* Length of this descriptor and all sub descriptors 用于表示配置信息

的总长度,包括配置描述符、接口描述符、端点描述符长度的总和。*/
    0x01,                           /* Number of interfaces 用于表示配置所支持的接口数。一般来说,USB设备的

接口至少有一个,因此其最小值为1。*/
    0x01,                           /* Configuration number 用于表示USB设备的配置值。*/
    0x00,                           /* COnfiguration string index 用于指出配置字符串描述符的索引值。具体字

符串的内容在后面字符串描述符中定义。如果没有配置字符串,可以置为0。*/
    0x80,                           /* Config characteristics - Bus powered 用于表示USB设备特性。

bmAttributes是接位寻址的,第6位置1表示使用总线电源;第5位置1表示支持远程唤醒功能;该字段其他位均保留,一般来

说,第0~4位置0即可,第7位置1即可。*/
    0x32,                           /* Max power consumption of device (in 8mA unit) : 400mA 用于表示USB设

备运行时所需要消耗的总线电流,单位以8mA为基准。USB设备可以从USB总线上获得最大的电流为500mA,因此bMaxPower字段

的最大值可以设置为250。*/

4.Interface Descriptor:接口描述。
    0x09,                           /* Descriptor size */
    CY_U3P_USB_INTRFC_DESCR,        /* Interface Descriptor type */
    0x00,                           /* Interface number 接口号*/
    0x00,                           /* Alternate setting number 可替换设置值*/
    0x02,                           /* Number of end points 端点0以外的端点数*/
    0xFF,                           /* Interface class 类代码和device里面的00对应*/
    0x00,                           /* Interface sub class 子类代码*/
    0x00,                           /* Interface protocol code 协议代码*/
    0x00,                           /* Interface descriptor string index 字符串描述符的索引值*/

5.Endpoint descriptor:端点描述符。
    0x07,                           /* Descriptor size */
    CY_U3P_USB_ENDPNT_DESCR,        /* Endpoint descriptor type */
    CY_FX_EP_PRODUCER,              /* Endpoint address and description 端点号,用于表示端点的端点号以及端

点的数据传输方向。第七位表示端点的数据传输方向,0表示OUT数据传输,1表示IN数据传输;第0~位表示端点号,例如001B

表示端点1、010B表示端点2;其余位均保留,必须置0。*/
    CY_U3P_USB_EP_BULK,             /* Bulk endpoint type 端点类型是BULK*/
    0x00,0x04,                      /* Max packet size = 1024 bytes */
    0x00,                 /* Servicing interval for data transfers : 0 for bulk 数据的访问间隔*/

6.qualifier descriptor:设备限定描述符。
    0x0A,                           /* Descriptor size */
    CY_U3P_USB_DEVQUAL_DESCR,       /* Device qualifier descriptor type */
    0x00,0x02,                      /* USB 2.0 用于表示USB设备及其描述符所遵循的USB规范版本,以BCD码的形式

表示,其值必须在版本2.0以上。*/
    0x00,                           /* Device class */
    0x00,                           /* Device sub-class */
    0x00,                           /* Device protocol */
    0x40,                           /* Maxpacket size for EP0 : 64 bytes */
    0x01,                           /* Number of configurations */
    0x00                            /* Reserved */

抱歉!评论已关闭.