Dear Dirk Behme,

In message <1362387637-32334-1-git-send-email-dirk.be...@de.bosch.com> you 
wrote:
> From: Dirk Behme <dirk.be...@de.bosch.com>
> 
> Several ARM timer implementations use gd->arch.tbl to record the
> absolute tick count of 32-bit counters, including timer overflows.
> For example arch/arm/imx-common/timer.c does:
> 
> ulong lastinc;
> ulong now = counter value;
> if (no overflow) {
>       ...
> } else { /* counter overflow */
>       gd->arch.tbl += (0xFFFFFFFF - lastinc) + now;
> }
> lastinc =  now;
> 
> As we use a 32-bit counter and the two ulong (32-bit) variables 'lastinc'
> and 'now' here, gd->arch.tbl should be long long (64-bit) to not overflow
> at the same time, too.

I think this is wrong.

"tbl" means "time base, lower 32 bits" and is complemented by "tbu"
(time base, upper 32 bits) to form a 64 bit time base counter.

If you need the full 64 bit precision, then please either maintain the
carry manually, or use a proper union or similar.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
A consultant is a person who borrows your watch, tells you what  time
it is, pockets the watch, and sends you a bill for it.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to