audio: host-zephyr: Update DMA block configuration when re-configuring

With every copy() operation, the source and destination addresses
keep getting modified. As such, for each re-configuration performed
during host_copy_one_shot(), the HOST DMAC needs to be made
aware of these changes.

This commit changes host_copy_one_shot() such that on each
dma_config() call the DMAC driver receives the updated
addresses and size.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit is contained in:
Laurentiu Mihalcea 2023-11-23 16:46:30 +02:00 committed by Liam Girdwood
parent 886026ea85
commit b0de76420e
1 changed files with 8 additions and 0 deletions

View File

@ -203,6 +203,7 @@ static uint32_t host_get_copy_bytes_one_shot(struct host_data *hd)
static int host_copy_one_shot(struct host_data *hd, struct comp_dev *dev, copy_callback_t cb)
{
uint32_t copy_bytes;
struct dma_sg_elem *local_elem = hd->config.elem_array.elems;
int ret = 0;
comp_dbg(dev, "host_copy_one_shot()");
@ -213,6 +214,13 @@ static int host_copy_one_shot(struct host_data *hd, struct comp_dev *dev, copy_c
return ret;
}
/* SRC/DEST addresses have changed so the DMAC needs
* to be re-configured.
*/
hd->z_config.head_block->source_address = local_elem->src;
hd->z_config.head_block->dest_address = local_elem->dest;
hd->z_config.head_block->block_size = local_elem->size;
/* reconfigure transfer */
ret = dma_config(hd->chan->dma->z_dev, hd->chan->index, &hd->z_config);
if (ret < 0) {