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

linux_host_loader下的 6657 DMA操作

大家好,

最近在开发linux下的PCI驱动,6657作为EP,准备使用6657的EDMA来操作数据,

但是在MCSDK_2.1.2的linux_host_loader示例代码中只有6678的EDMA部分,我直接使用那部分代码来操作6657的EDMA,

程序会一直停留在 HAL_readDMA 或者 HAL_writeDMA , 应该是这个接口还没有适配 6657 , 所以想请教一下各位高手,

我该如何修改这个接口,才能在6657上正确使用。或者谁有相应的示例代码,那就更好了。

代码如下,在Hello World程序之后添加EDMA操作,程序会一直停留在 HAL_writeDMA接口

#if HELLO_WORLD_DEMO
                /* Load DDR init code into DSP */
                pushData(ddrInitCode, 0, &bootEntryAddr);

                /* Write boot entry address into MAGIC_ADDR */
                writeDSPMemory(0, MAGIC_ADDR, &bootEntryAddr, 4);

                while (1) {
                        readDSPMemory(0, MAGIC_ADDR, buffer, 4);
                        if (buffer[0] == 0)  break;
                        for (i = 0; i < 1000; i++) i++;
                }

                /* Load "Hello World" demo into DSP */
                pushData(bootCode, 9, &bootEntryAddr);

                /* Write boot entry address into MAGIC_ADDR */
                writeDSPMemory(0, MAGIC_ADDR, &bootEntryAddr, 4);
#endif

        printk("Allocating consistent memory …\n");        wDataVirt = (uint8_t*)dma_alloc_coherent(&PCIE_DEV->dev, DMA_TRANSFER_SIZE, &wData, GFP_KERNEL);
        rDataVirt = (uint8_t*)dma_alloc_coherent(&PCIE_DEV->dev, DMA_TRANSFER_SIZE, &rData, GFP_KERNEL);

        for (i = 0; i < DMA_TRANSFER_SIZE; i++) {
            wDataVirt[i] = i;
            rDataVirt[i] = 0;
        }

        /* Wait 2 second for DDR init */
        mdelay(2000);

        printk ("Write DMA to DSP …\n");
        do_gettimeofday(&test_time1);
        HAL_writeDMA (wData, DDR_START, DMA_TRANSFER_SIZE, 1);   /* Move from GPP to DSP */        do_gettimeofday(&test_time2);

        mdelay(1000);

        printk("Read DMA from DSP …\n");
        do_gettimeofday(&test_time3);
        HAL_readDMA(DDR_START, rData, DMA_TRANSFER_SIZE, 1);     /* Move from DSP to GPP */
        do_gettimeofday(&test_time4);
        
        mdelay(1000);

        /* For demo how to move inside DSP purpose only, you can directly move between GPP and DSP using flag = 1 */
        //    HAL_writeDMA (0x80000000, 0x11800000, 0x10000, 0);        
        //    HAL_writeDMA (0x11800000, 0x0C000000, 0x10000, 0);

        diff = (test_time2.tv_sec – test_time1.tv_sec)*1000000 + (test_time2.tv_usec – test_time1.tv_usec);
        printk("DMA write throughput is: %d.%02d MB/s\n", DMA_TRANSFER_SIZE/(1024*1024)*1000*1000/diff,                ((DMA_TRANSFER_SIZE/(1024*1024)*1000*1000)%diff)*100/diff);

        diff = (test_time4.tv_sec – test_time3.tv_sec)*1000000 + (test_time4.tv_usec – test_time3.tv_usec);
        printk("DMA read throughput is: %d.%02d MB/s\n", DMA_TRANSFER_SIZE/(1024*1024)*1000*1000/diff,                ((DMA_TRANSFER_SIZE/(1024*1024)*1000*1000)%diff)*100/diff);

        printk("Freeing consistent memory …\n");
        dma_free_coherent(&PCIE_DEV->dev, DMA_TRANSFER_SIZE, wDataVirt, wData);
        dma_free_coherent(&PCIE_DEV->dev, DMA_TRANSFER_SIZE, rDataVirt, rData);

qingsong zhu:

自己顶一下,被沉了。 :)

qingsong zhu:

回复 Andy Yin1:

谢谢

赞(0)
未经允许不得转载:TI中文支持网 » linux_host_loader下的 6657 DMA操作
分享到: 更多 (0)