
Dear Lee Jones,
In message 1353422034-28107-2-git-send-email-lee.jones@linaro.org you wrote:
If we attempt to take a 32bit timer value and multiply it by a significant number, the core will not be able to handle it. This gives the illusion that the timer is rolling over, when in fact this is not the case. If we ensure the division in this instance is carried out before the multiplication, the issue vanishes.
Are you sure this is a good idea?
--- a/arch/arm/cpu/armv7/u8500/timer.c +++ b/arch/arm/cpu/armv7/u8500/timer.c @@ -70,7 +70,7 @@ struct u8500_mtu {
- The MTU is clocked at 133 MHz by default. (V1 and later)
*/ #define TIMER_CLOCK (133 * 1000 * 1000 / 16) -#define COUNT_TO_USEC(x) ((x) * 16 / 133) +#define COUNT_TO_USEC(x) ((x) / 133 * 16)
Before the change, the result is useful for all values of x in the interval from 0 through UINT_MAX/16 = 268435455 = 268 seconds, i. e. for all values that make sense to be measured in microseconds.
After the change, the result is changed to the worse for all low values of X, especially for the ranges from 16 through 132.
You lose accuracy here, and win nothing.
This makes no sense to me.
If you need a bigger number range, then use proper arithmetics. It';s available, just use it.
Best regards,
Wolfgang Denk