野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 11161|回复: 1

关于USB的缓冲区的问题

[复制链接]
发表于 2019-4-27 10:22:24 | 显示全部楼层 |阅读模式
最近在学习STM32的USB接口,看到文档中说USB接口对那段512字节的地址是16位访问,CPU是32位访问, 所以通过地址有个乘以2的关系,不理解为啥。
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 for the USB_BTABLE register
and buffer description table locations.
In the following pages two location addresses are reported: the one to be used by
application software while accessing the packet memory, and the local one relative to USB
Peripheral access. To obtain the correct STM32F10xxx memory address value to be used in
the application software while accessing the packet memory, the actual memory location
address must be multiplied by two.  




在代码中看到如下的宏:
#define _pEPTxAddr(bEpNum) ((uint32_t *)((_GetBTABLE()+bEpNum*8  )*2 + PMAAddr))


这个是如何理解呢?

回复

使用道具 举报

发表于 2019-4-28 17:49:34 | 显示全部楼层
帮顶
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-11-1 08:05 , Processed in 0.031192 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表