DMA Operation
351
SLAU367P – October 2012 – Revised April 2020
Copyright © 2012–2020, Texas Instruments Incorporated
DMA Controller
Any access, read or write, of the DMAIV register automatically resets the highest pending interrupt flag. If
another interrupt flag is set, another interrupt is immediately generated after servicing the initial interrupt.
For example, assume that DMA0 has the highest priority. If the DMA0IFG and DMA2IFG flags are set
when the interrupt service routine accesses the DMAIV register, DMA0IFG is reset automatically. After the
RETI instruction of the interrupt service routine is executed, the DMA2IFG generates another interrupt.
11.2.9.1 DMAIV Software Example
The following software example shows the recommended use of DMAIV and the handling overhead for an
eight channel DMA controller. The DMAIV value is added to the PC to automatically jump to the
appropriate routine.
The numbers at the right margin show the necessary CPU cycles for each instruction. The software
overhead for different interrupt sources includes interrupt latency and return-from-interrupt cycles, but not
the task handling itself.
;Interrupt handler for DMAxIFG
Cycles
DMA_HND
...
; Interrupt latency
6
ADD
&DMAIV,PC
; Add offset to Jump table
3
RETI
; Vector
0: No interrupt
5
JMP
DMA0_HND
; Vector
2: DMA channel 0
2
JMP
DMA1_HND
; Vector
4: DMA channel 1
2
JMP
DMA2_HND
; Vector
6: DMA channel 2
2
JMP
DMA3_HND
; Vector
8: DMA channel 3
2
JMP
DMA4_HND
; Vector 10: DMA channel 4
2
JMP
DMA5_HND
; Vector 12: DMA channel 5
2
JMP
DMA6_HND
; Vector 14: DMA channel 6
2
JMP
DMA7_HND
; Vector 16: DMA channel 7
2
DMA7_HND
; Vector 16: DMA channel 7
...
; Task starts here
RETI
; Back to main program
5
DMA6_HND
; Vector 14: DMA channel 6
...
; Task starts here
RETI
; Back to main program
5
DMA5_HND
; Vector 12: DMA channel 5
...
; Task starts here
RETI
; Back to main program
5
DMA4_HND
; Vector 10: DMA channel 4
...
; Task starts here
RETI
; Back to main program
5
DMA3_HND
; Vector 8: DMA channel 3
...
; Task starts here
RETI
; Back to main program
5
DMA2_HND
; Vector 6: DMA channel 2
...
; Task starts here
RETI
; Back to main program
5
DMA1_HND
; Vector 4: DMA channel 1
...
; Task starts here
RETI
; Back to main program
5
DMA0_HND
; Vector 2: DMA channel 0
...
; Task starts here
RETI
; Back to main program
5