drivers: dma: stm32 dma driver using DT compat macro

Controlling the DMA offset  for the request, relies on the
dma version different from V1

Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
Francois Ramu 2021-06-21 10:55:29 +02:00 committed by Christopher Friedt
commit 6312b7383d
2 changed files with 3 additions and 5 deletions

View file

@ -462,14 +462,12 @@ DMA_STM32_EXPORT_API int dma_stm32_configure(const struct device *dev,
config->dest_data_size; config->dest_data_size;
} }
#if defined(CONFIG_DMA_STM32_V2) || defined(CONFIG_DMAMUX_STM32) #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dma_v2) || DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dmamux)
/* /*
* the with dma V2 and dma mux, * the with dma V2 and dma mux,
* the request ID is stored in the dma_slot * the request ID is stored in the dma_slot
*/ */
#if !defined(CONFIG_SOC_SERIES_STM32F0X) || defined(CONFIG_SOC_STM32F030XC)
DMA_InitStruct.PeriphRequest = config->dma_slot; DMA_InitStruct.PeriphRequest = config->dma_slot;
#endif
#endif #endif
LL_DMA_Init(dma, dma_stm32_id_to_stream(id), &DMA_InitStruct); LL_DMA_Init(dma, dma_stm32_id_to_stream(id), &DMA_InitStruct);

View file

@ -44,14 +44,14 @@ struct dma_stm32_config {
struct dma_stm32_stream *streams; struct dma_stm32_stream *streams;
}; };
#if defined(CONFIG_DMAMUX_STM32) || defined(CONFIG_DMA_STM32_V2) #if !defined(CONFIG_DMA_STM32_V1)
/* from DTS the dma stream id is in range 1..<dma-requests> */ /* from DTS the dma stream id is in range 1..<dma-requests> */
/* so decrease to set range from 0 from now on */ /* so decrease to set range from 0 from now on */
#define STREAM_OFFSET 1 #define STREAM_OFFSET 1
#else #else
/* from DTS the dma stream id is in range 0..<dma-requests>-1 */ /* from DTS the dma stream id is in range 0..<dma-requests>-1 */
#define STREAM_OFFSET 0 #define STREAM_OFFSET 0
#endif /* CONFIG_DMAMUX_STM32 || CONFIG_DMA_STM32_V2 */ #endif /* ! CONFIG_DMA_STM32_V1 */
uint32_t dma_stm32_id_to_stream(uint32_t id); uint32_t dma_stm32_id_to_stream(uint32_t id);
#if !defined(CONFIG_DMAMUX_STM32) #if !defined(CONFIG_DMAMUX_STM32)