ARM Linux Driver how to work with DMA

下面是arm linux中一个申请DMA buffer的例子,DMA需要uncached virtual address space,同时映射的物理内存需要是连续的,所以需要特定的函数来帮助我们。
info->data_buff = dma_alloc_coherent(&pdev->dev, MAX_BUFF_SIZE, &info->data_buff_phys, GFP_KERNEL); if (info->data_buff == NULL) { dev_err(&pdev->dev, "failed to allocate dma buffer/n"); return -ENOMEM; } 其中info->data_buff_phys是物理地址,info->data_buff是线性地址

你可能感兴趣的:(linux,null,buffer)