Specifications
Using DMA Devices
The HAL provides a device abstraction model for direct memory access (DMA) devices. These are
peripherals that perform bulk data transactions from a data source to a destination. Sources and
destinations can be memory or another device, such as an Ethernet connection.
In the HAL DMA device model, there are two categories of DMA transactions: transmit and receive. The
HAL provides two device drivers to implement transmit channels and receive channels. A transmit
channel takes data in a source buffer and transmits it to a destination device. A receive channel receives
data from a device and deposits it in a destination buffer. Depending on the implementation of the
underlying hardware, software might have access to only one of these two endpoints.
Copying data from memory to memory involves both receive and transmit DMA channels simultane‐
ously.
Figure 6-2: Three Basic Types of DMA Transactions
1. Receiving Data
from a Peripheral
DMA
Recieve
Channel
Peripheral
Memory
2. Transmitting Data
to a Peripheral
DMA
Receive
Channel
Peripheral
DMA
Transmit
Channel
DMA
Receive
Channel
DMA
Transmit
Channel
3. Transferring Data
from Memory to
Memory
Memory
Memory
Memory
The API for access to DMA devices is defined in sys/alt_dma.h.
For more information about the use of these functions, refer to the HAL API Reference chapter of the Nios
II Software Developer’s Handbook.
DMA devices operate on the contents of physical memory, therefore when reading and writing data you
must consider cache interactions.
For more information about cache memory, refer to the Cache and Tightly-Coupled Memory chapter of
the Nios II Software Developer’s Handbook.
Related Information
• HAL API Reference on page 14-1
• Cache and Tightly-Coupled Memory
NII5V2
2015.05.14
Using DMA Devices
6-23
Developing Programs Using the Hardware Abstraction Layer
Altera Corporation
Send Feedback