summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2015-04-11 04:59:40 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2015-04-11 04:59:40 +0200
commite520cc2d4b856658d338a5fcb8ecd65699b41c38 (patch)
tree56d8a7bd8c5f0a863f1db8d3f09d6a44fa58d3ee
parent7b4ba03bc45dfed09759b9d0f99f6ddfde51ac43 (diff)
Added F3 DMA definition.
-rw-r--r--dma/dma.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/dma/dma.h b/dma/dma.h
index 30d1346..4d9b8d6 100644
--- a/dma/dma.h
+++ b/dma/dma.h
@@ -3,6 +3,32 @@
#include <stdint.h>
+#if defined(STM32F3)
+struct DMA_channel_reg_t {
+ volatile uint32_t CR;
+ volatile uint32_t NDTR;
+ volatile uint32_t PAR;
+ volatile uint32_t MAR;
+ uint32_t _reserved;
+};
+
+struct DMA_reg_t {
+ volatile uint32_t ISR;
+ volatile uint32_t IFCR;
+ DMA_channel_reg_t C[7];
+};
+
+class DMA_t {
+ public:
+ DMA_reg_t& reg;
+
+ DMA_t(uint32_t reg_addr) : reg(*(DMA_reg_t*)reg_addr) {}
+};
+
+static DMA_t DMA1(0x40020000);
+static DMA_t DMA2(0x40020400);
+
+#elif defined(STM32F4)
struct DMA_stream_reg_t {
volatile uint32_t CR;
volatile uint32_t NDTR;
@@ -27,9 +53,6 @@ class DMA_t {
DMA_t(uint32_t reg_addr) : reg(*(DMA_reg_t*)reg_addr) {}
};
-#if defined(STM32F1)
-
-#elif defined(STM32F4)
static DMA_t DMA1(0x40026000);
static DMA_t DMA2(0x40026400);
#endif