打印

请教香版一个问题

[复制链接]
2568|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
踢球老越位|  楼主 | 2010-3-10 18:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 踢球老越位 于 2010-3-10 18:12 编辑

#define RegBase  (0x40005C00L)  
#define PMAAddr  (0x40006000L)
#define BTABLE  ((__IO unsigned *)(RegBase + 0x50))
#define _GetBTABLE() ((uint16_t) *BTABLE)
#define _pEPTxAddr(bEpNum) ((uint32_t *)((_GetBTABLE()+bEpNum*8  )*2 + PMAAddr))
#define _pEPTxCount(bEpNum) ((uint32_t *)((_GetBTABLE()+bEpNum*8+2)*2 + PMAAddr))
#define _pEPRxAddr(bEpNum) ((uint32_t *)((_GetBTABLE()+bEpNum*8+4)*2 + PMAAddr))
#define _pEPRxCount(bEpNum) ((uint32_t *)((_GetBTABLE()+bEpNum*8+6)*2 + PMAAddr))
取bEpNum为0,并且根据上面假设_GetBTABLE()为0,即可以得出端点0对应的几个缓冲区描述表ADDR0_TX、COUNT0_TX、ADDR0_RX、COUNT0_RX的所对应的地址为0x4000 6000,0x4000 6004,0x4000 6008,0x4000 600C,不知道这样理解对不?为什么要乘以2呢?
沙发
STARM| | 2013-6-15 17:22 | 只看该作者
是不是这个原因 ?

Due to the common APB bridge limitation on word addressability,
all packet memory locations are accessed by the APB using 32-bit aligned addresses,
instead of the actual memory location addresses utilized by the USB peripheral

MCU 使用 32位地址
USB 使用 16位地址

使用特权

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

本版积分规则

40

主题

581

帖子

0

粉丝