udelay accuracy
FYA,
Here's some data on the accuracy of udelay().
Test was read cr16, udelay(x), read cr16, print cr16 delta. I collected this from my A180.
Numbers on the right of the ":" is the cr16 delta.
udelay test 10 : 2023 1896 1896 1896 1896 1896 1896 1896 1896 1896 udelay test 20 : 3731 3681 3681 3681 3681 3681 3681 3681 3681 3681 udelay test 30 : 5507 5472 5472 5472 5472 5472 5472 5472 5472 5472 udelay test 100 : 18028 17967 17967 17967 17967 17967 17967 17967 17967 17967 udelay test 200 : 35885 35815 35815 35815 35815 35815 35815 35815 35815 35815 udelay test 300 : 53665 53665 53665 53665 53665 53665 53665 53665 53665 53665 udelay test 1000 : 178615 178615 178615 178615 178615 178615 178615 178615 178615 178615 udelay test 2000 : 357115 357115 357115 357115 357115 357115 357115 357115 357115 357115 udelay test 3000 : 535615 538451 535615 535615 535615 535615 535615 535615 535615 535615
Expected output for "180Mhz" machine:
udelay(10) 1800 udelay(20) 3600 ... udelay(3000) 540000
The difference between the first invocation and successive might be a problem. I don't know what the expected accuracy is.
If +- 10% is ok, we are there.
grant
ps. thanks to ftr for helping figure out the expected values.
page zero (0x38c) contains the number of cycles per 10ms
for every box. This can be accessed from the A180
service menu: "mr 0x38c 2"Quoted 5 lines
udelay(3000) 540000The difference between the first invocation and successive might be a problem. I don't know what the expected accuracy is.
If +- 10% is ok, we are there.
Its generally good enough. Certainly on PC type hardware which is sloppy anyway If its ever an issue just bump the estimate by 10% on all udelays to be sure 8)