代码如下
void DMA0_Channel1_IRQHandler(void)
{
dma_interrupt_flag_clear(DMA0, DMA_CH1, DMA_INTC_FTFIFC);
}
void mem_dma_copy(void* dst,void *src,uint32_t len)
{
dma_multi_data_parameter_struct dma_init_struct;
/* enable DMA0 */
rcu_periph_clock_enable(RCU_DMA0);
dma_deinit(DMA0,DMA_CH1);
dma_init_struct.memory0_addr = (uint32_t)dst;
dma_init_struct.memory_width = DMA_MEMORY_WIDTH_8BIT;
dma_init_struct.memory_inc = DMA_MEMORY_INCREASE_ENABLE;
dma_init_struct.periph_addr = (uint32_t)src;
dma_init_struct.periph_width = DMA_PERIPH_WIDTH_8BIT;
dma_init_struct.periph_inc = DMA_PERIPH_INCREASE_ENABLE;
dma_init_struct.memory_burst_width = DMA_MEMORY_BURST_4_BEAT;
dma_init_struct.periph_burst_width = DMA_PERIPH_BURST_4_BEAT;
dma_init_struct.critical_value = DMA_FIFO_4_WORD;
dma_init_struct.circular_mode = DMA_CIRCULAR_MODE_DISABLE;
dma_init_struct.direction = DMA_MEMORY_TO_MEMORY;
dma_init_struct.number = len;
dma_init_struct.priority = DMA_PRIORITY_ULTRA_HIGH;
dma_multi_data_mode_init(DMA0, DMA_CH1, dma_init_struct);
dma_flow_controller_config(DMA0,DMA_CH1,DMA_FLOW_CONTROLLER_DMA);
/* configure DMA mode */
dma_circulation_disable(DMA0, DMA_CH1);
dma_channel_subperipheral_select(DMA0, DMA_CH1, DMA_SUBPERI0);
dma_interrupt_enable(DMA0, DMA_CH1, DMA_CHXCTL_FTFIE);/
//
/* dma interrupt configuration */
nvic_irq_enable(DMA0_Channel1_IRQn, 0, 0);
//
dma_channel_enable(DMA0, DMA_CH1);
}
运行后不能进入中断。哪里配置不对吗 ,有大佬可以解惑吗 |