From e4c0a50286cd7bdca76f7bc4dfa973668114e9ec Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Wed, 6 Feb 2013 11:41:10 +0000 Subject: [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 0a708aa..35b9da6 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; -- cgit v1.2.3 From 7afc13930f86f226cac27abc63a68afed0b119ec Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Wed, 6 Feb 2013 11:47:23 +0000 Subject: [stm32] Use common memorymap include for consistency Most peripheral headers simply include which, like the rest of libopencm3 requires the correct compiler define flag to be set. A few peripherals were directly including the platform include, libopencm3/stm32/xx/memorymap.h, and in some of those cases it wasn't even correctly including the correct platform. (Likely the result of copy/paste errors) These direct includes have been eliminated --- include/libopencm3/stm32/f1/dma.h | 2 +- include/libopencm3/stm32/f2/dma.h | 2 +- include/libopencm3/stm32/f2/rng.h | 2 +- include/libopencm3/stm32/f4/adc.h | 2 +- include/libopencm3/stm32/f4/dma.h | 2 +- include/libopencm3/stm32/f4/rng.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/libopencm3/stm32/f1/dma.h b/include/libopencm3/stm32/f1/dma.h index 4af8f43..e0c55a6 100644 --- a/include/libopencm3/stm32/f1/dma.h +++ b/include/libopencm3/stm32/f1/dma.h @@ -34,7 +34,7 @@ LGPL License Terms @ref lgpl_license #ifndef LIBOPENCM3_DMA_H #define LIBOPENCM3_DMA_H -#include +#include #include #endif diff --git a/include/libopencm3/stm32/f2/dma.h b/include/libopencm3/stm32/f2/dma.h index 8226f55..0eb952c 100644 --- a/include/libopencm3/stm32/f2/dma.h +++ b/include/libopencm3/stm32/f2/dma.h @@ -34,7 +34,7 @@ LGPL License Terms @ref lgpl_license #ifndef LIBOPENCM3_DMA_H #define LIBOPENCM3_DMA_H -#include +#include #include #endif diff --git a/include/libopencm3/stm32/f2/rng.h b/include/libopencm3/stm32/f2/rng.h index 63d03fe..403c7c7 100644 --- a/include/libopencm3/stm32/f2/rng.h +++ b/include/libopencm3/stm32/f2/rng.h @@ -18,7 +18,7 @@ #ifndef LIBOPENCM3_RNG_F2_H #define LIBOPENCM3_RNG_F2_H -#include +#include #include #endif diff --git a/include/libopencm3/stm32/f4/adc.h b/include/libopencm3/stm32/f4/adc.h index 272c4c2..e400591 100644 --- a/include/libopencm3/stm32/f4/adc.h +++ b/include/libopencm3/stm32/f4/adc.h @@ -36,7 +36,7 @@ LGPL License Terms @ref lgpl_license #ifndef LIBOPENCM3_ADC_H #define LIBOPENCM3_ADC_H -#include +#include #include /* --- Convenience macros -------------------------------------------------- */ diff --git a/include/libopencm3/stm32/f4/dma.h b/include/libopencm3/stm32/f4/dma.h index cc97024..a3e9db1 100644 --- a/include/libopencm3/stm32/f4/dma.h +++ b/include/libopencm3/stm32/f4/dma.h @@ -34,7 +34,7 @@ LGPL License Terms @ref lgpl_license #ifndef LIBOPENCM3_DMA_H #define LIBOPENCM3_DMA_H -#include +#include #include #endif diff --git a/include/libopencm3/stm32/f4/rng.h b/include/libopencm3/stm32/f4/rng.h index b72f801..e8e6cc4 100644 --- a/include/libopencm3/stm32/f4/rng.h +++ b/include/libopencm3/stm32/f4/rng.h @@ -18,7 +18,7 @@ #ifndef LIBOPENCM3_RNG_F4_H #define LIBOPENCM3_RNG_F4_H -#include +#include #include #endif -- cgit v1.2.3