LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
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.

Notices

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

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


Hi,

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
will_berry70
LQ Newbie
 
Registered: Oct 2009
Posts: 3

Rep: Reputation: 0
Hi,
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?

Will.
 
  


Reply


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


All times are GMT -5. The time now is 09:00 PM.

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