打印

请教USB数据传输大小问题

[复制链接]
2460|8
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
kingyou|  楼主 | 2009-3-27 16:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    请教下当主机驱动端读取的字节数可不可以大于设备端返回的字节数?谢谢了先....
    我试过当主机驱动端读取的字节数小于设备端返回的字节数时,驱动会读取失败,但是当主机驱动端读取的字节数小于设备端返回的字节数时,很多时候主机端读取一次数据,D12端会产生两到三次中断,然后D12就会返回几次数据...

相关帖子

沙发
computer00| | 2009-3-27 16:15 | 只看该作者

可以少于。在驱动程序中指定,数据少于指定字节时,是否

使用特权

评论回复
板凳
kingyou|  楼主 | 2009-3-27 16:21 | 只看该作者

谢谢了

谢谢了,但是还有个问题就是为什么主机驱动端读取的字节数小于设备端返回的字节数时,D12会产生多次中断呢?
想了好久没想明白,不知道是我驱动的问题还是没操作好D12的问题。

使用特权

评论回复
地板
kingyou|  楼主 | 2009-3-27 16:31 | 只看该作者

谢谢了

具体情况是这样的:
    我现在想在主机端通过使用USB通过D12来读取我设备端上网卡接收到的数据包,我每次固定读取1536个字节的数据,然后D12将实际接收到的一个网络包发送给主机,因为基本上D12发送的数据都小于主机请求的1536个字节,这样的话每次我的D12都会中断几次,将接收到的数据包重复发给主机几次...请求高人给解释下原因啊,谢谢了...

使用特权

评论回复
5
computer00| | 2009-3-27 16:58 | 只看该作者

D12端点大小最大只有64字节,当然要多次中断才能发送完毕了

使用特权

评论回复
6
小小电子| | 2009-3-30 22:55 | 只看该作者

借宝地问个问题

如果主机请求返回大数据大于描述符的大小      那么我只返回描述符的大小是否可以呢?

使用特权

评论回复
7
小小电子| | 2009-3-30 23:01 | 只看该作者

忘记贴上这个了

## Starting application at 0x0C008000 ...
/************************************************************/
this is my usbtest on S3C44B0x
/************************************************************/
System Initialized done.
Find Pdiusbd12, chip id = 1210
the dmaset is 40
the usb init is success!
the irq ep0out is happen!
the pkt is 80
the pkt is 6
the pkt is 0
the pkt is 1
the pkt is 0
the pkt is 0
the pkt is 40
the pkt is 0
the irq ep0in is happen!
Usb_GetDescriptor is happen!
the buf is 12
the buf is 1
the buf is 10
the buf is 1
the buf is 0
the buf is 0
the buf is 0
the buf is 10
the buf is 71
the buf is 4
the buf is 22
the buf is 2
the buf is 13
the buf is 1
the buf is 0
the buf is 0
have send Desc!!
the irq busreset is happen!
the irq bussuspend is happen!
the irq ep0in is happen!
Usb_GetDescriptor is happen!
the buf is 12
the buf is 1
have send Desc!!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq busreset is happen!
the irq ep0out is happen!
the pkt is 80
the pkt is 6
the pkt is 0
the pkt is 1
the pkt is 0
the pkt is 0
the pkt is 40
the pkt is 0
the irq ep0in is happen!
Usb_GetDescriptor is happen!
the buf is 12
the buf is 1
the buf is 10
the buf is 1
the buf is 0
the buf is 0
the buf is 0
the buf is 10
the buf is 71
the buf is 4
the buf is 22
the buf is 2
the buf is 13
the buf is 1
the buf is 0
the buf is 0
have send Desc!!
the irq ep0in is happen!
Usb_GetDescriptor is happen!
the buf is 12
the buf is 1
have send Desc!!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!
the irq ep0in is happen!

使用特权

评论回复
8
kingyou|  楼主 | 2009-3-30 23:07 | 只看该作者

可以

可以的。。

使用特权

评论回复
9
computer00| | 2009-3-30 23:09 | 只看该作者

可以。注意当少于请求数据量时,刚好又是端点大小整数倍

需要返回一个0长度的数据包以结束数据过程。

使用特权

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

本版积分规则

11

主题

33

帖子

0

粉丝