drivers/dma: stm32 dmamux: fix isActiveFlag/clearFlag function array len

This commit uses dt property dma-channels instead of ll defines to
make sure every soc has correct number of function pointers defined.

While commit 5f6218a tried to fix this for g0 series, this caused
regression for other series(e.g. stm32g431). Using UTIL_LISTIFY and
dt properties this should finally be fixed and reduce boilerplate code.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
This commit is contained in:
Thomas Stranger 2021-04-27 18:02:57 +02:00 committed by Kumar Gala
commit d7fb6fa9f1
2 changed files with 15 additions and 82 deletions

View file

@ -45,6 +45,21 @@ struct dmamux_stm32_config {
const struct dmamux_stm32_channel *mux_channels;
};
/*
* UTIL_LISTIFY is used to generate arrays with function pointers to check
* and clear interrupt flags using LL functions
*/
#define IS_ACTIVE_FLAG_SOX(i, _) LL_DMAMUX_IsActiveFlag_SO ## i,
#define CLEAR_FLAG_SOX(i, _) LL_DMAMUX_ClearFlag_SO ## i,
uint32_t (*func_ll_is_active_so[])(DMAMUX_Channel_TypeDef *DMAMUXx) = {
UTIL_LISTIFY(DT_INST_PROP(0, dma_channels), IS_ACTIVE_FLAG_SOX)
};
void (*func_ll_clear_so[])(DMAMUX_Channel_TypeDef *DMAMUXx) = {
UTIL_LISTIFY(DT_INST_PROP(0, dma_channels), CLEAR_FLAG_SOX)
};
int dmamux_stm32_configure(const struct device *dev, uint32_t id,
struct dma_config *config)
{