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 All,
I'm somewhat of a linux newbie who has been charged with writing a device driver for a custom ISA card. The card has a number of IO ports and some memory. I need to access the IO ports as fast as possible.
I've been working my way through Oreilly's linux device driver book, and looking around the web for info.
The original software is written in dos/borland c++.
Should I use the read and write file operations to do it? I"m wondering if they have internal buffering, or any other hidden gotchas that will slow access down.
Should ioctl be used?
are there any other methods that I don't know about?
Thanks in advance for any help you can give
Define fast (sec, millisec, usec, nanosec)? Read and write may or may not be fast depending on how you look at it. There is no internal buffer unless you make one, as you will actually define the behavior of the command in your module. I mostly use ioctl as a method of defining commands that can be sent to the driver.
I'm looking at the usec range. I guess my confusion (or aprehension) comes from using the Read and Write system calls. The prototypes don't seem to lend themselves to performing discrete IO. I.E. Read takes a file pointer, a buffer pointer, a count, and an offset.
The time sensitive data is written to (or read from) byte ports. I want to be able to send the driver an address and a byte of data, and have it write it (or read the port) as soon as possible.
That being the case you probably do want to implement an ioctl command, or maybe three, one to set the address, and one for reading a byte and one for writing a byte.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.