[U-Boot] [RFC] Review of U-Boot timer API

Wolfgang Denk
2011-05-25T11:37:38Z

Dear Graeme Russ,

In message <4DDCBFF4.40002@gmail.com> you wrote:
>
> > I don't get you. In such a system, the interrupt would be the tick
> > (see the PPC implementation). If you miss interrupts, you miss ticks.
>
> Yes, you miss ticks, but if the hardware is keeping the tick counter
> current in the background (i.e. without software or interrupts) then this
> does not matter - The prescaler takes care of this...

I think you don't want to understand.

Look at the PPC implementation. The decrementer causes an interrupt
every millisecond. This is our tick. We never ever actually read the
decrementer register itself. We just use the interrupt.

> The key is the prescaler takes a 'tick delta' between the last time it was
> called and now, uses the 'tick frequency' to calculate a corresponding
> 'timer delta' which it adds to the current timer

The "tick frequency" in above example is 1,000 Hz, and determined by
the frequency of the interrupts. There is not any "timer count
register" we are accessing here.

> This relies on the tick counter wrapping properly.

The "tick counter" is already in the higher level, i. e. implemented
in software, without any hardware based registers.

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: wd at denx.de
Diplomacy is the art of saying "nice doggy" until you can find a rock.