打印

请教68013的Bulkloop例程的部分程序

[复制链接]
3334|10
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
zyzyzy407|  楼主 | 2011-12-11 17:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
SCR, TE, DSC, des, se
本帖最后由 zyzyzy407 于 2011-12-11 17:16 编辑

// The following section of code is used to relocate the descriptor table.
   // The frameworks uses SUDPTRH and SUDPTRL to automate the SETUP      requests
   // for descriptors.  These registers only work with memory locations
   // in the EZ-USB internal RAM.  Therefore, if the descriptors are located
   // in external RAM, they must be copied to in internal RAM.  
   // The descriptor table is relocated by the frameworks ONLY if it is found
   // to be located in external memory.
   pDeviceDscr = (WORD)&DeviceDscr;
   pDeviceQualDscr = (WORD)&DeviceQualDscr;
   pHighSpeedConfigDscr = (WORD)&HighSpeedConfigDscr;
   pFullSpeedConfigDscr = (WORD)&FullSpeedConfigDscr;
   pStringDscr = (WORD)&StringDscr;

   // Is the descriptor table in external RAM (> 16Kbytes)?  If yes,
   // then relocate.
   // Note that this code only checks if the descriptors START in
   // external RAM.  It will not work if the descriptor table spans
   // internal and external RAM.
   if ((WORD)&DeviceDscr & 0xC000)
   {
      // first, relocate the descriptors
      IntDescrAddr = INTERNAL_DSCR_ADDR;
      ExtDescrAddr = (WORD)&DeviceDscr;
      DevDescrLen = (WORD)&UserDscr - (WORD)&DeviceDscr + 2;
      for (i = 0; i < DevDescrLen; i++)
         *((BYTE xdata *)IntDescrAddr+i) = *((BYTE xdata *)ExtDescrAddr+i);

      // update all of the descriptor pointers
      pDeviceDscr = IntDescrAddr;
      offset = (WORD)&DeviceDscr - INTERNAL_DSCR_ADDR;
      pDeviceQualDscr -= offset;
      pConfigDscr -= offset;
      pOtherConfigDscr -= offset;
      pHighSpeedConfigDscr -= offset;
      pFullSpeedConfigDscr -= offset;
      pStringDscr -= offset;
   }
这段程序没怎么看懂 就只知道大概是从片外移描述符到片内吧 麻烦具体讲讲

相关帖子

沙发
dqyubsh| | 2011-12-11 18:34 | 只看该作者
注释说的很清楚,还想怎么讲。。

使用特权

评论回复
板凳
zyzyzy407|  楼主 | 2011-12-11 19:40 | 只看该作者
主要是这句 INTERNAL_DSCR_ADDR 这个宏定义为了0x80 之后IntDescrAddr = INTERNAL_DSCR_ADDR;*((BYTE xdata *)IntDescrAddr+i) = *((BYTE xdata *)ExtDescrAddr+i); 主要是我这个IntDescrAddr非要是xdata的0x80吗? 2# dqyubsh

使用特权

评论回复
地板
dqyubsh| | 2011-12-11 22:04 | 只看该作者
问题有点难度。

如果扩展了片外程序存储器,并且把代码段覆盖到了0xC000以上,才有可能出现这个问题。能不能设置成0X80,看代码段0x80后的一段空间是否有别的代码在用。这个空闲位置是由编译器保证的。在映像文件里,给IntDescrAddr变量分配了地址,如果没有空闲,编译器会自动找一个空闲。所以,你不必理睬它究竟设置了多少。它就在代码段里,究竟在哪,由编译器的重定向机制决定。

个人观点,不一定对。

使用特权

评论回复
5
hongchengway| | 2011-12-12 08:22 | 只看该作者
:L

使用特权

评论回复
6
zyzyzy407|  楼主 | 2011-12-12 12:14 | 只看该作者
那你得意思是说 IntDescrAddr可能不是0x80吗?! 有点糊涂了 4# dqyubsh

使用特权

评论回复
7
dqyubsh| | 2011-12-12 20:38 | 只看该作者
你接上Keil串口仿真,实际看一下。我懒得看。

使用特权

评论回复
8
zyzyzy407|  楼主 | 2011-12-14 13:40 | 只看该作者
恩 还要请教你个问题 CYPRESS中有个Vend_ax例程 但里面有个eeprom.c文件 没有这个文件呀 还有怎么用cy的控制台发送厂商请求呀 7# dqyubsh

使用特权

评论回复
9
dqyubsh| | 2011-12-14 22:48 | 只看该作者
官网有完整例子

使用特权

评论回复
10
zyzyzy407|  楼主 | 2011-12-15 13:22 | 只看该作者
麻烦发个链接吧 没有找到啊 9# dqyubsh

使用特权

评论回复
11
zyzyzy407|  楼主 | 2011-12-15 17:05 | 只看该作者
不用了 大侠 是我的程序有问题 命令发下去了 呵呵 不过还是谢了 9# dqyubsh

使用特权

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

本版积分规则

1

主题

208

帖子

0

粉丝