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

Albert ARIBAUD
2011-05-23T18:24:47Z

Le 23/05/2011 19:30, J. William Campbell a ?crit :

>> Did you have a look at the PowerPC implementation? I'd like to see
>> this used as reference.

> I have looked at it as a reference. However, there is one disadvantage
> in using the PPC code as a reference. It has a 64 bit timestamp. Many
> systems do not have a 64 bit timestamp, but rather a 32 bit timestamp.
> It is possible to extend the 32 bit timestamp to a 64 bit timestamp if
> get_timer is called often enough that there will only be a single
> rollover of the bottom 32 bits between uses. However, if that condition
> is met, there is no need to extend the timer to 64 bits.

Well, there is one: making sure that drivers do not need to know if
timestamps are 32 or 64 bits, or even what resolution they are.

Granted, you could define a timestamp_t type to be either u32 or u64
depending on the actual timestamp width, so that the driver would not
need to know the details; but extending u32 to u64, or subtracting two
u64 values, are not so much of an effort, and that would mean a single API.

Amicalement,
--
Albert.