ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
Wasn't sure which forum to ask this, if there is a more appropriate one, please let me know...
I am trying to write a driver. My target system is running MontaVista Linux 3.1 (2.4.20) and my host system is running RedHat 7.1. The driver is supposed to be the simplest driver possible: open, release, read and write are only implemented functions. The hardware is just a register on-chip (it is a "custom" peripheral for a Xilinx FPGA, essentially hangs off the PLB bus of a PPC405 system). I need this driver to work before I try and write one for our real peripheral that is considerably more complex than a register.
I am getting an oops message on the first read or write that I try. I am fairly certain that the open and release methods work fine since when I don't try and read or write, I can use a test program to open and close the device (using out printf statements in the app as I go and printk statements in the driver as I go).
Since the hardware I am targeting is just a register, I figured if I had it's address in the system (which is hardcoded into the hardware at design time) it would only need a simple in_32()/out_32() statement in the read/write functions of the driver, but these oops on me. Tried using copy_to_user()/copy_from_user() instead, but these oopsed as well.
Been referencing the o'reilly book, Linux Device Drivers, but to no avail. I can put up code if helpful or describe my system in more detail, but hopefully I am missing something obvious to an experienced driver writer who can point me in the right direction...