- 论坛徽章:
- 0
|
我写的一个驱动,运行在红帽5的64系统,X86_64平台之上,采用DMA方式进行数据传输,在初始化过程中,发现申请的内核虚拟地址和总线地址(物理地址)是相同的,将物理地址编程到硬件后,启动DMA传输就死机。请那位帮忙解释一下
初始化过程中相关代码如下
#define BUF_SIZE 4096*1024
void * virtual_addr;
dma_addr_t * bus_addr;
virtual_addr = pci_alloc_consistent(gDev, BUF_SIZE, &bus_addr);
if (NULL == virtual_addr ) {
printk(KERN_CRIT"%s: Init: Unable to allocate virtual_addr .\n",gDrvrName);
return (CRIT_ERR);
}
// Print Read buffer size and address to kernel log
printk(KERN_INFO"%s: Read Buffer Allocation: %p->%p\n", gDrvrName, (unsigned int)virtual_addr , (unsigned int)bus_addr);
打印结果如下 DMA_DRV:Read Buffer Allocation: 00000000bbc00000->00000000bbc00000
|
|