在c55_csl_3.07里面的CSL_MMCSD_SdCardFSExample例程中,有一个是通过DMA向SD卡中写入数据,即mmcConfigFs("dmaTest");但是查看mmcConfigFs函数,没有发现和DMA相关的内容,关键语句就是ATA_write(pAtaFile, gMmcWriteBuf, 1);,这个ATA_write函数也好像没有区分是poll模式还是DMA模式。请问通过DMA想SD卡写入数据是如何操作的?谢谢
Shine:
这里设置了。
/* Configure the DMA in case of operating mode is set to DMA */ if(opMode == CSL_MMCSD_OPMODE_DMA) { /* Initialize Dma */ status = DMA_init(); if (status != CSL_SOK) { printf("DMA_init Failed!\n"); return(status); }
/* Open Dma channel for MMCSD write */ dmaWrHandle = DMA_open(CSL_DMA_CHAN0, &dmaWrChanObj, &status); if((dmaWrHandle == NULL) || (status != CSL_SOK)) { printf("DMA_open for MMCSD Write Failed!\n"); return(status); }
/* Open Dma channel for MMCSD read */ dmaRdHandle = DMA_open(CSL_DMA_CHAN1, &dmaRdChanObj, &status); if((dmaRdHandle == NULL) || (status != CSL_SOK)) { printf("DMA_open for MMCSD Read Failed!\n"); return(status); }
/* Set the DMA handle for MMC read */ status = MMC_setDmaHandle(mmcsdHandle, dmaWrHandle, dmaRdHandle); if(status != CSL_SOK) { printf("API: MMC_setDmaHandle for MMCSD Failed\n"); return(status); }
xue liu:
回复 Shine:
是的,这个设置我也看到了,但是好像这里只是做了DMA配置,比如打开DMA通道等,好像没有看到DMA传输数据具体在怎么执行的
xue liu:
回复 Shine:
@shine zhang,麻烦能具体解释一下DMA的写操作在哪里执行的么?
Shine:
回复 xue liu:
DMA配置好源地址,目的地址,长度,触发事件,使能就可以了,触发事件发生后,硬件会自动搬移。
xue liu:
回复 Shine:
是的,这个过程我看文档里是这样的,但是好像在这个例程没有体现出来,是不是这个例程里没有DMA写的相关过程?
xue liu:
回复 Shine:
@Shine Zhang,再次仔细看了下这个例程,确实没有发现DMA写操作。请问有那个例程里有带文件系统的写SD卡的DMA操作么?