Subject: Re: mmap problem in device driver and application program.

From: Johan Borkhuis <[email-masked]>
Date: Wed, 14 May 2008 08:18:46 +0200

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