Le 14 janv. 09 à 15:46, Aurelien Jarno a écrit :
The current implementation of the milliseconds prom call on PowerPC is totally buggy:
- The timer frequency returned by get_timer_freq() does not correspond
to the timer which is read.
- The dividend and the divisor of the division are swapped
- If called very often, this function is not precise
- Depending on the timer frequency and of the frequency of the calls,
the variable overflow after a few dozen of seconds.
Please find in this patch a totally new implementation. This fixes the problem observed with the quik when a timeout is defined.
The timer frequency is defined using #define, I wonder if there is a better place to put it.
It reads both low and high part of the timer to make sure there is no overflow. It also removes the function that returns 0 on the first call as this is not needed according to IEEE 1275-1994. Finally it computes the real value of the timer each time, instead of adding a small value to a variable at each function calls, in order to get a correct precision if this method is call very often.
Applied as r407, thanks.
Laurent -------------------- laurent@lvivier.info -------------------- "Tout ce qui est impossible reste à accomplir" Jules Verne "Things are only impossible until they're not" Jean-Luc Picard