Skip to content

Commit

Permalink
audio: dai-zephyr: convert DMA src/dst addresses to host-relative add…
Browse files Browse the repository at this point in the history
…resses

The DMAC has the same view of the address space as the HOST.
As such, the source and destination addresses need to be converted
to HOST-relative addresses before attempting to perform a DMA
transfer. This is only relevant for platforms for which the DSP
and HOST have different views of the address space (e.g: i.MX8ULP).

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
  • Loading branch information
LaurentiuM1234 committed Mar 14, 2024
1 parent 727ad82 commit cdb9394
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/audio/dai-zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,17 @@ static int dai_set_dma_config(struct dai_data *dd, struct comp_dev *dev)
for (i = 0; i < dma_cfg->block_count; i++) {
dma_block_cfg->dest_scatter_en = config->scatter;
dma_block_cfg->block_size = config->elem_array.elems[i].size;
dma_block_cfg->source_address = config->elem_array.elems[i].src;
dma_block_cfg->dest_address = config->elem_array.elems[i].dest;
if (dev->direction == SOF_IPC_STREAM_PLAYBACK) {
dma_block_cfg->source_address =
local_to_host(config->elem_array.elems[i].src);
dma_block_cfg->dest_address =
config->elem_array.elems[i].dest;
} else {
dma_block_cfg->source_address =
config->elem_array.elems[i].src;
dma_block_cfg->dest_address =
local_to_host(config->elem_array.elems[i].dest);
}
if (dev->direction == SOF_IPC_STREAM_PLAYBACK) {
dma_block_cfg->source_addr_adj = DMA_ADDR_ADJ_DECREMENT;
dma_block_cfg->dest_addr_adj = DMA_ADDR_ADJ_INCREMENT;
Expand Down

0 comments on commit cdb9394

Please sign in to comment.