本帖最后由 踢球老越位 于 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呢? |