4 ms·
Cool! I hadn't realized that PCI and PCIe were successors to DMA, and it's nice to see an overview of how application processors shuttle data around quickly. I
by leggomylibro 7y ago
Cool! I hadn't realized that PCI and PCIe were successors to DMA, and it's nice to see an overview of how application processors shuttle data around quickly.
If you want to play with DMA concepts on a less complex level, most modern microcontrollers implement it in some form or another. If you write a program that needs to move a lot of data quickly, like drawing to a display or using an SD card, the difference in speed and reduced overhead is dramatic.
I guess it's a basic concept that most people here will find pedestrian and unremarkable, but I really appreciate how flexible and powerful it can be. You just have to configure a DMA channel pointing at two memory addresses, and then the data moves in the background while the CPU goes off to do other things. You can send data from memory to an external device, or vice-versa, or within the chip's internal memory. You can usually wire two peripherals together to implement 'dumb pipes' which require almost no intervention from the CPU to keep working. Most chips will also let you trigger DMA transfers from arbitrary signals such as hardware timers, so you can also 'set and forget' things like sending audio data to a DAC at a specific bitrate.
I can see how it would be inadequate for the enormous bandwidth required to host multiple devices like GPUs and Ethernet ports, but DMA is still fun. A more elegant protocol for a more civilized age :)
- cperciva 7y agoDMA originates from a time when the CPU accessed memory via the North Bridge chipset; in effect, the CPU was just one of many peers in accessing memory, and data could be transferred between memory and devices without ever touching the CPU. These days, RAM hangs off the CPU -- and even "DMA" involves data passing through the CPU.
- leggomylibro 7y ago>These days, RAM hangs off the CPU -- and even "DMA" involves data passing through the CPU. Not for the microcontrollers I was talking about, it doesn't. They have built-in bus arbiters to manage access to the internal RAM across the CPU and each DMA channel. Not every "CPU" is an application processor. But thank you for the history lesson! I guess the term "DMA" has become sort of generic these days.