Altera_Forum
Honored Contributor
15 years agomemcpy, altera dma and tests...
Hi,
i'm trying to modify the memcpy function to decrease cpu usage (100% currently), while copying a huge quantity of data. i'm actually using uClinux (nommu) with a nios2 on an 3c120 FPGA. so i replace memcpy function in the file : .../nios2-linux/linux-2.6/arch/nios2/lib/memcpy.c by my function, using the altera DMA IP. for now i'm working in "CT_BYTE" to avoid alignements problems, but i managed to make it works with word in a simple application beside. my source code, with everything include (define from my nios2.h,...) is joined in the memcpy.c.txt Currently it doesn't work at all, system don't boot at all. but if i used the same thing in a standalone application to copy a 10Mb buffer to an other, it works ! 1.5x faster in CT_BYTE mode and 10x faster in CT_WORD mode than with a "c for" loop... it's the same speed as with memcpy, but if i use usleep(10) while i'm checking DM_STATUS register : while ((inl(na_dma_fp+REG_DMA_STATUS) & ST_DONE) != ST_DONE) usleep(10); cpu usage down to nearly 0%, while memcpy use 100% any idea of what i'm doing wrong or what i forget to do ? Thank you in advance, FP.