Sleep about one microsecond and outb on 0x80

Hello, I want to use delays of 1 microsend on linux 2.4 or linux 2.6 kernel on x386 platform.

As we know, usleep depends on the HZ of the system.

So both in 2.4 and in 2.6 we cannot achieve 1 microsec delay calling udelay (the man page of usleep says itslef that "Probably not accurate on many machines down to the microsecond.").

According to "Linux I/O port programming mini-HOWTO"

formatting link
you can use outb on 0x80 to create a dealy.

So I added this snippest of code and trird to use outb('a',0x80) for creating a sleep time in resolution of microseconds thus: ............

ioperm(0x80, 1, 1);

for (i=0;iFrom this results it seems that I cannot rely on this outb() for creating a microsec delay because it gives such different results on different machines. However , the results seems strange : I have 2 almost similiar machines : one gave 2.16 and one gave 1.4

Could it be that something in that machine caused it to do it slower and gicv 2.16 microsec as an average?

I must empasize that "top" showed that there did not run something heavy on both these machines.(in terms of cpu and memory)

Any idea?

John Que

Reply to
qwejohn
Loading thread data ...

schreef in bericht news: snipped-for-privacy@g44g2000cwa.googlegroups.com...

You can tune the loop by using the accurate timer.

How many times did you run the test? What is the spread of the results?

Reply to
Boudewijn Dijkstra

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.