如何通过DMA控制器访问RAM内存?

发布于 2025-01-02 10:05:20 字数 127 浏览 1 评论 0原文

我想将数据从闪存复制到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

指尖微凉心微凉 2025-01-09 10:05:20

8237 DMA 控制器能够进行从 RAM 到 RAM、从 I/O 到 RAM 以及从 RAM 到 I/O 设备的传输。

您必须考虑到最多只能复制 64KB 的数据。如果要复制超过 64KB,则需要不止一次传输操作。

假设您使用的环境与 IBM PC 相同,并且您能够在单独的锁存器中设置目标内存的段地址,您将需要:

  1. 标准化您的目标地址段:偏移量,以便偏移量为低于16。
    标准化是这样进行的(DIV是整数除法,MOD是模数):

    normalized_segment = 段 + 偏移量 DIV 16

    normalized_offset = offset MOD 16

  2. 将段值加载到属于您要使用的通道的高位锁存器(页地址寄存器)

  3. 加载偏移量地址到您要使用的 DMA 通道的起始地址寄存器中。
  4. 继续 DMA 设置(传输长度、模式、EOC 中断等)

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:

  1. 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

  2. Load the segment value into the high order bits latch belonging to the channel you want to use (the page address register)

  3. Load the offset address into the Start Address Register of the DMA channel you want to use.
  4. Continue with DMA setup (transfer length, mode, interrupt on EOC, etc)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文