From: "Vijay Padiyar" <vijay_padiyar@hotmail.com>
To: "Embedded TUX" <etux@embeddedtux.org>,
"LinuxPPC Support" <linuxppc-embedded@ozlabs.org>
Subject: query regarding access of physical memory from user space
Date: Fri, 11 Feb 2005 19:46:35 +0530 [thread overview]
Message-ID: <BAY1-DAV107BFA9E5ADCAD5B97A0118B770@phx.gbl> (raw)
Hi
I am a bit new to Linux and therefore am unable to appreciate exactly the
use of various techniques used to map physical memory to user or kernel
space. I have come across functions like ioremap(), remap_page_range(), etc.
I am still a _bit_ confused as to exactly what to use for our purpose.
I have an MPC8260 target with 128 MB SDRAM (0x00000000 - 0x07FFFFFF), 32 MB
FLASH (0xFE000000 - 0xFFFFFFFF). In between, I have some CPLDs and FPGAs
mapped at various physical addresses. I wish to access these devices from a
user program or from a device driver inserted into the kernel.
Please tell me how do I go about it?
What I have done right now is to use ioremap() to remap a section of
physical memory to kernel virtual memory and try to use it.
For example, we have a CPLD whose registers we wish to manipulate. These
registers lie in the address range 0x30000000 - 0x300000FF. I map this range
as follows:
unsigned char *cpld_mem;
cpld_mem = (unsigned char *)ioremap(0x30000000, 0x100);
Is this correct? After I do this, can I write to and read from the physical
memory locations 0x30000000-0x300000FF using writeb() and readb()? Or do I
have to use outb() and inb()?
Please do clarify my doubts. Also, what is the *highest memory address* as
well as *maximum memory size* that I can map to kernel or user space using
ioremap()?
In other words, can I map any address in the 32-bit address space to kernel
virtual space using ioremap()? Also, what chunk size of memory can I map in
one go?
Please give me some ideas regarding my doubts. I need to get finished with
the driver soon.
Regards
Vijay Padiyar
http://www.vijaypadiyar.eu.tf
next reply other threads:[~2005-02-11 14:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-11 14:16 Vijay Padiyar [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-02-12 4:53 query regarding access of physical memory from user space Akash kaul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BAY1-DAV107BFA9E5ADCAD5B97A0118B770@phx.gbl \
--to=vijay_padiyar@hotmail.com \
--cc=etux@embeddedtux.org \
--cc=linuxppc-embedded@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox