From 06cdcc071c82cd139b18e21648a8f559cc07fa98 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Wed, 3 Jan 2018 10:47:31 +0000 Subject: More work on STM32 SPIv3 and DMAv3 drivers, to be tested. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11215 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/STM32/LLD/DMAv3/stm32_dma.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'os/hal/ports/STM32/LLD/DMAv3/stm32_dma.h') diff --git a/os/hal/ports/STM32/LLD/DMAv3/stm32_dma.h b/os/hal/ports/STM32/LLD/DMAv3/stm32_dma.h index 09c586b31..8aa640deb 100644 --- a/os/hal/ports/STM32/LLD/DMAv3/stm32_dma.h +++ b/os/hal/ports/STM32/LLD/DMAv3/stm32_dma.h @@ -25,6 +25,8 @@ #ifndef STM32_DMA_H #define STM32_DMA_H +#include "stm32_dmamux.h" + /*===========================================================================*/ /* Driver constants. */ /*===========================================================================*/ @@ -50,6 +52,16 @@ */ #define STM32_DMA_IS_VALID_PRIORITY(prio) (((prio) >= 0U) && ((prio) <= 3U)) +/** + * @brief Checks if a DMA channel is within the valid range. + * @param[in] ch DMA channel + * + * @retval The check result. + * @retval FALSE invalid DMA channel. + * @retval TRUE correct DMA channel. + */ +#define STM32_DMA_IS_VALID_CHANNEL(ch) (((ch) >= 0U) && ((ch) <= 15U)) + /** * @name DMA streams identifiers * @{ @@ -82,7 +94,7 @@ /** @} */ /** - * @name CR register constants common to all DMA types + * @name CR register constants * @{ */ #define STM32_DMA_CR_RESET_VALUE 0x00000000U @@ -307,12 +319,13 @@ * @brief STM32 DMA stream descriptor structure. */ typedef struct { - DMA_Stream_TypeDef *stream; /**< @brief Associated DMA stream. */ - volatile uint32_t *ifcr; /**< @brief Associated IFCR reg. */ - uint8_t ishift; /**< @brief Bits offset in xIFCR + DMA_Stream_TypeDef *stream; /**< @brief Associated DMA stream. */ + volatile uint32_t *ifcr; /**< @brief Associated IFCR reg. */ + uint8_t ishift; /**< @brief Bits offset in xIFCR register. */ - uint8_t selfindex; /**< @brief Index to self in array. */ - uint8_t vector; /**< @brief Associated IRQ vector. */ + DMAMUX_Channel_TypeDef *mux; /**< @brief Associated DMA stream. */ + uint8_t selfindex; /**< @brief Index to self in array. */ + uint8_t vector; /**< @brief Associated IRQ vector. */ } stm32_dma_stream_t; /** @@ -624,6 +637,7 @@ extern "C" { uint32_t priority, stm32_dmaisr_t func, void *param); + void dmaSetRequestSource(const stm32_dma_stream_t *dmastp, uint32_t per); void dmaStreamRelease(const stm32_dma_stream_t *dmastp); #ifdef __cplusplus } -- cgit v1.2.3