static void DMA_RxConfiguration(u32 *BufferDST, u32 BufferSize)
{
DMA_InitTypeDef DMA_InitStructure;
DMA_ClearFlag(DMA2_FLAG_TC4 | DMA2_FLAG_TE4 | DMA2_FLAG_HT4 | DMA2_FLAG_GL4);
DMA_ClearITPendingBit(DMA2_IT_TC4);
/* DMA2 Channel4 disable */
DMA_Cmd(DMA2_Channel4, DISABLE);
/* DMA2 Channel4 Config */
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)SDIO_FIFO_Address;
DMA_InitStructure.DMA_MemoryBaseAddr = (u32)BufferDST;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
DMA_InitStructure.DMA_BufferSize = BufferSize/4 ; //这个值 为什么不能修改。?
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_High;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
DMA_Init(DMA2_Channel4, &DMA_InitStructure);
/* DMA2 Channel4 enable */
DMA_Cmd(DMA2_Channel4, ENABLE);
}
BufferSize是我定义的一个扇区大小为512
我里面的数据都是u32 也就是4个字节。但是理论上讲DMA_BufferSize不一定要规定死的,是应该可以灵活控制的,你想设置多少次就可以的。但是现在却不行。求高手指点
DMA_InitStructure.DMA_BufferSize 这个值为什么只能是BufferSize/4
} |