"Richard A. Smith" <[EMAIL PROTECTED]> writes: > On 10 Apr 2002 21:21:47 -0600, Eric W. Biederman wrote: > > > > >Also I'm not at all a fan of inb_p/outb_p. I get the feeling > >sometimes there is deep magic involved, in the pause length selected. > >Or even if the pause is what is really desired. At least so far I > >haven't heard a clear explination of what the gain of outputing a > >value to another port is. > > Are you talking outs for a delay?
Roughly. But very specifically about the linux kernel functions inb_p/outb_p that insert a write to port 0x80 for their delay. I'm certain inserting a short delay between operations is the primary effect of the inb_p/outb_p functions write to port 0x80. But they seem to have some deeper magic significance as well. Something to do with reliability in older systems. Linus commented that if I have a pci post card I shouldn't need to worry about it. Comments like: this functions uses inb_p/outb_p because it must work on a lot of hardware. etc. So it is clear to me that while a timing delay is part of what inb_p/outb_p provide there is some other magic involved. So while I don't have a problem with using port 0x80 or port 0xeb for a short delay. Reusing the kernel functions inb_p/outb_p looks like a very bad idea. > If so then idea behind delays based on port writes is that they go to > the ISA bus which has a _mostly_ fixed clock frequency so the elapsed > time is independent of CPU clock speed and/or CPU flavor. It also > won't get jacked with by the optimizer. > > In practice I don't know if it holds up or not. Especially with > these newer chipsets. I have used it in a Windows program I wrote to > program PIC microcontrolers where I needed to create delays around 1 > uS and I didn't want to mess with figureing out all the nuances of > the multi-media timer system. A standard sleep was _way_ too long. > > Got a few copies of the program out in the field and it seems to work > on several machines of differenet speeds. And this is what really worries me about it. Will this continue to work. Will this really reach the ISA bus. If it doesn't reach the ISA bus how will the timing change? I don't have a problem with a udelay() that just does an inb/outb for timing reasons but... Eric