avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avrdude-dev] Parallel port doesn't keep programmed states


From: Joerg Wunsch
Subject: Re: [avrdude-dev] Parallel port doesn't keep programmed states
Date: Wed, 26 Nov 2003 15:46:06 +0100
User-agent: Mutt/1.2.5i

> We just had a discussion about making SPI-drivers for UNIX systems. 
> This would reduce the overhead for system calls. Right now, we are 
> doing 32 ioctl()-calls to transfer a single byte to/from the 
> parallel-port. With a driver there would be only one call per byte 
> ;-)

Perhaps even less, like one read() or write() call per 16 (or 256 or
whatever) bytes.  This would make a lot of sense in particular for
page-oriented devices.

> IMHO, this is not a trivial task.

Yes, probably. ;)

> The hardest thing will be the 
> generation of exact timings.

Typically, the Unix kernels we're talking about here do provide some
kind of time-keeping in the kernel that can be used.  However, the
granularity of these timers might be too coarse.  Assuming the typical
``HZ=100'' approach, the typical loop like

for (...) {
  set up data byte
  trigger edge
  tsleep(0);
  trigger edge
  tsleep(0);
}

would at best result in 20 ms per byte.  So either a finer-grained
timer would be needed, or just use spin loops (which is not good
because it doesn't release the CPU).

The FreeBSD kernel has a function called DELAY() which is supposed
to produce a micrsecond-timed delay (using the 8254-compliant timer
on IA32 architectures).  Using DELAY(1) between each of the IO
operations ought to be enough.

Does Linux have something comparable?
-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]