[comp.unix.xenix] XENIX.. speed up of /dev/port ..

curtj@pogo.GPID.TEK.COM (Curt ) (01/06/89)

I thank you for the suggestion of  (mknod /dev/port 4 3) to create a 
device which I can talk to the I/O ports.. 

My current problem is this:

	I have 1.2 Meg, to send down through an I/O port.  Since
	I have to to an 'lseek' every time I wish to send a byte down 
	to a specific port address, it takes an astronomical amount of
	time to send the data.

	Is there any way to cause READ/WRITE to NOT update the file 
	pointer address when you execute them.  If not, HOW DO I GET
	HOLD OF THE i-node so that I can reset the file pointer	to the
	proper address every time I issue a READ/WRITE.

	I am trying to cut down the system call overhead.

----------------------------------------------------------------------
   __        __  /|      Curt Jutzi (Jutz)      Tektronix Inc.
 ((__ \      \'o.O`      tektronix!pogo!curtj   Del. St. 63-356
    \\ !     =(___)=     (503) 685-3723         P.O. Box 1000 
     !!!        U                               Wilsonville,OR 97070
 o_OO   \   
 (___,  /    ACK! PHHT! 
  ___! !
 / .-! !   _)   "Life's an adventure.. go for it."
(_/ _/  \_/ \   "Make America beautiful, eat your beer cans."   
  _(   _(   /   "If time heals all wounds, how do you explain belly buttons?"
 (_(__(____)


	

dyer@spdcc.COM (Steve Dyer) (01/07/89)

In article <6552@pogo.GPID.TEK.COM> curtj@pogo.GPID.TEK.COM (Curt ) writes:
>I have 1.2 Meg, to send down through an I/O port.  Since I have to to
>an 'lseek' every time I wish to send a byte down to a specific port
>address, it takes an astronomical amount of time to send the data.
>Is there any way to cause READ/WRITE to NOT update the file pointer address
>when you execute them.  If not, HOW DO I GET HOLD OF THE i-node so that I
>can reset the file pointer to the proper address every time I issue a
>READ/WRITE.  I am trying to cut down the system call overhead.

Sounds like you're ready to graduate to a REAL device driver.
Believe me, you shouldn't be too concerned by the time being consumed
by the extra lseeks, which are very fast, anyway; the byte-at-a-time
paradigm is burning you as badly.  There really isn't a way to
"get hold of the i-node" (file pointer, actually) from userspace
to make the lseeks unnecessary; at least, no way more efficient than
just doing the lseeks.

If your device is a simple IO port with no capability of generating an
interrupt, a device driver is VERY simple (hell, it's simple anyway.)
The SCO documentation has a chapter on writing device drivers, with
examples for boilerplate.

-- 
Steve Dyer
dyer@ursa-major.spdcc.com aka {ima,harvard,rayssd,linus,m2c}!spdcc!dyer
dyer@arktouros.mit.edu