Hi,
I need a calibrated delay of approx. 400ns for communicating with IDE
drives.
There are two possible options.
1. Use timer interrupts: I can use them if they are not going to be
used by any other components of the kernel. This also is not a good idea
because we frequently need to wait for 400ns in IDE -drive
communication. This will increase the number of interrupts. Probably
couple of them each time u try to access a sector.
2. Second is to use loop with NOP's in it and execute it to get
approximately a 400nsecond delay.
For eg. if NOP takes 4 clock cycles and my clock has 100ns duty cycle I
can get 400ns delay by putting 4 NOP in my delay loop.
This works fine if we assume all processors have 100ns clock duty
cycle...but this not the case because different versions of Intel/AMD
processors have different speeds.
If you guys have any Ideas regarding this let me know?? I will try to
look into Linux source reference how they handle such situations. I know
Linux uses something called BogoMIPS. But I am not sure how it works.
Let me know if you guys have some other amazing ideas to handle this
situation
Thanks,
Vishal
|