ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, I have a single board computer previously running DOS. I recently made Linux running on it. Now that the system is running Linux, I have to translate the code that was supported by DOS. The code has segments that allow direct access of memory mapped registers through the macro _MK_FP and do read/write.
I have read that where DOS allows this kind of direct memory access, Linux does not. Is there a way to do this in Linux?
I have read that where DOS allows this kind of direct memory access, Linux does not. Is there a way to do this in Linux?
Not from user-space. You'll probably need to write a kernel-space driver and use phys_to_virt() (see this). If you need an introduction to writing device drivers, this is a good start.
A better question would be: what does the memory mapping code do? What is its intended result? There might be a higher level mechanism to accomplish the same thing.
Hi, I tried to write a device driver to access some memory mapped hardware locations on a board attached to PC-104 single board computer. The hardware is actually an FPGA, the registers of which I want to access. I am using ioremap(), ioread16() and iowrite16() functions to do I/O. I write to a location and then read it back to verify whether the write is happening or not. Whereas some reads come out correctly, others don't. For instance, when I write to 0xB8000, the read comes out correctly, whereas a write to 0xD0000 does not. (0xD0000 is base address of above mentioned FPGA).
Its possible that some addresses are write-only. ISA bus address decoding does not always uniformly decode read & write cycles, since the -MEMR & -MEMW are separate logic signals, and the hardware designer is free to decode them both, or just one. Some hardware is inherently write-only.
My concern here is ... even if you do manage to write to the latch-addresses from a user mode program ... how do you expect to get the timing right? You need a device-driver to be doing that on your behalf.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.