mmap problem in device driver and application program.

Johan Borkhuis j.borkhuis at dutchspace.nl
Wed May 14 16:18:46 EST 2008


MingLiu wrote:
> Dear Dave,
>   
>> If you are using memory that is not under the kernel's memory management> you will need to use something other than remap_pfn_range.> 
>>     
> Happenly and unfortunately we are using the memory space out of the control from the kernel. We have 2GB memory on the board and only 64(or 32) MB is reserved for the kernel. The rest large space is for the data buffering or LUT use. In my question, the LUT memory is located in the rest part rather than the kernel memory area. 
>  
> Any more suggestion on how to mmap this LUT area? Any idea will be valuable for a beginner like me. Thanks in advance. 
>   

If this is physical memory that is not controlled by the kernel you
could also use the /dev/mem device. You could do something like:

memFd = open("/dev/mem", O_RDWR);
memBuf = mmap(0, <Memory size>, PROT_READ | PROT_WRITE, MAP_SHARED,
memFd, <Physical address of memory);

which maps the physical memory into user space, without the need for a
special device driver or mmap implementation.

Kind regards,
Johan Borkhuis



More information about the Linuxppc-embedded mailing list