Lines Matching +full:multi +full:- +full:channel
4 * SPDX-License-Identifier: Apache-2.0
38 #define DEV_DATA(dev) ((struct dma_sedi_driver_data *const)(dev)->data)
40 ((const struct dma_sedi_config_info *const)(dev)->config)
46 static void dma_handler(sedi_dma_t dma_device, int channel, int event_id, in dma_handler() argument
52 struct dma_config *config = &(data->dma_configs[channel]); in dma_handler()
54 /* run user-defined callback */ in dma_handler()
55 if (config->dma_callback) { in dma_handler()
57 (config->complete_callback_en)) { in dma_handler()
58 config->dma_callback(dev, config->user_data, in dma_handler()
59 channel, 0); in dma_handler()
60 } else if (!config->error_callback_dis) { in dma_handler()
61 config->dma_callback(dev, config->user_data, in dma_handler()
62 channel, event_id); in dma_handler()
90 return -ENOTSUP; in width_index()
125 return -ENOTSUP; in burst_index()
140 switch (config->channel_direction) { in dma_config_convert()
145 *sedi_dma_dir = config->channel_direction; in dma_config_convert()
167 static int dma_sedi_apply_common_config(sedi_dma_t dev, uint32_t channel, in dma_sedi_apply_common_config() argument
180 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_DIRECTION, in dma_sedi_apply_common_config()
184 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_SR_MEM_TYPE, in dma_sedi_apply_common_config()
186 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_DT_MEM_TYPE, in dma_sedi_apply_common_config()
189 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_HS_DEVICE_ID, in dma_sedi_apply_common_config()
190 config->dma_slot); in dma_sedi_apply_common_config()
191 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_HS_POLARITY, in dma_sedi_apply_common_config()
193 sedi_dma_control(dev, channel, in dma_sedi_apply_common_config()
197 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_HS_DEVICE_ID, in dma_sedi_apply_common_config()
198 config->dma_slot); in dma_sedi_apply_common_config()
199 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_HS_POLARITY, in dma_sedi_apply_common_config()
201 sedi_dma_control(dev, channel, in dma_sedi_apply_common_config()
205 return -1; in dma_sedi_apply_common_config()
210 static int dma_sedi_apply_single_config(sedi_dma_t dev, uint32_t channel, in dma_sedi_apply_single_config() argument
216 ret = dma_sedi_apply_common_config(dev, channel, config, NULL); in dma_sedi_apply_single_config()
221 ret = width_index(config->source_data_size, &temp); in dma_sedi_apply_single_config()
225 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_SR_TRANS_WIDTH, temp); in dma_sedi_apply_single_config()
228 ret = width_index(config->dest_data_size, &temp); in dma_sedi_apply_single_config()
232 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_DT_TRANS_WIDTH, temp); in dma_sedi_apply_single_config()
235 ret = burst_index(config->source_burst_length, &temp); in dma_sedi_apply_single_config()
239 sedi_dma_control(dev, channel, SEDI_CONFIG_DMA_BURST_LENGTH, temp); in dma_sedi_apply_single_config()
246 static int dma_sedi_chan_config(const struct device *dev, uint32_t channel, in dma_sedi_chan_config() argument
249 if ((dev == NULL) || (channel >= DEV_CFG(dev)->chn_num) in dma_sedi_chan_config()
251 || (config->block_count != 1)) { in dma_sedi_chan_config()
258 memcpy(&(data->dma_configs[channel]), config, sizeof(struct dma_config)); in dma_sedi_chan_config()
263 sedi_dma_init(info->peripheral_id, (int)channel, cb, (void *)dev); in dma_sedi_chan_config()
268 return -1; in dma_sedi_chan_config()
271 static int dma_sedi_reload(const struct device *dev, uint32_t channel, in dma_sedi_reload() argument
274 if ((dev == NULL) || (channel >= DEV_CFG(dev)->chn_num)) { in dma_sedi_reload()
276 return -ENOTSUP; in dma_sedi_reload()
281 struct dma_config *config = &(data->dma_configs[channel]); in dma_sedi_reload()
284 if ((config == NULL) || (config->head_block == NULL)) { in dma_sedi_reload()
286 return -ENOTSUP; in dma_sedi_reload()
288 block_config = config->head_block; in dma_sedi_reload()
290 if ((config->block_count == 1) || (block_config->next_block == NULL)) { in dma_sedi_reload()
291 block_config->source_address = src; in dma_sedi_reload()
292 block_config->dest_address = dst; in dma_sedi_reload()
293 block_config->block_size = size; in dma_sedi_reload()
295 LOG_ERR("no reload support for multi-linkedlist mode"); in dma_sedi_reload()
296 return -ENOTSUP; in dma_sedi_reload()
301 static int dma_sedi_start(const struct device *dev, uint32_t channel) in dma_sedi_start() argument
303 if ((dev == NULL) || (channel >= DEV_CFG(dev)->chn_num)) { in dma_sedi_start()
305 return -ENOTSUP; in dma_sedi_start()
308 int ret = -1; in dma_sedi_start()
311 struct dma_config *config = &(data->dma_configs[channel]); in dma_sedi_start()
312 struct dma_block_config *block_config = config->head_block; in dma_sedi_start()
315 if (config->block_count == 1) { in dma_sedi_start()
317 ret = dma_sedi_apply_single_config(info->peripheral_id, in dma_sedi_start()
318 channel, config); in dma_sedi_start()
322 src_addr = block_config->source_address; in dma_sedi_start()
323 dst_addr = block_config->dest_address; in dma_sedi_start()
325 ret = sedi_dma_start_transfer(info->peripheral_id, channel, in dma_sedi_start()
326 src_addr, dst_addr, block_config->block_size); in dma_sedi_start()
343 static int dma_sedi_stop(const struct device *dev, uint32_t channel) in dma_sedi_stop() argument
347 LOG_DBG("stopping dma: %p, %d", dev, channel); in dma_sedi_stop()
348 sedi_dma_abort_transfer(info->peripheral_id, channel); in dma_sedi_stop()
365 config->irq_config(); in dma_sedi_init()