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
|
@ -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