From e4c0a50286cd7bdca76f7bc4dfa973668114e9ec Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Wed, 6 Feb 2013 11:41:10 +0000 Subject: [PATCH] [stm32-dma] Eliminate redundant write. Clearing a single bit in DMA_CCR, then immediately writing a 0 over the entire register is completely redundant on the F1, F3 and L1 DMA peripherals. (Unlike the F2 & F4 DMA Peripheral, where this is required) --- lib/stm32/common/dma_common_f13.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/stm32/common/dma_common_f13.c b/lib/stm32/common/dma_common_f13.c index 0a708aa6..35b9da64 100644 --- a/lib/stm32/common/dma_common_f13.c +++ b/lib/stm32/common/dma_common_f13.c @@ -55,9 +55,7 @@ The channel is disabled and configuration registers are cleared. void dma_channel_reset(u32 dma, u8 channel) { - /* Disable channel. */ - DMA_CCR(dma, channel) &= ~DMA_CCR_EN; - /* Reset config bits. */ + /* Disable channel and reset config bits. */ DMA_CCR(dma, channel) = 0; /* Reset data transfer number. */ DMA_CNDTR(dma, channel) = 0;