diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2015-04-11 04:59:40 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2015-04-11 04:59:40 +0200 |
commit | e520cc2d4b856658d338a5fcb8ecd65699b41c38 (patch) | |
tree | 56d8a7bd8c5f0a863f1db8d3f09d6a44fa58d3ee /dma | |
parent | 7b4ba03bc45dfed09759b9d0f99f6ddfde51ac43 (diff) |
Added F3 DMA definition.
Diffstat (limited to 'dma')
-rw-r--r-- | dma/dma.h | 29 |
1 files changed, 26 insertions, 3 deletions
@@ -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 |