Do you have a question? Post it now! No Registration Necessary

Re: Writing diretly to memory (memory mapped IO)

Yes.
That's not quite C, but you're headed the right direction.
You'd better delcaer mappedport a pointer to a volatile data
type.

You've got to make sure your task's memory map is set up so that
the virtual address to which you're writing is mapped to the
physical addres to which you want to write.
The "right" way to do it is probably to write a device driver
that impliments the mmap() call allowing the device's I/O
registers to be mapped into userspace.
--
Grant Edwards grante Yow! Now my EMOTIONAL
at RESOURCES are heavily
Grant Edwards grante Yow! Now my EMOTIONAL
at RESOURCES are heavily
We've slightly trimmed the long signature. Click to see the full one.

Re: Writing diretly to memory (memory mapped IO)

True, if you know where your hardware is in memory, and you
don't have to do anything like scan the PCI bus, or tweak the
MMU to allow access to the region in question.
--
Grant Edwards grante Yow! Here I am at the flea
at market but nobody is buying
Grant Edwards grante Yow! Here I am at the flea
at market but nobody is buying
We've slightly trimmed the long signature. Click to see the full one.

Re: Writing diretly to memory (memory mapped IO)

interesting to know that. I'm just thinking of developping a PCI driver that
use the memory mapp so that I can declare some variables in my software that
are located in the PCI controller of the PCI board (so that the location is
transparent for the software), do you know an open source driver that do
such thing or an example of to use this driver ?
Best regards

Re: Writing diretly to memory (memory mapped IO)

Here's a demo driver I wrote about 6 years ago. I don't know how
compatible it is with newer kernels.
ftp://ftp.visi.com/users/grante/stuff/demomm.tar.gz
--
Grant Edwards grante Yow! Yow! Are we in the
at perfect mood?
Grant Edwards grante Yow! Yow! Are we in the
at perfect mood?
We've slightly trimmed the long signature. Click to see the full one.

Re: Writing diretly to memory (memory mapped IO)

I think the kernel's PIC API has been re-written at least once
snice I wrote that, so you might want to look at a more recent
driver for PCI examples.
--
Grant Edwards grante Yow! The PILLSBURY
at DOUGHBOY is CRYING for
Grant Edwards grante Yow! The PILLSBURY
at DOUGHBOY is CRYING for
We've slightly trimmed the long signature. Click to see the full one.
Site Timeline
- » Lilo fails on Chroot to NFS mounted flash
- — Next thread in » Embedded Linux
-
- » Inexpensive Developer Boards
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Passive Car Battery Trickle Charger
- — The site's Newest Thread. Posted in » Electronics Design
-
- » dalla cina un rebus
- — The site's Last Updated Thread. Posted in » Electronics Hobby (Italian)
-