关于usb cdc abstract control model的问题

宽哥111 2008-03-07 10:28:22
我想使用USB转成串口,通过普通的串口工具和板子通讯。
这是我使用的描述符,PC枚举上设备并出现了一个虚串口号,并且可以使用超级终端向板子这边发送字符,但是板子这边向PC发送字符,PC只通过IN TOKEN接收一个字符后,再也不发IN TOKEN了是不是使用超级终端不能直接从板子这边向PC发字符呢?

static T_U8 deviceDescrCDC[] = { /* USB device descriptor */
18, /* sizeof(usbDescriptorDevice): length of descriptor in bytes */
DEVICE_DESC_TYPE, /* descriptor type */
0x10, 0x01, /* USB version supported */
0x02, /* device class: CDC */
0, /* subclass */
0, /* protocol */
64, /* max packet size */
0x71, 0x04, /* 2 bytes */
0x77, 0x07, /* 2 bytes: shared PID for CDC-ACM devices */
0x00, 0x01, /* 2 bytes */
0, /* manufacturer string index */
0, /* product string index */
0, /* serial number string index */
1, /* number of configurations */
};

static T_U8 configDescrCDC[] = { /* USB configuration descriptor */
9, /* sizeof(usbDescrConfig): length of descriptor in bytes */
2, /* descriptor type */
67,
0, /* total length of data returned (including inlined descriptors) */
2, /* number of interfaces in this configuration */
1, /* index of this configuration */
0, /* configuration name string index */
0x80,
50, /* max USB current in 2mA units */

/* interface descriptor follows inline: */
9, /* sizeof(usbDescrInterface): length of descriptor in bytes */
4, /* descriptor type */
0, /* index of this interface */
0, /* alternate setting for this interface */
1, /* endpoints excl 0: number of endpoint descriptors to follow */
0x02, /* CDC class */
2, /* Abstract (Modem) */
//1, /* AT-Commands */
0, /* No protocol code */
0, /* string index for interface */

/* CDC Class-Specific descriptor */
5, /* sizeof(usbDescrCDC_HeaderFn): length of descriptor in bytes */
0x24, /* descriptor type */
0, /* header functional descriptor */
0x10, 0x01,

5, /* Size of this descriptor */
0x24, /* CS_INTERFACE type */
1, /* Call management descriptor */
0x01, /* Call management is handled by the device */
0x01, /* Data interface is 0x01 */

4, /* Size of this descriptor */
0x24, /* CS_INTERFACE type */
2, /* Abstract control management functional descriptor */
7, /* Every request/notification except NetworkConnection supported */

5, /* Size of this descriptor */
0x24, /* CS_INTERFACE type */
6, /* union functional descriptor */
0x00, /* Master interface is 0x00 (Communication class interface) */
0x01, /* First slave interface is 0x01 */

/* Endpoint Descriptor */
7, /* sizeof(usbDescrEndpoint) */
5, /* descriptor type = endpoint */
0x81, /* IN endpoint number 1 */
0x03, /* attrib: Interrupt endpoint */
64, 0, /* maximum packet size */
10, /* in ms */

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

/* Endpoint Descriptor */
7, /* sizeof(usbDescrEndpoint) */
5, /* descriptor type = endpoint */
0x03, /* OUT endpoint number 3 */
0x02, /* attrib: Bulk endpoint */
64,
0, /* maximum packet size */
0, /* in ms */

/* Endpoint Descriptor */
7, /* sizeof(usbDescrEndpoint) */
5, /* descriptor type = endpoint */
0x82, /* IN endpoint number 2 */
0x02, /* attrib: Bulk endpoint */
64,
0, /* maximum packet size */
0, /* in ms */
};
...全文
3164 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
l456789 2008-11-19
  • 打赏
  • 举报
回复
你发了IN TOKEN后,嵌入处理器端要清除相应状态,以响应PC的下一个IN请求啊.

21,595

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧