LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   Need help in writing device driver (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/need-help-in-writing-device-driver-895139/)

rainbow82 08-02-2011 01:00 PM

Need help in writing device driver
 
Hi, I am trying 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).

Can somebody please help me what's going on? Am I supposed to use some other functions?

I am following Linux Device Drivers-3rd Ed and the following tutorial:
http://www.freesoftwaremagazine.com/.../drivers_linux

Thanks

nini09 08-02-2011 02:26 PM

You should be aware of ioread or iowrite operate on kernel virtual address, not physical address.

David1357 08-02-2011 02:42 PM

Quote:

Originally Posted by rainbow82 (Post 4431863)
Am I supposed to use some other functions?

You need to read "Chapter 15: Memory Mapping and DMA".
However, you might be able to get away with using mmap and accessing your hardware from user space.


All times are GMT -5. The time now is 06:25 AM.