阅读:1120回复:4
谁能帮我解释一下这段程序?谢谢
谁能给讲一下下面这段程序吗?我不明白啊!谢谢~~~~
void get_descriptor(void) {........... case 0x02:// USB_CONFIGURATION i = XmtBuff.b[7]; i = ((i<<8) | XmtBuff.b[6]); XmtBuff.wrLength = Configuration_Descriptor[2]; XmtBuff.p = Configuration_Descriptor; if(i<16) XmtBuff.wrLength = XmtBuff.b[6]; break; ............ USB_submit() } 设i的用意是什么? Configuration_Descriptor[2]的值是2e,而Configuration_Descriptor[]的长度是9,执行USB_submit()不就会出错了吗? 谢谢大家了!! |
|
|
沙发#
发布于:2002-05-21 12:59
没人理???我顶~~~~~~~~
给分啊! :o |
|
|
板凳#
发布于:2002-05-21 17:09
再顶~~~~ :( :mad: :o :D
|
|
|
地板#
发布于:2002-05-21 22:11
;-----------------------------------
Configuration_Descriptor[2]的值是2e ;----------------------------------- 这个值是Configuration Descriptor + Interface Descriptor + Endpoint Descriptor + ...的长度总和. 看看USB spec,Configuration Descriptor的TotalLength这个域是什么意义就明白了. ;------------------------------------ 而Configuration_Descriptor[]的长度是9 ;------------------------------------ Configuration Descriptor的长度是不是9? 答得对就加点分 |
|
地下室#
发布于:2002-05-22 00:17
Configuration_Descriptor[]定义如下:
code char Configuration_Descriptor[] = { 0x09, // 配置描述表长度 0x02, // 配置描述表类型 0x2e,0x00, // 配置描述表及附带表长度 0x01, // 接口配置数 0x01, // 配置描述表标识 0x00, // 配置描述表字符串描述表索引 0x60, // 配置属性 0x64 // 总线供电最大值(*2mA) }; 是9没错吧?难道指针还能自己再指向Interface_Descriptor[]等数组?(这是plasma兄贴上来的程序(无DMA)) 那i的作用呢?(i<<8)是什么意思? 先给一点分,以示鼓励!! :D 哈哈!开玩笑 :)谢谢你的解答,还请继续,分大大的........ :D |
|
|