From: scarayol@assystembrime.com
To: akpm@osdl.org
Cc: linuxppc-embedded@ozlabs.org
Subject: mmap : please help !
Date: Wed, 13 Apr 2005 18:19:24 +0200 [thread overview]
Message-ID: <OFE975A4F1.3D68503C-ONC1256FE2.0059A386@brime.fr> (raw)
Hi all,
I need somme help : I wrote driver like /dev/mem to read and write into=
physical memory at specific addresses. For that, I use instruction mmap=
like that :
if((mem_mc_fd =3D open("/dev/map_mc",O_RDWR | O_SYNC)) < 0)
{
printf("\nProbleme pour ouvrir /dev/map_mc\n");
exit(-1);
}
// mapping de la zone correspondante
pmapMC =3D (DisqueMC *)mmap (0,MC_SIZE, PROT_READ | PROT_WRITE |
PROT_EXEC, MAP_SHARED, mem_mc_fd, MC_BASE_ADDRESS);
if (pmapMC =3D=3D MAP_FAILED)
{
printf("Erreur de mmap pour MC:%d,%s\n",errno, strerror(errno))=
;
close(mem_mc_fd);
}
I use function pread, pwrite to access datas within the driver function=
s
but, I should prefer to use pmapMC pointer (by the mean of this virtual=
address) that points to a structure. I thought that it was the same to
access to the physical memory to use the pointer or to use read, write =
on
the file (by mem_mc_fd), but it seems to have different results. What i=
s
wrong ? What is the good manner to read or write in the physical memory=
?
Thanks a lot.
----------------------------------------------------------
Sophie CARAYOL
TECHNOLOGIES & SYSTEMES
50 rue du Pr=E9sident Sadate
F - 29337 QUIMPER CEDEX
T=E9l: +33 2 98 10 30 06
mailto:scarayol@assystembrime.com
----------------------------------------------------------
=
next reply other threads:[~2005-04-13 16:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-13 16:19 scarayol [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-04-13 16:33 mmap : please help ! Fillod Stephane
2005-04-13 16:17 scarayol
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=OFE975A4F1.3D68503C-ONC1256FE2.0059A386@brime.fr \
--to=scarayol@assystembrime.com \
--cc=akpm@osdl.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