LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-03-2004, 03:19 PM   #1
Edgewise
LQ Newbie
 
Registered: Feb 2004
Posts: 2

Rep: Reputation: 0
Linux Device driver: Need FAST IO Port Access


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

-Edgewise
 
Old 02-03-2004, 04:58 PM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
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.
 
Old 02-03-2004, 10:29 PM   #3
Edgewise
LQ Newbie
 
Registered: Feb 2004
Posts: 2

Original Poster
Rep: Reputation: 0
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.


-Edgewise
 
Old 02-03-2004, 10:52 PM   #4
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
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.
 
  


Reply



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
USB device is recognized, but wount access it's specific driver. Lechium Linux - Software 2 08-05-2004 01:26 PM
Data acquisition from a device through serial port in linux newtolinux123 Linux - Newbie 1 04-22-2004 08:27 AM
Access linux device driver from a java application bnujos Programming 3 07-02-2003 04:55 AM
linux device driver & parallel port albatros Linux - General 1 01-08-2003 04:25 PM
iPAQ 10/100 fast Ethernet PCI card device driver philipsyyy Linux - Hardware 4 10-07-2002 05:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:27 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration