[U-Boot] [PATCH 2/2] sandbox: convert to common time functions
Rob Herring
robherring2 at gmail.com
Fri Nov 8 18:18:15 CET 2013
On Fri, Nov 8, 2013 at 10:32 AM, Simon Glass <sjg at chromium.org> wrote:
> Hi Rob,
>
> On Fri, Nov 8, 2013 at 7:40 AM, Rob Herring <robherring2 at gmail.com> wrote:
>> From: Rob Herring <rob.herring at calxeda.com>
>>
>> Convert sandbox to use common time functions.
>>
>> Signed-off-by: Rob Herring <rob.herring at calxeda.com>
>> ---
>> board/sandbox/sandbox/sandbox.c | 14 ++------------
>> include/configs/sandbox.h | 2 ++
>> 2 files changed, 4 insertions(+), 12 deletions(-)
>>
>> diff --git a/board/sandbox/sandbox/sandbox.c b/board/sandbox/sandbox/sandbox.c
>> index f471cb7..65dcce8 100644
>> --- a/board/sandbox/sandbox/sandbox.c
>> +++ b/board/sandbox/sandbox/sandbox.c
>> @@ -18,19 +18,9 @@ void flush_cache(unsigned long start, unsigned long size)
>> {
>> }
>>
>> -ulong get_tbclk(void)
>> +unsigned long timer_read_counter(void)
>> {
>> - return CONFIG_SYS_HZ;
>> -}
>> -
>> -unsigned long long get_ticks(void)
>> -{
>> - return get_timer(0);
>> -}
>> -
>> -ulong get_timer(ulong base)
>> -{
>> - return (os_get_nsec() / 1000000) - base;
>> + return os_get_nsec() / 1000;
>
> Doesn't this change the time base to microseconds? It would be good to
> keep sandbox at milliseconds like other boards. Or did I miss the
> reason for this change?
get_timer is still millisec. get_ticks is the "raw" counter ticks
which is in microsec for sandbox. Some boards are equal here and some
are not. The advantage of the latter is udelay has better resolution.
However, in the case of sandbox, it uses the OS usleep so this doesn't
matter.
Rob
More information about the U-Boot
mailing list