12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #ifndef ZEPHYR_INCLUDE_DRIVERS_DMA_STM32_H_
- #define ZEPHYR_INCLUDE_DRIVERS_DMA_STM32_H_
- #define STM32_DMA_HAL_OVERRIDE 0x7F
- #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dma_v2bis)
- #define STM32_DMA_SLOT(id, dir, slot) 0
- #else
- #define STM32_DMA_SLOT(id, dir, slot) DT_INST_DMAS_CELL_BY_NAME(id, dir, slot)
- #endif
- #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dma_v2) || \
- DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dma_v2bis) || \
- DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dmamux)
- #define STM32_DMA_FEATURES(id, dir) 0
- #else
- #define STM32_DMA_FEATURES(id, dir) \
- DT_INST_DMAS_CELL_BY_NAME(id, dir, features)
- #endif
- #define STM32_DMA_CTLR(id, dir) \
- DT_INST_DMAS_CTLR_BY_NAME(id, dir)
- #define STM32_DMA_CHANNEL_CONFIG(id, dir) \
- DT_INST_DMAS_CELL_BY_NAME(id, dir, channel_config)
- #define STM32_DMA_CONFIG_DIRECTION(config) ((config >> 6) & 0x3)
- #define STM32_DMA_CONFIG_PERIPHERAL_ADDR_INC(config) ((config >> 9) & 0x1)
- #define STM32_DMA_CONFIG_MEMORY_ADDR_INC(config) ((config >> 10) & 0x1)
- #define STM32_DMA_CONFIG_PERIPHERAL_DATA_SIZE(config) \
- (1 << ((config >> 11) & 0x3))
- #define STM32_DMA_CONFIG_MEMORY_DATA_SIZE(config) \
- (1 << ((config >> 13) & 0x3))
- #define STM32_DMA_CONFIG_PERIPHERAL_INC_FIXED(config) ((config >> 15) & 0x1)
- #define STM32_DMA_CONFIG_PRIORITY(config) ((config >> 16) & 0x3)
- #if DT_HAS_COMPAT_STATUS_OKAY(st_stm32_dma_v1)
- #define STM32_DMA_FEATURES_FIFO_THRESHOLD(features) (features & 0x3)
- #else
- #define STM32_DMA_FEATURES_FIFO_THRESHOLD(features) 0
- #endif
- #endif
|