|
我写了一个搬运函数不不工作,有哪位大神成功了,指导一下
void mem_to_mem_dma_transfer(u16 *dstAddr,u16 *srcAddr,unsigned int dataLength )
{
DMA_InitTypeDef DMA_InitStruct;
/* Initialize the DMA_PeripheralBaseAddr member */
DMA_InitStruct.DMA_PeripheralBaseAddr = (u16)&dstAddr;
/* Initialize the DMA_MemoryBaseAddr member */
DMA_InitStruct.DMA_MemoryBaseAddr = (u16)&srcAddr;
/* Initialize the DMA_DIR member */
DMA_InitStruct.DMA_DIR = DMA_DIR_PeripheralSRC;
/* Initialize the DMA_BufferSize member */
DMA_InitStruct.DMA_BufferSize = dataLength;
/* Initialize the DMA_PeripheralInc member */
DMA_InitStruct.DMA_PeripheralInc = DMA_PeripheralInc_Enable;
/* Initialize the DMA_MemoryInc member */
DMA_InitStruct.DMA_MemoryInc = DMA_MemoryInc_Enable;
/* Initialize the DMA_PeripheralDataSize member */
DMA_InitStruct.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
/* Initialize the DMA_MemoryDataSize member */
DMA_InitStruct.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
/* Initialize the DMA_Mode member */
DMA_InitStruct.DMA_Mode = DMA_Mode_Normal;
/* Initialize the DMA_Priority member */
DMA_InitStruct.DMA_Priority = DMA_Priority_High;
/* Initialize the DMA_M2M member */
DMA_InitStruct.DMA_M2M = DMA_M2M_Enable;
DMA_Init(DMA1_Channel1,&DMA_InitStruct);
DMA_ITConfig(DMA1_Channel1,DMA_IT_TC,ENABLE);
DMA_Cmd(DMA1_Channel1,ENABLE);
while( DMA1_Channel1 -> CNDTR != 0); //等待传输完成
}
|
阿莫论坛20周年了!感谢大家的支持与爱护!!
你所害怕的每一个鬼,都是别人朝思暮想却再也见不到的人。
|