2008-02-03 11:50 PM
DMA mem to mem copy instead of copy_to_user() ...
2008-01-29 04:41 AM
Hi all,
I'm trying FDMA to do a memory-to-memory copy function instead of using copy_to_user(). I followed the stlinux example below (http://www.stlinux.com/docs/manual/distribution/fdma_sh_exmpl1.php) unsigned long flags= STM_DMA_SETUP_CONTEXT_TASK | DIM_1_x_1 | MODE_SH_COMPATIBILITY; unsigned long xfer_bytes =4096; void* src_buff = kmalloc(xfer_bytes,GFP_KERNEL); void * dst_buff = kmalloc(xfer_bytes,GFP_KERNEL); int ch_num = request_dma(0,__FUNCTION__); if(!ch_num ==0) return -ENODEV; if(src_buff){ memset(src_buff,0x4,xfer_bytes); dma_cache_wback(&src_buff[0],sizeof(u32)*xfer_bytes); dma_cache_wback(&dst_buff[0],sizeof(u32)*xfer_bytes); dma_configure_channel(ch_num,flags); dma_xfer(ch_num, virt_to_phys((void*)src_buff), virt_to_phys((void*)dst_buff) ,xfer_bytes, MODE_SH_COMPATIBILITY); dma_wait_for_completion(ch_num); if(memcmp((void*)src_buff,(void*)dst_buff,xfer_bytes)!=0){ dump_srcbuff(src_buff,xfer_bytes); dump_dstbuff(dst_buff,xfer_bytes); panic('' memory does not compare\n''); } printk(''woken up from DMA - TEST OK\n''); kfree((void*)src_buff); kfree((void*)dst_buff); free_dma(ch_num); return 0; } return -ENOMEM; then got an error that looks like this: .. Unable to handle kernel NULL pointer dereference at virtual address 00000000 pc = 86cd56aa *pde = 00000000 Oops: 0001 [#1] Pid : 818, Comm: udhcpc PC is at create_llu_list+0x86/0x8c PC : 86cd56aa SP : 8f633d38 SR : 40008001 TEA : c0103a64 Not tainted R0 : 00000000 R1 : 00000000 R2 : 8f633d80 R3 : 00000001 R4 : 8f633d80 R5 : 00000000 R6 : 00000000 R7 : 00000000 R8 : 00000001 R9 : 8f633d40 R10 : 00000030 R11 : 86d6616c R12 : 0f516ae0 R13 : 86d6616c R14 : 8fbc6000 MACH: 00000000 MACL: 00000000 GBR : 295737e8 PR : 86cd696c my box use STB710x, SH architecture and stlinux-2.6.17.14. Could someone tell me a clue to my problem, please? If I change the flag to use ''MODE_FREERUNNING'', then I got another error: CH_0 invalid descriptor How should I configure the flags then? Thank you very much and sorry if this is not the right place to ask this kind of problems! /ha2008-02-03 11:50 PM
Hello hanguytv,
I think that your request is not for this forum. Maybe the ST40 or the STR7 forum will be more appropriate. Thank you, Seb