implements dma function.