如何通过DMA控制器访问RAM内存?
我想将数据从闪存复制到 RAM。 那么我如何在 DMA 控制器中设置 RAM 的目标内存地址,以便它可以使用其通道将数据从源地址(闪存中)复制到 RAM 内存。
我在 x86 arch 上执行此操作,它是 8237 DMA。
i want to copy data from flash memory to RAM.
So how can i set the destination memory address of RAM in DMA controller so that it can use its channel to copy the data from source address(in flash memory) to RAM memory.
I am doing it on x86 arch and it's a 8237 DMA.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
8237 DMA 控制器能够进行从 RAM 到 RAM、从 I/O 到 RAM 以及从 RAM 到 I/O 设备的传输。
您必须考虑到最多只能复制 64KB 的数据。如果要复制超过 64KB,则需要不止一次传输操作。
假设您使用的环境与 IBM PC 相同,并且您能够在单独的锁存器中设置目标内存的段地址,您将需要:
标准化您的目标地址段:偏移量,以便偏移量为低于16。
标准化是这样进行的(DIV是整数除法,MOD是模数):
normalized_segment = 段 + 偏移量 DIV 16
normalized_offset = offset MOD 16
将段值加载到属于您要使用的通道的高位锁存器(页地址寄存器)
The 8237 DMA controller is capable of making transfers from RAM to RAM, from I/O to RAM, and from RAM to I/O device.
You must take into account that you will only able to copy up to 64KB of data. If you want to copy more than 64KB, you will need more than one transfer operation.
Assuming you are using the same environment that a IBM PC has, and you are able to set the segment address of the destination memory in a separate latch, you will need to:
Normalize your destination address segment:offset so that offset is lower than 16.
Normalization is carried this way (DIV is integer division, MOD is modulus):
normalized_segment = segment + offset DIV 16
normalized_offset = offset MOD 16
Load the segment value into the high order bits latch belonging to the channel you want to use (the page address register)