标题: DMA陷入死循环 [打印本页]
作者: zengya 时间: 2008-10-20 20:45 标题: DMA陷入死循环
DMA陷入死循环
我的DMA程序也陷入死循环,请您知道一下!
#define TRANSFER_LENGTH 3367;
static volatile int dma_complete = 0;
void dma_done (void* handle){
dma_complete = 1;
}
int main(void)
{
int rc;
alt_dma_txchan txchan;
alt_u8* tx_data = nararray0[0];
/*Create the transmit channel*/
if((txchan = alt_dma_txchan_open("/dev/dma")) == NULL)
{
printf ("Failed to open transmit channel\n");
exit(1);
}
else
{
printf ("Create the transmit channel successfully!\n");
}
//post the transmit request
if((rc = alt_dma_txchan_send(txchan,
tx_data,
TRANSFER_LENGTH,
done,
NULL)) < 0)
{
printf ("Failed to post transmit request, reason = %i\n", return_code);
exit (1);
}
else
{
printf ("Post the transmit request successfully!\n");
}
while(!dma_complete);
printf("Transfer sucessful!\n");
return 0;
}
它一直执行while(!dma_complete);陷入死循环,希望高手能够指点一下!!
作者: zhanghoujun1989 时间: 2008-10-21 16:49
这要看你的DMA的 write和read主端口在SOPC端是不是挂接在32bit on chip memory 上, 如果是就将你上面的TRANSFER_LENGTH改成4的整数倍,否则你的dma_done (void* handle)就不会被调用,dma_complete一直是0,while(!dma_complete)陷入死循环!!
作者: zengya 时间: 2008-10-22 18:06
谢谢 zhanghoujun1。搞定了。设置问题 write和read没有挂在总线上
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) |
Powered by Discuz! 7.0.0 |