各位大侠: 小弟正在使用CDC类开发USB转RS232,但不知下面的CDC类的特殊描述符是什么意思???
/* The Configuration Descriptor */ CONST PACKED_USB_CONFIG_DESCR PackedConfigDescr = { 9, /* bLength */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* descriptor type */ SWAP( PACKED_USB_CONFIG_DESCR_LEN ), /* length of packed config descr. (16b) */ 0x02, /* number of interfaces */ 0x01, /* configuration value */ 0x00, /* configuration string index (none) */ 0x80, /* attributes (self-powered, no remote wakeup) */ 0x0A, /* max power (0x0A * 2mA = 20mA) */ // 通信接口 /* Interface descriptor */ 9, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* descriptor type */ 0x00, /* interface number */ 0x00, /* alternate setting */ 0x01, /* number of endpoints (excl. EP0) */ 0x02, /* CDC class */ /* interface class (USBTMC=0xFE) */ 0x02, /* Abstract (Modem) */ /* interface subclass (USB488=0x03) */ 0x01, /* AT-Commands */ /* interface protocol (0x01)*/ 0x00, /* interface string index (none) */
/* CDC Class-Specific descriptor */ ???????????????????????????????? 这里是什么意思??????????????????????? 5, /* sizeof(usbDescrCDC_HeaderFn): length of descriptor in bytes */ 0x24, /* descriptor type */ 0, /* header functional descriptor */ 0x10, 0x01,
4, /* sizeof(usbDescrCDC_AcmFn): length of descriptor in bytes */ 0x24, /* descriptor type */ 2, /* abstract control management functional descriptor */ 0x02, /* SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE */
5, /* sizeof(usbDescrCDC_UnionFn): length of descriptor in bytes */ 0x24, /* descriptor type */ 6, /* union functional descriptor */ 0, /* CDC_COMM_INTF_ID */ 1, /* CDC_DATA_INTF_ID */
5, /* sizeof(usbDescrCDC_CallMgtFn): length of descriptor in bytes */ 0x24, /* descriptor type */ 1, /* call management functional descriptor */ 0, /* allow management on data interface, handles call management by itself */ 1, /* CDC_DATA_INTF_ID */
7, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* descriptor type */ 0x81, /* Endpoint dir'n (IN) & addr */ USB_ENDPOINT_TYPE_INTERRUPT, /* Endpoint type */ LO_BYTE( EP1_MAX_PACKET_SIZE ), /* Maximum pkt size (16) */ HI_BYTE( EP1_MAX_PACKET_SIZE ), 10, /* Polling interval (unit=frame=1mS) */
// 数据接口 /* Interface Descriptor */ 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ 4, /* descriptor type */ 1, /* index of this interface */ 0, /* alternate setting for this interface */ 2, /* endpoints excl 0: number of endpoint descriptors to follow */ 0x0A, /* Data Interface Class Codes */ 0, 0, /* Data Interface Class Protocol Codes */ 0, /* string index for interface */
7, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* descriptor type */ 0x82, /* Endpoint dir'n (IN) & addr */ USB_ENDPOINT_TYPE_BULK, /* Endpoint type */ LO_BYTE( EP2_MAX_PACKET_SIZE ), /* Maximum pkt size (64) */ HI_BYTE( EP2_MAX_PACKET_SIZE ), 10, /* Interval - usually ignored for bulk */ 7, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* descriptor type */ 0x02, /* Endpoint dir'n (OUT) & addr */ USB_ENDPOINT_TYPE_BULK, /* Endpoint type */ LO_BYTE( EP2_MAX_PACKET_SIZE ), /* Maximum pkt size (64) */ HI_BYTE( EP2_MAX_PACKET_SIZE ), 10, /* Interval - usually ignored for bulk */ }; |