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

Albert ARIBAUD albert.u.boot at aribaud.net
Mon May 23 20:24:47 CEST 2011


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.


More information about the U-Boot mailing list