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

Graeme Russ graeme.russ at gmail.com
Wed May 25 15:14:48 CEST 2011


On Wednesday, May 25, 2011, Wolfgang Denk <wd at denx.de> wrote:
> Dear Graeme Russ,
>
> In message <4DDCF926.1050904 at gmail.com> you wrote:
>>
>> Many platforms have a hardware counter which is incremented without
>> assistance from software - not by an ISR, nothing (I mentioned this before,
>> but I can't track down the exact email) - THIS is the tick counter returned
>> by get_ticks() which the prescaler uses to update the timer when you either:
>>
>>  - Explicitly call get_timer()
>>  - Call the prescaler from an ISR
>>
>> The thing is, I have now highlighted that relying on interrupts to keep
>> get_timer() working is a really bad idea - We have no way of stopping
>> anyone from calling disable_interrupts() before using the timer
>
> There may be code which doe snot call get_timer() for _long_ times.
> And somebody disables interrupts. What's then?
>
We're hosed, but at least we are one better than relying on interrupts alone ;)

And what about platforms that do not support interrupts? Are you
mandating that get_timer() MUST always be supported by a timer updated
by an ISR?

Regards,

Graeme


More information about the U-Boot mailing list