implemented dma write and erase