Lines Matching +full:direction +full:- +full:based
4 * SPDX-License-Identifier: Apache-2.0
29 * a generic software-based DMA engine implementation.
45 uint32_t direction; member
59 enum channel_state prev = chan->state; in channel_change_state()
66 return -EPERM; in channel_change_state()
71 return -EINVAL; in channel_change_state()
74 chan->state = next; in channel_change_state()
90 data = dev->data; in sof_host_dma_reload()
92 if (chan_id >= data->ctx.dma_channels) { in sof_host_dma_reload()
94 return -EINVAL; in sof_host_dma_reload()
98 chan = &data->channels[chan_id]; in sof_host_dma_reload()
101 if (chan->state != CHAN_STATE_CONFIGURED) { in sof_host_dma_reload()
103 return -EINVAL; in sof_host_dma_reload()
106 if (chan->direction == HOST_TO_MEMORY) { in sof_host_dma_reload()
111 ret = sys_cache_data_invd_range(UINT_TO_POINTER(chan->src), in sof_host_dma_reload()
112 chan->size); in sof_host_dma_reload()
119 memcpy(UINT_TO_POINTER(chan->dest), UINT_TO_POINTER(chan->src), chan->size); in sof_host_dma_reload()
152 ret = sys_cache_data_flush_range(UINT_TO_POINTER(chan->dest), chan->size); in sof_host_dma_reload()
169 data = dev->data; in sof_host_dma_config()
171 if (chan_id >= data->ctx.dma_channels) { in sof_host_dma_config()
173 return -EINVAL; in sof_host_dma_config()
177 chan = &data->channels[chan_id]; in sof_host_dma_config()
187 if (config->block_count != 1) { in sof_host_dma_config()
188 LOG_ERR("invalid number of blocks: %d", config->block_count); in sof_host_dma_config()
189 return -EINVAL; in sof_host_dma_config()
192 if (!config->head_block->source_address) { in sof_host_dma_config()
194 return -EINVAL; in sof_host_dma_config()
197 if (!config->head_block->dest_address) { in sof_host_dma_config()
199 return -EINVAL; in sof_host_dma_config()
202 if (!config->head_block->block_size) { in sof_host_dma_config()
204 return -EINVAL; in sof_host_dma_config()
208 if (config->channel_direction != HOST_TO_MEMORY && in sof_host_dma_config()
209 config->channel_direction != MEMORY_TO_HOST) { in sof_host_dma_config()
210 LOG_ERR("invalid channel direction: %d", in sof_host_dma_config()
211 config->channel_direction); in sof_host_dma_config()
212 return -EINVAL; in sof_host_dma_config()
216 chan->src = config->head_block->source_address; in sof_host_dma_config()
217 chan->dest = config->head_block->dest_address; in sof_host_dma_config()
218 chan->size = config->head_block->block_size; in sof_host_dma_config()
219 chan->direction = config->channel_direction; in sof_host_dma_config()
222 chan_id, chan->src, chan->dest, chan->size); in sof_host_dma_config()
268 return -EINVAL; in sof_host_dma_get_attribute()
287 struct sof_host_dma_data *data = dev->data; in sof_host_dma_init()
289 data->channel_flags = ATOMIC_INIT(0); in sof_host_dma_init()
290 data->ctx.atomic = &data->channel_flags; in sof_host_dma_init()