打印

使用CDC类开发USB转RS232遇到的问题

[复制链接]
4105|6
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
wahahaabc|  楼主 | 2007-10-13 14:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
各位大侠:
小弟正在使用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 */ 
}; 

相关帖子

沙发
古道热肠| | 2007-10-14 16:14 | 只看该作者

USB转RS232

电脑还要写驱动的,能搞定吗?有些难度的哟!

使用特权

评论回复
板凳
wahahaabc|  楼主 | 2007-10-15 08:40 | 只看该作者

好像不需要写驱动,这要提供一个INF文件即可

使用特权

评论回复
地板
computer00| | 2007-10-15 08:51 | 只看该作者

看这个CDC的文档。www.usb.org有下载。

使用特权

评论回复
5
contiki| | 2012-6-19 20:52 | 只看该作者
到底windows还需要驱动吗

使用特权

评论回复
6
pipihahahah| | 2012-7-10 19:31 | 只看该作者
会楼上,用CDC就是为了不写驱动。

使用特权

评论回复
7
_nancy| | 2012-7-17 13:44 | 只看该作者
我現有也有這個需求, 請問樓主用哪個IC, 我用PIC試, 需要安裝驅動(inf)檔, 才可以用. 請問哪個IC CDC不用裝驅動!!

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

119

主题

627

帖子

0

粉丝