小编Mus*_*fat的帖子

Linux中的DMA memcpy操作

我想dma使用dmaengine.c文件(linux/drivers/dma)中的dma_async_memcpy_buf_to_buf函数.为此,我在dmatest.c文件(linux/drivers/dma)中添加了一个函数,如下所示:

void foo ()
{
    int index = 0;
    dma_cookie_t cookie;
    size_t len = 0x20000;

    ktime_t start, end, end1, end2, end3;
    s64 actual_time;    

    u16* dest;
    u16* src;

    dest = kmalloc(len, GFP_KERNEL);
    src = kmalloc(len, GFP_KERNEL);

    for (index = 0; index < len/2; index++)
    {
        dest[index] = 0xAA55;
        src[index] = 0xDEAD;
    }

    start = ktime_get();
    cookie = dma_async_memcpy_buf_to_buf(chan, dest, src, len);

    while (dma_async_is_tx_complete(chan, cookie, NULL, NULL) == DMA_IN_PROGRESS)
    {
       dma_sync_wait(chan, cookie);
    }
    end = ktime_get();
    actual_time = ktime_to_ns(ktime_sub(end, start));
    printk("Time taken …
Run Code Online (Sandbox Code Playgroud)

linux dma

6
推荐指数
1
解决办法
7062
查看次数

标签 统计

dma ×1

linux ×1