User`s manual

Using the DMA
Conserving Core MIPS by Working In Parallel
MOTOROLA Optimizing DSP56300/DSP56600 Applications 4-3
move #0,m1 ;modulo 1. each increment, R1 will flip
;between two consecutive addresses.
move #BASE_AREA1,x:(r1)+
move #BASE_AREA2,x:(r1)+;R1 will now point to
;the address storing BASE_AREA1.
;until changed, x:(r1) stores the
;base address of the current core
;processing area;
;x:(r+1) stores the base address of the
;DMA area.
;first address of external data for DMA
;transfers
movep #EXTERNAL_BASE,x:M_DSR0;
;destination address for first
;DMA block transfer
movep #BASE_AREA2,x:M_DDR0
;DMA data transfer block size.
movep #BLOCK_SIZE-1,x:M_DCO0
; DMA control word:% 1 0 011 11 0 00000 0 101 101 00 01
; DE 1 software trigger
; DIE 0 DMA interrupts disabled
; DTM 011 block transfer, DE trigger
; DPR 11 highest channel priority
; DCON 0 continuous mode disabled
; DRS 00000 DMA request source - don't care
; (arbitrary value)
; D3D 0 3 dimensional mode disabled
; DAM[5:3]101 destination address post-increment
; DAM[2:0]101 source address post-increment
; DS[3:2] 00 transfer destination: x memory.
; DS[1:0] 01 transfer source: y memory.
movep #$9e02d1,x:M_DCR0;initialize DMA control reg.
;and initiate first transfer
jmp MAIN_PROGRAM
...
;================================== main program area
MAIN_PROGRAM
do #(NUMBER_OF_TRANS-1),_END_LOOP
jsr _SWITCH_DATA
jsr _PROCESS_DATA
nop
_END_LOOP
move x:-(r1),r0 ;switch base ptr for core data
jsr _PROCESS_DATA ;last iteration, out of loop
...
;================================== subroutine area
_SWITCH_DATA
_WAIT
jclr #M_DTD0,x:M_DSTR,_WAIT ;verify that the DMA finished,
;otherwise wait until it does.
movep x:(r1)+,x:M_DDR0 ;load new value for DMA
;destination (previous core
;processing area).
;after R1 increment, x:(r1)
;points to the prev. DMA area.
move x:(r1),r0 ;load new core area pointer
bset #23,x:M_DCR0 ;trigger DMA tran. to new buffer
rts