drivers: dma: stm32: add get_status to dmamux driver
Add `get_status` function to dmamux driver api. This uses the regular dma driver `get_status` function. Signed-off-by: Shlomi Vaknin <shlomi.39sd@gmail.com>
This commit is contained in:
parent
6fd8cbb9b4
commit
cad96852a2
3 changed files with 26 additions and 2 deletions
|
@ -574,8 +574,8 @@ static int dma_stm32_init(const struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dma_stm32_get_status(const struct device *dev, uint32_t id,
|
||||
struct dma_status *stat)
|
||||
DMA_STM32_EXPORT_API int dma_stm32_get_status(const struct device *dev,
|
||||
uint32_t id, struct dma_status *stat)
|
||||
{
|
||||
const struct dma_stm32_config *config = dev->config;
|
||||
DMA_TypeDef *dma = (DMA_TypeDef *)(config->base);
|
||||
|
|
|
@ -106,6 +106,8 @@ int dma_stm32_reload(const struct device *dev, uint32_t id,
|
|||
uint32_t src, uint32_t dst, size_t size);
|
||||
int dma_stm32_start(const struct device *dev, uint32_t id);
|
||||
int dma_stm32_stop(const struct device *dev, uint32_t id);
|
||||
int dma_stm32_get_status(const struct device *dev, uint32_t id,
|
||||
struct dma_status *stat);
|
||||
#else
|
||||
#define DMA_STM32_EXPORT_API static
|
||||
#endif /* CONFIG_DMAMUX_STM32 */
|
||||
|
|
|
@ -138,6 +138,27 @@ int dmamux_stm32_reload(const struct device *dev, uint32_t id,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int dmamux_stm32_get_status(const struct device *dev, uint32_t id,
|
||||
struct dma_status *stat)
|
||||
{
|
||||
const struct dmamux_stm32_config *dev_config = dev->config;
|
||||
struct dmamux_stm32_data *data = dev->data;
|
||||
|
||||
/* check if this channel is valid */
|
||||
if (id >= dev_config->channel_nb) {
|
||||
LOG_ERR("channel ID %d is too big.", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (dma_stm32_get_status(data->mux_channels[id].dev_dma,
|
||||
data->mux_channels[id].dma_id, stat) != 0) {
|
||||
LOG_ERR("cannot get the status of dmamux channel %d.", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dmamux_stm32_init(const struct device *dev)
|
||||
{
|
||||
struct dmamux_stm32_data *data = dev->data;
|
||||
|
@ -185,6 +206,7 @@ static const struct dma_driver_api dma_funcs = {
|
|||
.config = dmamux_stm32_configure,
|
||||
.start = dmamux_stm32_start,
|
||||
.stop = dmamux_stm32_stop,
|
||||
.get_status = dmamux_stm32_get_status,
|
||||
};
|
||||
|
||||
#define DMAMUX_INIT(index) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue