/* DMA Stream Reset. 
The specified stream is disabled and configuration registers are cleared. */
void dma_stream_reset(uint32_t dma, uint8_t stream)
/* DMA Stream Reset. 
The specified stream is disabled and configuration registers are cleared. */
void dma_stream_reset(uint32_t dma, uint8_t stream)
{
	DMA_SCR(dma, stream) &= ~DMA_SxCR_EN;
	DMA_SCR(dma, stream) = 0;
	DMA_SNDTR(dma, stream) = 0;
	DMA_SPAR(dma, stream) = 0;
	DMA_SM0AR(dma, stream) = 0;
	DMA_SM1AR(dma, stream) = 0;
	DMA_SFCR(dma, stream) = 0x21;
	uint32_t mask = DMA_ISR_MASK(stream);
	if (stream < 4) {
		DMA_LIFCR(dma) |= mask;
	} else {
		DMA_HIFCR(dma) |= mask;
	}
}