HOW to do BUFFER COPY in LINUX KERNEL
Hi all ,
I am working for an DMA driver on LINUX 2.6.32. I having having the DMA data from the device in BUFFER A[using dma_alloc_coherent] such that char *dmasrcptr =dma_alloc_coherent(NULL,GLOBAL_BUFFER_SIZE,&dmadest,0); Now from user space i am getting an structure which has the buffer on which need to do copy this buffer. typedef struct { unsigned int value; unsigned char charbuf[GLOBAL_BUFFER_SIZE]; }driver_struct; At present i am doing an copy to user_buffer[in structure] using an for loop. like :- a. I am assigning an local char pointer. b. This pointer i am initializing to BUFFER of user structure. c. Then using FOR loop i am acessing data from DMA buffer and storing it in user buffer [in structure] using for loop. Can any one please let me know if there is any better method or an optimized function call.{ like MEMCPY } Thanks Ashish Mishra |
This might go down better at http://kernelnewbies.org/
There are definitely functions for copying between kernel and user space. The fastest tip may be to look at an existing driver. |
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves.
|
Hi all ,
#include <linux/string.h> memmove did the work for me !!!! |
All times are GMT -5. The time now is 09:55 PM. |