Hello,
I am having trouble getting a simple DMA example up and running in kernel space and am hoping someone would be kind enough to walk me through the steps necessary to properly setup a simple DMA that is triggered in software. All I want is a simple kernel-space example that transfers a few bytes from one buffer to another on a software trigger.
As it stands now, the kernel module compiles, and appears to set everything up correctly, but the DMA does not appear to be triggered.
I am using /arch/arm/mach-davinci/dma.c to call the setup functions, and taking hints from /drivers/spi/davinci_spi.c, /drivers/mmc/host/davinci_mmc.c, and /linuxutils_2_25_04_10/packages/ti/sdo/linuxutils/edma/src/module/edmak.c.
Below are excerpts from my module:
==================================================================================================
//Allocate buffers
dma_data1 = (int*)kmalloc(DATA_SIZE * sizeof(int), GFP_ATOMIC);
dma_data2 = (int*)kmalloc(DATA_SIZE * sizeof(int), GFP_ATOMIC);
.
.
.
//Get physical address of buffer head
src_addr_phy = (dma_addr_t)virt_to_phys(dma_data1);
dst_addr_phy = (dma_addr_t)virt_to_phys(dma_data2);
.
.
.
//Setup DMA parameters
channel = edma_alloc_channel(EDMA_CHANNEL_ANY, callMe, (void*)buf, EVENTQ_DEFAULT);
slot = edma_alloc_slot( 0 , EDMA_SLOT_ANY);
edma_set_src(slot, src_addr_phy, INCR, 0);
edma_set_dest(slot, dst_addr_phy, INCR, 0);
edma_set_transfer_params(slot, (u16)(DATA_SIZE*sizeof(int)), 1, 1, 0, ASYNC);
.
.
.
edma_start(channel);
==================================================================================================
Hardware being used: dm6467 on the evm6467 developer board.
Thank you very much!