Lines Matching refs:cfg

128 static int dma_si32_config(const struct device *dev, uint32_t channel, struct dma_config *cfg)  in dma_si32_config()  argument
154 if (cfg == NULL) { in dma_si32_config()
159 if (cfg->complete_callback_en > 1) { in dma_si32_config()
164 if (cfg->error_callback_dis > 1) { in dma_si32_config()
169 if (cfg->source_handshake > 1 || cfg->dest_handshake > 1) { in dma_si32_config()
174 if (cfg->channel_priority > 1) { in dma_si32_config()
179 if (cfg->source_chaining_en > 1 || cfg->dest_chaining_en > 1) { in dma_si32_config()
184 if (cfg->linked_channel > 1) { in dma_si32_config()
189 if (cfg->cyclic > 1) { in dma_si32_config()
194 if (cfg->source_data_size != 1 && cfg->source_data_size != 2 && in dma_si32_config()
195 cfg->source_data_size != 4) { in dma_si32_config()
196 LOG_ERR("source_data_size must be 1, 2, or 4 (%" PRIu32 ")", cfg->source_data_size); in dma_si32_config()
200 if (cfg->dest_data_size != 1 && cfg->dest_data_size != 2 && cfg->dest_data_size != 4) { in dma_si32_config()
201 LOG_ERR("dest_data_size must be 1, 2, or 4 (%" PRIu32 ")", cfg->dest_data_size); in dma_si32_config()
205 __ASSERT(cfg->source_data_size == cfg->dest_data_size, in dma_si32_config()
208 if (cfg->source_burst_length != cfg->dest_burst_length) { in dma_si32_config()
213 if (POPCOUNT(cfg->source_burst_length) > 1) { in dma_si32_config()
218 if (cfg->block_count > 1) { in dma_si32_config()
225 channel_data->callback = cfg->dma_callback; in dma_si32_config()
226 channel_data->callback_user_data = cfg->user_data; in dma_si32_config()
228 switch (cfg->source_data_size) { in dma_si32_config()
233 cfg->source_burst_length ? find_msb_set(cfg->source_burst_length) - 3 : 0; in dma_si32_config()
239 cfg->source_burst_length ? find_msb_set(cfg->source_burst_length) - 2 : 0; in dma_si32_config()
245 cfg->source_burst_length ? find_msb_set(cfg->source_burst_length) - 1 : 0; in dma_si32_config()
248 LOG_ERR("source_data_size must be 1, 2, or 4 (%" PRIu32 ")", cfg->source_data_size); in dma_si32_config()
253 if (!cfg->head_block || cfg->block_count == 0) { in dma_si32_config()
258 block = cfg->head_block; in dma_si32_config()
260 if (block->block_size % cfg->source_data_size != 0) { in dma_si32_config()
265 if (block->source_address % cfg->source_data_size != 0) { in dma_si32_config()
270 if (block->dest_address % cfg->dest_data_size != 0) { in dma_si32_config()
275 ncount = block->block_size / cfg->source_data_size - 1; in dma_si32_config()
286 switch (cfg->channel_direction) { in dma_si32_config()
305 LOG_ERR("Channel direction not implemented: %d", cfg->channel_direction); in dma_si32_config()
312 block->source_address + ncount * cfg->source_data_size; in dma_si32_config()
329 channel_descriptor->DSTEND.U32 = block->dest_address + ncount * cfg->dest_data_size; in dma_si32_config()