From: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
To: Pierre AUBERT <p.aubert@staubli.com>
Cc: linuxppc-embedded <linuxppc-embedded@lists.linuxppc.org>
Subject: Re: simple access to mem mapped peripheral
Date: Thu, 04 Oct 2001 12:07:21 +0200 [thread overview]
Message-ID: <3BBC34D9.B60D1BC9@esd-electronics.com> (raw)
In-Reply-To: 3BBC1AAC.AAA004C@staubli.com
Hi Pierre,
thanks. mmap is working fine for my problem ! I wonder why lseek'ing and
reading does not work.
Matthias
Pierre AUBERT wrote:
> I think that you can try the mmap function :
>
> int mmap_fd;
>
> /* Open the memory device and mmap the chip registers */
> if ((mmap_fd = open("/dev/mem", O_RDWR)) < 0 ) {
> perror("open(/dev/mem)");
> exit(1);
> }
> ptr = (chip_register *)mmap(NULL, CHIP_MEM_SIZE,
> (PROT_READ|PROT_WRITE),
> MAP_SHARED, mmap_fd, CHIP_PHYSICAL_ADDRESS);
> if ( ((int)ptr) < 0 ) {
> perror("mmap()");
> close(mmap_fd);
> exit(1);
> }
> else {
>
> /* Read and write your chip registers ... */
>
> munmap (ptr, CHIP_MEM_SIZE);
> close(mmap_fd);
> }
>
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~2001-10-04 10:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-02 14:53 simple access to mem mapped peripheral Subodh Nijsure
2001-10-04 8:02 ` Matthias Fuchs
2001-10-04 8:15 ` Pierre AUBERT
2001-10-04 10:07 ` Matthias Fuchs [this message]
2001-10-04 15:34 ` Francis Litterio
-- strict thread matches above, loose matches on Subject: below --
2001-10-02 9:02 Matthias Fuchs
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=3BBC34D9.B60D1BC9@esd-electronics.com \
--to=matthias.fuchs@esd-electronics.com \
--cc=linuxppc-embedded@lists.linuxppc.org \
--cc=p.aubert@staubli.com \
/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;
as well as URLs for NNTP newsgroup(s).