summaryrefslogtreecommitdiff
path: root/dma/dma.h
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2012-09-22 15:13:26 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2012-09-22 15:13:26 +0200
commit0ca572bc7a0fbe26b216cab519d89187ae49a28b (patch)
treeed9d49b9748081c36413b6d788bbc51c8e422304 /dma/dma.h
parent95729b7fd4de6704823ab8033593abe352134916 (diff)
Added DMA register definition.
Diffstat (limited to 'dma/dma.h')
-rw-r--r--dma/dma.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/dma/dma.h b/dma/dma.h
new file mode 100644
index 0000000..30d1346
--- /dev/null
+++ b/dma/dma.h
@@ -0,0 +1,37 @@
+#ifndef DMA_H
+#define DMA_H
+
+#include <stdint.h>
+
+struct DMA_stream_reg_t {
+ volatile uint32_t CR;
+ volatile uint32_t NDTR;
+ volatile uint32_t PAR;
+ volatile uint32_t M0AR;
+ volatile uint32_t M1AR;
+ volatile uint32_t FCR;
+};
+
+struct DMA_reg_t {
+ volatile uint32_t LISR;
+ volatile uint32_t HISR;
+ volatile uint32_t LIFCR;
+ volatile uint32_t HIFCR;
+ DMA_stream_reg_t S[8];
+};
+
+class DMA_t {
+ public:
+ DMA_reg_t& reg;
+
+ 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
+
+#endif