请教香版一个问题

[复制链接]
3626|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

粉丝
快速回复 在线客服 返回列表 返回顶部