I've used these in rust to record and play audio on embedded devices. The gist is, you set up a static mut array, set the DMA peripheral to write or read to it and circular mode. Use indexes to split the buffer in the middle; you do CPU IO on the half the DMA isn't accessing. Use a Half-Transfer interrupt to trigger these CPU reads/writes.