TI中文支持网
TI专业的中文技术问题搜集分享网站

edma_alloc_channel 申请channel值是负值

师兄们 最近在做edma时

edma_alloc_channel 时 申请的channel值是负值 ,然后报段错误 unable to handle kernel NULL pointer deference at virtual address 00000000 这个错误怎么解决..能不能给个思路 谢谢

edma配置代码如下:

static int edma_config(void)
{ int ret;
/*mmapbuf = (unsigned short *)kmalloc(SZ_4M, GFP_KERNEL);
if(!mmapbuf )
{
printk("kmalloc mmapbuf fail\n");
//goto init_fail_2;
return -ENOMEM;
}
SetPageReserved(virt_to_page(mmapbuf));//告诉系统,这个页面我已经占了
memset(mmapbuf , 0, SZ_4M);*/

fpga_buf = dma_alloc_coherent(NULL,MAX_DMA_TRANSFER_IN_BYTES,&dmaphysdest,0);
printk("DST1:0x%x\n", dmaphysdest);//dmaphysdest 物理内存起始地址
printk("fpga_buf:%p\n",fpga_buf); //fpga_buf 虚拟内存起始地址
if (!fpga_buf)
{
printk(KERN_INFO "dma_alloc_coherent failed for dmaphysdest\n");
return -ENOMEM;
}
// edma_free_channel(EDMA_CHANNEL_ANY);
edma_free_channel(52);
ret = edma_alloc_channel(52, callback1, NULL, 0);
gDmaCh = ret;
printk("nedma_alloc_channel sucsess,gDmaCh=%d\n",gDmaCh);
if (gDmaCh < 0) {
printk("edma_alloc_channel failed for dma_ch, error:%d\n", gDmaCh);
return gDmaCh;
}
printk("nedma_alloc_channel sucsess,gDmaCh=%d\n",gDmaCh);
edma_set_src (gDmaCh, (unsigned long)(fpga_phy_base), INCR, W16BIT);
printk("edma_set_src sucsess!\n");
edma_set_dest (gDmaCh, (unsigned long)(dmaphysdest), INCR, W16BIT);
printk("edma_set_dest sucsess!\n");
edma_set_src_index (gDmaCh, 0, 0);
printk("edma_set_src_index sucsess!\n");
edma_set_dest_index (gDmaCh, 0, 0);
printk("edma_set_dest_index sucsess!\n");
edma_set_transfer_params (gDmaCh, 8192, 1, 1, 1, ASYNC);
printk("edma_set_transfer_params sucsess!\n");
edma_read_slot (gDmaCh, &param_set);
printk("edma_read_slot sucsess!\n");
param_set.opt |= (1 << ITCINTEN_SHIFT);
printk("opt=%d\n",param_set.opt);
param_set.opt |= (1 << TCINTEN_SHIFT);
printk("opt=%d\n",param_set.opt);
param_set.opt |= EDMA_TCC(EDMA_CHAN_SLOT(gDmaCh));
printk("opt=%d\n",param_set.opt);
edma_write_slot (gDmaCh, &param_set);
printk("edma_write_slot sucsess!\n");
return 0;
}

insmod后报段错误 打印信息如下

Jian Zhou:

请问是在哪个CPU上测试的?AM335x?

user4822185:

回复 Jian Zhou:

嗯 am3352

指定通道 ,就报oops 段错误

Jian Zhou:

回复 user4822185:

有参考过这个文档么:

看看是不是通道设置的问题

赞(0)
未经允许不得转载:TI中文支持网 » edma_alloc_channel 申请channel值是负值
分享到: 更多 (0)