[U-Boot] RFC: get_ticks() + get_tbclk()

Reinhard Meyer u-boot at emk-elektronik.de
Tue Sep 21 07:52:47 CEST 2010


Hello,

it is my understanding that get_ticks() shall return the count of
a free running (hardware) counter that increments by a total of
get_tbclk() every second. Both functions are long long.

I also understand that this counter does not necessarily increment at
a rate of CONFIG_SYS_HZ, but at a hardware determined, usually much
higher rate.

Is that understanding correct so far?

Looking at the current implementations of those functions, it seems that
in some cases those two functions do not work in coherence.
Most get_tbclk() implementations plainly return CONFIG_SYS_HZ without
assuring that the timer is programmed to run at that rate.

Some do not work with long long values so there might be a small window
where 0x0000ffff wraps back to 0x00000000 and a programmed timeout will
fail.

Reinhard


More information about the U-Boot mailing list