dma40: combine mem and slave sg-to-lli functions