[U-Boot] [RFC][Timer API] Revised Specification - Implementation details

Graeme Russ graeme.russ at gmail.com
Thu Jun 16 08:27:00 CEST 2011


Hi Simon,

On Thu, Jun 16, 2011 at 3:53 PM, Simon Glass <sjg at chromium.org> wrote:
> Hi Graeme,
>
> On Wed, Jun 15, 2011 at 4:09 PM, Graeme Russ <graeme.russ at gmail.com> wrote:
> [snip]
>>>
>>> BTW should the deltas return a signed value?
>>
>> No - times are unsigned utilising the entire range of the u32 so (to -
>> from) will always returned the unsigned delta, even if there is a wrap
>> between them. I cannot imagine we would ever need to measure time backward
>> anyway.
>
> Can you please explain this again in different words as I don't
> follow. The difference between two unsigned times may be +ve or -ve,
> surely.  For example, say:
>
> now = 100
> event_time = 200
>
> then the delta is currently -100. Some people might loop until the
> delta is >= 0. This is like setting a future time and waiting for it
> to happen. If the delta is unsigned then this won't work.
>

start = 0xffffff00
now = 0x00000010

So there was a timer wrap between 'start' and 'now'

delta = now - start = 0x110

Remember that the new timer API does not rely on the tick counter (and
therefore the ms/us timers) to start at zero - It must be allowed to
wrap without causing timer glitches at any arbitray time

Regards,

Graeme


More information about the U-Boot mailing list