且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

基于OHCI的USB主机 —— USB设备描述符数据结构

更新时间:2022-09-16 11:17:58

根据USB规范,定义各种描述符的数据结构如下:
/**

 设备描述符

 */

typedef struct _DEVICE_DESC

{   BYTE bLength;

    BYTE bDescriptorType;

    WORD bcdUSB;

    BYTE bDeviceClass;

    BYTE bDeviceSubClass;

    BYTE bDeviceProtocol;

    BYTE bMaxPacketSize0;

    WORD idVendor;

    WORD idProduct;

    WORD bcdDevice;

    BYTE iManufacturer;

    BYTE iProduct;

    BYTE iSerialNumber;

    BYTE bNumConfigurations;

DEVICE_DESC, *pDevDesc;

 

/**

 配置描述符

 */

typedef struct _CFGDESC

{  

    BYTE bLength;              // Size of descriptor in Byte

    BYTE bType;              // Configuration

    WORD wLength;              // Total length

    BYTE bNumIntf;           // Number of interface

    BYTE bCV;                   // bConfigurationValue

    BYTE bIndex;               // iConfiguration

    BYTE bAttr;                // Configuration Characteristic

    BYTE bMaxPower;          // Power config

    BYTE rsvd;

CFG_DESC, *pCfgDesc;

 

/**

 接口描述符

 */

typedef struct _INTF_DESC

{   BYTE bLength;

    BYTE bType;

    BYTE iNum;

    BYTE iAltString;

    BYTE bEndPoints;

    BYTE iClass;

    BYTE iSub;

    BYTE iProto;

    BYTE iIndex;

INTF_DESC, *pIntfDesc;

 

/**

 端点描述符

 */

typedef struct _ED_DESC

{   BYTE bLength;

    BYTE bType;

    BYTE bEPAdd;

    BYTE bAttr;

    WORD wPayLoad;               // low-speed this must be 0x08

    BYTE bInterval;

    BYTE rsvd;

ED_DESC, *pEPDesc;





本文转自 tywali 51CTO博客,原文链接:http://blog.51cto.com/lancelot/274087,如需转载请自行联系原作者