日期:2014-05-16 浏览次数:20717 次
int edma3_memtomemcpy(struct edma_linux_params *params)
{
int result = 0;
int i;
unsigned int numenabled = 0;
struct paramentry_descriptor param_set;
unsigned int dma_ch;
unsigned int tcc = EDMA_TCC_ANY;
result = davinci_request_dma(EDMA_DMA_CHANNEL_ANY, "A-SYNC_DMA0",
edma_callback, NULL,
&dma_ch, &tcc, 0);
if (0 != result) {
DMA_PRINTK
("\nedma3_memtomemcpytest_dma::davinci_request_dma failed for dma_ch, error:%d\n",
result);
return result;
}
davinci_set_dma_src_params(dma_ch, (unsigned long)(params->src),
INCR, W8BIT);
davinci_set_dma_dest_params(dma_ch, (unsigned long)(params->dst),
INCR, W8BIT);
davinci_set_dma_src_index(dma_ch, params->srcbidx, params->srccidx);
davinci_set_dma_dest_index(dma_ch, params->dstbidx, params->dstcidx);
/* AB Sync Transfer Mode */
davinci_set_dma_transfer_params(dma_ch, params->acnt, params->bcnt, params->ccnt,
params->bcnt, ABSYNC);
/* Enable the Interrupts on Channel 1 */
davinci_get_dma_params(dma_ch, ¶m_set);
param_set.opt
------解决方案--------------------
= (1 << ITCINTEN_SHIFT);
param_set.opt
------解决方案--------------------
= (1 << TCINTEN_SHIFT);
davinci_set_dma_params(dma_ch, ¶m_set);
numenabled = params->ccnt;
for (i = 0; i < numenabled; i++) {
irqraised1 = 0;
/* Now enable the transfer as many times as calculated above. */
result = davinci_start_dma(dma_ch);
if (result != 0) {
DMA_PRINTK
("edma3_memtomemcpytest_dma: davinci_start_dma failed \n");
break;
}
/* Wait for the Completion ISR. */
while (irqraised1 == 0u) ;
/* Check the status of the completed transfer */
if (irqraised1 < 0) {
/* Some error occured, break from the FOR loop. */
DMA_PRINTK("edma3_memtomemcpytest_dma: "
"Event Miss Occured!!!\n");
break;
}
}
davinci_stop_dma(dma_ch);
davinci_free_dma(dma_ch);
return result;
}