MSC8113 Reference Manual, Rev. 0
16-20
Freescale Semiconductor
Direct Memory Access (DMA) Controller
When programming code that uses DMA buffers, you must consider how the DMA controller
uses buffers and channels and the order in which related events occur.
Example 16-2. Potential Race Conditions
Scenario:
If the DMA controller writes to a destination that is in memory and the optional
interrupt function is enabled, the interrupt is generated when the controller
completes the channel or buffer operation. The interrupt only indicates that the write
operation was initiated by the DMA controller. Due to internal bus arbitration, the
actual data transfer may not occur until several core clocks later. If the core
processes the interrupt handler immediately, the resulting data operations may be
erroneous due to a race condition.
Solution:
There are at least two possible options.
1.
In the interrupt handler, include code that polls the end of the destination buffer
until the contents change before further data transfer or processing.
2.
Program the DMA controller to use an additional small buffer and trigger the
interrupt at the end of that dummy buffer. The larger buffer transfer should be
completed by the time the interrupt occurs.
Example 16-3. Double Interrupt Generation
Scenario:
If the INTRPT bit is set in the BD_ATTR of the last buffer in a non-continuous
DMA transfer, the DMA channel issues two interrupts: one when the last buffer
completes and one because the BD_SIZE value reaches zero.
Solution:
Make sure that the INTRPT bit in the BD_ATTR of the last buffer in a
non-continuous DMA transfer is cleared.
Example 16-4. Missing DMA Interrupt in Chained Buffer
Scenario:
The DMA controller is activated with a chained buffer. Every buffer should generate
an interrupt when it is done. The interrupt service routine (ISR) performed by the
core clears the relevant status bit in the DSTR. If an additional buffer completes
before the core clears the DSTR bit, the core does not receive the appropriate
interrupt because it is a level interrupt.
Solution:
Make sure that the ISR clears the DSTR as soon as possible. You can read the
DCHCR after the interrupt is processed to determine whether another buffer was
completed or if the DMA channel is still active.
Summary of Contents for MSC8113
Page 1: ...MSC8113 Reference Manual Tri Core 16 Bit Digital Signal Processor MSC8113RM Rev 0 May 2008 ...
Page 20: ...MSC8113 Reference Manual Rev 0 xx Freescale Semiconductor Contents ...
Page 28: ...MSC8113 Reference Manual Rev 0 xxviii Freescale Semiconductor ...
Page 56: ...MSC8113 Reference Manual Rev 0 1 28 Freescale Semiconductor MSC8113 Overview ...
Page 76: ...MSC8113 Reference Manual Rev 0 2 20 Freescale Semiconductor SC140 Core Overview ...
Page 134: ...MSC8113 Reference Manual Rev 0 4 30 Freescale Semiconductor System Interface Unit SIU ...
Page 168: ...MSC8113 Reference Manual Rev 0 6 18 Freescale Semiconductor Boot Program ...
Page 180: ...MSC8113 Reference Manual Rev 0 7 12 Freescale Semiconductor Clocks ...
Page 260: ...MSC8113 Reference Manual Rev 0 8 80 Freescale Semiconductor Memory Map ...
Page 300: ...MSC8113 Reference Manual Rev 0 9 40 Freescale Semiconductor Extended Core ...
Page 304: ...MSC8113 Reference Manual Rev 0 10 4 Freescale Semiconductor MQBus and M2 Memory ...
Page 308: ...MSC8113 Reference Manual Rev 0 11 4 Freescale Semiconductor SQBus ...
Page 590: ...MSC8113 Reference Manual Rev 0 17 46 Freescale Semiconductor Interrupt Processing ...
Page 614: ...MSC8113 Reference Manual Rev 0 18 24 Freescale Semiconductor Debugging ...
Page 622: ...MSC8113 Reference Manual Rev 0 19 8 Freescale Semiconductor Internal Peripheral Bus IPBus ...
Page 724: ...MSC8113 Reference Manual Rev 0 21 32 Freescale Semiconductor UART ...
Page 920: ...MSC8113 Reference Manual Rev 0 25 150 Freescale Semiconductor Ethernet Controller ...
Page 1171: ...MSC8113 Reference Manual Rev 0 Freescale Semiconductor C 61 EF wait_rts P 01077FFC 9F rts 71 ...
Page 1172: ...MSC8113 Reference Manual Rev 0 C 62 Freescale Semiconductor MSC8113 Boot Code ...
Page 1202: ...MSC8113 Reference Manual Rev 0 Index 30 Freescale Semiconductor Index ...