Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.


  Search this Thread
Old 07-24-2008, 06:24 PM   #1
LQ Newbie
Registered: Jul 2008
Posts: 3

Rep: Reputation: 0
Question on using mmap to access physical memory


I am pretty new to linux and i have a few questions about an approach for an NVRAM driver.

We have 4 segments of memory that are attached to our processor via TI's EMIF (external memory interface).

I think I know at high level what needs to be done, but am having trouble with the details.

One of the areas is for an area of NonVolatile RAM. Once this is mapped you can read and write to the memory without any special needs. The chip handles the saving of data.

So, what I think i would like to is write a driver to map that area of memory which starts at 0x06000000 and is 32M in length and then have my application use mmap() to access the memory. The actual amount of memory on this device is much smaller than the 32M, but that is the size of the EMIF partition.

I found an example driver that implements something similar using a char driver, but it allocates new memory in the kernel and I don't quite get how to do this with existing memory.

1) Do i need to be using the MTD subsystem to do this?
2) How do you map the physical memory to an area that can be accessed by mmap?
3) Does this approach sound reasonable?

Thanks In Advance.
Old 10-05-2009, 04:54 AM   #2
LQ Newbie
Registered: Oct 2009
Posts: 3

Rep: Reputation: 0
I'm trying to do similar. I'm trying to access some NOR flash at 0x0200 0000. Again this is a TI ARM (DaVinci actually) setup.

I use mmap in the application (to a file descriptor ot type 'node' I've created earlier). In the kernel object I've used register_chrdev and then request_mem_region (physical memory) for the driver. Then remap_pfn_range pointing to the physical address.

Trouble is this doesn't seem to work, as my memory contents change when they should be constant.

Did you get your project working in the end?



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Physical memory ronlau9 Linux - Hardware 4 04-28-2008 07:41 AM
Physical Memory and Virtual Memory Murdock1979 Linux - General 1 01-28-2008 08:35 AM
Mmap and munmap physical address to user space karttik Linux - Software 0 10-28-2007 03:10 AM
Less physical memory? ariek Debian 5 07-21-2005 03:23 PM
How to access physical memory in C? cyu021 Programming 6 03-27-2005 05:16 AM > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 03:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration