LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices

Reply
 
Search this Thread
Old 08-02-2011, 01:00 PM   #1
rainbow82
LQ Newbie
 
Registered: Jul 2011
Posts: 8

Rep: Reputation: Disabled
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
 
Old 08-02-2011, 02:26 PM   #2
nini09
Member
 
Registered: Apr 2009
Posts: 990

Rep: Reputation: 67
You should be aware of ioread or iowrite operate on kernel virtual address, not physical address.
 
Old 08-02-2011, 02:42 PM   #3
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by rainbow82 View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing PCIe device driver pythonarms Linux - Kernel 0 02-23-2009 01:45 PM
Help in writing device driver ankit_chaudhri Programming 3 11-13-2007 11:50 AM
Device Driver Writing Guide SJD Linux - Hardware 1 04-11-2007 12:01 PM
Writing Device Driver... okeyla Programming 3 05-18-2005 07:41 AM
Need help in writing device driver eshwar_ind Programming 1 02-07-2004 03:46 PM


All times are GMT -5. The time now is 10:02 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration