;-----------------------------------------------------------------------! ; Init DMA ! ;-----------------------------------------------------------------------! fn InitDMA push {lr} ; save regs movs r0, pDMA ; enable peripheral clock bl PowerOn ; ldr r3, =dmaBase ; dma base movs r0, 0 ; adds r1, r3, dmaOffset+dmaCfg; channel[0].cfg str r0, [r1], 0x20 ; reset first channel str r0, [r1], 0x20 ; reset next channel str r0, [r1], 0x20 ; reset next channel str r0, [r1], 0x20 ; reset next channel str r0, [r1], 0x20 ; reset next channel str r0, [r1], 0x20 ; reset next channel str r0, [r1], 0x20 ; reset next channel str r0, [r1], 0x20 ; reset last channel movs r0, 0xFF ; clear any interrupt flags str r0, [r3, dmaTcClr] ; terminal counts str r0, [r3, dmaErrClr] ; errors movs r0, (1<<0)+(0<<1); ; enable DMA, little endian str r0, [r3, dmaConfig] ; movs r0, vDMA ; DMA interrupt handler ldr r1, =SioDmaHandler ; movs r2, dmaPriority ; bl SetHandler ; movs r0, bfBase ; to aid debugging movs r1, 0 ; movs r2, 5*bfSz ; bl memset ; pop {pc} ; return fe InitDMA |