[U-Boot] [RFC][Timer API] Revised Specification - Implementation details
Reinhard Meyer
u-boot at emk-elektronik.de
Tue May 31 06:53:16 CEST 2011
Dear Simon Glass,
> On Mon, May 30, 2011 at 5:24 PM, Graeme Russ<graeme.russ at gmail.com> wrote:
>> Hi Reinhard,
>>
>> On Tue, May 31, 2011 at 4:57 AM, Reinhard Meyer
> ...
>>> make_timeout() can be arch/soc/platform specific and take into account to return at least
>>> such a value that the timeout is never cut short. (In case of a 10 ms NIOS timer,
>>> make_timeout(5) would have to return the value 20, resulting in a real timeout of at least
>>> 10 ms but upto 20 ms )
>>
>> What about this:
>>
>> u32 start = get_timer();
>>
>> while (!timer_expired(start, timeout))
>> ...
>>
>
> Hi Graham,
>
> I like this, although I have a small preference for:
>
> u32 stop = time_get_future_ms(1234);
>
> while (!time_reached(stop))
> ..
I would perfectly like such a solution, it is equivalent to what I have been proposing
almost a year ago!
>
> since it possibly means the processing happens up front. However any
> such function is good and I hope you can add it to your API.
Exactly! And (saying it silently) this would not mandate that the now hidden internal
timer needs to be in ms units, it could be the bare "natural" tick of the hardware...
Making time_get_future() to return the "tick" (in whatever granularity) that has to
be passed would reduce time_reached() to a very simple function.
But I get the feeling that exactly this simplicity of above concept is the problem
for people that have the urge to invent elaborate and complicated solutions ;)
Regards,
Reinhard
More information about the U-Boot
mailing list