User manual

Table Of Contents
Zynq-7000 AP SoC Technical Reference Manual www.xilinx.com 280
UG585 (v1.11) September 27, 2016
Chapter 9: DMA Controller
9.4.3 PL Peripheral DMA Transfer Length Management
Example: Length Managed by Peripheral
The following example shows a DMAC program that transfers 64 words from memory to peripheral
0 when the peripheral sends a burst request (DMA{3:0}_DRTYPE[1:0] = 01). When the peripheral
sends a single request (DMA{3:0}_DRTYPE[1:0] = 00) then the DMAC program transfers one word
from memory to peripheral 0.
To transfer the 64 words, the program instructs the DMAC to perform 16 AXI bus transactions. Each
transaction consists of a 4-beat burst (SB=4, DB=4), each beat of which moves a word of data
(SS=32, DS=32).
In this example, the program shows use of the following instructions:
DMAWFP instruction. The DMAC waits for either a burst or single request from the peripheral.
DMASTPB and DMASTPS instructions. The DMAC informs the peripheral when a transfer is
complete.
# Set up for burst transfers (4-beat burst, so SB4 and DB4),
# (word data width, so SS32 and DS32)
DMAMOV CCR SB4 SS32 DB4 DS32
DMAMOV SAR ...
DMAMOV DAR ...
# Initialize peripheral '0'
DMAFLUSHP P0
# Perform peripheral transfers
# Outer loop - DMAC responds to peripheral requests until peripheral
# sets drlast_0 = 1
DMALPFE
# Wait for request, DMAC sets request_type0 flag depending on the
# request type it receives
DMAWFP 0, periph
# Set up loop for burst request: first 15 of 16 sets of transactions
# Note: B suffix - conditionally executed only if request_type0
# flag = Burst
DMALP 15
DMALDB
DMASTB
# Only loopback if servicing a burst, otherwise treat as a NOP
DMALPENDB
# Perform final transaction (16 of 16). Send the peripheral
# acknowledgement of burst request completion
DMALDB
DMASTPB P0
# Perform transaction if the peripheral signals a single request
# Note: S suffix - conditionally executed only if request_type0
# flag = Single