aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32/stm32_dma.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/platforms/STM32/stm32_dma.h')
-rw-r--r--os/hal/platforms/STM32/stm32_dma.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/os/hal/platforms/STM32/stm32_dma.h b/os/hal/platforms/STM32/stm32_dma.h
index 51c16741b..b34be76b9 100644
--- a/os/hal/platforms/STM32/stm32_dma.h
+++ b/os/hal/platforms/STM32/stm32_dma.h
@@ -20,6 +20,8 @@
/**
* @file stm32_dma.h
* @brief STM32 DMA helper driver header.
+ * @note This file requires definitions from the ST STM32 header file
+ * stm3232f10x.h.
*
* @addtogroup STM32_DMA
* @{
@@ -52,10 +54,53 @@
/* Driver data structures and types. */
/*===========================================================================*/
+/**
+ * @brief STM32 DMA channel memory structure.
+ */
+typedef struct {
+ volatile uint32_t CCR;
+ volatile uint32_t CNDTR;
+ volatile uint32_t CPAR;
+ volatile uint32_t CMAR;
+ volatile uint32_t dummy;
+} stm32_dma_channel_t;
+
+/**
+ * @brief STM32 DMA subsystem memory structure.
+ * @note This structure has been redefined here because it is convenient to
+ * have the channels organized as an array, the ST header does not
+ * do that.
+ */
+typedef struct {
+ volatile uint32_t ISR;
+ volatile uint32_t IFCR;
+ stm32_dma_channel_t channels[7];
+} stm32_dma_t:
+
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
+#define STM32_DMA1_BASE (AHBPERIPH_BASE + 0x0000)
+#define STM32_DMA1 ((stm32_dma_t *)STM32_DMA1_BASE)
+#define STM32_DMA1_CH1 (STM32_DMA1->channels[0])
+#define STM32_DMA1_CH2 (STM32_DMA1->channels[1])
+#define STM32_DMA1_CH3 (STM32_DMA1->channels[2])
+#define STM32_DMA1_CH4 (STM32_DMA1->channels[3])
+#define STM32_DMA1_CH5 (STM32_DMA1->channels[4])
+#define STM32_DMA1_CH6 (STM32_DMA1->channels[5])
+#define STM32_DMA1_CH7 (STM32_DMA1->channels[6])
+
+#if defined(STM32F10X_HD) || defined (STM32F10X_CL) || defined(__DOXYGEN__)
+#define STM32_DMA2_BASE (AHBPERIPH_BASE + 0x0400)
+#define STM32_DMA2 ((stm32_dma_t *)STM32_DMA2_BASE)
+#define STM32_DMA2_CH1 (STM32_DMA2->channels[0])
+#define STM32_DMA2_CH2 (STM32_DMA2->channels[1])
+#define STM32_DMA2_CH3 (STM32_DMA2->channels[2])
+#define STM32_DMA2_CH4 (STM32_DMA2->channels[3])
+#define STM32_DMA2_CH5 (STM32_DMA2->channels[4])
+#endif
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/